refactor raid naxx related

This commit is contained in:
Yunfan Li
2023-07-14 23:13:46 +08:00
parent 86f7a6e9d1
commit d183d285b6
18 changed files with 389 additions and 298 deletions

View File

@@ -57,7 +57,7 @@
#include "XpGainAction.h"
#include "VehicleActions.h"
#include "WorldBuffAction.h"
#include "RaidNaxxAction.h"
#include "RaidNaxxActions.h"
class PlayerbotAI;
@@ -223,42 +223,7 @@ class ActionContext : public NamedObjectContext<Action>
creators["toggle pet spell"] = &ActionContext::toggle_pet_spell;
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;
// creators["thaddius attack nearest pet"] = &ActionContext::thaddius_attack_nearest_pet;
// creators["thaddius melee to place"] = &ActionContext::thaddius_tank_to_place;
// creators["thaddius ranged to place"] = &ActionContext::thaddius_ranged_to_place;
// creators["thaddius move to platform"] = &ActionContext::thaddius_move_to_platform;
// creators["thaddius move polarity"] = &ActionContext::thaddius_move_polarity;
// creators["razuvious use obedience crystal"] = &ActionContext::razuvious_use_obedience_crystal;
// creators["razuvious target"] = &ActionContext::razuvious_target;
// creators["horseman attract alternatively"] = &ActionContext::horseman_attract_alternatively;
// creators["horseman attack in order"] = &ActionContext::horseman_attack_in_order;
// creators["sapphiron ground main tank position"] = &ActionContext::sapphiron_ground_main_tank_position;
// creators["sapphiron ground position"] = &ActionContext::sapphiron_ground_position;
// creators["sapphiron flight position"] = &ActionContext::sapphiron_flight_position;
// creators["sapphiron avoid chill"] = &ActionContext::sapphiron_avoid_chill;
// creators["kel'thuzad choose target"] = &ActionContext::kelthuzad_choose_target;
// creators["kel'thuzad position"] = &ActionContext::kelthuzad_position;
creators["anub'rekhan choose target"] = &ActionContext::anubrekhan_choose_target;
creators["anub'rekhan position"] = &ActionContext::anubrekhan_position;
// creators["gluth choose target"] = &ActionContext::gluth_choose_target;
// creators["gluth position"] = &ActionContext::gluth_position;
// creators["gluth slowdown"] = &ActionContext::gluth_slowdown;
// creators["loatheb position"] = &ActionContext::loatheb_position;
// creators["loatheb choose target"] = &ActionContext::loatheb_choose_target;
}
private:
@@ -421,33 +386,7 @@ class ActionContext : public NamedObjectContext<Action>
static Action* toggle_pet_spell(PlayerbotAI* ai) { return new TogglePetSpellAutoCastAction(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); }
// static Action* thaddius_tank_to_place(PlayerbotAI* ai) { return new ThaddiusMeleeToPlaceAction(ai); }
// static Action* thaddius_ranged_to_place(PlayerbotAI* ai) { return new ThaddiusRangedToPlaceAction(ai); }
// static Action* thaddius_move_to_platform(PlayerbotAI* ai) { return new ThaddiusMoveToPlatformAction(ai); }
// static Action* thaddius_move_polarity(PlayerbotAI* ai) { return new ThaddiusMovePolarityAction(ai); }
// static Action* razuvious_target(PlayerbotAI* ai) { return new RazuviousTargetAction(ai); }
// static Action* razuvious_use_obedience_crystal(PlayerbotAI* ai) { return new RazuviousUseObedienceCrystalAction(ai); }
// 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_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); }
static Action* anubrekhan_choose_target(PlayerbotAI* ai) { return new AnubrekhanChooseTargetAction(ai); }
static Action* anubrekhan_position(PlayerbotAI* ai) { return new AnubrekhanPositionAction(ai); }
// static Action* gluth_choose_target(PlayerbotAI* ai) { return new GluthChooseTargetAction(ai); }
// static Action* gluth_position(PlayerbotAI* ai) { return new GluthPositionAction(ai); }
// static Action* gluth_slowdown(PlayerbotAI* ai) { return new GluthSlowdownAction(ai); }
// static Action* loatheb_position(PlayerbotAI* ai) { return new LoathebPositionAction(ai); }
// static Action* loatheb_choose_target(PlayerbotAI* ai) { return new LoathebChooseTargetAction(ai); }
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,320 +0,0 @@
#ifndef _PLAYERBOT_RAIDNAXXACTION_H
#define _PLAYERBOT_RAIDNAXXACTION_H
#include "Action.h"
#include "MovementActions.h"
#include "AttackAction.h"
#include "GenericActions.h"
#include "PlayerbotAI.h"
#include "Playerbots.h"
// just for test
// class TryToGetBossAIAction : public Action
// {
// public:
// TryToGetBossAIAction(PlayerbotAI* ai) : Action(ai, "try to get boss ai") {}
// public:
// 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 MoveToPointForceAction : public MovementAction
// {
// public:
// MoveToPointForceAction(PlayerbotAI* ai, float x, float y) : MovementAction(ai, "move to point force") {
// this->x = x;
// this->y = y;
// }
// virtual bool Execute(Event event);
// protected:
// 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 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* 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 HeiganDanceAction : public MovementAction
{
public:
HeiganDanceAction(PlayerbotAI* ai) : MovementAction(ai, "heigan dance") {
this->prev_phase = 0;
this->prev_erupt = 0;
this->prev_timer = 0;
waypoints.push_back(std::make_pair(2793.58f, -3665.93f));
waypoints.push_back(std::make_pair(2775.49f, -3674.43f));
waypoints.push_back(std::make_pair(2762.30f, -3684.59f));
waypoints.push_back(std::make_pair(2755.99f, -3703.96f));
}
protected:
bool CalculateSafe();
void ResetSafe() { curr_safe = 0; curr_dir = 1; }
void NextSafe() { curr_safe += curr_dir; if (curr_safe == 3 || curr_safe == 0) { curr_dir = -curr_dir; } }
uint32 prev_phase, prev_erupt, prev_timer;
uint32 curr_safe, curr_dir;
std::vector<std::pair<float, float>> waypoints;
};
class HeiganDanceMeleeAction : public HeiganDanceAction
{
public:
HeiganDanceMeleeAction(PlayerbotAI* ai) : HeiganDanceAction(ai) {}
virtual bool Execute(Event event);
};
class HeiganDanceRangedAction : public HeiganDanceAction
{
public:
HeiganDanceRangedAction(PlayerbotAI* ai) : HeiganDanceAction(ai) {
platform = std::make_pair(2794.26f, -3706.67f);
}
virtual bool Execute(Event event);
protected:
std::pair<float, float> platform;
};
// class ThaddiusAttackNearestPetAction : public AttackAction
// {
// public:
// ThaddiusAttackNearestPetAction(PlayerbotAI* ai) : AttackAction(ai, "thaddius attack nearest pet") {}
// virtual bool Execute(Event event);
// virtual bool isUseful();
// };
// class ThaddiusMeleeToPlaceAction : public MovementAction
// {
// public:
// ThaddiusMeleeToPlaceAction(PlayerbotAI* ai) : MovementAction(ai, "thaddius melee to place") {}
// virtual bool Execute(Event event);
// virtual bool isUseful();
// };
// class ThaddiusRangedToPlaceAction : public MovementAction
// {
// public:
// ThaddiusRangedToPlaceAction(PlayerbotAI* ai) : MovementAction(ai, "thaddius ranged to place") {}
// virtual bool Execute(Event event);
// virtual bool isUseful();
// };
// class ThaddiusMoveToPlatformAction : public MovementAction
// {
// public:
// ThaddiusMoveToPlatformAction(PlayerbotAI* ai) : MovementAction(ai, "thaddius move to platform") {}
// virtual bool Execute(Event event);
// virtual bool isUseful();
// };
// class ThaddiusMovePolarityAction : public MovementAction
// {
// public:
// ThaddiusMovePolarityAction(PlayerbotAI* ai) : MovementAction(ai, "thaddius move polarity") {}
// virtual bool Execute(Event event);
// virtual bool isUseful();
// };
// class RazuviousUseObedienceCrystalAction : public MovementAction
// {
// public:
// RazuviousUseObedienceCrystalAction(PlayerbotAI* ai) : MovementAction(ai, "razuvious use obedience crystal") {}
// virtual bool Execute(Event event);
// };
// class RazuviousTargetAction : public AttackAction
// {
// public:
// RazuviousTargetAction(PlayerbotAI* ai) : AttackAction(ai, "razuvious target") {}
// virtual bool Execute(Event event);
// };
// class HorsemanAttractAlternativelyAction : public AttackAction
// {
// public:
// HorsemanAttractAlternativelyAction(PlayerbotAI* ai) : AttackAction(ai, "horseman attract alternatively") {
// this->last_voidzone = 0;
// this->voidzone_counter = 0;
// }
// virtual bool Execute(Event event);
// protected:
// uint32 last_voidzone, voidzone_counter;
// };
// class HorsemanAttactInOrderAction : public AttackAction
// {
// public:
// HorsemanAttactInOrderAction(PlayerbotAI* ai) : AttackAction(ai, "horseman attact in order") {}
// virtual bool Execute(Event event);
// };
// class SapphironGroundMainTankPositionAction : public MovementAction
// {
// public:
// SapphironGroundMainTankPositionAction(PlayerbotAI* ai) : MovementAction(ai, "sapphiron ground main tank position") {}
// 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 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 SapphironAvoidChillAction : public MovementAction
// {
// public:
// SapphironAvoidChillAction(PlayerbotAI* ai) : MovementAction(ai, "sapphiron avoid chill") {}
// virtual bool Execute(Event event);
// };
// class KelthuzadChooseTargetAction : public AttackAction
// {
// public:
// KelthuzadChooseTargetAction(PlayerbotAI* ai) : AttackAction(ai, "kel'thuzad choose target") {}
// virtual bool Execute(Event event);
// };
// class KelthuzadPositionAction : public MovementAction
// {
// public:
// KelthuzadPositionAction(PlayerbotAI* ai) : MovementAction(ai, "kel'thuzad position") {}
// virtual bool Execute(Event event);
// };
class AnubrekhanChooseTargetAction : public AttackAction
{
public:
AnubrekhanChooseTargetAction(PlayerbotAI* ai) : AttackAction(ai, "anub'rekhan choose target") {}
virtual bool Execute(Event event);
};
class AnubrekhanPositionAction : public RotateAroundTheCenterPointAction
{
public:
AnubrekhanPositionAction(PlayerbotAI* ai) : RotateAroundTheCenterPointAction(ai, "anub'rekhan position", 3272.49f, -3476.27f, 45.0f, 16) {}
virtual bool Execute(Event event);
};
// class GluthChooseTargetAction : public AttackAction
// {
// public:
// GluthChooseTargetAction(PlayerbotAI* ai) : AttackAction(ai, "gluth choose target") {}
// virtual bool Execute(Event event);
// };
// class GluthPositionAction : public RotateAroundTheCenterPointAction
// {
// public:
// GluthPositionAction(PlayerbotAI* ai) : RotateAroundTheCenterPointAction(ai, "gluth position", 3293.61f, -3149.01f, 12.0f, 12) {}
// virtual bool Execute(Event event);
// };
// class GluthSlowdownAction : public Action
// {
// public:
// GluthSlowdownAction(PlayerbotAI* ai) : Action(ai, "slowdown") {}
// virtual bool Execute(Event event);
// };
// class LoathebPositionAction : public MovementAction
// {
// public:
// LoathebPositionAction(PlayerbotAI* ai) : MovementAction(ai, "loatheb position") {}
// virtual bool Execute(Event event);
// };
// class LoathebChooseTargetAction : public AttackAction
// {
// public:
// LoathebChooseTargetAction(PlayerbotAI* ai) : AttackAction(ai, "loatheb choose target") {}
// virtual bool Execute(Event event);
// };
#endif