Collateral Damage
When attacking stacks, siege units have the built-in capability to damage additional units in the stack besides the one attacked. This is called collateral damage.
Collateral damage is done ONLY by an attacker and only to the stack member(s) that aren’t directly defending. The chosen defender will engage the attacking unit in a regular combat.
Maximum Damage
Gone are the Civ3 days of completely red-lining a unit. Each unit that can do collateral damage has a limit on the amount of damage it can do. These are given in the Units XML file. For catapults, it is 50; cannons 60; artillery 70. Tanks/panzers and modern armor are capped at 60; Cho-Ko-Nu at 60, and (stealth) bombers at 50. That means a catapult can not damage a unit at or below 50 hps. Similarly, an artillery cannot damage any unit at or below 30 hps. Those are hard caps.
Number of Targets
The number of targets is a function of both the attacking unit and the number of potential targets. The number of potential targets is the number of units in the tile which are not defending and who are above the maximum damage threshold.
Example: A catapult is attacking a stack a stack with a 100 hp musket, a 95 hp musket, a 42 hp knight, and a 73 hp axe. The number of potential targets is 2 – the 95 hp musket and the 73 hp axe. The 100 hp musket will defend, so is not a collateral target. The 42 hp knight is below the maximum damage for a catapult.
Each type of unit capable of doing collateral damage is limited in the number of targets it can hit, too. A catapult can only hit 5, a cannon 6, an artillery 7, Cho-Ko-Nu 5, a tank/panzer 5, a modern armor 6, a bomber 5, and a stealth bomber 6. So, even targeting a stack of 12 muskets, a cannon will only hit 7 total (1 directly which defends and 6 with collateral damage).
The number of targets, then, is the lesser of the two numbers – min(potential_targets,max_capable).
Selecting targets
The target of each “round” of collateral damage is selected randomly from the list of potential targets, as defined above. I don’t think the list is updated each round (so that a unit at the maximum damage mark could be selected), but I’m not certain.
Amount of Damage Done
The damage calculation is similar to the damage calculation for regular combat. However, the modifications to each unit’s strength are done differently.
The only potential attacker strength bonus is Barrage -- +20% for Barrage I, another 30% for Barrage II and another 50% for Barrage III. This affects the starting percentage of strength of each unit. The defender gets no strength bonus for anything. Hps are also not used in calculating these relative strengths.
All the regular artillery units (catapults, cannons, artillery, and (stealth) bombers) calculate based off of their full strength. The tanks (tank, panzer, modern armor) calculate based from 0 and the Cho-Ko-Nu starts at 50%.
Example: A Cho-Ko-Nu (str:6) will always have an adjusted strength of 3 (.5 * 6) when figuring collateral damage.
Example: A tank with Barrage I will have an adjusted strength of 5.6 (28 * .2) for collateral damage. With Barrage II, it would be 14 (28 * .5).
Then, the likely damage is half what it would be if the units were fighting directly with those relative strengths. That is, damage = floor(10*(3*A+D)/(3*D+A)). This amount is reduced only if the damage would put the defender past the damage threshold discussed above.
Example: A catapult (with Barrage I and Barrage II) is targeting a longbow with 71 hps in a city on a hill for collateral damage. The catapult’s adjusted strength is 7.5 (5 * 1.5) and the longbow’s adjusted strength is 6 – the hill defense, the city defense, the hps just don’t matter. The catapult does 11 damage to the longbow.
Putting It All Together
Then, the siege attack weapon simply loops through the selection and damage phase the number of times equal to the number of targets. Not every potential target gets hit and some may get hit more than once.
Example: A catapult (with Barrage I) attacks a stack with two full-strength muskets, a knight (with Combat I) at 54 hps, a sword at 38 hps, and an elephant at 83 hps. The number of targets is 3. The first random target is the elephant. Adjusted strengths of 6 and 8 means 8 damage to the elephant. Round 2, the knight is picked. Adjusted strengths of 6 and 10 mean 7 damage, but the limit is 4 because of maximum damage. Round 3, the elephant is selected again, and takes another 8 damage. Before combat between the catapult and the first full-strength musket begins, the stack now has two full-strength muskets, a knight with 50 hps, a sword with 38 hps, and an elephant with 67 hps. Then, the attack between the catapult and the musket would resolve as normally (described above).