mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/AI: added a function to allow 0 damage attacks (sparring) depending on target
(cherry picked from commit 3a2ecaa05f)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user