diff options
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 43b6a4bf75e..ce064dcc5f1 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5808,6 +5808,22 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32 if (unitCaster->IsInCombat() && !m_spellInfo->CanBeUsedInCombat(unitCaster)) return SPELL_FAILED_AFFECTING_COMBAT; + + if (m_spellInfo->HasAttribute(SPELL_ATTR9_ONLY_WHEN_ILLEGALLY_MOUNTED)) + { + bool hasInvalidMountAura = std::ranges::any_of(unitCaster->GetAuraEffectsByType(SPELL_AURA_MOUNTED), [unitCaster](AuraEffect const* mountEffect) + { + uint32 mountType = mountEffect->GetSpellEffectInfo().MiscValueB; + if (MountEntry const* mountEntry = sDB2Manager.GetMount(mountEffect->GetId())) + mountType = mountEntry->MountTypeID; + + MountCapabilityEntry const* mountCapability = unitCaster->GetMountCapability(mountType); + return !mountCapability || mountCapability->ID != uint32(mountEffect->GetAmount()); + }); + + if (!hasInvalidMountAura) + return SPELL_FAILED_ONLY_MOUNTED; + } } // Check vehicle flags |