Fixed independent conversions with buyMax false capping incorrectly

This commit is contained in:
thepaperpilot 2022-04-10 22:29:32 -05:00
parent b478999e7e
commit 78262996ad

View file

@ -214,6 +214,21 @@ export function createIndependentConversion<S extends ConversionOptions>(
setDefault(conversion, "buyMax", false); 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) { if (conversion.actualGain == null) {
conversion.actualGain = computed(() => { conversion.actualGain = computed(() => {
let gain = Decimal.sub( let gain = Decimal.sub(