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

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_RAIDACTIONCONTEXTACTION_H
#define _PLAYERBOT_RAIDACTIONCONTEXTACTION_H
#include "Action.h"
#include "NamedObjectContext.h"
class RaidActionContext : public NamedObjectContext<Action>
{
public:
RaidActionContext()
{
}
private:
};
#endif

View File

@@ -0,0 +1,18 @@
#ifndef _PLAYERBOT_RAIDSTRATEGYCONTEXT_H_
#define _PLAYERBOT_RAIDSTRATEGYCONTEXT_H_
#include "Strategy.h"
#include "RaidNaxxStrategy.h"
class RaidStrategyContext : public NamedObjectContext<Strategy>
{
public:
RaidStrategyContext() : NamedObjectContext<Strategy>(false, true)
{
creators["naxx"] = &RaidStrategyContext::naxx;
}
private:
static Strategy* naxx(PlayerbotAI* botAI) { return new RaidNaxxStrategy(botAI); }
};
#endif

View File

View File

@@ -0,0 +1,82 @@
// /*
// * Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
// */
#ifndef _PLAYERBOT_RAIDNAXXACTIONCONTEXT_H
#define _PLAYERBOT_RAIDNAXXACTIONCONTEXT_H
#include "Action.h"
#include "NamedObjectContext.h"
#include "RaidNaxxActions.h"
class RaidNaxxActionContext : public NamedObjectContext<Action>
{
public:
RaidNaxxActionContext() {
creators["grobbulus go behind the boss"] = &RaidNaxxActionContext::go_behind_the_boss;
creators["rotate grobbulus"] = &RaidNaxxActionContext::rotate_grobbulus;
creators["grobbulus move center"] = &RaidNaxxActionContext::grobbulus_move_center;
creators["heigan dance melee"] = &RaidNaxxActionContext::heigan_dance_melee;
creators["heigan dance ranged"] = &RaidNaxxActionContext::heigan_dance_ranged;
// creators["thaddius attack nearest pet"] = &RaidNaxxActionContext::thaddius_attack_nearest_pet;
// creators["thaddius melee to place"] = &RaidNaxxActionContext::thaddius_tank_to_place;
// creators["thaddius ranged to place"] = &RaidNaxxActionContext::thaddius_ranged_to_place;
// creators["thaddius move to platform"] = &RaidNaxxActionContext::thaddius_move_to_platform;
// creators["thaddius move polarity"] = &RaidNaxxActionContext::thaddius_move_polarity;
// creators["razuvious use obedience crystal"] = &RaidNaxxActionContext::razuvious_use_obedience_crystal;
// creators["razuvious target"] = &RaidNaxxActionContext::razuvious_target;
// creators["horseman attract alternatively"] = &RaidNaxxActionContext::horseman_attract_alternatively;
// 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 avoid chill"] = &RaidNaxxActionContext::sapphiron_avoid_chill;
// creators["kel'thuzad choose target"] = &RaidNaxxActionContext::kelthuzad_choose_target;
// creators["kel'thuzad position"] = &RaidNaxxActionContext::kelthuzad_position;
creators["anub'rekhan choose target"] = &RaidNaxxActionContext::anubrekhan_choose_target;
creators["anub'rekhan position"] = &RaidNaxxActionContext::anubrekhan_position;
// creators["gluth choose target"] = &RaidNaxxActionContext::gluth_choose_target;
// creators["gluth position"] = &RaidNaxxActionContext::gluth_position;
// creators["gluth slowdown"] = &RaidNaxxActionContext::gluth_slowdown;
// creators["loatheb position"] = &RaidNaxxActionContext::loatheb_position;
// creators["loatheb choose target"] = &RaidNaxxActionContext::loatheb_choose_target;
}
private:
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

@@ -0,0 +1,321 @@
#ifndef _PLAYERBOT_RAIDNAXXACTIONS_H
#define _PLAYERBOT_RAIDNAXXACTIONS_H
#include "Action.h"
#include "MovementActions.h"
#include "AttackAction.h"
#include "GenericActions.h"
#include "PlayerbotAI.h"
#include "Playerbots.h"
#include "RaidNaxxScripts.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

View File

@@ -0,0 +1,291 @@
#include "RaidNaxxMultipliers.h"
#include "MovementActions.h"
#include "ScriptedCreature.h"
#include "RaidNaxxActions.h"
#include "GenericSpellActions.h"
#include "ChooseTargetActions.h"
#include "ReachTargetActions.h"
#include "UseMeetingStoneAction.h"
#include "FollowActions.h"
#include "ShamanActions.h"
#include "PriestActions.h"
#include "DKActions.h"
#include "HunterActions.h"
#include "MageActions.h"
#include "RogueActions.h"
#include "DruidActions.h"
#include "PaladinActions.h"
#include "WarriorActions.h"
float HeiganDanceMultiplier::GetValue(Action* action)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "heigan the unclean");
if (!boss) {
return 1.0f;
}
boss_heigan::boss_heiganAI* boss_ai = dynamic_cast<boss_heigan::boss_heiganAI*>(boss->GetAI());
EventMap* eventMap = &boss_ai->events;
uint32 curr_phase = boss_ai->currentPhase;
uint32 curr_dance = eventMap->GetNextEventTime(4);
uint32 curr_timer = eventMap->GetTimer();
uint32 curr_erupt = eventMap->GetNextEventTime(3);
if (dynamic_cast<SetBehindTargetAction*>(action)) {
return 0.0f;
}
if (curr_phase != 1 && (int32)curr_dance - curr_timer >= 3000) {
return 1.0f;
}
if (dynamic_cast<HeiganDanceAction*>(action) || dynamic_cast<CurePartyMemberAction*>(action)) {
return 1.0f;
}
if (dynamic_cast<CastSpellAction*>(action) && !dynamic_cast<CastMeleeSpellAction*>(action))
{
uint32 spellId = AI_VALUE2(uint32, "spell id", action->getName());
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo) {
return 0.0f;
}
uint32 castTime = spellInfo->CalcCastTime();
if (castTime == 0 && !spellInfo->IsChanneled()) {
return 1.0f;
}
}
return 0.0f;
}
// float LoathebGenericMultiplier::GetValue(Action* action)
// {
// Unit* boss = AI_VALUE2(Unit*, "find target", "loatheb");
// if (!boss) {
// // bot->Yell("Can\'t find Loatheb...", LANG_UNIVERSAL);
// return 1.0f;
// }
// context->GetValue<bool>("neglect threat")->Set(true);
// if (botAI->GetCurrentState() == BOT_STATE_COMBAT &&
// (dynamic_cast<AttackLeastHpTargetAction*>(action) ||
// dynamic_cast<TankAssistAction*>(action) ||
// dynamic_cast<CastDebuffSpellOnAttackerAction*>(action) ||
// dynamic_cast<FleeAction*>(action))) {
// return 0.0f;
// }
// if (!dynamic_cast<CastHealingSpellAction*>(action)) {
// return 1.0f;
// }
// // bot->Yell("It\'s a healing spell!", LANG_UNIVERSAL);
// Aura* aura = botAI->GetAura("necrotic aura", bot);
// if (!aura || aura->GetDuration() <= 1500) {
// return 1.0f;
// }
// return 0.0f;
// }
// float ThaddiusGenericMultiplier::GetValue(Action* action)
// {
// Unit* boss = AI_VALUE2(Unit*, "find target", "thaddius");
// if (!boss) {
// return 1.0f;
// }
// BossAI* boss_ai = dynamic_cast<BossAI*>(boss->GetAI());
// EventMap* eventMap = boss_botAI->GetEvents();
// uint32 curr_phase = eventMap->GetPhaseMask();
// // pet phase
// if (curr_phase == 2 &&
// ( dynamic_cast<AttackLeastHpTargetAction*>(action) ||
// dynamic_cast<TankAssistAction*>(action) ||
// dynamic_cast<CastDebuffSpellOnAttackerAction*>(action) ||
// dynamic_cast<ReachPartyMemberToHealAction*>(action) ||
// dynamic_cast<BuffOnMainTankAction*>(action) )) {
// return 0.0f;
// }
// // die at the same time
// Unit* target = AI_VALUE(Unit*, "current target");
// Unit* feugen = AI_VALUE2(Unit*, "find target", "feugen");
// Unit* stalagg = AI_VALUE2(Unit*, "find target", "stalagg");
// if (curr_phase == 2 && target && feugen && stalagg &&
// target->GetHealthPct() <= 40 &&
// (feugen->GetHealthPct() >= target->GetHealthPct() + 3 || stalagg->GetHealthPct() >= target->GetHealthPct() + 3)) {
// if (dynamic_cast<CastSpellAction*>(action) && !dynamic_cast<CastHealingSpellAction*>(action)) {
// return 0.0f;
// }
// }
// // magnetic pull
// // uint32 curr_timer = eventMap->GetTimer();
// // // if (curr_phase == 2 && bot->GetPositionZ() > 312.5f && dynamic_cast<MovementAction*>(action)) {
// // if (curr_phase == 2 && (curr_timer % 20000 >= 18000 || curr_timer % 20000 <= 2000) && dynamic_cast<MovementAction*>(action)) {
// // // MotionMaster *mm = bot->GetMotionMaster();
// // // mm->Clear();
// // return 0.0f;
// // }
// // thaddius phase
// if (curr_phase == 8 && dynamic_cast<FleeAction*>(action)) {
// return 0.0f;
// }
// return 1.0f;
// }
// float SapphironGenericMultiplier::GetValue(Action* action)
// {
// Unit* boss = AI_VALUE2(Unit*, "find target", "sapphiron");
// if (!boss) {
// return 1.0f;
// }
// if (dynamic_cast<FollowAction*>(action) ||
// dynamic_cast<CastDeathGripAction*>(action)) {
// return 0.0f;
// }
// BossAI* boss_ai = dynamic_cast<BossAI*>(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<MovementAction*>(action) &&
// !dynamic_cast<SapphironFlightPositionAction*>(action) &&
// !dynamic_cast<SummonAction*>(action))) {
// return 0.0f;
// }
// return 1.0f;
// }
// float InstructorRazuviousGenericMultiplier::GetValue(Action* action)
// {
// Unit* boss = AI_VALUE2(Unit*, "find target", "instructor razuvious");
// if (!boss) {
// return 1.0f;
// }
// context->GetValue<bool>("neglect threat")->Set(true);
// if (botAI->GetCurrentState() == BOT_STATE_COMBAT &&
// (dynamic_cast<AttackLeastHpTargetAction*>(action) ||
// dynamic_cast<TankAssistAction*>(action) ||
// dynamic_cast<CastTauntAction*>(action) ||
// dynamic_cast<CastDarkCommandAction*>(action) ||
// dynamic_cast<CastHandOfReckoningAction*>(action) ||
// dynamic_cast<CastGrowlAction*>(action))) {
// return 0.0f;
// }
// return 1.0f;
// }
// float KelthuzadGenericMultiplier::GetValue(Action* action)
// {
// Unit* boss = AI_VALUE2(Unit*, "find target", "kel'thuzad");
// if (!boss) {
// return 1.0f;
// }
// if ((dynamic_cast<AttackLeastHpTargetAction*>(action) ||
// dynamic_cast<TankAssistAction*>(action) ||
// dynamic_cast<CastDebuffSpellOnAttackerAction*>(action) ||
// dynamic_cast<FollowAction*>(action) ||
// dynamic_cast<FleeAction*>(action))) {
// return 0.0f;
// }
// BossAI* boss_ai = dynamic_cast<BossAI*>(boss->GetAI());
// EventMap* eventMap = boss_botAI->GetEvents();
// uint32 curr_phase = eventMap->GetPhaseMask();
// if (curr_phase == 1) {
// if (dynamic_cast<CastTotemAction*>(action) ||
// dynamic_cast<CastShadowfiendAction*>(action) ||
// dynamic_cast<CastRaiseDeadAction*>(action) ||
// dynamic_cast<CastFeignDeathAction*>(action) ||
// dynamic_cast<CastInvisibilityAction*>(action) ||
// dynamic_cast<CastVanishAction*>(action)) {
// return 0.0f;
// }
// }
// if (curr_phase == 2) {
// if (dynamic_cast<CastBlizzardAction*>(action) ||
// dynamic_cast<CastFrostNovaAction*>(action)) {
// return 0.0f;
// }
// }
// return 1.0f;
// }
float AnubrekhanGenericMultiplier::GetValue(Action* action)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "anub'rekhan");
if (!boss) {
return 1.0f;
}
if (
// (dynamic_cast<AttackLeastHpTargetAction*>(action) ||
// dynamic_cast<DpsAssistAction*>(action) ||
// dynamic_cast<TankAssistAction*>(action) ||
dynamic_cast<FollowAction*>(action)) {
return 0.0f;
}
// BossAI* boss_ai = dynamic_cast<BossAI*>(boss->GetAI());
// EventMap* eventMap = boss_ai->GetEvents();
// uint32 curr_phase = eventMap->GetPhaseMask();
if (botAI->HasAura("locust swarm", boss)) {
if (dynamic_cast<FleeAction*>(action)) {
return 0.0f;
}
}
return 1.0f;
}
// float FourhorsemanGenericMultiplier::GetValue(Action* action)
// {
// Unit* boss = AI_VALUE2(Unit*, "find target", "sir zeliek");
// if (!boss) {
// return 1.0f;
// }
// if ((dynamic_cast<AttackLeastHpTargetAction*>(action) ||
// dynamic_cast<TankAssistAction*>(action))) {
// return 0.0f;
// }
// return 1.0f;
// }
// float GothikGenericMultiplier::GetValue(Action* action)
// {
// Unit* boss = AI_VALUE2(Unit*, "find target", "gothik the harvester");
// if (!boss) {
// return 1.0f;
// }
// BossAI* boss_ai = dynamic_cast<BossAI*>(boss->GetAI());
// EventMap* eventMap = boss_botAI->GetEvents();
// uint32 curr_phase = eventMap->GetPhaseMask();
// if (curr_phase == 1 && (dynamic_cast<FollowAction*>(action))) {
// return 0.0f;
// }
// if (curr_phase == 1 && (dynamic_cast<AttackAction*>(action))) {
// Unit* target = action->GetTarget();
// if (target == boss) {
// return 0.0f;
// }
// }
// return 1.0f;
// }
// float GluthGenericMultiplier::GetValue(Action* action)
// {
// Unit* boss = AI_VALUE2(Unit*, "find target", "gluth");
// if (!boss) {
// return 1.0f;
// }
// if ((dynamic_cast<AttackLeastHpTargetAction*>(action) ||
// dynamic_cast<TankAssistAction*>(action) ||
// dynamic_cast<FleeAction*>(action) ||
// dynamic_cast<CastDebuffSpellOnAttackerAction*>(action) ||
// dynamic_cast<CastStarfallAction*>(action))) {
// return 0.0f;
// }
// if (botAI->IsMainTank(bot)) {
// Aura* aura = botAI->GetAuraWithDuration("mortal wound", bot);
// if (aura && aura->GetStackAmount() >= 5) {
// if (dynamic_cast<CastTauntAction*>(action) ||
// dynamic_cast<CastDarkCommandAction*>(action) ||
// dynamic_cast<CastHandOfReckoningAction*>(action) ||
// dynamic_cast<CastGrowlAction*>(action)) {
// return 0.0f;
// }
// }
// }
// return 1.0f;
// }

