This commit is contained in:
unsoftcapped3 2022-12-15 03:15:53 +00:00
commit 2c38b2e4a1
2 changed files with 23 additions and 18 deletions

View file

@ -139,7 +139,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
},
style: {
color: colorText,
width: "160px"
width: "160px",
flexGrow: 1
}
})) as ElfBuyable & { resource: Resource };
const {
@ -206,7 +207,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
},
style: {
color: colorText,
width: "160px"
width: "160px",
flexGrow: 1
}
})) as ElfBuyable & { resource: Resource };
const {
@ -261,7 +263,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
},
style: {
color: colorText,
width: "160px"
width: "160px",
flexGrow: 1
}
})) as ElfBuyable & { resource: Resource };
const {
@ -296,7 +299,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
resource: metal.metal,
cost() {
let v = new Decimal(this.amount.value);
if (Decimal.gte(v, 100)) v = Decimal.pow(v, 4).div(100);
if (Decimal.gte(v, 10)) v = Decimal.pow(v, 4).div(10 ** 3);
v = Decimal.pow(0.95, paper.books.oilBook.totalAmount.value).times(v);
let price = Decimal.pow(16, v).times(2e6);
if (row2Upgrades[4].bought.value) {
@ -316,7 +319,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
}
let v = Decimal.div(x, 2e6).log(16);
v = v.div(Decimal.pow(0.95, paper.books.heavyDrillBook.totalAmount.value));
if (Decimal.gte(v, 100)) v = Decimal.mul(v, 100).root(4);
if (Decimal.gte(v, 10)) v = Decimal.mul(v, 10 ** 3).root(4);
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
},
display: jsx(() => (
@ -342,7 +345,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
},
style: {
color: colorText,
width: "160px"
width: "160px",
flexGrow: 1
}
})) as ElfBuyable & { resource: Resource };
const {
@ -370,14 +374,14 @@ const layer = createLayer(id, function (this: BaseLayer) {
resource: noPersist(oil),
cost() {
let v = new Decimal(this.amount.value);
if (Decimal.gte(v, 100)) v = Decimal.pow(v, 4).div(100);
if (Decimal.gte(v, 100)) v = Decimal.pow(v, 4).div(100 ** 3);
v = Decimal.pow(0.95, paper.books.oilBook.totalAmount.value).times(v);
return Decimal.pow(2, v).times(50);
},
inverseCost(x: DecimalSource) {
let v = Decimal.div(x, 50).log(2);
v = v.div(Decimal.pow(0.95, paper.books.oilBook.totalAmount.value));
if (Decimal.gte(v, 100)) v = Decimal.mul(v, 100).root(4);
if (Decimal.gte(v, 100)) v = Decimal.mul(v, 100 ** 3).root(4);
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
},
display: jsx(() => (
@ -410,7 +414,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
},
style: {
color: colorText,
width: "160px"
width: "160px",
flexGrow: 1
}
})) as ElfBuyable & { resource: Resource };
const {
@ -470,7 +475,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
},
style: {
color: colorText,
width: "160px"
width: "160px",
flexGrow: 1
}
})) as ElfBuyable & { resource: Resource };

View file

@ -3,14 +3,13 @@ import type { CoercableComponent } from "features/feature";
import { jsx } from "features/feature";
import settings from "game/settings";
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 { Computable, ProcessedComputable } from "util/computed";
import { convertComputable } from "util/computed";
import { createLazyProxy } from "util/proxies";
import { renderJSX } from "util/vue";
import { computed, unref } from "vue";
import player from "./player";
/**
* An object that can be used to apply or unapply some modification to a number.
@ -87,7 +86,7 @@ export function createAdditiveModifier<T extends AdditiveModifierOptions>(
) : null}
<span class="modifier-amount">
{Decimal.gte(unref(processedAddend), 0) ? "+" : ""}
{format(unref(processedAddend))}
{formatSmall(unref(processedAddend))}
</span>
</div>
))
@ -134,7 +133,7 @@ export function createMultiplicativeModifier<T extends MultiplicativeModifierOpt
</span>
) : null}
<span class="modifier-amount">
×{format(unref(processedMultiplier))}
×{formatSmall(unref(processedMultiplier))}
</span>
</div>
))
@ -204,7 +203,7 @@ export function createExponentialModifier<T extends ExponentialModifierOptions>(
</span>
) : null}
<span class="modifier-amount">
^{format(unref(processedExponent))}
^{formatSmall(unref(processedExponent))}
</span>
</div>
))
@ -274,7 +273,7 @@ export function createModifierSection(
baseText: CoercableComponent = "Base"
) {
return (
<div style={{"--unit": settings.alignUnits ? "'" + unit + "'" : ""}}>
<div style={{ "--unit": settings.alignUnits ? "'" + unit + "'" : "" }}>
<h3>
{title}
{subtitle ? <span class="subtitle"> ({subtitle})</span> : null}
@ -283,7 +282,7 @@ export function createModifierSection(
<div class="modifier-container">
<span class="modifier-description">{renderJSX(baseText)}</span>
<span class="modifier-amount">
{format(base)}
{formatSmall(base)}
{unit}
</span>
</div>
@ -292,7 +291,7 @@ export function createModifierSection(
<div class="modifier-container">
<span class="modifier-description">Total</span>
<span class="modifier-amount">
{format(modifier.apply(base))}
{formatSmall(modifier.apply(base))}
{unit}
</span>
</div>