Updated Bot AI to make use of neglected commands/features

This commit is contained in:
Uleat
2019-10-05 18:17:23 -04:00
parent b118864920
commit 12204dd927
10 changed files with 1377 additions and 534 deletions
+46 -13
View File
@@ -37,21 +37,24 @@
#include <sstream>
#define BOT_FOLLOW_DISTANCE_DEFAULT 184 // as DSq value (~13.565 units)
#define BOT_FOLLOW_DISTANCE_DEFAULT_MAX 2500 // as DSq value (50 units)
#define BOT_FOLLOW_DISTANCE_WALK 1000 // as DSq value (~31.623 units)
constexpr float BOT_FOLLOW_DISTANCE_DEFAULT = 184.0f; // as DSq value (~13.565 units)
constexpr float BOT_FOLLOW_DISTANCE_DEFAULT_MAX = 2500.0f; // as DSq value (50 units)
constexpr float BOT_FOLLOW_DISTANCE_WALK = 1000.0f; // as DSq value (~31.623 units)
#define BOT_LEASH_DISTANCE 250000 // as DSq value (500 units)
constexpr float BOT_LEASH_DISTANCE = 250000.0f; // as DSq value (500 units)
#define BOT_KEEP_ALIVE_INTERVAL 5000 // 5 seconds
constexpr uint32 BOT_KEEP_ALIVE_INTERVAL = 5000; // 5 seconds
//constexpr uint32 BOT_COMBAT_JITTER_INTERVAL_MIN = 5000; // 5 seconds
//constexpr uint32 BOT_COMBAT_JITTER_INTERVAL_MAX = 20000; // 20 seconds
extern WorldServer worldserver;
const int BotAISpellRange = 100; // TODO: Write a method that calcs what the bot's spell range is based on spell, equipment, AA, whatever and replace this
const int MaxSpellTimer = 15;
const int MaxDisciplineTimer = 10;
const int DisciplineReuseStart = MaxSpellTimer + 1;
const int MaxTimer = MaxSpellTimer + MaxDisciplineTimer;
constexpr int BotAISpellRange = 100; // TODO: Write a method that calcs what the bot's spell range is based on spell, equipment, AA, whatever and replace this
constexpr int MaxSpellTimer = 15;
constexpr int MaxDisciplineTimer = 10;
constexpr int DisciplineReuseStart = MaxSpellTimer + 1;
constexpr int MaxTimer = MaxSpellTimer + MaxDisciplineTimer;
@@ -260,10 +263,24 @@ public:
void Stand();
bool IsSitting();
bool IsStanding();
virtual int GetWalkspeed() const { return (int)((float)_GetWalkSpeed() * 1.785714f); } // 1.25 / 0.7 = 1.7857142857142857142857142857143
virtual int GetRunspeed() const { return (int)((float)_GetRunSpeed() * 1.785714f); }
virtual int GetWalkspeed() const { return (int)((float)_GetWalkSpeed() * 1.785714285f); } // 1.25 / 0.7 = 1.7857142857142857142857142857143
virtual int GetRunspeed() const { return (int)((float)_GetRunSpeed() * 1.785714285f); }
virtual void WalkTo(float x, float y, float z);
virtual void RunTo(float x, float y, float z);
virtual void StopMoving();
virtual void StopMoving(float new_heading);
//bool GetCombatJitterFlag() { return m_combat_jitter_flag; }
bool GetGuardFlag() { return m_guard_flag; }
void SetGuardFlag(bool flag = true) { m_guard_flag = flag; }
bool GetHoldFlag() { return m_hold_flag; }
void SetHoldFlag(bool flag = true) { m_hold_flag = flag; }
bool GetAttackFlag() { return m_attack_flag; }
void SetAttackFlag(bool flag = true) { m_attack_flag = flag; }
bool GetAttackingFlag() { return m_attacking_flag; }
bool GetPullFlag() { return m_pull_flag; }
void SetPullFlag(bool flag = true) { m_pull_flag = flag; }
bool GetPullingFlag() { return m_pulling_flag; }
bool GetReturningFlag() { return m_returning_flag; }
bool UseDiscipline(uint32 spell_id, uint32 target);
uint8 GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets);
bool GetNeedsCured(Mob *tar);
@@ -338,6 +355,7 @@ public:
uint8 GetStopMeleeLevel() { return _stopMeleeLevel; }
void SetStopMeleeLevel(uint8 level);
void SetGuardMode();
void SetHoldMode();
// Mob AI Virtual Override Methods
virtual void AI_Process();
@@ -674,7 +692,18 @@ private:
int32 end_regen;
uint32 timers[MaxTimer];
Timer evade_timer; // can be moved to pTimers at some point
Timer m_evade_timer; // can be moved to pTimers at some point
Timer m_alt_combat_hate_timer;
//Timer m_combat_jitter_timer;
//bool m_combat_jitter_flag;
bool m_guard_flag;
bool m_hold_flag;
bool m_attack_flag;
bool m_attacking_flag;
bool m_pull_flag;
bool m_pulling_flag;
bool m_returning_flag;
eStandingPetOrder m_previous_pet_order;
BotCastingRoles m_CastingRoles;
@@ -716,6 +745,10 @@ private:
int32 GenerateBaseManaPoints();
void GenerateSpecialAttacks();
void SetBotID(uint32 botID);
//void SetCombatJitterFlag(bool flag = true) { m_combat_jitter_flag = flag; }
void SetAttackingFlag(bool flag = true) { m_attacking_flag = flag; }
void SetPullingFlag(bool flag = true) { m_pulling_flag = flag; }
void SetReturningFlag(bool flag = true) { m_returning_flag = flag; }
// Private "Inventory" Methods
void GetBotItems(EQEmu::InventoryProfile &inv, std::string* errorMessage);