mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-02 02:13:47 +00:00
Improper singletons migration to clean Meyer's singletons (cherry-pick) (#2082)
# Pull Request
- Applies the clean and corrected singletons, Meyer pattern. (cherry
picked from @SmashingQuasar )
Testing by just playing the game in various ways. Been tested by myself
@Celandriel and @SmashingQuasar
---
## Complexity & Impact
- Does this change add new decision branches?
- [x] No
- [ ] Yes (**explain below**)
- Does this change increase per-bot or per-tick processing?
- [x] No
- [ ] Yes (**describe and justify impact**)
- Could this logic scale poorly under load?
- [x] No
- [ ] Yes (**explain why**)
---
## Defaults & Configuration
- Does this change modify default bot behavior?
- [x] No
- [ ] Yes (**explain why**)
---
## AI Assistance
- Was AI assistance (e.g. ChatGPT or similar tools) used while working
on this change?
- [x] No
- [ ] Yes (**explain below**)
---
## Final Checklist
- [x] Stability is not compromised
- [x] Performance impact is understood, tested, and acceptable
- [x] Added logic complexity is justified and explained
- [x] Documentation updated if needed
---
## Notes for Reviewers
Anything that significantly improves realism at the cost of stability or
performance should be carefully discussed
before merging.
---------
Co-authored-by: Nicolas Lebacq <nicolas.cordier@outlook.com>
Co-authored-by: Keleborn <22352763+Celandriel@users.noreply.github.com>
This commit is contained in:
@@ -89,7 +89,7 @@ bool CheckMountStateAction::isUseful()
|
||||
return false;
|
||||
|
||||
// Not useful when level lower than minimum required
|
||||
if (bot->GetLevel() < sPlayerbotAIConfig->useGroundMountAtMinLevel)
|
||||
if (bot->GetLevel() < sPlayerbotAIConfig.useGroundMountAtMinLevel)
|
||||
return false;
|
||||
|
||||
// Allow mounting while transformed only if the form allows it
|
||||
@@ -402,7 +402,7 @@ float CheckMountStateAction::CalculateDismountDistance() const
|
||||
// Warrior bots should dismount far enough to charge (because it's important for generating some initial rage),
|
||||
// a real player would be riding toward enemy mashing the charge key but the bots won't cast charge while mounted.
|
||||
bool isMelee = PlayerbotAI::IsMelee(bot);
|
||||
float dismountDistance = isMelee ? sPlayerbotAIConfig->meleeDistance + 2.0f : sPlayerbotAIConfig->spellDistance + 2.0f;
|
||||
float dismountDistance = isMelee ? sPlayerbotAIConfig.meleeDistance + 2.0f : sPlayerbotAIConfig.spellDistance + 2.0f;
|
||||
return bot->getClass() == CLASS_WARRIOR ? std::max(18.0f, dismountDistance) : dismountDistance;
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ float CheckMountStateAction::CalculateMountDistance() const
|
||||
// seconds:
|
||||
// 21 / 7 = 21 / 14 + 1.5 = 3 (7 = dismounted speed 14 = epic-mount speed 1.5 = mount-spell cast time)
|
||||
bool isMelee = PlayerbotAI::IsMelee(bot);
|
||||
float baseDistance = isMelee ? sPlayerbotAIConfig->meleeDistance + 10.0f : sPlayerbotAIConfig->spellDistance + 10.0f;
|
||||
float baseDistance = isMelee ? sPlayerbotAIConfig.meleeDistance + 10.0f : sPlayerbotAIConfig.spellDistance + 10.0f;
|
||||
return std::max(21.0f, baseDistance);
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ int32 CheckMountStateAction::CalculateMasterMountSpeed(Player* master, const Mou
|
||||
int32 ridingSkill = bot->GetPureSkillValue(SKILL_RIDING);
|
||||
int32 botLevel = bot->GetLevel();
|
||||
|
||||
if (ridingSkill <= 75 && botLevel < static_cast<int32>(sPlayerbotAIConfig->useFastGroundMountAtMinLevel))
|
||||
if (ridingSkill <= 75 && botLevel < static_cast<int32>(sPlayerbotAIConfig.useFastGroundMountAtMinLevel))
|
||||
return 59;
|
||||
|
||||
// If there is a master and bot not in BG, use master's aura effects.
|
||||
|
||||
Reference in New Issue
Block a user