View File

@@ -0,0 +1,97 @@
#ifndef _PLAYERRBOT_RAIDNAXXMULTIPLIERS_H_
#define _PLAYERRBOT_RAIDNAXXMULTIPLIERS_H_
#include "Multiplier.h"
class HeiganDanceMultiplier : public Multiplier
{
public:
HeiganDanceMultiplier(PlayerbotAI* ai) : Multiplier(ai, "helgan dance") {}
public:
virtual float GetValue(Action* action);
};
// class LoathebGenericMultiplier : public Multiplier
// {
// public:
// LoathebGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "loatheb generic") {}
// public:
// virtual float GetValue(Action* action);
// };
// class ThaddiusGenericMultiplier : public Multiplier
// {
// public:
// ThaddiusGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "thaddius generic") {}
// public:
// virtual float GetValue(Action* action);
// };
// class SapphironGenericMultiplier : public Multiplier
// {
// public:
// SapphironGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "sapphiron generic") {}
// public:
// virtual float GetValue(Action* action);
// };
// class InstructorRazuviousGenericMultiplier : public Multiplier
// {
// public:
// InstructorRazuviousGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "instructor razuvious generic") {}
// public:
// virtual float GetValue(Action* action);
// };
// class KelthuzadGenericMultiplier : public Multiplier
// {
// public:
// KelthuzadGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "kelthuzad generic") {}
// public:
// virtual float GetValue(Action* action);
// };
class AnubrekhanGenericMultiplier : public Multiplier
{
public:
AnubrekhanGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "anubrekhan generic") {}
public:
virtual float GetValue(Action* action);
};
// class FourhorsemanGenericMultiplier : public Multiplier
// {
// public:
// FourhorsemanGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "fourhorseman generic") {}
// public:
// virtual float GetValue(Action* action);
// };
// class GothikGenericMultiplier : public Multiplier
// {
// public:
// GothikGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "gothik generic") {}
// public:
// virtual float GetValue(Action* action);
// };
// class GluthGenericMultiplier : public Multiplier
// {
// public:
// GluthGenericMultiplier(PlayerbotAI* ai) : Multiplier(ai, "gluth generic") {}
// public:
// virtual float GetValue(Action* action);
// };
#endif

