aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Deutscher <adeutscher@gmail.com>2016-05-18 02:06:24 -0700
committerShauren <shauren.trinity@gmail.com>2016-05-18 11:06:24 +0200
commite7a12edb833ffe26f27d6e392e97a560ffb0c827 (patch)
tree384e98e58acfc345e9b7a683556c7b76370e85a9
parent6cf1446d39db994cdca2db8f7f61da8423672bb3 (diff)
Core/Spells Make certain spells (e.g. Mind Control) properly flag the caster for PvP (#17145)
* This issue was caused by PvP-flagging being done calculated after the target's flag was turned off by becoming a pet.
-rw-r--r--src/server/game/Spells/Spell.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 4176e8fb20e..c2a7e671507 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -2320,8 +2320,13 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
}
}
+ bool enablePvP = false; // need to check PvP state before spell effects, but act on it afterwards
+
if (spellHitTarget)
{
+ // if target is flagged for pvp also flag caster if a player
+ if (unit->IsPvP() && m_caster->GetTypeId() == TYPEID_PLAYER)
+ enablePvP = true; // Decide on PvP flagging now, but act on it later.
SpellMissInfo missInfo2 = DoSpellHitOnUnit(spellHitTarget, mask, target->scaleAura);
if (missInfo2 != SPELL_MISS_NONE)
{
@@ -2474,8 +2479,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
// Needs to be called after dealing damage/healing to not remove breaking on damage auras
DoTriggersOnSpellHit(spellHitTarget, mask);
- // if target is fallged for pvp also flag caster if a player
- if (unit->IsPvP() && m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (enablePvP)
m_caster->ToPlayer()->UpdatePvP(true);
CallScriptAfterHitHandlers();