How do battles work?
1 round of ranged attacks. All units of both sides which have a nonzero Rdmg (ranged damage) simultaneously fire 3 times at a random enemy unit, with a chance to hit equal to their Racc. Each time they hit, they do 1/3rd of their Ranged damage, adjusted by a random factor of 80% to 120%. Cavalry charge: After the ranged, the cavalry charges in and does 2*R*[Str] damage to a random enemy soldier, unless it hits a pike unit (pikeman, halberdier, lancer). If that is the case, the pike unit does R*[Str] damage to the cavalry unit. R is a random factor between 80% and 120%. Melee fight: In this stage, every round every soldier of the largest army attacks a random enemy soldier and does R*[Str] damage. The enemy soldier then counterattacks and also does R*[Str] damage to the attacker. R is a random factor between 80% and 120%. After each round, soldiers with less than 50% of their HP become injured and are taken out of the battle. Soldiers who reach 0 HP die. The officer (player) fights with