From 61263bf74dfa6d8ee6e54b56f54a8b3e01c80140 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 17 Jun 2022 12:54:34 +0200 Subject: Core/Spells: Corrected unit flag checked with SPELL_ATTR6_CAN_TARGET_UNTARGETABLE --- src/server/game/Entities/Object/Object.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 5734afb9f3b..47927eac3c8 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2911,7 +2911,10 @@ bool WorldObject::IsValidAttackTarget(WorldObject const* target, SpellInfo const return false; // can't attack untargetable - if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE)) && unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_UNINTERACTIBLE)) + if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE)) && unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE_2)) + return false; + + if (unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_UNINTERACTIBLE)) return false; if (Player const* playerAttacker = ToPlayer()) @@ -2921,7 +2924,7 @@ bool WorldObject::IsValidAttackTarget(WorldObject const* target, SpellInfo const } // check flags - if (unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_ON_TAXI | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_NON_ATTACKABLE_2)) + if (unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_ON_TAXI | UNIT_FLAG_NOT_ATTACKABLE_1)) return false; Unit const* unitOrOwner = unit; @@ -3061,11 +3064,14 @@ bool WorldObject::IsValidAssistTarget(WorldObject const* target, SpellInfo const return false; // can't assist untargetable - if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE)) && unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_UNINTERACTIBLE)) + if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE)) && unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE_2)) + return false; + + if (unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_UNINTERACTIBLE)) return false; // check flags for negative spells - if (isNegativeSpell && unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_ON_TAXI | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_NON_ATTACKABLE_2)) + if (isNegativeSpell && unitTarget && unitTarget->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_ON_TAXI | UNIT_FLAG_NOT_ATTACKABLE_1)) return false; if (isNegativeSpell || !bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC)) -- cgit v1.2.3