Skip to content

Commit

Permalink
PetAI: Minor refactor of autocast conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
deiteris committed Nov 3, 2023
1 parent 5c35cee commit cef9c11
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/game/AI/BaseAI/PetAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,6 @@ std::pair<Unit*, Spell*> PetAI::PickSpellWithTarget(Unit* owner, Unit* victim, C

return { m_unit, spell };
}
// Cast a spell on the victim in case the spell can be targeted at anyone
// IsSpellRequireTarget() check is not really required since AoE spells (like Thunderstomp)
// don't require target but need to be targeted at specific victim for distance check.
else if (victim && spell->CanAutoCast(victim))
return { victim, spell };
// Try to cast a spell if the spell is AoE
else if (IsAreaOfEffectSpell(spellInfo))
{
Expand Down Expand Up @@ -334,6 +329,9 @@ std::pair<Unit*, Spell*> PetAI::PickSpellWithTarget(Unit* owner, Unit* victim, C
// In all other cases, try to find a good use for the spell
else
{
// Cast a spell on the victim, if present
if (victim && spell->CanAutoCast(victim))
return { victim, spell };
// Cast the spell on self, if applicable
if (spell->CanAutoCast(m_unit))
return { m_unit, spell };
Expand Down

0 comments on commit cef9c11

Please sign in to comment.