diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 3 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 11 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.h | 1 | ||||
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 17 |
4 files changed, 31 insertions, 1 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e7f9c605bfe..21a9c44d608 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5669,6 +5669,9 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) if (HasUnitFlag(UNIT_FLAG_PACIFIED)) return false; + if (HasAuraType(SPELL_AURA_DISABLE_ATTACKING_EXCEPT_ABILITIES)) + return false; + // nobody can attack GM in GM-mode if (victim->GetTypeId() == TYPEID_PLAYER) { diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 18238d9340d..077bbdaf771 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -332,7 +332,7 @@ NonDefaultConstructible<pAuraEffectHandler> AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandlePhase, //261 SPELL_AURA_PHASE &AuraEffect::HandleNoImmediateEffect, //262 SPELL_AURA_ABILITY_IGNORE_AURASTATE implemented in Spell::CheckCast &AuraEffect::HandleNoImmediateEffect, //263 SPELL_AURA_DISABLE_CASTING_EXCEPT_ABILITIES implemented in Spell::CheckCast - &AuraEffect::HandleNULL, //264 SPELL_AURA_DISABLE_ATTACKING_EXCEPT_ABILITIES + &AuraEffect::HandleAuraDisableAttackingExceptAbilities, //264 SPELL_AURA_DISABLE_ATTACKING_EXCEPT_ABILITIES implemented in Spell::CheckCast, Unit::Attack &AuraEffect::HandleUnused, //265 unused (4.3.4) &AuraEffect::HandleNULL, //266 SPELL_AURA_SET_VIGNETTE &AuraEffect::HandleNoImmediateEffect, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmunedToSpellEffect @@ -2361,6 +2361,15 @@ void AuraEffect::HandleAuraModPacifyAndSilence(AuraApplication const* aurApp, ui HandleAuraModSilence(aurApp, mode, apply); } +void AuraEffect::HandleAuraDisableAttackingExceptAbilities(AuraApplication const* aurApp, uint8 mode, bool apply) const +{ + if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK)) + return; + + if (apply) + aurApp->GetTarget()->AttackStop(); +} + void AuraEffect::HandleAuraModNoActions(AuraApplication const* aurApp, uint8 mode, bool apply) const { if (!(mode & AURA_EFFECT_HANDLE_REAL)) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 8ecdbebc088..23f3fd65b96 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -166,6 +166,7 @@ class TC_GAME_API AuraEffect void HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleAuraModPacifyAndSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const; + void HandleAuraDisableAttackingExceptAbilities(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; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 67ac36e5f90..53f8ad117be 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4901,6 +4901,23 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint && !m_spellInfo->HasAttribute(SPELL_ATTR12_IGNORE_CASTING_DISABLED) && !m_caster->HasAuraTypeWithFamilyFlags(SPELL_AURA_DISABLE_CASTING_EXCEPT_ABILITIES, sChrClassesStore.AssertEntry(m_caster->getClass())->SpellClassSet, m_spellInfo->SpellFamilyFlags)); return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + + if (m_caster->HasAuraType(SPELL_AURA_DISABLE_ATTACKING_EXCEPT_ABILITIES)) + { + if (!m_caster->HasAuraTypeWithFamilyFlags(SPELL_AURA_DISABLE_ATTACKING_EXCEPT_ABILITIES, sChrClassesStore.AssertEntry(m_caster->getClass())->SpellClassSet, m_spellInfo->SpellFamilyFlags)) + { + if (m_spellInfo->HasAttribute(SPELL_ATTR0_REQ_AMMO) + || m_spellInfo->IsNextMeleeSwingSpell() + || m_spellInfo->HasAttribute(SPELL_ATTR1_MELEE_COMBAT_START) + || m_spellInfo->HasAttribute(SPELL_ATTR2_UNK20) + || m_spellInfo->HasEffect(SPELL_EFFECT_ATTACK) + || m_spellInfo->HasEffect(SPELL_EFFECT_NORMALIZED_WEAPON_DMG) + || m_spellInfo->HasEffect(SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL) + || m_spellInfo->HasEffect(SPELL_EFFECT_WEAPON_PERCENT_DAMAGE) + || m_spellInfo->HasEffect(SPELL_EFFECT_WEAPON_DAMAGE)) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + } + } } // check if we are using a potion in combat for the 2nd+ time. Cooldown is added only after caster gets out of combat |