mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
another related core refactor fixes
This commit is contained in:
@@ -57,8 +57,14 @@ uint32 GrobbulusRotateAction::GetCurrWaypoint()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
EventMap* eventMap = &boss_ai->events;
|
EventMap* eventMap = &boss_ai->events;
|
||||||
const uint32 event_time = eventMap->GetNextEventTime(2);
|
|
||||||
return (event_time / 15000) % intervals;
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HeiganDanceAction::CalculateSafe()
|
bool HeiganDanceAction::CalculateSafe()
|
||||||
@@ -73,12 +79,17 @@ bool HeiganDanceAction::CalculateSafe()
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventMap* eventMap = &boss_ai->events;
|
EventMap* eventMap = &boss_ai->events;
|
||||||
uint32 curr_phase = boss_ai->currentPhase;
|
uint32 curr_phase = boss_ai->currentPhase;
|
||||||
uint32 curr_erupt = eventMap->GetNextEventTime(3);
|
|
||||||
uint32 curr_dance = eventMap->GetNextEventTime(4);
|
// Get remaining time until events
|
||||||
uint32 curr_timer = eventMap->GetTimer();
|
Milliseconds curr_erupt = eventMap->GetTimeUntilEvent(3);
|
||||||
if ((curr_phase == 0 && curr_dance - curr_timer >= 85000) || (curr_phase == 1 && curr_dance - curr_timer >= 40000))
|
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)))
|
||||||
{
|
{
|
||||||
ResetSafe();
|
ResetSafe();
|
||||||
}
|
}
|
||||||
@@ -86,8 +97,11 @@ bool HeiganDanceAction::CalculateSafe()
|
|||||||
{
|
{
|
||||||
NextSafe();
|
NextSafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save previous values
|
||||||
prev_phase = curr_phase;
|
prev_phase = curr_phase;
|
||||||
prev_erupt = curr_erupt;
|
prev_erupt = curr_erupt;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1113,4 +1127,4 @@ bool LoathebChooseTargetAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Attack(target);
|
return Attack(target);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RaidNaxxBossHelper.h"
|
#include "RaidNaxxBossHelper.h"
|
||||||
#include "RaidNaxxScripts.h"
|
#include "RaidNaxxScripts.h"
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
|
||||||
// just for test
|
// just for test
|
||||||
// class TryToGetBossAIAction : public Action
|
// class TryToGetBossAIAction : public Action
|
||||||
@@ -62,8 +63,8 @@ public:
|
|||||||
HeiganDanceAction(PlayerbotAI* ai) : MovementAction(ai, "heigan dance")
|
HeiganDanceAction(PlayerbotAI* ai) : MovementAction(ai, "heigan dance")
|
||||||
{
|
{
|
||||||
this->prev_phase = 0;
|
this->prev_phase = 0;
|
||||||
this->prev_erupt = 0;
|
this->prev_erupt = Milliseconds(0);
|
||||||
this->prev_timer = 0;
|
this->prev_timer = Milliseconds(0);
|
||||||
ResetSafe();
|
ResetSafe();
|
||||||
waypoints.push_back(std::make_pair(2794.88f, -3668.12f));
|
waypoints.push_back(std::make_pair(2794.88f, -3668.12f));
|
||||||
waypoints.push_back(std::make_pair(2775.49f, -3674.43f));
|
waypoints.push_back(std::make_pair(2775.49f, -3674.43f));
|
||||||
@@ -86,7 +87,8 @@ protected:
|
|||||||
curr_dir = -curr_dir;
|
curr_dir = -curr_dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint32 prev_phase, prev_erupt, prev_timer;
|
uint32 prev_phase;
|
||||||
|
Milliseconds prev_erupt, prev_timer;
|
||||||
uint32 curr_safe, curr_dir;
|
uint32 curr_safe, curr_dir;
|
||||||
std::vector<std::pair<float, float>> waypoints;
|
std::vector<std::pair<float, float>> waypoints;
|
||||||
};
|
};
|
||||||
@@ -321,4 +323,4 @@ private:
|
|||||||
LoathebBossHelper helper;
|
LoathebBossHelper helper;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_timer = 0; //_event_map->GetTimer(); TODO: change back, still testing
|
_timer = _event_map->GetTimer();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual void Reset()
|
virtual void Reset()
|
||||||
@@ -218,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;
|
||||||
Milliseconds lastEventGround = 0ms;
|
Milliseconds lastEventGround = Milliseconds(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GluthBossHelper : public GenericBossHelper<Gluth::boss_gluth::boss_gluthAI>
|
class GluthBossHelper : public GenericBossHelper<Gluth::boss_gluth::boss_gluthAI>
|
||||||
@@ -298,7 +298,7 @@ public:
|
|||||||
lady = nullptr;
|
lady = nullptr;
|
||||||
ladyAI = nullptr;
|
ladyAI = nullptr;
|
||||||
ladyEvent = nullptr;
|
ladyEvent = nullptr;
|
||||||
lastEventVoidZone = 0ms;
|
lastEventVoidZone = Milliseconds(0);
|
||||||
voidZoneCounter = 0;
|
voidZoneCounter = 0;
|
||||||
posToGo = 0;
|
posToGo = 0;
|
||||||
}
|
}
|
||||||
@@ -367,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;
|
||||||
Milliseconds lastEventVoidZone = 0ms;
|
Milliseconds lastEventVoidZone = Milliseconds(0);
|
||||||
uint32 voidZoneCounter = 0;
|
uint32 voidZoneCounter = 0;
|
||||||
int posToGo = 0;
|
int posToGo = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "ShamanActions.h"
|
#include "ShamanActions.h"
|
||||||
#include "UseMeetingStoneAction.h"
|
#include "UseMeetingStoneAction.h"
|
||||||
#include "WarriorActions.h"
|
#include "WarriorActions.h"
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
|
||||||
float GrobbulusMultiplier::GetValue(Action* action)
|
float GrobbulusMultiplier::GetValue(Action* action)
|
||||||
{
|
{
|
||||||
@@ -48,16 +49,20 @@ float HeiganDanceMultiplier::GetValue(Action* action)
|
|||||||
}
|
}
|
||||||
EventMap* eventMap = &boss_ai->events;
|
EventMap* eventMap = &boss_ai->events;
|
||||||
uint32 curr_phase = boss_ai->currentPhase;
|
uint32 curr_phase = boss_ai->currentPhase;
|
||||||
uint32 curr_dance = eventMap->GetNextEventTime(4);
|
|
||||||
uint32 curr_timer = eventMap->GetTimer();
|
// Get remaining time until events
|
||||||
uint32 curr_erupt = eventMap->GetNextEventTime(3);
|
Milliseconds curr_dance = eventMap->GetTimeUntilEvent(4);
|
||||||
|
Milliseconds curr_erupt = eventMap->GetTimeUntilEvent(3);
|
||||||
|
|
||||||
if (dynamic_cast<CombatFormationMoveAction*>(action) ||
|
if (dynamic_cast<CombatFormationMoveAction*>(action) ||
|
||||||
dynamic_cast<CastDisengageAction*>(action) ||
|
dynamic_cast<CastDisengageAction*>(action) ||
|
||||||
dynamic_cast<CastBlinkBackAction*>(action) )
|
dynamic_cast<CastBlinkBackAction*>(action))
|
||||||
{
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
if (curr_phase != 1 && (int32)curr_dance - curr_timer >= 3000)
|
|
||||||
|
// Replace old subtraction with direct comparison
|
||||||
|
if (curr_phase != 1 && curr_dance >= Milliseconds(3000))
|
||||||
{
|
{
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
#include "Trigger.h"
|
#include "Trigger.h"
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
|
||||||
bool AuraRemovedTrigger::IsActive()
|
bool AuraRemovedTrigger::IsActive()
|
||||||
{
|
{
|
||||||
@@ -41,12 +42,16 @@ bool BossEventTrigger<T>::IsActive()
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const uint32 event_time = eventMap->GetNextEventTime(event_id);
|
Milliseconds event_time = eventMap->GetTimeUntilEvent(event_id);
|
||||||
if (event_time != last_event_time)
|
if (event_time == Milliseconds::max())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (last_event_time.count() == 0 || event_time != last_event_time)
|
||||||
{
|
{
|
||||||
last_event_time = event_time;
|
last_event_time = event_time;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,12 +41,13 @@ public:
|
|||||||
{
|
{
|
||||||
this->boss_entry = boss_entry;
|
this->boss_entry = boss_entry;
|
||||||
this->event_id = event_id;
|
this->event_id = event_id;
|
||||||
this->last_event_time = -1;
|
this->last_event_time = Milliseconds(0);
|
||||||
}
|
}
|
||||||
virtual bool IsActive();
|
virtual bool IsActive();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint32 boss_entry, event_id, last_event_time;
|
uint32 boss_entry, event_id;
|
||||||
|
Milliseconds last_event_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GrobbulusCloudTrigger : public BossEventTrigger<Grobbulus::boss_grobbulus::boss_grobbulusAI>
|
class GrobbulusCloudTrigger : public BossEventTrigger<Grobbulus::boss_grobbulus::boss_grobbulusAI>
|
||||||
@@ -221,4 +222,4 @@ private:
|
|||||||
LoathebBossHelper helper;
|
LoathebBossHelper helper;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user