mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
# Pull Request Fix the incorrect logic flaw when processing actions from different sources. It should be: `isUseful` -> `isPossible`. The original logic is based on the Mangosbot code and the impl presented inside `Engine::DoNextAction`. This should fix all wrong validation orders for triggers and direct/specific actions. Code style is based on the AzerothCore style guide + clang-format. --- ## Design Philosophy We prioritize **stability, performance, and predictability** over behavioral realism. Complex player-mimicking logic is intentionally limited due to its negative impact on scalability, maintainability, and long-term robustness. Excessive processing overhead can lead to server hiccups, increased CPU usage, and degraded performance for all participants. Because every action and decision tree is executed **per bot and per trigger**, even small increases in logic complexity can scale poorly and negatively affect both players and world (random) bots. Bots are not expected to behave perfectly, and perfect simulation of human decision-making is not a project goal. Increased behavioral realism often introduces disproportionate cost, reduced predictability, and significantly higher maintenance overhead. Every additional branch of logic increases long-term responsibility. All decision paths must be tested, validated, and maintained continuously as the system evolves. If advanced or AI-intensive behavior is introduced, the **default configuration must remain the lightweight decision model**. More complex behavior should only be available as an **explicit opt-in option**, clearly documented as having a measurable performance cost. Principles: - **Stability before intelligence** A stable system is always preferred over a smarter one. - **Performance is a shared resource** Any increase in bot cost affects all players and all bots. - **Simple logic scales better than smart logic** Predictable behavior under load is more valuable than perfect decisions. - **Complexity must justify itself** If a feature cannot clearly explain its cost, it should not exist. - **Defaults must be cheap** Expensive behavior must always be optional and clearly communicated. - **Bots should look reasonable, not perfect** The goal is believable behavior, not human simulation. Before submitting, confirm that this change aligns with those principles. --- ## Feature Evaluation Please answer the following: - Describe the **minimum logic** required to achieve the intended behavior? - Describe the **cheapest implementation** that produces an acceptable result? - Describe the **runtime cost** when this logic executes across many bots? --- ## How to Test the Changes - Step-by-step instructions to test the change - Any required setup (e.g. multiple players, bots, specific configuration) - Expected behavior and how to verify it ## 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**) If this introduces more advanced or AI-heavy logic: - - [ ] Lightweight mode remains the default - - [ ] 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? - - [x] No - - [ ] Yes (**explain below**) If yes, please specify: - AI tool or model used (e.g. ChatGPT, GPT-4, Claude, etc.) - Purpose of usage (e.g. brainstorming, refactoring, documentation, code generation) - Which parts of the change were influenced or generated - Whether the result was manually reviewed and adapted AI assistance is allowed, but all submitted code must be fully understood, reviewed, and owned by the contributor. Any AI-influenced changes must be verified against existing CORE and PB logic. We expect contributors to be honest about what they do and do not understand. --- ## 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.
227 lines
8.6 KiB
C++
227 lines
8.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.
|
|
*/
|
|
|
|
#ifndef _PLAYERBOT_PRIESTACTIONS_H
|
|
#define _PLAYERBOT_PRIESTACTIONS_H
|
|
|
|
#include "GenericSpellActions.h"
|
|
#include "PlayerbotAIConfig.h"
|
|
#include "Playerbots.h"
|
|
|
|
class PlayerbotAI;
|
|
|
|
// disc
|
|
BUFF_ACTION(CastPowerWordFortitudeAction, "power word: fortitude");
|
|
BUFF_PARTY_ACTION(CastPowerWordFortitudeOnPartyAction, "power word: fortitude");
|
|
BUFF_PARTY_ACTION(CastPrayerOfFortitudeOnPartyAction, "prayer of fortitude");
|
|
BUFF_ACTION(CastPowerWordShieldAction, "power word: shield");
|
|
|
|
BUFF_ACTION(CastInnerFireAction, "inner fire");
|
|
CURE_ACTION(CastDispelMagicAction, "dispel magic");
|
|
CURE_PARTY_ACTION(CastDispelMagicOnPartyAction, "dispel magic", DISPEL_MAGIC);
|
|
SPELL_ACTION(CastDispelMagicOnTargetAction, "dispel magic");
|
|
CC_ACTION(CastShackleUndeadAction, "shackle undead");
|
|
SPELL_ACTION_U(CastManaBurnAction, "mana burn",
|
|
AI_VALUE2(uint8, "mana", "self target") < 50 && AI_VALUE2(uint8, "mana", "current target") >= 20);
|
|
BUFF_ACTION(CastLevitateAction, "levitate");
|
|
BUFF_ACTION(CastDivineSpiritAction, "divine spirit");
|
|
BUFF_PARTY_ACTION(CastDivineSpiritOnPartyAction, "divine spirit");
|
|
BUFF_PARTY_ACTION(CastPrayerOfSpiritOnPartyAction, "prayer of spirit");
|
|
// disc 2.4.3
|
|
SPELL_ACTION(CastMassDispelAction, "mass dispel");
|
|
|
|
// disc talents
|
|
BUFF_ACTION(CastPowerInfusionAction, "power infusion");
|
|
BUFF_PARTY_ACTION(CastPowerInfusionOnPartyAction, "power infusion");
|
|
BUFF_ACTION(CastInnerFocusAction, "inner focus");
|
|
// disc 2.4.3 talents
|
|
BUFF_ACTION(CastPainSuppressionAction, "pain suppression");
|
|
PROTECT_ACTION(CastPainSuppressionProtectAction, "pain suppression");
|
|
|
|
// holy
|
|
HEAL_ACTION(CastLesserHealAction, "lesser heal");
|
|
HEAL_ACTION(CastHealAction, "heal");
|
|
HEAL_ACTION(CastGreaterHealAction, "greater heal");
|
|
HEAL_ACTION(CastFlashHealAction, "flash heal");
|
|
HEAL_ACTION(CastRenewAction, "renew");
|
|
HEAL_PARTY_ACTION(CastLesserHealOnPartyAction, "lesser heal", 50.0f, HealingManaEfficiency::MEDIUM);
|
|
HEAL_PARTY_ACTION(CastHealOnPartyAction, "heal", 50.0f, HealingManaEfficiency::MEDIUM);
|
|
HEAL_PARTY_ACTION(CastGreaterHealOnPartyAction, "greater heal", 50.0f, HealingManaEfficiency::MEDIUM);
|
|
HEAL_PARTY_ACTION(CastPowerWordShieldOnPartyAction, "power word: shield", 15.0f, HealingManaEfficiency::VERY_HIGH);
|
|
HEAL_PARTY_ACTION(CastFlashHealOnPartyAction, "flash heal", 15.0f, HealingManaEfficiency::LOW);
|
|
HEAL_PARTY_ACTION(CastRenewOnPartyAction, "renew", 15.0f, HealingManaEfficiency::VERY_HIGH);
|
|
// HEAL_PARTY_ACTION(CastPrayerOfMendingAction, "prayer of mending", 10.0f, HealingManaEfficiency::HIGH);
|
|
class CastPrayerOfMendingAction : public HealPartyMemberAction
|
|
{
|
|
public:
|
|
CastPrayerOfMendingAction(PlayerbotAI* botAI)
|
|
: HealPartyMemberAction(botAI, "prayer of mending", 10.0f, HealingManaEfficiency::HIGH, false)
|
|
{
|
|
}
|
|
};
|
|
|
|
HEAL_PARTY_ACTION(CastBindingHealAction, "binding heal", 15.0f, HealingManaEfficiency::MEDIUM);
|
|
HEAL_PARTY_ACTION(CastPrayerOfHealingAction, "prayer of healing", 15.0f, HealingManaEfficiency::MEDIUM);
|
|
// AOE_HEAL_ACTION(CastCircleOfHealingAction, "circle of healing", 15.0f, HealingManaEfficiency::HIGH);
|
|
class CastCircleOfHealingAction : public HealPartyMemberAction
|
|
{
|
|
public:
|
|
CastCircleOfHealingAction(PlayerbotAI* ai)
|
|
: HealPartyMemberAction(ai, "circle of healing", 15.0f, HealingManaEfficiency::HIGH)
|
|
{
|
|
}
|
|
};
|
|
AOE_HEAL_ACTION(CastLightwellAction, "lightwell", 15.0f, HealingManaEfficiency::MEDIUM);
|
|
|
|
SPELL_ACTION(CastSmiteAction, "smite");
|
|
SPELL_ACTION(CastHolyNovaAction, "holy nova");
|
|
|
|
RESS_ACTION(CastResurrectionAction, "resurrection");
|
|
|
|
CURE_ACTION(CastCureDiseaseAction, "cure disease");
|
|
CURE_PARTY_ACTION(CastCureDiseaseOnPartyAction, "cure disease", DISPEL_DISEASE);
|
|
CURE_ACTION(CastAbolishDiseaseAction, "abolish disease");
|
|
CURE_PARTY_ACTION(CastAbolishDiseaseOnPartyAction, "abolish disease", DISPEL_DISEASE);
|
|
|
|
// DEBUFF_CHECKISOWNER_ACTION(CastHolyFireAction, "holy fire");
|
|
class CastHolyFireAction : public CastDebuffSpellAction
|
|
{
|
|
public:
|
|
CastHolyFireAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "holy fire", true, 0.0f) {}
|
|
};
|
|
|
|
// shadow 2.4.3
|
|
// BUFF_ACTION(CastShadowfiendAction, "shadowfiend");
|
|
SPELL_ACTION(CastShadowWordDeathAction, "shadow word: death");
|
|
|
|
// shadow
|
|
DEBUFF_CHECKISOWNER_ACTION(CastPowerWordPainAction, "shadow word: pain");
|
|
DEBUFF_ENEMY_ACTION(CastPowerWordPainOnAttackerAction, "shadow word: pain");
|
|
SPELL_ACTION(CastMindBlastAction, "mind blast");
|
|
SPELL_ACTION(CastPsychicScreamAction, "psychic scream");
|
|
DEBUFF_ACTION(CastMindSootheAction, "mind soothe");
|
|
BUFF_ACTION_U(CastFadeAction, "fade", bot->GetGroup());
|
|
BUFF_ACTION(CastShadowProtectionAction, "shadow protection");
|
|
BUFF_PARTY_ACTION(CastShadowProtectionOnPartyAction, "shadow protection");
|
|
BUFF_PARTY_ACTION(CastPrayerOfShadowProtectionAction, "prayer of shadow protection");
|
|
|
|
// shadow talents
|
|
SPELL_ACTION(CastMindFlayAction, "mind flay");
|
|
DEBUFF_ACTION(CastVampiricEmbraceAction, "vampiric embrace");
|
|
BUFF_ACTION(CastShadowformAction, "shadowform");
|
|
SPELL_ACTION(CastSilenceAction, "silence");
|
|
ENEMY_HEALER_ACTION(CastSilenceOnEnemyHealerAction, "silence");
|
|
// shadow talents 2.4.3
|
|
DEBUFF_CHECKISOWNER_ACTION(CastVampiricTouchAction, "vampiric touch");
|
|
DEBUFF_ENEMY_ACTION(CastVampiricTouchOnAttackerAction, "vampiric touch");
|
|
// racials
|
|
DEBUFF_CHECKISOWNER_ACTION(CastDevouringPlagueAction, "devouring plague");
|
|
BUFF_ACTION(CastTouchOfWeaknessAction, "touch of weakness");
|
|
DEBUFF_ACTION(CastHexOfWeaknessAction, "hex of weakness");
|
|
BUFF_ACTION(CastShadowguardAction, "shadowguard");
|
|
HEAL_ACTION(CastDesperatePrayerAction, "desperate prayer");
|
|
BUFF_ACTION(CastFearWardAction, "fear ward");
|
|
BUFF_PARTY_ACTION(CastFearWardOnPartyAction, "fear ward");
|
|
SPELL_ACTION_U(CastStarshardsAction, "starshards",
|
|
(AI_VALUE2(uint8, "mana", "self target") > 50 && AI_VALUE(Unit*, "current target") &&
|
|
AI_VALUE2(float, "distance", "current target") > 15.0f));
|
|
BUFF_ACTION(CastElunesGraceAction, "elune's grace");
|
|
BUFF_ACTION(CastFeedbackAction, "feedback");
|
|
BUFF_ACTION(CastSymbolOfHopeAction, "symbol of hope");
|
|
SPELL_ACTION(CastConsumeMagicAction, "consume magic");
|
|
SNARE_ACTION(CastChastiseAction, "chastise");
|
|
|
|
class CastRemoveShadowformAction : public Action
|
|
{
|
|
public:
|
|
CastRemoveShadowformAction(PlayerbotAI* botAI) : Action(botAI, "remove shadowform") {}
|
|
|
|
bool Execute(Event event) override;
|
|
bool isUseful() override;
|
|
};
|
|
|
|
class CastDispersionAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastDispersionAction(PlayerbotAI* ai) : CastSpellAction(ai, "dispersion") {}
|
|
|
|
virtual std::string const GetTargetName() { return "self target"; }
|
|
};
|
|
|
|
class CastPenanceOnPartyAction : public HealPartyMemberAction
|
|
{
|
|
public:
|
|
CastPenanceOnPartyAction(PlayerbotAI* ai) : HealPartyMemberAction(ai, "penance", 25.0f, HealingManaEfficiency::HIGH)
|
|
{
|
|
}
|
|
};
|
|
|
|
class CastHymnOfHopeAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastHymnOfHopeAction(PlayerbotAI* ai) : CastSpellAction(ai, "hymn of hope") {}
|
|
|
|
virtual std::string const GetTargetName() { return "self target"; }
|
|
};
|
|
|
|
class CastDivineHymnAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastDivineHymnAction(PlayerbotAI* ai) : CastSpellAction(ai, "divine hymn") {}
|
|
|
|
virtual std::string const GetTargetName() { return "self target"; }
|
|
};
|
|
|
|
class CastShadowfiendAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastShadowfiendAction(PlayerbotAI* ai) : CastSpellAction(ai, "shadowfiend") {}
|
|
|
|
virtual std::string const GetTargetName() { return "current target"; }
|
|
};
|
|
|
|
class CastPowerWordShieldOnAlmostFullHealthBelowAction : public HealPartyMemberAction
|
|
{
|
|
public:
|
|
CastPowerWordShieldOnAlmostFullHealthBelowAction(PlayerbotAI* ai)
|
|
: HealPartyMemberAction(ai, "power word: shield", 15.0f, HealingManaEfficiency::HIGH)
|
|
{
|
|
}
|
|
|
|
bool isUseful() override;
|
|
Unit* GetTarget() override;
|
|
};
|
|
|
|
class CastPowerWordShieldOnNotFullAction : public HealPartyMemberAction
|
|
{
|
|
public:
|
|
CastPowerWordShieldOnNotFullAction(PlayerbotAI* ai)
|
|
: HealPartyMemberAction(ai, "power word: shield", 5.0f, HealingManaEfficiency::HIGH)
|
|
{
|
|
}
|
|
|
|
bool isUseful() override;
|
|
Unit* GetTarget() override;
|
|
};
|
|
|
|
class CastMindSearAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastMindSearAction(PlayerbotAI* ai) : CastSpellAction(ai, "mind sear") {}
|
|
|
|
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
|
};
|
|
|
|
class CastGuardianSpiritOnPartyAction : public HealPartyMemberAction
|
|
{
|
|
public:
|
|
CastGuardianSpiritOnPartyAction(PlayerbotAI* ai)
|
|
: HealPartyMemberAction(ai, "guardian spirit", 40.0f, HealingManaEfficiency::MEDIUM)
|
|
{
|
|
}
|
|
};
|
|
|
|
#endif
|