mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-11-22 00:21:34 +00:00
Fixed dyes not being created outside lazy proxies
This commit is contained in:
parent
7715a7fa65
commit
32eea67b53
2 changed files with 336 additions and 199 deletions
|
@ -2,39 +2,51 @@
|
|||
* @module
|
||||
* @hidden
|
||||
*/
|
||||
import Modal from "components/Modal.vue";
|
||||
import MainDisplay from "features/resources/MainDisplay.vue";
|
||||
import Row from "components/layout/Row.vue";
|
||||
import Spacer from "components/layout/Spacer.vue";
|
||||
import Sqrt from "components/math/Sqrt.vue";
|
||||
import { BuyableOptions, GenericBuyable, createBuyable } from "features/buyable";
|
||||
import Modal from "components/Modal.vue";
|
||||
import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common";
|
||||
import { BuyableOptions, createBuyable, GenericBuyable } from "features/buyable";
|
||||
import { jsx, JSXFunction, showIf, Visibility } from "features/feature";
|
||||
import MainDisplay from "features/resources/MainDisplay.vue";
|
||||
import { createResource, Resource } from "features/resources/resource";
|
||||
import { globalBus } from "game/events";
|
||||
import { BaseLayer, createLayer } from "game/layers";
|
||||
import { noPersist, persistent } from "game/persistence";
|
||||
import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
|
||||
import { computed, ComputedRef, ref, Ref, unref } from "vue";
|
||||
import trees from "./trees";
|
||||
import oil from "./oil";
|
||||
import { coerceComponent, render, renderCol, renderRow } from "util/vue";
|
||||
import { setUpDailyProgressTracker, createCollapsibleModifierSections } from "data/common";
|
||||
import { createAdditiveModifier, createMultiplicativeModifier, createSequentialModifier, Modifier } from "game/modifiers";
|
||||
import { WithRequired } from "util/common";
|
||||
import { createUpgrade, GenericUpgrade } from "features/upgrades/upgrade";
|
||||
import { BaseLayer, createLayer } from "game/layers";
|
||||
import {
|
||||
createAdditiveModifier,
|
||||
createMultiplicativeModifier,
|
||||
createSequentialModifier,
|
||||
Modifier
|
||||
} from "game/modifiers";
|
||||
import { NonPersistent, noPersist, Persistent } from "game/persistence";
|
||||
import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
|
||||
import { WithRequired } from "util/common";
|
||||
import { Computable, convertComputable } from "util/computed";
|
||||
import { createLazyProxy } from "util/proxies";
|
||||
import { render, renderCol, renderRow } from "util/vue";
|
||||
import { computed, ComputedRef, ref, Ref, unref } from "vue";
|
||||
import coal from "./coal";
|
||||
import oil from "./oil";
|
||||
import trees from "./trees";
|
||||
|
||||
interface Dye {
|
||||
name: string,
|
||||
amount: Resource<DecimalSource>,
|
||||
buyable: GenericBuyable,
|
||||
toGenerate: WithRequired<Modifier, "description" | "revert">,
|
||||
computedToGenerate: ComputedRef<DecimalSource>,
|
||||
display: JSXFunction
|
||||
name: string;
|
||||
amount: Resource<DecimalSource> &
|
||||
Persistent<DecimalSource> & { [NonPersistent]: Resource<DecimalSource> };
|
||||
buyable: GenericBuyable;
|
||||
toGenerate: WithRequired<Modifier, "description" | "revert">;
|
||||
computedToGenerate: ComputedRef<DecimalSource>;
|
||||
display: JSXFunction;
|
||||
}
|
||||
|
||||
type DyeUpg = "blueDyeUpg" | "redDyeUpg" | "yellowDyeUpg" | "yellowDyeUpg2" | "redDyeUpg2" | "blueDyeUpg2" | "coalUpg"
|
||||
type DyeUpg =
|
||||
| "blueDyeUpg"
|
||||
| "redDyeUpg"
|
||||
| "yellowDyeUpg"
|
||||
| "yellowDyeUpg2"
|
||||
| "redDyeUpg2"
|
||||
| "blueDyeUpg2"
|
||||
| "coalUpg";
|
||||
|
||||
const id = "dyes";
|
||||
const day = 11;
|
||||
|
@ -43,134 +55,171 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
const color = "#D4D4F4";
|
||||
|
||||
function createDye(
|
||||
optionsFunc: () => {
|
||||
name: string;
|
||||
color: string;
|
||||
costs: {
|
||||
base: Ref<DecimalSource> | DecimalSource;
|
||||
root?: Ref<DecimalSource> | DecimalSource,
|
||||
res: Resource<DecimalSource>
|
||||
}[];
|
||||
listedBoosts: {
|
||||
visible: Ref<boolean> | boolean,
|
||||
desc: Ref<string>
|
||||
options: {
|
||||
name: string;
|
||||
color: string;
|
||||
costs: Computable<
|
||||
{
|
||||
base: Ref<DecimalSource> | DecimalSource;
|
||||
root?: Ref<DecimalSource> | DecimalSource;
|
||||
res: Resource<DecimalSource>;
|
||||
}[]
|
||||
>;
|
||||
listedBoosts: {
|
||||
visible: Ref<boolean> | boolean;
|
||||
desc: Ref<string>;
|
||||
}[];
|
||||
dyesToReset: {
|
||||
name: string,
|
||||
reset: VoidFunction
|
||||
}[]
|
||||
name: string;
|
||||
reset: VoidFunction;
|
||||
}[];
|
||||
} & Partial<BuyableOptions>
|
||||
): Dye {
|
||||
return createLazyProxy(() => {
|
||||
const options = optionsFunc();
|
||||
const amount = createResource<DecimalSource>(0, name);
|
||||
|
||||
const amount = createResource<DecimalSource>(0, optionsFunc().name);
|
||||
const toGenerate = createSequentialModifier(() => [
|
||||
createAdditiveModifier(() => ({
|
||||
addend: () => Decimal.add(buyable.amount.value, 1),
|
||||
description: `${options.name} Chambers`
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: boosts.orange1,
|
||||
description: "Orange Dye Boost 1",
|
||||
enabled: options.color == "red" || options.color == "yellow"
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: boosts.green1,
|
||||
description: "Green Dye Boost 1",
|
||||
enabled: options.color == "yellow" || options.color == "blue"
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: boosts.purple1,
|
||||
description: "Purple Dye Boost 1",
|
||||
enabled: options.color == "red" || options.color == "blue"
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: 2,
|
||||
description: "Wetter Dyes",
|
||||
enabled: () => upgrades.yellowDyeUpg.bought.value && options.color == "red" || options.color == "yellow" || options.color == "blue"
|
||||
}))
|
||||
]) as WithRequired<Modifier, "description" | "revert">;
|
||||
const computedToGenerate = computed(() => toGenerate.apply(0));
|
||||
|
||||
const buyable: GenericBuyable = createBuyable(() => ({
|
||||
const toGenerate = createSequentialModifier(() => [
|
||||
createAdditiveModifier(() => ({
|
||||
addend: () => Decimal.add(buyable.amount.value, 1),
|
||||
description: `${name} Chambers`
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: boosts.orange1,
|
||||
description: "Orange Dye Boost 1",
|
||||
enabled: options.color == "red" || options.color == "yellow"
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: boosts.green1,
|
||||
description: "Green Dye Boost 1",
|
||||
enabled: options.color == "yellow" || options.color == "blue"
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: boosts.purple1,
|
||||
description: "Purple Dye Boost 1",
|
||||
enabled: options.color == "red" || options.color == "blue"
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: 2,
|
||||
description: "Wetter Dyes",
|
||||
enabled: () =>
|
||||
(upgrades.yellowDyeUpg.bought.value && options.color == "red") ||
|
||||
options.color == "yellow" ||
|
||||
options.color == "blue"
|
||||
}))
|
||||
]) as WithRequired<Modifier, "description" | "revert">;
|
||||
const computedToGenerate = computed(() => toGenerate.apply(0));
|
||||
|
||||
const buyable: GenericBuyable = createBuyable(() => {
|
||||
const costs = convertComputable(options.costs);
|
||||
return {
|
||||
...options,
|
||||
style: () => ({ backgroundColor: unref(buyable.canPurchase) ? color : "#545454", minWidth: "200px" }),
|
||||
style: () => ({
|
||||
backgroundColor: unref(buyable.canPurchase) ? color : "#545454",
|
||||
minWidth: "200px"
|
||||
}),
|
||||
display: jsx(() => {
|
||||
return (
|
||||
<span>
|
||||
<h3>{options.name} Chambers</h3>
|
||||
<br/>
|
||||
Create {format(computedToGenerate.value)} {options.name}{options.dyesToReset.length > 0 ? ", but reset " + options.dyesToReset.map(dye => dye.name).join(", ") : ""}.
|
||||
<br/>
|
||||
<br/>
|
||||
<h3>{name} Chambers</h3>
|
||||
<br />
|
||||
Create {format(computedToGenerate.value)} {name}
|
||||
{options.dyesToReset.length > 0
|
||||
? ", but reset " +
|
||||
options.dyesToReset.map(dye => dye.name).join(", ")
|
||||
: ""}
|
||||
.
|
||||
<br />
|
||||
<br />
|
||||
<span class="white-space: pre-wrap">
|
||||
Currently: {options.listedBoosts.filter(b => unref(b.visible)).map(b => render(jsx(() => <div>{unref(b.desc)}</div>)))}
|
||||
Currently:{" "}
|
||||
{options.listedBoosts
|
||||
.filter(b => unref(b.visible))
|
||||
.map(b => render(jsx(() => <div>{unref(b.desc)}</div>)))}
|
||||
</span>
|
||||
<br/>
|
||||
<br />
|
||||
<div>
|
||||
Cost: {options.costs.map(c => render(jsx(() =>
|
||||
<div>
|
||||
{format(unref(Decimal.pow(unref(buyable.cost) ?? Decimal.dInf, unref(c.root ?? 1)).times(unref(c.base))))}
|
||||
{" "}{c.res.displayName}<br/>
|
||||
</div>)))}
|
||||
Cost:{" "}
|
||||
{unref(costs).map(c =>
|
||||
render(
|
||||
jsx(() => (
|
||||
<div>
|
||||
{format(
|
||||
unref(
|
||||
Decimal.pow(
|
||||
unref(buyable.cost) ?? Decimal.dInf,
|
||||
unref(c.root ?? 1)
|
||||
).times(unref(c.base))
|
||||
)
|
||||
)}{" "}
|
||||
{c.res.displayName}
|
||||
<br />
|
||||
</div>
|
||||
))
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
</span>
|
||||
);
|
||||
}),
|
||||
cost() {
|
||||
let v = buyable.amount.value;
|
||||
if (Decimal.gte(v, 25)) v = Decimal.pow(v, 2).div(20) // intentional price jump #2
|
||||
if (Decimal.gte(v, 25)) v = Decimal.pow(v, 2).div(20); // intentional price jump #2
|
||||
if (Decimal.gte(v, 10)) v = Decimal.pow(v, 2).div(5); // intentional price jump
|
||||
return Decimal.div(v, 10).plus(1);
|
||||
},
|
||||
canPurchase: computed((cost?: DecimalSource) => {
|
||||
if (unref(buyable.visibility) != Visibility.Visible) return false;
|
||||
const trueCost = cost ?? unref(buyable.cost) ?? Decimal.dInf;
|
||||
return options.costs.every(c => Decimal.div(c.res.value, unref(c.base)).root(unref(c.root ?? 1)).gte(trueCost));
|
||||
return unref(costs).every(c =>
|
||||
Decimal.div(c.res.value, unref(c.base))
|
||||
.root(unref(c.root ?? 1))
|
||||
.gte(trueCost)
|
||||
);
|
||||
}),
|
||||
onPurchase(cost?: DecimalSource) {
|
||||
const trueCost = cost ?? unref(buyable.cost) ?? Decimal.dInf;
|
||||
options.costs.forEach(c => {
|
||||
c.res.value = Decimal.sub(c.res.value, Decimal.pow(trueCost, unref(c.root ?? 1)).times(unref(c.base)));
|
||||
unref(costs).forEach(c => {
|
||||
c.res.value = Decimal.sub(
|
||||
c.res.value,
|
||||
Decimal.pow(trueCost, unref(c.root ?? 1)).times(unref(c.base))
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
amount.value = Decimal.add(amount.value, computedToGenerate.value);
|
||||
buyable.amount.value = Decimal.add(buyable.amount.value, 1);
|
||||
|
||||
|
||||
options.dyesToReset.forEach(dye => dye.reset());
|
||||
}
|
||||
}));
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
name: options.name,
|
||||
amount,
|
||||
buyable,
|
||||
toGenerate,
|
||||
computedToGenerate,
|
||||
display: jsx(() => (
|
||||
<div class="col" style="max-width: 200px">
|
||||
<MainDisplay resource={amount} color={options.color} style="margin-bottom: 0" />
|
||||
<Spacer />
|
||||
{render(buyable)}
|
||||
</div>
|
||||
))
|
||||
}
|
||||
})
|
||||
return {
|
||||
name,
|
||||
amount,
|
||||
buyable,
|
||||
toGenerate,
|
||||
computedToGenerate,
|
||||
display: jsx(() => (
|
||||
<div class="col" style="max-width: 200px">
|
||||
<MainDisplay resource={amount} color={options.color} style="margin-bottom: 0" />
|
||||
<Spacer />
|
||||
{render(buyable)}
|
||||
</div>
|
||||
))
|
||||
};
|
||||
}
|
||||
|
||||
const dyes: Record<"red" | "yellow" | "blue" | "orange" | "green" | "purple", Dye> = {
|
||||
red: createDye(() => ({
|
||||
red: createDye({
|
||||
name: "Red Dye",
|
||||
color: "red",
|
||||
costs: [
|
||||
costs: () => [
|
||||
{
|
||||
base: '2e18',
|
||||
base: "2e18",
|
||||
root: 5,
|
||||
res: trees.logs
|
||||
},
|
||||
{
|
||||
base: computed(() => upgrades.yellowDyeUpg2.bought.value ? '2.5e5' : '5e5'),
|
||||
base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "2.5e5" : "5e5")),
|
||||
root: 2,
|
||||
res: oil.oil
|
||||
}
|
||||
|
@ -178,22 +227,27 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
listedBoosts: [
|
||||
{
|
||||
visible: true,
|
||||
desc: computed(() => `+${format(boosts.red1.value)} effective Oil Pumps (does not impact coal consumption)`)
|
||||
desc: computed(
|
||||
() =>
|
||||
`+${format(
|
||||
boosts.red1.value
|
||||
)} effective Oil Pumps (does not impact coal consumption)`
|
||||
)
|
||||
}
|
||||
],
|
||||
dyesToReset: [],
|
||||
})),
|
||||
yellow: createDye(() => ({
|
||||
dyesToReset: []
|
||||
}),
|
||||
yellow: createDye({
|
||||
name: "Yellow Dye",
|
||||
color: "yellow",
|
||||
costs: [
|
||||
costs: () => [
|
||||
{
|
||||
base: '1e18',
|
||||
base: "1e18",
|
||||
root: 5,
|
||||
res: trees.logs
|
||||
},
|
||||
{
|
||||
base: computed(() => upgrades.yellowDyeUpg2.bought.value ? '5e5' : '1e6'),
|
||||
base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "5e5" : "1e6")),
|
||||
root: 2,
|
||||
res: oil.oil
|
||||
}
|
||||
|
@ -204,19 +258,19 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
desc: computed(() => `x${format(boosts.yellow1.value)} Paper \& Plastic gain`)
|
||||
}
|
||||
],
|
||||
dyesToReset: [],
|
||||
})),
|
||||
blue: createDye(() => ({
|
||||
dyesToReset: []
|
||||
}),
|
||||
blue: createDye({
|
||||
name: "Blue Dye",
|
||||
color: "blue",
|
||||
costs: [
|
||||
costs: () => [
|
||||
{
|
||||
base: '5e17',
|
||||
base: "5e17",
|
||||
root: 5,
|
||||
res: trees.logs
|
||||
},
|
||||
{
|
||||
base: computed(() => upgrades.yellowDyeUpg2.bought.value ? '1e6' : '2e6'),
|
||||
base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "1e6" : "2e6")),
|
||||
root: 2,
|
||||
res: oil.oil
|
||||
}
|
||||
|
@ -224,15 +278,20 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
listedBoosts: [
|
||||
{
|
||||
visible: true,
|
||||
desc: computed(() => `+${formatWhole(boosts.blue1.value)} forest size (after all other modifiers).`)
|
||||
desc: computed(
|
||||
() =>
|
||||
`+${formatWhole(
|
||||
boosts.blue1.value
|
||||
)} forest size (after all other modifiers).`
|
||||
)
|
||||
}
|
||||
],
|
||||
dyesToReset: [],
|
||||
})),
|
||||
orange: createDye(() => ({
|
||||
dyesToReset: []
|
||||
}),
|
||||
orange: createDye({
|
||||
name: "Orange Dye",
|
||||
color: "orange",
|
||||
costs: [
|
||||
costs: () => [
|
||||
{
|
||||
base: 15,
|
||||
root: 2,
|
||||
|
@ -254,24 +313,27 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
desc: computed(() => `/${format(boosts.orange2.value)} Box buyable costs.`)
|
||||
}
|
||||
],
|
||||
dyesToReset: [{
|
||||
name: "Red Dye",
|
||||
reset() {
|
||||
dyes.red.amount.value = 0;
|
||||
dyes.red.buyable.amount.value = 0;
|
||||
dyesToReset: [
|
||||
{
|
||||
name: "Red Dye",
|
||||
reset() {
|
||||
dyes.red.amount.value = 0;
|
||||
dyes.red.buyable.amount.value = 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Yellow Dye",
|
||||
reset() {
|
||||
dyes.yellow.amount.value = 0;
|
||||
dyes.yellow.buyable.amount.value = 0;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
name: "Yellow Dye",
|
||||
reset() {
|
||||
dyes.yellow.amount.value = 0;
|
||||
dyes.yellow.buyable.amount.value = 0;
|
||||
}
|
||||
}],
|
||||
})),
|
||||
green: createDye(() => ({
|
||||
]
|
||||
}),
|
||||
green: createDye({
|
||||
name: "Green Dye",
|
||||
color: "green",
|
||||
costs: [
|
||||
costs: () => [
|
||||
{
|
||||
base: 15,
|
||||
root: 2,
|
||||
|
@ -290,27 +352,35 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
},
|
||||
{
|
||||
visible: true,
|
||||
desc: computed(() => `x${formatWhole(Decimal.sub(boosts.green2.value, 1).times(100))}% Kiln synergy effect.`)
|
||||
desc: computed(
|
||||
() =>
|
||||
`x${formatWhole(
|
||||
Decimal.sub(boosts.green2.value, 1).times(100)
|
||||
)}% Kiln synergy effect.`
|
||||
)
|
||||
}
|
||||
],
|
||||
dyesToReset: [{
|
||||
name: "Yellow Dye",
|
||||
reset() {
|
||||
dyes.yellow.amount.value = 0;
|
||||
dyes.yellow.buyable.amount.value = 0;
|
||||
dyesToReset: [
|
||||
{
|
||||
name: "Yellow Dye",
|
||||
reset() {
|
||||
dyes.yellow.amount.value = 0;
|
||||
dyes.yellow.buyable.amount.value = 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Blue Dye",
|
||||
reset() {
|
||||
dyes.blue.amount.value = 0;
|
||||
dyes.blue.buyable.amount.value = 0;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: "Blue Dye",
|
||||
reset() {
|
||||
dyes.blue.amount.value = 0;
|
||||
dyes.blue.buyable.amount.value = 0;
|
||||
}
|
||||
}],
|
||||
})),
|
||||
purple: createDye(() => ({
|
||||
]
|
||||
}),
|
||||
purple: createDye({
|
||||
name: "Purple Dye",
|
||||
color: "purple",
|
||||
costs: [
|
||||
costs: () => [
|
||||
{
|
||||
base: 15,
|
||||
root: 2,
|
||||
|
@ -329,37 +399,64 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
},
|
||||
{
|
||||
visible: true,
|
||||
desc: computed(() => `x${format(boosts.purple2.value)} Smelting Speed and Ore Purity`)
|
||||
desc: computed(
|
||||
() => `x${format(boosts.purple2.value)} Smelting Speed and Ore Purity`
|
||||
)
|
||||
}
|
||||
],
|
||||
dyesToReset: [{
|
||||
name: "Blue Dye",
|
||||
reset() {
|
||||
dyes.blue.amount.value = 0;
|
||||
dyes.blue.buyable.amount.value = 0;
|
||||
dyesToReset: [
|
||||
{
|
||||
name: "Blue Dye",
|
||||
reset() {
|
||||
dyes.blue.amount.value = 0;
|
||||
dyes.blue.buyable.amount.value = 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Red Dye",
|
||||
reset() {
|
||||
dyes.red.amount.value = 0;
|
||||
dyes.red.buyable.amount.value = 0;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
name: "Red Dye",
|
||||
reset() {
|
||||
dyes.red.amount.value = 0;
|
||||
dyes.red.buyable.amount.value = 0;
|
||||
}
|
||||
}],
|
||||
}))
|
||||
]
|
||||
})
|
||||
};
|
||||
|
||||
const boosts = {
|
||||
red1: computed(() => Decimal.pow(Decimal.add(dyes.red.amount.value, 1).log2().plus(1).log2().div(2), upgrades.blueDyeUpg2.bought.value ? 1.5 : 1)),
|
||||
red1: computed(() =>
|
||||
Decimal.pow(
|
||||
Decimal.add(dyes.red.amount.value, 1).log2().plus(1).log2().div(2),
|
||||
upgrades.blueDyeUpg2.bought.value ? 1.5 : 1
|
||||
)
|
||||
),
|
||||
yellow1: computed(() => Decimal.add(dyes.yellow.amount.value, 1).log2().plus(1)),
|
||||
blue1: computed(() => Decimal.add(dyes.blue.amount.value, 1).log2().sqrt().times(5e6)),
|
||||
|
||||
orange1: computed(() => Decimal.pow(2, Decimal.add(dyes.orange.amount.value, 1).log2().sqrt()).pow(upgrades.coalUpg.bought.value ? 1.2 : 1)),
|
||||
orange1: computed(() =>
|
||||
Decimal.pow(2, Decimal.add(dyes.orange.amount.value, 1).log2().sqrt()).pow(
|
||||
upgrades.coalUpg.bought.value ? 1.2 : 1
|
||||
)
|
||||
),
|
||||
orange2: computed(() => Decimal.add(dyes.orange.amount.value, 1).log2().plus(1)),
|
||||
green1: computed(() => Decimal.pow(2, Decimal.add(dyes.green.amount.value, 1).log2().sqrt()).pow(upgrades.coalUpg.bought.value ? 1.2 : 1)),
|
||||
green2: computed(() => Decimal.add(dyes.green.amount.value, 1).log2().plus(1).pow(upgrades.coalUpg.bought.value ? 2 : 1)),
|
||||
purple1: computed(() => Decimal.pow(2, Decimal.add(dyes.purple.amount.value, 1).log2().sqrt()).pow(upgrades.coalUpg.bought.value ? 1.2 : 1)),
|
||||
purple2: computed(() => Decimal.add(dyes.purple.amount.value, 1).log2().plus(1)),
|
||||
}
|
||||
green1: computed(() =>
|
||||
Decimal.pow(2, Decimal.add(dyes.green.amount.value, 1).log2().sqrt()).pow(
|
||||
upgrades.coalUpg.bought.value ? 1.2 : 1
|
||||
)
|
||||
),
|
||||
green2: computed(() =>
|
||||
Decimal.add(dyes.green.amount.value, 1)
|
||||
.log2()
|
||||
.plus(1)
|
||||
.pow(upgrades.coalUpg.bought.value ? 2 : 1)
|
||||
),
|
||||
purple1: computed(() =>
|
||||
Decimal.pow(2, Decimal.add(dyes.purple.amount.value, 1).log2().sqrt()).pow(
|
||||
upgrades.coalUpg.bought.value ? 1.2 : 1
|
||||
)
|
||||
),
|
||||
purple2: computed(() => Decimal.add(dyes.purple.amount.value, 1).log2().plus(1))
|
||||
};
|
||||
|
||||
const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [
|
||||
{
|
||||
|
@ -396,39 +493,62 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
|
||||
const upgrades: Record<DyeUpg, GenericUpgrade> = {
|
||||
blueDyeUpg: createUpgrade(() => ({
|
||||
visibility: () => showIf(Decimal.add(dyes.orange.amount.value, dyes.green.amount.value).add(dyes.purple.amount.value).gte(1) || upgrades.blueDyeUpg.bought.value),
|
||||
visibility: () =>
|
||||
showIf(
|
||||
Decimal.add(dyes.orange.amount.value, dyes.green.amount.value)
|
||||
.add(dyes.purple.amount.value)
|
||||
.gte(1) || upgrades.blueDyeUpg.bought.value
|
||||
),
|
||||
display: {
|
||||
title: "Is Blue Dye just Water?",
|
||||
description: jsx(() => <>Multiply Log gain by log<sub>10</sub>(Auto Cutting Amount)+1.</>)
|
||||
description: jsx(() => (
|
||||
<>
|
||||
Multiply Log gain by log<sub>10</sub>(Auto Cutting Amount)+1.
|
||||
</>
|
||||
))
|
||||
},
|
||||
cost: 1000,
|
||||
resource: dyes.blue.amount,
|
||||
resource: noPersist(dyes.blue.amount),
|
||||
onPurchase() {
|
||||
dyes.blue.amount.value = 0;
|
||||
dyes.blue.buyable.amount.value = 0;
|
||||
}
|
||||
})),
|
||||
redDyeUpg: createUpgrade(() => ({
|
||||
visibility: () => showIf(Decimal.add(dyes.orange.amount.value, dyes.green.amount.value).add(dyes.purple.amount.value).gte(10) || upgrades.redDyeUpg.bought.value),
|
||||
visibility: () =>
|
||||
showIf(
|
||||
Decimal.add(dyes.orange.amount.value, dyes.green.amount.value)
|
||||
.add(dyes.purple.amount.value)
|
||||
.gte(10) || upgrades.redDyeUpg.bought.value
|
||||
),
|
||||
display: {
|
||||
title: "Glistening Paint",
|
||||
description: jsx(() => <>Multiply Ore Purity by log<sub>10</sub>(Cloth)+1.</>)
|
||||
description: jsx(() => (
|
||||
<>
|
||||
Multiply Ore Purity by log<sub>10</sub>(Cloth)+1.
|
||||
</>
|
||||
))
|
||||
},
|
||||
cost: 1500,
|
||||
resource: dyes.red.amount,
|
||||
resource: noPersist(dyes.red.amount),
|
||||
onPurchase() {
|
||||
dyes.red.amount.value = 0;
|
||||
dyes.red.buyable.amount.value = 0;
|
||||
}
|
||||
})),
|
||||
yellowDyeUpg: createUpgrade(() => ({
|
||||
visibility: () => showIf(Decimal.add(dyes.orange.amount.value, dyes.green.amount.value).add(dyes.purple.amount.value).gte(100) || upgrades.yellowDyeUpg.bought.value),
|
||||
visibility: () =>
|
||||
showIf(
|
||||
Decimal.add(dyes.orange.amount.value, dyes.green.amount.value)
|
||||
.add(dyes.purple.amount.value)
|
||||
.gte(100) || upgrades.yellowDyeUpg.bought.value
|
||||
),
|
||||
display: {
|
||||
title: "Wetter Dyes",
|
||||
description: "Double Red, Yellow, and Blue Dye gain, but reset their amounts."
|
||||
},
|
||||
cost: 2000,
|
||||
resource: dyes.yellow.amount,
|
||||
resource: noPersist(dyes.yellow.amount),
|
||||
onPurchase() {
|
||||
dyes.red.amount.value = 0;
|
||||
dyes.red.buyable.amount.value = 0;
|
||||
|
@ -447,7 +567,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
description: "Halve the Oil cost of Red, Yellow, and Blue Dyes."
|
||||
},
|
||||
cost: 5000,
|
||||
resource: dyes.yellow.amount,
|
||||
resource: noPersist(dyes.yellow.amount),
|
||||
onPurchase() {
|
||||
dyes.yellow.amount.value = 0;
|
||||
dyes.yellow.buyable.amount.value = 0;
|
||||
|
@ -457,10 +577,14 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
visibility: () => showIf(upgrades.redDyeUpg.bought.value),
|
||||
display: {
|
||||
title: "De Louvre",
|
||||
description: jsx(() => <>Multiply Smelting Speed by <Sqrt>Refineries+1</Sqrt>.</>)
|
||||
description: jsx(() => (
|
||||
<>
|
||||
Multiply Smelting Speed by <Sqrt>Refineries+1</Sqrt>.
|
||||
</>
|
||||
))
|
||||
},
|
||||
cost: 6000,
|
||||
resource: dyes.red.amount,
|
||||
resource: noPersist(dyes.red.amount),
|
||||
onPurchase() {
|
||||
dyes.red.amount.value = 0;
|
||||
dyes.red.buyable.amount.value = 0;
|
||||
|
@ -473,17 +597,23 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
description: "Raise Red Dye's effect ^1.5."
|
||||
},
|
||||
cost: 7500,
|
||||
resource: dyes.blue.amount,
|
||||
resource: noPersist(dyes.blue.amount),
|
||||
onPurchase() {
|
||||
dyes.blue.amount.value = 0;
|
||||
dyes.blue.buyable.amount.value = 0;
|
||||
}
|
||||
})),
|
||||
coalUpg: createUpgrade(() => ({
|
||||
visibility: () => showIf(upgrades.blueDyeUpg2.bought.value && upgrades.redDyeUpg2.bought.value && upgrades.yellowDyeUpg2.bought.value),
|
||||
visibility: () =>
|
||||
showIf(
|
||||
upgrades.blueDyeUpg2.bought.value &&
|
||||
upgrades.redDyeUpg2.bought.value &&
|
||||
upgrades.yellowDyeUpg2.bought.value
|
||||
),
|
||||
display: {
|
||||
title: "Denser Spectrum",
|
||||
description: "Orange, Green, and Purple Dyes' first effect is raised ^1.2, and Green Dye's second effect is squared. Buying this resets Red, Yellow, and Blue Dyes.",
|
||||
description:
|
||||
"Orange, Green, and Purple Dyes' first effect is raised ^1.2, and Green Dye's second effect is squared. Buying this resets Red, Yellow, and Blue Dyes."
|
||||
},
|
||||
cost: "5e30",
|
||||
resource: coal.coal,
|
||||
|
@ -498,7 +628,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
dyes.blue.buyable.amount.value = 0;
|
||||
}
|
||||
}))
|
||||
}
|
||||
};
|
||||
|
||||
const showModifiersModal = ref(false);
|
||||
const modifiersModal = jsx(() => (
|
||||
|
@ -512,7 +642,12 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
/>
|
||||
));
|
||||
|
||||
const dyeSum = createResource<DecimalSource>(computed(() => Object.values(dyes).reduce<DecimalSource>((a,c) => Decimal.add(a, c.amount.value), 0)), "Sum of Dyes");
|
||||
const dyeSum = createResource<DecimalSource>(
|
||||
computed(() =>
|
||||
Object.values(dyes).reduce<DecimalSource>((a, c) => Decimal.add(a, c.amount.value), 0)
|
||||
),
|
||||
"Sum of Dyes"
|
||||
);
|
||||
|
||||
const { total: totalDyeSum, trackerDisplay } = setUpDailyProgressTracker({
|
||||
resource: dyeSum,
|
||||
|
@ -554,7 +689,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
{render(upgrades.coalUpg)}
|
||||
</>
|
||||
))
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
export default layer;
|
||||
export default layer;
|
||||
|
|
|
@ -24,17 +24,17 @@ import {
|
|||
Modifier
|
||||
} from "game/modifiers";
|
||||
import { noPersist, persistent } from "game/persistence";
|
||||
import Decimal, { DecimalSource, format, formatWhole, formatLimit, formatGain } from "util/bignum";
|
||||
import Decimal, { DecimalSource, format, formatGain, formatLimit, formatWhole } from "util/bignum";
|
||||
import { Direction, WithRequired } from "util/common";
|
||||
import { render, renderRow } from "util/vue";
|
||||
import { render, renderGrid, renderRow } from "util/vue";
|
||||
import { computed, ref } from "vue";
|
||||
import boxes from "./boxes";
|
||||
import cloth from "./cloth";
|
||||
import coal from "./coal";
|
||||
import dyes from "./dyes";
|
||||
import elves from "./elves";
|
||||
import paper from "./paper";
|
||||
import workshop from "./workshop";
|
||||
import dyes from "./dyes";
|
||||
const id = "trees";
|
||||
const day = 1;
|
||||
|
||||
|
@ -426,7 +426,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
enabled: cloth.treesUpgrades.treesUpgrade4.bought
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: computed(() => Decimal.add(computedAutoCuttingAmount.value, 1).log10().plus(1)),
|
||||
multiplier: computed(() =>
|
||||
Decimal.add(computedAutoCuttingAmount.value, 1).log10().plus(1)
|
||||
),
|
||||
description: "Is Blue Dye just Water?",
|
||||
enabled: dyes.upgrades.blueDyeUpg.bought
|
||||
})),
|
||||
|
|
Loading…
Reference in a new issue