Updated AI to use repeatables instead of buyables

This commit is contained in:
thepaperpilot 2023-02-14 13:24:21 -06:00
parent 5a4bb43814
commit 7000d4898c
19 changed files with 107 additions and 107 deletions

View file

@ -1,7 +1,7 @@
import Collapsible from "components/layout/Collapsible.vue"; import Collapsible from "components/layout/Collapsible.vue";
import "data/layers/styles/day-gradients.css"; import "data/layers/styles/day-gradients.css";
import { createBar } from "features/bars/bar"; import { createBar } from "features/bars/bar";
import { GenericBuyable } from "features/buyable"; import { GenericRepeatable } from "features/repeatable";
import type { Clickable, ClickableOptions, GenericClickable } from "features/clickables/clickable"; import type { Clickable, ClickableOptions, GenericClickable } from "features/clickables/clickable";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import type { GenericConversion } from "features/conversion"; import type { GenericConversion } from "features/conversion";
@ -534,7 +534,7 @@ export function setUpDailyProgressTracker(options: {
export function changeActiveBuyables(options: { export function changeActiveBuyables(options: {
style?: StyleValue; style?: StyleValue;
active: Persistent<DecimalSource>; active: Persistent<DecimalSource>;
buyable: GenericBuyable; buyable: GenericRepeatable;
}) { }) {
const style = options.style ?? { minHeight: "20px", width: "40px", color: "var(--foreground)" }; const style = options.style ?? { minHeight: "20px", width: "40px", color: "var(--foreground)" };
const min = createClickable(() => ({ const min = createClickable(() => ({

View file

@ -6,7 +6,7 @@ import Spacer from "components/layout/Spacer.vue";
import Modal from "components/Modal.vue"; import Modal from "components/Modal.vue";
import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBuyable } from "features/buyable"; import { createRepeatable } from "features/repeatable";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { createCumulativeConversion, createPolynomialScaling } from "features/conversion"; import { createCumulativeConversion, createPolynomialScaling } from "features/conversion";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
@ -230,7 +230,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
})) as GenericUpgrade; })) as GenericUpgrade;
const row3Upgrades = { clothUpgrade, dyeUpgrade, xpUpgrade }; const row3Upgrades = { clothUpgrade, dyeUpgrade, xpUpgrade };
const logBoxesBuyable = createBuyable(() => ({ const logBoxesBuyable = createRepeatable(() => ({
display: { display: {
title: "Carry more logs", title: "Carry more logs",
description: jsx(() => ( description: jsx(() => (
@ -300,7 +300,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
Decimal.add(logBoxesBuyable.amount.value, logBoxesBuyable.freeLevels.value) Decimal.add(logBoxesBuyable.amount.value, logBoxesBuyable.freeLevels.value)
) )
})) as BoxesBuyable; })) as BoxesBuyable;
const ashBoxesBuyable = createBuyable(() => ({ const ashBoxesBuyable = createRepeatable(() => ({
display: { display: {
title: "Carry more ash", title: "Carry more ash",
description: jsx(() => ( description: jsx(() => (
@ -364,7 +364,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
Decimal.add(ashBoxesBuyable.amount.value, ashBoxesBuyable.freeLevels.value) Decimal.add(ashBoxesBuyable.amount.value, ashBoxesBuyable.freeLevels.value)
) )
})) as BoxesBuyable; })) as BoxesBuyable;
const coalBoxesBuyable = createBuyable(() => ({ const coalBoxesBuyable = createRepeatable(() => ({
display: { display: {
title: "Carry more coal", title: "Carry more coal",
description: jsx(() => ( description: jsx(() => (
@ -429,7 +429,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
) )
})) as BoxesBuyable; })) as BoxesBuyable;
const buyables = { logBoxesBuyable, ashBoxesBuyable, coalBoxesBuyable }; const buyables = { logBoxesBuyable, ashBoxesBuyable, coalBoxesBuyable };
const oreBoxesBuyable = createBuyable(() => ({ const oreBoxesBuyable = createRepeatable(() => ({
display: { display: {
title: "Carry more ore", title: "Carry more ore",
description: jsx(() => ( description: jsx(() => (
@ -499,7 +499,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
Decimal.add(oreBoxesBuyable.amount.value, oreBoxesBuyable.freeLevels.value) Decimal.add(oreBoxesBuyable.amount.value, oreBoxesBuyable.freeLevels.value)
) )
})) as BoxesBuyable; })) as BoxesBuyable;
const metalBoxesBuyable = createBuyable(() => ({ const metalBoxesBuyable = createRepeatable(() => ({
display: { display: {
title: "Carry more metal", title: "Carry more metal",
description: jsx(() => ( description: jsx(() => (
@ -563,7 +563,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
Decimal.add(metalBoxesBuyable.amount.value, metalBoxesBuyable.freeLevels.value) Decimal.add(metalBoxesBuyable.amount.value, metalBoxesBuyable.freeLevels.value)
) )
})) as BoxesBuyable; })) as BoxesBuyable;
const plasticBoxesBuyable = createBuyable(() => ({ const plasticBoxesBuyable = createRepeatable(() => ({
display: { display: {
title: "Carry more plastic", title: "Carry more plastic",
description: jsx(() => ( description: jsx(() => (
@ -627,7 +627,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
Decimal.add(plasticBoxesBuyable.amount.value, plasticBoxesBuyable.freeLevels.value) Decimal.add(plasticBoxesBuyable.amount.value, plasticBoxesBuyable.freeLevels.value)
) )
})) as BoxesBuyable; })) as BoxesBuyable;
const presentBuyable = createBuyable(() => ({ const presentBuyable = createRepeatable(() => ({
display: { display: {
title: "Carry presents in boxes", title: "Carry presents in boxes",
description: jsx(() => ( description: jsx(() => (

View file

@ -9,7 +9,7 @@ import Modal from "components/Modal.vue";
import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBar } from "features/bars/bar"; import { createBar } from "features/bars/bar";
import { createBuyable } from "features/buyable"; import { createRepeatable } from "features/repeatable";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import { createHotkey } from "features/hotkey"; import { createHotkey } from "features/hotkey";
@ -240,7 +240,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
enabled: noPersist(main.days[day - 1].opened) enabled: noPersist(main.days[day - 1].opened)
})); }));
const buildPens = createBuyable(() => ({ const buildPens = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: trees.logs, resource: trees.logs,
cost() { cost() {
@ -263,7 +263,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
})) as ElfBuyable; })) as ElfBuyable;
const betterShears = createBuyable(() => ({ const betterShears = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: metal.metal, resource: metal.metal,
cost() { cost() {
@ -286,7 +286,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
})) as ElfBuyable; })) as ElfBuyable;
const fasterSpinning = createBuyable(() => ({ const fasterSpinning = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: paper.paper, resource: paper.paper,
cost() { cost() {

View file

@ -12,7 +12,7 @@ import {
setUpDailyProgressTracker setUpDailyProgressTracker
} from "data/common"; } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBuyable } from "features/buyable"; import { createRepeatable } from "features/repeatable";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import MainDisplay from "features/resources/MainDisplay.vue"; import MainDisplay from "features/resources/MainDisplay.vue";
import { createResource, Resource } from "features/resources/resource"; import { createResource, Resource } from "features/resources/resource";
@ -75,7 +75,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
v = Decimal.pow(0.95, paper.books.smallFireBook.totalAmount.value).times(v); v = Decimal.pow(0.95, paper.books.smallFireBook.totalAmount.value).times(v);
return v.pow(masteryEffectActive.value ? 1.1 : 1.5).times(1e4); return v.pow(masteryEffectActive.value ? 1.1 : 1.5).times(1e4);
}); });
const buildFire = createBuyable(() => ({ const buildFire = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: trees.logs, resource: trees.logs,
cost: fireCost cost: fireCost
@ -141,7 +141,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
return gain; return gain;
}); });
const buildBonfire = createBuyable(() => ({ const buildBonfire = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: fireResource, resource: fireResource,
cost() { cost() {
@ -215,7 +215,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
1e7 1e7
); );
}); });
const buildKiln = createBuyable(() => ({ const buildKiln = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: trees.logs, resource: trees.logs,
cost: kilnCost cost: kilnCost
@ -288,7 +288,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
return cost; return cost;
}); });
const buildDrill = createBuyable(() => ({ const buildDrill = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: metal.metal, resource: metal.metal,
cost: drillCost cost: drillCost
@ -521,7 +521,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
})); }));
const row3upgrades = [efficientSmelther, arsonistAssistance, refinedCoal, coloredFire]; const row3upgrades = [efficientSmelther, arsonistAssistance, refinedCoal, coloredFire];
const heatedCutters = createBuyable(() => ({ const heatedCutters = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(coal), resource: noPersist(coal),
cost() { cost() {
@ -559,7 +559,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
style: { color: colorText }, style: { color: colorText },
visibility: () => showIf(warmerCutters.bought.value) visibility: () => showIf(warmerCutters.bought.value)
})) as ElfBuyable & { display: { title: string }; resource: Resource }; })) as ElfBuyable & { display: { title: string }; resource: Resource };
const heatedPlanters = createBuyable(() => ({ const heatedPlanters = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(coal), resource: noPersist(coal),
cost() { cost() {
@ -599,7 +599,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
style: { color: colorText }, style: { color: colorText },
visibility: () => showIf(warmerPlanters.bought.value) visibility: () => showIf(warmerPlanters.bought.value)
})) as ElfBuyable & { display: { title: string }; resource: Resource }; })) as ElfBuyable & { display: { title: string }; resource: Resource };
const moreFertilizer = createBuyable(() => ({ const moreFertilizer = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(ash), resource: noPersist(ash),
cost() { cost() {

View file

@ -7,7 +7,7 @@ import Spacer from "components/layout/Spacer.vue";
import Sqrt from "components/math/Sqrt.vue"; import Sqrt from "components/math/Sqrt.vue";
import Modal from "components/Modal.vue"; import Modal from "components/Modal.vue";
import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common";
import { BuyableOptions, createBuyable } from "features/buyable"; import { RepeatableOptions, createRepeatable } from "features/repeatable";
import { jsx, JSXFunction, showIf, Visibility } from "features/feature"; import { jsx, JSXFunction, showIf, Visibility } from "features/feature";
import { createHotkey, GenericHotkey } from "features/hotkey"; import { createHotkey, GenericHotkey } from "features/hotkey";
import MainDisplay from "features/resources/MainDisplay.vue"; import MainDisplay from "features/resources/MainDisplay.vue";
@ -111,7 +111,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
name: string; name: string;
reset: VoidFunction; reset: VoidFunction;
}[]; }[];
} & Partial<BuyableOptions> } & Partial<RepeatableOptions>
): Dye { ): Dye {
const amount = createResource( const amount = createResource(
computed(() => computed(() =>
@ -259,7 +259,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
break; break;
} }
const buyable: ElfBuyable = createBuyable(() => { const buyable: ElfBuyable = createRepeatable(() => {
const costs = options.costs(); const costs = options.costs();
return { return {
...options, ...options,

View file

@ -9,7 +9,7 @@ import Modal from "components/Modal.vue";
import { createCollapsibleMilestones, createCollapsibleModifierSections } from "data/common"; import { createCollapsibleMilestones, createCollapsibleModifierSections } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBar, GenericBar } from "features/bars/bar"; import { createBar, GenericBar } from "features/bars/bar";
import { GenericBuyable } from "features/buyable"; import { GenericRepeatable } from "features/repeatable";
import { ClickableOptions } from "features/clickables/clickable"; import { ClickableOptions } from "features/clickables/clickable";
import { jsx, showIf, Visibility } from "features/feature"; import { jsx, showIf, Visibility } from "features/feature";
import { createMilestone } from "features/milestones/milestone"; import { createMilestone } from "features/milestones/milestone";
@ -42,7 +42,7 @@ import letters from "./letters";
import packing from "./packing"; import packing from "./packing";
import { createBooleanRequirement, createCostRequirement } from "game/requirements"; import { createBooleanRequirement, createCostRequirement } from "game/requirements";
export interface ElfBuyable extends GenericBuyable { export interface ElfBuyable extends GenericRepeatable {
/** The inverse function of the cost formula, used to calculate the maximum amount that can be bought by elves. */ /** The inverse function of the cost formula, used to calculate the maximum amount that can be bought by elves. */
inverseCost: (x?: DecimalSource) => DecimalSource; inverseCost: (x?: DecimalSource) => DecimalSource;
resource: Resource; resource: Resource;

View file

@ -10,7 +10,7 @@ import Modal from "components/Modal.vue";
import { createCollapsibleModifierSections } from "data/common"; import { createCollapsibleModifierSections } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBar, GenericBar } from "features/bars/bar"; import { createBar, GenericBar } from "features/bars/bar";
import { createBuyable, GenericBuyable } from "features/buyable"; import { createRepeatable, GenericRepeatable } from "features/repeatable";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import { createHotkey, GenericHotkey } from "features/hotkey"; import { createHotkey, GenericHotkey } from "features/hotkey";
import MainDisplay from "features/resources/MainDisplay.vue"; import MainDisplay from "features/resources/MainDisplay.vue";
@ -1153,7 +1153,7 @@ const factory = createLayer(id, () => {
]); ]);
const computedCostCheapeners = computed(() => costCheapener.apply(1)); const computedCostCheapeners = computed(() => costCheapener.apply(1));
const clothesBuyable = createBuyable(() => ({ const clothesBuyable = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: toys.clothes, resource: toys.clothes,
cost() { cost() {
@ -1167,8 +1167,8 @@ const factory = createLayer(id, () => {
description: "Use your finished toys to train an elf on factory work" description: "Use your finished toys to train an elf on factory work"
}, },
style: "width: 110px" style: "width: 110px"
})) as GenericBuyable; })) as GenericRepeatable;
const blocksBuyable = createBuyable(() => ({ const blocksBuyable = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: toys.woodenBlocks, resource: toys.woodenBlocks,
cost() { cost() {
@ -1182,8 +1182,8 @@ const factory = createLayer(id, () => {
description: "Use your finished toys to train an elf on factory work" description: "Use your finished toys to train an elf on factory work"
}, },
style: "width: 110px" style: "width: 110px"
})) as GenericBuyable; })) as GenericRepeatable;
const trucksBuyable = createBuyable(() => ({ const trucksBuyable = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: toys.trucks, resource: toys.trucks,
cost() { cost() {
@ -1197,8 +1197,8 @@ const factory = createLayer(id, () => {
description: "Use your finished toys to train an elf on factory work" description: "Use your finished toys to train an elf on factory work"
}, },
style: "width: 110px" style: "width: 110px"
})) as GenericBuyable; })) as GenericRepeatable;
const bearsBuyable = createBuyable(() => ({ const bearsBuyable = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(bears), resource: noPersist(bears),
cost() { cost() {
@ -1213,8 +1213,8 @@ const factory = createLayer(id, () => {
}, },
style: "width: 110px", style: "width: 110px",
visible: () => showIf(main.days[advancedDay - 1].opened.value) visible: () => showIf(main.days[advancedDay - 1].opened.value)
})) as GenericBuyable; })) as GenericRepeatable;
const bucketBuyable = createBuyable(() => ({ const bucketBuyable = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(bucketAndShovels), resource: noPersist(bucketAndShovels),
cost() { cost() {
@ -1229,8 +1229,8 @@ const factory = createLayer(id, () => {
}, },
style: "width: 110px", style: "width: 110px",
visible: () => showIf(main.days[advancedDay - 1].opened.value) visible: () => showIf(main.days[advancedDay - 1].opened.value)
})) as GenericBuyable; })) as GenericRepeatable;
const consolesBuyable = createBuyable(() => ({ const consolesBuyable = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(consoles), resource: noPersist(consoles),
cost() { cost() {
@ -1245,7 +1245,7 @@ const factory = createLayer(id, () => {
}, },
style: "width: 110px", style: "width: 110px",
visible: () => showIf(main.days[advancedDay - 1].opened.value) visible: () => showIf(main.days[advancedDay - 1].opened.value)
})) as GenericBuyable; })) as GenericRepeatable;
const elfBuyables = { const elfBuyables = {
clothesBuyable, clothesBuyable,
blocksBuyable, blocksBuyable,
@ -1263,7 +1263,7 @@ const factory = createLayer(id, () => {
const trainedElves = createResource<DecimalSource>(sumElves, "trained elves"); const trainedElves = createResource<DecimalSource>(sumElves, "trained elves");
const elvesEffect = computed(() => Decimal.pow(1.05, trainedElves.value)); const elvesEffect = computed(() => Decimal.pow(1.05, trainedElves.value));
const expandFactory = createBuyable(() => ({ const expandFactory = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: trees.logs, resource: trees.logs,
cost() { cost() {
@ -1282,8 +1282,8 @@ const factory = createLayer(id, () => {
purchaseLimit: 12, purchaseLimit: 12,
style: "width: 200px", style: "width: 200px",
visibility: () => showIf(main.days[advancedDay - 1].opened.value) visibility: () => showIf(main.days[advancedDay - 1].opened.value)
})) as GenericBuyable; })) as GenericRepeatable;
const oilFuel = createBuyable(() => ({ const oilFuel = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: oil.oil, resource: oil.oil,
cost() { cost() {
@ -1298,8 +1298,8 @@ const factory = createLayer(id, () => {
}, },
style: "width: 200px", style: "width: 200px",
visibility: () => showIf(main.days[advancedDay - 1].opened.value) visibility: () => showIf(main.days[advancedDay - 1].opened.value)
})) as GenericBuyable; })) as GenericRepeatable;
const carryToys = createBuyable(() => ({ const carryToys = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: boxes.boxes, resource: boxes.boxes,
cost() { cost() {
@ -1316,7 +1316,7 @@ const factory = createLayer(id, () => {
}, },
style: "width: 200px", style: "width: 200px",
visibility: () => showIf(main.days[advancedDay - 1].opened.value) visibility: () => showIf(main.days[advancedDay - 1].opened.value)
})) as GenericBuyable; })) as GenericRepeatable;
const betterFactory = createUpgrade(() => ({ const betterFactory = createUpgrade(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
@ -1368,7 +1368,7 @@ const factory = createLayer(id, () => {
}, },
visibility: () => showIf(excitmentUpgrade.bought.value) visibility: () => showIf(excitmentUpgrade.bought.value)
})); }));
const carryBoxes = createBuyable(() => ({ const carryBoxes = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(presents), resource: noPersist(presents),
cost() { cost() {
@ -1386,7 +1386,7 @@ const factory = createLayer(id, () => {
effectDisplay: jsx(() => <>x{format(Decimal.pow(1.5, carryBoxes.amount.value))}</>) effectDisplay: jsx(() => <>x{format(Decimal.pow(1.5, carryBoxes.amount.value))}</>)
}, },
visibility: () => showIf(carryPresents.bought.value) visibility: () => showIf(carryPresents.bought.value)
})) as GenericBuyable; })) as GenericRepeatable;
const catalysts = createUpgrade(() => ({ const catalysts = createUpgrade(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(presents), resource: noPersist(presents),

View file

@ -20,7 +20,7 @@ import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
import { Direction } from "util/common"; import { Direction } from "util/common";
import { render, renderRow } from "util/vue"; import { render, renderRow } from "util/vue";
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import { createBuyable, GenericBuyable } from "features/buyable"; import { createRepeatable, GenericRepeatable } from "features/repeatable";
import metal from "./metal"; import metal from "./metal";
import plastic from "./plastic"; import plastic from "./plastic";
import paper from "./paper"; import paper from "./paper";
@ -96,7 +96,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
enabled: noPersist(main.days[day - 1].opened) enabled: noPersist(main.days[day - 1].opened)
})); }));
const metalBuyable = createBuyable(() => ({ const metalBuyable = createRepeatable(() => ({
display: { display: {
title: "Sorting Machine", title: "Sorting Machine",
description: description:
@ -112,8 +112,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
})), })),
visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value) visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value)
})) as GenericBuyable; })) as GenericRepeatable;
const plasticBuyable = createBuyable(() => ({ const plasticBuyable = createRepeatable(() => ({
display: { display: {
title: "Plastic Bins", title: "Plastic Bins",
description: description:
@ -129,8 +129,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
})), })),
visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value) visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value)
})) as GenericBuyable; })) as GenericRepeatable;
const paperBuyable = createBuyable(() => ({ const paperBuyable = createRepeatable(() => ({
display: { display: {
title: "Printed Labels", title: "Printed Labels",
description: "Use printed labels to improve how many letters you can process at once", description: "Use printed labels to improve how many letters you can process at once",
@ -145,7 +145,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
})), })),
visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value) visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value)
})) as GenericBuyable; })) as GenericRepeatable;
const buyables = { metalBuyable, plasticBuyable, paperBuyable }; const buyables = { metalBuyable, plasticBuyable, paperBuyable };
const autoSmeltingMilestone = createMilestone(() => ({ const autoSmeltingMilestone = createMilestone(() => ({

View file

@ -4,7 +4,7 @@ import Modal from "components/Modal.vue";
import { createCollapsibleMilestones, createCollapsibleModifierSections } from "data/common"; import { createCollapsibleMilestones, createCollapsibleModifierSections } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBar, GenericBar } from "features/bars/bar"; import { createBar, GenericBar } from "features/bars/bar";
import { createBuyable, GenericBuyable } from "features/buyable"; import { createRepeatable, GenericRepeatable } from "features/repeatable";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { jsx, showIf, Visibility } from "features/feature"; import { jsx, showIf, Visibility } from "features/feature";
import { createMilestone, GenericMilestone } from "features/milestones/milestone"; import { createMilestone, GenericMilestone } from "features/milestones/milestone";
@ -1592,7 +1592,7 @@ const layer = createLayer(id, () => {
const upgrades2 = [focusUpgrade4, focusUpgrade5, focusUpgrade6]; const upgrades2 = [focusUpgrade4, focusUpgrade5, focusUpgrade6];
// ------------------------------------------------------------------------------- Schools // ------------------------------------------------------------------------------- Schools
const schools = createBuyable(() => ({ const schools = createRepeatable(() => ({
requirements: [ requirements: [
createCostRequirement(() => ({ createCostRequirement(() => ({
resource: trees.logs, resource: trees.logs,
@ -1678,7 +1678,7 @@ const layer = createLayer(id, () => {
}, },
visibility: computed(() => showIf(teaching.bought.value)), visibility: computed(() => showIf(teaching.bought.value)),
style: "width: 600px" style: "width: 600px"
})) as GenericBuyable; })) as GenericRepeatable;
const classroomFactor = computed(() => { const classroomFactor = computed(() => {
let v = classrooms.amount.value; let v = classrooms.amount.value;
@ -1691,7 +1691,7 @@ const layer = createLayer(id, () => {
return Decimal.add(classrooms.amount.value, 1).pow(0.9); return Decimal.add(classrooms.amount.value, 1).pow(0.9);
}); });
const classrooms = createBuyable(() => ({ const classrooms = createRepeatable(() => ({
requirements: [ requirements: [
createCostRequirement(() => ({ createCostRequirement(() => ({
resource: trees.logs, resource: trees.logs,
@ -1727,7 +1727,7 @@ const layer = createLayer(id, () => {
}, },
visibility: computed(() => showIf(classroomUpgrade.bought.value)), visibility: computed(() => showIf(classroomUpgrade.bought.value)),
style: "width: 600px" style: "width: 600px"
})) as GenericBuyable; })) as GenericRepeatable;
// ------------------------------------------------------------------------------- Modifiers // ------------------------------------------------------------------------------- Modifiers

View file

@ -3,7 +3,7 @@ import Spacer from "components/layout/Spacer.vue";
import Modal from "components/Modal.vue"; import Modal from "components/Modal.vue";
import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common";
import { createBar } from "features/bars/bar"; import { createBar } from "features/bars/bar";
import { createBuyable } from "features/buyable"; import { createRepeatable } from "features/repeatable";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import MainDisplay from "features/resources/MainDisplay.vue"; import MainDisplay from "features/resources/MainDisplay.vue";
@ -505,7 +505,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
visibility: () => showIf(oil.depthMilestones[4].earned.value) visibility: () => showIf(oil.depthMilestones[4].earned.value)
})); }));
const oreDrill = createBuyable(() => ({ const oreDrill = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(metal), resource: noPersist(metal),
cost() { cost() {
@ -552,7 +552,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
), ),
style: { width: "200px" } style: { width: "200px" }
})) as ElfBuyable; })) as ElfBuyable;
const industrialCrucible = createBuyable(() => ({ const industrialCrucible = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(metal), resource: noPersist(metal),
cost() { cost() {
@ -599,7 +599,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
style: { width: "200px" } style: { width: "200px" }
})) as ElfBuyable; })) as ElfBuyable;
const autoSmeltEnabled = persistent<boolean>(true); const autoSmeltEnabled = persistent<boolean>(true);
const hotterForge = createBuyable(() => ({ const hotterForge = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: coal.coal, resource: coal.coal,
cost() { cost() {

View file

@ -18,7 +18,7 @@ import Decimal, { DecimalSource } from "lib/break_eternity";
import { render, renderGrid, renderRow } from "util/vue"; import { render, renderGrid, renderRow } from "util/vue";
import { computed, ComputedRef, ref, unref } from "vue"; import { computed, ComputedRef, ref, unref } from "vue";
import { noPersist, persistent } from "game/persistence"; import { noPersist, persistent } from "game/persistence";
import { createBuyable, GenericBuyable } from "features/buyable"; import { createRepeatable, GenericRepeatable } from "features/repeatable";
import { format, formatWhole } from "util/break_eternity"; import { format, formatWhole } from "util/break_eternity";
import metal from "./metal"; import metal from "./metal";
import { import {
@ -114,7 +114,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
v = Decimal.pow(0.95, paper.books.heavyDrillBook.totalAmount.value).times(v); v = Decimal.pow(0.95, paper.books.heavyDrillBook.totalAmount.value).times(v);
return Decimal.pow(1.3, v).times(2.5e4); return Decimal.pow(1.3, v).times(2.5e4);
}); });
const buildHeavy = createBuyable(() => ({ const buildHeavy = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: metal.metal, resource: metal.metal,
cost: heavyCost cost: heavyCost
@ -185,7 +185,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
v = Decimal.pow(0.95, paper.books.heavyDrillBook.totalAmount.value).times(v); v = Decimal.pow(0.95, paper.books.heavyDrillBook.totalAmount.value).times(v);
return Decimal.pow(2, v).times(1e5); return Decimal.pow(2, v).times(1e5);
}); });
const buildHeavy2 = createBuyable(() => ({ const buildHeavy2 = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: metal.metal, resource: metal.metal,
cost: heavy2Cost cost: heavy2Cost
@ -253,7 +253,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
v = Decimal.pow(0.95, paper.books.heavyDrillBook.totalAmount.value).times(v); v = Decimal.pow(0.95, paper.books.heavyDrillBook.totalAmount.value).times(v);
return Decimal.pow(8, v).times(2e5); return Decimal.pow(8, v).times(2e5);
}); });
const buildExtractor = createBuyable(() => ({ const buildExtractor = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: metal.metal, resource: metal.metal,
cost: extractorCost cost: extractorCost
@ -334,7 +334,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
return price; return price;
}); });
const buildPump = createBuyable(() => ({ const buildPump = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: metal.metal, resource: metal.metal,
cost: pumpCost cost: pumpCost
@ -407,7 +407,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
v = Decimal.pow(0.95, paper.books.oilBook.totalAmount.value).times(v); v = Decimal.pow(0.95, paper.books.oilBook.totalAmount.value).times(v);
return Decimal.pow(2, v).times(50); return Decimal.pow(2, v).times(50);
}); });
const buildBurner = createBuyable(() => ({ const buildBurner = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(oil), resource: noPersist(oil),
cost: burnerCost cost: burnerCost
@ -477,7 +477,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
if (row2Upgrades[4].bought.value) price = price.div(Decimal.add(totalOil.value, 1).root(6)); if (row2Upgrades[4].bought.value) price = price.div(Decimal.add(totalOil.value, 1).root(6));
return price; return price;
}); });
const buildSmelter = createBuyable(() => ({ const buildSmelter = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: metal.metal, resource: metal.metal,
cost: smelterCost cost: smelterCost

View file

@ -3,7 +3,7 @@ import SpacerVue from "components/layout/Spacer.vue";
import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBar } from "features/bars/bar"; import { createBar } from "features/bars/bar";
import { createBuyable, GenericBuyable } from "features/buyable"; import { createRepeatable, GenericRepeatable } from "features/repeatable";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import { createMilestone, GenericMilestone } from "features/milestones/milestone"; import { createMilestone, GenericMilestone } from "features/milestones/milestone";
@ -197,7 +197,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
})) }))
]); ]);
const computedLoaderPackingSpeed = computed(() => loaderPackingSpeed.apply(1000)); const computedLoaderPackingSpeed = computed(() => loaderPackingSpeed.apply(1000));
const elf = createBuyable(() => ({ const elf = createRepeatable(() => ({
visibility: () => showIf(Decimal.gte(totalPresents.value, 10)), visibility: () => showIf(Decimal.gte(totalPresents.value, 10)),
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: totalPresentsResource, resource: totalPresentsResource,
@ -228,7 +228,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
width: "200px" width: "200px"
} }
})) as ElfBuyable; })) as ElfBuyable;
const loader = createBuyable(() => ({ const loader = createRepeatable(() => ({
visibility: () => showIf(upgrades.loaderUnlock.bought.value), visibility: () => showIf(upgrades.loaderUnlock.bought.value),
requirements: [ requirements: [
createCostRequirement(() => ({ createCostRequirement(() => ({

View file

@ -6,7 +6,7 @@ import Spacer from "components/layout/Spacer.vue";
import Modal from "components/Modal.vue"; import Modal from "components/Modal.vue";
import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { BuyableOptions, createBuyable } from "features/buyable"; import { RepeatableOptions, createRepeatable } from "features/repeatable";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { createCumulativeConversion, createPolynomialScaling } from "features/conversion"; import { createCumulativeConversion, createPolynomialScaling } from "features/conversion";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
@ -100,9 +100,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
})); }));
function createBook( function createBook(
options: { name: string; elfName: string; buyableName: string } & Partial<BuyableOptions> options: { name: string; elfName: string; buyableName: string } & Partial<RepeatableOptions>
) { ) {
const buyable = createBuyable(() => ({ const buyable = createRepeatable(() => ({
...options, ...options,
display: { display: {
title: options.name, title: options.name,

View file

@ -12,7 +12,7 @@ import {
setUpDailyProgressTracker setUpDailyProgressTracker
} from "data/common"; } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBuyable, GenericBuyable } from "features/buyable"; import { createRepeatable, GenericRepeatable } from "features/repeatable";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import MainDisplay from "features/resources/MainDisplay.vue"; import MainDisplay from "features/resources/MainDisplay.vue";
import { createResource, Resource } from "features/resources/resource"; import { createResource, Resource } from "features/resources/resource";
@ -86,7 +86,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
return cost; return cost;
}); });
const buildRefinery = createBuyable(() => ({ const buildRefinery = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: metal.metal, resource: metal.metal,
cost: refineryCost cost: refineryCost
@ -116,7 +116,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
width: "300px" width: "300px"
}, },
visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value) visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value)
})) as GenericBuyable & { resource: Resource }; })) as GenericRepeatable & { resource: Resource };
const { const {
min: minRefinery, min: minRefinery,
max: maxRefinery, max: maxRefinery,
@ -227,7 +227,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
})) as GenericUpgrade; })) as GenericUpgrade;
const elfUpgrades = { paperElf, boxElf, clothElf }; const elfUpgrades = { paperElf, boxElf, clothElf };
const passivePaper = createBuyable(() => ({ const passivePaper = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(plastic), resource: noPersist(plastic),
cost() { cost() {
@ -263,7 +263,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
Decimal.add(passivePaper.amount.value, passivePaper.freeLevels.value) Decimal.add(passivePaper.amount.value, passivePaper.freeLevels.value)
) )
})) as BoxesBuyable; })) as BoxesBuyable;
const passiveBoxes = createBuyable(() => ({ const passiveBoxes = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(plastic), resource: noPersist(plastic),
cost() { cost() {
@ -299,7 +299,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
Decimal.add(passiveBoxes.amount.value, passiveBoxes.freeLevels.value) Decimal.add(passiveBoxes.amount.value, passiveBoxes.freeLevels.value)
) )
})) as BoxesBuyable; })) as BoxesBuyable;
const clothGains = createBuyable(() => ({ const clothGains = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(plastic), resource: noPersist(plastic),
cost() { cost() {

View file

@ -8,7 +8,7 @@ import { createCollapsibleMilestones, createCollapsibleModifierSections } from "
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBar, GenericBar } from "features/bars/bar"; import { createBar, GenericBar } from "features/bars/bar";
import { BoardNode, BoardNodeLink, createBoard, Shape } from "features/boards/board"; import { BoardNode, BoardNodeLink, createBoard, Shape } from "features/boards/board";
import { createBuyable, GenericBuyable } from "features/buyable"; import { createRepeatable, GenericRepeatable } from "features/repeatable";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import { createMilestone, GenericMilestone } from "features/milestones/milestone"; import { createMilestone, GenericMilestone } from "features/milestones/milestone";
@ -610,7 +610,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
return Decimal.pow(1.2, amount).mul(1e11).div(Decimal.max(citiesCompleted.value, 1)); return Decimal.pow(1.2, amount).mul(1e11).div(Decimal.max(citiesCompleted.value, 1));
}); });
const metaBuyables = { const metaBuyables = {
metal: createBuyable(() => ({ metal: createRepeatable(() => ({
resName: "Metal", resName: "Metal",
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: metal.metal, resource: metal.metal,
@ -624,7 +624,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
}, },
style: "width: 150px; min-height: 60px" style: "width: 150px; min-height: 60px"
})), })),
console: createBuyable(() => ({ console: createRepeatable(() => ({
resName: "Game Console", resName: "Game Console",
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: factory.consoles, resource: factory.consoles,
@ -638,7 +638,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
}, },
style: "width: 150px; min-height: 60px" style: "width: 150px; min-height: 60px"
})), })),
classroom: createBuyable(() => ({ classroom: createRepeatable(() => ({
resName: "Classroom", resName: "Classroom",
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: createResource(management.classrooms.amount, "classrooms"), resource: createResource(management.classrooms.amount, "classrooms"),
@ -658,7 +658,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
}, },
style: "width: 150px; min-height: 60px" style: "width: 150px; min-height: 60px"
})), })),
tick: createBuyable(() => ({ tick: createRepeatable(() => ({
resName: "Factory Tick Rate", resName: "Factory Tick Rate",
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: createResource(factory.computedTickRate, "factory tick rate"), resource: createResource(factory.computedTickRate, "factory tick rate"),
@ -678,7 +678,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
}, },
style: "width: 150px; min-height: 60px" style: "width: 150px; min-height: 60px"
})) }))
} as Record<string, GenericBuyable & { resName: string }>; } as Record<string, GenericRepeatable & { resName: string }>;
const metaMilestones = { const metaMilestones = {
0: createMilestone(() => ({ 0: createMilestone(() => ({

View file

@ -7,7 +7,7 @@ import Spacer from "components/layout/Spacer.vue";
import { createCollapsibleMilestones } from "data/common"; import { createCollapsibleMilestones } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBar } from "features/bars/bar"; import { createBar } from "features/bars/bar";
import { createBuyable, GenericBuyable } from "features/buyable"; import { createRepeatable, GenericRepeatable } from "features/repeatable";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import { createMilestone } from "features/milestones/milestone"; import { createMilestone } from "features/milestones/milestone";
import { Resource } from "features/resources/resource"; import { Resource } from "features/resources/resource";
@ -41,7 +41,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
); );
} }
const sleighProgress = computed(() => sleigh.amount); const sleighProgress = computed(() => sleigh.amount);
const sleigh = createBuyable(() => ({ const sleigh = createRepeatable(() => ({
requirements: [ requirements: [
createCostRequirement(() => ({ createCostRequirement(() => ({
resource: trees.logs, resource: trees.logs,
@ -65,7 +65,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
}, },
visibility: () => showIf(Decimal.lt(sleighProgress.value.value, 100)), visibility: () => showIf(Decimal.lt(sleighProgress.value.value, 100)),
style: "width: 600px" style: "width: 600px"
})) as GenericBuyable; })) as GenericRepeatable;
const shouldShowPopups = computed(() => true); const shouldShowPopups = computed(() => true);
const milestone1 = createMilestone(() => ({ const milestone1 = createMilestone(() => ({

View file

@ -10,7 +10,7 @@ import {
setUpDailyProgressTracker setUpDailyProgressTracker
} from "data/common"; } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBuyable, GenericBuyable } from "features/buyable"; import { createRepeatable, GenericRepeatable } from "features/repeatable";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import { createMilestone, GenericMilestone } from "features/milestones/milestone"; import { createMilestone, GenericMilestone } from "features/milestones/milestone";
import MainDisplay from "features/resources/MainDisplay.vue"; import MainDisplay from "features/resources/MainDisplay.vue";
@ -47,7 +47,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
"toys" "toys"
); );
const clothesBuyable = createBuyable(() => ({ const clothesBuyable = createRepeatable(() => ({
requirements: [ requirements: [
createCostRequirement(() => ({ createCostRequirement(() => ({
resource: cloth.cloth, resource: cloth.cloth,
@ -87,8 +87,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
onPurchase() { onPurchase() {
clothes.value = Decimal.add(clothes.value, 1); clothes.value = Decimal.add(clothes.value, 1);
} }
})) as GenericBuyable; })) as GenericRepeatable;
const woodenBlocksBuyable = createBuyable(() => ({ const woodenBlocksBuyable = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: trees.logs, resource: trees.logs,
cost() { cost() {
@ -113,8 +113,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
onPurchase() { onPurchase() {
woodenBlocks.value = Decimal.add(woodenBlocks.value, 1); woodenBlocks.value = Decimal.add(woodenBlocks.value, 1);
} }
})) as GenericBuyable; })) as GenericRepeatable;
const trucksBuyable = createBuyable(() => ({ const trucksBuyable = createRepeatable(() => ({
requirements: [ requirements: [
createCostRequirement(() => ({ createCostRequirement(() => ({
resource: metal.metal, resource: metal.metal,
@ -153,7 +153,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
onPurchase() { onPurchase() {
trucks.value = Decimal.add(trucks.value, 1); trucks.value = Decimal.add(trucks.value, 1);
} }
})) as GenericBuyable; })) as GenericRepeatable;
const buyables = [clothesBuyable, woodenBlocksBuyable, trucksBuyable]; const buyables = [clothesBuyable, woodenBlocksBuyable, trucksBuyable];
const trucksUpgrade1 = createUpgrade(() => ({ const trucksUpgrade1 = createUpgrade(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({

View file

@ -8,7 +8,7 @@ import Modal from "components/Modal.vue";
import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBar } from "features/bars/bar"; import { createBar } from "features/bars/bar";
import { createBuyable } from "features/buyable"; import { createRepeatable } from "features/repeatable";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import { createHotkey } from "features/hotkey"; import { createHotkey } from "features/hotkey";
@ -237,7 +237,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
researchUpgrade2 researchUpgrade2
]; ];
const autoCuttingBuyable1 = createBuyable(() => ({ const autoCuttingBuyable1 = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(logs), resource: noPersist(logs),
cost() { cost() {
@ -266,7 +266,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
}, },
visibility: () => showIf(researchUpgrade2.bought.value) visibility: () => showIf(researchUpgrade2.bought.value)
})) as ElfBuyable; })) as ElfBuyable;
const autoPlantingBuyable1 = createBuyable(() => ({ const autoPlantingBuyable1 = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(logs), resource: noPersist(logs),
cost() { cost() {
@ -302,7 +302,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
}, },
visibility: () => showIf(researchUpgrade2.bought.value) visibility: () => showIf(researchUpgrade2.bought.value)
})) as ElfBuyable; })) as ElfBuyable;
const expandingForestBuyable = createBuyable(() => ({ const expandingForestBuyable = createRepeatable(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(logs), resource: noPersist(logs),
cost() { cost() {

View file

@ -1,6 +1,6 @@
import Spacer from "components/layout/Spacer.vue"; import Spacer from "components/layout/Spacer.vue";
import { createBar, GenericBar } from "features/bars/bar"; import { createBar, GenericBar } from "features/bars/bar";
import { BuyableOptions, createBuyable, GenericBuyable } from "features/buyable"; import { RepeatableOptions, createRepeatable, GenericRepeatable } from "features/repeatable";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { jsx, JSXFunction, showIf } from "features/feature"; import { jsx, JSXFunction, showIf } from "features/feature";
import { createMilestone } from "features/milestones/milestone"; import { createMilestone } from "features/milestones/milestone";
@ -29,7 +29,7 @@ const baseSecondaryRatio = 1.2;
interface WrappingPaper { interface WrappingPaper {
name: string; name: string;
buyable: GenericBuyable; buyable: GenericRepeatable;
display: JSXFunction; display: JSXFunction;
} }
@ -54,8 +54,8 @@ const layer = createLayer(id, () => {
const name = "Wrapping Paper"; const name = "Wrapping Paper";
const color = "gold"; const color = "gold";
const createWrappingPaper = (options: WrappingPaperOptions & Partial<BuyableOptions>) => { const createWrappingPaper = (options: WrappingPaperOptions & Partial<RepeatableOptions>) => {
const buyable: GenericBuyable = createBuyable(() => { const buyable: GenericRepeatable = createRepeatable(() => {
return { return {
requirements: (Object.entries(options.ratio) as [enumColor, Scaling][]).map( requirements: (Object.entries(options.ratio) as [enumColor, Scaling][]).map(
([color, ratio]) => { ([color, ratio]) => {