The server chooses the most effective of the 3 stats for the attacker to attack with, and for the defender to defend with. The attacker's stat value is multiplied by 2 if it's a critical hit. The defender's stat value is multiplied by either 0.5, 1 or 2 depending on the rock/paper/scissors relationship between the attack and defense stats. Once the final attack and defense stat value have been determined, the ratio of attack/defense is computed, and multiplied by a random number in the range 0.5->1.5. This attack ratio is then multiplied by the attacker's manpower per attack to determine how many hit points will be taken away from the defending square.
Here's a more detailed version:
Outline of the combat formula:
1) Based on the stats of the attacking and defending nations, two numbers are determined: the attackVal and the defenseVal.
2) The attackRatio is (attackVal / defenseVal). It is a number in the range of 0 to infinity, where a low value means the defender does well, a high value means the attacker does well, and 1.0 means they're evenly matched.
3) A random number in the range 0.5 to 1.5 is generated and multiplied into the attackRatio.
4) The amount of hit points taken away from the defending square is equal to the attacker's manpowerPerAttack, multiplied by the attackRatio. (If that number of hit points is greater than the square has, then the square is defeated and no more of the attacker's manpowerPerAttack is used up than is needed).
Here are the details about how the nations' stats are used to determine the attackVal and defenseVal:
1) Nine possible attackVal and defenseVal pairs are determined, corresponding to the 9 possible attack and defense stat combinations (eg tech->tech, tech->bio, etc.). The value of each pair is:
attackVal: the attacker's value in the attack stat, multiplied by 2 if this is a critical hit.
defenseVal: the defender's value in the defense stat, multiplied by 0.5, 1.0 or 2.0 depending on the rock/paper/scissors relationship of the particular attack and defense stats.
2) For each pair, the ratio of attackVal / defenseVal is looked at to determine which attack stat and defense stat will be used for the attack. For each attack stat the defense stat is chosen that produces the lowest ratio (best result for defender). Then, given that, the attack stat is chosen that produces the highest ratio (best result for attacker). The result is that the attacker and defender both choose to use their stat that works to their own greatest advantage.
Note that during the several seconds that an attack takes, the square is also gaining hit points at whatever that nation's hit point restore rate is. So, the attack needs to take away more hit points during those seconds than the nation restores, in order to do any damage.Statistics:Posted by Mike — Tue Feb 06, 2018 12:48 am
]]>