Fixed independent conversions with buyMax false capping incorrectly
This commit is contained in:
parent
b478999e7e
commit
78262996ad
1 changed files with 15 additions and 0 deletions
|
@ -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(
|
||||||
|
|
Loading…
Reference in a new issue