Heika said: Hi, I'm not sure this is the place for it but I figured I couldn't really go wrong by posting it here.
I first thought there was an issue with the damage formula used in ps with the +2 roaming in that formula (according to internet sources such as bulbapedia and serebi) from looking to the code (+ the issue I thought there was matched with the damage calc results which are not the one I obtained by "manual" calculation), so I did some tests, and during those test, this happened :
https://replay.pokemonshowdown.com/gen8customgame-1022897205-rcw7l95sky6j2dipq0fxtgcnwb2evtcpw
The thing happened Turn 10 Snorlax took 169 damages, min roll according to ps damagecalc is 170, and min roll according to internet sources formula is 171. From the calculation I made, it only matches a 0.84 roll, while rolls are supposed to be (according to the same sources as before) between 0.85 and 1.
Some other roll related thing JavaScript: randomizer (baseDamage: number ) {
const tr = this .trunc ;
return tr (tr (baseDamage * (100 - this .random (16 ))) / 100 );
I'm have absolutly no experience with Jave so I don't know if that 16 is the reason or if putting 16 means 15 is the biggest possible number generated.
So, for this reason, the main reason I'm putting this here is not related to the main part but to the fact that in gen 1 and 2 the calculation of the roll is not this one but is a number between 217 and 255 divided by 255 (according to bulbapedia).
Click to expand... Click to collapse... Neither Bulbapedia nor Serebii have reliable documentation on the damage formula. You can use
this article as a more reliable reference .
Assuming the numbers given were correct (102 BP Return, 256 Attack, 156 Defense), it should be calculated as follows:
Base Damage = floor[floor[(floor[2*100/5]*102*256)/166]/50] + 2
= floor[floor[(42*102*256)/166]/50] + 2
= floor[6606]/50] + 2
= 132 +2
= 134
With 134 base damage, no modifiers exist until the random damage rolls. After the random damage rolls, the possible values are as follows:
113, 115, 116, 117, 119, 120, 121, 123, 124, 125, 127, 128, 129, 131, 132, 134
After applying STAB to each damage roll, the possible values are as follows:
169, 172, 174, 175, 178, 180, 181, 184, 186, 187, 190, 192, 193, 196, 198, 201
As you can see, Return's minimum damage roll in this case is 169. But this is exactly what Showdown's damage calculator is returning, so I'm not sure what the issue is.
Screenshot of Damage Calculation