[Avoid aoe] Fix friendly game object

This commit is contained in:
Yunfan Li
2024-04-15 22:22:10 +08:00
parent caa3eb6423
commit 47064cc0f4
2 changed files with 16 additions and 12 deletions

View File

@@ -170,7 +170,6 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
botAI->InterruptSpell();
}
MotionMaster &mm = *bot->GetMotionMaster();
mm.Clear();
mm.MovePoint(mapId, x, y, z, generatePath);
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation());
@@ -1564,17 +1563,17 @@ bool AvoidAoeAction::AvoidGameObjectWithDamage()
if (spellInfo->IsPositive()) {
continue;
}
float radius = 5.0f;
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) {
radius = spellInfo->Effects[i].CalcRadius();
break;
}
} else if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) {
break;
}
}
float radius = (float)goInfo->trap.diameter / 2;
// 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) {
// radius = spellInfo->Effects[i].CalcRadius();
// break;
// }
// } else if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) {
// break;
// }
// }
if (bot->GetDistance(go) > radius) {
return false;
}

View File

@@ -59,6 +59,11 @@ GuidVector NearestTrapWithDamageValue::Calculate()
{
continue;
}
Unit* owner = go->GetOwner();
if (owner && owner->IsFriendlyTo(bot))
{
continue;
}
const GameObjectTemplate* goInfo = go->GetGOInfo();
if (!goInfo)
{