From 8ca8720f651c6ac15c71b143e457d575243405c0 Mon Sep 17 00:00:00 2001 From: innerthunder Date: Wed, 4 Sep 2024 18:20:08 -0700 Subject: [PATCH] Fix `randBattleSeedInt` prototype messing up damage-based tests --- src/field/pokemon.ts | 6 ++---- src/test/utils/gameManager.ts | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 5b2e26fce39..f333d129778 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2243,7 +2243,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { * This Pokemon's defensive stat for the given move's category. * Critical hits ignore positive stat stages. */ - const targetDef = new Utils.IntegerHolder(this.getEffectiveStat(isPhysical ? Stat.DEF : Stat.SPDEF, source, move, ignoreAbility, ignoreSourceAbility, isCritical, simulated)); + const targetDef = new Utils.NumberHolder(this.getEffectiveStat(isPhysical ? Stat.DEF : Stat.SPDEF, source, move, ignoreAbility, ignoreSourceAbility, isCritical, simulated)); applyMoveAttrs(VariableDefAttr, source, this, move, targetDef); /** @@ -2296,9 +2296,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { applyAbAttrs(StabBoostAbAttr, source, null, simulated, stabMultiplier); } - if (sourceTeraType !== Type.UNKNOWN && matchesSourceType) { - stabMultiplier.value = Math.min(stabMultiplier.value + 0.5, 2.25); - } + stabMultiplier.value = Math.min(stabMultiplier.value, 2.25); /** Halves damage if the attacker is using a physical attack while burned */ const burnMultiplier = new Utils.NumberHolder(1); diff --git a/src/test/utils/gameManager.ts b/src/test/utils/gameManager.ts index 998d10ddf12..14b1730ef11 100644 --- a/src/test/utils/gameManager.ts +++ b/src/test/utils/gameManager.ts @@ -73,7 +73,7 @@ export default class GameManager { constructor(phaserGame: Phaser.Game, bypassLogin: boolean = true) { localStorage.clear(); ErrorInterceptor.getInstance().clear(); - BattleScene.prototype.randBattleSeedInt = (arg) => arg-1; + BattleScene.prototype.randBattleSeedInt = (range, min) => (min ?? 0) + range - 1; this.gameWrapper = new GameWrapper(phaserGame, bypassLogin); this.scene = new BattleScene(); this.phaseInterceptor = new PhaseInterceptor(this.scene);