View File

@@ -0,0 +1,8 @@
#ifndef _PLAYERBOT_RAIDNAXXSCRIPTS_H
#define _PLAYERBOT_RAIDNAXXSCRIPTS_H
#include "../../../../src/server/scripts/Northrend/Naxxramas/boss_heigan.h"
#include "../../../../src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.h"
#include "../../../../src/server/scripts/Northrend/Naxxramas/boss_grobbulus.h"
#endif

View File

@@ -0,0 +1,139 @@
#include "RaidNaxxStrategy.h"
#include "RaidNaxxMultipliers.h"
void RaidNaxxStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{
// triggers.push_back(new TriggerNode(
// "often",
// NextAction::array(0, new NextAction("try to get boss ai", ACTION_RAID), NULL)));
// Grobbulus
triggers.push_back(new TriggerNode(
"mutating injection",
NextAction::array(0, new NextAction("grobbulus go behind the boss", ACTION_RAID + 2), NULL)));
triggers.push_back(new TriggerNode(
"mutating injection removed",
NextAction::array(0, new NextAction("grobbulus move center", ACTION_RAID + 1), NULL)));
triggers.push_back(new TriggerNode(
"grobbulus cloud",
NextAction::array(0, new NextAction("rotate grobbulus", ACTION_RAID + 1), NULL)));
// Heigan the Unclean
triggers.push_back(new TriggerNode(
"heigan melee",
NextAction::array(0, new NextAction("heigan dance melee", ACTION_RAID + 1), NULL)));
triggers.push_back(new TriggerNode(
"heigan ranged",
NextAction::array(0, new NextAction("heigan dance ranged", ACTION_RAID + 1), NULL)));
// Thaddius
// triggers.push_back(new TriggerNode(
// "thaddius phase pet",
// NextAction::array(0,
// new NextAction("thaddius attack nearest pet", ACTION_RAID + 1),
// new NextAction("thaddius melee to place", ACTION_RAID),
// new NextAction("thaddius ranged to place", ACTION_RAID),
// NULL)));
// triggers.push_back(new TriggerNode(
// "thaddius phase pet lose aggro",
// NextAction::array(0, new NextAction("taunt spell", ACTION_RAID + 2), NULL)));
// triggers.push_back(new TriggerNode(
// "thaddius phase transition",
// NextAction::array(0, new NextAction("thaddius move to platform", ACTION_RAID + 1), NULL)));
// triggers.push_back(new TriggerNode(
// "thaddius phase thaddius",
// NextAction::array(0, new NextAction("thaddius move polarity", ACTION_RAID + 1), NULL)));
// // Instructor Razuvious
// triggers.push_back(new TriggerNode(
// "razuvious tank",
// NextAction::array(0, new NextAction("razuvious use obedience crystal", ACTION_RAID + 1), NULL)));
// triggers.push_back(new TriggerNode(
// "razuvious nontank",
// NextAction::array(0, new NextAction("razuvious target", ACTION_RAID + 1), NULL)));
// // four horseman
// triggers.push_back(new TriggerNode(
// "horseman attractors",
// NextAction::array(0, new NextAction("horseman attract alternatively", ACTION_RAID + 1), NULL)));
// triggers.push_back(new TriggerNode(
// "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)));
// triggers.push_back(new TriggerNode(
// "sapphiron chill",
// NextAction::array(0, new NextAction("sapphiron avoid chill", ACTION_RAID + 1), NULL)));
// // Kel'Thuzad
// triggers.push_back(new TriggerNode(
// "kel'thuzad",
// NextAction::array(0,
// new NextAction("kel'thuzad choose target", ACTION_RAID + 1),
// new NextAction("kel'thuzad position", ACTION_RAID + 1),
// NULL)));
// Anub'Rekhan
triggers.push_back(new TriggerNode(
"anub'rekhan",
NextAction::array(0,
// new NextAction("anub'rekhan choose target", ACTION_RAID + 1),
new NextAction("anub'rekhan position", ACTION_RAID + 1),
NULL)));
// // Gluth
// triggers.push_back(new TriggerNode(
// "gluth",
// NextAction::array(0,
// new NextAction("gluth choose target", ACTION_RAID + 1),
// new NextAction("gluth position", ACTION_RAID + 1),
// new NextAction("gluth slowdown", ACTION_RAID),
// NULL)));
// triggers.push_back(new TriggerNode(
// "gluth main tank mortal wound",
// NextAction::array(0,
// new NextAction("taunt spell", ACTION_RAID + 1), NULL)));
// // Loatheb
// triggers.push_back(new TriggerNode(
// "loatheb",
// NextAction::array(0,
// new NextAction("loatheb position", ACTION_RAID + 1),
// new NextAction("loatheb choose target", ACTION_RAID + 1),
// NULL)));
}
void RaidNaxxStrategy::InitMultipliers(std::vector<Multiplier*> &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 InstructorRazuviousGenericMultiplier(ai));
// multipliers.push_back(new KelthuzadGenericMultiplier(ai));
multipliers.push_back(new AnubrekhanGenericMultiplier(botAI));
// multipliers.push_back(new FourhorsemanGenericMultiplier(ai));
// multipliers.push_back(new GothikGenericMultiplier(ai));
// multipliers.push_back(new GluthGenericMultiplier(ai));
}

