Core/Misc: Rename Unit::AttackedTarget to Unit::AtTargetAttacked to match naming scheme for these notifiers

# Conflicts:
#	src/server/game/Entities/Unit/Unit.cpp
#	src/server/game/Spells/Spell.cpp
This commit is contained in:
Treeston authored and Ovahlord committed 2020-07-22 18:07:24 +02:00
1 parent e07f4f9dc2
commit e54f8ca4f7
3 files changed
+27 -21

No files matched your search

+24 -19
View File
@@ -2078,7 +2078,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(AURA_INTERRUPT_FLAG_MELEE_ATTACK);
if (attType != BASE_ATTACK && attType != OFF_ATTACK)
@@ -8406,24 +8406,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);
Player* myPlayerOwner = GetCharmerOrOwnerPlayerOrPlayerItself();
Player* targetPlayerOwner = target->GetCharmerOrOwnerPlayerOrPlayerItself();
if (myPlayerOwner && targetPlayerOwner && !(myPlayerOwner->duel && myPlayerOwner->duel->opponent == targetPlayerOwner))
{
myPlayerOwner->UpdatePvP(true);
myPlayerOwner->SetContestedPvP(targetPlayerOwner);
myPlayerOwner->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
}
void Unit::SetImmuneToAll(bool apply, bool keepCombat)
{
if (apply)
@@ -9264,6 +9246,29 @@ void Unit::AtExitCombat()
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LEAVE_COMBAT);
}
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(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
}
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