Made modifiers show small numbers

This commit is contained in:
thepaperpilot 2022-12-14 21:14:40 -06:00
parent 97faa20056
commit beb996803d

View file

@ -2,7 +2,7 @@ import "components/common/modifiers.css";
import type { CoercableComponent } from "features/feature"; import type { CoercableComponent } from "features/feature";
import { jsx } from "features/feature"; import { jsx } from "features/feature";
import type { DecimalSource } from "util/bignum"; import type { DecimalSource } from "util/bignum";
import Decimal, { format } from "util/bignum"; import Decimal, { formatSmall } from "util/bignum";
import type { WithRequired } from "util/common"; import type { WithRequired } from "util/common";
import type { Computable, ProcessedComputable } from "util/computed"; import type { Computable, ProcessedComputable } from "util/computed";
import { convertComputable } from "util/computed"; import { convertComputable } from "util/computed";
@ -85,7 +85,7 @@ export function createAdditiveModifier<T extends AdditiveModifierOptions>(
) : null} ) : null}
<span class="modifier-amount"> <span class="modifier-amount">
{Decimal.gte(unref(processedAddend), 0) ? "+" : ""} {Decimal.gte(unref(processedAddend), 0) ? "+" : ""}
{format(unref(processedAddend))} {formatSmall(unref(processedAddend))}
</span> </span>
</div> </div>
)) ))
@ -132,7 +132,7 @@ export function createMultiplicativeModifier<T extends MultiplicativeModifierOpt
</span> </span>
) : null} ) : null}
<span class="modifier-amount"> <span class="modifier-amount">
×{format(unref(processedMultiplier))} ×{formatSmall(unref(processedMultiplier))}
</span> </span>
</div> </div>
)) ))
@ -202,7 +202,7 @@ export function createExponentialModifier<T extends ExponentialModifierOptions>(
</span> </span>
) : null} ) : null}
<span class="modifier-amount"> <span class="modifier-amount">
^{format(unref(processedExponent))} ^{formatSmall(unref(processedExponent))}
</span> </span>
</div> </div>
)) ))
@ -281,7 +281,7 @@ export function createModifierSection(
<div class="modifier-container"> <div class="modifier-container">
<span class="modifier-description">{renderJSX(baseText)}</span> <span class="modifier-description">{renderJSX(baseText)}</span>
<span class="modifier-amount"> <span class="modifier-amount">
{format(base)} {formatSmall(base)}
{unit} {unit}
</span> </span>
</div> </div>
@ -290,7 +290,7 @@ export function createModifierSection(
<div class="modifier-container"> <div class="modifier-container">
<span class="modifier-description">Total</span> <span class="modifier-description">Total</span>
<span class="modifier-amount"> <span class="modifier-amount">
{format(modifier.apply(base))} {formatSmall(modifier.apply(base))}
{unit} {unit}
</span> </span>
</div> </div>