From b478999e7e5e0ddc1e785f802a0ab1f06c2b959b Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 10 Apr 2022 22:28:39 -0500 Subject: [PATCH] Cap gain in nextAt and currentAt to 0 after modifier --- src/features/conversion.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/features/conversion.ts b/src/features/conversion.ts index e21b146..70b4572 100644 --- a/src/features/conversion.ts +++ b/src/features/conversion.ts @@ -150,6 +150,7 @@ export function createLinearScaling( if (conversion.gainModifier) { current = conversion.gainModifier.revert(current); } + current = Decimal.max(0, current); return Decimal.times(current, unref(coefficient)).add(unref(base)); }, nextAt(conversion) { @@ -157,6 +158,7 @@ export function createLinearScaling( if (conversion.gainModifier) { next = conversion.gainModifier.revert(next); } + next = Decimal.max(0, next); return Decimal.times(next, unref(coefficient)).add(unref(base)).max(unref(base)); } }; @@ -184,6 +186,7 @@ export function createPolynomialScaling( if (conversion.gainModifier) { current = conversion.gainModifier.revert(current); } + current = Decimal.max(0, current); return Decimal.root(current, unref(exponent)).times(unref(base)); }, nextAt(conversion) { @@ -191,6 +194,7 @@ export function createPolynomialScaling( if (conversion.gainModifier) { next = conversion.gainModifier.revert(next); } + next = Decimal.max(0, next); return Decimal.root(next, unref(exponent)).times(unref(base)).max(unref(base)); } };