BG BotFill : capture des bannieres d Arathi reparee
- GetNearGameObjectFlag reecrit : l ancienne detection par objet d aura (indices approximatifs, rayon 6 m) faisait cliquer les bots sur une banniere a 30 m -> sort d ouverture hors portee, zero capture. Renvoie desormais la banniere cliquable la plus proche (etat reel du noeud) dans un rayon de 30 m. - TryOccupiedABNode : le bot marche jusqu a la banniere (< 8 m) avant de lancer le sort, et s arrete pour canaliser l ouverture. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -314,11 +314,22 @@ void CommandAB::TryOccupiedABNode(ObjectGuid guid)
|
||||
GameObject const* pFlag = pBattlegroundAB->GetNearGameObjectFlag(player);
|
||||
if (!pFlag)
|
||||
return;
|
||||
// SylvaniaCore (module BG BotFill): hors de portee d interaction -> on marche vers la
|
||||
// banniere (ordre prioritaire type drapeau) au lieu de lancer un sort qui echouera
|
||||
float flagDist = player->GetDistance(pFlag);
|
||||
if (flagDist > 8.0f)
|
||||
{
|
||||
pBotAI->GetAIMovement()->AcceptCommand(pFlag->GetGUID(), true);
|
||||
return;
|
||||
}
|
||||
TC_LOG_ERROR("server.worldserver", "BGF-DBG: TryOccupiedABNode %s clique la banniere %u (dist %.1f)",
|
||||
player->GetName().c_str(), pFlag->GetEntry(), flagDist);
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(21651);
|
||||
if (!spellInfo)
|
||||
return;
|
||||
|
||||
pBotAI->Dismount();
|
||||
player->StopMoving();
|
||||
SpellCastTargets targets;
|
||||
targets.SetTargetMask(TARGET_FLAG_GAMEOBJECT);
|
||||
targets.SetGOTarget((GameObject*)pFlag);
|
||||
|
||||
@@ -715,49 +715,38 @@ Creature const* BattlegroundAB::GetClosestGraveCreature(const Player* player)
|
||||
|
||||
GameObject const* BattlegroundAB::GetNearGameObjectFlag(const Player* player)
|
||||
{
|
||||
// SylvaniaCore (module BG BotFill): reecriture. L ancienne version reperait le noeud via
|
||||
// un objet d aura avec des indices approximatifs et un rayon de 6 m : les bots cliquaient
|
||||
// une banniere a 30 m (sort d ouverture hors portee, aucune capture possible).
|
||||
// On renvoie la banniere cliquable (etat courant du noeud) la plus proche dans 30 m ;
|
||||
// l IA rapproche le bot avant de lancer le sort.
|
||||
if (!player)
|
||||
return NULL;
|
||||
uint8 node = BG_AB_NODE_STABLES;
|
||||
GameObject* nearObject = GetBgMap()->GetGameObject(BgObjects[node * 8 + 7]);
|
||||
while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!nearObject) || (!player->IsWithinDistInMap(nearObject, 6))))
|
||||
{
|
||||
++node;
|
||||
nearObject = GetBgMap()->GetGameObject(BgObjects[node * 8 + BG_AB_OBJECT_SPEEDBUFF_STABLES]);
|
||||
}
|
||||
|
||||
if (node == BG_AB_DYNAMIC_NODES_COUNT)
|
||||
return NULL;
|
||||
TeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
|
||||
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node] % 2))
|
||||
return NULL;
|
||||
if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL)
|
||||
GameObject* best = NULL;
|
||||
float bestDist = 30.0f;
|
||||
for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
{
|
||||
ObjectGuid nearFlagGuid = BgObjects[node * 8 + BG_AB_NODE_TYPE_NEUTRAL];
|
||||
GameObject* nearFlag = GetBgMap()->GetGameObject(nearFlagGuid);
|
||||
if (nearFlag && nearFlag->isSpawned())
|
||||
return nearFlag;
|
||||
return NULL;
|
||||
uint8 status = m_Nodes[node];
|
||||
// cliquable si neutre, ou tenu/conteste par l equipe adverse
|
||||
if (!(status == 0 || teamIndex == status % 2))
|
||||
continue;
|
||||
// BgObjects[node*8 + status] = banniere affichee pour cet etat (0=neutre,
|
||||
// 1/2=contestee A/H, 3/4=occupee A/H)
|
||||
GameObject* flag = GetBgMap()->GetGameObject(BgObjects[node * 8 + status]);
|
||||
if (!flag || !flag->isSpawned())
|
||||
continue;
|
||||
float dist = player->GetDistance(flag);
|
||||
if (dist < bestDist)
|
||||
{
|
||||
bestDist = dist;
|
||||
best = flag;
|
||||
}
|
||||
}
|
||||
else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) ||
|
||||
(m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED))
|
||||
{
|
||||
ObjectGuid nearFlagGuid = BgObjects[node * 8 + BG_AB_NODE_TYPE_CONTESTED + !teamIndex];
|
||||
GameObject* nearFlag = GetBgMap()->GetGameObject(nearFlagGuid);
|
||||
if (nearFlag && nearFlag->isSpawned())
|
||||
return nearFlag;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ObjectGuid nearFlagGuid = BgObjects[node * 8 + BG_AB_NODE_TYPE_OCCUPIED + !teamIndex];
|
||||
GameObject* nearFlag = GetBgMap()->GetGameObject(nearFlagGuid);
|
||||
if (nearFlag && nearFlag->isSpawned())
|
||||
return nearFlag;
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
return best;
|
||||
}
|
||||
|
||||
|
||||
uint8 BattlegroundAB::GetABNodeState(uint32 abNode)
|
||||
{
|
||||
if (abNode >= BG_AB_BattlegroundNodes::BG_AB_DYNAMIC_NODES_COUNT)
|
||||
|
||||
Reference in New Issue
Block a user