naxx raid grobbulus

This commit is contained in:
Yunfan Li
2023-06-08 11:46:14 +08:00
parent 89d24b646c
commit 634ce3d183
7 changed files with 203 additions and 193 deletions

View File

@@ -223,8 +223,9 @@ class ActionContext : public NamedObjectContext<Action>
creators["toggle pet spell"] = &ActionContext::toggle_pet_spell; creators["toggle pet spell"] = &ActionContext::toggle_pet_spell;
// creators["rotate grobbulus"] = &ActionContext::rotate_grobbulus; creators["grobbulus go behind the boss"] = &ActionContext::go_behind_the_boss;
// creators["grobbulus move center"] = &ActionContext::grobbulus_move_center; creators["rotate grobbulus"] = &ActionContext::rotate_grobbulus;
creators["grobbulus move center"] = &ActionContext::grobbulus_move_center;
creators["heigan dance melee"] = &ActionContext::heigan_dance_melee; creators["heigan dance melee"] = &ActionContext::heigan_dance_melee;
creators["heigan dance ranged"] = &ActionContext::heigan_dance_ranged; creators["heigan dance ranged"] = &ActionContext::heigan_dance_ranged;
@@ -420,8 +421,9 @@ class ActionContext : public NamedObjectContext<Action>
static Action* toggle_pet_spell(PlayerbotAI* ai) { return new TogglePetSpellAutoCastAction(ai); } static Action* toggle_pet_spell(PlayerbotAI* ai) { return new TogglePetSpellAutoCastAction(ai); }
// static Action* rotate_grobbulus(PlayerbotAI* ai) { return new RotateGrobbulusAction(ai); } static Action* go_behind_the_boss(PlayerbotAI* ai) { return new GoBehindTheBossAction(ai); }
// static Action* grobbulus_move_center(PlayerbotAI* ai) { return new GrobblulusMoveCenterAction(ai); } static Action* rotate_grobbulus(PlayerbotAI* ai) { return new RotateGrobbulusAction(ai); }
static Action* grobbulus_move_center(PlayerbotAI* ai) { return new GrobblulusMoveCenterAction(ai); }
static Action* heigan_dance_melee(PlayerbotAI* ai) { return new HeiganDanceMeleeAction(ai); } static Action* heigan_dance_melee(PlayerbotAI* ai) { return new HeiganDanceMeleeAction(ai); }
static Action* heigan_dance_ranged(PlayerbotAI* ai) { return new HeiganDanceRangedAction(ai); } static Action* heigan_dance_ranged(PlayerbotAI* ai) { return new HeiganDanceRangedAction(ai); }
// static Action* thaddius_attack_nearest_pet(PlayerbotAI* ai) { return new ThaddiusAttackNearestPetAction(ai); } // static Action* thaddius_attack_nearest_pet(PlayerbotAI* ai) { return new ThaddiusAttackNearestPetAction(ai); }

View File

