hmmmm, the handling of first strikes in the code for choosing the best defender appears rather dubious to me:
Provided the attacker isn't immune to first strikes, a potential defender's strength gets boosted by an additional flat 16% for each first strike of the defender and a flat 8% for each first strike chance. Furthermore there is a similar piece of code that boosts this modified strength of a defender who
is immune to first strikes according to the number of first strikes/chances of the attacker.
This leads to the following extreme situation:
Monty "chooses" to defend with his uber Ironclad (Drill IV, Flanking I+II --> immune to first strikes) against my Drill IV Destroyer. My odds 97.6%
If Monty's Combat II Destroyer were the "best" chosen defender my odds would only be 49.3%.
During the comparison the units' strengths are integers multiplied by 100:
Drill IV, Flanking I+II Ironclad:
strength = 1200, + 10% defense on coast --> 1320
attacker not immune to first strikes: + 3*16% + 3*8% = +72% --> 2270
Ironclad is immune to first strikes, attacker has Drill IV: + 3*16% + 3*8% = +72% -->
3904
Combat II Destroyer:
strength = 3000, + 10% defense on coast + 20% for Combat II -->
3900
3904 > 3900 --> Ironclad is the "best defender" !!
Apart from the special case of cargo units loaded on potential defenders, I can't really see a reason not to let the one unit get chosen as the defender, which simply gets the best combat odds.
