[Bots] Add attack flag when told to attack (#4490)

This adds a flag to mobs that are told to attack by their owner to prevent unintended attacks.

Previously, if you were to send your bots to attack a target and then switch targets: before casters land their spell or if melee (especially anyone with pets)  hasn't engaged before the target switch, they could switch to your new target and attack.

This adds a flag upon attack and bots will only attack flagged targets.
This commit is contained in:
nytmyr
2024-09-29 16:59:26 -05:00
committed by GitHub
parent 8d23e710ce
commit 56608e84bd
5 changed files with 48 additions and 2 deletions
+11
View File
@@ -205,6 +205,9 @@ public:
Timer mob_close_scan_timer;
Timer mob_check_moving_timer;
// Bot attack flag
Timer bot_attack_flag_timer;
//Somewhat sorted: needs documenting!
//Attack
@@ -1102,6 +1105,11 @@ public:
bool invulnerable;
bool qglobal;
inline std::vector<uint32> GetBotAttackFlags() { return bot_attack_flags; }
inline void SetBotAttackFlag(uint32 value) { bot_attack_flags.push_back(value); }
inline void ClearBotAttackFlags() { bot_attack_flags.clear(); }
bool HasBotAttackFlag(Mob* tar);
virtual void SetAttackTimer();
inline void SetInvul(bool invul) { invulnerable=invul; }
inline bool GetInvul(void) { return invulnerable; }
@@ -1863,6 +1871,9 @@ protected:
bool pet_owner_npc; // Flags pets as belonging to an NPC
uint32 pet_targetlock_id;
//bot attack flags
std::vector<uint32> bot_attack_flags;
glm::vec3 m_TargetRing;
GravityBehavior flymode;