Core/Units: removed deprecated fake attacker state update from the core

This commit is contained in:
Ovahlord committed 2021-11-17 17:18:05 +01:00
1 parent 7840a8f529
commit 373a296b8d
5 files changed
+3 -72

No files matched your search

+2 -10
View File
@@ -71,21 +71,13 @@ void UnitAI::DoMeleeAttackIfReady()
//Make sure our attack is ready and we aren't currently casting before checking distance
if (me->isAttackReady())
{
if (ShouldSparWith(victim))
me->FakeAttackerStateUpdate(victim);
else
me->AttackerStateUpdate(victim);
me->AttackerStateUpdate(victim);
me->resetAttackTimer();
}
if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK))
{
if (ShouldSparWith(victim))
me->FakeAttackerStateUpdate(victim, OFF_ATTACK);
else
me->AttackerStateUpdate(victim, OFF_ATTACK);
me->AttackerStateUpdate(victim, OFF_ATTACK);
me->resetAttackTimer(OFF_ATTACK);
}
}
-3
View File
@@ -315,9 +315,6 @@ class TC_GAME_API UnitAI
void DoCastAOE(uint32 spellId, CastSpellExtraArgs const& args = {}) { DoCast(nullptr, spellId, args); }
float DoGetSpellMaxRange(uint32 spellId, bool positive = false);
virtual bool ShouldSparWith(Unit const* /*target*/) const { return false; }
void DoMeleeAttackIfReady();
bool DoSpellAttackIfReady(uint32 spell);
-52
View File
@@ -2121,49 +2121,6 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr
}
}
void Unit::FakeAttackerStateUpdate(Unit* victim, WeaponAttackType attType /*= BASE_ATTACK*/)
{
if (HasUnitState(UNIT_STATE_CANNOT_AUTOATTACK) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
return;
if (!victim->IsAlive())
return;
if ((attType == BASE_ATTACK || attType == OFF_ATTACK) && !IsWithinLOSInMap(victim))
return;
AtTargetAttacked(victim, true);
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::Attacking);
if (attType != BASE_ATTACK && attType != OFF_ATTACK)
return; // ignore ranged case
if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) && !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN))
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
CalcDamageInfo damageInfo;
damageInfo.attacker = this;
damageInfo.target = victim;
damageInfo.damageSchoolMask = GetMeleeDamageSchoolMask();
damageInfo.attackType = attType;
damageInfo.damage = 0;
damageInfo.cleanDamage = 0;
damageInfo.absorb = 0;
damageInfo.resist = 0;
damageInfo.blocked_amount = 0;
damageInfo.TargetState = VICTIMSTATE_HIT;
damageInfo.HitInfo = HITINFO_AFFECTS_VICTIM | HITINFO_NORMALSWING | HITINFO_FAKE_DAMAGE;
if (attType == OFF_ATTACK)
damageInfo.HitInfo |= HITINFO_OFFHAND;
damageInfo.procAttacker = PROC_FLAG_NONE;
damageInfo.procVictim = PROC_FLAG_NONE;
damageInfo.hitOutCome = MELEE_HIT_NORMAL;
SendAttackStateUpdate(&damageInfo);
}
void Unit::HandleProcExtraAttackFor(Unit* victim)
{
while (m_extraAttacks)
@@ -13471,8 +13428,6 @@ void Unit::_ExitVehicle(Position const* exitPosition)
else
ToTempSummon()->UnSummon(2000); // Approximation
}
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::AbandonVehicle);
}
bool Unit::IsFalling() const
@@ -13803,13 +13758,6 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel
_positionUpdateInfo.Relocated = relocated;
_positionUpdateInfo.Turned = turn;
bool isInWater = IsInWater();
if (!IsFalling() || isInWater || IsFlying())
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::Ground);
if (isInWater)
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::Swimming);
return (relocated || turn);
}
+1 -2
View File
@@ -1047,8 +1047,7 @@ class TC_GAME_API Unit : public WorldObject
void TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, AuraApplicationProcContainer& procAuras);
void HandleEmoteCommand(uint32 anim_id);
void AttackerStateUpdate (Unit* victim, WeaponAttackType attType = BASE_ATTACK, bool extra = false);
void FakeAttackerStateUpdate(Unit* victim, WeaponAttackType attType = BASE_ATTACK);
void AttackerStateUpdate(Unit* victim, WeaponAttackType attType = BASE_ATTACK, bool extra = false);
void CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* damageInfo, WeaponAttackType attackType = BASE_ATTACK);
void DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss);
@@ -1162,11 +1162,6 @@ class npc_thorim_pre_phase : public CreatureScript
thorim->AI()->DoAction(ACTION_INCREASE_PREADDS_COUNT);
}
bool ShouldSparWith(Unit const* target) const override
{
return !target->GetAffectingPlayer();
}
void DamageTaken(Unit* attacker, uint32& damage) override
{
// nullify spell damage