mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
Core/Spells: fixed SPELL_ATTR5_USABLE_WHILE_STUNNED
This commit is contained in:
@@ -5733,20 +5733,27 @@ SpellCastResult Spell::CheckCasterAuras() const
|
||||
uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state
|
||||
if (unitflag & UNIT_FLAG_STUNNED)
|
||||
{
|
||||
// spell is usable while stunned, check if caster has only mechanic stun auras, another stun types must prevent cast spell
|
||||
// spell is usable while stunned, check if caster has allowed stun auras, another stun types must prevent cast spell
|
||||
if (usableInStun)
|
||||
{
|
||||
static uint32 const allowedStunMask =
|
||||
1 << MECHANIC_STUN
|
||||
| 1 << MECHANIC_FREEZE
|
||||
| 1 << MECHANIC_SAPPED
|
||||
| 1 << MECHANIC_SLEEP;
|
||||
|
||||
bool foundNotStun = false;
|
||||
Unit::AuraEffectList const& stunAuras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_STUN);
|
||||
for (Unit::AuraEffectList::const_iterator i = stunAuras.begin(); i != stunAuras.end(); ++i)
|
||||
{
|
||||
if ((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() && !((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() & (1 << MECHANIC_STUN)))
|
||||
uint32 mechanicMask = (*i)->GetSpellInfo()->GetAllEffectsMechanicMask();
|
||||
if (mechanicMask && !(mechanicMask & allowedStunMask))
|
||||
{
|
||||
foundNotStun = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundNotStun && m_spellInfo->Id != 22812)
|
||||
if (foundNotStun)
|
||||
prevented_reason = SPELL_FAILED_STUNNED;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user