Compare commits

...

3 Commits

Author SHA1 Message Date
SaW
27311b734d Revert "feat: Improve bot mount behavior to faster close distance between bot and master" (#1855)
Reverts mod-playerbots/mod-playerbots#1760

This, as it is causing issues in BG, where bots just don't dismount and
just stand there instead.

<img width="2336" height="1374" alt="image"
src="https://github.com/user-attachments/assets/b61d7a77-1561-4f05-a438-edbb9321e113"
/>
2025-11-18 20:06:24 +01:00
SaW
bb5ed37cd3 Update codestyle_cpp.yml for review events and concurrency (#1836)
Include ready_for_review type, to run when draft is converted to ready.

Include concurrency; cancels obsolete tasks on new commits.
2025-11-18 18:48:52 +01:00
Jay
e88c1b779b Minor README.md corrections (#1849)
- Removed double "is" in acknowledgements
- Made the acknowledgements section more grammatical by using "based on"
instead of "based off"
- Corrected misspelling of "implemented"
- Standardized instances of "Playerbots" to `mod-playerbots` or properly
capitalized `Playerbots`
- Minor change of "for the continued contributions" to "for their
continued contributions" in the Acknowledgements section
2025-11-18 18:08:16 +01:00
4 changed files with 12 additions and 65 deletions

View File

@@ -5,11 +5,16 @@ on:
- opened
- reopened
- synchronize
- ready_for_review
paths:
- src/**
- "!README.md"
- "!docs/**"
concurrency:
group: "codestyle-cppcheck-${{ github.event.pull_request.number }}"
cancel-in-progress: true
jobs:
triage:
runs-on: ubuntu-latest

View File

@@ -34,7 +34,7 @@ We also have a **[Discord server](https://discord.gg/NQm5QShwf9)** where you can
Supported platforms are Ubuntu, Windows, and macOS. Other Linux distributions may work, but may not receive support.
**All `mod-playerbots` installations require a custom branch of AzerothCore: [mod-playerbots/azerothcore-wotlk/tree/Playerbot](https://github.com/mod-playerbots/azerothcore-wotlk/tree/Playerbot).** This branch allows the playerbots module to build and function. Updates from the upstream are implemneted regularly to this branch. Instructions for installing this required branch and this module are provided below.
**All `mod-playerbots` installations require a custom branch of AzerothCore: [mod-playerbots/azerothcore-wotlk/tree/Playerbot](https://github.com/mod-playerbots/azerothcore-wotlk/tree/Playerbot).** This branch allows the `mod-playerbots` module to build and function. Updates from the upstream are implemented regularly to this branch. Instructions for installing this required branch and this module are provided below.
### Cloning the Repositories
@@ -50,7 +50,7 @@ For more information, refer to the [AzerothCore Installation Guide](https://www.
### Docker Installation
Docker installations are considered experimental (unofficial with limited support), and previous Docker experience is recommended. To install the `mod-playerbots` on Docker, first clone the required branch of AzerothCore and this module:
Docker installations are considered experimental (unofficial with limited support), and previous Docker experience is recommended. To install `mod-playerbots` on Docker, first clone the required branch of AzerothCore and this module:
```bash
git clone https://github.com/mod-playerbots/azerothcore-wotlk.git --branch=Playerbot
@@ -103,7 +103,7 @@ Please click on the "⭐" button to stay up to date and help us gain more visibi
## Acknowledgements
`mod-playerbots` is is based off [ZhengPeiRu21/mod-playerbots](https://github.com/ZhengPeiRu21/mod-playerbots) and [celguar/mangosbot-bots](https://github.com/celguar/mangosbot-bots). We extend our gratitude to [@ZhengPeiRu21](https://github.com/ZhengPeiRu21) and [@celguar](https://github.com/celguar) for the continued efforts in maintaining the module.
`mod-playerbots` is based on [ZhengPeiRu21/mod-playerbots](https://github.com/ZhengPeiRu21/mod-playerbots) and [celguar/mangosbot-bots](https://github.com/celguar/mangosbot-bots). We extend our gratitude to [@ZhengPeiRu21](https://github.com/ZhengPeiRu21) and [@celguar](https://github.com/celguar) for their continued efforts in maintaining the module.
Also, a thank you to the many contributors who've helped build this project:

View File

@@ -122,21 +122,18 @@ bool CheckMountStateAction::Execute(Event /*event*/)
bool shouldMount = false;
Unit* currentTarget = AI_VALUE(Unit*, "current target");
bool masterInCombat = master && master->IsInCombat();
if (currentTarget && (bot->IsInCombat() || masterInCombat))
if (currentTarget)
{
// Use target-based logic if bot is in combat OR master is in combat and needs assistance
float dismountDistance = CalculateDismountDistance();
float mountDistance = CalculateMountDistance();
float combatReach = bot->GetCombatReach() + currentTarget->GetCombatReach();
float distanceToTarget = bot->GetExactDist(currentTarget);
shouldDismount = (distanceToTarget <= dismountDistance);
shouldMount = (distanceToTarget > mountDistance);
shouldDismount = (distanceToTarget <= dismountDistance + combatReach);
shouldMount = (distanceToTarget > mountDistance + combatReach);
}
else
{
// If neither bot nor master is in combat, prioritize master-following
shouldMount = true;
}
@@ -163,19 +160,10 @@ bool CheckMountStateAction::Execute(Event /*event*/)
else if (ShouldDismountForMaster(master) && bot->IsMounted())
{
// If master dismounted, stay mounted until close enough to assist
if (StayMountedToCloseDistance())
return false;
Dismount();
return true;
}
// Mount up to close distance to master if beneficial - allow mounting even if master is in combat
// as long as the bot itself is not in combat and has no attackers
else if (!bot->IsMounted() && noAttackers && !bot->IsInCombat() && ShouldMountToCloseDistance())
return Mount();
return false;
}
@@ -409,50 +397,6 @@ bool CheckMountStateAction::TryRandomMountFiltered(const std::map<int32, std::ve
return false;
}
bool CheckMountStateAction::StayMountedToCloseDistance() const
{
// Keep the bot mounted while closing distance to a recently dismounted master.
// Rationale: if the master dismounts far away, immediately dismounting slows the bot down
// and delays assistance. Instead, remain mounted until within reasonable proximity
// of the master, then dismount to help.
if (!master)
return false;
float distToMaster = sServerFacade->GetDistance2d(bot, master);
// If master is in combat, dismount at combat assist range to help immediately
if (master->IsInCombat())
{
float assistRange = CalculateDismountDistance();
return distToMaster > assistRange;
}
// If master is not in combat, use smaller proximity range for general following
float masterProximityRange = 10.0f; // Close enough to be near master but not attack range
return distToMaster > masterProximityRange;
}
bool CheckMountStateAction::ShouldMountToCloseDistance() const
{
// Mount up to close distance to master if beneficial
// Uses the same logic as CalculateMountDistance() which already considers the 2-second mount cast time
// This handles cases where master is in combat but bot isn't, and bot needs to mount to reach master
if (!master)
return false;
// Only mount to close distance when actively following
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
return false;
float distToMaster = sServerFacade->GetDistance2d(bot, master);
float mountDistance = CalculateMountDistance();
// Mount if distance is greater than the calculated mount distance threshold
return distToMaster > mountDistance;
}
float CheckMountStateAction::CalculateDismountDistance() const
{
// Warrior bots should dismount far enough to charge (because it's important for generating some initial rage),

View File

@@ -60,8 +60,6 @@ private:
bool TryPreferredMount(Player* master) const;
uint32 GetMountType(Player* master) const;
bool TryRandomMountFiltered(const std::map<int32, std::vector<uint32>>& spells, int32 masterSpeed) const;
bool StayMountedToCloseDistance() const;
bool ShouldMountToCloseDistance() const;
};
#endif