From 78262996ad79a5291c34515375cacbfcca81d120 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 10 Apr 2022 22:29:32 -0500 Subject: [PATCH] Fixed independent conversions with buyMax false capping incorrectly --- src/features/conversion.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/features/conversion.ts b/src/features/conversion.ts index 70b4572..55b1547 100644 --- a/src/features/conversion.ts +++ b/src/features/conversion.ts @@ -214,6 +214,21 @@ export function createIndependentConversion( setDefault(conversion, "buyMax", false); + if (conversion.currentGain == null) { + conversion.currentGain = computed(() => { + let gain = conversion.gainModifier + ? conversion.gainModifier.apply( + conversion.scaling.currentGain(conversion as GenericConversion) + ) + : conversion.scaling.currentGain(conversion as GenericConversion); + gain = Decimal.floor(gain).max(conversion.gainResource.value); + + if (!unref(conversion.buyMax)) { + gain = gain.min(Decimal.add(conversion.gainResource.value, 1)); + } + return gain; + }); + } if (conversion.actualGain == null) { conversion.actualGain = computed(() => { let gain = Decimal.sub(