aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Unit/Unit.h3
-rw-r--r--src/server/game/Spells/Auras/SpellAuraDefines.h2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp31
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h1
-rw-r--r--src/server/game/Spells/Spell.cpp4
5 files changed, 37 insertions, 4 deletions
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 48e7cb86fcf..5cbe29996dc 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -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
diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h
index 70a08d05d5f..ae34e06fe37 100644
--- a/src/server/game/Spells/Auras/SpellAuraDefines.h
+++ b/src/server/game/Spells/Auras/SpellAuraDefines.h
@@ -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)
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 4ae91981448..9e46b2d1d35 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -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 ***/
/****************************/
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index 7d1df37eb42..a046a675eb4 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.h
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.h
@@ -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;
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index b77cac83e34..bc34002a33b 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -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)