View File

@@ -0,0 +1,21 @@
#ifndef _PLAYERBOT_RAIDNAXXSTRATEGY_H
#define _PLAYERBOT_RAIDNAXXSTRATEGY_H
#include "Multiplier.h"
#include "AiObjectContext.h"
#include "Strategy.h"
#include "RaidNaxxScripts.h"
class RaidNaxxStrategy : public Strategy
{
public:
RaidNaxxStrategy(PlayerbotAI* ai) : Strategy(ai) {}
virtual std::string const getName() override { return "naxx"; }
virtual void InitTriggers(std::vector<TriggerNode*> &triggers) override;
virtual void InitMultipliers(std::vector<Multiplier*> &multipliers) override;
};
#endif

View File

@@ -0,0 +1,76 @@
// /*
// * Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
// */
#ifndef _PLAYERBOT_RAIDNAXXTRIGGERCONTEXT_H
#define _PLAYERBOT_RAIDNAXXTRIGGERCONTEXT_H
#include "NamedObjectContext.h"
#include "AiObjectContext.h"
#include "RaidNaxxTriggers.h"
class RaidNaxxTriggerContext : public NamedObjectContext<Trigger>
{
public:
RaidNaxxTriggerContext()
{
creators["mutating injection"] = &RaidNaxxTriggerContext::mutating_injection;
creators["mutating injection removed"] = &RaidNaxxTriggerContext::mutating_injection_removed;
creators["grobbulus cloud"] = &RaidNaxxTriggerContext::grobbulus_cloud;
creators["heigan melee"] = &RaidNaxxTriggerContext::heigan_melee;
creators["heigan ranged"] = &RaidNaxxTriggerContext::heigan_ranged;
// creators["thaddius phase pet"] = &RaidNaxxTriggerContext::thaddius_phase_pet;
// creators["thaddius phase pet lose aggro"] = &RaidNaxxTriggerContext::thaddius_phase_pet_lose_aggro;
// creators["thaddius phase transition"] = &RaidNaxxTriggerContext::thaddius_phase_transition;
// creators["thaddius phase thaddius"] = &RaidNaxxTriggerContext::thaddius_phase_thaddius;
// creators["razuvious tank"] = &RaidNaxxTriggerContext::razuvious_tank;
// creators["razuvious nontank"] = &RaidNaxxTriggerContext::razuvious_nontank;
// 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["kel'thuzad"] = &RaidNaxxTriggerContext::kelthuzad;
// creators["kel'thuzad phase two"] = &RaidNaxxTriggerContext::kelthuzad_phase_two;
creators["anub'rekhan"] = &RaidNaxxTriggerContext::anubrekhan;
// creators["gluth"] = &RaidNaxxTriggerContext::gluth;
// creators["gluth main tank mortal wound"] = &RaidNaxxTriggerContext::gluth_main_tank_mortal_wound;
// creators["loatheb"] = &RaidNaxxTriggerContext::loatheb;
}
private:
static Trigger* mutating_injection(PlayerbotAI* ai) { return new MutatingInjectionTrigger(ai); }
static Trigger* mutating_injection_removed(PlayerbotAI* ai) { return new MutatingInjectionRemovedTrigger(ai); }
static Trigger* grobbulus_cloud(PlayerbotAI* ai) { return new GrobbulusCloudTrigger(ai); }
static Trigger* heigan_melee(PlayerbotAI* ai) { return new HeiganMeleeTrigger(ai); }
static Trigger* heigan_ranged(PlayerbotAI* ai) { return new HeiganRangedTrigger(ai); }
// static Trigger* thaddius_phase_pet(PlayerbotAI* ai) { return new ThaddiusPhasePetTrigger(ai); }
// static Trigger* thaddius_phase_pet_lose_aggro(PlayerbotAI* ai) { return new ThaddiusPhasePetLoseAggroTrigger(ai); }
// static Trigger* thaddius_phase_transition(PlayerbotAI* ai) { return new ThaddiusPhaseTransitionTrigger(ai); }
// static Trigger* thaddius_phase_thaddius(PlayerbotAI* ai) { return new ThaddiusPhaseThaddiusTrigger(ai); }
// static Trigger* razuvious_tank(PlayerbotAI* ai) { return new RazuviousTankTrigger(ai); }
// static Trigger* razuvious_nontank(PlayerbotAI* ai) { return new RazuviousNontankTrigger(ai); }
// 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_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); }
static Trigger* anubrekhan(PlayerbotAI* ai) { return new AnubrekhanTrigger(ai); }
// static Trigger* gluth(PlayerbotAI* ai) { return new GluthTrigger(ai); }
// static Trigger* gluth_main_tank_mortal_wound(PlayerbotAI* ai) { return new GluthMainTankMortalWoundTrigger(ai); }
// static Trigger* loatheb(PlayerbotAI* ai) { return new LoathebTrigger(ai); }
};
#endif

