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:
1 parent
e07f4f9dc2
commit
e54f8ca4f7
3 files changed
+27
-21
No files matched your search
@@ -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
|
||||
|
||||
@@ -1241,7 +1241,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);
|
||||
|
||||
@@ -2700,7 +2700,8 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
||||
// spellHitTarget can be null if spell is missed in DoSpellHitOnUnit
|
||||
if (missInfo != SPELL_MISS_EVADE && spellHitTarget && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)))
|
||||
{
|
||||
m_caster->AttackedTarget(unit, m_spellInfo->HasInitialAggro());
|
||||
if (Unit* unitCaster = spell->m_caster->ToUnit())
|
||||
unitCaster->AtTargetAttacked(unit, spell->m_spellInfo->HasInitialAggro());
|
||||
|
||||
if (!unit->IsStandState())
|
||||
unit->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
|
||||
Reference in new issue
Block a user