Updates to SSC Strategies (#2138)

# Pull Request

Most of the changes are not functional but are to modify style based on
comments received to the TK PR (e.g., eliminate nesting of if
statements) and leverage general boss helpers. There is some reordering
of returns and other changes to try to consolidate or clean-up the code
(such as removing unnecessary parameters).

The strategies themselves have only minor changes.

- Main tank no longer uses tangential movement for Lurker Spout, unlike
other bots. The MT will just call moves directly to a position behind
Lurker. This is because I found tangential movement was taking too long
for the MT to get in place since it starts right in front of Lurker.
- Vashj MT group Shaman will now use Grounding Totem without actually
switching to the Grounding Totem strategy. I have now eliminated all
strategy swaps, which I dislike because they persist after the
encounter, and it's better not to mess with player strategies since
presumably people are generally using Windfury or Wrath of Air for the
Air Totem.
- I made a ton of changes to Vashj core passing as I noticed the
existing logic is nonfunctional in several ways. It generally works fine
ingame, but the changes should make things much smoother. For example,
the storing of the nearest trigger NPC for generators in the existing
strategy is useless because it relies on insert_or_assign for an
unordered map that will continue to run during the course of the core
passing logic, and a similar issue exists with respect to the map to
store the last time a bot held a core. The result is that there is
slight movement of bots when the core is flying through the air and not
held by any bot because the trigger for core passing does not fire
during that period. In practice, the time is brief enough that the
sequence works OK, but it looks stupid because the bots should not be
moving at all. So that should be fixed.

There is a known issue re: core passing that would take extreme effort
to fix and I am not going to do it because it is a fringe situation.
There are a couple of spots where the Tainted Elemental can rarely spawn
that can result in a straight-line passing sequence to the nearest
generator that is blocked by LoS. Fixing this would be extremely
difficult and niche, so what you will need to do if this happens is to
just command your bots to destroy the core and try again with the next
spawn.

---

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

I have attempted to streamline methods and even remove some. The
strategy is admittedly somewhat performance heavy due to the need for
function calls such as iterating over inventory items. However, the new
version should be less performance intensive than the merged
strategy--for example, there were places where all members of the raid
would have their inventory checked, but I've now limited the check to
only the 5 core handler bots. I've run the instance with pmon on, and
there are no methods that stand out as particularly resource intensive
when not in a boss encounter, and I view that as the most important
thing (though I make effort to reduce performance impact during
encounters also). Expensive checks that are unavoidable for the strategy
to work such as grid searches are gated behind cheaper checks.

---

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

Enter SSC with a raid group and run the instance, including all bosses.
Every boss should be killable, and every major mechanic should be
addressed by bots. I will work with Dreathean to get the Wiki up soon so
that should be a reference for testing strategies.

## Complexity & Impact

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

Only within the context of strategies, which are basically all new
decision branches, and there are some tweaks here to what is currently
merged.

Does this change increase per-bot or per-tick processing?
- - [x] No
- - [ ] Yes (**describe and justify impact**)

Could this logic scale poorly under load?
- - [ ] No
- - [x] Yes (**explain why**)

I'm sure if you have a large server, with multiple raid groups running
the instance at the same time, the performance impact could be
significant. But I have done my best to limit it, and I think some
notable performance impact is unavoidable with the current framework for
raid strategies.

---

## Defaults & Configuration

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

Only for strategies in the instance.

If this introduces more advanced or AI-heavy logic:
- - [ ] Lightweight mode remains the default
- - [x] More complex behavior is optional and thereby configurable

There should be no impact if co +ssc and nc +ssc are not added to bots.
Because raid strategies are currently not removed after leaving an
instance, players should manually remove them (or reset botAI). This is
a general issue that needs to be addressed with the module.

---

## AI Assistance

Was AI assistance (e.g. ChatGPT or similar tools) used while working on
this change?
- - [ ] No
- - [x] 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.

GPT-4 because I don't like to use up my premium requests in CoPilot and
I generally like it better than GPT-5 =P

I use LLMs to draft code snippets but do review everything and have
become less-and-less reliant over time. I don't use agent mode, only
ask. For this PR, I had it do the updated version of
AnyRecentCoreInInventory(), which is more complicated than before and
uses indexing for each bot to consider status of only prior bots in the
passing chain. Everything else either I wrote or could have written but
had the AI help and just edited afterward to save time.

---

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

---------

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>
This commit is contained in:
Crow
2026-03-13 16:21:37 -05:00
committed by GitHub
parent ca19548cc5
commit dca0be2932
12 changed files with 1221 additions and 1547 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,8 @@
/*
* 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_RAIDSSCACTIONS_H
#define _PLAYERBOT_RAIDSSCACTIONS_H
@@ -75,8 +80,8 @@ public:
bool Execute(Event event) override;
private:
bool TryMisdirectToFrostTank(Unit* hydross, Group* group);
bool TryMisdirectToNatureTank(Unit* hydross, Group* group);
bool TryMisdirectToFrostTank(Unit* hydross);
bool TryMisdirectToNatureTank(Unit* hydross);
};
class HydrossTheUnstableStopDpsUponPhaseChangeAction : public Action
@@ -413,10 +418,10 @@ private:
bool LineUpSecondCorePasser(Player* firstCorePasser, Unit* closestTrigger);
bool LineUpThirdCorePasser(Player* designatedLooter, Player* firstCorePasser, Player* secondCorePasser, Unit* closestTrigger);
bool LineUpFourthCorePasser(Player* firstCorePasser, Player* secondCorePasser, Player* thirdCorePasser, Unit* closestTrigger);
bool IsFirstCorePasserInIntendedPosition(Player* designatedLooter, Player* firstCorePasser, Unit* closestTrigger);
bool IsSecondCorePasserInIntendedPosition(Player* firstCorePasser, Player* secondCorePasser, Unit* closestTrigger);
bool IsThirdCorePasserInIntendedPosition(Player* secondCorePasser, Player* thirdCorePasser, Unit* closestTrigger);
bool IsFourthCorePasserInIntendedPosition(Player* thirdCorePasser, Player* fourthCorePasser, Unit* closestTrigger);
bool IsFirstCorePasserInPosition(Player* designatedLooter, Player* firstCorePasser, Unit* closestTrigger);
bool IsSecondCorePasserInPosition(Player* firstCorePasser, Player* secondCorePasser, Unit* closestTrigger);
bool IsThirdCorePasserInPosition(Player* secondCorePasser, Player* thirdCorePasser, Unit* closestTrigger);
bool IsFourthCorePasserInPosition(Player* thirdCorePasser, Player* fourthCorePasser, Unit* closestTrigger);
void ScheduleTransferCoreAfterImbue(PlayerbotAI* botAI, Player* giver, Player* receiver);
bool UseCoreOnNearestGenerator(const uint32 instanceId);
};
@@ -428,19 +433,12 @@ public:
bool Execute(Event event) override;
};
class LadyVashjEraseCorePassingTrackersAction : public Action
{
public:
LadyVashjEraseCorePassingTrackersAction(PlayerbotAI* botAI, std::string const name = "lady vashj erase core passing trackers") : Action(botAI, name) {}
bool Execute(Event event) override;
};
class LadyVashjAvoidToxicSporesAction : public MovementAction
{
public:
LadyVashjAvoidToxicSporesAction(PlayerbotAI* botAI, std::string const name = "lady vashj avoid toxic spores") : MovementAction(botAI, name) {}
bool Execute(Event event) override;
static std::vector<Unit*> GetAllSporeDropTriggers(PlayerbotAI* botAI, Player* bot);
static std::vector<Unit*> GetAllSporeDropTriggers(Player* bot);
private:
Position FindSafestNearbyPosition(const std::vector<Unit*>& spores, const Position& position, float maxRadius, float hazardRadius);

View File

@@ -1,3 +1,8 @@
/*
* 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 "RaidSSCMultipliers.h"
#include "RaidSSCActions.h"
#include "RaidSSCHelpers.h"
@@ -28,12 +33,10 @@ using namespace SerpentShrineCavernHelpers;
float UnderbogColossusEscapeToxicPoolMultiplier::GetValue(Action* action)
{
if (bot->HasAura(SPELL_TOXIC_POOL))
{
if (dynamic_cast<MovementAction*>(action) &&
!dynamic_cast<UnderbogColossusEscapeToxicPoolAction*>(action))
return 0.0f;
}
if (bot->HasAura(SPELL_TOXIC_POOL) &&
dynamic_cast<MovementAction*>(action) &&
!dynamic_cast<UnderbogColossusEscapeToxicPoolAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -53,16 +56,16 @@ float HydrossTheUnstableDisableTankActionsMultiplier::GetValue(Action* action)
dynamic_cast<CombatFormationMoveAction*>(action))
return 0.0f;
if ((botAI->IsMainTank(bot) && !hydross->HasAura(SPELL_CORRUPTION)) ||
(botAI->IsAssistTankOfIndex(bot, 0, true) && hydross->HasAura(SPELL_CORRUPTION)))
return 1.0f;
if (dynamic_cast<CastReachTargetSpellAction*>(action) ||
dynamic_cast<ReachTargetAction*>(action) ||
(dynamic_cast<AttackAction*>(action) &&
!dynamic_cast<HydrossTheUnstablePositionFrostTankAction*>(action) &&
!dynamic_cast<HydrossTheUnstablePositionNatureTankAction*>(action)))
{
if ((botAI->IsMainTank(bot) && hydross->HasAura(SPELL_CORRUPTION)) ||
(botAI->IsAssistTankOfIndex(bot, 0, true) && !hydross->HasAura(SPELL_CORRUPTION)))
return 0.0f;
}
return 0.0f;
return 1.0f;
}
@@ -97,13 +100,13 @@ float HydrossTheUnstableWaitForDpsMultiplier::GetValue(Action* action)
bool aboutToChange = (itPhase != hydrossChangeToFrostPhaseTimer.end() &&
(now - itPhase->second) > phaseChangeWaitSeconds);
if (justChanged || aboutToChange)
{
if (dynamic_cast<AttackAction*>(action) ||
(dynamic_cast<CastSpellAction*>(action) &&
!dynamic_cast<CastHealingSpellAction*>(action)))
return 0.0f;
}
if (!justChanged && !aboutToChange)
return 1.0f;
if (dynamic_cast<AttackAction*>(action) ||
(dynamic_cast<CastSpellAction*>(action) &&
!dynamic_cast<CastHealingSpellAction*>(action)))
return 0.0f;
}
if (hydross->HasAura(SPELL_CORRUPTION) && !botAI->IsAssistTankOfIndex(bot, 0, true))
@@ -116,13 +119,13 @@ float HydrossTheUnstableWaitForDpsMultiplier::GetValue(Action* action)
bool aboutToChange = (itPhase != hydrossChangeToNaturePhaseTimer.end() &&
(now - itPhase->second) > phaseChangeWaitSeconds);
if (justChanged || aboutToChange)
{
if (dynamic_cast<AttackAction*>(action) ||
(dynamic_cast<CastSpellAction*>(action) &&
!dynamic_cast<CastHealingSpellAction*>(action)))
return 0.0f;
}
if (!justChanged && !aboutToChange)
return 1.0f;
if (dynamic_cast<AttackAction*>(action) ||
(dynamic_cast<CastSpellAction*>(action) &&
!dynamic_cast<CastHealingSpellAction*>(action)))
return 0.0f;
}
return 1.0f;
@@ -133,11 +136,9 @@ float HydrossTheUnstableControlMisdirectionMultiplier::GetValue(Action* action)
if (bot->getClass() != CLASS_HUNTER)
return 1.0f;
if (AI_VALUE2(Unit*, "find target", "hydross the unstable"))
{
if (dynamic_cast<CastMisdirectionOnMainTankAction*>(action))
return 0.0f;
}
if (AI_VALUE2(Unit*, "find target", "hydross the unstable") &&
dynamic_cast<CastMisdirectionOnMainTankAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -175,14 +176,14 @@ float TheLurkerBelowMaintainRangedSpreadMultiplier::GetValue(Action* action)
if (!botAI->IsRanged(bot))
return 1.0f;
if (AI_VALUE2(Unit*, "find target", "the lurker below"))
{
if (dynamic_cast<CombatFormationMoveAction*>(action) ||
dynamic_cast<FleeAction*>(action) ||
dynamic_cast<CastDisengageAction*>(action) ||
dynamic_cast<CastBlinkBackAction*>(action))
return 0.0f;
}
if (!AI_VALUE2(Unit*, "find target", "the lurker below"))
return 1.0f;
if (dynamic_cast<CombatFormationMoveAction*>(action) ||
dynamic_cast<FleeAction*>(action) ||
dynamic_cast<CastDisengageAction*>(action) ||
dynamic_cast<CastBlinkBackAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -215,11 +216,11 @@ float TheLurkerBelowDisableTankAssistMultiplier::GetValue(Action* action)
++tankCount;
}
if (tankCount >= 3)
{
if (dynamic_cast<TankAssistAction*>(action))
return 0.0f;
}
if (tankCount < 3)
return 1.0f;
if (dynamic_cast<TankAssistAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -234,22 +235,18 @@ float LeotherasTheBlindAvoidWhirlwindMultiplier::GetValue(Action* action)
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return 1.0f;
Unit* leotherasHuman = GetLeotherasHuman(botAI);
if (!leotherasHuman)
Unit* leotheras = AI_VALUE2(Unit*, "find target", "leotheras the blind");
if (!leotheras || (!leotheras->HasAura(SPELL_WHIRLWIND) &&
!leotheras->HasAura(SPELL_WHIRLWIND_CHANNEL)))
return 1.0f;
if (!leotherasHuman->HasAura(SPELL_LEOTHERAS_BANISHED) &&
(leotherasHuman->HasAura(SPELL_WHIRLWIND) ||
leotherasHuman->HasAura(SPELL_WHIRLWIND_CHANNEL)))
{
if (dynamic_cast<CastReachTargetSpellAction*>(action))
return 0.0f;
if (dynamic_cast<CastReachTargetSpellAction*>(action))
return 0.0f;
if (dynamic_cast<MovementAction*>(action) &&
!dynamic_cast<AttackAction*>(action) &&
!dynamic_cast<LeotherasTheBlindRunAwayFromWhirlwindAction*>(action))
return 0.0f;
}
if (dynamic_cast<MovementAction*>(action) &&
!dynamic_cast<AttackAction*>(action) &&
!dynamic_cast<LeotherasTheBlindRunAwayFromWhirlwindAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -262,10 +259,10 @@ float LeotherasTheBlindDisableTankActionsMultiplier::GetValue(Action* action)
if (!AI_VALUE2(Unit*, "find target", "leotheras the blind"))
return 1.0f;
if (GetPhase2LeotherasDemon(botAI) && dynamic_cast<AttackAction*>(action))
if (GetPhase2LeotherasDemon(bot) && dynamic_cast<AttackAction*>(action))
return 0.0f;
if (!GetPhase3LeotherasDemon(botAI) && dynamic_cast<CastBerserkAction*>(action))
if (!GetPhase3LeotherasDemon(bot) && dynamic_cast<CastBerserkAction*>(action))
return 0.0f;
return 1.0f;
@@ -273,21 +270,21 @@ float LeotherasTheBlindDisableTankActionsMultiplier::GetValue(Action* action)
float LeotherasTheBlindFocusOnInnerDemonMultiplier::GetValue(Action* action)
{
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
{
if (dynamic_cast<TankAssistAction*>(action) ||
dynamic_cast<DpsAssistAction*>(action) ||
dynamic_cast<CastHealingSpellAction*>(action) ||
dynamic_cast<CastCureSpellAction*>(action) ||
dynamic_cast<CurePartyMemberAction*>(action) ||
dynamic_cast<CastBuffSpellAction*>(action) ||
dynamic_cast<ResurrectPartyMemberAction*>(action) ||
dynamic_cast<PartyMemberActionNameSupport*>(action) ||
dynamic_cast<CastBearFormAction*>(action) ||
dynamic_cast<CastDireBearFormAction*>(action) ||
dynamic_cast<CastTreeFormAction*>(action))
return 0.0f;
}
if (!bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return 1.0f;
if (dynamic_cast<TankAssistAction*>(action) ||
dynamic_cast<DpsAssistAction*>(action) ||
dynamic_cast<CastHealingSpellAction*>(action) ||
dynamic_cast<CastCureSpellAction*>(action) ||
dynamic_cast<CurePartyMemberAction*>(action) ||
dynamic_cast<CastBuffSpellAction*>(action) ||
dynamic_cast<ResurrectPartyMemberAction*>(action) ||
dynamic_cast<PartyMemberActionNameSupport*>(action) ||
dynamic_cast<CastBearFormAction*>(action) ||
dynamic_cast<CastDireBearFormAction*>(action) ||
dynamic_cast<CastTreeFormAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -297,19 +294,19 @@ float LeotherasTheBlindMeleeDpsAvoidChaosBlastMultiplier::GetValue(Action* actio
if (botAI->IsRanged(bot) || botAI->IsTank(bot))
return 1.0f;
if (!GetPhase2LeotherasDemon(botAI))
if (!GetPhase2LeotherasDemon(bot))
return 1.0f;
Aura* chaosBlast = bot->GetAura(SPELL_CHAOS_BLAST);
if (chaosBlast && chaosBlast->GetStackAmount() >= 5)
{
if (dynamic_cast<AttackAction*>(action) ||
dynamic_cast<ReachTargetAction*>(action) ||
dynamic_cast<CombatFormationMoveAction*>(action) ||
dynamic_cast<CastReachTargetSpellAction*>(action) ||
dynamic_cast<CastKillingSpreeAction*>(action))
return 0.0f;
}
if (!chaosBlast || chaosBlast->GetStackAmount() < 5)
return 1.0f;
if (dynamic_cast<AttackAction*>(action) ||
dynamic_cast<ReachTargetAction*>(action) ||
dynamic_cast<CombatFormationMoveAction*>(action) ||
dynamic_cast<CastReachTargetSpellAction*>(action) ||
dynamic_cast<CastKillingSpreeAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -330,8 +327,8 @@ float LeotherasTheBlindWaitForDpsMultiplier::GetValue(Action* action)
const time_t now = std::time(nullptr);
constexpr uint8 dpsWaitSecondsPhase1 = 5;
Unit* leotherasHuman = GetLeotherasHuman(botAI);
Unit* leotherasPhase3Demon = GetPhase3LeotherasDemon(botAI);
Unit* leotherasHuman = GetLeotherasHuman(bot);
Unit* leotherasPhase3Demon = GetPhase3LeotherasDemon(bot);
if (leotherasHuman && !leotherasHuman->HasAura(SPELL_LEOTHERAS_BANISHED) &&
!leotherasPhase3Demon)
{
@@ -345,12 +342,12 @@ float LeotherasTheBlindWaitForDpsMultiplier::GetValue(Action* action)
if (dynamic_cast<AttackAction*>(action) ||
(dynamic_cast<CastSpellAction*>(action) &&
!dynamic_cast<CastHealingSpellAction*>(action)))
return 0.0f;
return 0.0f;
}
}
constexpr uint8 dpsWaitSecondsPhase2 = 12;
Unit* leotherasPhase2Demon = GetPhase2LeotherasDemon(botAI);
Unit* leotherasPhase2Demon = GetPhase2LeotherasDemon(bot);
Player* demonFormTank = GetLeotherasDemonFormTank(bot);
if (leotherasPhase2Demon)
{
@@ -367,7 +364,7 @@ float LeotherasTheBlindWaitForDpsMultiplier::GetValue(Action* action)
if (dynamic_cast<AttackAction*>(action) ||
(dynamic_cast<CastSpellAction*>(action) &&
!dynamic_cast<CastHealingSpellAction*>(action)))
return 0.0f;
return 0.0f;
}
}
@@ -384,7 +381,7 @@ float LeotherasTheBlindWaitForDpsMultiplier::GetValue(Action* action)
if (dynamic_cast<AttackAction*>(action) ||
(dynamic_cast<CastSpellAction*>(action) &&
!dynamic_cast<CastHealingSpellAction*>(action)))
return 0.0f;
return 0.0f;
}
}
@@ -398,12 +395,12 @@ float LeotherasTheBlindDelayBloodlustAndHeroismMultiplier::GetValue(Action* acti
return 1.0f;
Unit* leotheras = AI_VALUE2(Unit*, "find target", "leotheras the blind");
if (leotheras && leotheras->HasAura(SPELL_LEOTHERAS_BANISHED))
{
if (dynamic_cast<CastHeroismAction*>(action) ||
dynamic_cast<CastBloodlustAction*>(action))
return 0.0f;
}
if (!leotheras || !leotheras->HasAura(SPELL_LEOTHERAS_BANISHED))
return 1.0f;
if (dynamic_cast<CastHeroismAction*>(action) ||
dynamic_cast<CastBloodlustAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -447,14 +444,12 @@ float FathomLordKarathressDisableAoeMultiplier::GetValue(Action* action)
if (!botAI->IsDps(bot))
return 1.0f;
if (AI_VALUE2(Unit*, "find target", "fathom-lord karathress"))
{
if (auto castSpellAction = dynamic_cast<CastSpellAction*>(action))
{
if (castSpellAction->getThreatType() == Action::ActionThreatType::Aoe)
return 0.0f;
}
}
if (!AI_VALUE2(Unit*, "find target", "fathom-lord karathress"))
return 1.0f;
auto castSpellAction = dynamic_cast<CastSpellAction*>(action);
if (castSpellAction && castSpellAction->getThreatType() == Action::ActionThreatType::Aoe)
return 0.0f;
return 1.0f;
}
@@ -464,11 +459,11 @@ float FathomLordKarathressControlMisdirectionMultiplier::GetValue(Action* action
if (bot->getClass() != CLASS_HUNTER)
return 1.0f;
if (AI_VALUE2(Unit*, "find target", "fathom-lord karathress"))
{
if (dynamic_cast<CastMisdirectionOnMainTankAction*>(action))
return 0.0f;
}
if (!AI_VALUE2(Unit*, "find target", "fathom-lord karathress"))
return 1.0f;
if (dynamic_cast<CastMisdirectionOnMainTankAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -494,7 +489,7 @@ float FathomLordKarathressWaitForDpsMultiplier::GetValue(Action* action)
if (dynamic_cast<AttackAction*>(action) ||
(dynamic_cast<CastSpellAction*>(action) &&
!dynamic_cast<CastHealingSpellAction*>(action)))
return 0.0f;
return 0.0f;
}
return 1.0f;
@@ -505,12 +500,12 @@ float FathomLordKarathressCaribdisTankHealerMaintainPositionMultiplier::GetValue
if (!botAI->IsAssistHealOfIndex(bot, 0, true))
return 1.0f;
if (AI_VALUE2(Unit*, "find target", "fathom-guard caribdis"))
{
if (dynamic_cast<FleeAction*>(action) ||
dynamic_cast<FollowAction*>(action))
return 0.0f;
}
if (!AI_VALUE2(Unit*, "find target", "fathom-guard caribdis"))
return 1.0f;
if (dynamic_cast<FleeAction*>(action) ||
dynamic_cast<FollowAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -526,12 +521,12 @@ float MorogrimTidewalkerDelayBloodlustAndHeroismMultiplier::GetValue(Action* act
if (!AI_VALUE2(Unit*, "find target", "morogrim tidewalker"))
return 1.0f;
if (!AI_VALUE2(Unit*, "find target", "tidewalker lurker"))
{
if (dynamic_cast<CastHeroismAction*>(action) ||
dynamic_cast<CastBloodlustAction*>(action))
return 0.0f;
}
if (AI_VALUE2(Unit*, "find target", "tidewalker lurker"))
return 1.0f;
if (dynamic_cast<CastHeroismAction*>(action) ||
dynamic_cast<CastBloodlustAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -541,11 +536,11 @@ float MorogrimTidewalkerDisableTankActionsMultiplier::GetValue(Action* action)
if (!botAI->IsMainTank(bot))
return 1.0f;
if (AI_VALUE2(Unit*, "find target", "morogrim tidewalker"))
{
if (dynamic_cast<CombatFormationMoveAction*>(action))
return 0.0f;
}
if (!AI_VALUE2(Unit*, "find target", "morogrim tidewalker"))
return 1.0f;
if (dynamic_cast<CombatFormationMoveAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -556,17 +551,14 @@ float MorogrimTidewalkerMaintainPhase2StackingMultiplier::GetValue(Action* actio
return 1.0f;
Unit* tidewalker = AI_VALUE2(Unit*, "find target", "morogrim tidewalker");
if (!tidewalker)
if (!tidewalker || tidewalker->GetHealthPct() > 25.0f)
return 1.0f;
if (tidewalker->GetHealthPct() < 25.0f)
{
if (dynamic_cast<CombatFormationMoveAction*>(action) ||
dynamic_cast<FleeAction*>(action) ||
dynamic_cast<CastDisengageAction*>(action) ||
dynamic_cast<CastBlinkBackAction*>(action))
return 0.0f;
}
if (dynamic_cast<CombatFormationMoveAction*>(action) ||
dynamic_cast<FleeAction*>(action) ||
dynamic_cast<CastDisengageAction*>(action) ||
dynamic_cast<CastBlinkBackAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -580,41 +572,59 @@ float LadyVashjDelayCooldownsMultiplier::GetValue(Action* action)
if (!AI_VALUE2(Unit*, "find target", "lady vashj"))
return 1.0f;
if (bot->getClass() == CLASS_SHAMAN)
{
if (IsLadyVashjInPhase3(botAI))
return 1.0f;
if (bot->getClass() == CLASS_SHAMAN &&
!IsLadyVashjInPhase3(botAI) &&
(dynamic_cast<CastBloodlustAction*>(action) ||
dynamic_cast<CastHeroismAction*>(action)))
return 0.0f;
if (dynamic_cast<CastBloodlustAction*>(action) ||
dynamic_cast<CastHeroismAction*>(action))
return 0.0f;
}
if (!botAI->IsDps(bot) || !IsLadyVashjInPhase1(botAI))
return 1.0f;
if (botAI->IsDps(bot) && IsLadyVashjInPhase1(botAI))
{
if (dynamic_cast<CastMetamorphosisAction*>(action) ||
dynamic_cast<CastAdrenalineRushAction*>(action) ||
dynamic_cast<CastBladeFlurryAction*>(action) ||
dynamic_cast<CastIcyVeinsAction*>(action) ||
dynamic_cast<CastColdSnapAction*>(action) ||
dynamic_cast<CastArcanePowerAction*>(action) ||
dynamic_cast<CastPresenceOfMindAction*>(action) ||
dynamic_cast<CastCombustionAction*>(action) ||
dynamic_cast<CastRapidFireAction*>(action) ||
dynamic_cast<CastReadinessAction*>(action) ||
dynamic_cast<CastAvengingWrathAction*>(action) ||
dynamic_cast<CastElementalMasteryAction*>(action) ||
dynamic_cast<CastFeralSpiritAction*>(action) ||
dynamic_cast<CastFireElementalTotemAction*>(action) ||
dynamic_cast<CastFireElementalTotemMeleeAction*>(action) ||
dynamic_cast<CastForceOfNatureAction*>(action) ||
dynamic_cast<CastArmyOfTheDeadAction*>(action) ||
dynamic_cast<CastSummonGargoyleAction*>(action) ||
dynamic_cast<CastBerserkingAction*>(action) ||
dynamic_cast<CastBloodFuryAction*>(action) ||
dynamic_cast<UseTrinketAction*>(action))
return 0.0f;
}
if (dynamic_cast<CastMetamorphosisAction*>(action) ||
dynamic_cast<CastAdrenalineRushAction*>(action) ||
dynamic_cast<CastBladeFlurryAction*>(action) ||
dynamic_cast<CastIcyVeinsAction*>(action) ||
dynamic_cast<CastColdSnapAction*>(action) ||
dynamic_cast<CastArcanePowerAction*>(action) ||
dynamic_cast<CastPresenceOfMindAction*>(action) ||
dynamic_cast<CastCombustionAction*>(action) ||
dynamic_cast<CastRapidFireAction*>(action) ||
dynamic_cast<CastReadinessAction*>(action) ||
dynamic_cast<CastAvengingWrathAction*>(action) ||
dynamic_cast<CastElementalMasteryAction*>(action) ||
dynamic_cast<CastFeralSpiritAction*>(action) ||
dynamic_cast<CastFireElementalTotemAction*>(action) ||
dynamic_cast<CastFireElementalTotemMeleeAction*>(action) ||
dynamic_cast<CastForceOfNatureAction*>(action) ||
dynamic_cast<CastArmyOfTheDeadAction*>(action) ||
dynamic_cast<CastSummonGargoyleAction*>(action) ||
dynamic_cast<CastBerserkingAction*>(action) ||
dynamic_cast<CastBloodFuryAction*>(action) ||
dynamic_cast<UseTrinketAction*>(action))
return 0.0f;
return 1.0f;
}
float LadyVashjMainTankGroupShamanUseGroundingTotemMultiplier::GetValue(Action* action)
{
if (bot->getClass() != CLASS_SHAMAN)
return 1.0f;
if (!AI_VALUE2(Unit*, "find target", "lady vashj"))
return 1.0f;
if (!IsMainTankInSameSubgroup(botAI, bot))
return 1.0f;
if (dynamic_cast<CastWindfuryTotemAction*>(action) ||
dynamic_cast<SetWindfuryTotemAction*>(action) ||
dynamic_cast<CastWrathOfAirTotemAction*>(action) ||
dynamic_cast<SetWrathOfAirTotemAction*>(action) ||
dynamic_cast<CastNatureResistanceTotemAction*>(action) ||
dynamic_cast<SetNatureResistanceTotemAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -624,15 +634,15 @@ float LadyVashjMaintainPhase1RangedSpreadMultiplier::GetValue(Action* action)
if (!botAI->IsRanged(bot))
return 1.0f;
if (AI_VALUE2(Unit*, "find target", "lady vashj") &&
IsLadyVashjInPhase1(botAI))
{
if (dynamic_cast<CombatFormationMoveAction*>(action) ||
dynamic_cast<FleeAction*>(action) ||
dynamic_cast<CastDisengageAction*>(action) ||
dynamic_cast<CastBlinkBackAction*>(action))
return 0.0f;
}
if (!AI_VALUE2(Unit*, "find target", "lady vashj") ||
!IsLadyVashjInPhase1(botAI))
return 1.0f;
if (dynamic_cast<CombatFormationMoveAction*>(action) ||
dynamic_cast<FleeAction*>(action) ||
dynamic_cast<CastDisengageAction*>(action) ||
dynamic_cast<CastBlinkBackAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -658,19 +668,18 @@ float LadyVashjStaticChargeStayAwayFromGroupMultiplier::GetValue(Action* action)
// Bots should not loot the core with normal looting logic
float LadyVashjDoNotLootTheTaintedCoreMultiplier::GetValue(Action* action)
{
if (AI_VALUE2(Unit*, "find target", "lady vashj"))
{
if (dynamic_cast<LootAction*>(action))
return 0.0f;
}
if (!AI_VALUE2(Unit*, "find target", "lady vashj"))
return 1.0f;
if (dynamic_cast<LootAction*>(action))
return 0.0f;
return 1.0f;
}
float LadyVashjCorePassersPrioritizePositioningMultiplier::GetValue(Action* action)
{
if (!AI_VALUE2(Unit*, "find target", "lady vashj") ||
!IsLadyVashjInPhase2(botAI))
if (!AI_VALUE2(Unit*, "find target", "lady vashj") || !IsLadyVashjInPhase2(botAI))
return 1.0f;
if (dynamic_cast<WipeAction*>(action) ||
@@ -678,65 +687,43 @@ float LadyVashjCorePassersPrioritizePositioningMultiplier::GetValue(Action* acti
dynamic_cast<LadyVashjDestroyTaintedCoreAction*>(action))
return 1.0f;
Group* group = bot->GetGroup();
if (!group)
return 1.0f;
auto coreHandlers = GetCoreHandlers(botAI, bot);
Player* designatedLooter = GetDesignatedCoreLooter(group, botAI);
Player* firstCorePasser = GetFirstTaintedCorePasser(group, botAI);
Player* secondCorePasser = GetSecondTaintedCorePasser(group, botAI);
Player* thirdCorePasser = GetThirdTaintedCorePasser(group, botAI);
Player* fourthCorePasser = GetFourthTaintedCorePasser(group, botAI);
bool isCoreHandler = false;
int myIndex = -1;
for (int i = 0; i < static_cast<int>(coreHandlers.size()); ++i)
{
if (coreHandlers[i] && coreHandlers[i] == bot)
{
isCoreHandler = true;
myIndex = i;
}
}
if (!isCoreHandler)
return 1.0f;
auto hasCore = [](Player* player)
{
return player && player->HasItemCount(ITEM_TAINTED_CORE, 1, false);
};
if (hasCore(bot))
{
if (!dynamic_cast<LadyVashjPassTheTaintedCoreAction*>(action))
return 0.0f;
}
// If the bot actually has the core, only allow core handling
if (hasCore(bot) && !dynamic_cast<LadyVashjPassTheTaintedCoreAction*>(action))
return 0.0f;
if (bot == designatedLooter)
{
if (!hasCore(bot))
return 1.0f;
}
else if (bot == firstCorePasser)
{
if (hasCore(secondCorePasser) || hasCore(thirdCorePasser) ||
hasCore(fourthCorePasser))
return 1.0f;
}
else if (bot == secondCorePasser)
{
if (hasCore(thirdCorePasser) || hasCore(fourthCorePasser))
return 1.0f;
}
else if (bot == thirdCorePasser)
{
if (hasCore(fourthCorePasser))
return 1.0f;
}
else if (bot != fourthCorePasser)
return 1.0f;
// First and second passers block movement when the looter teleports to the elemental
Unit* tainted = AI_VALUE2(Unit*, "find target", "tainted elemental");
if (tainted && coreHandlers[0]->GetExactDist2d(tainted) < 5.0f &&
(bot == coreHandlers[1] || bot == coreHandlers[2]) &&
(dynamic_cast<MovementAction*>(action) &&
!dynamic_cast<LadyVashjPassTheTaintedCoreAction*>(action)))
return 0.0f;
if (AI_VALUE2(Unit*, "find target", "tainted elemental") &&
(bot == firstCorePasser || bot == secondCorePasser))
{
if (dynamic_cast<MovementAction*>(action) &&
!dynamic_cast<LadyVashjPassTheTaintedCoreAction*>(action))
return 0.0f;
}
if (AnyRecentCoreInInventory(group, botAI))
{
if (dynamic_cast<MovementAction*>(action) &&
!dynamic_cast<LadyVashjPassTheTaintedCoreAction*>(action))
return 0.0f;
}
// If any prior handler (including self) recently had the core, block other movement
if (AnyRecentCoreInInventory(botAI, bot) &&
dynamic_cast<MovementAction*>(action) &&
!dynamic_cast<LadyVashjPassTheTaintedCoreAction*>(action))
return 0.0f;
return 1.0f;
}
@@ -745,7 +732,8 @@ float LadyVashjCorePassersPrioritizePositioningMultiplier::GetValue(Action* acti
// So the standard target selection system must be disabled
float LadyVashjDisableAutomaticTargetingAndMovementModifier::GetValue(Action *action)
{
if (!AI_VALUE2(Unit*, "find target", "lady vashj"))
Unit* vashj = AI_VALUE2(Unit*, "find target", "lady vashj");
if (!vashj)
return 1.0f;
if (dynamic_cast<AvoidAoeAction*>(action))
@@ -755,24 +743,26 @@ float LadyVashjDisableAutomaticTargetingAndMovementModifier::GetValue(Action *ac
{
if (dynamic_cast<DpsAssistAction*>(action) ||
dynamic_cast<TankAssistAction*>(action) ||
dynamic_cast<FollowAction*>(action) ||
dynamic_cast<FleeAction*>(action))
return 0.0f;
if (bot->GetExactDist2d(vashj) < 60.0f &&
dynamic_cast<FollowAction*>(action))
return 0.0f;
if (!botAI->IsHeal(bot) && dynamic_cast<CastHealingSpellAction*>(action))
return 0.0f;
Unit* enchanted = AI_VALUE2(Unit*, "find target", "enchanted elemental");
if (enchanted && bot->GetVictim() == enchanted)
{
if (dynamic_cast<CastDebuffSpellOnAttackerAction*>(action))
return 0.0f;
}
if (enchanted && bot->GetVictim() == enchanted &&
dynamic_cast<CastDebuffSpellOnAttackerAction*>(action))
return 0.0f;
}
if (IsLadyVashjInPhase3(botAI))
{
if (dynamic_cast<DpsAssistAction*>(action))
if (dynamic_cast<DpsAssistAction*>(action) ||
dynamic_cast<TankAssistAction*>(action))
return 0.0f;
Unit* enchanted = AI_VALUE2(Unit*, "find target", "enchanted elemental");
@@ -780,16 +770,13 @@ float LadyVashjDisableAutomaticTargetingAndMovementModifier::GetValue(Action *ac
Unit* elite = AI_VALUE2(Unit*, "find target", "coilfang elite");
if (enchanted || strider || elite)
{
if (dynamic_cast<TankAssistAction*>(action) ||
dynamic_cast<FollowAction*>(action) ||
if (dynamic_cast<FollowAction*>(action) ||
dynamic_cast<FleeAction*>(action))
return 0.0f;
if (enchanted && bot->GetVictim() == enchanted)
{
if (dynamic_cast<CastDebuffSpellOnAttackerAction*>(action))
return 0.0f;
}
if (enchanted && bot->GetVictim() == enchanted &&
dynamic_cast<CastDebuffSpellOnAttackerAction*>(action))
return 0.0f;
}
else if (dynamic_cast<CombatFormationMoveAction*>(action))
return 0.0f;

View File

@@ -1,3 +1,8 @@
/*
* 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_RAIDSSCMULTIPLIERS_H
#define _PLAYERBOT_RAIDSSCMULTIPLIERS_H
@@ -193,6 +198,14 @@ public:
virtual float GetValue(Action* action);
};
class LadyVashjMainTankGroupShamanUseGroundingTotemMultiplier : public Multiplier
{
public:
LadyVashjMainTankGroupShamanUseGroundingTotemMultiplier(
PlayerbotAI* botAI) : Multiplier(botAI, "lady vashj main tank group shaman use grounding totem") {}
virtual float GetValue(Action* action);
};
class LadyVashjMaintainPhase1RangedSpreadMultiplier : public Multiplier
{
public:

View File

@@ -1,3 +1,8 @@
/*
* 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_RAIDSSCACTIONCONTEXT_H
#define _PLAYERBOT_RAIDSSCACTIONCONTEXT_H
@@ -161,9 +166,6 @@ public:
creators["lady vashj destroy tainted core"] =
&RaidSSCActionContext::lady_vashj_destroy_tainted_core;
creators["lady vashj erase core passing trackers"] =
&RaidSSCActionContext::lady_vashj_erase_core_passing_trackers;
creators["lady vashj avoid toxic spores"] =
&RaidSSCActionContext::lady_vashj_avoid_toxic_spores;
@@ -324,9 +326,6 @@ private:
static Action* lady_vashj_destroy_tainted_core(
PlayerbotAI* botAI) { return new LadyVashjDestroyTaintedCoreAction(botAI); }
static Action* lady_vashj_erase_core_passing_trackers(
PlayerbotAI* botAI) { return new LadyVashjEraseCorePassingTrackersAction(botAI); }
static Action* lady_vashj_avoid_toxic_spores(
PlayerbotAI* botAI) { return new LadyVashjAvoidToxicSporesAction(botAI); }

View File

@@ -1,3 +1,8 @@
/*
* 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_RAIDSSCTRIGGERCONTEXT_H
#define _PLAYERBOT_RAIDSSCTRIGGERCONTEXT_H
@@ -155,9 +160,6 @@ public:
creators["lady vashj tainted core is unusable"] =
&RaidSSCTriggerContext::lady_vashj_tainted_core_is_unusable;
creators["lady vashj need to reset core passing trackers"] =
&RaidSSCTriggerContext::lady_vashj_need_to_reset_core_passing_trackers;
creators["lady vashj toxic sporebats are spewing poison clouds"] =
&RaidSSCTriggerContext::lady_vashj_toxic_sporebats_are_spewing_poison_clouds;
@@ -312,9 +314,6 @@ private:
static Trigger* lady_vashj_tainted_core_is_unusable(
PlayerbotAI* botAI) { return new LadyVashjTaintedCoreIsUnusableTrigger(botAI); }
static Trigger* lady_vashj_need_to_reset_core_passing_trackers(
PlayerbotAI* botAI) { return new LadyVashjNeedToResetCorePassingTrackersTrigger(botAI); }
static Trigger* lady_vashj_toxic_sporebats_are_spewing_poison_clouds(
PlayerbotAI* botAI) { return new LadyVashjToxicSporebatsAreSpewingPoisonCloudsTrigger(botAI); }

View File

@@ -1,3 +1,8 @@
/*
* 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 "RaidSSCStrategy.h"
#include "RaidSSCMultipliers.h"
@@ -144,9 +149,6 @@ void RaidSSCStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back(new TriggerNode("lady vashj tainted core is unusable", {
NextAction("lady vashj destroy tainted core", ACTION_EMERGENCY + 1) }));
triggers.push_back(new TriggerNode("lady vashj need to reset core passing trackers", {
NextAction("lady vashj erase core passing trackers", ACTION_EMERGENCY + 10) }));
triggers.push_back(new TriggerNode("lady vashj adds spawn in phase 2 and phase 3", {
NextAction("lady vashj assign phase 2 and phase 3 dps priority", ACTION_RAID + 1) }));
@@ -198,6 +200,7 @@ void RaidSSCStrategy::InitMultipliers(std::vector<Multiplier*>& multipliers)
// Lady Vashj <Coilfang Matron>
multipliers.push_back(new LadyVashjDelayCooldownsMultiplier(botAI));
multipliers.push_back(new LadyVashjMainTankGroupShamanUseGroundingTotemMultiplier(botAI));
multipliers.push_back(new LadyVashjMaintainPhase1RangedSpreadMultiplier(botAI));
multipliers.push_back(new LadyVashjStaticChargeStayAwayFromGroupMultiplier(botAI));
multipliers.push_back(new LadyVashjDoNotLootTheTaintedCoreMultiplier(botAI));

View File

@@ -1,3 +1,8 @@
/*
* 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_RAIDSSCSTRATEGY_H_
#define _PLAYERBOT_RAIDSSCSTRATEGY_H_

View File

@@ -1,3 +1,8 @@
/*
* 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 "RaidSSCTriggers.h"
#include "RaidSSCHelpers.h"
#include "RaidSSCActions.h"
@@ -26,35 +31,37 @@ bool UnderbogColossusSpawnedToxicPoolAfterDeathTrigger::IsActive()
bool GreyheartTidecallerWaterElementalTotemSpawnedTrigger::IsActive()
{
return botAI->IsDps(bot) &&
GetFirstAliveUnitByEntry(botAI, NPC_WATER_ELEMENTAL_TOTEM);
AI_VALUE2(Unit*, "find target", "greyheart tidecaller");
}
// Hydross the Unstable <Duke of Currents>
bool HydrossTheUnstableBotIsFrostTankTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "hydross the unstable") &&
botAI->IsMainTank(bot);
return botAI->IsMainTank(bot) &&
AI_VALUE2(Unit*, "find target", "hydross the unstable");
}
bool HydrossTheUnstableBotIsNatureTankTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "hydross the unstable") &&
botAI->IsAssistTankOfIndex(bot, 0, true);
return botAI->IsAssistTankOfIndex(bot, 0, true) &&
AI_VALUE2(Unit*, "find target", "hydross the unstable");
}
bool HydrossTheUnstableElementalsSpawnedTrigger::IsActive()
{
if (botAI->IsHeal(bot))
return false;
Unit* hydross = AI_VALUE2(Unit*, "find target", "hydross the unstable");
if (hydross && hydross->GetHealthPct() < 10.0f)
if (!hydross || hydross->GetHealthPct() < 10.0f)
return false;
if (!AI_VALUE2(Unit*, "find target", "pure spawn of hydross") &&
!AI_VALUE2(Unit*, "find target", "tainted spawn of hydross"))
if (botAI->IsMainTank(bot) || botAI->IsAssistTankOfIndex(bot, 0, true))
return false;
return !botAI->IsHeal(bot) && !botAI->IsMainTank(bot) &&
!botAI->IsAssistTankOfIndex(bot, 0, true);
return AI_VALUE2(Unit*, "find target", "pure spawn of hydross") ||
AI_VALUE2(Unit*, "find target", "tainted spawn of hydross");
}
bool HydrossTheUnstableDangerFromWaterTombsTrigger::IsActive()
@@ -71,19 +78,19 @@ bool HydrossTheUnstableTankNeedsAggroUponPhaseChangeTrigger::IsActive()
bool HydrossTheUnstableAggroResetsUponPhaseChangeTrigger::IsActive()
{
if (!AI_VALUE2(Unit*, "find target", "hydross the unstable"))
if (bot->getClass() == CLASS_HUNTER ||
botAI->IsHeal(bot) ||
botAI->IsMainTank(bot) ||
botAI->IsAssistTankOfIndex(bot, 0, true))
return false;
return bot->getClass() != CLASS_HUNTER &&
!botAI->IsHeal(bot) &&
!botAI->IsMainTank(bot) &&
!botAI->IsAssistTankOfIndex(bot, 0, true);
return AI_VALUE2(Unit*, "find target", "hydross the unstable");
}
bool HydrossTheUnstableNeedToManageTimersTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "hydross the unstable") &&
IsMechanicTrackerBot(botAI, bot, SSC_MAP_ID, nullptr);
return IsMechanicTrackerBot(botAI, bot, SSC_MAP_ID) &&
AI_VALUE2(Unit*, "find target", "hydross the unstable");
}
// The Lurker Below
@@ -102,11 +109,11 @@ bool TheLurkerBelowSpoutIsActiveTrigger::IsActive()
bool TheLurkerBelowBossIsActiveForMainTankTrigger::IsActive()
{
Unit* lurker = AI_VALUE2(Unit*, "find target", "the lurker below");
if (!lurker)
if (!botAI->IsMainTank(bot))
return false;
if (!botAI->IsMainTank(bot))
Unit* lurker = AI_VALUE2(Unit*, "find target", "the lurker below");
if (!lurker)
return false;
const time_t now = std::time(nullptr);
@@ -135,35 +142,16 @@ bool TheLurkerBelowBossCastsGeyserTrigger::IsActive()
// Trigger will be active only if there are at least 3 tanks in the raid
bool TheLurkerBelowBossIsSubmergedTrigger::IsActive()
{
if (!botAI->IsTank(bot))
return false;
Unit* lurker = AI_VALUE2(Unit*, "find target", "the lurker below");
if (!lurker || lurker->getStandState() != UNIT_STAND_STATE_SUBMERGED)
return false;
Player* mainTank = nullptr;
Player* firstAssistTank = nullptr;
Player* secondAssistTank = nullptr;
Group* group = bot->GetGroup();
if (!group)
return false;
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (!member || !member->IsAlive())
continue;
PlayerbotAI* memberAI = GET_PLAYERBOT_AI(member);
if (!memberAI)
continue;
if (!mainTank && memberAI->IsMainTank(member))
mainTank = member;
else if (!firstAssistTank && memberAI->IsAssistTankOfIndex(member, 0, true))
firstAssistTank = member;
else if (!secondAssistTank && memberAI->IsAssistTankOfIndex(member, 1, true))
secondAssistTank = member;
}
Player* mainTank = GetGroupMainTank(botAI, bot);
Player* firstAssistTank = GetGroupAssistTank(botAI, bot, 0);
Player* secondAssistTank = GetGroupAssistTank(botAI, bot, 1);
if (!mainTank || !firstAssistTank || !secondAssistTank)
return false;
@@ -173,51 +161,55 @@ bool TheLurkerBelowBossIsSubmergedTrigger::IsActive()
bool TheLurkerBelowNeedToPrepareTimerForSpoutTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "the lurker below") &&
IsMechanicTrackerBot(botAI, bot, SSC_MAP_ID, nullptr);
return IsMechanicTrackerBot(botAI, bot, SSC_MAP_ID) &&
AI_VALUE2(Unit*, "find target", "the lurker below");
}
// Leotheras the Blind
bool LeotherasTheBlindBossIsInactiveTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "greyheart spellbinder");
return IsMechanicTrackerBot(botAI, bot, SSC_MAP_ID) &&
AI_VALUE2(Unit*, "find target", "greyheart spellbinder");
}
bool LeotherasTheBlindBossTransformedIntoDemonFormTrigger::IsActive()
{
if (bot->getClass() != CLASS_WARLOCK)
return false;
if (!AI_VALUE2(Unit*, "find target", "leotheras the blind"))
return false;
if (GetLeotherasDemonFormTank(bot) != bot)
return false;
return GetActiveLeotherasDemon(botAI);
return GetActiveLeotherasDemon(bot);
}
bool LeotherasTheBlindOnlyWarlockShouldTankDemonFormTrigger::IsActive()
{
if (botAI->IsRanged(bot) || !botAI->IsTank(bot))
if (!botAI->IsTank(bot))
return false;
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return false;
if (!AI_VALUE2(Unit*, "find target", "leotheras the blind"))
return false;
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return false;
if (!GetLeotherasDemonFormTank(bot))
return false;
return GetPhase2LeotherasDemon(botAI);
return GetPhase2LeotherasDemon(bot);
}
bool LeotherasTheBlindBossEngagedByRangedTrigger::IsActive()
{
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
if (!botAI->IsRanged(bot))
return false;
if (!botAI->IsRanged(bot))
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return false;
Unit* leotheras = AI_VALUE2(Unit*, "find target", "leotheras the blind");
@@ -231,14 +223,14 @@ bool LeotherasTheBlindBossEngagedByRangedTrigger::IsActive()
bool LeotherasTheBlindBossChannelingWhirlwindTrigger::IsActive()
{
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return false;
if (botAI->IsTank(bot) && botAI->IsMelee(bot))
if (botAI->IsTank(bot))
return false;
Unit* leotheras = AI_VALUE2(Unit*, "find target", "leotheras the blind");
if (!leotheras || leotheras->HasAura(SPELL_LEOTHERAS_BANISHED))
if (!leotheras)
return false;
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return false;
return leotheras->HasAura(SPELL_WHIRLWIND) ||
@@ -247,10 +239,13 @@ bool LeotherasTheBlindBossChannelingWhirlwindTrigger::IsActive()
bool LeotherasTheBlindBotHasTooManyChaosBlastStacksTrigger::IsActive()
{
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
if (botAI->IsRanged(bot))
return false;
if (botAI->IsRanged(bot))
if (!AI_VALUE2(Unit*, "find target", "leotheras the blind"))
return false;
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return false;
Aura* chaosBlast = bot->GetAura(SPELL_CHAOS_BLAST);
@@ -260,7 +255,7 @@ bool LeotherasTheBlindBotHasTooManyChaosBlastStacksTrigger::IsActive()
if (!GetLeotherasDemonFormTank(bot) && botAI->IsMainTank(bot))
return false;
return GetPhase2LeotherasDemon(botAI);
return GetPhase2LeotherasDemon(bot);
}
bool LeotherasTheBlindInnerDemonHasAwakenedTrigger::IsActive()
@@ -271,89 +266,68 @@ bool LeotherasTheBlindInnerDemonHasAwakenedTrigger::IsActive()
bool LeotherasTheBlindEnteredFinalPhaseTrigger::IsActive()
{
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return false;
if (botAI->IsHeal(bot))
return false;
if (GetLeotherasDemonFormTank(bot) == bot)
if (!AI_VALUE2(Unit*, "find target", "leotheras the blind"))
return false;
return GetPhase3LeotherasDemon(botAI) &&
GetLeotherasHuman(botAI);
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return false;
if (bot->getClass() == CLASS_WARLOCK && GetLeotherasDemonFormTank(bot) == bot)
return false;
return GetPhase3LeotherasDemon(bot);
}
bool LeotherasTheBlindDemonFormTankNeedsAggro::IsActive()
{
if (bot->HasAura(SPELL_INSIDIOUS_WHISPER))
return false;
if (bot->getClass() != CLASS_HUNTER)
return false;
return AI_VALUE2(Unit*, "find target", "leotheras the blind");
if (!AI_VALUE2(Unit*, "find target", "leotheras the blind"))
return false;
return !bot->HasAura(SPELL_INSIDIOUS_WHISPER);
}
bool LeotherasTheBlindBossWipesAggroUponPhaseChangeTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "leotheras the blind") &&
IsMechanicTrackerBot(botAI, bot, SSC_MAP_ID, nullptr);
return IsMechanicTrackerBot(botAI, bot, SSC_MAP_ID) &&
AI_VALUE2(Unit*, "find target", "leotheras the blind");
}
// Fathom-Lord Karathress
bool FathomLordKarathressBossEngagedByMainTankTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "fathom-lord karathress") &&
botAI->IsMainTank(bot);
return botAI->IsMainTank(bot) &&
AI_VALUE2(Unit*, "find target", "fathom-lord karathress");
}
bool FathomLordKarathressCaribdisEngagedByFirstAssistTankTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "fathom-guard caribdis") &&
botAI->IsAssistTankOfIndex(bot, 0, false);
return botAI->IsAssistTankOfIndex(bot, 0, false) &&
AI_VALUE2(Unit*, "find target", "fathom-guard caribdis");
}
bool FathomLordKarathressSharkkisEngagedBySecondAssistTankTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "fathom-guard sharkkis") &&
botAI->IsAssistTankOfIndex(bot, 1, false);
return botAI->IsAssistTankOfIndex(bot, 1, false) &&
AI_VALUE2(Unit*, "find target", "fathom-guard sharkkis");
}
bool FathomLordKarathressTidalvessEngagedByThirdAssistTankTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "fathom-guard tidalvess") &&
botAI->IsAssistTankOfIndex(bot, 2, false);
return botAI->IsAssistTankOfIndex(bot, 2, false) &&
AI_VALUE2(Unit*, "find target", "fathom-guard tidalvess");
}
bool FathomLordKarathressCaribdisTankNeedsDedicatedHealerTrigger::IsActive()
{
Unit* caribdis = AI_VALUE2(Unit*, "find target", "fathom-guard caribdis");
if (!caribdis)
return false;
if (!botAI->IsAssistHealOfIndex(bot, 0, true))
return false;
Player* firstAssistTank = nullptr;
if (Group* group = bot->GetGroup())
{
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (!member || !member->IsAlive())
continue;
if (botAI->IsAssistTankOfIndex(member, 0, false))
{
firstAssistTank = member;
break;
}
}
}
return firstAssistTank;
return botAI->IsAssistHealOfIndex(bot, 0, true) &&
AI_VALUE2(Unit*, "find target", "fathom-guard caribdis");
}
bool FathomLordKarathressPullingBossesTrigger::IsActive()
@@ -367,10 +341,10 @@ bool FathomLordKarathressPullingBossesTrigger::IsActive()
bool FathomLordKarathressDeterminingKillOrderTrigger::IsActive()
{
if (!AI_VALUE2(Unit*, "find target", "fathom-lord karathress"))
if (botAI->IsHeal(bot))
return false;
if (botAI->IsHeal(bot))
if (!AI_VALUE2(Unit*, "find target", "fathom-lord karathress"))
return false;
if (botAI->IsDps(bot))
@@ -387,8 +361,8 @@ bool FathomLordKarathressDeterminingKillOrderTrigger::IsActive()
bool FathomLordKarathressTanksNeedToEstablishAggroTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "fathom-lord karathress") &&
IsMechanicTrackerBot(botAI, bot, SSC_MAP_ID, nullptr);
return IsMechanicTrackerBot(botAI, bot, SSC_MAP_ID) &&
AI_VALUE2(Unit*, "find target", "fathom-lord karathress");
}
// Morogrim Tidewalker
@@ -404,8 +378,8 @@ bool MorogrimTidewalkerPullingBossTrigger::IsActive()
bool MorogrimTidewalkerBossEngagedByMainTankTrigger::IsActive()
{
return AI_VALUE2(Unit*, "find target", "morogrim tidewalker") &&
botAI->IsMainTank(bot);
return botAI->IsMainTank(bot) &&
AI_VALUE2(Unit*, "find target", "morogrim tidewalker");
}
bool MorogrimTidewalkerWaterGlobulesAreIncomingTrigger::IsActive()
@@ -421,8 +395,11 @@ bool MorogrimTidewalkerWaterGlobulesAreIncomingTrigger::IsActive()
bool LadyVashjBossEngagedByMainTankTrigger::IsActive()
{
if (!botAI->IsMainTank(bot))
return false;
return AI_VALUE2(Unit*, "find target", "lady vashj") &&
!IsLadyVashjInPhase2(botAI) && botAI->IsMainTank(bot);
!IsLadyVashjInPhase2(botAI);
}
bool LadyVashjBossEngagedByRangedInPhase1Trigger::IsActive()
@@ -439,10 +416,7 @@ bool LadyVashjCastsShockBlastOnHighestAggroTrigger::IsActive()
IsLadyVashjInPhase2(botAI))
return false;
if (!IsMainTankInSameSubgroup(bot))
return false;
return true;
return IsMainTankInSameSubgroup(botAI, bot);
}
bool LadyVashjBotHasStaticChargeTrigger::IsActive()
@@ -450,14 +424,15 @@ bool LadyVashjBotHasStaticChargeTrigger::IsActive()
if (!AI_VALUE2(Unit*, "find target", "lady vashj"))
return false;
if (Group* group = bot->GetGroup())
Group* group = bot->GetGroup();
if (!group)
return false;
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (member && member->HasAura(SPELL_STATIC_CHARGE))
return true;
}
Player* member = ref->GetSource();
if (member && member->HasAura(SPELL_STATIC_CHARGE))
return true;
}
return false;
@@ -500,9 +475,10 @@ bool LadyVashjTaintedElementalCheatTrigger::IsActive()
return false;
bool taintedPresent = false;
Unit* taintedUnit = AI_VALUE2(Unit*, "find target", "tainted elemental");
if (taintedUnit)
if (AI_VALUE2(Unit*, "find target", "tainted elemental"))
{
taintedPresent = true;
}
else
{
GuidVector corpses = AI_VALUE(GuidVector, "nearest corpses");
@@ -513,13 +489,11 @@ bool LadyVashjTaintedElementalCheatTrigger::IsActive()
if (!object)
continue;
if (Creature* creature = object->ToCreature())
if (Creature* creature = object->ToCreature();
creature->GetEntry() == NPC_TAINTED_ELEMENTAL && !creature->IsAlive())
{
if (creature->GetEntry() == NPC_TAINTED_ELEMENTAL && !creature->IsAlive())
{
taintedPresent = true;
break;
}
taintedPresent = true;
break;
}
}
}
@@ -527,12 +501,8 @@ bool LadyVashjTaintedElementalCheatTrigger::IsActive()
if (!taintedPresent)
return false;
Group* group = bot->GetGroup();
if (!group)
return false;
return (GetDesignatedCoreLooter(group, botAI) == bot &&
!bot->HasItemCount(ITEM_TAINTED_CORE, 1, false));
return GetDesignatedCoreLooter(botAI, bot) == bot &&
!bot->HasItemCount(ITEM_TAINTED_CORE, 1, false);
}
bool LadyVashjTaintedCoreWasLootedTrigger::IsActive()
@@ -540,54 +510,24 @@ bool LadyVashjTaintedCoreWasLootedTrigger::IsActive()
if (!AI_VALUE2(Unit*, "find target", "lady vashj") || !IsLadyVashjInPhase2(botAI))
return false;
Group* group = bot->GetGroup();
if (!group)
auto coreHandlers = GetCoreHandlers(botAI, bot);
bool isCoreHandler = false;
for (Player* handler : coreHandlers)
if (handler == bot)
isCoreHandler = true;
if (!isCoreHandler)
return false;
Player* designatedLooter = GetDesignatedCoreLooter(group, botAI);
Player* firstCorePasser = GetFirstTaintedCorePasser(group, botAI);
Player* secondCorePasser = GetSecondTaintedCorePasser(group, botAI);
Player* thirdCorePasser = GetThirdTaintedCorePasser(group, botAI);
Player* fourthCorePasser = GetFourthTaintedCorePasser(group, botAI);
auto hasCore = [](Player* player) -> bool
{
return player && player->HasItemCount(ITEM_TAINTED_CORE, 1, false);
};
if (bot == designatedLooter)
{
if (!hasCore(bot))
return false;
}
else if (bot == firstCorePasser)
{
if (hasCore(secondCorePasser) || hasCore(thirdCorePasser) ||
hasCore(fourthCorePasser))
return false;
}
else if (bot == secondCorePasser)
{
if (hasCore(thirdCorePasser) || hasCore(fourthCorePasser))
return false;
}
else if (bot == thirdCorePasser)
{
if (hasCore(fourthCorePasser))
return false;
}
else if (bot != fourthCorePasser)
return false;
if (AnyRecentCoreInInventory(group, botAI))
return true;
// First and second passers move to positions as soon as the elemental appears
if (AI_VALUE2(Unit*, "find target", "tainted elemental") &&
(bot == firstCorePasser || bot == secondCorePasser))
Unit* tainted = AI_VALUE2(Unit*, "find target", "tainted elemental");
if (tainted && coreHandlers[0]->GetExactDist2d(tainted) < 5.0f &&
(bot == coreHandlers[1] || bot == coreHandlers[2]))
return true;
return false;
// Main logic: run if core is in play for this bot or a prior handler
return AnyRecentCoreInInventory(botAI, bot);
}
bool LadyVashjTaintedCoreIsUnusableTrigger::IsActive()
@@ -599,18 +539,7 @@ bool LadyVashjTaintedCoreIsUnusableTrigger::IsActive()
if (!IsLadyVashjInPhase2(botAI))
return bot->HasItemCount(ITEM_TAINTED_CORE, 1, false);
Group* group = bot->GetGroup();
if (!group)
return false;
Player* coreHandlers[] =
{
GetDesignatedCoreLooter(group, botAI),
GetFirstTaintedCorePasser(group, botAI),
GetSecondTaintedCorePasser(group, botAI),
GetThirdTaintedCorePasser(group, botAI),
GetFourthTaintedCorePasser(group, botAI)
};
auto coreHandlers = GetCoreHandlers(botAI, bot);
if (bot->HasItemCount(ITEM_TAINTED_CORE, 1, false))
{
@@ -625,24 +554,6 @@ bool LadyVashjTaintedCoreIsUnusableTrigger::IsActive()
return false;
}
bool LadyVashjNeedToResetCorePassingTrackersTrigger::IsActive()
{
Unit* vashj = AI_VALUE2(Unit*, "find target", "lady vashj");
if (!vashj || IsLadyVashjInPhase2(botAI))
return false;
Group* group = bot->GetGroup();
if (!group)
return false;
return IsMechanicTrackerBot(botAI, bot, SSC_MAP_ID, nullptr) ||
GetDesignatedCoreLooter(group, botAI) == bot ||
GetFirstTaintedCorePasser(group, botAI) == bot ||
GetSecondTaintedCorePasser(group, botAI) == bot ||
GetThirdTaintedCorePasser(group, botAI) == bot ||
GetFourthTaintedCorePasser(group, botAI) == bot;
}
bool LadyVashjToxicSporebatsAreSpewingPoisonCloudsTrigger::IsActive()
{
return IsLadyVashjInPhase3(botAI);
@@ -653,17 +564,18 @@ bool LadyVashjBotIsEntangledInToxicSporesOrStaticChargeTrigger::IsActive()
if (!AI_VALUE2(Unit*, "find target", "lady vashj"))
return false;
if (Group* group = bot->GetGroup())
{
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (!member || !member->HasAura(SPELL_ENTANGLE))
continue;
Group* group = bot->GetGroup();
if (!group)
return false;
if (botAI->IsMelee(member))
return true;
}
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (!member || !member->HasAura(SPELL_ENTANGLE))
continue;
if (botAI->IsMelee(member))
return true;
}
return false;

View File

@@ -1,3 +1,8 @@
/*
* 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_RAIDSSCTRIGGERS_H
#define _PLAYERBOT_RAIDSSCTRIGGERS_H
@@ -387,14 +392,6 @@ public:
bool IsActive() override;
};
class LadyVashjNeedToResetCorePassingTrackersTrigger : public Trigger
{
public:
LadyVashjNeedToResetCorePassingTrackersTrigger(
PlayerbotAI* botAI) : Trigger(botAI, "lady vashj need to reset core passing trackers") {}
bool IsActive() override;
};
class LadyVashjToxicSporebatsAreSpewingPoisonCloudsTrigger : public Trigger
{
public:

View File

@@ -1,3 +1,8 @@
/*
* 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 "RaidSSCHelpers.h"
#include "AiFactory.h"
#include "Creature.h"
@@ -79,61 +84,54 @@ namespace SerpentShrineCavernHelpers
std::unordered_map<uint32, time_t> leotherasDemonFormDpsWaitTimer;
std::unordered_map<uint32, time_t> leotherasFinalPhaseDpsWaitTimer;
Unit* GetLeotherasHuman(PlayerbotAI* botAI)
Unit* GetLeotherasHuman(Player* bot)
{
auto const& npcs =
botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest hostile npcs")->Get();
for (auto const& guid : npcs)
{
Unit* unit = botAI->GetUnit(guid);
if (unit && unit->GetEntry() == NPC_LEOTHERAS_THE_BLIND &&
unit->IsInCombat() && !unit->HasAura(SPELL_METAMORPHOSIS))
return unit;
}
constexpr float searchRadius = 100.0f;
Creature* leotheras =
bot->FindNearestCreature(NPC_LEOTHERAS_THE_BLIND, searchRadius, true);
if (leotheras && leotheras->IsInCombat() &&
!leotheras->HasAura(SPELL_METAMORPHOSIS))
return leotheras;
return nullptr;
}
Unit* GetPhase2LeotherasDemon(PlayerbotAI* botAI)
Unit* GetPhase2LeotherasDemon(Player* bot)
{
auto const& npcs =
botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest hostile npcs")->Get();
for (auto const& guid : npcs)
{
Unit* unit = botAI->GetUnit(guid);
if (unit && unit->GetEntry() == NPC_LEOTHERAS_THE_BLIND &&
unit->HasAura(SPELL_METAMORPHOSIS))
return unit;
}
constexpr float searchRadius = 100.0f;
Creature* leotheras =
bot->FindNearestCreature(NPC_LEOTHERAS_THE_BLIND, searchRadius, true);
if (leotheras && leotheras->HasAura(SPELL_METAMORPHOSIS))
return leotheras;
return nullptr;
}
Unit* GetPhase3LeotherasDemon(PlayerbotAI* botAI)
Unit* GetPhase3LeotherasDemon(Player* bot)
{
auto const& npcs =
botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest hostile npcs")->Get();
for (auto const& guid : npcs)
{
Unit* unit = botAI->GetUnit(guid);
if (unit && unit->GetEntry() == NPC_SHADOW_OF_LEOTHERAS)
return unit;
}
return nullptr;
constexpr float searchRadius = 100.0f;
return bot->FindNearestCreature(NPC_SHADOW_OF_LEOTHERAS, searchRadius, true);
}
Unit* GetActiveLeotherasDemon(PlayerbotAI* botAI)
Unit* GetActiveLeotherasDemon(Player* bot)
{
Unit* phase2 = GetPhase2LeotherasDemon(botAI);
Unit* phase3 = GetPhase3LeotherasDemon(botAI);
Unit* phase2 = GetPhase2LeotherasDemon(bot);
Unit* phase3 = GetPhase3LeotherasDemon(bot);
return phase2 ? phase2 : phase3;
}
// (1) First priority is an assistant Warlock (real player or bot)
// (2) If no assistant Warlock, then look for any Warlock bot
Player* GetLeotherasDemonFormTank(Player* bot)
{
Group* group = bot->GetGroup();
if (!group)
return nullptr;
// (1) First loop: Return the first assistant Warlock (real player or bot)
Player* fallbackWarlock = nullptr;
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
@@ -142,21 +140,12 @@ namespace SerpentShrineCavernHelpers
if (group->IsAssistant(member->GetGUID()))
return member;
if (!fallbackWarlock && GET_PLAYERBOT_AI(member))
fallbackWarlock = member;
}
// (2) Fall back to first found bot Warlock
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (!member || !member->IsAlive() || !GET_PLAYERBOT_AI(member) ||
member->getClass() != CLASS_WARLOCK)
continue;
return member;
}
// (3) Return nullptr if none found
return nullptr;
return fallbackWarlock;
}
// Fathom-Lord Karathress
@@ -182,16 +171,15 @@ namespace SerpentShrineCavernHelpers
// Lady Vashj <Coilfang Matron>
const Position VASHJ_PLATFORM_CENTER_POSITION = { 29.634f, -923.541f, 42.985f };
const Position VASHJ_PLATFORM_CENTER_POSITION = { 29.634f, -923.541f, 42.902f };
std::unordered_map<ObjectGuid, Position> vashjRangedPositions;
std::unordered_map<ObjectGuid, bool> hasReachedVashjRangedPosition;
std::unordered_map<uint32, ObjectGuid> nearestTriggerGuid;
std::unordered_map<ObjectGuid, Position> intendedLineup;
std::unordered_map<uint32, time_t> lastImbueAttempt;
std::unordered_map<uint32, time_t> lastCoreInInventoryTime;
std::unordered_map<ObjectGuid, time_t> lastCoreInInventoryTime;
bool IsMainTankInSameSubgroup(Player* bot)
bool IsMainTankInSameSubgroup(PlayerbotAI* botAI, Player* bot)
{
Group* group = bot->GetGroup();
if (!group || !group->isRaidGroup())
@@ -210,11 +198,8 @@ namespace SerpentShrineCavernHelpers
if (group->GetMemberGroup(member->GetGUID()) != botSubGroup)
continue;
if (PlayerbotAI* memberAI = GET_PLAYERBOT_AI(member))
{
if (memberAI->IsMainTank(member))
return true;
}
if (botAI->IsMainTank(member))
return true;
}
return false;
@@ -277,38 +262,9 @@ namespace SerpentShrineCavernHelpers
return false;
}
bool AnyRecentCoreInInventory(Group* group, PlayerbotAI* botAI, uint32 graceSeconds)
{
Unit* vashj =
botAI->GetAiObjectContext()->GetValue<Unit*>("find target", "lady vashj")->Get();
if (!vashj)
return false;
if (group)
{
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (member && member->HasItemCount(ITEM_TAINTED_CORE, 1, false))
return true;
}
}
const uint32 instanceId = vashj->GetMap()->GetInstanceId();
const time_t now = std::time(nullptr);
auto it = lastCoreInInventoryTime.find(instanceId);
if (it != lastCoreInInventoryTime.end())
{
if ((now - it->second) <= static_cast<time_t>(graceSeconds))
return true;
}
return false;
}
Player* GetDesignatedCoreLooter(Group* group, PlayerbotAI* botAI)
Player* GetDesignatedCoreLooter(PlayerbotAI* botAI, Player* bot)
{
Group* group = bot->GetGroup();
if (!group)
return nullptr;
@@ -317,10 +273,15 @@ namespace SerpentShrineCavernHelpers
if (!leaderGuid.IsEmpty())
leader = ObjectAccessor::FindPlayer(leaderGuid);
// If cheats are disabled, the group leader will be the designated looter
if (!botAI->HasCheat(BotCheatMask::raid))
return leader;
Player* fallback = leader;
// Priority: (1) assistant melee DPS, (2) other melee DPS, (3) any ranged DPS
Player* meleeDpsAssistant = nullptr;
Player* meleeDps = nullptr;
Player* rangedDps = nullptr;
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
@@ -331,22 +292,36 @@ namespace SerpentShrineCavernHelpers
if (!memberAI)
continue;
if (memberAI->IsMelee(member) && memberAI->IsDps(member))
return member;
if (!meleeDpsAssistant && memberAI->IsMelee(member) &&
memberAI->IsDps(member) && group->IsAssistant(member->GetGUID()))
{
meleeDpsAssistant = member;
break;
}
if (!fallback && memberAI->IsRangedDps(member))
fallback = member;
if (!meleeDps && memberAI->IsMelee(member) && memberAI->IsDps(member))
meleeDps = member;
if (!rangedDps && memberAI->IsRangedDps(member))
rangedDps = member;
}
return fallback ? fallback : leader;
if (meleeDpsAssistant)
return meleeDpsAssistant;
if (meleeDps)
return meleeDps;
if (rangedDps)
return rangedDps;
return leader;
}
Player* GetFirstTaintedCorePasser(Group* group, PlayerbotAI* botAI)
Player* GetFirstTaintedCorePasser(PlayerbotAI* botAI, Player* bot)
{
Group* group = bot->GetGroup();
if (!group)
return nullptr;
Player* designatedLooter = GetDesignatedCoreLooter(group, botAI);
Player* designatedLooter = GetDesignatedCoreLooter(botAI, bot);
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
@@ -355,32 +330,29 @@ namespace SerpentShrineCavernHelpers
continue;
PlayerbotAI* memberAI = GET_PLAYERBOT_AI(member);
if (!memberAI)
continue;
if (memberAI->IsAssistHealOfIndex(member, 0, true))
if (memberAI && memberAI->IsAssistHealOfIndex(member, 0, true))
return member;
}
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (!member || !member->IsAlive() || !GET_PLAYERBOT_AI(member) ||
botAI->IsTank(member) || member == designatedLooter)
continue;
return member;
if (member && member->IsAlive() && GET_PLAYERBOT_AI(member) &&
!botAI->IsTank(member) && member != designatedLooter)
return member;
}
return nullptr;
}
Player* GetSecondTaintedCorePasser(Group* group, PlayerbotAI* botAI)
Player* GetSecondTaintedCorePasser(PlayerbotAI* botAI, Player* bot)
{
Group* group = bot->GetGroup();
if (!group)
return nullptr;
Player* designatedLooter = GetDesignatedCoreLooter(group, botAI);
Player* firstCorePasser = GetFirstTaintedCorePasser(group, botAI);
Player* designatedLooter = GetDesignatedCoreLooter(botAI, bot);
Player* firstCorePasser = GetFirstTaintedCorePasser(botAI, bot);
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
@@ -390,34 +362,31 @@ namespace SerpentShrineCavernHelpers
continue;
PlayerbotAI* memberAI = GET_PLAYERBOT_AI(member);
if (!memberAI)
continue;
if (memberAI->IsAssistHealOfIndex(member, 1, true))
if (memberAI && memberAI->IsAssistHealOfIndex(member, 1, true))
return member;
}
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (!member || !member->IsAlive() || !GET_PLAYERBOT_AI(member) ||
botAI->IsTank(member) || member == designatedLooter ||
member == firstCorePasser)
continue;
return member;
if (member && member->IsAlive() && GET_PLAYERBOT_AI(member) &&
!botAI->IsTank(member) && member != designatedLooter &&
member != firstCorePasser)
return member;
}
return nullptr;
}
Player* GetThirdTaintedCorePasser(Group* group, PlayerbotAI* botAI)
Player* GetThirdTaintedCorePasser(PlayerbotAI* botAI, Player* bot)
{
Group* group = bot->GetGroup();
if (!group)
return nullptr;
Player* designatedLooter = GetDesignatedCoreLooter(group, botAI);
Player* firstCorePasser = GetFirstTaintedCorePasser(group, botAI);
Player* secondCorePasser = GetSecondTaintedCorePasser(group, botAI);
Player* designatedLooter = GetDesignatedCoreLooter(botAI, bot);
Player* firstCorePasser = GetFirstTaintedCorePasser(botAI, bot);
Player* secondCorePasser = GetSecondTaintedCorePasser(botAI, bot);
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
@@ -427,35 +396,32 @@ namespace SerpentShrineCavernHelpers
continue;
PlayerbotAI* memberAI = GET_PLAYERBOT_AI(member);
if (!memberAI)
continue;
if (memberAI->IsAssistHealOfIndex(member, 2, true))
if (memberAI && memberAI->IsAssistHealOfIndex(member, 2, true))
return member;
}
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (!member || !member->IsAlive() || !GET_PLAYERBOT_AI(member) ||
botAI->IsTank(member) || member == designatedLooter ||
member == firstCorePasser || member == secondCorePasser)
continue;
return member;
if (member && member->IsAlive() && GET_PLAYERBOT_AI(member) &&
!botAI->IsTank(member) && member != designatedLooter &&
member != firstCorePasser && member != secondCorePasser)
return member;
}
return nullptr;
}
Player* GetFourthTaintedCorePasser(Group* group, PlayerbotAI* botAI)
Player* GetFourthTaintedCorePasser(PlayerbotAI* botAI, Player* bot)
{
Group* group = bot->GetGroup();
if (!group)
return nullptr;
Player* designatedLooter = GetDesignatedCoreLooter(group, botAI);
Player* firstCorePasser = GetFirstTaintedCorePasser(group, botAI);
Player* secondCorePasser = GetSecondTaintedCorePasser(group, botAI);
Player* thirdCorePasser = GetThirdTaintedCorePasser(group, botAI);
Player* designatedLooter = GetDesignatedCoreLooter(botAI, bot);
Player* firstCorePasser = GetFirstTaintedCorePasser(botAI, bot);
Player* secondCorePasser = GetSecondTaintedCorePasser(botAI, bot);
Player* thirdCorePasser = GetThirdTaintedCorePasser(botAI, bot);
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
@@ -466,27 +432,75 @@ namespace SerpentShrineCavernHelpers
continue;
PlayerbotAI* memberAI = GET_PLAYERBOT_AI(member);
if (!memberAI)
continue;
if (memberAI->IsAssistRangedDpsOfIndex(member, 0, true))
if (memberAI && memberAI->IsAssistRangedDpsOfIndex(member, 0, true))
return member;
}
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (!member || !member->IsAlive() || !GET_PLAYERBOT_AI(member) ||
botAI->IsTank(member) || member == designatedLooter ||
member == firstCorePasser || member == secondCorePasser ||
member == thirdCorePasser)
continue;
return member;
if (member && member->IsAlive() && GET_PLAYERBOT_AI(member) &&
!botAI->IsTank(member) && member != designatedLooter &&
member != firstCorePasser && member != secondCorePasser &&
member != thirdCorePasser)
return member;
}
return nullptr;
}
std::array<Player*, 5> GetCoreHandlers(PlayerbotAI* botAI, Player* bot)
{
return
{
GetDesignatedCoreLooter(botAI, bot),
GetFirstTaintedCorePasser(botAI, bot),
GetSecondTaintedCorePasser(botAI, bot),
GetThirdTaintedCorePasser(botAI, bot),
GetFourthTaintedCorePasser(botAI, bot)
};
}
// Checks if any bot from earlier in the passing sequence has the Tainted Core or
// had it within the prior 3 seconds so the chain is not broken when the Core is in transit
bool AnyRecentCoreInInventory(PlayerbotAI* botAI, Player* bot)
{
Unit* vashj =
botAI->GetAiObjectContext()->GetValue<Unit*>("find target", "lady vashj")->Get();
if (!vashj)
return false;
auto coreHandlers = GetCoreHandlers(botAI, bot);
int8 myIndex = -1;
for (int8 i = 0; i < 5; ++i)
if (coreHandlers[i] && coreHandlers[i] == bot)
myIndex = i;
if (myIndex == -1)
return false;
const time_t now = std::time(nullptr);
constexpr uint8 lookbackSeconds = 3;
for (int8 i = 0; i <= myIndex; ++i)
{
Player* handler = coreHandlers[i];
if (!handler)
continue;
if (handler->HasItemCount(ITEM_TAINTED_CORE, 1, false))
return true;
auto it = lastCoreInInventoryTime.find(handler->GetGUID());
if (it != lastCoreInInventoryTime.end() &&
(now - it->second) <= static_cast<time_t>(lookbackSeconds))
return true;
}
return false;
}
const std::vector<uint32> SHIELD_GENERATOR_DB_GUIDS =
{
47482, // NW
@@ -510,10 +524,7 @@ namespace SerpentShrineCavernHelpers
continue;
GameObject* go = bounds.first->second;
if (!go)
continue;
if (go->GetGoState() != GO_STATE_READY)
if (!go || go->GetGoState() != GO_STATE_READY)
continue;
GeneratorInfo info;
@@ -529,7 +540,7 @@ namespace SerpentShrineCavernHelpers
// Returns the nearest active Shield Generator to the bot
// Active generators are powered by NPC_WORLD_INVISIBLE_TRIGGER creatures,
// which depawn after use
// which despawn after use
Unit* GetNearestActiveShieldGeneratorTriggerByEntry(Unit* reference)
{
if (!reference)

View File

@@ -1,3 +1,8 @@
/*
* 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_
@@ -64,9 +69,6 @@ namespace SerpentShrineCavernHelpers
// Warlock
SPELL_CURSE_OF_EXHAUSTION = 18223,
// Item
SPELL_HEAVY_NETHERWEAVE_NET = 31368,
};
enum SerpentShrineCavernNPCs
@@ -105,9 +107,6 @@ namespace SerpentShrineCavernHelpers
{
// Lady Vashj <Coilfang Matron>
ITEM_TAINTED_CORE = 31088,
// Tailoring
ITEM_HEAVY_NETHERWEAVE_NET = 24269,
};
constexpr uint32 SSC_MAP_ID = 548;
@@ -134,10 +133,10 @@ namespace SerpentShrineCavernHelpers
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(PlayerbotAI* botAI);
Unit* GetPhase2LeotherasDemon(PlayerbotAI* botAI);
Unit* GetPhase3LeotherasDemon(PlayerbotAI* botAI);
Unit* GetActiveLeotherasDemon(PlayerbotAI* botAI);
Unit* GetLeotherasHuman(Player* bot);
Unit* GetPhase2LeotherasDemon(Player* bot);
Unit* GetPhase3LeotherasDemon(Player* bot);
Unit* GetActiveLeotherasDemon(Player* bot);
Player* GetLeotherasDemonFormTank(Player* bot);
// Fathom-Lord Karathress
@@ -158,25 +157,26 @@ namespace SerpentShrineCavernHelpers
extern std::unordered_map<ObjectGuid, uint8> tidewalkerRangedStep;
// Lady Vashj <Coilfang Matron>
constexpr float VASHJ_PLATFORM_Z = 42.985f;
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, Position> vashjRangedPositions;
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<uint32, time_t> lastCoreInInventoryTime;
bool IsMainTankInSameSubgroup(Player* bot);
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);
bool AnyRecentCoreInInventory(Group* group, PlayerbotAI* botAI, uint32 graceSeconds = 3);
Player* GetDesignatedCoreLooter(Group* group, PlayerbotAI* botAI);
Player* GetFirstTaintedCorePasser(Group* group, PlayerbotAI* botAI);
Player* GetSecondTaintedCorePasser(Group* group, PlayerbotAI* botAI);
Player* GetThirdTaintedCorePasser(Group* group, PlayerbotAI* botAI);
Player* GetFourthTaintedCorePasser(Group* group, 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(