[Avoid aoe] Crash fix and cover more spell

This commit is contained in:
Yunfan Li
2024-04-18 22:41:14 +08:00
parent 248bf6c003
commit 19ffe0227a
7 changed files with 67 additions and 102 deletions

View File

@@ -120,15 +120,13 @@ bool HasAreaDebuffValue::Calculate()
Aura* AreaDebuffValue::Calculate()
{
Unit::AuraApplicationMap& map = bot->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator i = map.begin(); i != map.end(); ++i)
{
Aura *aura = i->second->GetBase();
if (!aura)
continue;
AuraObjectType type = aura->GetType();
// bool is_area = aura->IsArea();
// Unit::AuraApplicationMap& map = bot->GetAppliedAuras();
Unit::AuraEffectList const& auras = bot->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE);
for (auto i = auras.begin(); i != auras.end(); ++i)
{
AuraEffect* aurEff = *i;
Aura *aura = aurEff->GetBase();
AuraObjectType type = aura->GetType();
bool isPositive = aura->GetSpellInfo()->IsPositive();
if (type == DYNOBJ_AURA_TYPE && !isPositive) {
DynamicObject* dynOwner = aura->GetDynobjOwner();
@@ -137,6 +135,23 @@ Aura* AreaDebuffValue::Calculate()
}
return aura;
}
}
}
// for (Unit::AuraApplicationMap::iterator i = map.begin(); i != map.end(); ++i)
// {
// Aura *aura = i->second->GetBase();
// if (!aura)
// continue;
// AuraObjectType type = aura->GetType();
// // bool is_area = aura->IsArea();
// bool isPositive = aura->GetSpellInfo()->IsPositive();
// if (type == DYNOBJ_AURA_TYPE && !isPositive) {
// DynamicObject* dynOwner = aura->GetDynobjOwner();
// if (!dynOwner) {
// continue;
// }
// return aura;
// }
// }
return nullptr;
}