grobbulus fixed

This commit is contained in:
Yunfan Li
2023-06-09 23:19:33 +08:00
parent 634ce3d183
commit b11fad1a46
9 changed files with 54 additions and 32 deletions

View File

@@ -99,8 +99,8 @@ uint32 RotateGrobbulusAction::GetCurrWaypoint()
if (!boss) {
return false;
}
BossAI* boss_ai = dynamic_cast<BossAI*>(boss->GetAI());
EventMap* eventMap = boss_ai->GetEvents();
auto* boss_ai = dynamic_cast<boss_grobbulus::boss_grobbulusAI*>(boss->GetAI());
EventMap* eventMap = &boss_ai->events;
const uint32 event_time = eventMap->GetNextEventTime(2);
return (event_time / 15000) % intervals;
}
@@ -116,7 +116,7 @@ bool HeiganDanceAction::CalculateSafe() {
uint32 curr_erupt = eventMap->GetNextEventTime(3);
uint32 curr_dance = eventMap->GetNextEventTime(4);
uint32 curr_timer = eventMap->GetTimer();
if ((curr_phase == PHASE_SLOW_DANCE && curr_dance - curr_timer >= 80000) || (curr_phase == PHASE_FAST_DANCE && curr_dance - curr_timer >= 40000)) {
if ((curr_phase == 0 && curr_dance - curr_timer >= 80000) || (curr_phase == 1 && curr_dance - curr_timer >= 40000)) {
ResetSafe();
} else if (curr_erupt != prev_erupt) {
NextSafe();
@@ -128,16 +128,15 @@ bool HeiganDanceAction::CalculateSafe() {
bool HeiganDanceMeleeAction::Execute(Event event) {
CalculateSafe();
if (prev_phase == PHASE_SLOW_DANCE && botAI->IsMainTank(bot) && !AI_VALUE2(bool, "has aggro", "boss target")) {
if (prev_phase == 0 && botAI->IsMainTank(bot) && !AI_VALUE2(bool, "has aggro", "boss target")) {
return false;
}
// botAI->TellMaster("Let\'s go " + std::to_string(curr_safe));
return MoveInside(bot->GetMapId(), waypoints[curr_safe].first, waypoints[curr_safe].second, bot->GetPositionZ(), botAI->IsMainTank(bot) ? 0 : 0);
}
bool HeiganDanceRangedAction::Execute(Event event) {
CalculateSafe();
if (prev_phase != PHASE_FAST_DANCE) {
if (prev_phase != 1) {
return MoveTo(bot->GetMapId(), platform.first, platform.second, 276.54f);
}
botAI->InterruptSpell();

View File

@@ -5,6 +5,8 @@
#include "MovementActions.h"
#include "AttackAction.h"
#include "GenericActions.h"
#include "PlayerbotAI.h"
#include "Playerbots.h"
// just for test
// class TryToGetBossAIAction : public Action

View File

@@ -35,7 +35,7 @@ float HeiganDanceMultiplier::GetValue(Action* action)
if (dynamic_cast<SetBehindTargetAction*>(action)) {
return 0.0f;
}
if (curr_phase != PHASE_FAST_DANCE && (int32)curr_dance - curr_timer >= 3000) {
if (curr_phase != 1 && (int32)curr_dance - curr_timer >= 3000) {
return 1.0f;
}
if (dynamic_cast<HeiganDanceAction*>(action) || dynamic_cast<CurePartyMemberAction*>(action)) {

View File

@@ -1,3 +1,4 @@
#include "EventMap.h"
#include "Playerbots.h"
#include "RaidNaxxTrigger.h"
#include "ScriptedCreature.h"
@@ -21,12 +22,15 @@ bool MutatingInjectionRemovedTrigger::IsActive()
return HasNoAuraTrigger::IsActive() && botAI->GetState() == BOT_STATE_COMBAT && botAI->IsRanged(bot);
}
bool BossEventTrigger::IsActive()
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;
}
@@ -54,18 +58,18 @@ bool BossEventTrigger::IsActive()
// 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 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()
{
@@ -159,4 +163,6 @@ bool HeiganRangedTrigger::IsActive()
// }
// // bot->Yell("Time to taunt!", LANG_UNIVERSAL);
// return true;
// }
// }
template bool BossEventTrigger<boss_grobbulus::boss_grobbulusAI>::IsActive();

View File

@@ -34,6 +34,7 @@ public:
virtual bool IsActive();
};
template<class T>
class BossEventTrigger : public Trigger
{
public:
@@ -45,7 +46,6 @@ public:
virtual bool IsActive();
protected:
uint32 boss_entry, event_id, last_event_time;
EventMap *eventMap;
};
class BossPhaseTrigger : public Trigger
@@ -61,12 +61,10 @@ protected:
uint32 phase_mask;
};
class GrobbulusCloudTrigger : public BossEventTrigger
class GrobbulusCloudTrigger : public BossEventTrigger<boss_grobbulus::boss_grobbulusAI>
{
public:
GrobbulusCloudTrigger(PlayerbotAI* ai): BossEventTrigger(ai, 15931, 2, "grobbulus cloud event") {
this->eventMap = boss_grobbulus::boss_grobbulusAI
}
GrobbulusCloudTrigger(PlayerbotAI* ai): BossEventTrigger(ai, 15931, 2, "grobbulus cloud event") { }
virtual bool IsActive();
};
@@ -205,4 +203,6 @@ public:
// LoathebTrigger(PlayerbotAI* ai) : BossPhaseTrigger(ai, "loatheb", 0, "loatheb trigger") {}
// };
// template BossEventTrigger<class boss_grobbulus::boss_grobbulusAI>;
#endif

View File

@@ -195,8 +195,8 @@ class TriggerContext : public NamedObjectContext<Trigger>
creators["rpg duel"] = &TriggerContext::rpg_duel;
creators["mutating injection"] = &TriggerContext::mutating_injection;
// creators["mutating injection removed"] = &TriggerContext::mutating_injection_removed;
// creators["grobbulus cloud"] = &TriggerContext::grobbulus_cloud;
creators["mutating injection removed"] = &TriggerContext::mutating_injection_removed;
creators["grobbulus cloud"] = &TriggerContext::grobbulus_cloud;
creators["heigan melee"] = &TriggerContext::heigan_melee;
creators["heigan ranged"] = &TriggerContext::heigan_ranged;
@@ -367,8 +367,8 @@ class TriggerContext : public NamedObjectContext<Trigger>
static Trigger* rpg_duel(PlayerbotAI* botAI) { return new RpgDuelTrigger(botAI); }
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* 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); }