From 99c26c662be516976ad72f605deb8944f845ffa3 Mon Sep 17 00:00:00 2001 From: ShiyoKozuki Date: Wed, 10 Jan 2024 10:32:50 -0500 Subject: [PATCH] Properly swap to marked / party leader targets in combat --- src/game/PlayerBots/PartyBotAI.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/game/PlayerBots/PartyBotAI.cpp b/src/game/PlayerBots/PartyBotAI.cpp index 306244a60ca..18d5b831763 100644 --- a/src/game/PlayerBots/PartyBotAI.cpp +++ b/src/game/PlayerBots/PartyBotAI.cpp @@ -960,6 +960,27 @@ void PartyBotAI::UpdateInCombatAI() return; } + Unit* pVictim = me->GetVictim(); + + // Swap to marked target or party leader's target + if (GetRole() != ROLE_HEALER) + { + if (Player* pLeader = GetPartyLeader()) + { + Unit* newVictim = SelectAttackTarget(pLeader); + + if (newVictim && (newVictim != pVictim)) + { + if (pVictim) + me->AttackStop(); + else + AttackStart(newVictim); + + return; + } + } + } + switch (me->GetClass()) { case CLASS_PALADIN: