Core/Spells: Correct flagging spell caster for pvp when healing/buffing friendly creatures - it should only happen if target is in combat (#27977)

This commit is contained in:
Jinnaix
2022-06-09 11:33:30 +02:00
committed by GitHub
parent 222a0ba8ee
commit b155209ec4

View File

@@ -2322,7 +2322,8 @@ void Spell::TargetInfo::PreprocessTarget(Spell* spell)
if (_spellHitTarget)
{
// if target is flagged for pvp also flag caster if a player
if (unit->IsPvP() && spell->m_caster->GetTypeId() == TYPEID_PLAYER)
// but respect current pvp rules (buffing/healing npcs flagged for pvp only flags you if they are in combat)
if (unit->IsPvP() && (unit->IsInCombat() || unit->IsCharmedOwnedByPlayerOrPlayer()) && spell->m_caster->GetTypeId() == TYPEID_PLAYER)
_enablePVP = true; // Decide on PvP flagging now, but act on it later.
SpellMissInfo missInfo = spell->PreprocessSpellHit(_spellHitTarget, ScaleAura, *this);