Revert "another related core refactor fixes"

This reverts commit bcc173d920.
This commit is contained in:
bash
2025-10-19 03:27:04 +02:00
parent bcc173d920
commit 0a88aa9abe
6 changed files with 25 additions and 52 deletions

View File

@@ -57,14 +57,8 @@ uint32 GrobbulusRotateAction::GetCurrWaypoint()
return false;
}
EventMap* eventMap = &boss_ai->events;
// avoids division/modulo by zero
if (!eventMap->HasTimeUntilEvent(2) || intervals == 0)
return 0;
const Milliseconds event_time = eventMap->GetTimeUntilEvent(2);
uint32 event_ms = static_cast<uint32>(event_time.count());
return (event_ms / 15000) % intervals;
const uint32 event_time = eventMap->GetNextEventTime(2);
return (event_time / 15000) % intervals;
}
bool HeiganDanceAction::CalculateSafe()
@@ -79,17 +73,12 @@ bool HeiganDanceAction::CalculateSafe()
{
return false;
}
EventMap* eventMap = &boss_ai->events;
uint32 curr_phase = boss_ai->currentPhase;
// Get remaining time until events
Milliseconds curr_erupt = eventMap->GetTimeUntilEvent(3);
Milliseconds curr_dance = eventMap->GetTimeUntilEvent(4);
// Replace timer subtraction with the fact that GetTimeUntilEvent() already gives remaining time
if ((curr_phase == 0 && curr_dance >= Milliseconds(85000)) ||
(curr_phase == 1 && curr_dance >= Milliseconds(40000)))
uint32 curr_erupt = eventMap->GetNextEventTime(3);
uint32 curr_dance = eventMap->GetNextEventTime(4);
uint32 curr_timer = eventMap->GetTimer();
if ((curr_phase == 0 && curr_dance - curr_timer >= 85000) || (curr_phase == 1 && curr_dance - curr_timer >= 40000))
{
ResetSafe();
}
@@ -97,11 +86,8 @@ bool HeiganDanceAction::CalculateSafe()
{
NextSafe();
}
// Save previous values
prev_phase = curr_phase;
prev_erupt = curr_erupt;
return true;
}
@@ -1127,4 +1113,4 @@ bool LoathebChooseTargetAction::Execute(Event event)
return false;
}
return Attack(target);
}
}

View File

@@ -9,7 +9,6 @@
#include "Playerbots.h"
#include "RaidNaxxBossHelper.h"
#include "RaidNaxxScripts.h"
#include "SharedDefines.h"
// just for test
// class TryToGetBossAIAction : public Action
@@ -63,8 +62,8 @@ public:
HeiganDanceAction(PlayerbotAI* ai) : MovementAction(ai, "heigan dance")
{
this->prev_phase = 0;
this->prev_erupt = Milliseconds(0);
this->prev_timer = Milliseconds(0);
this->prev_erupt = 0;
this->prev_timer = 0;
ResetSafe();
waypoints.push_back(std::make_pair(2794.88f, -3668.12f));
waypoints.push_back(std::make_pair(2775.49f, -3674.43f));
@@ -87,8 +86,7 @@ protected:
curr_dir = -curr_dir;
}
}
uint32 prev_phase;
Milliseconds prev_erupt, prev_timer;
uint32 prev_phase, prev_erupt, prev_timer;
uint32 curr_safe, curr_dir;
std::vector<std::pair<float, float>> waypoints;
};
@@ -323,4 +321,4 @@ private:
LoathebBossHelper helper;
};
#endif
#endif

View File

@@ -60,7 +60,7 @@ public:
{
return false;
}
_timer = _event_map->GetTimer();
_timer = 0; //_event_map->GetTimer(); TODO: change back, still testing
return true;
}
virtual void Reset()
@@ -218,7 +218,7 @@ public:
private:
const uint32 POSITION_TIME_AFTER_LANDED = 5000;
const uint32 EVENT_FLIGHT_INTERVAL = 45000;
Milliseconds lastEventGround = Milliseconds(0);
Milliseconds lastEventGround = 0ms;
};
class GluthBossHelper : public GenericBossHelper<Gluth::boss_gluth::boss_gluthAI>
@@ -298,7 +298,7 @@ public:
lady = nullptr;
ladyAI = nullptr;
ladyEvent = nullptr;
lastEventVoidZone = Milliseconds(0);
lastEventVoidZone = 0ms;
voidZoneCounter = 0;
posToGo = 0;
}
@@ -367,7 +367,7 @@ protected:
Unit* lady = nullptr;
FourHorsemen::boss_four_horsemen::boss_four_horsemenAI* ladyAI = nullptr;
EventMap* ladyEvent = nullptr;
Milliseconds lastEventVoidZone = Milliseconds(0);
Milliseconds lastEventVoidZone = 0ms;
uint32 voidZoneCounter = 0;
int posToGo = 0;
};

View File

@@ -19,7 +19,6 @@
#include "ShamanActions.h"
#include "UseMeetingStoneAction.h"
#include "WarriorActions.h"
#include "SharedDefines.h"
float GrobbulusMultiplier::GetValue(Action* action)
{
@@ -49,20 +48,16 @@ float HeiganDanceMultiplier::GetValue(Action* action)
}
EventMap* eventMap = &boss_ai->events;
uint32 curr_phase = boss_ai->currentPhase;
// Get remaining time until events
Milliseconds curr_dance = eventMap->GetTimeUntilEvent(4);
Milliseconds curr_erupt = eventMap->GetTimeUntilEvent(3);
uint32 curr_dance = eventMap->GetNextEventTime(4);
uint32 curr_timer = eventMap->GetTimer();
uint32 curr_erupt = eventMap->GetNextEventTime(3);
if (dynamic_cast<CombatFormationMoveAction*>(action) ||
dynamic_cast<CastDisengageAction*>(action) ||
dynamic_cast<CastBlinkBackAction*>(action))
dynamic_cast<CastBlinkBackAction*>(action) )
{
return 0.0f;
}
// Replace old subtraction with direct comparison
if (curr_phase != 1 && curr_dance >= Milliseconds(3000))
if (curr_phase != 1 && (int32)curr_dance - curr_timer >= 3000)
{
return 1.0f;
}

View File

@@ -4,7 +4,6 @@
#include "Playerbots.h"
#include "ScriptedCreature.h"
#include "Trigger.h"
#include "SharedDefines.h"
bool AuraRemovedTrigger::IsActive()
{
@@ -42,16 +41,12 @@ bool BossEventTrigger<T>::IsActive()
{
return false;
}
Milliseconds event_time = eventMap->GetTimeUntilEvent(event_id);
if (event_time == Milliseconds::max())
return false;
if (last_event_time.count() == 0 || event_time != last_event_time)
const uint32 event_time = eventMap->GetNextEventTime(event_id);
if (event_time != last_event_time)
{
last_event_time = event_time;
return true;
}
return false;
}

View File

@@ -41,13 +41,12 @@ public:
{
this->boss_entry = boss_entry;
this->event_id = event_id;
this->last_event_time = Milliseconds(0);
this->last_event_time = -1;
}
virtual bool IsActive();
protected:
uint32 boss_entry, event_id;
Milliseconds last_event_time;
uint32 boss_entry, event_id, last_event_time;
};
class GrobbulusCloudTrigger : public BossEventTrigger<Grobbulus::boss_grobbulus::boss_grobbulusAI>
@@ -222,4 +221,4 @@ private:
LoathebBossHelper helper;
};
#endif
#endif