diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-06-11 00:55:22 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-06-20 01:19:33 +0200 |
commit | 0c0e451027d1d00913dcfcbe3d1babaee8946cf4 (patch) | |
tree | ba4db0685147e31139c114725fe2880ccd3a0736 /src/server/game/Spells/Spell.cpp | |
parent | baadaa550e21d215bf7690d9bfa3336a48a772d0 (diff) |
Core/Spells: Implemented SPELL_ATTR9_ONLY_WHEN_ILLEGALLY_MOUNTED
(cherry picked from commit 1f3af18e3a17096748a621c9171feb30047287be)
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 |