diff --git a/src/strategy/raids/naxxramas/RaidNaxxActionContext.h b/src/strategy/raids/naxxramas/RaidNaxxActionContext.h index 816f797b..226b2bc6 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxActionContext.h +++ b/src/strategy/raids/naxxramas/RaidNaxxActionContext.h @@ -32,8 +32,8 @@ class RaidNaxxActionContext : public NamedObjectContext // creators["horseman attack in order"] = &RaidNaxxActionContext::horseman_attack_in_order; // creators["sapphiron ground main tank position"] = &RaidNaxxActionContext::sapphiron_ground_main_tank_position; - // creators["sapphiron ground position"] = &RaidNaxxActionContext::sapphiron_ground_position; - // creators["sapphiron flight position"] = &RaidNaxxActionContext::sapphiron_flight_position; + creators["sapphiron ground position"] = &RaidNaxxActionContext::sapphiron_ground_position; + creators["sapphiron flight position"] = &RaidNaxxActionContext::sapphiron_flight_position; // creators["sapphiron avoid chill"] = &RaidNaxxActionContext::sapphiron_avoid_chill; creators["kel'thuzad choose target"] = &RaidNaxxActionContext::kelthuzad_choose_target; @@ -65,8 +65,8 @@ class RaidNaxxActionContext : public NamedObjectContext // static Action* horseman_attract_alternatively(PlayerbotAI* ai) { return new HorsemanAttractAlternativelyAction(ai); } // static Action* horseman_attack_in_order(PlayerbotAI* ai) { return new HorsemanAttactInOrderAction(ai); } // static Action* sapphiron_ground_main_tank_position(PlayerbotAI* ai) { return new SapphironGroundMainTankPositionAction(ai); } - // static Action* sapphiron_ground_position(PlayerbotAI* ai) { return new SapphironGroundPositionAction(ai); } - // static Action* sapphiron_flight_position(PlayerbotAI* ai) { return new SapphironFlightPositionAction(ai); } + static Action* sapphiron_ground_position(PlayerbotAI* ai) { return new SapphironGroundPositionAction(ai); } + static Action* sapphiron_flight_position(PlayerbotAI* ai) { return new SapphironFlightPositionAction(ai); } // static Action* sapphiron_avoid_chill(PlayerbotAI* ai) { return new SapphironAvoidChillAction(ai); } static Action* kelthuzad_choose_target(PlayerbotAI* ai) { return new KelthuzadChooseTargetAction(ai); } static Action* kelthuzad_position(PlayerbotAI* ai) { return new KelthuzadPositionAction(ai); } diff --git a/src/strategy/raids/naxxramas/RaidNaxxActions.cpp b/src/strategy/raids/naxxramas/RaidNaxxActions.cpp index 33548acf..c82b15ed 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxActions.cpp +++ b/src/strategy/raids/naxxramas/RaidNaxxActions.cpp @@ -526,120 +526,83 @@ bool RazuviousTargetAction::Execute(Event event) // // return MoveTo(533, 3498.58f, -5245.35f, 137.29f); // } -// bool SapphironGroundPositionAction::Execute(Event event) -// { -// Unit* boss = AI_VALUE2(Unit*, "find target", "sapphiron"); -// if (!boss) { -// return false; -// } -// BossAI* boss_ai = dynamic_cast(boss->GetAI()); -// EventMap* eventMap = boss_botAI->GetEvents(); -// const uint32 flight = eventMap->GetNextEventTime(6); -// const uint32 timer = eventMap->GetTimer(); -// if (timer <= 2000 || (flight && flight != last_flight)) { -// reset = true; -// reset_timer = timer; -// } -// last_flight = flight; -// if (reset) { -// // bot->Yell("Let\'s go!", LANG_UNIVERSAL); -// std::pair center = {3517.31f, -5253.74f}; -// // std::pair center = {3498.58f, -5245.35f}; -// // std::pair center = {boss->GetPositionX(), boss->GetPositionY()}; -// uint32 index = botAI->GetGroupSlotIndex(bot); -// // float start_angle = 1.25 * M_PI; -// // float offset_angle = botAI->IsRanged(bot) ? -M_PI * 0.06 * index : -M_PI * 0.3; -// float start_angle = 0.85 * M_PI; -// float offset_angle = M_PI * 0.02 * index; -// float angle = start_angle + offset_angle; -// float distance = 30.0f; -// if (botAI->IsRangedDps(bot)) { -// distance = rand_norm() * 5 + 40.0f; -// } else if (botAI->IsHeal(bot)) { -// distance = rand_norm() * 5 + 25.0f; -// } else { -// distance = rand_norm() * 10; -// } -// if (MoveTo(533, center.first + cos(angle) * distance, center.second + sin(angle) * distance, 137.29f)) { -// return true; -// } -// if (timer - reset_timer >= 2000) { -// reset = false; -// } -// } -// return false; -// } +bool SapphironGroundPositionAction::Execute(Event event) +{ + if (!helper.UpdateBossAI()) { + return false; + } + if (botAI->IsMainTank(bot)) { + if (AI_VALUE2(bool, "has aggro", "current target")) { + return MoveTo(NAXX_MAP_ID, helper.mainTankPos.first, helper.mainTankPos.second, helper.GENERIC_HEIGHT); + } + return false; + } + if (helper.JustLanded()) { + uint32 index = botAI->GetGroupSlotIndex(bot); + float start_angle = 0.85 * M_PI; + float offset_angle = M_PI * 0.02 * index; + float angle = start_angle + offset_angle; + float distance; + if (botAI->IsRangedDps(bot)) { + distance = rand_norm() * 5 + 30.0f; + } else if (botAI->IsHeal(bot)) { + distance = rand_norm() * 5 + 20.0f; + } else { + distance = rand_norm() * 10; + } + if (MoveTo(NAXX_MAP_ID, helper.center.first + cos(angle) * distance, helper.center.second + sin(angle) * distance, helper.GENERIC_HEIGHT)) { + return true; + } + } else { + std::vector dest; + if (helper.FindPosToAvoidChill(dest)) { + return MoveTo(NAXX_MAP_ID, dest[0], dest[1], dest[2]); + } + } + return false; +} -// bool SapphironFlightPositionAction::Execute(Event event) -// { -// Unit* boss = AI_VALUE2(Unit*, "find target", "sapphiron"); -// if (!boss) { -// return false; -// } -// BossAI* boss_ai = dynamic_cast(boss->GetAI()); -// EventMap* eventMap = boss_botAI->GetEvents(); -// const uint32 explosion = eventMap->GetNextEventTime(10); -// const uint32 land = eventMap->GetNextEventTime(11); -// const uint32 timer = eventMap->GetTimer(); -// if (explosion && explosion != last_explosion) { -// move_ice_bolt = true; -// } -// last_explosion = explosion; -// if (land && land > timer) { -// move_ice_bolt = false; -// } -// // bool newexplosion = explosion && explosion != last_explosion; -// if (move_ice_bolt) { -// return MoveToNearestIcebolt(); -// } - -// // before explosion -// std::pair center = {boss->GetPositionX(), boss->GetPositionY()}; -// const uint32 icebolt = eventMap->GetNextEventTime(8); +bool SapphironFlightPositionAction::Execute(Event event) +{ + if (!helper.UpdateBossAI()) { + return false; + } + if (helper.WaitForExplosion()) { + return MoveToNearestIcebolt(); + } else { + std::vector dest; + if (helper.FindPosToAvoidChill(dest)) { + return MoveTo(NAXX_MAP_ID, dest[0], dest[1], dest[2]); + } + } + return false; +} -// // uint32 runBeforeIcebolt = botAI->IsRanged(bot) ? 1000 : 3000; -// // if ((icebolt <= timer && timer - icebolt <= 7000) || (icebolt >= timer && icebolt - timer <= runBeforeIcebolt)) { -// // std::pair center = {3517.31f, -5253.74f}; -// // uint32 index = botAI->GetGroupSlotIndex(bot); -// // float start_angle = 0.9 * M_PI; -// // float offset_angle = M_PI * 0.025 * index; -// // float angle = start_angle + offset_angle; -// // float distance = 45.0f; -// // if (MoveTo(533, center.first + cos(angle) * distance, center.second + sin(angle) * distance, 137.29f)) { -// // return true; -// // } -// // } -// return false; -// } - -// bool SapphironFlightPositionAction::MoveToNearestIcebolt() -// { -// Group* group = bot->GetGroup(); -// if (!group) { -// return 0; -// } -// Group::MemberSlotList const& slots = group->GetMemberSlots(); -// int counter = 0; -// Player* playerWithIcebolt = nullptr; -// float minDistance; -// for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next()) { -// Player* member = ref->GetSource(); -// if (botAI->HasAuraWithDuration("icebolt", member)) { -// if (!playerWithIcebolt || minDistance > bot->GetDistance(member)) { -// playerWithIcebolt = member; -// minDistance = bot->GetDistance(member); -// } -// } -// } -// if (playerWithIcebolt) { -// Unit* boss = AI_VALUE2(Unit*, "find target", "sapphiron"); -// float angle = boss->GetAngle(playerWithIcebolt); -// // bot->Yell("Find icebolt and let\'s move!", LANG_UNIVERSAL); -// return MoveTo(533, playerWithIcebolt->GetPositionX() + cos(angle) * 3.0f, playerWithIcebolt->GetPositionY() + sin(angle) * 3.0f, 137.29f); -// } -// // bot->Yell("No icebolt!", LANG_UNIVERSAL); -// return false; -// } +bool SapphironFlightPositionAction::MoveToNearestIcebolt() +{ + Group* group = bot->GetGroup(); + if (!group) { + return false; + } + Group::MemberSlotList const& slots = group->GetMemberSlots(); + Player* playerWithIcebolt = nullptr; + float minDistance; + for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next()) { + Player* member = ref->GetSource(); + if (botAI->HasAura("icebolt", member, false, false, -1, true)) { + if (!playerWithIcebolt || minDistance > bot->GetDistance(member)) { + playerWithIcebolt = member; + minDistance = bot->GetDistance(member); + } + } + } + if (playerWithIcebolt) { + Unit* boss = AI_VALUE2(Unit*, "find target", "sapphiron"); + float angle = boss->GetAngle(playerWithIcebolt); + return MoveTo(NAXX_MAP_ID, playerWithIcebolt->GetPositionX() + cos(angle) * 3.0f, playerWithIcebolt->GetPositionY() + sin(angle) * 3.0f, helper.GENERIC_HEIGHT); + } + return false; +} // bool SapphironAvoidChillAction::Execute(Event event) // { diff --git a/src/strategy/raids/naxxramas/RaidNaxxActions.h b/src/strategy/raids/naxxramas/RaidNaxxActions.h index 83c0fa6a..7c9d0a2e 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxActions.h +++ b/src/strategy/raids/naxxramas/RaidNaxxActions.h @@ -171,33 +171,24 @@ class RazuviousTargetAction : public AttackAction // virtual bool Execute(Event event); // }; -// class SapphironGroundPositionAction : public MovementAction -// { -// public: -// SapphironGroundPositionAction(PlayerbotAI* ai) : MovementAction(ai, "sapphiron ground position") { -// this->reset = 1; -// this->last_flight = 0; -// this->reset_timer = 0; -// } -// virtual bool Execute(Event event); -// protected: -// bool reset; -// uint32 last_flight, reset_timer; -// }; +class SapphironGroundPositionAction : public MovementAction +{ + public: + SapphironGroundPositionAction(PlayerbotAI* ai) : MovementAction(ai, "sapphiron ground position"), helper(ai) {} + bool Execute(Event event) override; + protected: + SapphironBossHelper helper; +}; -// class SapphironFlightPositionAction : public MovementAction -// { -// public: -// SapphironFlightPositionAction(PlayerbotAI* ai) : MovementAction(ai, "sapphiron flight position") { -// this->last_explosion = 0; -// this->move_ice_bolt = 0; -// } -// virtual bool Execute(Event event); -// protected: -// uint32 last_explosion; -// bool move_ice_bolt; -// bool MoveToNearestIcebolt(); -// }; +class SapphironFlightPositionAction : public MovementAction +{ + public: + SapphironFlightPositionAction(PlayerbotAI* ai) : MovementAction(ai, "sapphiron flight position"), helper(ai) {} + bool Execute(Event event) override; + protected: + SapphironBossHelper helper; + bool MoveToNearestIcebolt(); +}; // class SapphironAvoidChillAction : public MovementAction // { diff --git a/src/strategy/raids/naxxramas/RaidNaxxBossHelper.h b/src/strategy/raids/naxxramas/RaidNaxxBossHelper.h index ed6f72bb..64faa078 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxBossHelper.h +++ b/src/strategy/raids/naxxramas/RaidNaxxBossHelper.h @@ -4,6 +4,7 @@ #include "AiObject.h" #include "AiObjectContext.h" #include "EventMap.h" +#include "Log.h" #include "ObjectGuid.h" #include "Player.h" #include "PlayerbotAI.h" @@ -20,12 +21,16 @@ template class GenericBossHelper : public AiObject { public: GenericBossHelper(PlayerbotAI* botAI, std::string name): AiObject(botAI), name_(name) {} - bool UpdateBossAI() { - Unit* target = AI_VALUE2(Unit*, "find target", name_); - if (!target) { + virtual bool UpdateBossAI() { + Unit* unit = AI_VALUE2(Unit*, "find target", name_); + if (!unit) { return false; } - ai_ = dynamic_cast(target->GetAI()); + target_ = unit->ToCreature(); + if (!target_) { + return false; + } + ai_ = dynamic_cast(target_->GetAI()); if (!ai_) { return false; } @@ -33,20 +38,23 @@ class GenericBossHelper : public AiObject { if (!event_map_) { return false; } + timer_ = event_map_->GetTimer(); return true; } protected: + Creature* target_; std::string name_; BossAiType *ai_; EventMap* event_map_; + uint32 timer_; }; class KelthuzadBossHelper: public GenericBossHelper { public: KelthuzadBossHelper(PlayerbotAI *botAI): GenericBossHelper(botAI, "kel'thuzad") {} - std::pair center = {3716.19f, -5106.58f}; - std::pair tank_pos = {3709.19f, -5104.86f}; - std::pair assist_tank_pos = {3746.05f, -5112.74f}; + const std::pair center = {3716.19f, -5106.58f}; + const std::pair tank_pos = {3709.19f, -5104.86f}; + const std::pair assist_tank_pos = {3746.05f, -5112.74f}; bool IsPhaseOne() { return event_map_->GetNextEventTime(KELTHUZAD_EVENT_PHASE_2) != 0; } @@ -74,4 +82,81 @@ class RazuviousBossHelper: public GenericBossHelper { + public: + const std::pair mainTankPos = {3512.07f, -5274.06f}; + const std::pair center = {3517.31f, -5253.74f}; + const float GENERIC_HEIGHT = 137.29f; + SapphironBossHelper(PlayerbotAI *botAI): GenericBossHelper(botAI, "sapphiron") {} + bool UpdateBossAI() override { + if (!GenericBossHelper::UpdateBossAI()) { + return false; + } + uint32 nextEventGround = event_map_->GetNextEventTime(EVENT_GROUND); + if (nextEventGround && nextEventGround != lastEventGround) + lastEventGround = nextEventGround; + return true; + } + bool IsPhaseGround() { + return target_->GetReactState() == REACT_AGGRESSIVE; + } + bool IsPhaseFlight() { + return !IsPhaseGround(); + } + bool JustLanded() { + // if (event_map_->GetTimer() <= POSITION_TIME_AFTER_LANDED) { + // return true; + // } + // LOG_DEBUG("playerbots", "JustLanded lastEventGround: {}", lastEventGround); + // return timer_ >= lastEventGround && timer_ - lastEventGround <= POSITION_TIME_AFTER_LANDED; + return (event_map_->GetNextEventTime(EVENT_FLIGHT_START) - timer_) >= EVENT_FLIGHT_INTERVAL - POSITION_TIME_AFTER_LANDED; + } + bool WaitForExplosion() { + return event_map_->GetNextEventTime(EVENT_FLIGHT_SPELL_EXPLOSION); + } + bool FindPosToAvoidChill(std::vector &dest) { + Aura* aura = botAI->GetAura("chill", bot); + if (!aura) { + return false; + } + DynamicObject* dyn_obj = aura->GetDynobjOwner(); + if (!dyn_obj) { + return false; + } + Unit* currentTarget = AI_VALUE(Unit*, "current target"); + float angle = 0; + uint32 index = botAI->GetGroupSlotIndex(bot); + if (currentTarget) { + if (botAI->IsRanged(bot)) { + if (bot->GetExactDist2d(currentTarget) <= 45.0f) { + angle = bot->GetAngle(dyn_obj) - M_PI + (rand_norm() - 0.5) * M_PI / 2; + } else { + if (index % 2 == 0) { + angle = bot->GetAngle(currentTarget) + M_PI / 2; + } else { + angle = bot->GetAngle(currentTarget) - M_PI / 2; + } + } + } else { + if (index % 3 == 0) { + angle = bot->GetAngle(currentTarget); + } else if (index % 3 == 1) { + angle = bot->GetAngle(currentTarget) + M_PI / 2; + } else { + angle = bot->GetAngle(currentTarget) - M_PI / 2; + } + } + } else { + angle = bot->GetAngle(dyn_obj) - M_PI + (rand_norm() - 0.5) * M_PI / 2; + } + dest = {bot->GetPositionX() + cos(angle) * 5.0f, bot->GetPositionY() + sin(angle) * 5.0f, bot->GetPositionZ()}; + return true; + } + private: + const uint32 POSITION_TIME_AFTER_LANDED = 5000; + const uint32 EVENT_FLIGHT_INTERVAL = 45000; + uint32 lastEventGround = 0; + +}; + #endif \ No newline at end of file diff --git a/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp b/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp index 8137760e..f640bafe 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp +++ b/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp @@ -125,29 +125,17 @@ float HeiganDanceMultiplier::GetValue(Action* action) // return 1.0f; // } -// float SapphironGenericMultiplier::GetValue(Action* action) -// { -// Unit* boss = AI_VALUE2(Unit*, "find target", "sapphiron"); -// if (!boss) { -// return 1.0f; -// } -// if (dynamic_cast(action) || -// dynamic_cast(action)) { -// return 0.0f; -// } -// BossAI* boss_ai = dynamic_cast(boss->GetAI()); -// EventMap* eventMap = boss_botAI->GetEvents(); -// uint32 curr_phase = eventMap->GetPhaseMask(); -// uint32 timer = eventMap->GetTimer(); -// uint32 explosion = eventMap->GetNextEventTime(10); -// if (curr_phase == 4 && explosion > timer && -// (dynamic_cast(action) && -// !dynamic_cast(action) && -// !dynamic_cast(action))) { -// return 0.0f; -// } -// return 1.0f; -// } +float SapphironGenericMultiplier::GetValue(Action* action) +{ + if (!helper.UpdateBossAI()) { + return 1.0f; + } + if (dynamic_cast(action) || + dynamic_cast(action)) { + return 0.0f; + } + return 1.0f; +} float InstructorRazuviousGenericMultiplier::GetValue(Action* action) { diff --git a/src/strategy/raids/naxxramas/RaidNaxxMultipliers.h b/src/strategy/raids/naxxramas/RaidNaxxMultipliers.h index 88c9e2bd..49550132 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxMultipliers.h +++ b/src/strategy/raids/naxxramas/RaidNaxxMultipliers.h @@ -32,14 +32,15 @@ public: // virtual float GetValue(Action* action); // }; -// class SapphironGenericMultiplier : public Multiplier -// { -// public: -// SapphironGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "sapphiron generic") {} +class SapphironGenericMultiplier : public Multiplier +{ + public: + SapphironGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "sapphiron generic"), helper(ai) {} -// public: -// virtual float GetValue(Action* action); -// }; + virtual float GetValue(Action* action); + private: + SapphironBossHelper helper; +}; class InstructorRazuviousGenericMultiplier : public Multiplier { diff --git a/src/strategy/raids/naxxramas/RaidNaxxStrategy.cpp b/src/strategy/raids/naxxramas/RaidNaxxStrategy.cpp index 39c02ec2..71b10d08 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxStrategy.cpp +++ b/src/strategy/raids/naxxramas/RaidNaxxStrategy.cpp @@ -34,8 +34,8 @@ void RaidNaxxStrategy::InitTriggers(std::vector &triggers) triggers.push_back(new TriggerNode( "kel'thuzad", NextAction::array(0, + new NextAction("kel'thuzad position", ACTION_RAID + 2), new NextAction("kel'thuzad choose target", ACTION_RAID + 1), - new NextAction("kel'thuzad position", ACTION_RAID + 1), NULL))); // Anub'Rekhan @@ -85,18 +85,14 @@ void RaidNaxxStrategy::InitTriggers(std::vector &triggers) // "horseman except attractors", // NextAction::array(0, new NextAction("horseman attack in order", ACTION_RAID + 1), NULL))); - // // sapphiron - // triggers.push_back(new TriggerNode( - // "sapphiron ground main tank", - // NextAction::array(0, new NextAction("sapphiron ground main tank position", ACTION_RAID + 1), NULL))); - - // triggers.push_back(new TriggerNode( - // "sapphiron ground except main tank", - // NextAction::array(0, new NextAction("sapphiron ground position", ACTION_RAID + 1), NULL))); - - // triggers.push_back(new TriggerNode( - // "sapphiron flight", - // NextAction::array(0, new NextAction("sapphiron flight position", ACTION_RAID + 1), NULL))); + // sapphiron + triggers.push_back(new TriggerNode( + "sapphiron ground", + NextAction::array(0, new NextAction("sapphiron ground position", ACTION_RAID + 1), NULL))); + + triggers.push_back(new TriggerNode( + "sapphiron flight", + NextAction::array(0, new NextAction("sapphiron flight position", ACTION_RAID + 1), NULL))); // triggers.push_back(new TriggerNode( // "sapphiron chill", @@ -132,7 +128,7 @@ void RaidNaxxStrategy::InitMultipliers(std::vector &multipliers) multipliers.push_back(new HeiganDanceMultiplier(botAI)); // multipliers.push_back(new LoathebGenericMultiplier(ai)); // multipliers.push_back(new ThaddiusGenericMultiplier(ai)); - // multipliers.push_back(new SapphironGenericMultiplier(ai)); + multipliers.push_back(new SapphironGenericMultiplier(botAI)); multipliers.push_back(new InstructorRazuviousGenericMultiplier(botAI)); multipliers.push_back(new KelthuzadGenericMultiplier(botAI)); multipliers.push_back(new AnubrekhanGenericMultiplier(botAI)); diff --git a/src/strategy/raids/naxxramas/RaidNaxxTriggerContext.h b/src/strategy/raids/naxxramas/RaidNaxxTriggerContext.h index 524b8bc3..5a2cba72 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxTriggerContext.h +++ b/src/strategy/raids/naxxramas/RaidNaxxTriggerContext.h @@ -31,11 +31,9 @@ class RaidNaxxTriggerContext : public NamedObjectContext // creators["horseman attractors"] = &RaidNaxxTriggerContext::horseman_attractors; // creators["horseman except attractors"] = &RaidNaxxTriggerContext::horseman_except_attractors; - // creators["sapphiron ground main tank"] = &RaidNaxxTriggerContext::sapphiron_ground_main_tank; - // creators["sapphiron ground except main tank"] = &RaidNaxxTriggerContext::sapphiron_ground_except_main_tank; - // creators["sapphiron flight"] = &RaidNaxxTriggerContext::sapphiron_flight; - // creators["sapphiron chill"] = &RaidNaxxTriggerContext::sapphiron_ground_chill; - + creators["sapphiron ground"] = &RaidNaxxTriggerContext::sapphiron_ground; + creators["sapphiron flight"] = &RaidNaxxTriggerContext::sapphiron_flight; + creators["kel'thuzad"] = &RaidNaxxTriggerContext::kelthuzad; // creators["kel'thuzad phase two"] = &RaidNaxxTriggerContext::kelthuzad_phase_two; @@ -61,9 +59,9 @@ class RaidNaxxTriggerContext : public NamedObjectContext // static Trigger* horseman_attractors(PlayerbotAI* ai) { return new HorsemanAttractorsTrigger(ai); } // static Trigger* horseman_except_attractors(PlayerbotAI* ai) { return new HorsemanExceptAttractorsTrigger(ai); } - // static Trigger* sapphiron_ground_main_tank(PlayerbotAI* ai) { return new SapphironGroundMainTankTrigger(ai); } + static Trigger* sapphiron_ground(PlayerbotAI* ai) { return new SapphironGroundTrigger(ai); } + static Trigger* sapphiron_flight(PlayerbotAI* ai) { return new SapphironFlightTrigger(ai); } // static Trigger* sapphiron_ground_except_main_tank(PlayerbotAI* ai) { return new SapphironGroundExceptMainTankTrigger(ai); } - // static Trigger* sapphiron_flight(PlayerbotAI* ai) { return new SapphironFlightTrigger(ai); } // static Trigger* sapphiron_ground_chill(PlayerbotAI* ai) { return new SapphironGroundChillTrigger(ai); } static Trigger* kelthuzad(PlayerbotAI* ai) { return new KelthuzadTrigger(ai); } // static Trigger* kelthuzad_phase_two(PlayerbotAI* ai) { return new KelthuzadPhaseTwoTrigger(ai); } diff --git a/src/strategy/raids/naxxramas/RaidNaxxTriggers.cpp b/src/strategy/raids/naxxramas/RaidNaxxTriggers.cpp index 3a95bf4c..619d9a07 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxTriggers.cpp +++ b/src/strategy/raids/naxxramas/RaidNaxxTriggers.cpp @@ -2,6 +2,7 @@ #include "Playerbots.h" #include "RaidNaxxTriggers.h" #include "ScriptedCreature.h" +#include "Trigger.h" bool AuraRemovedTrigger::IsActive() { bool check = botAI->HasAura(name, bot, false, false, -1, true); @@ -126,10 +127,21 @@ bool RazuviousNontankTrigger::IsActive() // botAI->IsHealAssistantOfIndex(bot, 1) || botAI->IsHealAssistantOfIndex(bot, 2)); // } -// bool SapphironGroundMainTankTrigger::IsActive() -// { -// return BossPhaseTrigger::IsActive() && botAI->IsMainTank(bot) && AI_VALUE2(bool, "has aggro", "boss target"); -// } +bool SapphironGroundTrigger::IsActive() +{ + if (!helper.UpdateBossAI()) { + return false; + } + return helper.IsPhaseGround(); +} + +bool SapphironFlightTrigger::IsActive() +{ + if (!helper.UpdateBossAI()) { + return false; + } + return helper.IsPhaseFlight(); +} // bool SapphironGroundExceptMainTankTrigger::IsActive() // { diff --git a/src/strategy/raids/naxxramas/RaidNaxxTriggers.h b/src/strategy/raids/naxxramas/RaidNaxxTriggers.h index 3f538191..581a6ab5 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxTriggers.h +++ b/src/strategy/raids/naxxramas/RaidNaxxTriggers.h @@ -159,12 +159,14 @@ public: // virtual bool IsActive(); // }; -// class SapphironGroundMainTankTrigger : public BossPhaseTrigger -// { -// public: -// SapphironGroundMainTankTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "sapphiron", (1 << (2 - 1)), "sapphiron ground main tank") {} -// virtual bool IsActive(); -// }; +class SapphironGroundTrigger : public Trigger +{ + public: + SapphironGroundTrigger(PlayerbotAI* ai) : Trigger(ai, "sapphiron ground"), helper(ai) {} + bool IsActive() override; + private: + SapphironBossHelper helper; +}; // class SapphironGroundExceptMainTankTrigger : public BossPhaseTrigger // { @@ -173,12 +175,14 @@ public: // virtual bool IsActive(); // }; -// class SapphironFlightTrigger : public BossPhaseTrigger -// { -// public: -// SapphironFlightTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "sapphiron", (1 << (3 - 1)), "sapphiron flight") {} -// virtual bool IsActive(); -// }; +class SapphironFlightTrigger : public Trigger +{ + public: + SapphironFlightTrigger(PlayerbotAI* ai) : Trigger(ai, "sapphiron flight"), helper(ai) {} + bool IsActive() override; + private: + SapphironBossHelper helper; +}; // class SapphironGroundChillTrigger : public BossPhaseTrigger // {