mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-17 00:54:35 +00:00
naxx raid grobbulus
This commit is contained in:
@@ -223,8 +223,9 @@ class ActionContext : public NamedObjectContext<Action>
|
||||
|
||||
creators["toggle pet spell"] = &ActionContext::toggle_pet_spell;
|
||||
|
||||
// creators["rotate grobbulus"] = &ActionContext::rotate_grobbulus;
|
||||
// creators["grobbulus move center"] = &ActionContext::grobbulus_move_center;
|
||||
creators["grobbulus go behind the boss"] = &ActionContext::go_behind_the_boss;
|
||||
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 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* rotate_grobbulus(PlayerbotAI* ai) { return new RotateGrobbulusAction(ai); }
|
||||
// static Action* grobbulus_move_center(PlayerbotAI* ai) { return new GrobblulusMoveCenterAction(ai); }
|
||||
static Action* go_behind_the_boss(PlayerbotAI* ai) { return new GoBehindTheBossAction(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_ranged(PlayerbotAI* ai) { return new HeiganDanceRangedAction(ai); }
|
||||
// static Action* thaddius_attack_nearest_pet(PlayerbotAI* ai) { return new ThaddiusAttackNearestPetAction(ai); }
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "RaidStrategy.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "../../../../src/server/scripts/Northrend/Naxxramas/boss_heigan.h"
|
||||
#include "../../../../src/server/scripts/Northrend/Naxxramas/boss_grobbulus.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -39,70 +40,70 @@ using namespace std;
|
||||
|
||||
// }
|
||||
|
||||
// bool GoBehindTheBossAction::Execute(Event event)
|
||||
// {
|
||||
// Unit* boss = AI_VALUE(Unit*, "boss target");
|
||||
// if (!boss) {
|
||||
// return false;
|
||||
// }
|
||||
// // Position* pos = boss->GetPosition();
|
||||
// float orientation = boss->GetOrientation() + M_PI + delta_angle;
|
||||
// float x = boss->GetPositionX();
|
||||
// float y = boss->GetPositionY();
|
||||
// float z = boss->GetPositionZ();
|
||||
// float rx = x + cos(orientation) * distance;
|
||||
// float ry = y + sin(orientation) * distance;
|
||||
// return MoveTo(bot->GetMapId(), rx, ry, z);
|
||||
// }
|
||||
bool GoBehindTheBossAction::Execute(Event event)
|
||||
{
|
||||
Unit* boss = AI_VALUE(Unit*, "boss target");
|
||||
if (!boss) {
|
||||
return false;
|
||||
}
|
||||
// Position* pos = boss->GetPosition();
|
||||
float orientation = boss->GetOrientation() + M_PI + delta_angle;
|
||||
float x = boss->GetPositionX();
|
||||
float y = boss->GetPositionY();
|
||||
float z = boss->GetPositionZ();
|
||||
float rx = x + cos(orientation) * distance;
|
||||
float ry = y + sin(orientation) * distance;
|
||||
return MoveTo(bot->GetMapId(), rx, ry, z);
|
||||
}
|
||||
|
||||
// bool MoveToPointForceAction::Execute(Event event)
|
||||
// {
|
||||
// return MoveTo(bot->GetMapId(), x, y, bot->GetPositionZ(), true);
|
||||
// }
|
||||
|
||||
// bool MoveInsideAction::Execute(Event event)
|
||||
// {
|
||||
// return MoveInside(bot->GetMapId(), x, y, bot->GetPositionZ(), distance);
|
||||
// }
|
||||
bool MoveInsideAction::Execute(Event event)
|
||||
{
|
||||
return MoveInside(bot->GetMapId(), x, y, bot->GetPositionZ(), distance);
|
||||
}
|
||||
|
||||
// bool RotateAroundTheCenterPointAction::Execute(Event event)
|
||||
// {
|
||||
// // uint32 nearest = FindNearestWaypoint();
|
||||
// // uint32 next_point = (nearest + 1) % intervals;
|
||||
// uint32 next_point = GetCurrWaypoint();
|
||||
// if (MoveTo(bot->GetMapId(), waypoints[next_point].first, waypoints[next_point].second, bot->GetPositionZ())) {
|
||||
// call_counters += 1;
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
bool RotateAroundTheCenterPointAction::Execute(Event event)
|
||||
{
|
||||
// uint32 nearest = FindNearestWaypoint();
|
||||
// uint32 next_point = (nearest + 1) % intervals;
|
||||
uint32 next_point = GetCurrWaypoint();
|
||||
if (MoveTo(bot->GetMapId(), waypoints[next_point].first, waypoints[next_point].second, bot->GetPositionZ())) {
|
||||
call_counters += 1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// uint32 RotateAroundTheCenterPointAction::FindNearestWaypoint()
|
||||
// {
|
||||
// float minDistance = 0;
|
||||
// int ret = -1;
|
||||
// for (int i = 0; i < intervals; i++) {
|
||||
// float w_x = waypoints[i].first, w_y = waypoints[i].second;
|
||||
// float dis = bot->GetDistance2d(w_x, w_y);
|
||||
// if (ret == -1 || dis < minDistance) {
|
||||
// ret = i;
|
||||
// minDistance = dis;
|
||||
// }
|
||||
// }
|
||||
// return ret;
|
||||
// }
|
||||
uint32 RotateAroundTheCenterPointAction::FindNearestWaypoint()
|
||||
{
|
||||
float minDistance = 0;
|
||||
int ret = -1;
|
||||
for (int i = 0; i < intervals; i++) {
|
||||
float w_x = waypoints[i].first, w_y = waypoints[i].second;
|
||||
float dis = bot->GetDistance2d(w_x, w_y);
|
||||
if (ret == -1 || dis < minDistance) {
|
||||
ret = i;
|
||||
minDistance = dis;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// uint32 RotateGrobbulusAction::GetCurrWaypoint()
|
||||
// {
|
||||
// Unit* boss = AI_VALUE(Unit*, "boss target");
|
||||
// if (!boss) {
|
||||
// return false;
|
||||
// }
|
||||
// BossAI* boss_ai = dynamic_cast<BossAI*>(boss->GetAI());
|
||||
// EventMap* eventMap = boss_botAI->GetEvents();
|
||||
// const uint32 event_time = eventMap->GetNextEventTime(2);
|
||||
// return (event_time / 15000) % intervals;
|
||||
// }
|
||||
uint32 RotateGrobbulusAction::GetCurrWaypoint()
|
||||
{
|
||||
Unit* boss = AI_VALUE(Unit*, "boss target");
|
||||
if (!boss) {
|
||||
return false;
|
||||
}
|
||||
BossAI* boss_ai = dynamic_cast<BossAI*>(boss->GetAI());
|
||||
EventMap* eventMap = boss_ai->GetEvents();
|
||||
const uint32 event_time = eventMap->GetNextEventTime(2);
|
||||
return (event_time / 15000) % intervals;
|
||||
}
|
||||
|
||||
bool HeiganDanceAction::CalculateSafe() {
|
||||
Unit* boss = AI_VALUE2(Unit*, "find target", "heigan the unclean");
|
||||
|
||||
@@ -16,17 +16,17 @@
|
||||
// virtual bool Execute(Event event);
|
||||
// };
|
||||
|
||||
// class GoBehindTheBossAction : public MovementAction
|
||||
// {
|
||||
// public:
|
||||
// GoBehindTheBossAction(PlayerbotAI* ai, float distance = 24.0f, float delta_angle = M_PI / 8) : MovementAction(ai, "grobbulus go behind the boss") {
|
||||
// this->distance = distance;
|
||||
// this->delta_angle = delta_angle;
|
||||
// }
|
||||
// virtual bool Execute(Event event);
|
||||
// protected:
|
||||
// float distance, delta_angle;
|
||||
// };
|
||||
class GoBehindTheBossAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
GoBehindTheBossAction(PlayerbotAI* ai, float distance = 24.0f, float delta_angle = M_PI / 8) : MovementAction(ai, "grobbulus go behind the boss") {
|
||||
this->distance = distance;
|
||||
this->delta_angle = delta_angle;
|
||||
}
|
||||
virtual bool Execute(Event event);
|
||||
protected:
|
||||
float distance, delta_angle;
|
||||
};
|
||||
|
||||
// class MoveToPointForceAction : public MovementAction
|
||||
// {
|
||||
@@ -40,62 +40,62 @@
|
||||
// float x, y;
|
||||
// };
|
||||
|
||||
// class MoveInsideAction : public MovementAction
|
||||
// {
|
||||
// public:
|
||||
// MoveInsideAction(PlayerbotAI* ai, float x, float y, float distance = 5.0f) : MovementAction(ai, "move inside") {
|
||||
// this->x = x;
|
||||
// this->y = y;
|
||||
// this->distance = distance;
|
||||
// }
|
||||
// virtual bool Execute(Event event);
|
||||
// protected:
|
||||
// float x, y, distance;
|
||||
// };
|
||||
class MoveInsideAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
MoveInsideAction(PlayerbotAI* ai, float x, float y, float distance = 5.0f) : MovementAction(ai, "move inside") {
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->distance = distance;
|
||||
}
|
||||
virtual bool Execute(Event event);
|
||||
protected:
|
||||
float x, y, distance;
|
||||
};
|
||||
|
||||
// class RotateAroundTheCenterPointAction : public MovementAction
|
||||
// {
|
||||
// public:
|
||||
// RotateAroundTheCenterPointAction(PlayerbotAI* ai, string name,
|
||||
// float center_x, float center_y, float radius = 40.0f,
|
||||
// uint32 intervals = 16, bool clockwise = true, float start_angle = 0) : MovementAction(ai, name) {
|
||||
// this->center_x = center_x;
|
||||
// this->center_y = center_y;
|
||||
// this->radius = radius;
|
||||
// this->intervals = intervals;
|
||||
// this->clockwise = clockwise;
|
||||
// this->call_counters = 0;
|
||||
// for (int i = 0; i < intervals; i++) {
|
||||
// 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));
|
||||
// }
|
||||
// }
|
||||
// virtual bool Execute(Event event);
|
||||
// protected:
|
||||
// virtual uint32 GetCurrWaypoint() { return 0; }
|
||||
// uint32 FindNearestWaypoint();
|
||||
// float center_x, center_y, radius;
|
||||
// uint32 intervals, call_counters;
|
||||
// bool clockwise;
|
||||
// std::vector<std::pair<float, float>> waypoints;
|
||||
// };
|
||||
class RotateAroundTheCenterPointAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
RotateAroundTheCenterPointAction(PlayerbotAI* ai, std::string name,
|
||||
float center_x, float center_y, float radius = 40.0f,
|
||||
uint32 intervals = 16, bool clockwise = true, float start_angle = 0) : MovementAction(ai, name) {
|
||||
this->center_x = center_x;
|
||||
this->center_y = center_y;
|
||||
this->radius = radius;
|
||||
this->intervals = intervals;
|
||||
this->clockwise = clockwise;
|
||||
this->call_counters = 0;
|
||||
for (int i = 0; i < intervals; i++) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
virtual bool Execute(Event event);
|
||||
protected:
|
||||
virtual uint32 GetCurrWaypoint() { return 0; }
|
||||
uint32 FindNearestWaypoint();
|
||||
float center_x, center_y, radius;
|
||||
uint32 intervals, call_counters;
|
||||
bool clockwise;
|
||||
std::vector<std::pair<float, float>> waypoints;
|
||||
};
|
||||
|
||||
// class RotateGrobbulusAction : public RotateAroundTheCenterPointAction
|
||||
// {
|
||||
// public:
|
||||
// RotateGrobbulusAction(PlayerbotAI* ai): RotateAroundTheCenterPointAction(ai, "rotate grobbulus", 3281.23f, -3310.38f, 35.0f, 8, true, M_PI) {}
|
||||
// virtual bool isUseful() {
|
||||
// return RotateAroundTheCenterPointAction::isUseful() && ai->IsMainTank(bot) && AI_VALUE2(bool, "has aggro", "boss target");
|
||||
// }
|
||||
// virtual uint32 GetCurrWaypoint();
|
||||
// protected:
|
||||
// };
|
||||
class RotateGrobbulusAction : public RotateAroundTheCenterPointAction
|
||||
{
|
||||
public:
|
||||
RotateGrobbulusAction(PlayerbotAI* botAI): RotateAroundTheCenterPointAction(botAI, "rotate grobbulus", 3281.23f, -3310.38f, 35.0f, 8, true, M_PI) {}
|
||||
virtual bool isUseful() {
|
||||
return RotateAroundTheCenterPointAction::isUseful() && botAI->IsMainTank(bot) && AI_VALUE2(bool, "has aggro", "boss target");
|
||||
}
|
||||
virtual uint32 GetCurrWaypoint();
|
||||
protected:
|
||||
};
|
||||
|
||||
// class GrobblulusMoveCenterAction : public MoveInsideAction
|
||||
// {
|
||||
// public:
|
||||
// GrobblulusMoveCenterAction(PlayerbotAI* ai) : MoveInsideAction(ai, 3281.23f, -3310.38f, 5.0f) {}
|
||||
// };
|
||||
class GrobblulusMoveCenterAction : public MoveInsideAction
|
||||
{
|
||||
public:
|
||||
GrobblulusMoveCenterAction(PlayerbotAI* ai) : MoveInsideAction(ai, 3281.23f, -3310.38f, 5.0f) {}
|
||||
};
|
||||
|
||||
class HeiganDanceAction : public MovementAction
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user