[11144] Prevents abilities that are 'usable while stunned' being usable while in non-stun effects. The usability while stunned is restricted only to stun auras with mechanic stun

Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
darkstalker 2011-02-12 15:59:09 +02:00 committed by Ambal
parent 01e4f25888
commit 3d4caa275b
4 changed files with 29 additions and 4 deletions

View file

@ -5602,8 +5602,25 @@ SpellCastResult Spell::CheckCasterAuras() const
SpellCastResult prevented_reason = SPELL_CAST_OK;
// Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out
uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state
if (unitflag & UNIT_FLAG_STUNNED && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))
prevented_reason = SPELL_FAILED_STUNNED;
if (unitflag & UNIT_FLAG_STUNNED)
{
// spell is usable while stunned, check if aura has mechanic stun
if (m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED)
{
bool is_stun_mechanic = true;
Unit::AuraList const& stunAuras = m_caster->GetAurasByType(SPELL_AURA_MOD_STUN);
for (Unit::AuraList::const_iterator itr = stunAuras.begin(); itr != stunAuras.end(); ++itr)
if (!(*itr)->HasMechanic(MECHANIC_STUN))
{
is_stun_mechanic = false;
break;
}
if (!is_stun_mechanic)
prevented_reason = SPELL_FAILED_STUNNED;
}
else
prevented_reason = SPELL_FAILED_STUNNED;
}
else if (unitflag & UNIT_FLAG_CONFUSED && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED))
prevented_reason = SPELL_FAILED_CONFUSED;
else if (unitflag & UNIT_FLAG_FLEEING && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED))
@ -5652,7 +5669,7 @@ SpellCastResult Spell::CheckCasterAuras() const
switch(aura->GetModifier()->m_auraname)
{
case SPELL_AURA_MOD_STUN:
if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))
if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED) || !aura->HasMechanic(MECHANIC_STUN))
return SPELL_FAILED_STUNNED;
break;
case SPELL_AURA_MOD_CONFUSE: