From 05bb38493408f0b4b8481e6a7c213fca876b198a Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Tue, 16 Apr 2024 12:14:33 -0400 Subject: [PATCH] Update crit chance to gen 7 odds --- src/battle.ts | 2 ++ src/field/pokemon.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/battle.ts b/src/battle.ts index b7dbb9a4219..b8ac378029f 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -212,6 +212,8 @@ export default class Battle { } randSeedInt(scene: BattleScene, range: integer, min: integer = 0): integer { + if (range <= 1) + return min; let ret: integer; const tempRngCounter = scene.rngCounter; const tempSeedOverride = scene.rngSeedOverride; diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index bf7073ad0bf..a4d9acc04ad 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1213,7 +1213,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } if (source.getTag(BattlerTagType.CRIT_BOOST)) critLevel.value += 2; - const critChance = Math.ceil(16 / Math.pow(2, critLevel.value)); + const critChance = [24, 8, 2, 1][Math.max(0, Math.min(critLevel.value, 3))]; isCritical = !source.getTag(BattlerTagType.NO_CRIT) && (critChance === 1 || !this.scene.randBattleSeedInt(critChance)); if (isCritical) { const blockCrit = new Utils.BooleanHolder(false);