aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinnaix <37972361+Jinnaix@users.noreply.github.com>2022-06-09 11:33:30 +0200
committerShauren <shauren.trinity@gmail.com>2022-06-10 19:25:31 +0200
commit84996901ccb22e2a82745d469f3560f7574a64c5 (patch)
tree426eaff89cd6bf1ceeb5552f6475e4eb2de9d6d1
parentba89ca2444e74d46600c7c1e20c9cf1b0bcd744b (diff)
Core/Spells: Correct flagging spell caster for pvp when healing/buffing friendly creatures - it should only happen if target is in combat (#27977)
(cherry picked from commit b155209ec40f867fc90d64eb207f3d3e7f633c2b)
-rw-r--r--src/server/game/Spells/Spell.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 81fcf8aa784..ea90562b469 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -2579,8 +2579,9 @@ void Spell::TargetInfo::PreprocessTarget(Spell* spell)
unit->SetInCombatWith(spell->m_caster->ToPlayer());
// if target is flagged for pvp also flag caster if a player
+ // but respect current pvp rules (buffing/healing npcs flagged for pvp only flags you if they are in combat)
_enablePVP = (MissCondition == SPELL_MISS_NONE || spell->m_spellInfo->HasAttribute(SPELL_ATTR3_PVP_ENABLING))
- && unit->IsPvP() && spell->m_caster->GetTypeId() == TYPEID_PLAYER; // need to check PvP state before spell effects, but act on it afterwards
+ && unit->IsPvP() && (unit->IsInCombat() || unit->IsCharmedOwnedByPlayerOrPlayer()) && spell->m_caster->GetTypeId() == TYPEID_PLAYER; // need to check PvP state before spell effects, but act on it afterwards
if (_spellHitTarget)
{