Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
276 changes: 276 additions & 0 deletions .zenflow/tasks/tok-lighthouse-battleground-5045/plan.md

Large diffs are not rendered by default.

312 changes: 312 additions & 0 deletions .zenflow/tasks/tok-lighthouse-battleground-5045/requirements.md

Large diffs are not rendered by default.

499 changes: 499 additions & 0 deletions .zenflow/tasks/tok-lighthouse-battleground-5045/spec.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ class TempleOfKotmoguScript : public DominationScriptBase
/// Get the priority order for grabbing orbs
std::vector<uint32> GetOrbPriority(uint32 faction) const;

// ========================================================================
// RUNTIME BEHAVIOR (lighthouse pattern)
// ========================================================================

/// Execute TOK-specific strategy for a bot (overrides IBGScript)
bool ExecuteStrategy(::Player* player) override;

// ========================================================================
// ENTERPRISE-GRADE POSITIONING
// ========================================================================
Expand Down Expand Up @@ -157,6 +164,9 @@ class TempleOfKotmoguScript : public DominationScriptBase
/// Get distance from an orb to center
float GetOrbToCenterDistance(uint32 orbId) const;

/// Get orb position (uses dynamic discovery if available, falls back to hardcoded)
Position GetDynamicOrbPosition(uint32 orbId) const;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This function was moved from the private section to the public section. However, it appears to only be used by PickupOrb, which is a private method within this class. To maintain proper encapsulation and a clean public API, GetDynamicOrbPosition should be moved back to the private section of the class.


protected:
// ========================================================================
// BASE CLASS OVERRIDES
Expand All @@ -173,6 +183,25 @@ class TempleOfKotmoguScript : public DominationScriptBase
// HELPER METHODS
// ========================================================================

// ========================================================================
// RUNTIME BEHAVIOR HELPERS
// ========================================================================

/// Pick up the nearest available orb
bool PickupOrb(::Player* player);

/// Defend nearest friendly orb carrier or patrol center
bool DefendOrbCarrier(::Player* player);

/// Hunt and attack enemy orb carriers
bool HuntEnemyOrbCarrier(::Player* player);

/// Escort nearest friendly orb carrier in formation
bool EscortOrbCarrier(::Player* player);

/// Move orb carrier toward center or hold position
bool ExecuteOrbCarrierMovement(::Player* player);

BGObjectiveData GetOrbData(uint32 orbId) const;

/// Calculate 3D distance between two points
Expand Down Expand Up @@ -228,12 +257,6 @@ class TempleOfKotmoguScript : public DominationScriptBase
*/
bool InitializePositionDiscovery();

/**
* @brief Get orb position (uses dynamic discovery if available)
* @param orbId Orb identifier (0-3)
* @return Validated orb position
*/
Position GetDynamicOrbPosition(uint32 orbId) const;
};

} // namespace Playerbot::Coordination::Battleground
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include <functional>
#include <cstdint>

// Forward declarations
class Player;

// Forward declare BattlegroundCoordinator in its actual namespace
namespace Playerbot {
class BattlegroundCoordinator;
Expand Down Expand Up @@ -719,6 +722,22 @@ class IBGScript
*/
virtual bool ShouldUseVehicle(ObjectGuid botGuid, uint32 vehicleEntry) const { return true; }

// ========================================================================
// RUNTIME BEHAVIOR
// ========================================================================

/**
* @brief Execute BG-specific strategy for a bot player
*
* BG scripts that implement runtime behavior (movement, combat, orb pickup,
* etc.) override this method. The BattlegroundAI delegates to this method
* instead of embedding BG-specific logic.
*
* @param player The bot player to execute strategy for
* @return true if the script handled the player's behavior
*/
virtual bool ExecuteStrategy(::Player* player) { return false; }

// ========================================================================
// UTILITY
// ========================================================================
Expand Down
40 changes: 16 additions & 24 deletions src/modules/Playerbot/PvP/BattlegroundAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "../Movement/BotMovementUtil.h"
#include <algorithm>
#include <cmath>
#include <limits>

// WSG/TP Flag aura IDs
constexpr uint32 ALLIANCE_FLAG_AURA = 23333; // Carrying Horde flag
Expand Down Expand Up @@ -1565,36 +1566,27 @@ bool BattlegroundAI::DefendGate(::Player* player)
// ============================================================================
// TEMPLE OF KOTMOGU STRATEGY
// ============================================================================
// Runtime behavior has been moved to TempleOfKotmoguScript (lighthouse pattern).
// This is a thin delegation wrapper.

void BattlegroundAI::ExecuteKotmoguStrategy(::Player* player)
{
if (!player)
if (!player || !player->IsInWorld() || !player->IsAlive())
return;

// Pick up orb or defend orb carrier
PickupOrb(player);
DefendOrbCarrier(player);
}

bool BattlegroundAI::PickupOrb(::Player* player)
{
if (!player)
return false;

// Full implementation: Find and pick up orb
TC_LOG_DEBUG("playerbot", "BattlegroundAI: Player {} picking up orb",
player->GetGUID().GetCounter());

return true;
}

bool BattlegroundAI::DefendOrbCarrier(::Player* player)
{
if (!player)
return false;
BattlegroundCoordinator* coordinator = sBGCoordinatorMgr->GetCoordinatorForPlayer(player);
if (coordinator)
{
auto* script = coordinator->GetScript();
if (script && script->GetBGType() == BGType::TEMPLE_OF_KOTMOGU)
{
if (script->ExecuteStrategy(player))
return;
}
}

// Full implementation: Find friendly orb carrier and defend
return true;
TC_LOG_DEBUG("playerbots.bg", "[TOK] {} no coordinator/script available, idle",
player->GetName());
}

// ============================================================================
Expand Down
4 changes: 1 addition & 3 deletions src/modules/Playerbot/PvP/BattlegroundAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,8 @@ class TC_GAME_API BattlegroundAI final
bool AttackGate(::Player* player);
bool DefendGate(::Player* player);

// Temple of Kotmogu
// Temple of Kotmogu (delegates to TempleOfKotmoguScript::ExecuteStrategy)
void ExecuteKotmoguStrategy(::Player* player);
bool PickupOrb(::Player* player);
bool DefendOrbCarrier(::Player* player);

// Silvershard Mines
void ExecuteSilvershardStrategy(::Player* player);
Expand Down
Loading