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

This commit is contained in:
ariel-
2017-04-26 04:16:32 -03:00
parent 486b032343
commit 3a2ecaa05f
2 changed files with 10 additions and 2 deletions

View File

@@ -59,14 +59,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

@@ -290,6 +290,8 @@ class TC_GAME_API UnitAI
float DoGetSpellMaxRange(uint32 spellId, bool positive = false);
virtual bool ShouldSparWith(Unit const* /*target*/) const { return false; }
void DoMeleeAttackIfReady();
bool DoSpellAttackIfReady(uint32 spell);