mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[Combat formation] Compatible with naxx and avoid aoe
This commit is contained in:
@@ -326,9 +326,9 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
|
||||
}
|
||||
|
||||
if (nextTransportCheck > elapsed)
|
||||
nextTransportCheck -= elapsed;
|
||||
else
|
||||
nextTransportCheck = 0;
|
||||
nextTransportCheck -= elapsed;
|
||||
else
|
||||
nextTransportCheck = 0;
|
||||
|
||||
if (!nextTransportCheck)
|
||||
{
|
||||
@@ -2090,6 +2090,25 @@ bool PlayerbotAI::IsMainTank(Player* player)
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 PlayerbotAI::GetGroupTankNum(Player* player)
|
||||
{
|
||||
Group* group = player->GetGroup();
|
||||
if (!group)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
uint32 result = 0;
|
||||
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
|
||||
{
|
||||
Player* member = ref->GetSource();
|
||||
if (IsTank(member) && member->IsAlive())
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool PlayerbotAI::IsAssistTank(Player* player) { return IsTank(player) && !IsMainTank(player); }
|
||||
|
||||
bool PlayerbotAI::IsAssistTankOfIndex(Player* player, int index)
|
||||
|
||||
@@ -410,6 +410,7 @@ public:
|
||||
static bool IsCombo(Player* player, bool bySpec = false);
|
||||
static bool IsRangedDps(Player* player, bool bySpec = false);
|
||||
static bool IsMainTank(Player* player);
|
||||
static uint32 GetGroupTankNum(Player* player);
|
||||
bool IsAssistTank(Player* player);
|
||||
bool IsAssistTankOfIndex(Player* player, int index);
|
||||
bool IsHealAssistantOfIndex(Player* player, int index);
|
||||
|
||||
@@ -525,7 +525,10 @@ void PlayerbotHolder::OnBotLogin(Player* const bot)
|
||||
sGroupMgr->AddGroup(newGroup);
|
||||
newGroup->AddMember(bot);
|
||||
}
|
||||
|
||||
// if (master)
|
||||
// {
|
||||
// // bot->TeleportTo(master);
|
||||
// }
|
||||
uint32 accountId = bot->GetSession()->GetAccountId();
|
||||
bool isRandomAccount = sPlayerbotAIConfig->IsInRandomAccountList(accountId);
|
||||
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user