theastrogoth / tera-raid-builder

A tool for simulating Tera Raid battles in Pokémon Scarlet & Violet
https://theastrogoth.github.io/tera-raid-builder/
4 stars 3 forks source link

More thorough faint probability calculation #215

Closed theastrogoth closed 3 months ago

theastrogoth commented 3 months ago

This adds an attempt to assess the "cumulative" probability of fainting across all moves, rather than just reporting the KO chance for a single move, factoring in miss chance and crit chance. Any stat boosts, secondary effects, shield activation, etc, are not considered for this calculation. They are fixed by the chosen damage roll.

Example readout (obtained by reducing the Maushold HP EVs by 4, and then Optimizing Boss Moves for the Tom & Jerry Swampert strat):

0 Atk Tera Poison Swampert Earthquake vs. -1 248 HP / 0+ Def Maushold through Def Cheer on a critical hit: 217-256 (61.8 - 72.9%) -- 1.88e-7% cumulative chance to KO

Inspired by: https://www.smogon.com/forums/threads/pok%C3%A9mon-showdown-damage-calculator.3593546/page-38#post-10141275

Luckily, we don't need to worry about scaling things up to 10^12 moves, so a simple O(H^2) implementation should be good enough.