diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index cf6eddefd..82e67fb80 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -1968,7 +1968,7 @@ namespace Framework.Constants { ForceDestLocation = 0x01, // Force Dest Location DESCRIPTION Ignores collision with terrain (unsure if it also ignores terrain height and can go under map) ModInvisIncludesParty = 0x02, // Mod Invis Includes Party 1@Attr9 DESCRIPTION Causes invisibility auras to ignore "can always see party member invis" rule - RestrictedFlightArea = 0x04, // 2 + OnlyWhenIllegallyMounted = 0x04, // Only When Illegally Mounted Unk3 = 0x08, // 3 SpecialDelayCalculation = 0x10, // 4 SummonPlayerTotem = 0x20, // 5 diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 0e66ad9e8..cf4f571cc 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -5148,6 +5148,23 @@ namespace Game.Spells if (unitCaster.IsInCombat() && !m_spellInfo.CanBeUsedInCombat(unitCaster)) return SpellCastResult.AffectingCombat; + + if (m_spellInfo.HasAttribute(SpellAttr9.OnlyWhenIllegallyMounted)) + { + bool hasInvalidMountAura = unitCaster.GetAuraEffectsByType(AuraType.Mounted).Any(mountEffect => + { + uint mountType = (uint)mountEffect.GetSpellEffectInfo().MiscValueB; + var mountEntry = Global.DB2Mgr.GetMount(mountEffect.GetId()); + if (mountEntry != null) + mountType = mountEntry.MountTypeID; + + var mountCapability = unitCaster.GetMountCapability(mountType); + return mountCapability == null || mountCapability.Id != mountEffect.GetAmount(); + }); + + if (!hasInvalidMountAura) + return SpellCastResult.OnlyMounted; + } } // Check vehicle flags