Improve ICC spread and fix Valithria trigger (#884)

* Temp fix valithria find target

* Improve spread with FleePosition

* Fix Valithria trigger
This commit is contained in:
Yunfan Li
2025-01-22 03:24:06 +08:00
committed by GitHub
parent b0ca0e8595
commit f6cc3f6e40
4 changed files with 28 additions and 15 deletions

View File

@@ -2144,8 +2144,13 @@ Position MovementAction::BestPositionForRangedToFlee(Position pos, float radius)
return Position(); return Position();
} }
bool MovementAction::FleePosition(Position pos, float radius) bool MovementAction::FleePosition(Position pos, float radius, uint32 minInterval)
{ {
std::list<FleeInfo>& infoList = AI_VALUE(std::list<FleeInfo>&, "recently flee info");
if (!infoList.empty() && infoList.back().timestamp + minInterval > getMSTime())
return false;
Position bestPos; Position bestPos;
if (botAI->IsMelee(bot)) if (botAI->IsMelee(bot))
{ {
@@ -2160,7 +2165,6 @@ bool MovementAction::FleePosition(Position pos, float radius)
if (MoveTo(bot->GetMapId(), bestPos.GetPositionX(), bestPos.GetPositionY(), bestPos.GetPositionZ(), false, if (MoveTo(bot->GetMapId(), bestPos.GetPositionX(), bestPos.GetPositionY(), bestPos.GetPositionZ(), false,
false, true, false, MovementPriority::MOVEMENT_COMBAT)) false, true, false, MovementPriority::MOVEMENT_COMBAT))
{ {
std::list<FleeInfo>& infoList = AI_VALUE(std::list<FleeInfo>&, "recently flee info");
uint32 curTS = getMSTime(); uint32 curTS = getMSTime();
while (!infoList.empty()) while (!infoList.empty())
{ {

View File

@@ -58,7 +58,7 @@ protected:
void CreateWp(Player* wpOwner, float x, float y, float z, float o, uint32 entry, bool important = false); void CreateWp(Player* wpOwner, float x, float y, float z, float o, uint32 entry, bool important = false);
Position BestPositionForMeleeToFlee(Position pos, float radius); Position BestPositionForMeleeToFlee(Position pos, float radius);
Position BestPositionForRangedToFlee(Position pos, float radius); Position BestPositionForRangedToFlee(Position pos, float radius);
bool FleePosition(Position pos, float radius); bool FleePosition(Position pos, float radius, uint32 minInterval = 1000);
bool CheckLastFlee(float curAngle, std::list<FleeInfo>& infoList); bool CheckLastFlee(float curAngle, std::list<FleeInfo>& infoList);
protected: protected:

View File

@@ -138,7 +138,8 @@ bool IccRangedPositionLadyDeathwhisperAction::Execute(Event event)
if (dist < radius) if (dist < radius)
{ {
float moveDistance = std::min(moveIncrement, radius - dist + 1.0f); float moveDistance = std::min(moveIncrement, radius - dist + 1.0f);
return MoveAway(unit, moveDistance); return FleePosition(unit->GetPosition(), moveDistance);
// return MoveAway(unit, moveDistance);
} }
} }
} }
@@ -274,9 +275,10 @@ bool IccRottingFrostGiantTankPositionAction::Execute(Event event)
} }
Unit* unit = botAI->GetUnit(member); Unit* unit = botAI->GetUnit(member);
if ((botAI->IsHeal(bot) || botAI->IsDps(bot)) && bot->GetExactDist2d(unit) < radius) if (unit && (botAI->IsHeal(bot) || botAI->IsDps(bot)) && bot->GetExactDist2d(unit) < radius)
{ {
return MoveAway(unit, radius + distanceExtra - bot->GetExactDist2d(unit)); return FleePosition(unit->GetPosition(), radius + distanceExtra - bot->GetExactDist2d(unit));
// return MoveAway(unit, radius + distanceExtra - bot->GetExactDist2d(unit));
} }
} }
return Attack(boss); return Attack(boss);
@@ -486,7 +488,8 @@ bool IccDbsTankPositionAction::Execute(Event event)
if (dist < radius) if (dist < radius)
{ {
float moveDistance = std::min(moveIncrement, radius - dist + 1.0f); float moveDistance = std::min(moveIncrement, radius - dist + 1.0f);
return MoveAway(unit, moveDistance); return FleePosition(unit->GetPosition(), moveDistance);
// return MoveAway(unit, moveDistance);
} }
} }
} }
@@ -608,7 +611,8 @@ bool IccFestergutTankPositionAction::Execute(Event event)
// Move away from closest player, but maintain roughly max range from boss // Move away from closest player, but maintain roughly max range from boss
float distToCenter = bot->GetExactDist2d(ICC_FESTERGUT_TANK_POSITION); float distToCenter = bot->GetExactDist2d(ICC_FESTERGUT_TANK_POSITION);
float moveDistance = (distToCenter > 25.0f) ? 2.0f : 3.0f; // Move less if already far from center float moveDistance = (distToCenter > 25.0f) ? 2.0f : 3.0f; // Move less if already far from center
return MoveAway(closestPlayer, moveDistance); return FleePosition(closestPlayer->GetPosition(), moveDistance);
// return MoveAway(closestPlayer, moveDistance);
} }
} }
return false; return false;
@@ -841,7 +845,8 @@ bool IccRotfaceGroupPositionAction::Execute(Event event)
{ {
float distToCenter = bot->GetExactDist2d(ICC_ROTFACE_TANK_POSITION); float distToCenter = bot->GetExactDist2d(ICC_ROTFACE_TANK_POSITION);
float moveDistance = (distToCenter > 25.0f) ? 2.0f : 3.0f; float moveDistance = (distToCenter > 25.0f) ? 2.0f : 3.0f;
return MoveAway(closestMember, moveDistance); // return MoveAway(closestMember, moveDistance);
return FleePosition(closestMember->GetPosition(), moveDistance);
} }
return false; return false;
@@ -1302,7 +1307,8 @@ bool AvoidMalleableGooAction::Execute(Event event)
// Only move if we have line of sight // Only move if we have line of sight
if (bot->IsWithinLOS(newX, newY, bot->GetPositionZ())) if (bot->IsWithinLOS(newX, newY, bot->GetPositionZ()))
{ {
return MoveAway(unit, moveDistance); return FleePosition(unit->GetPosition(), moveDistance);
// return MoveAway(unit, moveDistance);
} }
} }
} }
@@ -1505,7 +1511,8 @@ bool IccBpcEmpoweredVortexAction::Execute(Event event)
// Only move if we have line of sight // Only move if we have line of sight
if (bot->IsWithinLOS(newX, newY, bot->GetPositionZ())) if (bot->IsWithinLOS(newX, newY, bot->GetPositionZ()))
{ {
return MoveAway(unit, moveDistance); return FleePosition(unit->GetPosition(), moveDistance);
// return MoveAway(unit, moveDistance);
} }
} }
} }
@@ -1547,7 +1554,8 @@ bool IccBqlTankPositionAction::Execute(Event event)
if (dist < radius) if (dist < radius)
{ {
float moveDistance = std::min(moveIncrement, radius - dist + 1.0f); float moveDistance = std::min(moveIncrement, radius - dist + 1.0f);
return MoveAway(unit, moveDistance); return FleePosition(unit->GetPosition(), moveDistance);
// return MoveAway(unit, moveDistance);
} }
} }
} }
@@ -1564,7 +1572,8 @@ bool IccBqlTankPositionAction::Execute(Event event)
if (dist < radius) if (dist < radius)
{ {
float moveDistance = std::min(moveIncrement, radius - dist + 1.0f); float moveDistance = std::min(moveIncrement, radius - dist + 1.0f);
return MoveAway(unit, moveDistance); return FleePosition(unit->GetPosition(), moveDistance);
// return MoveAway(unit, moveDistance);
} }
} }
} }

View File

@@ -551,10 +551,10 @@ bool IccValithriaPortalTrigger::IsActive()
bool IccValithriaHealTrigger::IsActive() bool IccValithriaHealTrigger::IsActive()
{ {
Unit* boss = AI_VALUE2(Unit*, "find target", "valithria dreamwalker"); Unit* boss = bot->FindNearestCreature(36789, 100.0f);
if (!boss) if (!boss)
return false; return false;
// Only healers should use healing // Only healers should use healing
if (!botAI->IsHeal(bot) || bot->HasAura(70766)) if (!botAI->IsHeal(bot) || bot->HasAura(70766))
return false; return false;