mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
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" />
This commit is contained in:
parent
cba6af27ad
commit
c6a07ad012
@ -163,6 +163,7 @@ public:
|
|||||||
creators["war stomp"] = &ActionContext::war_stomp;
|
creators["war stomp"] = &ActionContext::war_stomp;
|
||||||
creators["blood fury"] = &ActionContext::blood_fury;
|
creators["blood fury"] = &ActionContext::blood_fury;
|
||||||
creators["berserking"] = &ActionContext::berserking;
|
creators["berserking"] = &ActionContext::berserking;
|
||||||
|
creators["every man for himself"] = &ActionContext::every_man_for_himself;
|
||||||
creators["use trinket"] = &ActionContext::use_trinket;
|
creators["use trinket"] = &ActionContext::use_trinket;
|
||||||
creators["auto talents"] = &ActionContext::auto_talents;
|
creators["auto talents"] = &ActionContext::auto_talents;
|
||||||
creators["auto share quest"] = &ActionContext::auto_share_quest;
|
creators["auto share quest"] = &ActionContext::auto_share_quest;
|
||||||
@ -357,6 +358,7 @@ private:
|
|||||||
static Action* war_stomp(PlayerbotAI* botAI) { return new CastWarStompAction(botAI); }
|
static Action* war_stomp(PlayerbotAI* botAI) { return new CastWarStompAction(botAI); }
|
||||||
static Action* blood_fury(PlayerbotAI* botAI) { return new CastBloodFuryAction(botAI); }
|
static Action* blood_fury(PlayerbotAI* botAI) { return new CastBloodFuryAction(botAI); }
|
||||||
static Action* berserking(PlayerbotAI* botAI) { return new CastBerserkingAction(botAI); }
|
static Action* berserking(PlayerbotAI* botAI) { return new CastBerserkingAction(botAI); }
|
||||||
|
static Action* every_man_for_himself(PlayerbotAI* botAI) { return new CastEveryManForHimselfAction(botAI); }
|
||||||
static Action* use_trinket(PlayerbotAI* botAI) { return new UseTrinketAction(botAI); }
|
static Action* use_trinket(PlayerbotAI* botAI) { return new UseTrinketAction(botAI); }
|
||||||
static Action* auto_talents(PlayerbotAI* botAI) { return new AutoSetTalentsAction(botAI); }
|
static Action* auto_talents(PlayerbotAI* botAI) { return new AutoSetTalentsAction(botAI); }
|
||||||
static Action* auto_share_quest(PlayerbotAI* ai) { return new AutoShareQuestAction(ai); }
|
static Action* auto_share_quest(PlayerbotAI* ai) { return new AutoShareQuestAction(ai); }
|
||||||
|
|||||||
@ -311,6 +311,30 @@ bool CastVehicleSpellAction::Execute(Event /*event*/)
|
|||||||
return botAI->CastVehicleSpell(spellId, GetTarget());
|
return botAI->CastVehicleSpell(spellId, GetTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CastEveryManForHimselfAction::isPossible()
|
||||||
|
{
|
||||||
|
uint32 spellId = AI_VALUE2(uint32, "spell id", spell);
|
||||||
|
if (!spellId)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!bot->HasSpell(spellId))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (bot->HasSpellCooldown(spellId))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CastEveryManForHimselfAction::isUseful()
|
||||||
|
{
|
||||||
|
return bot->HasAuraType(SPELL_AURA_MOD_STUN) ||
|
||||||
|
bot->HasAuraType(SPELL_AURA_MOD_FEAR) ||
|
||||||
|
bot->HasAuraType(SPELL_AURA_MOD_ROOT) ||
|
||||||
|
bot->HasAuraType(SPELL_AURA_MOD_CONFUSE) ||
|
||||||
|
bot->HasAuraType(SPELL_AURA_MOD_CHARM);
|
||||||
|
}
|
||||||
|
|
||||||
bool UseTrinketAction::Execute(Event /*event*/)
|
bool UseTrinketAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Item* trinket1 = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET1);
|
Item* trinket1 = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET1);
|
||||||
|
|||||||
@ -284,6 +284,16 @@ public:
|
|||||||
CastBerserkingAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "berserking") {}
|
CastBerserkingAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "berserking") {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CastEveryManForHimselfAction : public CastSpellAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CastEveryManForHimselfAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "every man for himself") {}
|
||||||
|
|
||||||
|
std::string const GetTargetName() override { return "self target"; }
|
||||||
|
bool isPossible() override;
|
||||||
|
bool isUseful() override;
|
||||||
|
};
|
||||||
|
|
||||||
class UseTrinketAction : public Action
|
class UseTrinketAction : public Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -34,6 +34,9 @@ void RacialsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|||||||
NextAction("berserking", ACTION_NORMAL + 5),
|
NextAction("berserking", ACTION_NORMAL + 5),
|
||||||
NextAction("use trinket", ACTION_NORMAL + 4) }));
|
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)
|
RacialsStrategy::RacialsStrategy(PlayerbotAI* botAI) : Strategy(botAI)
|
||||||
|
|||||||
@ -464,6 +464,15 @@ bool AttackerCountTrigger::IsActive() { return AI_VALUE(uint8, "attacker count")
|
|||||||
|
|
||||||
bool HasAuraTrigger::IsActive() { return botAI->HasAura(getName(), GetTarget(), false, false, -1, true); }
|
bool HasAuraTrigger::IsActive() { return botAI->HasAura(getName(), GetTarget(), false, false, -1, true); }
|
||||||
|
|
||||||
|
bool LossOfControlTrigger::IsActive()
|
||||||
|
{
|
||||||
|
return bot->HasAuraType(SPELL_AURA_MOD_STUN) ||
|
||||||
|
bot->HasAuraType(SPELL_AURA_MOD_FEAR) ||
|
||||||
|
bot->HasAuraType(SPELL_AURA_MOD_ROOT) ||
|
||||||
|
bot->HasAuraType(SPELL_AURA_MOD_CONFUSE) ||
|
||||||
|
bot->HasAuraType(SPELL_AURA_MOD_CHARM);
|
||||||
|
}
|
||||||
|
|
||||||
bool HasAuraStackTrigger::IsActive()
|
bool HasAuraStackTrigger::IsActive()
|
||||||
{
|
{
|
||||||
Aura* aura = botAI->GetAura(getName(), GetTarget(), false, true, stack);
|
Aura* aura = botAI->GetAura(getName(), GetTarget(), false, true, stack);
|
||||||
|
|||||||
@ -746,6 +746,14 @@ public:
|
|||||||
bool IsActive() override;
|
bool IsActive() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LossOfControlTrigger : public Trigger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LossOfControlTrigger(PlayerbotAI* botAI) : Trigger(botAI, "loss of control", 1) {}
|
||||||
|
|
||||||
|
bool IsActive() override;
|
||||||
|
};
|
||||||
|
|
||||||
class IsSwimmingTrigger : public Trigger
|
class IsSwimmingTrigger : public Trigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -59,6 +59,7 @@ public:
|
|||||||
creators["party member almost full health"] = &TriggerContext::PartyMemberAlmostFullHealth;
|
creators["party member almost full health"] = &TriggerContext::PartyMemberAlmostFullHealth;
|
||||||
|
|
||||||
creators["generic boost"] = &TriggerContext::generic_boost;
|
creators["generic boost"] = &TriggerContext::generic_boost;
|
||||||
|
creators["loss of control"] = &TriggerContext::loss_of_control;
|
||||||
|
|
||||||
creators["protect party member"] = &TriggerContext::protect_party_member;
|
creators["protect party member"] = &TriggerContext::protect_party_member;
|
||||||
|
|
||||||
@ -363,6 +364,7 @@ private:
|
|||||||
return new PartyMemberAlmostFullHealthTrigger(botAI);
|
return new PartyMemberAlmostFullHealthTrigger(botAI);
|
||||||
}
|
}
|
||||||
static Trigger* generic_boost(PlayerbotAI* botAI) { return new GenericBoostTrigger(botAI); }
|
static Trigger* generic_boost(PlayerbotAI* botAI) { return new GenericBoostTrigger(botAI); }
|
||||||
|
static Trigger* loss_of_control(PlayerbotAI* botAI) { return new LossOfControlTrigger(botAI); }
|
||||||
static Trigger* PartyMemberCriticalHealth(PlayerbotAI* botAI)
|
static Trigger* PartyMemberCriticalHealth(PlayerbotAI* botAI)
|
||||||
{
|
{
|
||||||
return new PartyMemberCriticalHealthTrigger(botAI);
|
return new PartyMemberCriticalHealthTrigger(botAI);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user