aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp48
-rw-r--r--src/server/game/Entities/Unit/Unit.h2
-rw-r--r--src/server/game/Spells/Spell.cpp2
3 files changed, 26 insertions, 26 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 4a7bee546fa..324a44646ec 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -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
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 4ad89f1ce6e..0b01aad923a 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -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);
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 74baf6338c8..ae80cf47590 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -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);