Here is my first stab at the mechanism:
Auto-attack checks occur once per day, after all commands
of lesser priority than ATTACK have run.
Units will not auto-attack if they are wounded.
Only the top unit in a stack will be checked for auto-attack.
If multiple hostile targets are present, one will be chosen
at random. The others will not be attacked until the next day.
The issue I'm having the most concern about is what to do if a unit
is already executing an order.
1. Only check for auto-attacks if the unit is not executing
2. If a hostile target is found, temporarily suspend the order
for the day of the combat, then resume it afterwards.
3. If a hostile target is found, terminate the running order.
I suppose #2 is the most trouble-free for the players. Auto-attack would
certainly be less useful with the other choices.
-- Rich Skrenta <email@example.com>