[Bug] Fix off-by-one error in damage calc (#2970)
* Fix random damage roll to be 85-100% instead of 85-99% * Update battle.test.ts to reflect the fix
This commit is contained in:
parent
991051fa09
commit
6bc191c44e
|
@ -1909,7 +1909,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
applyPreAttackAbAttrs(AddSecondStrikeAbAttr, source, this, move, numTargets, new Utils.IntegerHolder(0), twoStrikeMultiplier);
|
||||
|
||||
if (!isTypeImmune) {
|
||||
damage.value = Math.ceil(((((2 * source.level / 5 + 2) * power.value * sourceAtk.value / targetDef.value) / 50) + 2) * stabMultiplier.value * typeMultiplier.value * arenaAttackTypeMultiplier.value * screenMultiplier.value * twoStrikeMultiplier.value * ((this.scene.randBattleSeedInt(15) + 85) / 100) * criticalMultiplier.value);
|
||||
damage.value = Math.ceil(
|
||||
((((2 * source.level / 5 + 2) * power.value * sourceAtk.value / targetDef.value) / 50) + 2)
|
||||
* stabMultiplier.value * typeMultiplier.value * arenaAttackTypeMultiplier.value * screenMultiplier.value * twoStrikeMultiplier.value * ((this.scene.randBattleSeedInt(16) + 85) / 100) * criticalMultiplier.value);
|
||||
if (isPhysical && source.status && source.status.effect === StatusEffect.BURN) {
|
||||
if (!move.hasAttr(BypassBurnDamageReductionAttr)) {
|
||||
const burnDamageReductionCancelled = new Utils.BooleanHolder(false);
|
||||
|
|
|
@ -151,8 +151,8 @@ describe("Test Battle Phase", () => {
|
|||
|
||||
it("test remove random battle seed int", async() => {
|
||||
for (let i=0; i<10; i++) {
|
||||
const rand = game.scene.randBattleSeedInt(15);
|
||||
expect(rand).toBe(14);
|
||||
const rand = game.scene.randBattleSeedInt(16);
|
||||
expect(rand).toBe(15);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue