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 -->
Mages have a "bdps" strategy to use Molten Armor (default for Fire and
Arcane) and "bmana" strategy to use Mage Armor (default for Frost). The
existing code uses a series of alternatives for armor
(Molten->Mage->Ice->Frost), which is needed for Mages that have not
learned Molten or Mage. However, I was noticing that sometimes my Fire
and Arcane Mages would end up with Mage Armor, presumably because there
could be a situation in which the casting of Molten Armor failed and the
fallback to Mage Armor kicked in (for example, due to there being not
enough mana to cast Molten Armor). This PR makes bdps always mean Molten
Armor, if it is learned, and bmana always mean Mage Armor, if it is
learned, by gating through triggers.
Other changes:
- Added bdps and bmana to default Mage combat strategies (still bdps for
Fire and Arcane and bmana for Frost) so that Mages will reapply armor if
it expires in combat.
- Deleted Arcane Explosion strategy--it was not fully implemented
because there was no associated action (such as through a
CastArcaneExplosionAction class). I debated implementing it, but there
isn't a suitable targeting mechanism that exists in the code from what I
can tell. Arcane Mages generally just use Blizzard for AoE (and
Flamestrike with PoM); Arcane Explosion is useful to use if (1) a player
is moving or (2) mobs are almost dead in an AoE situation. Scenario (1)
is irrelevant for bots since they cannot cast while moving. With respect
to scenario (2), the existing AoE triggers in fact look for highest HP
mobs so to implement Arcane Explosion in a useful manner would probably
require a new Value, and that is not worth it for what would be
miniscule benefit anyway.
- General cleanups of Mage code (e.g., deleted empty ActionNodes). These
were based on a quick review; I did not do any sort of detailed or
comprehensive review and have no desire to with this PR. Note: I know
that FrostMageStrategy.cpp had a Fireball alternative for Frostfire
Bolt, but I deleted it anyway because the same ActionNode is already in
GenericMageStrategy.cpp.
- General cleanups of AiFactory default combat/noncombat strategies
(e.g., removal of deprecated bdps and bmana strategies for Shamans).
## Feature Evaluation
<!--
If your PR is very minimal (comment typo, wrong ID reference, etc), and
it is very obvious it will not have
any impact on performance, you may skip these question. If necessary, a
maintainer may ask you for them later.
-->
<!-- Please answer the following: -->
- Describe the **minimum logic** required to achieve the intended
behavior.
- Describe the **processing cost** when this logic executes across many
bots.
Added getAlternatives for the armor strategies; this approach already
exists for Druids. Added one new trigger for Molten Armor that is
throttled by 10s like the existing Mage Armor trigger.
## 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.
-->
Give a Mage the "bdps" strategy. They should cast Molten Armor. Make
them cast a different armor. After the trigger throttle period (10s),
they should reapply Molten Armor. Same goes for bmana and Mage Armor.
Try this in combat, and it should work too.
## 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**)
The point of this PR is to fix the default Mage armor buffing behavior.
- Does this change add new decision branches or increase maintenance
complexity?
- - [x] No
- - [ ] Yes (**explain below**)
## 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?
- - [ ] No
- - [x] 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.
-->
I had GPT-5.4 present a couple of possibilities to fix the issue of Mage
Armor being cast with bdps, and from there I settled on the
getAlternatives approach. I did everything else.
<!--
TRANSLATIONS:
Anything new that the bots say in chat must be in a translatable format.
This is done using GetBotTextOrDefault,
which you can search for in the codebase to find examples. Your code
needs to have English as the default fallback,
while the full translations need to be in an SQL update file. The
languages in the file are the nine language
options supported by AzerothCore: English, Korean, French, German,
Chinese, Taiwanese, Spanish, Spanish Mexico, and
Russian. See
data/sql/playerbots/updates/2025_12_27_ai_playerbot_fishing_text.sql as
an example of a translation SQL
update, whose content are called within the codebase at
src/strategy/actions/FishingAction.cpp
-->
## Final Checklist
- - [x] Stability is not compromised.
- - [x] Performance impact is understood, tested, and acceptable.
- - [x] Added logic complexity is justified and explained.
- - [x] Any new bot dialogue lines are translated.
- - [x] Documentation updated if needed (Conf comments, WiKi commands).
## Notes for Reviewers
<!-- Anything else that's helpful to review or test your pull request.
-->
@Dreathean Perhaps the wiki can be updated to document the bdps and
bmana strategies for Mages?
407 lines
11 KiB
C++
407 lines
11 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_MAGEACTIONS_H
|
|
#define _PLAYERBOT_MAGEACTIONS_H
|
|
|
|
#include "GenericSpellActions.h"
|
|
#include "SharedDefines.h"
|
|
#include "UseItemAction.h"
|
|
|
|
class PlayerbotAI;
|
|
|
|
// Buff and Out of Combat Actions
|
|
|
|
class CastMoltenArmorAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastMoltenArmorAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "molten armor") {}
|
|
std::vector<NextAction> getAlternatives() override;
|
|
};
|
|
|
|
class CastMageArmorAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastMageArmorAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "mage armor") {}
|
|
std::vector<NextAction> getAlternatives() override;
|
|
};
|
|
|
|
class CastIceArmorAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastIceArmorAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "ice armor") {}
|
|
};
|
|
|
|
class CastFrostArmorAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastFrostArmorAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "frost armor") {}
|
|
};
|
|
|
|
class CastArcaneIntellectAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastArcaneIntellectAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "arcane intellect") {}
|
|
};
|
|
|
|
class CastArcaneIntellectOnPartyAction : public BuffOnPartyAction
|
|
{
|
|
public:
|
|
CastArcaneIntellectOnPartyAction(PlayerbotAI* botAI) : BuffOnPartyAction(botAI, "arcane intellect") {}
|
|
};
|
|
|
|
class CastFocusMagicOnPartyAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastFocusMagicOnPartyAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "focus magic") {}
|
|
Unit* GetTarget() override;
|
|
};
|
|
|
|
class CastSummonWaterElementalAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastSummonWaterElementalAction(PlayerbotAI* botAI)
|
|
: CastBuffSpellAction(botAI, "summon water elemental") {}
|
|
};
|
|
|
|
// Boost Actions
|
|
|
|
class CastCombustionAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastCombustionAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "combustion") {}
|
|
};
|
|
|
|
class CastArcanePowerAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastArcanePowerAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "arcane power") {}
|
|
};
|
|
|
|
class CastPresenceOfMindAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastPresenceOfMindAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "presence of mind") {}
|
|
};
|
|
|
|
class CastIcyVeinsAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastIcyVeinsAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "icy veins") {}
|
|
};
|
|
|
|
class CastColdSnapAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastColdSnapAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "cold snap") {}
|
|
};
|
|
|
|
// Defensive Actions
|
|
|
|
class CastFireWardAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastFireWardAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "fire ward") {}
|
|
};
|
|
|
|
class CastFrostWardAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastFrostWardAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "frost ward") {}
|
|
};
|
|
|
|
class CastIceBarrierAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastIceBarrierAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "ice barrier") {}
|
|
};
|
|
|
|
class CastInvisibilityAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastInvisibilityAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "invisibility") {}
|
|
};
|
|
class CastIceBlockAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastIceBlockAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "ice block") {}
|
|
};
|
|
|
|
class CastMirrorImageAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastMirrorImageAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "mirror image") {}
|
|
};
|
|
|
|
class CastBlinkBackAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastBlinkBackAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "blink") {}
|
|
bool Execute(Event event) override;
|
|
};
|
|
|
|
class CastManaShieldAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastManaShieldAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "mana shield") {}
|
|
};
|
|
|
|
// Utility Actions
|
|
|
|
class CastEvocationAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastEvocationAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "evocation") {}
|
|
std::string const GetTargetName() override { return "self target"; }
|
|
};
|
|
|
|
class CastConjureManaGemAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastConjureManaGemAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "conjure mana gem") {}
|
|
};
|
|
|
|
class CastConjureFoodAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastConjureFoodAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "conjure food") {}
|
|
};
|
|
|
|
class CastConjureWaterAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastConjureWaterAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "conjure water") {}
|
|
};
|
|
|
|
class UseManaSapphireAction : public UseItemAction
|
|
{
|
|
public:
|
|
UseManaSapphireAction(PlayerbotAI* botAI) : UseItemAction(botAI, "mana sapphire") {}
|
|
bool isUseful() override;
|
|
};
|
|
class UseManaEmeraldAction : public UseItemAction
|
|
{
|
|
public:
|
|
UseManaEmeraldAction(PlayerbotAI* botAI) : UseItemAction(botAI, "mana emerald") {}
|
|
bool isUseful() override;
|
|
};
|
|
|
|
class UseManaRubyAction : public UseItemAction
|
|
{
|
|
public:
|
|
UseManaRubyAction(PlayerbotAI* botAI) : UseItemAction(botAI, "mana ruby") {}
|
|
bool isUseful() override;
|
|
};
|
|
|
|
class UseManaCitrineAction : public UseItemAction
|
|
{
|
|
public:
|
|
UseManaCitrineAction(PlayerbotAI* botAI) : UseItemAction(botAI, "mana citrine") {}
|
|
bool isUseful() override;
|
|
};
|
|
|
|
class UseManaJadeAction : public UseItemAction
|
|
{
|
|
public:
|
|
UseManaJadeAction(PlayerbotAI* botAI) : UseItemAction(botAI, "mana jade") {}
|
|
bool isUseful() override;
|
|
};
|
|
|
|
class UseManaAgateAction : public UseItemAction
|
|
{
|
|
public:
|
|
UseManaAgateAction(PlayerbotAI* botAI) : UseItemAction(botAI, "mana agate") {}
|
|
bool isUseful() override;
|
|
};
|
|
|
|
// CC, Interrupt, and Dispel Actions
|
|
|
|
class CastPolymorphAction : public CastCrowdControlSpellAction
|
|
{
|
|
public:
|
|
CastPolymorphAction(PlayerbotAI* botAI) : CastCrowdControlSpellAction(botAI, "polymorph") {}
|
|
};
|
|
|
|
class CastSpellstealAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastSpellstealAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "spellsteal") {}
|
|
};
|
|
|
|
class CastCounterspellAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastCounterspellAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "counterspell") {}
|
|
};
|
|
|
|
class CastCounterspellOnEnemyHealerAction : public CastSpellOnEnemyHealerAction
|
|
{
|
|
public:
|
|
CastCounterspellOnEnemyHealerAction(PlayerbotAI* botAI)
|
|
: CastSpellOnEnemyHealerAction(botAI, "counterspell") {}
|
|
};
|
|
|
|
class CastFrostNovaAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastFrostNovaAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "frost nova") {}
|
|
bool isUseful() override;
|
|
};
|
|
|
|
class CastDeepFreezeAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastDeepFreezeAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "deep freeze") {}
|
|
bool isPossible() override { return true; }
|
|
};
|
|
|
|
class CastRemoveCurseAction : public CastCureSpellAction
|
|
{
|
|
public:
|
|
CastRemoveCurseAction(PlayerbotAI* botAI) : CastCureSpellAction(botAI, "remove curse") {}
|
|
};
|
|
|
|
class CastRemoveLesserCurseAction : public CastCureSpellAction
|
|
{
|
|
public:
|
|
CastRemoveLesserCurseAction(PlayerbotAI* botAI) : CastCureSpellAction(botAI, "remove lesser curse") {}
|
|
};
|
|
|
|
class CastRemoveCurseOnPartyAction : public CurePartyMemberAction
|
|
{
|
|
public:
|
|
CastRemoveCurseOnPartyAction(PlayerbotAI* botAI) : CurePartyMemberAction(botAI, "remove curse", DISPEL_CURSE) {}
|
|
};
|
|
|
|
class CastRemoveLesserCurseOnPartyAction : public CurePartyMemberAction
|
|
{
|
|
public:
|
|
CastRemoveLesserCurseOnPartyAction(PlayerbotAI* botAI)
|
|
: CurePartyMemberAction(botAI, "remove lesser curse", DISPEL_CURSE) {}
|
|
};
|
|
|
|
// Damage and Debuff Actions
|
|
|
|
class CastFireballAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastFireballAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "fireball") {}
|
|
};
|
|
|
|
class CastScorchAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastScorchAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "scorch") {}
|
|
};
|
|
|
|
class CastFireBlastAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastFireBlastAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "fire blast") {}
|
|
};
|
|
|
|
class CastArcaneBlastAction : public CastBuffSpellAction
|
|
{
|
|
public:
|
|
CastArcaneBlastAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "arcane blast") {}
|
|
std::string const GetTargetName() override { return "current target"; }
|
|
};
|
|
|
|
class CastArcaneBarrageAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastArcaneBarrageAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "arcane barrage") {}
|
|
};
|
|
|
|
class CastArcaneMissilesAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastArcaneMissilesAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "arcane missiles") {}
|
|
};
|
|
|
|
class CastPyroblastAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastPyroblastAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "pyroblast") {}
|
|
};
|
|
|
|
class CastLivingBombAction : public CastDebuffSpellAction
|
|
{
|
|
public:
|
|
CastLivingBombAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "living bomb", true) {}
|
|
bool isUseful() override
|
|
{
|
|
return CastAuraSpellAction::isUseful();
|
|
}
|
|
};
|
|
|
|
class CastLivingBombOnAttackersAction : public CastDebuffSpellOnAttackerAction
|
|
{
|
|
public:
|
|
CastLivingBombOnAttackersAction(PlayerbotAI* botAI) : CastDebuffSpellOnAttackerAction(botAI, "living bomb", true) {}
|
|
bool isUseful() override
|
|
{
|
|
return CastAuraSpellAction::isUseful();
|
|
}
|
|
};
|
|
|
|
class CastFrostboltAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastFrostboltAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "frostbolt") {}
|
|
};
|
|
|
|
class CastFrostfireBoltAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastFrostfireBoltAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "frostfire bolt") {}
|
|
};
|
|
|
|
class CastIceLanceAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastIceLanceAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "ice lance") {}
|
|
};
|
|
|
|
class CastBlizzardAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastBlizzardAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "blizzard") {}
|
|
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
|
};
|
|
|
|
class CastConeOfColdAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastConeOfColdAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "cone of cold") {}
|
|
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
|
bool isUseful() override;
|
|
};
|
|
|
|
class CastFlamestrikeAction : public CastDebuffSpellAction
|
|
{
|
|
public:
|
|
CastFlamestrikeAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "flamestrike", true, 0.0f) {}
|
|
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
|
};
|
|
|
|
class CastDragonsBreathAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastDragonsBreathAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "dragon's breath") {}
|
|
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
|
bool isUseful() override;
|
|
};
|
|
|
|
class CastBlastWaveAction : public CastSpellAction
|
|
{
|
|
public:
|
|
CastBlastWaveAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "blast wave") {}
|
|
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
|
|
bool isUseful() override;
|
|
};
|
|
|
|
#endif
|