diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-04-26 04:16:32 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2017-04-26 04:16:32 -0300 |
commit | 3a2ecaa05f0a3da96b3d4a0bec44175d6a7dda6a (patch) | |
tree | 2b45de0b28f3ea3dcf37a2cc86ed50b3e3136319 /src | |
parent | 486b03234304526d8f7d66ff0d99ea3de975745e (diff) |
Core/AI: added a function to allow 0 damage attacks (sparring) depending on target
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 4f0c05429d5..055abc99d96 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -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); } diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 6a6c3aa5ea9..98e2ca1f444 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -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); |