Core/Spells: Implemented SPELL_ATTR5_NOT_AVAILABLE_WHILE_CHARMED

Port From (https://github.com/TrinityCore/TrinityCore/commit/076c63c766d10697cea17da8bd5194862a682cbe)
This commit is contained in:
hondacrx
2022-06-01 15:40:38 -04:00
parent 68d8f664d7
commit 812d98f5b5
4 changed files with 15 additions and 3 deletions
@@ -1771,7 +1771,7 @@ namespace Framework.Constants
ImpliedTargeting = 0x800, // Implied Targeting (Client Only)
MeleeChainTargeting = 0x1000, // Melee Chain Targeting
SpellHasteAffectsPeriodic = 0x2000, // Spell Haste Affects Periodic
NotAvailableWhileCharmed = 0x4000, /*Nyi*/ // Not Available While Charmed
NotAvailableWhileCharmed = 0x4000, // Not Available While Charmed
TreatAsAreaEffect = 0x8000, /*Nyi*/ // Treat As Area Effect
AuraAffectsNotJustReqEquippedItem = 0x10000, // Aura Affects Not Just Req. Equipped Item
AllowWhileFleeing = 0x20000, // Allow While Fleeing
+3
View File
@@ -1096,6 +1096,9 @@ namespace Game.Entities
if (spellInfo == null)
continue;
if (spellInfo.HasAttribute(SpellAttr5.NotAvailableWhileCharmed))
continue;
if (!Global.ConditionMgr.IsObjectMeetingVehicleSpellConditions(vehicle.GetEntry(), spellId, this, vehicle))
{
Log.outDebug(LogFilter.Condition, "VehicleSpellInitialize: conditions not met for Vehicle entry {0} spell {1}", vehicle.ToCreature().GetEntry(), spellId);
+6
View File
@@ -110,6 +110,9 @@ namespace Game.Entities
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, _unit.GetMap().GetDifficultyID());
if (spellInfo != null)
{
if (spellInfo.HasAttribute(SpellAttr5.NotAvailableWhileCharmed))
continue;
if (spellInfo.IsPassive())
_unit.CastSpell(_unit, spellInfo.Id, new CastSpellExtraArgs(true));
else
@@ -142,6 +145,9 @@ namespace Game.Entities
continue;
}
if (spellInfo.HasAttribute(SpellAttr5.NotAvailableWhileCharmed))
continue;
if (spellInfo.IsPassive())
{
_unit.CastSpell(_unit, spellInfo.Id, new CastSpellExtraArgs(true));
+5 -2
View File
@@ -4703,6 +4703,9 @@ namespace Game.Spells
Unit unitCaster = m_caster.ToUnit();
if (unitCaster != null)
{
if (m_spellInfo.HasAttribute(SpellAttr5.NotAvailableWhileCharmed) && unitCaster.IsCharmed())
return SpellCastResult.Charmed;
// only check at first call, Stealth auras are already removed at second call
// for now, ignore triggered spells
if (strict && !_triggeredCastFlags.HasFlag(TriggerCastFlags.IgnoreShapeshift))
@@ -5659,7 +5662,7 @@ namespace Game.Spells
return SpellCastResult.NoPet;
if (!pet.GetCharmerGUID().IsEmpty())
return SpellCastResult.Charmed;
return SpellCastResult.AlreadyHaveCharm;
break;
}
case AuraType.ModPossess:
@@ -5671,7 +5674,7 @@ namespace Game.Spells
return SpellCastResult.BadTargets;
if (!unitCaster1.GetCharmerGUID().IsEmpty())
return SpellCastResult.Charmed;
return SpellCastResult.AlreadyHaveCharm;
if (spellEffectInfo.ApplyAuraName == AuraType.ModCharm || spellEffectInfo.ApplyAuraName == AuraType.ModPossess)
{