diff --git a/src/Ai/Class/Dk/Action/DKActions.cpp b/src/Ai/Class/Dk/Action/DKActions.cpp index 7788e4819..5cd475e81 100644 --- a/src/Ai/Class/Dk/Action/DKActions.cpp +++ b/src/Ai/Class/Dk/Action/DKActions.cpp @@ -48,3 +48,55 @@ bool CastRaiseDeadAction::Execute(Event event) return true; } + +Unit* CastHysteriaAction::GetTarget() +{ + Group* group = bot->GetGroup(); + if (!group) + { + if (!bot->HasAura(49016)) + return bot; + return nullptr; + } + + Unit* rangedDps = nullptr; + Unit* tank = nullptr; + + for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next()) + { + Player* member = ref->GetSource(); + if (!member || !member->IsAlive()) + continue; + + if (member->GetMap() != bot->GetMap() || bot->GetDistance(member) > sPlayerbotAIConfig.spellDistance) + continue; + + // Skip if already has hysteria + if (member->HasAura(49016)) + continue; + + // Priority 1: Melee DPS + if (botAI->IsMelee(member) && botAI->IsDps(member)) + return member; + + // Priority 2: Ranged DPS (physical, not casters) + if (!rangedDps && botAI->IsRanged(member) && botAI->IsDps(member) && !botAI->IsCaster(member)) + rangedDps = member; + + // Priority 3: Tank + if (!tank && botAI->IsTank(member)) + tank = member; + } + + if (rangedDps) + return rangedDps; + + if (tank) + return tank; + + // Fallback to self if no hysteria + if (!bot->HasAura(49016)) + return bot; + + return nullptr; +} diff --git a/src/Ai/Class/Dk/Action/DKActions.h b/src/Ai/Class/Dk/Action/DKActions.h index 74e066cd5..5e8bf968f 100644 --- a/src/Ai/Class/Dk/Action/DKActions.h +++ b/src/Ai/Class/Dk/Action/DKActions.h @@ -340,4 +340,11 @@ public: CastBloodTapAction(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, "blood tap") {} }; +class CastHysteriaAction : public CastSpellAction +{ +public: + CastHysteriaAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "hysteria") {} + Unit* GetTarget() override; +}; + #endif diff --git a/src/Ai/Class/Dk/DKAiObjectContext.cpp b/src/Ai/Class/Dk/DKAiObjectContext.cpp index ac80c7dc4..9a8271aa7 100644 --- a/src/Ai/Class/Dk/DKAiObjectContext.cpp +++ b/src/Ai/Class/Dk/DKAiObjectContext.cpp @@ -100,6 +100,7 @@ public: creators["dd cd and no desolation"] = &DeathKnightTriggerFactoryInternal::dd_cd_and_no_desolation; creators["death and decay cooldown"] = &DeathKnightTriggerFactoryInternal::death_and_decay_cooldown; creators["army of the dead"] = &DeathKnightTriggerFactoryInternal::army_of_the_dead; + creators["hysteria no cd"] = &DeathKnightTriggerFactoryInternal::hysteria_no_cd; } private: @@ -152,6 +153,7 @@ private: } static Trigger* death_and_decay_cooldown(PlayerbotAI* botAI) { return new DeathAndDecayCooldownTrigger(botAI); } static Trigger* army_of_the_dead(PlayerbotAI* botAI) { return new ArmyOfTheDeadTrigger(botAI); } + static Trigger* hysteria_no_cd(PlayerbotAI* botAI) { return new HysteriaNoCooldownTrigger(botAI); } }; class DeathKnightAiObjectContextInternal : public NamedObjectContext @@ -209,7 +211,7 @@ public: creators["vampiric blood"] = &DeathKnightAiObjectContextInternal::vampiric_blood; creators["death pact"] = &DeathKnightAiObjectContextInternal::death_pact; creators["death rune_mastery"] = &DeathKnightAiObjectContextInternal::death_rune_mastery; - // creators["hysteria"] = &DeathKnightAiObjectContextInternal::hysteria; + creators["hysteria"] = &DeathKnightAiObjectContextInternal::hysteria; creators["dancing rune weapon"] = &DeathKnightAiObjectContextInternal::dancing_rune_weapon; creators["dark command"] = &DeathKnightAiObjectContextInternal::dark_command; } @@ -265,7 +267,7 @@ private: static Action* vampiric_blood(PlayerbotAI* botAI) { return new CastVampiricBloodAction(botAI); } static Action* death_pact(PlayerbotAI* botAI) { return new CastDeathPactAction(botAI); } static Action* death_rune_mastery(PlayerbotAI* botAI) { return new CastDeathRuneMasteryAction(botAI); } - // static Action* hysteria(PlayerbotAI* botAI) { return new CastHysteriaAction(botAI); } + static Action* hysteria(PlayerbotAI* botAI) { return new CastHysteriaAction(botAI); } static Action* dancing_rune_weapon(PlayerbotAI* botAI) { return new CastDancingRuneWeaponAction(botAI); } static Action* dark_command(PlayerbotAI* botAI) { return new CastDarkCommandAction(botAI); } static Action* mind_freeze_on_enemy_healer(PlayerbotAI* botAI) diff --git a/src/Ai/Class/Dk/Strategy/BloodDKStrategy.cpp b/src/Ai/Class/Dk/Strategy/BloodDKStrategy.cpp index 344b3dc09..9ced88ac7 100644 --- a/src/Ai/Class/Dk/Strategy/BloodDKStrategy.cpp +++ b/src/Ai/Class/Dk/Strategy/BloodDKStrategy.cpp @@ -50,7 +50,9 @@ private: { NextAction("frost presence") }, - /*A*/ {}, + /*A*/ { + NextAction("blood strike") + }, /*C*/ {} ); } @@ -89,13 +91,11 @@ BloodDKStrategy::BloodDKStrategy(PlayerbotAI* botAI) : GenericDKStrategy(botAI) std::vector BloodDKStrategy::getDefaultActions() { return { - NextAction("rune strike", ACTION_DEFAULT + 0.8f), - NextAction("icy touch", ACTION_DEFAULT + 0.7f), - NextAction("heart strike", ACTION_DEFAULT + 0.6f), - NextAction("blood strike", ACTION_DEFAULT + 0.5f), - NextAction("dancing rune weapon", ACTION_DEFAULT + 0.4f), - NextAction("death coil", ACTION_DEFAULT + 0.3f), - NextAction("plague strike", ACTION_DEFAULT + 0.2f), + NextAction("rune strike", ACTION_DEFAULT + 0.6f), + NextAction("icy touch", ACTION_DEFAULT + 0.5f), + NextAction("heart strike", ACTION_DEFAULT + 0.4f), + NextAction("dancing rune weapon", ACTION_DEFAULT + 0.3f), + NextAction("death coil", ACTION_DEFAULT + 0.2f), NextAction("horn of winter", ACTION_DEFAULT + 0.1f), NextAction("melee", ACTION_DEFAULT) }; @@ -105,6 +105,14 @@ void BloodDKStrategy::InitTriggers(std::vector& triggers) { GenericDKStrategy::InitTriggers(triggers); + triggers.push_back( + new TriggerNode( + "hysteria no cd", + { + NextAction("hysteria", ACTION_NORMAL + 4) + } + ) + ); triggers.push_back( new TriggerNode( "rune strike", @@ -162,4 +170,12 @@ void BloodDKStrategy::InitTriggers(std::vector& triggers) } ) ); + triggers.push_back( + new TriggerNode( + "high unholy rune", + { + NextAction("death strike", ACTION_HIGH + 1) + } + ) + ); } diff --git a/src/Ai/Class/Dk/Strategy/FrostDKStrategy.cpp b/src/Ai/Class/Dk/Strategy/FrostDKStrategy.cpp index d0b0ee203..48a61a5ff 100644 --- a/src/Ai/Class/Dk/Strategy/FrostDKStrategy.cpp +++ b/src/Ai/Class/Dk/Strategy/FrostDKStrategy.cpp @@ -91,7 +91,6 @@ std::vector FrostDKStrategy::getDefaultActions() return { NextAction("obliterate", ACTION_DEFAULT + 0.7f), NextAction("frost strike", ACTION_DEFAULT + 0.4f), - NextAction("empower rune weapon", ACTION_DEFAULT + 0.3f), NextAction("horn of winter", ACTION_DEFAULT + 0.1f), NextAction("melee", ACTION_DEFAULT) }; diff --git a/src/Ai/Class/Dk/Strategy/GenericDKNonCombatStrategy.cpp b/src/Ai/Class/Dk/Strategy/GenericDKNonCombatStrategy.cpp index d358d4370..0d3a43b79 100644 --- a/src/Ai/Class/Dk/Strategy/GenericDKNonCombatStrategy.cpp +++ b/src/Ai/Class/Dk/Strategy/GenericDKNonCombatStrategy.cpp @@ -41,16 +41,10 @@ void GenericDKNonCombatStrategy::InitTriggers(std::vector& trigger { NonCombatStrategy::InitTriggers(triggers); - triggers.push_back( - new TriggerNode("no pet", { NextAction("raise dead", ACTION_NORMAL + 1) })); triggers.push_back( new TriggerNode("horn of winter", { NextAction("horn of winter", 21.0f) })); triggers.push_back( new TriggerNode("bone shield", { NextAction("bone shield", 21.0f) })); - triggers.push_back( - new TriggerNode("has pet", { NextAction("toggle pet spell", 60.0f) })); - triggers.push_back( - new TriggerNode("new pet", { NextAction("set pet stance", 60.0f) })); } void DKBuffDpsStrategy::InitTriggers(std::vector& triggers) diff --git a/src/Ai/Class/Dk/Strategy/GenericDKStrategy.cpp b/src/Ai/Class/Dk/Strategy/GenericDKStrategy.cpp index 61ff8c748..109341612 100644 --- a/src/Ai/Class/Dk/Strategy/GenericDKStrategy.cpp +++ b/src/Ai/Class/Dk/Strategy/GenericDKStrategy.cpp @@ -165,12 +165,6 @@ void GenericDKStrategy::InitTriggers(std::vector& triggers) { MeleeCombatStrategy::InitTriggers(triggers); - triggers.push_back( - new TriggerNode("no pet", { NextAction("raise dead", ACTION_NORMAL + 5) })); - triggers.push_back( - new TriggerNode("has pet", { NextAction("toggle pet spell", 60.0f) })); - triggers.push_back( - new TriggerNode("new pet", { NextAction("set pet stance", 60.0f) })); triggers.push_back( new TriggerNode("mind freeze", { NextAction("mind freeze", ACTION_HIGH + 1) })); triggers.push_back( @@ -179,7 +173,8 @@ void GenericDKStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode( "horn of winter", { NextAction("horn of winter", ACTION_NORMAL + 1) })); triggers.push_back(new TriggerNode("critical health", - { NextAction("death pact", ACTION_HIGH + 5) })); + { NextAction("raise dead", ACTION_HIGH + 6), + NextAction("death pact", ACTION_HIGH + 5) })); triggers.push_back( new TriggerNode("low health", { NextAction("icebound fortitude", ACTION_HIGH + 5), @@ -190,4 +185,11 @@ void GenericDKStrategy::InitTriggers(std::vector& triggers) NextAction("blood boil", ACTION_NORMAL + 3) })); triggers.push_back( new TriggerNode("pestilence glyph", { NextAction("pestilence", ACTION_HIGH + 9) })); + triggers.push_back( + new TriggerNode("no rune", + { + NextAction("empower rune weapon", ACTION_HIGH + 1) + } + ) + ); } diff --git a/src/Ai/Class/Dk/Strategy/UnholyDKStrategy.cpp b/src/Ai/Class/Dk/Strategy/UnholyDKStrategy.cpp index d94a94ec3..40a0ac041 100644 --- a/src/Ai/Class/Dk/Strategy/UnholyDKStrategy.cpp +++ b/src/Ai/Class/Dk/Strategy/UnholyDKStrategy.cpp @@ -87,6 +87,13 @@ void UnholyDKStrategy::InitTriggers(std::vector& triggers) { GenericDKStrategy::InitTriggers(triggers); + triggers.push_back( + new TriggerNode("no pet", { NextAction("raise dead", ACTION_NORMAL + 5) })); + triggers.push_back( + new TriggerNode("has pet", { NextAction("toggle pet spell", 60.0f) })); + triggers.push_back( + new TriggerNode("new pet", { NextAction("set pet stance", 60.0f) })); + triggers.push_back( new TriggerNode( "death and decay cooldown", @@ -146,13 +153,6 @@ void UnholyDKStrategy::InitTriggers(std::vector& triggers) } ) ); - triggers.push_back( - new TriggerNode("no rune", - { - NextAction("empower rune weapon", ACTION_HIGH + 1) - } - ) - ); triggers.push_back( new TriggerNode( "army of the dead", diff --git a/src/Ai/Class/Dk/Trigger/DKTriggers.h b/src/Ai/Class/Dk/Trigger/DKTriggers.h index c46fbfe37..98070d85f 100644 --- a/src/Ai/Class/Dk/Trigger/DKTriggers.h +++ b/src/Ai/Class/Dk/Trigger/DKTriggers.h @@ -198,4 +198,10 @@ public: ArmyOfTheDeadTrigger(PlayerbotAI* botAI) : BoostTrigger(botAI, "army of the dead") {} }; +class HysteriaNoCooldownTrigger : public SpellNoCooldownTrigger +{ +public: + HysteriaNoCooldownTrigger(PlayerbotAI* botAI) : SpellNoCooldownTrigger(botAI, "hysteria") {} +}; + #endif