diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-04-26 04:16:32 -0300 |
---|---|---|
committer | funjoker <funjoker109@gmail.com> | 2020-04-28 14:05:16 +0200 |
commit | bb3f2a11cfa909a0b40450050f33a3893f6bb061 (patch) | |
tree | c5eb258076aac7494d98d1e5b21536f470eff113 /src | |
parent | 49f25f6e33aa4b4f67a46ba3cb71a183570da67e (diff) |
Core/AI: added a function to allow 0 damage attacks (sparring) depending on target
(cherry picked from commit 3a2ecaa05f0a3da96b3d4a0bec44175d6a7dda6a)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/CoreAI/UnitAI.cpp | 10 | ||||
-rw-r--r-- | src/server/game/AI/CoreAI/UnitAI.h | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 21d15731b11..124361f0c07 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -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); } diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 0145233e3c9..9ffee6c146c 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -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); |