Core/AI: added a function to allow 0 damage attacks (sparring) depending on target

(cherry picked from commit 3a2ecaa05f)
This commit is contained in:
ariel-
2017-04-26 04:16:32 -03:00
committed by funjoker
parent 49f25f6e33
commit bb3f2a11cf
2 changed files with 10 additions and 2 deletions

View File

@@ -65,14 +65,20 @@ void UnitAI::DoMeleeAttackIfReady()
//Make sure our attack is ready and we aren't currently casting before checking distance
if (me->isAttackReady())
{
me->AttackerStateUpdate(victim);
if (ShouldSparWith(victim))
me->FakeAttackerStateUpdate(victim);
else
me->AttackerStateUpdate(victim);
me->resetAttackTimer();
}
if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK))
{
me->AttackerStateUpdate(victim, OFF_ATTACK);
if (ShouldSparWith(victim))
me->FakeAttackerStateUpdate(victim, OFF_ATTACK);
else
me->AttackerStateUpdate(victim, OFF_ATTACK);
me->resetAttackTimer(OFF_ATTACK);
}

View File

@@ -265,6 +265,8 @@ class TC_GAME_API UnitAI
void DoCastVictim(uint32 spellId, bool triggered = false);
void DoCastAOE(uint32 spellId, bool triggered = false);
virtual bool ShouldSparWith(Unit const* /*target*/) const { return false; }
void DoMeleeAttackIfReady();
bool DoSpellAttackIfReady(uint32 spellId);