@@ -4,6 +4,7 @@
#include "RaidStrategy.h" #include "RaidStrategy.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "../../../../src/server/scripts/Northrend/Naxxramas/boss_heigan.h" #include "../../../../src/server/scripts/Northrend/Naxxramas/boss_heigan.h"
#include "../../../../src/server/scripts/Northrend/Naxxramas/boss_grobbulus.h"
using namespace std; using namespace std;
@@ -39,70 +40,70 @@ using namespace std;
// } // }
// bool GoBehindTheBossAction::Execute(Event event) bool GoBehindTheBossAction::Execute(Event event)
// { {
// Unit* boss = AI_VALUE(Unit*, "boss target"); Unit* boss = AI_VALUE(Unit*, "boss target");
// if (!boss) { if (!boss) {
// return false; return false;
// } }
// // Position* pos = boss->GetPosition(); // Position* pos = boss->GetPosition();
// float orientation = boss->GetOrientation() + M_PI + delta_angle; float orientation = boss->GetOrientation() + M_PI + delta_angle;
// float x = boss->GetPositionX(); float x = boss->GetPositionX();
// float y = boss->GetPositionY(); float y = boss->GetPositionY();
// float z = boss->GetPositionZ(); float z = boss->GetPositionZ();
// float rx = x + cos(orientation) * distance; float rx = x + cos(orientation) * distance;
// float ry = y + sin(orientation) * distance; float ry = y + sin(orientation) * distance;
// return MoveTo(bot->GetMapId(), rx, ry, z); return MoveTo(bot->GetMapId(), rx, ry, z);
// } }
// bool MoveToPointForceAction::Execute(Event event) // bool MoveToPointForceAction::Execute(Event event)
// { // {
// return MoveTo(bot->GetMapId(), x, y, bot->GetPositionZ(), true); // return MoveTo(bot->GetMapId(), x, y, bot->GetPositionZ(), true);
// } // }
// bool MoveInsideAction::Execute(Event event) bool MoveInsideAction::Execute(Event event)
// { {
// return MoveInside(bot->GetMapId(), x, y, bot->GetPositionZ(), distance); return MoveInside(bot->GetMapId(), x, y, bot->GetPositionZ(), distance);
// } }
// bool RotateAroundTheCenterPointAction::Execute(Event event) bool RotateAroundTheCenterPointAction::Execute(Event event)
// { {
// // uint32 nearest = FindNearestWaypoint(); // uint32 nearest = FindNearestWaypoint();
// // uint32 next_point = (nearest + 1) % intervals; // uint32 next_point = (nearest + 1) % intervals;
// uint32 next_point = GetCurrWaypoint(); uint32 next_point = GetCurrWaypoint();
// if (MoveTo(bot->GetMapId(), waypoints[next_point].first, waypoints[next_point].second, bot->GetPositionZ())) { if (MoveTo(bot->GetMapId(), waypoints[next_point].first, waypoints[next_point].second, bot->GetPositionZ())) {
// call_counters += 1; call_counters += 1;
// return true; return true;
// } }
// return false; return false;
// } }
// uint32 RotateAroundTheCenterPointAction::FindNearestWaypoint() uint32 RotateAroundTheCenterPointAction::FindNearestWaypoint()
// { {
// float minDistance = 0; float minDistance = 0;
// int ret = -1; int ret = -1;
// for (int i = 0; i < intervals; i++) { for (int i = 0; i < intervals; i++) {
// float w_x = waypoints[i].first, w_y = waypoints[i].second; float w_x = waypoints[i].first, w_y = waypoints[i].second;
// float dis = bot->GetDistance2d(w_x, w_y); float dis = bot->GetDistance2d(w_x, w_y);
// if (ret == -1 || dis < minDistance) { if (ret == -1 || dis < minDistance) {
// ret = i; ret = i;
// minDistance = dis; minDistance = dis;
// } }
// } }
// return ret; return ret;
// } }
// uint32 RotateGrobbulusAction::GetCurrWaypoint() uint32 RotateGrobbulusAction::GetCurrWaypoint()
// { {
// Unit* boss = AI_VALUE(Unit*, "boss target"); Unit* boss = AI_VALUE(Unit*, "boss target");
// if (!boss) { if (!boss) {
// return false; return false;
// } }
// BossAI* boss_ai = dynamic_cast<BossAI*>(boss->GetAI()); BossAI* boss_ai = dynamic_cast<BossAI*>(boss->GetAI());
// EventMap* eventMap = boss_botAI->GetEvents(); EventMap* eventMap = boss_ai->GetEvents();
// const uint32 event_time = eventMap->GetNextEventTime(2); const uint32 event_time = eventMap->GetNextEventTime(2);
// return (event_time / 15000) % intervals; return (event_time / 15000) % intervals;
// } }
bool HeiganDanceAction::CalculateSafe() { bool HeiganDanceAction::CalculateSafe() {
Unit* boss = AI_VALUE2(Unit*, "find target", "heigan the unclean"); Unit* boss = AI_VALUE2(Unit*, "find target", "heigan the unclean");

View File

@@ -16,17 +16,17 @@
// virtual bool Execute(Event event); // virtual bool Execute(Event event);
// }; // };
// class GoBehindTheBossAction : public MovementAction class GoBehindTheBossAction : public MovementAction
// { {
// public: public:
// GoBehindTheBossAction(PlayerbotAI* ai, float distance = 24.0f, float delta_angle = M_PI / 8) : MovementAction(ai, "grobbulus go behind the boss") { GoBehindTheBossAction(PlayerbotAI* ai, float distance = 24.0f, float delta_angle = M_PI / 8) : MovementAction(ai, "grobbulus go behind the boss") {
// this->distance = distance; this->distance = distance;
// this->delta_angle = delta_angle; this->delta_angle = delta_angle;
// } }
// virtual bool Execute(Event event); virtual bool Execute(Event event);
// protected: protected:
// float distance, delta_angle; float distance, delta_angle;
// }; };
// class MoveToPointForceAction : public MovementAction // class MoveToPointForceAction : public MovementAction
// { // {
@@ -40,62 +40,62 @@
// float x, y; // float x, y;
// }; // };
// class MoveInsideAction : public MovementAction class MoveInsideAction : public MovementAction
// { {
// public: public:
// MoveInsideAction(PlayerbotAI* ai, float x, float y, float distance = 5.0f) : MovementAction(ai, "move inside") { MoveInsideAction(PlayerbotAI* ai, float x, float y, float distance = 5.0f) : MovementAction(ai, "move inside") {
// this->x = x; this->x = x;
// this->y = y; this->y = y;
// this->distance = distance; this->distance = distance;
// } }
// virtual bool Execute(Event event); virtual bool Execute(Event event);
// protected: protected:
// float x, y, distance; float x, y, distance;
// }; };
// class RotateAroundTheCenterPointAction : public MovementAction class RotateAroundTheCenterPointAction : public MovementAction
// { {
// public: public:
// RotateAroundTheCenterPointAction(PlayerbotAI* ai, string name, RotateAroundTheCenterPointAction(PlayerbotAI* ai, std::string name,
// float center_x, float center_y, float radius = 40.0f, float center_x, float center_y, float radius = 40.0f,
// uint32 intervals = 16, bool clockwise = true, float start_angle = 0) : MovementAction(ai, name) { uint32 intervals = 16, bool clockwise = true, float start_angle = 0) : MovementAction(ai, name) {
// this->center_x = center_x; this->center_x = center_x;
// this->center_y = center_y; this->center_y = center_y;
// this->radius = radius; this->radius = radius;
// this->intervals = intervals; this->intervals = intervals;
// this->clockwise = clockwise; this->clockwise = clockwise;
// this->call_counters = 0; this->call_counters = 0;
// for (int i = 0; i < intervals; i++) { for (int i = 0; i < intervals; i++) {
// float angle = start_angle + 2 * M_PI * i / intervals; float angle = start_angle + 2 * M_PI * i / intervals;
// waypoints.push_back(std::make_pair(center_x + cos(angle) * radius, center_y + sin(angle) * radius)); waypoints.push_back(std::make_pair(center_x + cos(angle) * radius, center_y + sin(angle) * radius));
// } }
// } }
// virtual bool Execute(Event event); virtual bool Execute(Event event);
// protected: protected:
// virtual uint32 GetCurrWaypoint() { return 0; } virtual uint32 GetCurrWaypoint() { return 0; }
// uint32 FindNearestWaypoint(); uint32 FindNearestWaypoint();
// float center_x, center_y, radius; float center_x, center_y, radius;
// uint32 intervals, call_counters; uint32 intervals, call_counters;
// bool clockwise; bool clockwise;
// std::vector<std::pair<float, float>> waypoints; std::vector<std::pair<float, float>> waypoints;
// }; };
// class RotateGrobbulusAction : public RotateAroundTheCenterPointAction class RotateGrobbulusAction : public RotateAroundTheCenterPointAction
// { {
// public: public:
// RotateGrobbulusAction(PlayerbotAI* ai): RotateAroundTheCenterPointAction(ai, "rotate grobbulus", 3281.23f, -3310.38f, 35.0f, 8, true, M_PI) {} RotateGrobbulusAction(PlayerbotAI* botAI): RotateAroundTheCenterPointAction(botAI, "rotate grobbulus", 3281.23f, -3310.38f, 35.0f, 8, true, M_PI) {}
// virtual bool isUseful() { virtual bool isUseful() {
// return RotateAroundTheCenterPointAction::isUseful() && ai->IsMainTank(bot) && AI_VALUE2(bool, "has aggro", "boss target"); return RotateAroundTheCenterPointAction::isUseful() && botAI->IsMainTank(bot) && AI_VALUE2(bool, "has aggro", "boss target");
// } }
// virtual uint32 GetCurrWaypoint(); virtual uint32 GetCurrWaypoint();
// protected: protected:
// }; };
// class GrobblulusMoveCenterAction : public MoveInsideAction class GrobblulusMoveCenterAction : public MoveInsideAction
// { {
// public: public:
// GrobblulusMoveCenterAction(PlayerbotAI* ai) : MoveInsideAction(ai, 3281.23f, -3310.38f, 5.0f) {} GrobblulusMoveCenterAction(PlayerbotAI* ai) : MoveInsideAction(ai, 3281.23f, -3310.38f, 5.0f) {}
// }; };
class HeiganDanceAction : public MovementAction class HeiganDanceAction : public MovementAction
{ {

View File

@@ -297,17 +297,17 @@ void RaidNaxxGenericStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
// NextAction::array(0, new NextAction("try to get boss ai", ACTION_RAID), NULL))); // NextAction::array(0, new NextAction("try to get boss ai", ACTION_RAID), NULL)));
// Grobbulus // Grobbulus
// triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
// "mutating injection", "mutating injection",
// NextAction::array(0, new NextAction("grobbulus go behind the boss", ACTION_RAID + 2), NULL))); NextAction::array(0, new NextAction("grobbulus go behind the boss", ACTION_RAID + 2), NULL)));
// triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
// "mutating injection removed", "mutating injection removed",
// NextAction::array(0, new NextAction("grobbulus move center", ACTION_RAID + 1), NULL))); NextAction::array(0, new NextAction("grobbulus move center", ACTION_RAID + 1), NULL)));
// triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
// "grobbulus cloud", "grobbulus cloud",
// NextAction::array(0, new NextAction("rotate grobbulus", ACTION_RAID + 1), NULL))); NextAction::array(0, new NextAction("rotate grobbulus", ACTION_RAID + 1), NULL)));
// Heigan the Unclean // Heigan the Unclean
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(

View File

@@ -2,30 +2,41 @@
#include "RaidNaxxTrigger.h" #include "RaidNaxxTrigger.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
// bool MutatingInjectionRemovedTrigger::IsActive() bool AuraRemovedTrigger::IsActive() {
// { bool check = botAI->HasAura(name, bot, false, false, -1, true);
// Unit* boss = AI_VALUE2(Unit*, "find target", "grobbulus"); bool ret = false;
// if (!boss) { if (prev_check && !check) {
// return false; ret = true;
// } }
// return HasNotAuraTrigger::IsActive() && botAI->GetCurrentState() == BOT_STATE_COMBAT && botAI->IsRanged(bot); prev_check = check;
// } return ret;
}
// bool BossEventTrigger::IsActive() bool MutatingInjectionRemovedTrigger::IsActive()
// { {
// Unit* boss = AI_VALUE(Unit*, "boss target"); Unit* boss = AI_VALUE2(Unit*, "find target", "grobbulus");
// if (!boss || boss->GetEntry() != boss_entry) { if (!boss) {
// return false; return false;
// } }
// BossAI* boss_ai = dynamic_cast<BossAI*>(boss->GetAI()); return HasNoAuraTrigger::IsActive() && botAI->GetState() == BOT_STATE_COMBAT && botAI->IsRanged(bot);
// EventMap* eventMap = boss_botAI->GetEvents(); }
// const uint32 event_time = eventMap->GetNextEventTime(event_id);
// if (event_time != last_event_time) { bool BossEventTrigger::IsActive()
// last_event_time = event_time; {
// return true; Unit* boss = AI_VALUE(Unit*, "boss target");
// } if (!boss || boss->GetEntry() != boss_entry) {
// return false; return false;
// } }
if (!eventMap) {
return false;
}
const uint32 event_time = eventMap->GetNextEventTime(event_id);
if (event_time != last_event_time) {
last_event_time = event_time;
return true;
}
return false;
}
// bool BossPhaseTrigger::IsActive() // bool BossPhaseTrigger::IsActive()
// { // {

View File

@@ -2,44 +2,37 @@
#ifndef _PLAYERBOT_RAIDNAXXTRIGGER_H #ifndef _PLAYERBOT_RAIDNAXXTRIGGER_H
#define _PLAYERBOT_RAIDNAXXTRIGGER_H #define _PLAYERBOT_RAIDNAXXTRIGGER_H
#include "EventMap.h"
#include "Trigger.h" #include "Trigger.h"
#include "PlayerbotAIConfig.h" #include "PlayerbotAIConfig.h"
#include "GenericTriggers.h" #include "GenericTriggers.h"
#include "../../../../src/server/scripts/Northrend/Naxxramas/boss_grobbulus.h"
using namespace std; using namespace std;
// class MutatingInjectionTrigger : public HasAuraTrigger class MutatingInjectionTrigger : public HasAuraTrigger
// { {
// public: public:
// MutatingInjectionTrigger(PlayerbotAI* ai): HasAuraTrigger(ai, "mutating injection", 1) {} MutatingInjectionTrigger(PlayerbotAI* ai): HasAuraTrigger(ai, "mutating injection", 1) {}
// }; };
// class AuraRemovedTrigger : public Trigger class AuraRemovedTrigger : public Trigger
// { {
// public: public:
// AuraRemovedTrigger(PlayerbotAI* ai, string name): Trigger(ai, name, 1) { AuraRemovedTrigger(PlayerbotAI* botAI, string name): Trigger(botAI, name, 1) {
// this->prev_check = false; this->prev_check = false;
// } }
// virtual bool IsActive() { virtual bool IsActive() override;
// bool check = ai->HasAuraWithDuration(name, bot); protected:
// bool ret = false; bool prev_check;
// // bot->Yell(to_string(prev_check) + to_string(check), LANG_UNIVERSAL); };
// if (prev_check && !check) {
// ret = true;
// }
// prev_check = check;
// return ret;
// }
// protected:
// bool prev_check;
// };
// class MutatingInjectionRemovedTrigger : public HasNotAuraTrigger class MutatingInjectionRemovedTrigger : public HasNoAuraTrigger
// { {
// public: public:
// MutatingInjectionRemovedTrigger(PlayerbotAI* ai): HasNotAuraTrigger(ai, "mutating injection", 1) {} MutatingInjectionRemovedTrigger(PlayerbotAI* ai): HasNoAuraTrigger(ai, "mutating injection") {}
// virtual bool IsActive(); virtual bool IsActive();
// }; };
class BossEventTrigger : public Trigger class BossEventTrigger : public Trigger
{ {
@@ -52,6 +45,7 @@ public:
virtual bool IsActive(); virtual bool IsActive();
protected: protected:
uint32 boss_entry, event_id, last_event_time; uint32 boss_entry, event_id, last_event_time;
EventMap *eventMap;
}; };
class BossPhaseTrigger : public Trigger class BossPhaseTrigger : public Trigger
@@ -67,12 +61,14 @@ protected:
uint32 phase_mask; uint32 phase_mask;
}; };
// class GrobbulusCloudTrigger : public BossEventTrigger class GrobbulusCloudTrigger : public BossEventTrigger
// { {
// public: public:
// GrobbulusCloudTrigger(PlayerbotAI* ai): BossEventTrigger(ai, 15931, 2, "grobbulus cloud event") {} GrobbulusCloudTrigger(PlayerbotAI* ai): BossEventTrigger(ai, 15931, 2, "grobbulus cloud event") {
// virtual bool IsActive(); this->eventMap = boss_grobbulus::boss_grobbulusAI
// }; }
virtual bool IsActive();
};
class HeiganMeleeTrigger : public Trigger class HeiganMeleeTrigger : public Trigger
{ {

View File

@@ -194,7 +194,7 @@ class TriggerContext : public NamedObjectContext<Trigger>
creators["rpg trade useful"] = &TriggerContext::rpg_trade_useful; creators["rpg trade useful"] = &TriggerContext::rpg_trade_useful;
creators["rpg duel"] = &TriggerContext::rpg_duel; creators["rpg duel"] = &TriggerContext::rpg_duel;
// creators["mutating injection"] = &TriggerContext::mutating_injection; creators["mutating injection"] = &TriggerContext::mutating_injection;
// creators["mutating injection removed"] = &TriggerContext::mutating_injection_removed; // creators["mutating injection removed"] = &TriggerContext::mutating_injection_removed;
// creators["grobbulus cloud"] = &TriggerContext::grobbulus_cloud; // creators["grobbulus cloud"] = &TriggerContext::grobbulus_cloud;
creators["heigan melee"] = &TriggerContext::heigan_melee; creators["heigan melee"] = &TriggerContext::heigan_melee;
@@ -366,7 +366,7 @@ class TriggerContext : public NamedObjectContext<Trigger>
static Trigger* rpg_trade_useful(PlayerbotAI* botAI) { return new RpgTradeUsefulTrigger(botAI); } static Trigger* rpg_trade_useful(PlayerbotAI* botAI) { return new RpgTradeUsefulTrigger(botAI); }
static Trigger* rpg_duel(PlayerbotAI* botAI) { return new RpgDuelTrigger(botAI); } static Trigger* rpg_duel(PlayerbotAI* botAI) { return new RpgDuelTrigger(botAI); }
// static Trigger* mutating_injection(PlayerbotAI* ai) { return new MutatingInjectionTrigger(ai); } static Trigger* mutating_injection(PlayerbotAI* ai) { return new MutatingInjectionTrigger(ai); }
// static Trigger* mutating_injection_removed(PlayerbotAI* ai) { return new MutatingInjectionRemovedTrigger(ai); } // static Trigger* mutating_injection_removed(PlayerbotAI* ai) { return new MutatingInjectionRemovedTrigger(ai); }
// static Trigger* grobbulus_cloud(PlayerbotAI* ai) { return new GrobbulusCloudTrigger(ai); } // static Trigger* grobbulus_cloud(PlayerbotAI* ai) { return new GrobbulusCloudTrigger(ai); }
static Trigger* heigan_melee(PlayerbotAI* ai) { return new HeiganMeleeTrigger(ai); } static Trigger* heigan_melee(PlayerbotAI* ai) { return new HeiganMeleeTrigger(ai); }