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

View File

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