Was the fighter standing on a mountain tile during the previous turn? Cavaliers can’t move on mountains. I believe the second AI byte is changing to 0x00, but that AI won’t pursue out-of-range units who are on terrain they can’t traverse.
My point is that it won’t ever reach that particular 03 code due to the change AI command above it. If there is an unit in the expanded range, it should stop execution in either AI 1 or the new AI 2.
I don’t think 03 represents finalize and execute.
00 : 01 64 FF 00 00 00 00 00 41 AA 03 08 B0 F3 FF 08
01 : 01 64 FF 00 00 00 00 00 41 AA 03 08 B4 F3 FF 08
02 : 01 64 FF 00 00 00 00 00 41 AA 03 08 B8 F3 FF 08
03 : 01 64 FF 00 00 00 00 00 41 AA 03 08 BC F3 FF 08
04 : 03 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00
This is a modified version of your AI code that made the brigand walk in a loop. It behaves the same without the extra 03 and 1B codes.
In the RAM unit data, the byte after a unit’s AI1/AI2 is like an AI program counter. At the start of each turn, the value indicates which command to execute next.
AI PC for the above code at the start of each turn:
Turn 1 = 00
Turn 2 = 01
Turn 3 = 02
Turn 4 = 03
Turn 5 = 04
Turn 6 = 01 (repeatedly cycles 01-04)