From 54f6bf27b92de3dfd276d39448a3cbfedf858bdf Mon Sep 17 00:00:00 2001 From: killerwife Date: Fri, 27 Dec 2024 12:35:38 +0100 Subject: [PATCH] Creature/Spell: Implement NO_FRIENDLY_AREA_AURAS and IMMUNE_TO_PLAYER_BUFFS --- src/game/Spells/SpellAuras.cpp | 3 +++ src/game/Spells/SpellEffects.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index 6022844c88..8a3eafcf2d 100644 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -659,6 +659,9 @@ void AreaAura::Update(uint32 diff) if (!apply) continue; + if (m_areaAuraType == AREA_AURA_FRIEND && target->IsCreature() && static_cast(target)->GetSettings().HasFlag(CreatureStaticFlags3::NO_FRIENDLY_AREA_AURAS)) + continue; + // Skip some targets (TODO: Might require better checks, also unclear how the actual caster must/can be handled) if (actualSpellInfo->HasAttribute(SPELL_ATTR_EX3_ONLY_ON_PLAYER) && target->GetTypeId() != TYPEID_PLAYER) continue; diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 1ee995837b..085031b233 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -3359,6 +3359,11 @@ void Spell::EffectApplyAura(SpellEffectIndex eff_idx) // GO auras have caster == nullptr Unit* caster = GetAffectiveCaster(); + if (caster && caster->IsPlayerControlled() && unitTarget->IsCreature() + && static_cast(unitTarget)->GetSettings().HasFlag(CreatureStaticFlags3::IMMUNE_TO_PLAYER_BUFFS) + && IsPositiveAuraEffect(m_spellInfo, eff_idx, caster, unitTarget)) + return; + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell: Aura is: %u", m_spellInfo->EffectApplyAuraName[eff_idx]); Aura* aur = CreateAura(m_spellInfo, eff_idx, &damage, &m_currentBasePoints[eff_idx], m_spellAuraHolder, unitTarget, caster, m_CastItem, GetScriptValue());