Skip to content

Commit

Permalink
Creature/Spell: Implement NO_FRIENDLY_AREA_AURAS and IMMUNE_TO_PLAYER…
Browse files Browse the repository at this point in the history
…_BUFFS
  • Loading branch information
killerwife committed Dec 27, 2024
1 parent f5e29b3 commit 54f6bf2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@ void AreaAura::Update(uint32 diff)
if (!apply)
continue;

if (m_areaAuraType == AREA_AURA_FRIEND && target->IsCreature() && static_cast<Creature*>(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;
Expand Down
5 changes: 5 additions & 0 deletions src/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Creature*>(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());
Expand Down

0 comments on commit 54f6bf2

Please sign in to comment.