mod-playerbots/src/Ai/Base/Strategy/RacialsStrategy.cpp
kadeshar c6a07ad012
Every Man for Himself racial support (#2198)
# Pull Request

Added Every Man for Himself racial support
Partially resolves:
https://github.com/mod-playerbots/mod-playerbots/issues/2002

---

## How to Test the Changes

- when human bot is in combat apply aura via command `.aura 20066`
- bot should use "Every Man for Himself" to remove aura

## 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?
- - [ ] No
- - [x] Yes (**explain why**)

Human bots now using "Every Man for Himself" by default where in combat

If this introduces more advanced or AI-heavy logic:
- - [x] Lightweight mode remains the default
- - [x] More complex behavior is optional and thereby configurable
---

## AI Assistance

Was AI assistance (e.g. ChatGPT or similar tools) used while working on
this change?
- - [ ] No
- - [x] Yes (**explain below**)

Copilot CLI to review changes

---

## 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

Test result:
<img width="358" height="97" alt="obraz"
src="https://github.com/user-attachments/assets/66044a93-d73b-4706-ae2f-ea8ae6e25438"
/>
2026-03-20 20:41:22 +01:00

46 lines
1.6 KiB
C++

/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
* and/or modify it under version 3 of the License, or (at your option), any later version.
*/
#include "RacialsStrategy.h"
class RacialsStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
{
public:
RacialsStrategyActionNodeFactory() { creators["lifeblood"] = &lifeblood; }
private:
static ActionNode* lifeblood(PlayerbotAI* botAI)
{
return new ActionNode("lifeblood",
/*P*/ {},
/*A*/ { NextAction("gift of the naaru") },
/*C*/ {});
}
};
void RacialsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
triggers.push_back(
new TriggerNode("low health", { NextAction("lifeblood", ACTION_NORMAL + 5) }));
triggers.push_back(
new TriggerNode("medium aoe", { NextAction("war stomp", ACTION_NORMAL + 5) }));
triggers.push_back(new TriggerNode(
"low mana", { NextAction("arcane torrent", ACTION_NORMAL + 5) }));
triggers.push_back(new TriggerNode(
"generic boost", { NextAction("blood fury", ACTION_NORMAL + 5),
NextAction("berserking", ACTION_NORMAL + 5),
NextAction("use trinket", ACTION_NORMAL + 4) }));
triggers.push_back(new TriggerNode(
"loss of control", { NextAction("every man for himself", ACTION_EMERGENCY + 1) }));
}
RacialsStrategy::RacialsStrategy(PlayerbotAI* botAI) : Strategy(botAI)
{
actionNodeFactories.Add(new RacialsStrategyActionNodeFactory());
}