[11220] Implement support positive persistent auras

Note this alos have bad side: if some spell wrongly checks as possitive then it will work wrong after.
So report if any.
This commit is contained in:
VladimirMangos 2011-03-05 23:01:56 +03:00
parent 8f3d97d955
commit d3947b2026
5 changed files with 10 additions and 6 deletions

View file

@ -96,6 +96,7 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellE
m_radius = radius;
m_effIndex = effIndex;
m_spellId = spellId;
m_positive = IsPositiveEffect(m_spellId, m_effIndex);
return true;
}
@ -127,7 +128,7 @@ void DynamicObject::Update(uint32 update_diff, uint32 p_time)
if(m_radius)
{
// TODO: make a timer and update this in larger intervals
MaNGOS::DynamicObjectUpdater notifier(*this, caster);
MaNGOS::DynamicObjectUpdater notifier(*this, caster, m_positive);
Cell::VisitAllObjects(this, notifier, m_radius);
}

View file

@ -65,6 +65,7 @@ class DynamicObject : public WorldObject
SpellEffectIndex m_effIndex;
int32 m_aliveDuration;
float m_radius; // radius apply persistent effect, 0 = no persistent effect
bool m_positive;
AffectedSet m_affected;
private:
GridReference<DynamicObject> m_gridRef;

View file

@ -148,7 +148,8 @@ namespace MaNGOS
{
DynamicObject &i_dynobject;
Unit* i_check;
DynamicObjectUpdater(DynamicObject &dynobject, Unit* caster) : i_dynobject(dynobject)
bool i_positive;
DynamicObjectUpdater(DynamicObject &dynobject, Unit* caster, bool positive) : i_dynobject(dynobject), i_positive(positive)
{
i_check = caster;
Unit* owner = i_check->GetOwner();

View file

@ -136,14 +136,15 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
if (target->GetTypeId() == TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility() == VISIBILITY_OFF))
return;
// for player casts use less strict negative and more stricted positive targeting
if (i_check->GetTypeId() == TYPEID_PLAYER )
{
if (i_check->IsFriendlyTo( target ))
if (i_check->IsFriendlyTo( target ) != i_positive)
return;
}
else
{
if (!i_check->IsHostileTo( target ))
if (i_check->IsHostileTo( target ) == i_positive)
return;
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11219"
#define REVISION_NR "11220"
#endif // __REVISION_NR_H__