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);
|
: conversion.scaling.currentGain(conversion as GenericConversion);
|
||||||
gain = Decimal.floor(gain).max(0);
|
gain = Decimal.floor(gain).max(0);
|
||||||
|
|
||||||
if (!conversion.buyMax) {
|
if (!unref(conversion.buyMax)) {
|
||||||
gain = gain.min(1);
|
gain = gain.min(1);
|
||||||
}
|
}
|
||||||
return gain;
|
return gain;
|
||||||
|
@ -211,12 +211,17 @@ export function createIndependentConversion<S extends ConversionOptions>(
|
||||||
setDefault(conversion, "buyMax", false);
|
setDefault(conversion, "buyMax", false);
|
||||||
|
|
||||||
if (conversion.actualGain == null) {
|
if (conversion.actualGain == null) {
|
||||||
conversion.actualGain = computed(() =>
|
conversion.actualGain = computed(() => {
|
||||||
Decimal.sub(
|
let gain = Decimal.sub(
|
||||||
conversion.scaling.currentGain(conversion as GenericConversion),
|
conversion.scaling.currentGain(conversion as GenericConversion),
|
||||||
conversion.gainResource.value
|
conversion.gainResource.value
|
||||||
).max(0)
|
).max(0);
|
||||||
);
|
|
||||||
|
if (!unref(conversion.buyMax)) {
|
||||||
|
gain = gain.min(1);
|
||||||
|
}
|
||||||
|
return gain;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
setDefault(conversion, "convert", function () {
|
setDefault(conversion, "convert", function () {
|
||||||
conversion.gainResource.value = conversion.gainModifier
|
conversion.gainResource.value = conversion.gainModifier
|
||||||
|
|
Loading…
Reference in a new issue