Skip to content

Commit 334446b

Browse files
committed
PetAI: Minor refactor of autocast conditions
1 parent 95fa94a commit 334446b

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/game/AI/BaseAI/PetAI.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,6 @@ std::pair<Unit*, Spell*> PetAI::PickSpellWithTarget(Unit* owner, Unit* victim, C
299299

300300
return { m_unit, spell };
301301
}
302-
// Cast a spell on the victim in case the spell can be targeted at anyone
303-
// IsSpellRequireTarget() check is not really required since AoE spells (like Thunderstomp)
304-
// don't require target but need to be targeted at specific victim for distance check.
305-
else if (victim && spell->CanAutoCast(victim))
306-
return { victim, spell };
307302
// Try to cast a spell if the spell is AoE
308303
else if (IsAreaOfEffectSpell(spellInfo))
309304
{
@@ -334,6 +329,9 @@ std::pair<Unit*, Spell*> PetAI::PickSpellWithTarget(Unit* owner, Unit* victim, C
334329
// In all other cases, try to find a good use for the spell
335330
else
336331
{
332+
// Cast a spell on the victim, if present
333+
if (victim && spell->CanAutoCast(victim))
334+
return { victim, spell };
337335
// Cast the spell on self, if applicable
338336
if (spell->CanAutoCast(m_unit))
339337
return { m_unit, spell };

0 commit comments

Comments
 (0)