forked from profectus/Profectus
Cap independent conversion's actualGain to 1 if buyMax is false
This commit is contained in:
parent
98c7cd7724
commit
3694e2be1f
1 changed files with 10 additions and 5 deletions
|
@ -74,7 +74,7 @@ export function createConversion<T extends ConversionOptions>(
|
|||
: conversion.scaling.currentGain(conversion as GenericConversion);
|
||||
gain = Decimal.floor(gain).max(0);
|
||||
|
||||
if (!conversion.buyMax) {
|
||||
if (!unref(conversion.buyMax)) {
|
||||
gain = gain.min(1);
|
||||
}
|
||||
return gain;
|
||||
|
@ -211,12 +211,17 @@ export function createIndependentConversion<S extends ConversionOptions>(
|
|||
setDefault(conversion, "buyMax", false);
|
||||
|
||||
if (conversion.actualGain == null) {
|
||||
conversion.actualGain = computed(() =>
|
||||
Decimal.sub(
|
||||
conversion.actualGain = computed(() => {
|
||||
let gain = Decimal.sub(
|
||||
conversion.scaling.currentGain(conversion as GenericConversion),
|
||||
conversion.gainResource.value
|
||||
).max(0)
|
||||
);
|
||||
).max(0);
|
||||
|
||||
if (!unref(conversion.buyMax)) {
|
||||
gain = gain.min(1);
|
||||
}
|
||||
return gain;
|
||||
});
|
||||
}
|
||||
setDefault(conversion, "convert", function () {
|
||||
conversion.gainResource.value = conversion.gainModifier
|
||||
|
|
Loading…
Reference in a new issue