[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
+1 -1
View File
@@ -2978,7 +2978,7 @@ void Bot::SetOwnerTarget(Client* bot_owner) {
if (NOT_HOLDING && NOT_PASSIVE) {
auto attack_target = bot_owner->GetTarget();
if (attack_target) {
if (attack_target && HasBotAttackFlag(attack_target)) {
InterruptSpell();
WipeHateList();