From 4ad0dbeaa8240089db41457e1756314caf4f194a Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 26 Apr 2024 13:05:48 -0400 Subject: [PATCH] Cap costs at max safe integer --- src/modifier/modifier-type.ts | 2 +- src/phases.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index d88c396df..54484a1e0 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -1513,7 +1513,7 @@ export class ModifierTypeOption { constructor(type: ModifierType, upgradeCount: integer, cost: number = 0) { this.type = type; this.upgradeCount = upgradeCount; - this.cost = Math.round(cost); + this.cost = Math.min(Math.round(cost), Number.MAX_SAFE_INTEGER); } } diff --git a/src/phases.ts b/src/phases.ts index c7ff49e2e..ad4f52e55 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -4379,7 +4379,7 @@ export class SelectModifierPhase extends BattlePhase { baseValue += tierValues[opt.type.tier]; } else baseValue = 250; - return Math.ceil(this.scene.currentBattle.waveIndex / 10) * baseValue * Math.pow(2, this.rerollCount); + return Math.min(Math.ceil(this.scene.currentBattle.waveIndex / 10) * baseValue * Math.pow(2, this.rerollCount), Number.MAX_SAFE_INTEGER); } getPoolType(): ModifierPoolType {