mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2025-04-25 02:31:04 +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
|
* @module
|
||||||
* @hidden
|
* @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 Spacer from "components/layout/Spacer.vue";
|
||||||
import Sqrt from "components/math/Sqrt.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 { jsx, JSXFunction, showIf, Visibility } from "features/feature";
|
||||||
|
import MainDisplay from "features/resources/MainDisplay.vue";
|
||||||
import { createResource, Resource } from "features/resources/resource";
|
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 { 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 { createLazyProxy } from "util/proxies";
|
||||||
|
import { render, renderCol, renderRow } from "util/vue";
|
||||||
|
import { computed, ComputedRef, ref, Ref, unref } from "vue";
|
||||||
import coal from "./coal";
|
import coal from "./coal";
|
||||||
|
import oil from "./oil";
|
||||||
|
import trees from "./trees";
|
||||||
|
|
||||||
interface Dye {
|
interface Dye {
|
||||||
name: string,
|
name: string;
|
||||||
amount: Resource<DecimalSource>,
|
amount: Resource<DecimalSource> &
|
||||||
buyable: GenericBuyable,
|
Persistent<DecimalSource> & { [NonPersistent]: Resource<DecimalSource> };
|
||||||
toGenerate: WithRequired<Modifier, "description" | "revert">,
|
buyable: GenericBuyable;
|
||||||
computedToGenerate: ComputedRef<DecimalSource>,
|
toGenerate: WithRequired<Modifier, "description" | "revert">;
|
||||||
display: JSXFunction
|
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 id = "dyes";
|
||||||
const day = 11;
|
const day = 11;
|
||||||
|
@ -43,96 +55,133 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
const color = "#D4D4F4";
|
const color = "#D4D4F4";
|
||||||
|
|
||||||
function createDye(
|
function createDye(
|
||||||
optionsFunc: () => {
|
options: {
|
||||||
name: string;
|
name: string;
|
||||||
color: string;
|
color: string;
|
||||||
costs: {
|
costs: Computable<
|
||||||
base: Ref<DecimalSource> | DecimalSource;
|
{
|
||||||
root?: Ref<DecimalSource> | DecimalSource,
|
base: Ref<DecimalSource> | DecimalSource;
|
||||||
res: Resource<DecimalSource>
|
root?: Ref<DecimalSource> | DecimalSource;
|
||||||
}[];
|
res: Resource<DecimalSource>;
|
||||||
|
}[]
|
||||||
|
>;
|
||||||
listedBoosts: {
|
listedBoosts: {
|
||||||
visible: Ref<boolean> | boolean,
|
visible: Ref<boolean> | boolean;
|
||||||
desc: Ref<string>
|
desc: Ref<string>;
|
||||||
}[];
|
}[];
|
||||||
dyesToReset: {
|
dyesToReset: {
|
||||||
name: string,
|
name: string;
|
||||||
reset: VoidFunction
|
reset: VoidFunction;
|
||||||
}[]
|
}[];
|
||||||
} & Partial<BuyableOptions>
|
} & Partial<BuyableOptions>
|
||||||
): Dye {
|
): Dye {
|
||||||
return createLazyProxy(() => {
|
const amount = createResource<DecimalSource>(0, name);
|
||||||
const options = optionsFunc();
|
|
||||||
|
|
||||||
const amount = createResource<DecimalSource>(0, optionsFunc().name);
|
const toGenerate = createSequentialModifier(() => [
|
||||||
const toGenerate = createSequentialModifier(() => [
|
createAdditiveModifier(() => ({
|
||||||
createAdditiveModifier(() => ({
|
addend: () => Decimal.add(buyable.amount.value, 1),
|
||||||
addend: () => Decimal.add(buyable.amount.value, 1),
|
description: `${name} Chambers`
|
||||||
description: `${options.name} Chambers`
|
})),
|
||||||
})),
|
createMultiplicativeModifier(() => ({
|
||||||
createMultiplicativeModifier(() => ({
|
multiplier: boosts.orange1,
|
||||||
multiplier: boosts.orange1,
|
description: "Orange Dye Boost 1",
|
||||||
description: "Orange Dye Boost 1",
|
enabled: options.color == "red" || options.color == "yellow"
|
||||||
enabled: options.color == "red" || options.color == "yellow"
|
})),
|
||||||
})),
|
createMultiplicativeModifier(() => ({
|
||||||
createMultiplicativeModifier(() => ({
|
multiplier: boosts.green1,
|
||||||
multiplier: boosts.green1,
|
description: "Green Dye Boost 1",
|
||||||
description: "Green Dye Boost 1",
|
enabled: options.color == "yellow" || options.color == "blue"
|
||||||
enabled: options.color == "yellow" || options.color == "blue"
|
})),
|
||||||
})),
|
createMultiplicativeModifier(() => ({
|
||||||
createMultiplicativeModifier(() => ({
|
multiplier: boosts.purple1,
|
||||||
multiplier: boosts.purple1,
|
description: "Purple Dye Boost 1",
|
||||||
description: "Purple Dye Boost 1",
|
enabled: options.color == "red" || options.color == "blue"
|
||||||
enabled: options.color == "red" || options.color == "blue"
|
})),
|
||||||
})),
|
createMultiplicativeModifier(() => ({
|
||||||
createMultiplicativeModifier(() => ({
|
multiplier: 2,
|
||||||
multiplier: 2,
|
description: "Wetter Dyes",
|
||||||
description: "Wetter Dyes",
|
enabled: () =>
|
||||||
enabled: () => upgrades.yellowDyeUpg.bought.value && options.color == "red" || options.color == "yellow" || options.color == "blue"
|
(upgrades.yellowDyeUpg.bought.value && options.color == "red") ||
|
||||||
}))
|
options.color == "yellow" ||
|
||||||
]) as WithRequired<Modifier, "description" | "revert">;
|
options.color == "blue"
|
||||||
const computedToGenerate = computed(() => toGenerate.apply(0));
|
}))
|
||||||
|
]) as WithRequired<Modifier, "description" | "revert">;
|
||||||
|
const computedToGenerate = computed(() => toGenerate.apply(0));
|
||||||
|
|
||||||
const buyable: GenericBuyable = createBuyable(() => ({
|
const buyable: GenericBuyable = createBuyable(() => {
|
||||||
|
const costs = convertComputable(options.costs);
|
||||||
|
return {
|
||||||
...options,
|
...options,
|
||||||
style: () => ({ backgroundColor: unref(buyable.canPurchase) ? color : "#545454", minWidth: "200px" }),
|
style: () => ({
|
||||||
|
backgroundColor: unref(buyable.canPurchase) ? color : "#545454",
|
||||||
|
minWidth: "200px"
|
||||||
|
}),
|
||||||
display: jsx(() => {
|
display: jsx(() => {
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
<h3>{options.name} Chambers</h3>
|
<h3>{name} Chambers</h3>
|
||||||
<br/>
|
<br />
|
||||||
Create {format(computedToGenerate.value)} {options.name}{options.dyesToReset.length > 0 ? ", but reset " + options.dyesToReset.map(dye => dye.name).join(", ") : ""}.
|
Create {format(computedToGenerate.value)} {name}
|
||||||
<br/>
|
{options.dyesToReset.length > 0
|
||||||
<br/>
|
? ", but reset " +
|
||||||
|
options.dyesToReset.map(dye => dye.name).join(", ")
|
||||||
|
: ""}
|
||||||
|
.
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
<span class="white-space: pre-wrap">
|
<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>
|
</span>
|
||||||
<br/>
|
<br />
|
||||||
<div>
|
<div>
|
||||||
Cost: {options.costs.map(c => render(jsx(() =>
|
Cost:{" "}
|
||||||
<div>
|
{unref(costs).map(c =>
|
||||||
{format(unref(Decimal.pow(unref(buyable.cost) ?? Decimal.dInf, unref(c.root ?? 1)).times(unref(c.base))))}
|
render(
|
||||||
{" "}{c.res.displayName}<br/>
|
jsx(() => (
|
||||||
</div>)))}
|
<div>
|
||||||
|
{format(
|
||||||
|
unref(
|
||||||
|
Decimal.pow(
|
||||||
|
unref(buyable.cost) ?? Decimal.dInf,
|
||||||
|
unref(c.root ?? 1)
|
||||||
|
).times(unref(c.base))
|
||||||
|
)
|
||||||
|
)}{" "}
|
||||||
|
{c.res.displayName}
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
cost() {
|
cost() {
|
||||||
let v = buyable.amount.value;
|
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
|
if (Decimal.gte(v, 10)) v = Decimal.pow(v, 2).div(5); // intentional price jump
|
||||||
return Decimal.div(v, 10).plus(1);
|
return Decimal.div(v, 10).plus(1);
|
||||||
},
|
},
|
||||||
canPurchase: computed((cost?: DecimalSource) => {
|
canPurchase: computed((cost?: DecimalSource) => {
|
||||||
if (unref(buyable.visibility) != Visibility.Visible) return false;
|
if (unref(buyable.visibility) != Visibility.Visible) return false;
|
||||||
const trueCost = cost ?? unref(buyable.cost) ?? Decimal.dInf;
|
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) {
|
onPurchase(cost?: DecimalSource) {
|
||||||
const trueCost = cost ?? unref(buyable.cost) ?? Decimal.dInf;
|
const trueCost = cost ?? unref(buyable.cost) ?? Decimal.dInf;
|
||||||
options.costs.forEach(c => {
|
unref(costs).forEach(c => {
|
||||||
c.res.value = Decimal.sub(c.res.value, Decimal.pow(trueCost, unref(c.root ?? 1)).times(unref(c.base)));
|
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);
|
amount.value = Decimal.add(amount.value, computedToGenerate.value);
|
||||||
|
@ -140,37 +189,37 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
|
|
||||||
options.dyesToReset.forEach(dye => dye.reset());
|
options.dyesToReset.forEach(dye => dye.reset());
|
||||||
}
|
}
|
||||||
}));
|
};
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: options.name,
|
name,
|
||||||
amount,
|
amount,
|
||||||
buyable,
|
buyable,
|
||||||
toGenerate,
|
toGenerate,
|
||||||
computedToGenerate,
|
computedToGenerate,
|
||||||
display: jsx(() => (
|
display: jsx(() => (
|
||||||
<div class="col" style="max-width: 200px">
|
<div class="col" style="max-width: 200px">
|
||||||
<MainDisplay resource={amount} color={options.color} style="margin-bottom: 0" />
|
<MainDisplay resource={amount} color={options.color} style="margin-bottom: 0" />
|
||||||
<Spacer />
|
<Spacer />
|
||||||
{render(buyable)}
|
{render(buyable)}
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
}
|
};
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const dyes: Record<"red" | "yellow" | "blue" | "orange" | "green" | "purple", Dye> = {
|
const dyes: Record<"red" | "yellow" | "blue" | "orange" | "green" | "purple", Dye> = {
|
||||||
red: createDye(() => ({
|
red: createDye({
|
||||||
name: "Red Dye",
|
name: "Red Dye",
|
||||||
color: "red",
|
color: "red",
|
||||||
costs: [
|
costs: () => [
|
||||||
{
|
{
|
||||||
base: '2e18',
|
base: "2e18",
|
||||||
root: 5,
|
root: 5,
|
||||||
res: trees.logs
|
res: trees.logs
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
base: computed(() => upgrades.yellowDyeUpg2.bought.value ? '2.5e5' : '5e5'),
|
base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "2.5e5" : "5e5")),
|
||||||
root: 2,
|
root: 2,
|
||||||
res: oil.oil
|
res: oil.oil
|
||||||
}
|
}
|
||||||
|
@ -178,22 +227,27 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
listedBoosts: [
|
listedBoosts: [
|
||||||
{
|
{
|
||||||
visible: true,
|
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: [],
|
dyesToReset: []
|
||||||
})),
|
}),
|
||||||
yellow: createDye(() => ({
|
yellow: createDye({
|
||||||
name: "Yellow Dye",
|
name: "Yellow Dye",
|
||||||
color: "yellow",
|
color: "yellow",
|
||||||
costs: [
|
costs: () => [
|
||||||
{
|
{
|
||||||
base: '1e18',
|
base: "1e18",
|
||||||
root: 5,
|
root: 5,
|
||||||
res: trees.logs
|
res: trees.logs
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
base: computed(() => upgrades.yellowDyeUpg2.bought.value ? '5e5' : '1e6'),
|
base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "5e5" : "1e6")),
|
||||||
root: 2,
|
root: 2,
|
||||||
res: oil.oil
|
res: oil.oil
|
||||||
}
|
}
|
||||||
|
@ -204,19 +258,19 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
desc: computed(() => `x${format(boosts.yellow1.value)} Paper \& Plastic gain`)
|
desc: computed(() => `x${format(boosts.yellow1.value)} Paper \& Plastic gain`)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
dyesToReset: [],
|
dyesToReset: []
|
||||||
})),
|
}),
|
||||||
blue: createDye(() => ({
|
blue: createDye({
|
||||||
name: "Blue Dye",
|
name: "Blue Dye",
|
||||||
color: "blue",
|
color: "blue",
|
||||||
costs: [
|
costs: () => [
|
||||||
{
|
{
|
||||||
base: '5e17',
|
base: "5e17",
|
||||||
root: 5,
|
root: 5,
|
||||||
res: trees.logs
|
res: trees.logs
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
base: computed(() => upgrades.yellowDyeUpg2.bought.value ? '1e6' : '2e6'),
|
base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "1e6" : "2e6")),
|
||||||
root: 2,
|
root: 2,
|
||||||
res: oil.oil
|
res: oil.oil
|
||||||
}
|
}
|
||||||
|
@ -224,15 +278,20 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
listedBoosts: [
|
listedBoosts: [
|
||||||
{
|
{
|
||||||
visible: true,
|
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: [],
|
dyesToReset: []
|
||||||
})),
|
}),
|
||||||
orange: createDye(() => ({
|
orange: createDye({
|
||||||
name: "Orange Dye",
|
name: "Orange Dye",
|
||||||
color: "orange",
|
color: "orange",
|
||||||
costs: [
|
costs: () => [
|
||||||
{
|
{
|
||||||
base: 15,
|
base: 15,
|
||||||
root: 2,
|
root: 2,
|
||||||
|
@ -254,24 +313,27 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
desc: computed(() => `/${format(boosts.orange2.value)} Box buyable costs.`)
|
desc: computed(() => `/${format(boosts.orange2.value)} Box buyable costs.`)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
dyesToReset: [{
|
dyesToReset: [
|
||||||
name: "Red Dye",
|
{
|
||||||
reset() {
|
name: "Red Dye",
|
||||||
dyes.red.amount.value = 0;
|
reset() {
|
||||||
dyes.red.buyable.amount.value = 0;
|
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() {
|
green: createDye({
|
||||||
dyes.yellow.amount.value = 0;
|
|
||||||
dyes.yellow.buyable.amount.value = 0;
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
})),
|
|
||||||
green: createDye(() => ({
|
|
||||||
name: "Green Dye",
|
name: "Green Dye",
|
||||||
color: "green",
|
color: "green",
|
||||||
costs: [
|
costs: () => [
|
||||||
{
|
{
|
||||||
base: 15,
|
base: 15,
|
||||||
root: 2,
|
root: 2,
|
||||||
|
@ -290,27 +352,35 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visible: true,
|
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: [{
|
dyesToReset: [
|
||||||
name: "Yellow Dye",
|
{
|
||||||
reset() {
|
name: "Yellow Dye",
|
||||||
dyes.yellow.amount.value = 0;
|
reset() {
|
||||||
dyes.yellow.buyable.amount.value = 0;
|
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() {
|
purple: createDye({
|
||||||
dyes.blue.amount.value = 0;
|
|
||||||
dyes.blue.buyable.amount.value = 0;
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
})),
|
|
||||||
purple: createDye(() => ({
|
|
||||||
name: "Purple Dye",
|
name: "Purple Dye",
|
||||||
color: "purple",
|
color: "purple",
|
||||||
costs: [
|
costs: () => [
|
||||||
{
|
{
|
||||||
base: 15,
|
base: 15,
|
||||||
root: 2,
|
root: 2,
|
||||||
|
@ -329,37 +399,64 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visible: true,
|
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: [{
|
dyesToReset: [
|
||||||
name: "Blue Dye",
|
{
|
||||||
reset() {
|
name: "Blue Dye",
|
||||||
dyes.blue.amount.value = 0;
|
reset() {
|
||||||
dyes.blue.buyable.amount.value = 0;
|
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 = {
|
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)),
|
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)),
|
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)),
|
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)),
|
green1: computed(() =>
|
||||||
green2: computed(() => Decimal.add(dyes.green.amount.value, 1).log2().plus(1).pow(upgrades.coalUpg.bought.value ? 2 : 1)),
|
Decimal.pow(2, Decimal.add(dyes.green.amount.value, 1).log2().sqrt()).pow(
|
||||||
purple1: computed(() => Decimal.pow(2, Decimal.add(dyes.purple.amount.value, 1).log2().sqrt()).pow(upgrades.coalUpg.bought.value ? 1.2 : 1)),
|
upgrades.coalUpg.bought.value ? 1.2 : 1
|
||||||
purple2: computed(() => Decimal.add(dyes.purple.amount.value, 1).log2().plus(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(() => [
|
const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [
|
||||||
{
|
{
|
||||||
|
@ -396,39 +493,62 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
|
|
||||||
const upgrades: Record<DyeUpg, GenericUpgrade> = {
|
const upgrades: Record<DyeUpg, GenericUpgrade> = {
|
||||||
blueDyeUpg: createUpgrade(() => ({
|
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: {
|
display: {
|
||||||
title: "Is Blue Dye just Water?",
|
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,
|
cost: 1000,
|
||||||
resource: dyes.blue.amount,
|
resource: noPersist(dyes.blue.amount),
|
||||||
onPurchase() {
|
onPurchase() {
|
||||||
dyes.blue.amount.value = 0;
|
dyes.blue.amount.value = 0;
|
||||||
dyes.blue.buyable.amount.value = 0;
|
dyes.blue.buyable.amount.value = 0;
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
redDyeUpg: createUpgrade(() => ({
|
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: {
|
display: {
|
||||||
title: "Glistening Paint",
|
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,
|
cost: 1500,
|
||||||
resource: dyes.red.amount,
|
resource: noPersist(dyes.red.amount),
|
||||||
onPurchase() {
|
onPurchase() {
|
||||||
dyes.red.amount.value = 0;
|
dyes.red.amount.value = 0;
|
||||||
dyes.red.buyable.amount.value = 0;
|
dyes.red.buyable.amount.value = 0;
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
yellowDyeUpg: createUpgrade(() => ({
|
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: {
|
display: {
|
||||||
title: "Wetter Dyes",
|
title: "Wetter Dyes",
|
||||||
description: "Double Red, Yellow, and Blue Dye gain, but reset their amounts."
|
description: "Double Red, Yellow, and Blue Dye gain, but reset their amounts."
|
||||||
},
|
},
|
||||||
cost: 2000,
|
cost: 2000,
|
||||||
resource: dyes.yellow.amount,
|
resource: noPersist(dyes.yellow.amount),
|
||||||
onPurchase() {
|
onPurchase() {
|
||||||
dyes.red.amount.value = 0;
|
dyes.red.amount.value = 0;
|
||||||
dyes.red.buyable.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."
|
description: "Halve the Oil cost of Red, Yellow, and Blue Dyes."
|
||||||
},
|
},
|
||||||
cost: 5000,
|
cost: 5000,
|
||||||
resource: dyes.yellow.amount,
|
resource: noPersist(dyes.yellow.amount),
|
||||||
onPurchase() {
|
onPurchase() {
|
||||||
dyes.yellow.amount.value = 0;
|
dyes.yellow.amount.value = 0;
|
||||||
dyes.yellow.buyable.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),
|
visibility: () => showIf(upgrades.redDyeUpg.bought.value),
|
||||||
display: {
|
display: {
|
||||||
title: "De Louvre",
|
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,
|
cost: 6000,
|
||||||
resource: dyes.red.amount,
|
resource: noPersist(dyes.red.amount),
|
||||||
onPurchase() {
|
onPurchase() {
|
||||||
dyes.red.amount.value = 0;
|
dyes.red.amount.value = 0;
|
||||||
dyes.red.buyable.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."
|
description: "Raise Red Dye's effect ^1.5."
|
||||||
},
|
},
|
||||||
cost: 7500,
|
cost: 7500,
|
||||||
resource: dyes.blue.amount,
|
resource: noPersist(dyes.blue.amount),
|
||||||
onPurchase() {
|
onPurchase() {
|
||||||
dyes.blue.amount.value = 0;
|
dyes.blue.amount.value = 0;
|
||||||
dyes.blue.buyable.amount.value = 0;
|
dyes.blue.buyable.amount.value = 0;
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
coalUpg: createUpgrade(() => ({
|
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: {
|
display: {
|
||||||
title: "Denser Spectrum",
|
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",
|
cost: "5e30",
|
||||||
resource: coal.coal,
|
resource: coal.coal,
|
||||||
|
@ -498,7 +628,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
dyes.blue.buyable.amount.value = 0;
|
dyes.blue.buyable.amount.value = 0;
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
};
|
||||||
|
|
||||||
const showModifiersModal = ref(false);
|
const showModifiersModal = ref(false);
|
||||||
const modifiersModal = jsx(() => (
|
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({
|
const { total: totalDyeSum, trackerDisplay } = setUpDailyProgressTracker({
|
||||||
resource: dyeSum,
|
resource: dyeSum,
|
||||||
|
@ -554,7 +689,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
{render(upgrades.coalUpg)}
|
{render(upgrades.coalUpg)}
|
||||||
</>
|
</>
|
||||||
))
|
))
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export default layer;
|
export default layer;
|
|
@ -24,17 +24,17 @@ import {
|
||||||
Modifier
|
Modifier
|
||||||
} from "game/modifiers";
|
} from "game/modifiers";
|
||||||
import { noPersist, persistent } from "game/persistence";
|
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 { Direction, WithRequired } from "util/common";
|
||||||
import { render, renderRow } from "util/vue";
|
import { render, renderGrid, renderRow } from "util/vue";
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import boxes from "./boxes";
|
import boxes from "./boxes";
|
||||||
import cloth from "./cloth";
|
import cloth from "./cloth";
|
||||||
import coal from "./coal";
|
import coal from "./coal";
|
||||||
|
import dyes from "./dyes";
|
||||||
import elves from "./elves";
|
import elves from "./elves";
|
||||||
import paper from "./paper";
|
import paper from "./paper";
|
||||||
import workshop from "./workshop";
|
import workshop from "./workshop";
|
||||||
import dyes from "./dyes";
|
|
||||||
const id = "trees";
|
const id = "trees";
|
||||||
const day = 1;
|
const day = 1;
|
||||||
|
|
||||||
|
@ -426,7 +426,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
enabled: cloth.treesUpgrades.treesUpgrade4.bought
|
enabled: cloth.treesUpgrades.treesUpgrade4.bought
|
||||||
})),
|
})),
|
||||||
createMultiplicativeModifier(() => ({
|
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?",
|
description: "Is Blue Dye just Water?",
|
||||||
enabled: dyes.upgrades.blueDyeUpg.bought
|
enabled: dyes.upgrades.blueDyeUpg.bought
|
||||||
})),
|
})),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue