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 -->
Lady Vashj has been screwed up in Acore for a month or two. In Phase 2,
only one generator activates (instead of four). As a result, disabling
one generator brings Vashj into Phase 3. The strategy uses Vashj's HP +
unit state to determine phase--with the Acore bug, Vashj enters Phase 3
at <65% HP (instead of the correct <50% HP, as deactivating a generator
damages her by 5%) so under the current strategy, bots won't assume
Phase 3 strategies at the right moment. I tried looking into the issue
with Vashj in Acore and cannot figure it out, and I've had an issue open
with Acore and don't know if/when it will be fixed. In the meantime, I'm
modifying the strategy to use the shield barrier aura check on Vashj
instead so it will work regardless of Vashj's HP at the time the
generators are disabled. If/when Vashj is fixed, the strategy will still
work.
I also changed bot-side targeting checks throughout the strategies I've
written from GetVictim() and GetTarget() to using the AI's target state
via "current target." This approach I believe is the best way to
actually check for the target because a GetVictim() check can lock up
Elemental Shamans and Balance Druids due to them not being able to start
an attack to pass that check when outside of spell range, and a
GetTarget() check can occasionally not align with the target that the
bot is actually attacking.
- In effect, this should reduce cases where the bot AI thinks it is on
the right raid target but encounter logic disagrees because the live
victim or client selection is lagging or different.
- Exception: multipliers for blocking TankAssistAction still use a
GetVictim() check. This is because "current target" processes before
issuing an attack, and the targeting check for TankAssistAction is not
to suppress it if the bot hasn't actually issued an attack.
There is a lot more than could be refactored with past strategies to
make them better, but that's for another day. This PR is intended to be
limited and simple to review.
## 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.
Logic is described above. There should be no relevant impact on
processing cost.
## 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.
-->
Attempt Lady Vashj with the current bugged version. After disabling the
lone generator, bots should enter Phase 3 strategies and the encounter
should be completable.
Otherwise, generally run raids, and confirm there are no issues with
bots switching targets or starting attacking.
## 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?
- - [x] No
- - [ ] Yes (**explain why**)
- 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?
- - [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.
-->
<!--
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.
-->
191 lines
7.4 KiB
C++
191 lines
7.4 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_RAIDSSCHELPERS_H_
|
|
#define _PLAYERBOT_RAIDSSCHELPERS_H_
|
|
|
|
#include <ctime>
|
|
#include <unordered_map>
|
|
|
|
#include "AiObject.h"
|
|
#include "Position.h"
|
|
#include "Unit.h"
|
|
|
|
namespace SerpentShrineCavernHelpers
|
|
{
|
|
enum SerpentShrineCavernSpells
|
|
{
|
|
// Trash Mobs
|
|
SPELL_TOXIC_POOL = 38718,
|
|
|
|
// Hydross the Unstable <Duke of Currents>
|
|
SPELL_MARK_OF_HYDROSS_10 = 38215,
|
|
SPELL_MARK_OF_HYDROSS_25 = 38216,
|
|
SPELL_MARK_OF_HYDROSS_50 = 38217,
|
|
SPELL_MARK_OF_HYDROSS_100 = 38218,
|
|
SPELL_MARK_OF_HYDROSS_250 = 38231,
|
|
SPELL_MARK_OF_HYDROSS_500 = 40584,
|
|
SPELL_MARK_OF_CORRUPTION_10 = 38219,
|
|
SPELL_MARK_OF_CORRUPTION_25 = 38220,
|
|
SPELL_MARK_OF_CORRUPTION_50 = 38221,
|
|
SPELL_MARK_OF_CORRUPTION_100 = 38222,
|
|
SPELL_MARK_OF_CORRUPTION_250 = 38230,
|
|
SPELL_MARK_OF_CORRUPTION_500 = 40583,
|
|
SPELL_CORRUPTION = 37961,
|
|
|
|
// The Lurker Below
|
|
SPELL_SPOUT_VISUAL = 37431,
|
|
|
|
// Leotheras the Blind
|
|
SPELL_LEOTHERAS_BANISHED = 37546,
|
|
SPELL_WHIRLWIND = 37640,
|
|
SPELL_WHIRLWIND_CHANNEL = 37641,
|
|
SPELL_METAMORPHOSIS = 37673,
|
|
SPELL_CHAOS_BLAST = 37675,
|
|
SPELL_INSIDIOUS_WHISPER = 37676,
|
|
|
|
// Lady Vashj <Coilfang Matron>
|
|
SPELL_FEAR_WARD = 6346,
|
|
SPELL_MAGIC_BARRIER = 38112,
|
|
SPELL_POISON_BOLT = 38253,
|
|
SPELL_STATIC_CHARGE = 38280,
|
|
SPELL_ENTANGLE = 38316,
|
|
|
|
// Druid
|
|
SPELL_CAT_FORM = 768,
|
|
SPELL_BEAR_FORM = 5487,
|
|
SPELL_DIRE_BEAR_FORM = 9634,
|
|
SPELL_TREE_OF_LIFE = 33891,
|
|
|
|
// Hunter
|
|
SPELL_MISDIRECTION = 35079,
|
|
|
|
// Mage
|
|
SPELL_SLOW = 31589,
|
|
|
|
// Shaman
|
|
SPELL_GROUNDING_TOTEM_EFFECT = 8178,
|
|
|
|
// Warlock
|
|
SPELL_CURSE_OF_EXHAUSTION = 18223,
|
|
};
|
|
|
|
enum SerpentShrineCavernNPCs
|
|
{
|
|
// Trash Mobs
|
|
NPC_WATER_ELEMENTAL_TOTEM = 22236,
|
|
|
|
// Hydross the Unstable <Duke of Currents>
|
|
NPC_PURE_SPAWN_OF_HYDROSS = 22035,
|
|
NPC_TAINTED_SPAWN_OF_HYDROSS = 22036,
|
|
|
|
// The Lurker Below
|
|
NPC_COILFANG_GUARDIAN = 21873,
|
|
|
|
// Leotheras the Blind
|
|
NPC_LEOTHERAS_THE_BLIND = 21215,
|
|
NPC_GREYHEART_SPELLBINDER = 21806,
|
|
NPC_INNER_DEMON = 21857,
|
|
NPC_SHADOW_OF_LEOTHERAS = 21875,
|
|
|
|
// Fathom-Lord Karathress
|
|
NPC_SPITFIRE_TOTEM = 22091,
|
|
|
|
// Lady Vashj <Coilfang Matron>
|
|
NPC_WORLD_INVISIBLE_TRIGGER = 12999,
|
|
NPC_LADY_VASHJ = 21212,
|
|
NPC_ENCHANTED_ELEMENTAL = 21958,
|
|
NPC_TAINTED_ELEMENTAL = 22009,
|
|
NPC_COILFANG_ELITE = 22055,
|
|
NPC_COILFANG_STRIDER = 22056,
|
|
NPC_TOXIC_SPOREBAT = 22140,
|
|
NPC_SPORE_DROP_TRIGGER = 22207,
|
|
};
|
|
|
|
enum SerpentShrineCavernItems
|
|
{
|
|
// Lady Vashj <Coilfang Matron>
|
|
ITEM_TAINTED_CORE = 31088,
|
|
};
|
|
|
|
constexpr uint32 SSC_MAP_ID = 548;
|
|
|
|
// Hydross the Unstable <Duke of Currents>
|
|
extern const Position HYDROSS_FROST_TANK_POSITION;
|
|
extern const Position HYDROSS_NATURE_TANK_POSITION;
|
|
extern std::unordered_map<uint32, time_t> hydrossFrostDpsWaitTimer;
|
|
extern std::unordered_map<uint32, time_t> hydrossNatureDpsWaitTimer;
|
|
extern std::unordered_map<uint32, time_t> hydrossChangeToFrostPhaseTimer;
|
|
extern std::unordered_map<uint32, time_t> hydrossChangeToNaturePhaseTimer;
|
|
bool HasMarkOfHydrossAt100Percent(Player* bot);
|
|
bool HasNoMarkOfHydross(Player* bot);
|
|
bool HasMarkOfCorruptionAt100Percent(Player* bot);
|
|
bool HasNoMarkOfCorruption(Player* bot);
|
|
|
|
// The Lurker Below
|
|
extern const Position LURKER_MAIN_TANK_POSITION;
|
|
extern std::unordered_map<uint32, time_t> lurkerSpoutTimer;
|
|
extern std::unordered_map<ObjectGuid, Position> lurkerRangedPositions;
|
|
bool IsLurkerCastingSpout(Unit* lurker);
|
|
|
|
// Leotheras the Blind
|
|
extern std::unordered_map<uint32, time_t> leotherasHumanFormDpsWaitTimer;
|
|
extern std::unordered_map<uint32, time_t> leotherasDemonFormDpsWaitTimer;
|
|
extern std::unordered_map<uint32, time_t> leotherasFinalPhaseDpsWaitTimer;
|
|
Unit* GetLeotherasHuman(Player* bot);
|
|
Unit* GetPhase2LeotherasDemon(Player* bot);
|
|
Unit* GetPhase3LeotherasDemon(Player* bot);
|
|
Unit* GetActiveLeotherasDemon(Player* bot);
|
|
Player* GetLeotherasDemonFormTank(Player* bot);
|
|
|
|
// Fathom-Lord Karathress
|
|
extern const Position KARATHRESS_TANK_POSITION;
|
|
extern const Position TIDALVESS_TANK_POSITION;
|
|
extern const Position SHARKKIS_TANK_POSITION;
|
|
extern const Position CARIBDIS_TANK_POSITION;
|
|
extern const Position CARIBDIS_HEALER_POSITION;
|
|
extern const Position CARIBDIS_RANGED_DPS_POSITION;
|
|
extern std::unordered_map<uint32, time_t> karathressDpsWaitTimer;
|
|
|
|
// Morogrim Tidewalker
|
|
extern const Position TIDEWALKER_PHASE_1_TANK_POSITION;
|
|
extern const Position TIDEWALKER_PHASE_TRANSITION_WAYPOINT;
|
|
extern const Position TIDEWALKER_PHASE_2_TANK_POSITION;
|
|
extern const Position TIDEWALKER_PHASE_2_RANGED_POSITION;
|
|
extern std::unordered_map<ObjectGuid, uint8> tidewalkerTankStep;
|
|
extern std::unordered_map<ObjectGuid, uint8> tidewalkerRangedStep;
|
|
|
|
// Lady Vashj <Coilfang Matron>
|
|
constexpr float VASHJ_PLATFORM_CENTER_Z = 42.902f;
|
|
constexpr float VASHJ_PLATFORM_EDGE_Z = 41.097f;
|
|
extern const Position VASHJ_PLATFORM_CENTER_POSITION;
|
|
extern std::unordered_map<ObjectGuid, bool> hasReachedVashjRangedPosition;
|
|
extern std::unordered_map<uint32, ObjectGuid> nearestTriggerGuid;
|
|
extern std::unordered_map<ObjectGuid, Position> intendedLineup;
|
|
extern std::unordered_map<uint32, time_t> lastImbueAttempt;
|
|
extern std::unordered_map<ObjectGuid, time_t> lastCoreInInventoryTime;
|
|
bool IsMainTankInSameSubgroup(PlayerbotAI* botAI, Player* bot);
|
|
bool IsLadyVashjInPhase1(PlayerbotAI* botAI);
|
|
bool IsLadyVashjInPhase2(PlayerbotAI* botAI);
|
|
bool IsLadyVashjInPhase3(PlayerbotAI* botAI);
|
|
bool IsValidLadyVashjCombatNpc(Unit* unit, PlayerbotAI* botAI);
|
|
Player* GetDesignatedCoreLooter(PlayerbotAI* botAI, Player* bot);
|
|
Player* GetFirstTaintedCorePasser(PlayerbotAI* botAI, Player* bot);
|
|
Player* GetSecondTaintedCorePasser(PlayerbotAI* botAI, Player* bot);
|
|
Player* GetThirdTaintedCorePasser(PlayerbotAI* botAI, Player* bot);
|
|
Player* GetFourthTaintedCorePasser(PlayerbotAI* botAI, Player* bot);
|
|
std::array<Player*, 5> GetCoreHandlers(PlayerbotAI* botAI, Player* bot);
|
|
bool AnyRecentCoreInInventory(PlayerbotAI* botAI, Player* bot);
|
|
struct GeneratorInfo { ObjectGuid guid; float x, y, z; };
|
|
extern const std::vector<uint32> SHIELD_GENERATOR_DB_GUIDS;
|
|
std::vector<GeneratorInfo> GetAllGeneratorInfosByDbGuids(
|
|
Map* map, const std::vector<uint32>& generatorDbGuids);
|
|
Unit* GetNearestActiveShieldGeneratorTriggerByEntry(Unit* reference);
|
|
const GeneratorInfo* GetNearestGeneratorToBot(
|
|
Player* bot, const std::vector<GeneratorInfo>& generators);
|
|
}
|
|
|
|
#endif
|