Skip to content

Commit f0e0768

Browse files
committed
PetAI: Minor refactor of autocast conditions
1 parent 683c7da commit f0e0768

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,14 +299,12 @@ 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
// In all other cases, try to find a good use for the spell
308303
else
309304
{
305+
// Cast a spell on the victim, if present
306+
if (victim && spell->CanAutoCast(victim))
307+
return { victim, spell };
310308
// Cast the spell on self, if applicable
311309
if (spell->CanAutoCast(m_unit))
312310
return { m_unit, spell };

0 commit comments

Comments
 (0)