[Combat formation] Compatible with naxx and avoid aoe

This commit is contained in:
Yunfan Li
2024-09-26 20:01:10 +08:00
parent d1a744fca3
commit 8d524cdaf0
5 changed files with 66 additions and 20 deletions

View File

@@ -1883,16 +1883,7 @@ bool AvoidAoeAction::AvoidGameObjectWithDamage()
float radius = (float)goInfo->trap.diameter / 2 + go->GetCombatReach();
if (!radius || radius > sPlayerbotAIConfig->maxAoeAvoidRadius)
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) {
// radius = spellInfo->Effects[i].CalcRadius();
// break;
// }
// } else if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) {
// break;
// }
// }
if (bot->GetDistance(go) > radius)
{
continue;
@@ -2353,12 +2344,26 @@ bool TankFaceAction::Execute(Event event)
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
x, y, z))
{
availablePos.push_back(Position(x, y, z));
/// @todo: movement control now is a mess, prepare to rewrite
std::list<FleeInfo>& infoList = AI_VALUE(std::list<FleeInfo>&, "recently flee info");
Position pos(x, y, z);
float angle = bot->GetAngle(&pos);
if (CheckLastFlee(angle, infoList))
{
availablePos.push_back(Position(x, y, z));
}
}
target->GetNearPoint(bot, x, y, z, 0.0f, dist, goodAngle2);
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
x, y, z))
{
std::list<FleeInfo>& infoList = AI_VALUE(std::list<FleeInfo>&, "recently flee info");
Position pos(x, y, z);
float angle = bot->GetAngle(&pos);
if (CheckLastFlee(angle, infoList))
{
availablePos.push_back(Position(x, y, z));
}
availablePos.push_back(Position(x, y, z));
}
if (availablePos.empty())
@@ -2531,12 +2536,27 @@ bool SetBehindTargetAction::Execute(Event event)
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
x, y, z))
{
/// @todo: movement control now is a mess, prepare to rewrite
std::list<FleeInfo>& infoList = AI_VALUE(std::list<FleeInfo>&, "recently flee info");
Position pos(x, y, z);
float angle = bot->GetAngle(&pos);
if (CheckLastFlee(angle, infoList))
{
availablePos.push_back(Position(x, y, z));
}
availablePos.push_back(Position(x, y, z));
}
target->GetNearPoint(bot, x, y, z, 0.0f, dist, goodAngle2);
if (bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
x, y, z))
{
std::list<FleeInfo>& infoList = AI_VALUE(std::list<FleeInfo>&, "recently flee info");
Position pos(x, y, z);
float angle = bot->GetAngle(&pos);
if (CheckLastFlee(angle, infoList))
{
availablePos.push_back(Position(x, y, z));
}
availablePos.push_back(Position(x, y, z));
}
if (availablePos.empty())

View File

@@ -27,7 +27,7 @@ float GrobbulusMultiplier::GetValue(Action* action)
{
return 1.0f;
}
if (dynamic_cast<AvoidAoeAction*>(action))
if (dynamic_cast<AvoidAoeAction*>(action) || dynamic_cast<CombatFormationMoveAction*>(action))
{
return 0.0f;
}
@@ -48,7 +48,7 @@ float HeiganDanceMultiplier::GetValue(Action* action)
uint32 curr_dance = eventMap->GetNextEventTime(4);
uint32 curr_timer = eventMap->GetTimer();
uint32 curr_erupt = eventMap->GetNextEventTime(3);
if (dynamic_cast<SetBehindTargetAction*>(action))
if (dynamic_cast<CombatFormationMoveAction*>(action))
{
return 0.0f;
}
@@ -87,7 +87,8 @@ float LoathebGenericMultiplier::GetValue(Action* action)
context->GetValue<bool>("neglect threat")->Set(true);
if (botAI->GetState() == BOT_STATE_COMBAT &&
(dynamic_cast<DpsAssistAction*>(action) || dynamic_cast<TankAssistAction*>(action) ||
dynamic_cast<CastDebuffSpellOnAttackerAction*>(action) || dynamic_cast<FleeAction*>(action)))
dynamic_cast<CastDebuffSpellOnAttackerAction*>(action) || dynamic_cast<FleeAction*>(action) ||
dynamic_cast<CombatFormationMoveAction*>(action)))
{
return 0.0f;
}
@@ -113,7 +114,8 @@ float ThaddiusGenericMultiplier::GetValue(Action* action)
if (helper.IsPhasePet() &&
(dynamic_cast<DpsAssistAction*>(action) || dynamic_cast<TankAssistAction*>(action) ||
dynamic_cast<CastDebuffSpellOnAttackerAction*>(action) ||
dynamic_cast<ReachPartyMemberToHealAction*>(action) || dynamic_cast<BuffOnMainTankAction*>(action)))
dynamic_cast<ReachPartyMemberToHealAction*>(action) || dynamic_cast<BuffOnMainTankAction*>(action) ||
dynamic_cast<CombatFormationMoveAction*>(action)))
{
return 0.0f;
}
@@ -151,7 +153,8 @@ float SapphironGenericMultiplier::GetValue(Action* action)
{
return 1.0f;
}
if (dynamic_cast<FollowAction*>(action) || dynamic_cast<CastDeathGripAction*>(action))
if (dynamic_cast<FollowAction*>(action) || dynamic_cast<CastDeathGripAction*>(action) ||
dynamic_cast<CombatFormationMoveAction*>(action))
{
return 0.0f;
}