mod-playerbots/src/Ai/Raid/HyjalSummit/Trigger/RaidHyjalSummitTriggers.cpp
Crow 5d9761c9e8
Implement Battle for Mount Hyjal Strategies (#2258)
<!--
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.
-->

### Contingent on
https://github.com/mod-playerbots/mod-playerbots/pull/2295/

## Pull Request Description
<!-- Describe what this change does and why it is needed -->
This PR implements raid strategies for all bosses in everybody's
favorite TBC instance, the Battle for Mount Hyjal. As before, I have
designed these all to work with IP with 50% damage and healing. I also
did not merge the 1.88x buff to Vanilla & TBC healing items that IP
recently implemented.

The next post will outline all implemented strategies.

Note: Set to draft for now as I may tweak Archimonde some more, but I
generally consider Hyjal complete, subject to comments.

## 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.

As with previous strategies, I've worked within the existing context of
actions/multipliers/triggers. This strategy does implement new spell
hooks, but I don't think that is problematic for performance, and I'll
explain why they are necessary in the next post.


## 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.
-->



## 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?
    - - [ ] No, not at all
    - - [x] Minimal impact (**explain below**)
    - - [ ] Moderate impact (**explain below**)

There are many new triggers, multipliers, and actions, but they will be
evaluated only if the "hyjal" strategy is added. Additionally, I've
attempted to order and implement checks in a manner to limit performance
impact and have tested with .pmon active. In general, I consider
performance to be highly important so am always working on ways to limit
the impact (e.g., trying to use the most targeted grid searches
available when needed).


- Does this change modify default bot behavior?
    - - [ ] No
    - - [x] Yes (**explain why**)

Only in the Hyjal instance, for obvious reasons.


- Does this change add new decision branches or increase maintenance
complexity?
    - - [ ] No
    - - [x] Yes (**explain below**)

New decision branches apply only in the new Hyjal instance, for obvious
reasons. Maintenance complexity should not be increased as code outside
of the new Hyjal files is not impacted, except to the extent needed to
register and implement the strategy in the same manner as all existing
strategies. Exception: As noted, I did add new spell hooks, but if they
become problematic, they can easily be removed.


## 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?
    - - [ ] 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.
-->

Claude Sonnet 4.6 was used for more complex implementation and
occasionally GPT-5 mini was used for simple questions. I do not use AI
for brainstorming or developing strategies, only for implementation and
review of code. Most of this was written by me directly, but most
notably I needed AI support to implement the spell hooks and
triggers/actions that relied on them. Everything was reviewed and tested
many times.


## Final Checklist

- - [x] Stability is not compromised.
- - [x] Performance impact is understood, tested, and acceptable.
Caveat: The full impact of implementing the spell hooks on a broad scale
is beyond my knowledge to evaluate.
- - [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.
-->

---------

Co-authored-by: Keleborn <22352763+Celandriel@users.noreply.github.com>
Co-authored-by: bash <hermensb@gmail.com>
Co-authored-by: Revision <tkn963@gmail.com>
Co-authored-by: kadeshar <kadeshar@gmail.com>
2026-05-08 22:39:32 -07:00

358 lines
9.8 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 "RaidHyjalSummitTriggers.h"
#include "RaidHyjalSummitHelpers.h"
#include "RaidHyjalSummitActions.h"
#include "AiFactory.h"
#include "Playerbots.h"
#include "RaidBossHelpers.h"
using namespace HyjalSummitHelpers;
// General
bool HyjalSummitBotIsNotInCombatTrigger::IsActive()
{
return !bot->IsInCombat() && bot->GetMapId() == HYJAL_SUMMIT_MAP_ID;
}
// Rage Winterchill
bool RageWinterchillPullingBossTrigger::IsActive()
{
if (bot->getClass() != CLASS_HUNTER)
return false;
Unit* winterchill = AI_VALUE2(Unit*, "find target", "rage winterchill");
return winterchill && winterchill->GetHealthPct() > 95.0f;
}
bool RageWinterchillBossEngagedByMainTankTrigger::IsActive()
{
return botAI->IsMainTank(bot) &&
AI_VALUE2(Unit*, "find target", "rage winterchill");
}
bool RageWinterchillBossCastsDeathAndDecayOnRangedTrigger::IsActive()
{
return botAI->IsRanged(bot) &&
AI_VALUE2(Unit*, "find target", "rage winterchill");
}
bool RageWinterchillMeleeIsStandingInDeathAndDecayTrigger::IsActive()
{
if (botAI->IsRanged(bot))
return false;
Unit* winterchill = AI_VALUE2(Unit*, "find target", "rage winterchill");
if (!winterchill || winterchill->GetVictim() == bot)
return false;
if (botAI->IsMainTank(bot))
return false;
return IsInDeathAndDecay(bot, DEATH_AND_DECAY_SAFE_RADIUS);
}
// Anetheron
bool AnetheronPullingBossOrInfernalTrigger::IsActive()
{
return bot->getClass() == CLASS_HUNTER &&
AI_VALUE2(Unit*, "find target", "anetheron");
}
bool AnetheronBossEngagedByMainTankTrigger::IsActive()
{
return botAI->IsMainTank(bot) && AI_VALUE2(Unit*, "find target", "anetheron");
}
bool AnetheronBossCastsCarrionSwarmTrigger::IsActive()
{
if (botAI->IsMelee(bot))
return false;
Unit* anetheron = AI_VALUE2(Unit*, "find target", "anetheron");
if (!anetheron)
return false;
return GetInfernoTarget(anetheron) != bot;
}
bool AnetheronBotIsTargetedByInfernalTrigger::IsActive()
{
Unit* anetheron = AI_VALUE2(Unit*, "find target", "anetheron");
if (!anetheron || botAI->IsMainTank(bot))
return false;
return GetInfernoTarget(anetheron) == bot;
}
bool AnetheronInfernalsNeedToBeKeptAwayFromRaidTrigger::IsActive()
{
return botAI->IsAssistTankOfIndex(bot, 0, true) &&
AI_VALUE2(Unit*, "find target", "towering infernal");
}
bool AnetheronInfernalsContinueToSpawnTrigger::IsActive()
{
return !botAI->IsTank(bot) && AI_VALUE2(Unit*, "find target", "anetheron");
}
// Kaz'rogal
bool KazrogalPullingBossTrigger::IsActive()
{
if (bot->getClass() != CLASS_HUNTER)
return false;
Unit* kazrogal = AI_VALUE2(Unit*, "find target", "kaz'rogal");
return kazrogal && kazrogal->GetHealthPct() > 95.0f;
}
bool KazrogalBossEngagedByMainTankTrigger::IsActive()
{
return botAI->IsMainTank(bot) && AI_VALUE2(Unit*, "find target", "kaz'rogal");
}
bool KazrogalBossEngagedByAssistTanksTrigger::IsActive()
{
if (!botAI->IsAssistTank(bot))
return false;
if (!AI_VALUE2(Unit*, "find target", "kaz'rogal"))
return false;
return bot->GetPower(POWER_MANA) > 3000;
}
bool KazrogalLowManaBotsNeedEscapePathTrigger::IsActive()
{
if (bot->getClass() == CLASS_WARRIOR || bot->getClass() == CLASS_ROGUE ||
bot->getClass() == CLASS_DEATH_KNIGHT)
return false;
uint8 tab = AiFactory::GetPlayerSpecTab(bot);
if (bot->getClass() == CLASS_DRUID && tab == DRUID_TAB_FERAL)
return false;
if (!AI_VALUE2(Unit*, "find target", "kaz'rogal"))
return false;
if (bot->getClass() == CLASS_HUNTER)
{
return true;
}
else if (bot->GetPower(POWER_MANA) > 4000)
{
isBelowManaThreshold.erase(bot->GetGUID());
if (botAI->IsMelee(bot))
return false;
else
return true;
}
return false;
}
bool KazrogalBotIsLowOnManaTrigger::IsActive()
{
if (bot->getClass() == CLASS_WARRIOR || bot->getClass() == CLASS_ROGUE ||
bot->getClass() == CLASS_DEATH_KNIGHT)
return false;
uint8 tab = AiFactory::GetPlayerSpecTab(bot);
if (bot->getClass() == CLASS_DRUID && tab == DRUID_TAB_FERAL)
return false;
if (!AI_VALUE2(Unit*, "find target", "kaz'rogal"))
return false;
if (botAI->HasAnyAuraOf(bot, "ice block", "divine shield", nullptr))
return false;
if (isBelowManaThreshold.count(bot->GetGUID()) ||
bot->GetPower(POWER_MANA) <= 3200)
return true;
return false;
}
bool KazrogalMarkDealsShadowDamageTrigger::IsActive()
{
if (bot->getClass() != CLASS_PALADIN && bot->getClass() != CLASS_WARLOCK)
return false;
if (!AI_VALUE2(Unit*, "find target", "kaz'rogal"))
return false;
if (bot->getClass() == CLASS_PALADIN &&
(botAI->HasAura("shadow resistance aura", bot) ||
botAI->HasAura("prayer of shadow protection", bot) ||
botAI->HasAura("shadow protection", bot)))
return false;
return bot->HasAura(
static_cast<uint32>(HyjalSummitSpells::SPELL_MARK_OF_KAZROGAL));
}
// Azgalor
bool AzgalorPullingBossTrigger::IsActive()
{
if (bot->getClass() != CLASS_HUNTER)
return false;
Unit* azgalor = AI_VALUE2(Unit*, "find target", "azgalor");
return azgalor && azgalor->GetHealthPct() > 95.0f;
}
bool AzgalorBossEngagedByMainTankTrigger::IsActive()
{
return botAI->IsMainTank(bot) && AI_VALUE2(Unit*, "find target", "azgalor");
}
bool AzgalorMainTankIsPositioningBossTrigger::IsActive()
{
if (botAI->IsRanged(bot))
return false;
Unit* azgalor = AI_VALUE2(Unit*, "find target", "azgalor");
if (!azgalor || azgalor->GetVictim() == bot)
return false;
Player* mainTank = GetGroupMainTank(botAI, bot);
if (!mainTank || !GET_PLAYERBOT_AI(mainTank) || botAI->IsMainTank(bot))
return false;
TankPositionState tankState = GetAzgalorTankPositionState(botAI, bot);
return tankState == TankPositionState::Unknown ||
tankState == TankPositionState::MovingToTransition;
}
bool AzgalorBossEngagedByRangedTrigger::IsActive()
{
if (botAI->IsMelee(bot))
return false;
Unit* azgalor = AI_VALUE2(Unit*, "find target", "azgalor");
return azgalor && azgalor->GetVictim() != bot &&
!bot->HasAura(static_cast<uint32>(HyjalSummitSpells::SPELL_DOOM));
}
bool AzgalorBossCastsRainOfFireOnMeleeTrigger::IsActive()
{
if (botAI->IsRanged(bot) || botAI->IsTank(bot))
return false;
Unit* azgalor = AI_VALUE2(Unit*, "find target", "azgalor");
if (!azgalor || azgalor->GetVictim() == bot ||
bot->HasAura(static_cast<uint32>(HyjalSummitSpells::SPELL_DOOM)))
return false;
return IsInRainOfFire(bot, RAIN_OF_FIRE_RADIUS);
}
bool AzgalorBotIsDoomedTrigger::IsActive()
{
return bot->HasAura(static_cast<uint32>(HyjalSummitSpells::SPELL_DOOM));
}
bool AzgalorDoomguardsMustBeControlledTrigger::IsActive()
{
if (!botAI->IsAssistTank(bot) ||
!AI_VALUE2(Unit*, "find target", "azgalor"))
return false;
if (botAI->IsAssistTankOfIndex(bot, 0, true))
{
return AI_VALUE2(Unit*, "find target", "lesser doomguard") ||
AnyGroupMemberHasDoom(bot);
}
if (botAI->IsAssistTankOfIndex(bot, 1, true))
{
// Trigger for second assist tank only if first assist tank has Doom
Player* firstAssistTank = GetGroupAssistTank(botAI, bot, 0);
if (firstAssistTank &&
!firstAssistTank->HasAura(static_cast<uint32>(HyjalSummitSpells::SPELL_DOOM)))
return false;
return AI_VALUE2(Unit*, "find target", "lesser doomguard") ||
AnyGroupMemberHasDoom(bot);
}
return false;
}
bool AzgalorDoomguardsMustDieTrigger::IsActive()
{
return botAI->IsRangedDps(bot) && AI_VALUE2(Unit*, "find target", "azgalor");
}
// Archimonde
bool ArchimondePullingBossTrigger::IsActive()
{
if (bot->getClass() != CLASS_HUNTER)
return false;
Unit* archimonde = AI_VALUE2(Unit*, "find target", "archimonde");
return archimonde && archimonde->GetHealthPct() > 95.0f;
}
bool ArchimondeBossEngagedByMainTankTrigger::IsActive()
{
if (!botAI->IsMainTank(bot))
return false;
Unit* archimonde = AI_VALUE2(Unit*, "find target", "archimonde");
return archimonde && archimonde->GetHealthPct() > 95.0f;
}
bool ArchimondeBossCastsFearTrigger::IsActive()
{
if (bot->getClass() != CLASS_PRIEST &&
bot->getClass() != CLASS_SHAMAN)
return false;
Unit* archimonde = AI_VALUE2(Unit*, "find target", "archimonde");
return archimonde && archimonde->GetHealthPct() > 10.0f;
}
bool ArchimondeBossCastsAirBurstTrigger::IsActive()
{
Unit* archimonde = AI_VALUE2(Unit*, "find target", "archimonde");
if (!archimonde || archimonde->GetHealthPct() <= 10.0f ||
archimonde->GetVictim() == bot)
return false;
return !botAI->IsMainTank(bot);
}
bool ArchimondeBossSummonedDoomfireTrigger::IsActive()
{
Unit* archimonde = AI_VALUE2(Unit*, "find target", "archimonde");
if (!archimonde || archimonde->GetHealthPct() <= 10.0f)
return false;
// If I don't make an exception, bots actually refuse to enter the
// Doomfire even when feared
return !bot->HasAura(
static_cast<uint32>(HyjalSummitSpells::SPELL_ARCHIMONDE_FEAR));
}
bool ArchimondeBotStoodInDoomfireTrigger::IsActive()
{
if (bot->getClass() != CLASS_MAGE && bot->getClass() != CLASS_ROGUE &&
bot->getClass() != CLASS_PALADIN)
return false;
return bot->GetHealthPct() < 40.0f &&
(bot->HasAura(static_cast<uint32>(HyjalSummitSpells::SPELL_DOOMFIRE)) ||
bot->HasAura(static_cast<uint32>(HyjalSummitSpells::SPELL_DOOMFIRE_DOT)));
}