>>46560131>>46560034>>46562569Those conditions are things like Screens, Grassy Terrain+Recovery, Berries you are holding, Rain, Leftovers recovery, Hail damage, Magma Storm Damage, ect.
If end turn recovery/damage needs to be factored in, have that apply after the damage calculator as the fraction of HP, rounded down to the lowest integer, and put into remaining HP at the end of the turn.
As a tip, you only need the opposing Pokemon’s offensive stats with the respective boosts for this scenario.
Don’t go overboard on adding conditions however. Having Screens+Grassy Terrain+Rain is too unrealistic.
Also consider something like Excadrill doing more damage than Garchomp with Jolly and Life Orb, and to also consider Heatran’s Magma Storm with just Occa Berry and Volcarona’s Fire Blast with Occa Berry+Light Screen.
Next to setting up the percentage cell (which should be floor(Max HP-Damage)/Max HP).
Last, is to make a cell where your bulk is summed up, and have that be the value you want to minimize.
Once that it finally done, you can make your constraints.
For good measure, make it so SpA can’t get any higher that 359 SpA (or 63 real EVs).
You are also gonna want to have Magearna’s real EVs add up to 127.
Next are setting up the damage, which is <= the damage you would like under those conditions.
Last constraint is to have your real EVs be all integers.
Then you can solve to see what is the least amount of bulk you can invest, with the correct way of investing them, so that you can tank however many hits you want with what ever HP you want remaining.
There, you now spent a good chunk of your day figuring out what EV spread a banned Pokemon should have and what teammates you should give that Pokemon for maximum effectiveness as well.
At least this can also be applied to a Pokemon like Hawlucha as well.