From 98c7cd7724c5ce7d2e1248f8e3a7dd76eee66ffb Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 10 Apr 2022 21:16:20 -0500 Subject: [PATCH] Added minimumGain to resetButton --- src/data/common.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/data/common.tsx b/src/data/common.tsx index a188486..e3fe79f 100644 --- a/src/data/common.tsx +++ b/src/data/common.tsx @@ -15,7 +15,7 @@ import { TreeNodeOptions } from "features/trees/tree"; import player from "game/player"; -import Decimal from "util/bignum"; +import Decimal, { DecimalSource } from "util/bignum"; import { Computable, GetComputableType, @@ -33,6 +33,7 @@ export interface ResetButtonOptions extends ClickableOptions { showNextAt?: Computable; display?: Computable; canClick?: Computable; + minimumGain?: Computable; } export type ResetButton = Replace< @@ -42,6 +43,7 @@ export type ResetButton = Replace< showNextAt: GetComputableTypeWithDefault; display: GetComputableTypeWithDefault>; canClick: GetComputableTypeWithDefault>; + minimumGain: GetComputableTypeWithDefault; onClick: VoidFunction; } >; @@ -53,6 +55,7 @@ export type GenericResetButton = Replace< showNextAt: ProcessedComputable; display: ProcessedComputable; canClick: ProcessedComputable; + minimumGain: ProcessedComputable; } >; @@ -64,6 +67,7 @@ export function createResetButton @@ -80,7 +84,10 @@ export function createResetButton {displayResource( resetButton.conversion.gainResource, - unref(resetButton.conversion.actualGain) + Decimal.max( + unref(resetButton.conversion.actualGain), + unref(resetButton.minimumGain as ProcessedComputable) + ) )} {" "} {resetButton.conversion.gainResource.displayName} @@ -99,7 +106,10 @@ export function createResetButton - Decimal.gt(unref(resetButton.conversion.actualGain), 0) + Decimal.gte( + unref(resetButton.conversion.actualGain), + unref(resetButton.minimumGain as ProcessedComputable) + ) ); }