mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[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:
parent
01e4f25888
commit
3d4caa275b
4 changed files with 29 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -8180,6 +8180,12 @@ bool Aura::IsLastAuraOnHolder()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Aura::HasMechanic(uint32 mechanic) const
|
||||
{
|
||||
return GetSpellProto()->Mechanic == mechanic ||
|
||||
GetSpellProto()->EffectMechanic[m_effIndex] == mechanic;
|
||||
}
|
||||
|
||||
SpellAuraHolder::SpellAuraHolder(SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem) :
|
||||
m_target(target), m_castItemGuid(castItem ? castItem->GetObjectGuid() : ObjectGuid()),
|
||||
m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_procCharges(0),
|
||||
|
|
|
|||
|
|
@ -436,6 +436,8 @@ class MANGOS_DLL_SPEC Aura
|
|||
SpellAuraHolder* const GetHolder() const { return m_spellAuraHolder; }
|
||||
|
||||
bool IsLastAuraOnHolder();
|
||||
|
||||
bool HasMechanic(uint32 mechanic) const;
|
||||
protected:
|
||||
Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11143"
|
||||
#define REVISION_NR "11144"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue