Finally, I have results that match James' table. The code is...
private int getCapResult(int base, int caps, int armour)
{
// Calculate the increments in which armour damage is applied
int damageTick = (int)Math.round(armour / 512.0);
// Calculate the damage modification from the capacitors
int mod = 1000;
for (int n = 0; n < caps; n++)
{
mod = mod * 90 / 100;
}
mod = (int)Math.floor( mod / 10 );
// Get the basic damage done after taking capacitors into account
int damage = base * mod / 100;
// Round up so that damage is applied in increments of 1/512
int damage2 = (int)(Math.ceil(1.0 * damage / damageTick) * damageTick);
System.out.println( caps + " : " + mod + "% = " + damage + " (" + damage2 + ")" );
return damage2;
}
and the results are...
1 : 90% = 4262 (4270)
2 : 81% = 3836 (3840)
3 : 72% = 3409 (3410)
4 : 65% = 3078 (3080)
5 : 59% = 2794 (2800)
6 : 53% = 2510 (2510)
7 : 47% = 2225 (2230)
8 : 42% = 1989 (1990)
9 : 38% = 1799 (1800)
10 : 34% = 1610 (1610)
11 : 31% = 1468 (1470)
12 : 28% = 1326 (1330)
13 : 25% = 1184 (1190)
14 : 22% = 1041 (1050)
15 : 20% = 947 (950)
16 : 18% = 852 (860)
17 : 16% = 757 (760)
18 : 14% = 663 (670)
19 : 13% = 615 (620)
20 : 11% = 520 (520)
21 : 10% = 473 (480)
22 : 9% = 426 (430)
23 : 8% = 378 (380)
24 : 7% = 331 (340)
25 : 6% = 284 (290)
26 : 6% = 284 (290)
27 : 5% = 236 (240)
28 : 4% = 189 (190)
29 : 4% = 189 (190)
30 : 3% = 142 (150)
31 : 3% = 142 (150)
32 : 3% = 142 (150)
33 : 2% = 94 (100)