Core/Spells: Implemented SPELL_ATTR5_NOT_ON_PLAYER and SPELL_ATTR5_NOT_ON_PLAYER_CONTROLLED_NPC

Port From (https://github.com/TrinityCore/TrinityCore/commit/acda6f9dcf411a1406b81e1a100125dbe34f942b)
This commit is contained in:
hondacrx
2022-06-01 15:37:28 -04:00
parent da9cd08caa
commit 68d8f664d7
5 changed files with 71 additions and 16 deletions
+2
View File
@@ -1594,6 +1594,8 @@ namespace Game.Spells
retMask &= GridMapTypeMask.Corpse | GridMapTypeMask.Player;
if (m_spellInfo.HasAttribute(SpellAttr3.OnlyOnGhosts))
retMask &= GridMapTypeMask.Player;
if (m_spellInfo.HasAttribute(SpellAttr5.NotOnPlayer))
retMask &= ~GridMapTypeMask.Player;
if (condList != null)
retMask &= Global.ConditionMgr.GetSearcherTypeMaskForConditionList(condList);
+10 -2
View File
@@ -1080,8 +1080,16 @@ namespace Game.Spells
return SpellCastResult.SpellCastOk;
// corpseOwner and unit specific target checks
if (HasAttribute(SpellAttr3.OnlyOnPlayer) && !unitTarget.IsTypeId(TypeId.Player))
return SpellCastResult.TargetNotPlayer;
if (!unitTarget.IsPlayer())
{
if (HasAttribute(SpellAttr3.OnlyOnPlayer))
return SpellCastResult.TargetNotPlayer;
if (HasAttribute(SpellAttr5.NotOnPlayerControlledNpc) && unitTarget.IsControlledByPlayer())
return SpellCastResult.TargetIsPlayerControlled;
}
else if (HasAttribute(SpellAttr5.NotOnPlayer))
return SpellCastResult.TargetIsPlayer;
if (!IsAllowingDeadTarget() && !unitTarget.IsAlive())
return SpellCastResult.TargetsDead;