core eventMap has been refactored

This commit is contained in:
bash
2025-10-17 20:17:45 +02:00
parent f791ab61c4
commit 4c87a04201

View File

@@ -60,7 +60,7 @@ public:
{ {
return false; return false;
} }
_timer = _event_map->GetTimer(); _timer = 0; //_event_map->GetTimer(); TODO: change back, still testing
return true; return true;
} }
virtual void Reset() virtual void Reset()
@@ -88,8 +88,15 @@ public:
const std::pair<float, float> center = {3716.19f, -5106.58f}; const std::pair<float, float> center = {3716.19f, -5106.58f};
const std::pair<float, float> tank_pos = {3709.19f, -5104.86f}; const std::pair<float, float> tank_pos = {3709.19f, -5104.86f};
const std::pair<float, float> assist_tank_pos = {3746.05f, -5112.74f}; const std::pair<float, float> assist_tank_pos = {3746.05f, -5112.74f};
bool IsPhaseOne() { return _event_map->GetNextEventTime(Kelthuzad::EVENT_PHASE_2) != 0; } bool IsPhaseOne()
bool IsPhaseTwo() { return !IsPhaseOne(); } {
return !_event_map->IsInPhase(Kelthuzad::EVENT_PHASE_2) &&
!_event_map->IsInPhase(Kelthuzad::EVENT_PHASE_3);
}
bool IsPhaseTwo()
{
return _event_map->IsInPhase(Kelthuzad::EVENT_PHASE_2);
}
Unit* GetAnyShadowFissure() Unit* GetAnyShadowFissure()
{ {
Unit* shadow_fissure = nullptr; Unit* shadow_fissure = nullptr;
@@ -124,22 +131,31 @@ public:
bool UpdateBossAI() override bool UpdateBossAI() override
{ {
if (!GenericBossHelper::UpdateBossAI()) if (!GenericBossHelper::UpdateBossAI())
{
return false; return false;
}
uint32 nextEventGround = _event_map->GetNextEventTime(Sapphiron::EVENT_GROUND); Milliseconds nextEventGround = _event_map->GetTimeUntilEvent(Sapphiron::EVENT_GROUND);
if (nextEventGround && nextEventGround != lastEventGround)
// Only update if the event exists and is different from the last stored time
if (nextEventGround != Milliseconds::max() && nextEventGround != lastEventGround)
lastEventGround = nextEventGround; lastEventGround = nextEventGround;
return true; return true;
} }
bool IsPhaseGround() { return _target->GetReactState() == REACT_AGGRESSIVE; } bool IsPhaseGround() { return _target->GetReactState() == REACT_AGGRESSIVE; }
bool IsPhaseFlight() { return !IsPhaseGround(); } bool IsPhaseFlight() { return !IsPhaseGround(); }
bool JustLanded() bool JustLanded()
{ {
return (_event_map->GetNextEventTime(Sapphiron::EVENT_FLIGHT_START) - _timer) >= Milliseconds timeUntilFlightStart = _event_map->GetTimeUntilEvent(Sapphiron::EVENT_FLIGHT_START);
EVENT_FLIGHT_INTERVAL - POSITION_TIME_AFTER_LANDED;
if (timeUntilFlightStart == Milliseconds::max())
return false; // event not scheduled
return timeUntilFlightStart >= Milliseconds(EVENT_FLIGHT_INTERVAL - POSITION_TIME_AFTER_LANDED);
}
bool WaitForExplosion()
{
return _event_map->GetTimeUntilEvent(Sapphiron::EVENT_FLIGHT_SPELL_EXPLOSION) != Milliseconds::max();
} }
bool WaitForExplosion() { return _event_map->GetNextEventTime(Sapphiron::EVENT_FLIGHT_SPELL_EXPLOSION); }
bool FindPosToAvoidChill(std::vector<float>& dest) bool FindPosToAvoidChill(std::vector<float>& dest)
{ {
Aura* aura = botAI->GetAura("chill", bot); Aura* aura = botAI->GetAura("chill", bot);
@@ -202,7 +218,7 @@ public:
private: private:
const uint32 POSITION_TIME_AFTER_LANDED = 5000; const uint32 POSITION_TIME_AFTER_LANDED = 5000;
const uint32 EVENT_FLIGHT_INTERVAL = 45000; const uint32 EVENT_FLIGHT_INTERVAL = 45000;
uint32 lastEventGround = 0; Milliseconds lastEventGround = 0ms;
}; };
class GluthBossHelper : public GenericBossHelper<Gluth::boss_gluth::boss_gluthAI> class GluthBossHelper : public GenericBossHelper<Gluth::boss_gluth::boss_gluthAI>
@@ -220,8 +236,12 @@ public:
GluthBossHelper(PlayerbotAI* botAI) : GenericBossHelper(botAI, "gluth") {} GluthBossHelper(PlayerbotAI* botAI) : GenericBossHelper(botAI, "gluth") {}
bool BeforeDecimate() bool BeforeDecimate()
{ {
uint32 decimate = _event_map->GetNextEventTime(Gluth::EVENT_DECIMATE); Milliseconds timeUntilDecimate = _event_map->GetTimeUntilEvent(Gluth::EVENT_DECIMATE);
return decimate && decimate - _timer <= 3000;
if (timeUntilDecimate == Milliseconds::max())
return false; // event not scheduled
return timeUntilDecimate <= Milliseconds(3000);
} }
bool JustStartCombat() { return _timer < 10000; } bool JustStartCombat() { return _timer < 10000; }
}; };
@@ -263,11 +283,10 @@ public:
return true; return true;
} }
ladyEvent = &ladyAI->events; ladyEvent = &ladyAI->events;
const uint32 voidZone = ladyEvent->GetNextEventTime(FourHorsemen::EVENT_SECONDARY_SPELL); if (Milliseconds voidZone = ladyEvent->GetTimeUntilEvent(FourHorsemen::EVENT_SECONDARY_SPELL);
if (voidZone && lastEventVoidZone != voidZone) voidZone != Milliseconds::max() && lastEventVoidZone != voidZone)
{ {
voidZoneCounter++; voidZoneCounter = (voidZoneCounter + 1) % 8;
voidZoneCounter %= 8;
lastEventVoidZone = voidZone; lastEventVoidZone = voidZone;
} }
return true; return true;
@@ -279,7 +298,7 @@ public:
lady = nullptr; lady = nullptr;
ladyAI = nullptr; ladyAI = nullptr;
ladyEvent = nullptr; ladyEvent = nullptr;
lastEventVoidZone = 0; lastEventVoidZone = 0ms;
voidZoneCounter = 0; voidZoneCounter = 0;
posToGo = 0; posToGo = 0;
} }
@@ -348,7 +367,7 @@ protected:
Unit* lady = nullptr; Unit* lady = nullptr;
FourHorsemen::boss_four_horsemen::boss_four_horsemenAI* ladyAI = nullptr; FourHorsemen::boss_four_horsemen::boss_four_horsemenAI* ladyAI = nullptr;
EventMap* ladyEvent = nullptr; EventMap* ladyEvent = nullptr;
uint32 lastEventVoidZone = 0; Milliseconds lastEventVoidZone = 0ms;
uint32 voidZoneCounter = 0; uint32 voidZoneCounter = 0;
int posToGo = 0; int posToGo = 0;
}; };