View File

@@ -0,0 +1,170 @@
#include "EventMap.h"
#include "Playerbots.h"
#include "RaidNaxxTriggers.h"
#include "ScriptedCreature.h"
bool AuraRemovedTrigger::IsActive() {
bool check = botAI->HasAura(name, bot, false, false, -1, true);
bool ret = false;
if (prev_check && !check) {
ret = true;
}
prev_check = check;
return ret;
}
bool MutatingInjectionRemovedTrigger::IsActive()
{
Unit* boss = AI_VALUE2(Unit*, "find target", "grobbulus");
if (!boss) {
return false;
}
return HasNoAuraTrigger::IsActive() && botAI->GetState() == BOT_STATE_COMBAT && botAI->IsRanged(bot);
}
template<class T>
bool BossEventTrigger<T>::IsActive()
{
Unit* boss = AI_VALUE(Unit*, "boss target");
if (!boss || boss->GetEntry() != boss_entry) {
return false;
}
T* ai = dynamic_cast<T*>(boss->GetAI());
EventMap *eventMap = &ai->events;
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;
}
template<class T>
bool BossPhaseTrigger<T>::IsActive()
{
Unit* boss = AI_VALUE2(Unit*, "find target", boss_name);
if (!boss) {
return false;
}
if (this->phase_mask == 0) {
return true;
}
T* boss_ai = dynamic_cast<T*>(boss->GetAI());
EventMap* eventMap = &boss_ai->events;
uint8 phase_mask = eventMap->GetPhaseMask();
// bot->Yell("phase mask detected: " + to_string(phase_mask) + " compare with " + to_string(this->phase_mask), LANG_UNIVERSAL);
return phase_mask == this->phase_mask;
}
bool GrobbulusCloudTrigger::IsActive()
{
Unit* boss = AI_VALUE(Unit*, "boss target");
if (!boss || boss->GetEntry() != boss_entry) {
return false;
}
if (!botAI->IsMainTank(bot)) {
return false;
}
// bot->Yell("has aggro on " + boss->GetName() + " : " + to_string(AI_VALUE2(bool, "has aggro", "boss target")), LANG_UNIVERSAL);
return AI_VALUE2(bool, "has aggro", "boss target");
}
bool HeiganMeleeTrigger::IsActive()
{
Unit* heigan = AI_VALUE2(Unit*, "find target", "heigan the unclean");
if (!heigan) {
return false;
}
return !botAI->IsRanged(bot);
}
bool HeiganRangedTrigger::IsActive()
{
Unit* heigan = AI_VALUE2(Unit*, "find target", "heigan the unclean");
if (!heigan) {
return false;
}
return botAI->IsRanged(bot);
}
// bool RazuviousTankTrigger::IsActive()
// {
// Difficulty diff = bot->GetRaidDifficulty();
// if (diff == RAID_DIFFICULTY_10MAN_NORMAL) {
// return BossPhaseTrigger::IsActive() && botAI->IsTank(bot);
// }
// return BossPhaseTrigger::IsActive() && bot->getClass() == CLASS_PRIEST;
// }
// bool RazuviousNontankTrigger::IsActive()
// {
// Difficulty diff = bot->GetRaidDifficulty();
// if (diff == RAID_DIFFICULTY_10MAN_NORMAL) {
// return BossPhaseTrigger::IsActive() && !(botAI->IsTank(bot));
// }
// return BossPhaseTrigger::IsActive() && !(bot->getClass() == CLASS_PRIEST);
// }
// bool HorsemanAttractorsTrigger::IsActive()
// {
// Difficulty diff = bot->GetRaidDifficulty();
// if (diff == RAID_DIFFICULTY_25MAN_NORMAL) {
// return BossPhaseTrigger::IsActive() && (botAI->IsRangedDpsAssistantOfIndex(bot, 0) || botAI->IsHealAssistantOfIndex(bot, 0) ||
// botAI->IsHealAssistantOfIndex(bot, 1) || botAI->IsHealAssistantOfIndex(bot, 2));
// }
// return BossPhaseTrigger::IsActive() && (botAI->IsRangedDpsAssistantOfIndex(bot, 0) || botAI->IsHealAssistantOfIndex(bot, 0));
// }
// bool HorsemanExceptAttractorsTrigger::IsActive()
// {
// return BossPhaseTrigger::IsActive() &&
// !(botAI->IsRangedDpsAssistantOfIndex(bot, 0) || botAI->IsHealAssistantOfIndex(bot, 0) ||
// 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 SapphironGroundExceptMainTankTrigger::IsActive()
// {
// return BossPhaseTrigger::IsActive() && !botAI->IsMainTank(bot);
// }
// bool SapphironFlightTrigger::IsActive()
// {
// return BossPhaseTrigger::IsActive();
// }
// bool SapphironGroundChillTrigger::IsActive()
// {
// return BossPhaseTrigger::IsActive() && !botAI->IsMainTank(bot) && botAI->HasAura("chill", bot);
// }
// bool GluthMainTankMortalWoundTrigger::IsActive()
// {
// if (!BossPhaseTrigger::IsActive()) {
// return false;
// }
// if (!botAI->IsAssistTankOfIndex(bot, 0)) {
// return false;
// }
// Unit* mt = AI_VALUE(Unit*, "main tank");
// if (!mt) {
// return false;
// }
// Aura* aura = botAI->GetAuraWithDuration("mortal wound", mt);
// if (!aura || aura->GetStackAmount() < 5) {
// return false;
// }
// // bot->Yell("Time to taunt!", LANG_UNIVERSAL);
// return true;
// }
template bool BossEventTrigger<boss_grobbulus::boss_grobbulusAI>::IsActive();
template bool BossPhaseTrigger<boss_anubrekhan::boss_anubrekhanAI>::IsActive();

