diff --git a/src/Battling/Models/Creature.cpp b/src/Battling/Models/Creature.cpp index 1309bc5..733b76f 100644 --- a/src/Battling/Models/Creature.cpp +++ b/src/Battling/Models/Creature.cpp @@ -302,13 +302,14 @@ namespace CreatureLib::Battling { bool Creature::HasVolatileScript(const ArbUt::BasicStringView& name) const { return _volatile.Has(name); } void Creature::AddAttack(LearnedAttack* attack) { for (size_t i = 0; i < _attacks.Count(); i++) { - if (_attacks[i] == nullptr) { + if (!_attacks[i].HasValue()) { _attacks.Set(i, attack); return; } } if (_attacks.Count() < _library->GetStaticLib()->GetSettings()->GetMaximalAttacks()) { _attacks.Append(attack); + return; } THROW("Can't add attack. The creature already has the maximum amount of attacks."); }