Closed augmt closed 9 years ago
Thanks! I'll check it out tonight, but would love input from others as well.
(Tagging #19 just so I can find this later)
Still tracking it down, but there's something funky going on. This is non-mega Abomasnow vs. Abomasnow, with the left Aboma carrying a Sitrus:
...I take it back. The "0% chance" is effectively correct. After working it out by hand, there's a 1/16^3 chance (max damage on three consecutive rolls) to 3HKO with Sitrus Berry recovery:
197 HP
69-82 damage per attack
After 1 attack: 115-128 (no Sitrus proc)
After 2 attacks: 33-59 (always Sitrus proc, which makes it:) 82-108
After 3 attacks: 0-39
...so I propose the following stylistic change, but otherwise I think this PR is accurate as far as I can see:
for (i = 2; i <= 4; i++) {
c = getKOChance(damage, move.hits, defender.curHP - hazards, eot, i, defender.maxHP, toxicCounter, hasSitrus);
if (c === 1) {
return 'guaranteed ' + i + 'HKO' + afterText;
} else if (c > 0) {
var pct = Math.round(c * 1000) / 10;
var chance = pct ? qualifier + pct + '%' : 'Miniscule';
return chance + ' chance to ' + i + 'HKO' + afterText;
}
}
Funky, indeed.
As you've seen, the KO Chance only shows up to the tenths place. And, as it turns out, Blizzard does have a chance of 3HKOing Abomasnow, albeit a 0.0244140625% chance.
More of the decimal should be shown.
I think a single decimal place is fine; more than that is just noise, IMO. Nice timing, btw.
Also potentially worth noting that this sort of thing could only possibly show up on something that's a 3HKO or worse, since the minimum nonzero chance for a 2HKO is 0.4%. Lucky(?) catch, I guess. Sorry about the false alarm.
Proclaiming that it's a minuscule chance works well. Choose whichever fix you like more.
Haha, no problem. It's better to catch this sort of thing sooner rather than later.
However, if you get a min roll and then a max roll, the Sitrus actually wouldn't activate and it would be a 2HKO. Any way to account for those cases easily?
Nice catch!
If you comment out the following lines of code from the getKOChance function:
if (predictTotal(maxDamage, eot, hits, toxicCounter, hp, maxHP, hasSitrus) < hp) {
return 0;
} else if (predictTotal(minDamage, eot, hits, toxicCounter, hp, maxHP, hasSitrus) >= hp) {
return 1;
}
you'll get:
From what I've gathered, the calculator is only about a millisecond slower with that code commented out.
This commit includes the Sitrus Berry into the KO Chance calculation for single-hit and multi-hit moves.
Please, please someone verify that the KO Chance calculation is correct. I have doubts but I can't pinpoint them.