Skip to content

Commit

Permalink
Spells: Allow secondary target checking for area auras
Browse files Browse the repository at this point in the history
  • Loading branch information
insunaa authored and killerwife committed Jan 8, 2024
1 parent 133d0a6 commit e43d31b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/game/Entities/DynamicObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,9 @@ void DynamicObject::OnPersistentAreaAuraEnd()
m_auraScript->OnPersistentAreaAuraEnd(this);
}

bool DynamicObject::OnPersistentAreaAuraCheckTarget(Unit* target)
{
if (m_auraScript)
return m_auraScript->OnPersistentAreaAuraCheckTarget(this, target);
return true;
}
1 change: 1 addition & 0 deletions src/game/Entities/DynamicObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class DynamicObject : public WorldObject
bool CanAssistSpell(Unit const* target, SpellEntry const* spellInfo = nullptr) const override;

void OnPersistentAreaAuraEnd();
bool OnPersistentAreaAuraCheckTarget(Unit* target);

float GetObjectBoundingRadius() const override { return 0.f; } // dynamic object not have real interact size
float GetCollisionHeight() const override { return 1.f; } // to get away with ground collision
Expand Down
3 changes: 3 additions & 0 deletions src/game/Grids/GridNotifiersImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
}
}

if (!i_dynobject.OnPersistentAreaAuraCheckTarget(target))
return;

if (spellInfo->HasAttribute(SPELL_ATTR_EX3_ONLY_ON_PLAYER) && target->GetTypeId() != TYPEID_PLAYER)
return;

Expand Down
2 changes: 2 additions & 0 deletions src/game/Spells/Scripts/SpellScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ struct AuraScript
virtual void OnPeriodicTickEnd(Aura* /*aura*/) const {}
// called on persistent area aura dyngo lifetime end
virtual void OnPersistentAreaAuraEnd(DynamicObject* /*dynGo*/) const {}
// called on AreaAura target selection
virtual bool OnPersistentAreaAuraCheckTarget(DynamicObject* /*dynGo*/, Unit* /*target*/) const { return true; }
// called on unit heartbeat
virtual void OnHeartbeat(Aura* /*aura*/) const {}
// called on affect check of aura - spellInfo can be nullptr in case of melee
Expand Down

0 comments on commit e43d31b

Please sign in to comment.