mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-13 15:23:46 +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:
@@ -22,7 +22,7 @@ bool UnstealthTrigger::IsActive()
|
||||
return botAI->HasAura("stealth", bot) && !AI_VALUE(uint8, "attacker count") &&
|
||||
(AI_VALUE2(bool, "moving", "self target") &&
|
||||
((botAI->GetMaster() &&
|
||||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "group leader"), 10.0f) &&
|
||||
ServerFacade::instance().IsDistanceGreaterThan(AI_VALUE2(float, "distance", "group leader"), 10.0f) &&
|
||||
AI_VALUE2(bool, "moving", "group leader")) ||
|
||||
!AI_VALUE(uint8, "attacker count")));
|
||||
}
|
||||
@@ -60,7 +60,7 @@ bool StealthTrigger::IsActive()
|
||||
if (bot->InArena())
|
||||
distance += 15;
|
||||
|
||||
return target && sServerFacade->GetDistance2d(bot, target) < distance;
|
||||
return target && ServerFacade::instance().GetDistance2d(bot, target) < distance;
|
||||
}
|
||||
|
||||
bool SapTrigger::IsPossible() { return bot->GetLevel() > 10 && bot->HasSpell(6770) && !bot->IsInCombat(); }
|
||||
@@ -99,8 +99,8 @@ bool SprintTrigger::IsActive()
|
||||
|
||||
return AI_VALUE2(bool, "moving", "self target") &&
|
||||
(AI_VALUE2(bool, "moving", "dps target") || AI_VALUE2(bool, "moving", "enemy player target")) && targeted &&
|
||||
(sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "dps target"), distance) ||
|
||||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), distance));
|
||||
(ServerFacade::instance().IsDistanceGreaterThan(AI_VALUE2(float, "distance", "dps target"), distance) ||
|
||||
ServerFacade::instance().IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), distance));
|
||||
}
|
||||
|
||||
bool ExposeArmorTrigger::IsActive()
|
||||
|
||||
Reference in New Issue
Block a user