Avoid aoe for game object

This commit is contained in:
Yunfan Li
2024-04-15 20:36:44 +08:00
parent 09ae42ea30
commit 56881c3a4d
4 changed files with 107 additions and 17 deletions

View File

@@ -8,6 +8,7 @@
#include "GridNotifiersImpl.h"
#include "Playerbots.h"
#include "SharedDefines.h"
#include "SpellMgr.h"
class AnyGameObjectInObjectRangeCheck
{
@@ -58,15 +59,32 @@ GuidVector NearestTrapWithDamageValue::Calculate()
{
continue;
}
uint32 spellId = go->GetSpellId();
const GameObjectTemplate* goInfo = go->GetGOInfo();
if (!goInfo)
{
continue;
}
uint32 spellId = goInfo->trap.spellId;
if (!spellId)
{
continue;
}
// if (ignoreLos || bot->IsWithinLOSInMap(go))
result.push_back(go->GetGUID());
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo->IsPositive()) {
continue;
}
for (int i = 0; i < MAX_SPELL_EFFECTS; i++) {
if (spellInfo->Effects[i].Effect == SPELL_EFFECT_APPLY_AURA) {
if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE) {
result.push_back(go->GetGUID());
break;
}
} else if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) {
result.push_back(go->GetGUID());
break;
}
}
}
return result;
}