Core/Auras: Implemented aura 321 SPELL_AURA_MOD_NO_ACTIONS

This commit is contained in:
Shauren
2016-06-25 10:50:28 +02:00
parent 77d0e3257c
commit 55d5cd37df
5 changed files with 37 additions and 4 deletions
+2 -1
View File
@@ -729,7 +729,8 @@ enum UnitFlags2
UNIT_FLAG2_DISABLE_TURN = 0x00008000,
UNIT_FLAG2_UNK2 = 0x00010000,
UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000 // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
UNIT_FLAG2_NO_ACTIONS = 0x00800000
};
/// Non Player Character flags
@@ -378,7 +378,7 @@ enum AuraType
SPELL_AURA_MASTERY = 318,
SPELL_AURA_MOD_MELEE_HASTE_3 = 319,
SPELL_AURA_MOD_RANGED_HASTE_2 = 320,
SPELL_AURA_321 = 321,
SPELL_AURA_MOD_NO_ACTIONS = 321,
SPELL_AURA_INTERFERE_TARGETTING = 322, // NYI
SPELL_AURA_323 = 323, // Not used in 4.3.4
SPELL_AURA_324 = 324, // spell critical chance (probably by school mask)
@@ -380,7 +380,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleMastery, //318 SPELL_AURA_MASTERY
&AuraEffect::HandleModMeleeSpeedPct, //319 SPELL_AURA_MOD_MELEE_HASTE_3
&AuraEffect::HandleAuraModRangedHaste, //320 SPELL_AURA_MOD_RANGED_HASTE_2
&AuraEffect::HandleNULL, //321 SPELL_AURA_321
&AuraEffect::HandleAuraModNoActions, //321 SPELL_AURA_MOD_NO_ACTIONS
&AuraEffect::HandleNULL, //322 SPELL_AURA_INTERFERE_TARGETTING
&AuraEffect::HandleUnused, //323 unused (4.3.4)
&AuraEffect::HandleNULL, //324 SPELL_AURA_324
@@ -2509,6 +2509,35 @@ void AuraEffect::HandleAuraAllowOnlyAbility(AuraApplication const* aurApp, uint8
}
}
void AuraEffect::HandleAuraModNoActions(AuraApplication const* aurApp, uint8 mode, bool apply) const
{
if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
Unit* target = aurApp->GetTarget();
if (apply)
{
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_NO_ACTIONS);
// call functions which may have additional effects after chainging state of unit
// Stop cast only spells vs PreventionType & SPELL_PREVENTION_TYPE_SILENCE
for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
if (spell->m_spellInfo->PreventionType & SPELL_PREVENTION_TYPE_NO_ACTIONS)
// Stop spells on prepare or casting state
target->InterruptSpell(CurrentSpellTypes(i), false);
}
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target->HasAuraType(SPELL_AURA_MOD_NO_ACTIONS))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_NO_ACTIONS);
}
}
/****************************/
/*** TRACKING ***/
/****************************/
@@ -167,6 +167,7 @@ class TC_GAME_API AuraEffect
void HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleAuraModPacifyAndSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleAuraAllowOnlyAbility(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleAuraModNoActions(AuraApplication const* aurApp, uint8 mode, bool apply) const;
// tracking
void HandleAuraTrackResources(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleAuraTrackCreatures(AuraApplication const* aurApp, uint8 mode, bool apply) const;
+3 -1
View File
@@ -5749,7 +5749,7 @@ SpellCastResult Spell::CheckCasterAuras() const
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)))
if ((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() && !((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() & (1 << MECHANIC_STUN)))
{
foundNotStun = true;
break;
@@ -5769,6 +5769,8 @@ SpellCastResult Spell::CheckCasterAuras() const
prevented_reason = SPELL_FAILED_SILENCED;
else if (unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType & SPELL_PREVENTION_TYPE_PACIFY)
prevented_reason = SPELL_FAILED_PACIFIED;
else if (m_caster->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_NO_ACTIONS) && m_spellInfo->PreventionType & SPELL_PREVENTION_TYPE_NO_ACTIONS)
prevented_reason = SPELL_FAILED_NO_ACTIONS;
// Attr must make flag drop spell totally immune from all effects
if (prevented_reason != SPELL_CAST_OK)