mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Compare commits
3 Commits
05057ae9b5
...
27311b734d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27311b734d | ||
|
|
bb5ed37cd3 | ||
|
|
e88c1b779b |
5
.github/workflows/codestyle_cpp.yml
vendored
5
.github/workflows/codestyle_cpp.yml
vendored
@@ -5,11 +5,16 @@ on:
|
|||||||
- opened
|
- opened
|
||||||
- reopened
|
- reopened
|
||||||
- synchronize
|
- synchronize
|
||||||
|
- ready_for_review
|
||||||
paths:
|
paths:
|
||||||
- src/**
|
- src/**
|
||||||
- "!README.md"
|
- "!README.md"
|
||||||
- "!docs/**"
|
- "!docs/**"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "codestyle-cppcheck-${{ github.event.pull_request.number }}"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
triage:
|
triage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -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.
|
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
|
### Cloning the Repositories
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ For more information, refer to the [AzerothCore Installation Guide](https://www.
|
|||||||
|
|
||||||
### Docker Installation
|
### 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
|
```bash
|
||||||
git clone https://github.com/mod-playerbots/azerothcore-wotlk.git --branch=Playerbot
|
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
|
## 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:
|
Also, a thank you to the many contributors who've helped build this project:
|
||||||
|
|
||||||
|
|||||||
@@ -122,21 +122,18 @@ bool CheckMountStateAction::Execute(Event /*event*/)
|
|||||||
bool shouldMount = false;
|
bool shouldMount = false;
|
||||||
|
|
||||||
Unit* currentTarget = AI_VALUE(Unit*, "current target");
|
Unit* currentTarget = AI_VALUE(Unit*, "current target");
|
||||||
bool masterInCombat = master && master->IsInCombat();
|
if (currentTarget)
|
||||||
|
|
||||||
if (currentTarget && (bot->IsInCombat() || masterInCombat))
|
|
||||||
{
|
{
|
||||||
// Use target-based logic if bot is in combat OR master is in combat and needs assistance
|
|
||||||
float dismountDistance = CalculateDismountDistance();
|
float dismountDistance = CalculateDismountDistance();
|
||||||
float mountDistance = CalculateMountDistance();
|
float mountDistance = CalculateMountDistance();
|
||||||
|
float combatReach = bot->GetCombatReach() + currentTarget->GetCombatReach();
|
||||||
float distanceToTarget = bot->GetExactDist(currentTarget);
|
float distanceToTarget = bot->GetExactDist(currentTarget);
|
||||||
|
|
||||||
shouldDismount = (distanceToTarget <= dismountDistance);
|
shouldDismount = (distanceToTarget <= dismountDistance + combatReach);
|
||||||
shouldMount = (distanceToTarget > mountDistance);
|
shouldMount = (distanceToTarget > mountDistance + combatReach);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If neither bot nor master is in combat, prioritize master-following
|
|
||||||
shouldMount = true;
|
shouldMount = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,19 +160,10 @@ bool CheckMountStateAction::Execute(Event /*event*/)
|
|||||||
|
|
||||||
else if (ShouldDismountForMaster(master) && bot->IsMounted())
|
else if (ShouldDismountForMaster(master) && bot->IsMounted())
|
||||||
{
|
{
|
||||||
// If master dismounted, stay mounted until close enough to assist
|
|
||||||
if (StayMountedToCloseDistance())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Dismount();
|
Dismount();
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,50 +397,6 @@ bool CheckMountStateAction::TryRandomMountFiltered(const std::map<int32, std::ve
|
|||||||
return false;
|
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
|
float CheckMountStateAction::CalculateDismountDistance() const
|
||||||
{
|
{
|
||||||
// Warrior bots should dismount far enough to charge (because it's important for generating some initial rage),
|
// Warrior bots should dismount far enough to charge (because it's important for generating some initial rage),
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ private:
|
|||||||
bool TryPreferredMount(Player* master) const;
|
bool TryPreferredMount(Player* master) const;
|
||||||
uint32 GetMountType(Player* master) const;
|
uint32 GetMountType(Player* master) const;
|
||||||
bool TryRandomMountFiltered(const std::map<int32, std::vector<uint32>>& spells, int32 masterSpeed) const;
|
bool TryRandomMountFiltered(const std::map<int32, std::vector<uint32>>& spells, int32 masterSpeed) const;
|
||||||
bool StayMountedToCloseDistance() const;
|
|
||||||
bool ShouldMountToCloseDistance() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user