Core/Misc: Rename Unit::AttackedTarget to Unit::AtTargetAttacked to match naming scheme for these notifiers
(cherry picked from commit 632a300dd20aad9663392c2f21a8ed29ffee1ef7)
This commit is contained in:
@@ -1970,7 +1970,7 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr
|
||||
if ((attType == BASE_ATTACK || attType == OFF_ATTACK) && !IsWithinLOSInMap(victim))
|
||||
return;
|
||||
|
||||
AttackedTarget(victim, true);
|
||||
AtTargetAttacked(victim, true);
|
||||
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::Attacking);
|
||||
|
||||
if (attType != BASE_ATTACK && attType != OFF_ATTACK)
|
||||
@@ -7659,29 +7659,6 @@ void Unit::EngageWithTarget(Unit* enemy)
|
||||
SetInCombatWith(enemy);
|
||||
}
|
||||
|
||||
void Unit::AttackedTarget(Unit* target, bool canInitialAggro)
|
||||
{
|
||||
if (!target->IsEngaged() && !canInitialAggro)
|
||||
return;
|
||||
target->EngageWithTarget(this);
|
||||
if (Unit* targetOwner = target->GetCharmerOrOwner())
|
||||
targetOwner->EngageWithTarget(this);
|
||||
|
||||
//Patch 3.0.8: All player spells which cause a creature to become aggressive to you will now also immediately cause the creature to be tapped.
|
||||
if (Creature* creature = target->ToCreature())
|
||||
if (!creature->hasLootRecipient() && GetTypeId() == TYPEID_PLAYER)
|
||||
creature->SetLootRecipient(this);
|
||||
|
||||
Player* myPlayerOwner = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
Player* targetPlayerOwner = target->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (myPlayerOwner && targetPlayerOwner && !(myPlayerOwner->duel && myPlayerOwner->duel->Opponent == targetPlayerOwner))
|
||||
{
|
||||
myPlayerOwner->UpdatePvP(true);
|
||||
myPlayerOwner->SetContestedPvP(targetPlayerOwner);
|
||||
myPlayerOwner->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::PvPActive);
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SetImmuneToAll(bool apply, bool keepCombat)
|
||||
{
|
||||
if (apply)
|
||||
@@ -8233,6 +8210,29 @@ void Unit::AtExitCombat()
|
||||
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::LeavingCombat);
|
||||
}
|
||||
|
||||
void Unit::AtTargetAttacked(Unit* target, bool canInitialAggro)
|
||||
{
|
||||
if (!target->IsEngaged() && !canInitialAggro)
|
||||
return;
|
||||
target->EngageWithTarget(this);
|
||||
if (Unit* targetOwner = target->GetCharmerOrOwner())
|
||||
targetOwner->EngageWithTarget(this);
|
||||
|
||||
//Patch 3.0.8: All player spells which cause a creature to become aggressive to you will now also immediately cause the creature to be tapped.
|
||||
if (Creature* creature = target->ToCreature())
|
||||
if (!creature->hasLootRecipient() && GetTypeId() == TYPEID_PLAYER)
|
||||
creature->SetLootRecipient(this);
|
||||
|
||||
Player* myPlayerOwner = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
Player* targetPlayerOwner = target->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (myPlayerOwner && targetPlayerOwner && !(myPlayerOwner->duel && myPlayerOwner->duel->Opponent == targetPlayerOwner))
|
||||
{
|
||||
myPlayerOwner->UpdatePvP(true);
|
||||
myPlayerOwner->SetContestedPvP(targetPlayerOwner);
|
||||
myPlayerOwner->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::PvPActive);
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::UpdatePetCombatState()
|
||||
{
|
||||
ASSERT(!IsPet()); // player pets do not use UNIT_FLAG_PET_IN_COMBAT for this purpose - but player pets should also never have minions of their own to call this
|
||||
|
||||
@@ -1107,7 +1107,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
// Combat handling
|
||||
CombatManager& GetCombatManager() { return m_combatManager; }
|
||||
CombatManager const& GetCombatManager() const { return m_combatManager; }
|
||||
void AttackedTarget(Unit* target, bool canInitialAggro);
|
||||
void AtTargetAttacked(Unit* target, bool canInitialAggro);
|
||||
|
||||
bool IsImmuneToAll() const { return IsImmuneToPC() && IsImmuneToNPC(); }
|
||||
void SetImmuneToAll(bool apply, bool keepCombat);
|
||||
|
||||
@@ -2620,7 +2620,7 @@ void Spell::TargetInfo::DoDamageAndTriggers(Spell* spell)
|
||||
if (MissCondition != SPELL_MISS_EVADE && _spellHitTarget && !spell->m_caster->IsFriendlyTo(unit) && (!spell->IsPositive() || spell->m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)))
|
||||
{
|
||||
if (Unit* unitCaster = spell->m_caster->ToUnit())
|
||||
unitCaster->AttackedTarget(unit, spell->m_spellInfo->HasInitialAggro());
|
||||
unitCaster->AtTargetAttacked(unit, spell->m_spellInfo->HasInitialAggro());
|
||||
|
||||
if (!unit->IsStandState())
|
||||
unit->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
|
||||
Reference in New Issue
Block a user