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) + ) ); }