View File

@@ -0,0 +1,209 @@
#ifndef _PLAYERBOT_RAIDNAXXTRIGGERS_H
#define _PLAYERBOT_RAIDNAXXTRIGGERS_H
#include "EventMap.h"
#include "Trigger.h"
#include "PlayerbotAIConfig.h"
#include "GenericTriggers.h"
#include "RaidNaxxScripts.h"
using namespace std;
class MutatingInjectionTrigger : public HasAuraTrigger
{
public:
MutatingInjectionTrigger(PlayerbotAI* ai): HasAuraTrigger(ai, "mutating injection", 1) {}
};
class AuraRemovedTrigger : public Trigger
{
public:
AuraRemovedTrigger(PlayerbotAI* botAI, string name): Trigger(botAI, name, 1) {
this->prev_check = false;
}
virtual bool IsActive() override;
protected:
bool prev_check;
};
class MutatingInjectionRemovedTrigger : public HasNoAuraTrigger
{
public:
MutatingInjectionRemovedTrigger(PlayerbotAI* ai): HasNoAuraTrigger(ai, "mutating injection") {}
virtual bool IsActive();
};
template<class T>
class BossEventTrigger : public Trigger
{
public:
BossEventTrigger(PlayerbotAI* ai, uint32 boss_entry, uint32 event_id, string name = "boss event"): Trigger(ai, name, 1) {
this->boss_entry = boss_entry;
this->event_id = event_id;
this->last_event_time = -1;
}
virtual bool IsActive();
protected:
uint32 boss_entry, event_id, last_event_time;
};
template<class T>
class BossPhaseTrigger : public Trigger
{
public:
BossPhaseTrigger(PlayerbotAI* ai, string boss_name, uint32 phase_mask, string name = "boss event"): Trigger(ai, name, 1) {
this->boss_name = boss_name;
this->phase_mask = phase_mask;
}
virtual bool IsActive();
protected:
string boss_name;
uint32 phase_mask;
};
class GrobbulusCloudTrigger : public BossEventTrigger<boss_grobbulus::boss_grobbulusAI>
{
public:
GrobbulusCloudTrigger(PlayerbotAI* ai): BossEventTrigger(ai, 15931, 2, "grobbulus cloud event") { }
virtual bool IsActive();
};
class HeiganMeleeTrigger : public Trigger
{
public:
HeiganMeleeTrigger(PlayerbotAI* ai): Trigger(ai, "heigan melee") {}
virtual bool IsActive();
};
class HeiganRangedTrigger : public Trigger
{
public:
HeiganRangedTrigger(PlayerbotAI* ai): Trigger(ai, "heigan ranged") {}
virtual bool IsActive();
};
// class ThaddiusPhasePetTrigger : public BossPhaseTrigger
// {
// public:
// ThaddiusPhasePetTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "thaddius", 1 << (2 - 1), "thaddius phase pet") {}
// };
// class ThaddiusPhasePetLoseAggroTrigger : public ThaddiusPhasePetTrigger
// {
// public:
// ThaddiusPhasePetLoseAggroTrigger(PlayerbotAI* ai) : ThaddiusPhasePetTrigger(ai) {}
// virtual bool IsActive() {
// Unit* target = AI_VALUE(Unit*, "current target");
// return ThaddiusPhasePetTrigger::IsActive() && ai->IsTank(bot) && target && target->GetVictim() != bot;
// }
// };
// class ThaddiusPhaseTransitionTrigger : public BossPhaseTrigger
// {
// public:
// ThaddiusPhaseTransitionTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "thaddius", 1 << (3 - 1), "thaddius phase transition") {}
// };
// class ThaddiusPhaseThaddiusTrigger : public BossPhaseTrigger
// {
// public:
// ThaddiusPhaseThaddiusTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "thaddius", 1 << (4 - 1), "thaddius phase thaddius") {}
// };
// class RazuviousTankTrigger : public BossPhaseTrigger
// {
// public:
// RazuviousTankTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "instructor razuvious", 0, "razuvious tank") {}
// virtual bool IsActive();
// };
// class RazuviousNontankTrigger : public BossPhaseTrigger
// {
// public:
// RazuviousNontankTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "instructor razuvious", 0, "razuvious nontank") {}
// virtual bool IsActive();
// };
// class HorsemanAttractorsTrigger : public BossPhaseTrigger
// {
// public:
// HorsemanAttractorsTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "sir zeliek", 0, "horseman attractors") {}
// virtual bool IsActive();
// };
// class HorsemanExceptAttractorsTrigger : public BossPhaseTrigger
// {
// public:
// HorsemanExceptAttractorsTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "sir zeliek", 0, "horseman except attractors") {}
// 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 SapphironGroundExceptMainTankTrigger : public BossPhaseTrigger
// {
// public:
// SapphironGroundExceptMainTankTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "sapphiron", (1 << (2 - 1)), "sapphiron ground except main tank") {}
// virtual bool IsActive();
// };
// class SapphironFlightTrigger : public BossPhaseTrigger
// {
// public:
// SapphironFlightTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "sapphiron", (1 << (3 - 1)), "sapphiron flight") {}
// virtual bool IsActive();
// };
// class SapphironGroundChillTrigger : public BossPhaseTrigger
// {
// public:
// SapphironGroundChillTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "sapphiron", 0, "sapphiron chill") {}
// virtual bool IsActive();
// };
// class KelthuzadTrigger : public BossPhaseTrigger
// {
// public:
// KelthuzadTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "kel'thuzad", 0, "kel'thuzad trigger") {}
// };
class AnubrekhanTrigger : public BossPhaseTrigger<boss_anubrekhan::boss_anubrekhanAI>
{
public:
AnubrekhanTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "anub'rekhan", 0, "anub'rekhan trigger") {}
};
// class KelthuzadPhaseTwoTrigger : public BossPhaseTrigger
// {
// public:
// KelthuzadPhaseTwoTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "kel'thuzad", 1 << (2 - 1), "kel'thuzad trigger") {}
// };
// class GluthTrigger : public BossPhaseTrigger
// {
// public:
// GluthTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "gluth", 0, "gluth trigger") {}
// };
// class GluthMainTankMortalWoundTrigger : public BossPhaseTrigger
// {
// public:
// GluthMainTankMortalWoundTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "gluth", 0, "gluth main tank mortal wound trigger") {}
// virtual bool IsActive();
// };
// class LoathebTrigger : public BossPhaseTrigger
// {
// public:
// LoathebTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "loatheb", 0, "loatheb trigger") {}
// };
// template BossEventTrigger<class boss_grobbulus::boss_grobbulusAI>;
#endif