ModernUO/Projects/UOContent/Mobiles/AI/BaseAI
Kamron Batman 5d00149dd8
fix: keep the Guard order through combat and sprint guard returns
A guarding pet's engagement path (FindCombatant) rewrote ControlOrder to
Attack, so guard silently converted to a plain kill order mid-fight (#2595):
the (guarding)/guarded OPL tags vanished, the pet stopped scanning for the
master's threats and never retargeted, recall/gate left it behind
(TeleportPets only takes Guard/Follow/Come), and every engage->kill->resume
cycle replayed the "is now guarding you" flourish. Return pacing also
depended on stale Warmode, leaving guard returns active or passive by combat
history.

- FindCombatant is now FindGuardTarget: a pure selector that prefers the
  aggressor closest to the master (RunUO guard parity) and keeps the current
  combatant unless a strictly closer one exists. DoOrderGuard engages through
  it without ever leaving the Guard order.
- HandleInvalidControlTarget resumes the persistent order first and chains
  the next aggressor into an explicit Attack only for non-guard fallbacks —
  an explicit "all attack" completes, returns to guarding, and the guard scan
  takes over. Resuming Guard no longer replays the sound/message flourish.
- The peaceful guard branch stands down (Warmode/Combatant/FocusMob cleared)
  so pacing is deterministic, and guard returns sprint at the follow pace
  (0.1s/step, AOS) on the move clock while the think cadence is untouched.
- WalkMobileRange honors the caller's run flag instead of a hardcoded
  distance-5 gate; follow/guard run animation now matches their actual pace.

Closes #2595

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-25 07:06:09 -07:00
..
ActionType.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
AIGroupMovement.cs fix: creatures track and chase targets reliably around corners (#2590) 2026-08-23 01:13:00 -07:00
AIMovement.cs fix: keep the Guard order through combat and sprint guard returns 2026-08-25 07:06:09 -07:00
AITimer.cs fix: restore pet obedience pacing and reschedule stale AI wakes 2026-08-24 12:26:42 -07:00
AIType.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
BaseAI.cs fix: restore pet obedience pacing and reschedule stale AI wakes 2026-08-24 12:26:42 -07:00
BaseAIExtensions.cs fix: Consolidates debug check messages for AI and adds debounce (#2235) 2025-07-18 18:08:03 -07:00
ContextMenu.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
DebugInterpolatedStringHandler.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
InternalEntry.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
OnSpeech.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
PetLogin.cs fix(ai): pet order/home refactor — stop & post-combat behavior (#2459) 2026-06-07 01:22:43 -07:00
PetOrderHandlers.cs fix: keep the Guard order through combat and sprint guard returns 2026-08-25 07:06:09 -07:00
PetOrders.cs fix: keep the Guard order through combat and sprint guard returns 2026-08-25 07:06:09 -07:00
SpeechEventArgsExt.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
TransferItem.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
WalkRandomLogic.cs fix(ai): pet order/home refactor — stop & post-combat behavior (#2459) 2026-06-07 01:22:43 -07:00