X-Act
np: Biffy Clyro - Shock Shock
I downloaded Shoddy Battle recently. I played a few games with it, and I got the feeling that something was wrong with the damage inflicted. Now, I don't know about you, but I don't like my Pokemon being dealt 2% more damage than it should. So, since it's written in Java, I decided to download its source code and start investigating.
After 5 minutes rummaging through the code (which is extremely well-commented, by the way), I got to the part where the program calculates the damage done:
Let's translate this to mathematics:
Damage = floor((floor(floor((floor((2 * Level) / 5 + 2) * Attack * BasePower) / Defense) / 50) + 2) * TypeEffectiveness * STAB * (Random / 255)) * CH
Random is a random whole number between 217 and 255, by the way, which has been proven wrong not only for DP, but for ADV as well. Oh, and who cares about TypeEffectiveness, STAB and (Random/255) possibly all being decimals... just multiply them out and then floor the answer! And I haven't even started to look into how the item, ability and berry modifiers are implemented...
I have told Colin about this, but, for now, be aware of the fact that your damage calculations might not correspond to the damage you'll be dealing in Shoddy Battle... you'll end up dealing around 2% more or less damage than you're supposed to be dealing. Which, in the case when my opponent was left with 1% health after I hit him with a move that I was certain to OHKO him with, is rather frustrating at times.
After 5 minutes rummaging through the code (which is extremely well-commented, by the way), I got to the part where the program calculates the damage done:
Code:
.
.
.
int power = (int)(((int)((int)(((int)((2 * attacker.getLevel()) / 5.0 + 2.0)
* attack
* move.getPower())
/ defence)
/ 50.0)
+ 2)
* multiplier
* (stab ? 1.5 : 1.0)
* (random / 255.0));
if (move.canCriticalHit() && isCriticalHit(move, attacker, defender)) {
power *= attacker.hasAbility("Sniper") ? 3 : 2;
.
.
.
Damage = floor((floor(floor((floor((2 * Level) / 5 + 2) * Attack * BasePower) / Defense) / 50) + 2) * TypeEffectiveness * STAB * (Random / 255)) * CH
Random is a random whole number between 217 and 255, by the way, which has been proven wrong not only for DP, but for ADV as well. Oh, and who cares about TypeEffectiveness, STAB and (Random/255) possibly all being decimals... just multiply them out and then floor the answer! And I haven't even started to look into how the item, ability and berry modifiers are implemented...
I have told Colin about this, but, for now, be aware of the fact that your damage calculations might not correspond to the damage you'll be dealing in Shoddy Battle... you'll end up dealing around 2% more or less damage than you're supposed to be dealing. Which, in the case when my opponent was left with 1% health after I hit him with a move that I was certain to OHKO him with, is rather frustrating at times.