Scripts/AuraScript: Make AuraApplication in OnEffectPeriodic never be NULL.
Scripts: remove some unnecessary NULL checks from scripts. --HG-- branch : trunk
This commit is contained in:
@@ -400,6 +400,17 @@ void AuraEffect::GetTargetList(std::list<Unit *> & targetList) const
|
||||
}
|
||||
}
|
||||
|
||||
void AuraEffect::GetApplicationList(std::list<AuraApplication *> & applicationList) const
|
||||
{
|
||||
Aura::ApplicationMap const & targetMap = GetBase()->GetApplicationMap();
|
||||
// remove all targets which were not added to new list - they no longer deserve area aura
|
||||
for (Aura::ApplicationMap::const_iterator appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
|
||||
{
|
||||
if (appIter->second->HasEffect(GetEffIndex()))
|
||||
applicationList.push_back(appIter->second);
|
||||
}
|
||||
}
|
||||
|
||||
int32 AuraEffect::CalculateAmount(Unit * caster)
|
||||
{
|
||||
int32 amount;
|
||||
@@ -1057,13 +1068,13 @@ void AuraEffect::Update(uint32 diff, Unit * caster)
|
||||
m_periodicTimer += m_amplitude - diff;
|
||||
UpdatePeriodic(caster);
|
||||
|
||||
UnitList effectTargets;
|
||||
GetTargetList(effectTargets);
|
||||
std::list<AuraApplication*> effectApplications;
|
||||
GetApplicationList(effectApplications);
|
||||
// tick on targets of effects
|
||||
if (!caster || !caster->hasUnitState(UNIT_STAT_ISOLATED))
|
||||
{
|
||||
for (UnitList::iterator targetItr = effectTargets.begin(); targetItr != effectTargets.end(); ++targetItr)
|
||||
PeriodicTick(*targetItr, caster);
|
||||
for (std::list<AuraApplication*>::iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
|
||||
PeriodicTick(*apptItr, caster);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1224,12 +1235,14 @@ void AuraEffect::SendTickImmune(Unit * target, Unit *caster) const
|
||||
caster->SendSpellDamageImmune(target, m_spellProto->Id);
|
||||
}
|
||||
|
||||
void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
||||
void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit * caster) const
|
||||
{
|
||||
bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(const_cast<AuraEffect const *>(this), GetBase()->GetApplicationOfTarget(target->GetGUID()));
|
||||
bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(const_cast<AuraEffect const *>(this), aurApp);
|
||||
if (prevented)
|
||||
return;
|
||||
|
||||
Unit * target = aurApp->GetTarget();
|
||||
|
||||
switch(GetAuraType())
|
||||
{
|
||||
case SPELL_AURA_PERIODIC_DAMAGE:
|
||||
|
||||
@@ -23,6 +23,7 @@ class AuraEffect
|
||||
uint64 GetCasterGUID() const { return GetBase()->GetCasterGUID(); }
|
||||
Aura * GetBase() const { return m_base; }
|
||||
void GetTargetList(std::list<Unit*> & targetList) const;
|
||||
void GetApplicationList(std::list<AuraApplication*> & applicationList) const;
|
||||
|
||||
SpellEntry const * GetSpellProto() const { return m_spellProto; }
|
||||
uint32 GetId() const { return m_spellProto->Id; }
|
||||
@@ -63,7 +64,7 @@ class AuraEffect
|
||||
|
||||
void SendTickImmune(Unit * target, Unit *caster) const;
|
||||
|
||||
void PeriodicTick(Unit * target, Unit * caster) const;
|
||||
void PeriodicTick(AuraApplication * aurApp, Unit * caster) const;
|
||||
void PeriodicDummyTick(Unit * target, Unit * caster) const;
|
||||
Unit* GetTriggerTarget(Unit * target) const;
|
||||
void TriggerSpell(Unit * target, Unit * caster) const;
|
||||
|
||||
Reference in New Issue
Block a user