diff --git a/src/features/conversion.ts b/src/features/conversion.ts index 9f7d176..aa19839 100644 --- a/src/features/conversion.ts +++ b/src/features/conversion.ts @@ -292,3 +292,20 @@ export function setupPassiveGeneration( } }); } + +/** + * Creates requirement that is met when the conversion hits a specified gain amount + * @param conversion The conversion to check the gain amount of + * @param minGainAmount The minimum gain amount that must be met for the requirement to be met + */ +export function createCanConvertRequirement( + conversion: GenericConversion, + minGainAmount: Computable = 1, + display?: CoercableComponent +) { + const computedMinGainAmount = convertComputable(minGainAmount); + return createBooleanRequirement( + () => Decimal.gte(unref(conversion.actualGain), unref(computedMinGainAmount)), + display + ); +}