mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
<!-- Thank you for contributing to mod-playerbots, please make sure that you... 1. Submit your PR to the test-staging branch, not master. 2. Read the guidelines below before submitting. 3. Don't delete parts of this template. DESIGN PHILOSOPHY: We prioritize STABILITY, PERFORMANCE, AND PREDICTABILITY over behavioral realism. Every action and decision executes PER BOT AND PER TRIGGER. Small increases in logic complexity scale poorly across thousands of bots and negatively affect all. We prioritize a stable system over a smarter one. Bots don't need to behave perfectly; believable behavior is the goal, not human simulation. Default behavior must be cheap in processing; expensive behavior must be opt-in. Before submitting, make sure your changes aligns with these principles. --> ## Pull Request Description <!-- Describe what this change does and why it is needed --> Added Challenging Roar support to druid taunt spell Related with: #2002 ## How to Test the Changes <!-- - Step-by-step instructions to test the change. - Any required setup (e.g. multiple players, number of bots, specific configuration). - Expected behavior and how to verify it. --> - run dungeon with druid tank and monitor spell usage ## Impact Assessment <!-- As a generic test, before and after measure of pmon (playerbot pmon tick) can help you here. --> - Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots? - - [x] No, not at all - - [ ] Minimal impact (**explain below**) - - [ ] Moderate impact (**explain below**) - Does this change modify default bot behavior? - - [ ] No - - [x] Yes (**explain why**) Druid also use Challenging Roar as taunt spell - Does this change add new decision branches or increase maintenance complexity? - - [x] No - - [ ] Yes (**explain below**) ## Messages to Translate <!-- Bot messages have to be translatable, but you don't need to do the translations here. You only need to make sure the message is in a translatable format, and list in the table the message_key and the default English message. Search for GetBotTextOrDefault in the codebase for examples. --> - Does this change add bot messages to translate? - - [x] No - - [ ] Yes (**list messages in the table**) | Message key | Default message | | --------------- | ------------------ | | | | | | | ## AI Assistance <!-- AI assistance is allowed, but all submitted code must be fully understood, reviewed, and owned by the contributor. We expect contributors to be honest about what they do and do not understand. --> - Was AI assistance used while working on this change? - - [x] No - - [ ] Yes (**explain below**) <!-- If yes, please specify: - Purpose of usage (e.g. brainstorming, refactoring, documentation, code generation). - Which parts of the change were influenced or generated, and whether it was thoroughly reviewed. --> ## 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 (Conf comments, WiKi commands). ## Notes for Reviewers <!-- Anything else that's helpful to review or test your pull request. -->
258 lines
6.5 KiB
C++
258 lines
6.5 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 "BearTankDruidStrategy.h"
|
|
|
|
#include "Playerbots.h"
|
|
|
|
class BearTankDruidStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
|
|
{
|
|
public:
|
|
BearTankDruidStrategyActionNodeFactory()
|
|
{
|
|
creators["melee"] = &melee;
|
|
creators["feral charge - bear"] = &feral_charge_bear;
|
|
creators["swipe (bear)"] = &swipe_bear;
|
|
creators["faerie fire (feral)"] = &faerie_fire_feral;
|
|
creators["bear form"] = &bear_form;
|
|
creators["dire bear form"] = &dire_bear_form;
|
|
creators["mangle (bear)"] = &mangle_bear;
|
|
creators["maul"] = &maul;
|
|
creators["bash"] = &bash;
|
|
creators["swipe"] = &swipe;
|
|
creators["lacerate"] = &lacerate;
|
|
creators["demoralizing roar"] = &demoralizing_roar;
|
|
creators["taunt spell"] = &growl;
|
|
}
|
|
|
|
private:
|
|
static ActionNode* melee([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"melee",
|
|
/*P*/ { NextAction("feral charge - bear") },
|
|
/*A*/ {},
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* feral_charge_bear([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"feral charge - bear",
|
|
/*P*/ {},
|
|
/*A*/ { NextAction("reach melee") },
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* swipe_bear([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"swipe (bear)",
|
|
/*P*/ {},
|
|
/*A*/ {},
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* faerie_fire_feral([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"faerie fire (feral)",
|
|
/*P*/ { NextAction("feral charge - bear") },
|
|
/*A*/ {},
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* bear_form([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"bear form",
|
|
/*P*/ {},
|
|
/*A*/ {},
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* dire_bear_form([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"dire bear form",
|
|
/*P*/ { NextAction("caster form") },
|
|
/*A*/ { NextAction("bear form") },
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* mangle_bear([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"mangle (bear)",
|
|
/*P*/ {},
|
|
/*A*/ {},
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* maul([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"maul",
|
|
/*P*/ {},
|
|
/*A*/ { NextAction("melee") },
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* bash([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"bash",
|
|
/*P*/ {},
|
|
/*A*/ { NextAction("melee") },
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* swipe([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"swipe",
|
|
/*P*/ {},
|
|
/*A*/ { NextAction("melee") },
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* lacerate([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"lacerate",
|
|
/*P*/ {},
|
|
/*A*/ { NextAction("maul") },
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* growl([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"growl",
|
|
/*P*/ {},
|
|
/*A*/ {},
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
|
|
static ActionNode* demoralizing_roar([[maybe_unused]] PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode(
|
|
"demoralizing roar",
|
|
/*P*/ {},
|
|
/*A*/ {},
|
|
/*C*/ {}
|
|
);
|
|
}
|
|
};
|
|
|
|
BearTankDruidStrategy::BearTankDruidStrategy(PlayerbotAI* botAI) : FeralDruidStrategy(botAI)
|
|
{
|
|
actionNodeFactories.Add(new BearTankDruidStrategyActionNodeFactory());
|
|
}
|
|
|
|
std::vector<NextAction> BearTankDruidStrategy::getDefaultActions()
|
|
{
|
|
return {
|
|
NextAction("mangle (bear)", ACTION_DEFAULT + 0.5f),
|
|
NextAction("faerie fire (feral)", ACTION_DEFAULT + 0.4f),
|
|
NextAction("lacerate", ACTION_DEFAULT + 0.3f),
|
|
NextAction("maul", ACTION_DEFAULT + 0.2f),
|
|
NextAction("enrage", ACTION_DEFAULT + 0.1f),
|
|
NextAction("melee", ACTION_DEFAULT)
|
|
};
|
|
}
|
|
|
|
void BearTankDruidStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|
{
|
|
FeralDruidStrategy::InitTriggers(triggers);
|
|
|
|
triggers.push_back(
|
|
new TriggerNode(
|
|
"enemy out of melee",
|
|
{
|
|
NextAction("feral charge - bear", ACTION_NORMAL + 8)
|
|
}
|
|
)
|
|
);
|
|
triggers.push_back(
|
|
new TriggerNode(
|
|
"bear form",
|
|
{
|
|
NextAction("dire bear form", ACTION_HIGH + 8)
|
|
}
|
|
)
|
|
);
|
|
triggers.push_back(
|
|
new TriggerNode(
|
|
"low health",
|
|
{
|
|
NextAction("frenzied regeneration", ACTION_HIGH + 7)
|
|
}
|
|
)
|
|
);
|
|
triggers.push_back(
|
|
new TriggerNode(
|
|
"faerie fire (feral)",
|
|
{
|
|
NextAction("faerie fire (feral)", ACTION_HIGH + 7)
|
|
}
|
|
)
|
|
);
|
|
triggers.push_back(new TriggerNode("high aoe", {NextAction("challenging roar", ACTION_HIGH + 8)}));
|
|
triggers.push_back(
|
|
new TriggerNode(
|
|
"lose aggro",
|
|
{
|
|
NextAction("growl", ACTION_HIGH + 8)
|
|
}
|
|
)
|
|
);
|
|
triggers.push_back(
|
|
new TriggerNode(
|
|
"medium aoe",
|
|
{
|
|
NextAction("demoralizing roar", ACTION_HIGH + 6),
|
|
NextAction("swipe (bear)", ACTION_HIGH + 6)
|
|
}
|
|
)
|
|
);
|
|
triggers.push_back(
|
|
new TriggerNode(
|
|
"light aoe",
|
|
{
|
|
NextAction("swipe (bear)", ACTION_HIGH + 5)
|
|
}
|
|
)
|
|
);
|
|
triggers.push_back(
|
|
new TriggerNode(
|
|
"bash",
|
|
{
|
|
NextAction("bash", ACTION_INTERRUPT + 2)
|
|
}
|
|
)
|
|
);
|
|
triggers.push_back(
|
|
new TriggerNode(
|
|
"bash on enemy healer",
|
|
{
|
|
NextAction("bash on enemy healer", ACTION_INTERRUPT + 1)
|
|
}
|
|
)
|
|
);
|
|
}
|