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