diff --git a/src/data/common.tsx b/src/data/common.tsx index b089ffc..6145f79 100644 --- a/src/data/common.tsx +++ b/src/data/common.tsx @@ -1,7 +1,7 @@ import Collapsible from "components/layout/Collapsible.vue"; import "data/layers/styles/day-gradients.css"; 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 { createClickable } from "features/clickables/clickable"; import type { GenericConversion } from "features/conversion"; @@ -534,7 +534,7 @@ export function setUpDailyProgressTracker(options: { export function changeActiveBuyables(options: { style?: StyleValue; active: Persistent; - buyable: GenericBuyable; + buyable: GenericRepeatable; }) { const style = options.style ?? { minHeight: "20px", width: "40px", color: "var(--foreground)" }; const min = createClickable(() => ({ diff --git a/src/data/layers/boxes.tsx b/src/data/layers/boxes.tsx index 361ce4b..e2412a4 100644 --- a/src/data/layers/boxes.tsx +++ b/src/data/layers/boxes.tsx @@ -6,7 +6,7 @@ import Spacer from "components/layout/Spacer.vue"; import Modal from "components/Modal.vue"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { main } from "data/projEntry"; -import { createBuyable } from "features/buyable"; +import { createRepeatable } from "features/repeatable"; import { createClickable } from "features/clickables/clickable"; import { createCumulativeConversion, createPolynomialScaling } from "features/conversion"; import { jsx, showIf } from "features/feature"; @@ -230,7 +230,7 @@ const layer = createLayer(id, function (this: BaseLayer) { } })) as GenericUpgrade; const row3Upgrades = { clothUpgrade, dyeUpgrade, xpUpgrade }; - const logBoxesBuyable = createBuyable(() => ({ + const logBoxesBuyable = createRepeatable(() => ({ display: { title: "Carry more logs", description: jsx(() => ( @@ -300,7 +300,7 @@ const layer = createLayer(id, function (this: BaseLayer) { Decimal.add(logBoxesBuyable.amount.value, logBoxesBuyable.freeLevels.value) ) })) as BoxesBuyable; - const ashBoxesBuyable = createBuyable(() => ({ + const ashBoxesBuyable = createRepeatable(() => ({ display: { title: "Carry more ash", description: jsx(() => ( @@ -364,7 +364,7 @@ const layer = createLayer(id, function (this: BaseLayer) { Decimal.add(ashBoxesBuyable.amount.value, ashBoxesBuyable.freeLevels.value) ) })) as BoxesBuyable; - const coalBoxesBuyable = createBuyable(() => ({ + const coalBoxesBuyable = createRepeatable(() => ({ display: { title: "Carry more coal", description: jsx(() => ( @@ -429,7 +429,7 @@ const layer = createLayer(id, function (this: BaseLayer) { ) })) as BoxesBuyable; const buyables = { logBoxesBuyable, ashBoxesBuyable, coalBoxesBuyable }; - const oreBoxesBuyable = createBuyable(() => ({ + const oreBoxesBuyable = createRepeatable(() => ({ display: { title: "Carry more ore", description: jsx(() => ( @@ -499,7 +499,7 @@ const layer = createLayer(id, function (this: BaseLayer) { Decimal.add(oreBoxesBuyable.amount.value, oreBoxesBuyable.freeLevels.value) ) })) as BoxesBuyable; - const metalBoxesBuyable = createBuyable(() => ({ + const metalBoxesBuyable = createRepeatable(() => ({ display: { title: "Carry more metal", description: jsx(() => ( @@ -563,7 +563,7 @@ const layer = createLayer(id, function (this: BaseLayer) { Decimal.add(metalBoxesBuyable.amount.value, metalBoxesBuyable.freeLevels.value) ) })) as BoxesBuyable; - const plasticBoxesBuyable = createBuyable(() => ({ + const plasticBoxesBuyable = createRepeatable(() => ({ display: { title: "Carry more plastic", description: jsx(() => ( @@ -627,7 +627,7 @@ const layer = createLayer(id, function (this: BaseLayer) { Decimal.add(plasticBoxesBuyable.amount.value, plasticBoxesBuyable.freeLevels.value) ) })) as BoxesBuyable; - const presentBuyable = createBuyable(() => ({ + const presentBuyable = createRepeatable(() => ({ display: { title: "Carry presents in boxes", description: jsx(() => ( diff --git a/src/data/layers/cloth.tsx b/src/data/layers/cloth.tsx index 37e05ec..5c36d76 100644 --- a/src/data/layers/cloth.tsx +++ b/src/data/layers/cloth.tsx @@ -9,7 +9,7 @@ import Modal from "components/Modal.vue"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { main } from "data/projEntry"; import { createBar } from "features/bars/bar"; -import { createBuyable } from "features/buyable"; +import { createRepeatable } from "features/repeatable"; import { createClickable } from "features/clickables/clickable"; import { jsx, showIf } from "features/feature"; import { createHotkey } from "features/hotkey"; @@ -240,7 +240,7 @@ const layer = createLayer(id, function (this: BaseLayer) { enabled: noPersist(main.days[day - 1].opened) })); - const buildPens = createBuyable(() => ({ + const buildPens = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: trees.logs, cost() { @@ -263,7 +263,7 @@ const layer = createLayer(id, function (this: BaseLayer) { } })) as ElfBuyable; - const betterShears = createBuyable(() => ({ + const betterShears = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: metal.metal, cost() { @@ -286,7 +286,7 @@ const layer = createLayer(id, function (this: BaseLayer) { } })) as ElfBuyable; - const fasterSpinning = createBuyable(() => ({ + const fasterSpinning = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: paper.paper, cost() { diff --git a/src/data/layers/coal.tsx b/src/data/layers/coal.tsx index c7ac104..88f6651 100644 --- a/src/data/layers/coal.tsx +++ b/src/data/layers/coal.tsx @@ -12,7 +12,7 @@ import { setUpDailyProgressTracker } from "data/common"; import { main } from "data/projEntry"; -import { createBuyable } from "features/buyable"; +import { createRepeatable } from "features/repeatable"; import { jsx, showIf } from "features/feature"; import MainDisplay from "features/resources/MainDisplay.vue"; 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); return v.pow(masteryEffectActive.value ? 1.1 : 1.5).times(1e4); }); - const buildFire = createBuyable(() => ({ + const buildFire = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: trees.logs, cost: fireCost @@ -141,7 +141,7 @@ const layer = createLayer(id, function (this: BaseLayer) { } return gain; }); - const buildBonfire = createBuyable(() => ({ + const buildBonfire = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: fireResource, cost() { @@ -215,7 +215,7 @@ const layer = createLayer(id, function (this: BaseLayer) { 1e7 ); }); - const buildKiln = createBuyable(() => ({ + const buildKiln = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: trees.logs, cost: kilnCost @@ -288,7 +288,7 @@ const layer = createLayer(id, function (this: BaseLayer) { } return cost; }); - const buildDrill = createBuyable(() => ({ + const buildDrill = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: metal.metal, cost: drillCost @@ -521,7 +521,7 @@ const layer = createLayer(id, function (this: BaseLayer) { })); const row3upgrades = [efficientSmelther, arsonistAssistance, refinedCoal, coloredFire]; - const heatedCutters = createBuyable(() => ({ + const heatedCutters = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(coal), cost() { @@ -559,7 +559,7 @@ const layer = createLayer(id, function (this: BaseLayer) { style: { color: colorText }, visibility: () => showIf(warmerCutters.bought.value) })) as ElfBuyable & { display: { title: string }; resource: Resource }; - const heatedPlanters = createBuyable(() => ({ + const heatedPlanters = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(coal), cost() { @@ -599,7 +599,7 @@ const layer = createLayer(id, function (this: BaseLayer) { style: { color: colorText }, visibility: () => showIf(warmerPlanters.bought.value) })) as ElfBuyable & { display: { title: string }; resource: Resource }; - const moreFertilizer = createBuyable(() => ({ + const moreFertilizer = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(ash), cost() { diff --git a/src/data/layers/dyes.tsx b/src/data/layers/dyes.tsx index 2741c58..7c81814 100644 --- a/src/data/layers/dyes.tsx +++ b/src/data/layers/dyes.tsx @@ -7,7 +7,7 @@ import Spacer from "components/layout/Spacer.vue"; import Sqrt from "components/math/Sqrt.vue"; import Modal from "components/Modal.vue"; 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 { createHotkey, GenericHotkey } from "features/hotkey"; import MainDisplay from "features/resources/MainDisplay.vue"; @@ -111,7 +111,7 @@ const layer = createLayer(id, function (this: BaseLayer) { name: string; reset: VoidFunction; }[]; - } & Partial + } & Partial ): Dye { const amount = createResource( computed(() => @@ -259,7 +259,7 @@ const layer = createLayer(id, function (this: BaseLayer) { break; } - const buyable: ElfBuyable = createBuyable(() => { + const buyable: ElfBuyable = createRepeatable(() => { const costs = options.costs(); return { ...options, diff --git a/src/data/layers/elves.tsx b/src/data/layers/elves.tsx index d91ea5e..4828c1b 100644 --- a/src/data/layers/elves.tsx +++ b/src/data/layers/elves.tsx @@ -9,7 +9,7 @@ import Modal from "components/Modal.vue"; import { createCollapsibleMilestones, createCollapsibleModifierSections } from "data/common"; import { main } from "data/projEntry"; import { createBar, GenericBar } from "features/bars/bar"; -import { GenericBuyable } from "features/buyable"; +import { GenericRepeatable } from "features/repeatable"; import { ClickableOptions } from "features/clickables/clickable"; import { jsx, showIf, Visibility } from "features/feature"; import { createMilestone } from "features/milestones/milestone"; @@ -42,7 +42,7 @@ import letters from "./letters"; import packing from "./packing"; 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. */ inverseCost: (x?: DecimalSource) => DecimalSource; resource: Resource; diff --git a/src/data/layers/factory.tsx b/src/data/layers/factory.tsx index 5bd223a..525878b 100644 --- a/src/data/layers/factory.tsx +++ b/src/data/layers/factory.tsx @@ -10,7 +10,7 @@ import Modal from "components/Modal.vue"; import { createCollapsibleModifierSections } from "data/common"; import { main } from "data/projEntry"; 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 { createHotkey, GenericHotkey } from "features/hotkey"; import MainDisplay from "features/resources/MainDisplay.vue"; @@ -1153,7 +1153,7 @@ const factory = createLayer(id, () => { ]); const computedCostCheapeners = computed(() => costCheapener.apply(1)); - const clothesBuyable = createBuyable(() => ({ + const clothesBuyable = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: toys.clothes, cost() { @@ -1167,8 +1167,8 @@ const factory = createLayer(id, () => { description: "Use your finished toys to train an elf on factory work" }, style: "width: 110px" - })) as GenericBuyable; - const blocksBuyable = createBuyable(() => ({ + })) as GenericRepeatable; + const blocksBuyable = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: toys.woodenBlocks, cost() { @@ -1182,8 +1182,8 @@ const factory = createLayer(id, () => { description: "Use your finished toys to train an elf on factory work" }, style: "width: 110px" - })) as GenericBuyable; - const trucksBuyable = createBuyable(() => ({ + })) as GenericRepeatable; + const trucksBuyable = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: toys.trucks, cost() { @@ -1197,8 +1197,8 @@ const factory = createLayer(id, () => { description: "Use your finished toys to train an elf on factory work" }, style: "width: 110px" - })) as GenericBuyable; - const bearsBuyable = createBuyable(() => ({ + })) as GenericRepeatable; + const bearsBuyable = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(bears), cost() { @@ -1213,8 +1213,8 @@ const factory = createLayer(id, () => { }, style: "width: 110px", visible: () => showIf(main.days[advancedDay - 1].opened.value) - })) as GenericBuyable; - const bucketBuyable = createBuyable(() => ({ + })) as GenericRepeatable; + const bucketBuyable = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(bucketAndShovels), cost() { @@ -1229,8 +1229,8 @@ const factory = createLayer(id, () => { }, style: "width: 110px", visible: () => showIf(main.days[advancedDay - 1].opened.value) - })) as GenericBuyable; - const consolesBuyable = createBuyable(() => ({ + })) as GenericRepeatable; + const consolesBuyable = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(consoles), cost() { @@ -1245,7 +1245,7 @@ const factory = createLayer(id, () => { }, style: "width: 110px", visible: () => showIf(main.days[advancedDay - 1].opened.value) - })) as GenericBuyable; + })) as GenericRepeatable; const elfBuyables = { clothesBuyable, blocksBuyable, @@ -1263,7 +1263,7 @@ const factory = createLayer(id, () => { const trainedElves = createResource(sumElves, "trained elves"); const elvesEffect = computed(() => Decimal.pow(1.05, trainedElves.value)); - const expandFactory = createBuyable(() => ({ + const expandFactory = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: trees.logs, cost() { @@ -1282,8 +1282,8 @@ const factory = createLayer(id, () => { purchaseLimit: 12, style: "width: 200px", visibility: () => showIf(main.days[advancedDay - 1].opened.value) - })) as GenericBuyable; - const oilFuel = createBuyable(() => ({ + })) as GenericRepeatable; + const oilFuel = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: oil.oil, cost() { @@ -1298,8 +1298,8 @@ const factory = createLayer(id, () => { }, style: "width: 200px", visibility: () => showIf(main.days[advancedDay - 1].opened.value) - })) as GenericBuyable; - const carryToys = createBuyable(() => ({ + })) as GenericRepeatable; + const carryToys = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: boxes.boxes, cost() { @@ -1316,7 +1316,7 @@ const factory = createLayer(id, () => { }, style: "width: 200px", visibility: () => showIf(main.days[advancedDay - 1].opened.value) - })) as GenericBuyable; + })) as GenericRepeatable; const betterFactory = createUpgrade(() => ({ requirements: createCostRequirement(() => ({ @@ -1368,7 +1368,7 @@ const factory = createLayer(id, () => { }, visibility: () => showIf(excitmentUpgrade.bought.value) })); - const carryBoxes = createBuyable(() => ({ + const carryBoxes = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(presents), cost() { @@ -1386,7 +1386,7 @@ const factory = createLayer(id, () => { effectDisplay: jsx(() => <>x{format(Decimal.pow(1.5, carryBoxes.amount.value))}) }, visibility: () => showIf(carryPresents.bought.value) - })) as GenericBuyable; + })) as GenericRepeatable; const catalysts = createUpgrade(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(presents), diff --git a/src/data/layers/letters.tsx b/src/data/layers/letters.tsx index ec7ff35..9494c8d 100644 --- a/src/data/layers/letters.tsx +++ b/src/data/layers/letters.tsx @@ -20,7 +20,7 @@ import Decimal, { DecimalSource, format, formatWhole } from "util/bignum"; import { Direction } from "util/common"; import { render, renderRow } from "util/vue"; import { computed, ref } from "vue"; -import { createBuyable, GenericBuyable } from "features/buyable"; +import { createRepeatable, GenericRepeatable } from "features/repeatable"; import metal from "./metal"; import plastic from "./plastic"; import paper from "./paper"; @@ -96,7 +96,7 @@ const layer = createLayer(id, function (this: BaseLayer) { enabled: noPersist(main.days[day - 1].opened) })); - const metalBuyable = createBuyable(() => ({ + const metalBuyable = createRepeatable(() => ({ display: { title: "Sorting Machine", description: @@ -112,8 +112,8 @@ const layer = createLayer(id, function (this: BaseLayer) { } })), visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value) - })) as GenericBuyable; - const plasticBuyable = createBuyable(() => ({ + })) as GenericRepeatable; + const plasticBuyable = createRepeatable(() => ({ display: { title: "Plastic Bins", description: @@ -129,8 +129,8 @@ const layer = createLayer(id, function (this: BaseLayer) { } })), visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value) - })) as GenericBuyable; - const paperBuyable = createBuyable(() => ({ + })) as GenericRepeatable; + const paperBuyable = createRepeatable(() => ({ display: { title: "Printed Labels", 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) - })) as GenericBuyable; + })) as GenericRepeatable; const buyables = { metalBuyable, plasticBuyable, paperBuyable }; const autoSmeltingMilestone = createMilestone(() => ({ diff --git a/src/data/layers/management.tsx b/src/data/layers/management.tsx index b1b0d7c..841370e 100644 --- a/src/data/layers/management.tsx +++ b/src/data/layers/management.tsx @@ -4,7 +4,7 @@ import Modal from "components/Modal.vue"; import { createCollapsibleMilestones, createCollapsibleModifierSections } from "data/common"; import { main } from "data/projEntry"; 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 { jsx, showIf, Visibility } from "features/feature"; import { createMilestone, GenericMilestone } from "features/milestones/milestone"; @@ -1592,7 +1592,7 @@ const layer = createLayer(id, () => { const upgrades2 = [focusUpgrade4, focusUpgrade5, focusUpgrade6]; // ------------------------------------------------------------------------------- Schools - const schools = createBuyable(() => ({ + const schools = createRepeatable(() => ({ requirements: [ createCostRequirement(() => ({ resource: trees.logs, @@ -1678,7 +1678,7 @@ const layer = createLayer(id, () => { }, visibility: computed(() => showIf(teaching.bought.value)), style: "width: 600px" - })) as GenericBuyable; + })) as GenericRepeatable; const classroomFactor = computed(() => { let v = classrooms.amount.value; @@ -1691,7 +1691,7 @@ const layer = createLayer(id, () => { return Decimal.add(classrooms.amount.value, 1).pow(0.9); }); - const classrooms = createBuyable(() => ({ + const classrooms = createRepeatable(() => ({ requirements: [ createCostRequirement(() => ({ resource: trees.logs, @@ -1727,7 +1727,7 @@ const layer = createLayer(id, () => { }, visibility: computed(() => showIf(classroomUpgrade.bought.value)), style: "width: 600px" - })) as GenericBuyable; + })) as GenericRepeatable; // ------------------------------------------------------------------------------- Modifiers diff --git a/src/data/layers/metal.tsx b/src/data/layers/metal.tsx index 9c18079..16ac039 100644 --- a/src/data/layers/metal.tsx +++ b/src/data/layers/metal.tsx @@ -3,7 +3,7 @@ import Spacer from "components/layout/Spacer.vue"; import Modal from "components/Modal.vue"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { createBar } from "features/bars/bar"; -import { createBuyable } from "features/buyable"; +import { createRepeatable } from "features/repeatable"; import { createClickable } from "features/clickables/clickable"; import { jsx, showIf } from "features/feature"; 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) })); - const oreDrill = createBuyable(() => ({ + const oreDrill = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(metal), cost() { @@ -552,7 +552,7 @@ const layer = createLayer(id, function (this: BaseLayer) { ), style: { width: "200px" } })) as ElfBuyable; - const industrialCrucible = createBuyable(() => ({ + const industrialCrucible = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(metal), cost() { @@ -599,7 +599,7 @@ const layer = createLayer(id, function (this: BaseLayer) { style: { width: "200px" } })) as ElfBuyable; const autoSmeltEnabled = persistent(true); - const hotterForge = createBuyable(() => ({ + const hotterForge = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: coal.coal, cost() { diff --git a/src/data/layers/oil.tsx b/src/data/layers/oil.tsx index 5b9eccb..2bfe91f 100644 --- a/src/data/layers/oil.tsx +++ b/src/data/layers/oil.tsx @@ -18,7 +18,7 @@ import Decimal, { DecimalSource } from "lib/break_eternity"; import { render, renderGrid, renderRow } from "util/vue"; import { computed, ComputedRef, ref, unref } from "vue"; 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 metal from "./metal"; import { @@ -114,7 +114,7 @@ const layer = createLayer(id, function (this: BaseLayer) { v = Decimal.pow(0.95, paper.books.heavyDrillBook.totalAmount.value).times(v); return Decimal.pow(1.3, v).times(2.5e4); }); - const buildHeavy = createBuyable(() => ({ + const buildHeavy = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: metal.metal, 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); return Decimal.pow(2, v).times(1e5); }); - const buildHeavy2 = createBuyable(() => ({ + const buildHeavy2 = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: metal.metal, 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); return Decimal.pow(8, v).times(2e5); }); - const buildExtractor = createBuyable(() => ({ + const buildExtractor = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: metal.metal, cost: extractorCost @@ -334,7 +334,7 @@ const layer = createLayer(id, function (this: BaseLayer) { } return price; }); - const buildPump = createBuyable(() => ({ + const buildPump = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: metal.metal, 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); return Decimal.pow(2, v).times(50); }); - const buildBurner = createBuyable(() => ({ + const buildBurner = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(oil), 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)); return price; }); - const buildSmelter = createBuyable(() => ({ + const buildSmelter = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: metal.metal, cost: smelterCost diff --git a/src/data/layers/packing.tsx b/src/data/layers/packing.tsx index 89cc689..559b547 100644 --- a/src/data/layers/packing.tsx +++ b/src/data/layers/packing.tsx @@ -3,7 +3,7 @@ import SpacerVue from "components/layout/Spacer.vue"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { main } from "data/projEntry"; 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 { jsx, showIf } from "features/feature"; 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 elf = createBuyable(() => ({ + const elf = createRepeatable(() => ({ visibility: () => showIf(Decimal.gte(totalPresents.value, 10)), requirements: createCostRequirement(() => ({ resource: totalPresentsResource, @@ -228,7 +228,7 @@ const layer = createLayer(id, function (this: BaseLayer) { width: "200px" } })) as ElfBuyable; - const loader = createBuyable(() => ({ + const loader = createRepeatable(() => ({ visibility: () => showIf(upgrades.loaderUnlock.bought.value), requirements: [ createCostRequirement(() => ({ diff --git a/src/data/layers/paper.tsx b/src/data/layers/paper.tsx index ffdeb25..f537aeb 100644 --- a/src/data/layers/paper.tsx +++ b/src/data/layers/paper.tsx @@ -6,7 +6,7 @@ import Spacer from "components/layout/Spacer.vue"; import Modal from "components/Modal.vue"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { main } from "data/projEntry"; -import { BuyableOptions, createBuyable } from "features/buyable"; +import { RepeatableOptions, createRepeatable } from "features/repeatable"; import { createClickable } from "features/clickables/clickable"; import { createCumulativeConversion, createPolynomialScaling } from "features/conversion"; import { jsx, showIf } from "features/feature"; @@ -100,9 +100,9 @@ const layer = createLayer(id, function (this: BaseLayer) { })); function createBook( - options: { name: string; elfName: string; buyableName: string } & Partial + options: { name: string; elfName: string; buyableName: string } & Partial ) { - const buyable = createBuyable(() => ({ + const buyable = createRepeatable(() => ({ ...options, display: { title: options.name, diff --git a/src/data/layers/plastic.tsx b/src/data/layers/plastic.tsx index 81dcd6f..789cc31 100644 --- a/src/data/layers/plastic.tsx +++ b/src/data/layers/plastic.tsx @@ -12,7 +12,7 @@ import { setUpDailyProgressTracker } from "data/common"; import { main } from "data/projEntry"; -import { createBuyable, GenericBuyable } from "features/buyable"; +import { createRepeatable, GenericRepeatable } from "features/repeatable"; import { jsx, showIf } from "features/feature"; import MainDisplay from "features/resources/MainDisplay.vue"; import { createResource, Resource } from "features/resources/resource"; @@ -86,7 +86,7 @@ const layer = createLayer(id, function (this: BaseLayer) { } return cost; }); - const buildRefinery = createBuyable(() => ({ + const buildRefinery = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: metal.metal, cost: refineryCost @@ -116,7 +116,7 @@ const layer = createLayer(id, function (this: BaseLayer) { width: "300px" }, visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value) - })) as GenericBuyable & { resource: Resource }; + })) as GenericRepeatable & { resource: Resource }; const { min: minRefinery, max: maxRefinery, @@ -227,7 +227,7 @@ const layer = createLayer(id, function (this: BaseLayer) { })) as GenericUpgrade; const elfUpgrades = { paperElf, boxElf, clothElf }; - const passivePaper = createBuyable(() => ({ + const passivePaper = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(plastic), cost() { @@ -263,7 +263,7 @@ const layer = createLayer(id, function (this: BaseLayer) { Decimal.add(passivePaper.amount.value, passivePaper.freeLevels.value) ) })) as BoxesBuyable; - const passiveBoxes = createBuyable(() => ({ + const passiveBoxes = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(plastic), cost() { @@ -299,7 +299,7 @@ const layer = createLayer(id, function (this: BaseLayer) { Decimal.add(passiveBoxes.amount.value, passiveBoxes.freeLevels.value) ) })) as BoxesBuyable; - const clothGains = createBuyable(() => ({ + const clothGains = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(plastic), cost() { diff --git a/src/data/layers/routing.tsx b/src/data/layers/routing.tsx index ca40488..a2760f3 100644 --- a/src/data/layers/routing.tsx +++ b/src/data/layers/routing.tsx @@ -8,7 +8,7 @@ import { createCollapsibleMilestones, createCollapsibleModifierSections } from " import { main } from "data/projEntry"; import { createBar, GenericBar } from "features/bars/bar"; 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 { jsx, showIf } from "features/feature"; 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)); }); const metaBuyables = { - metal: createBuyable(() => ({ + metal: createRepeatable(() => ({ resName: "Metal", requirements: createCostRequirement(() => ({ resource: metal.metal, @@ -624,7 +624,7 @@ const layer = createLayer(id, function (this: BaseLayer) { }, style: "width: 150px; min-height: 60px" })), - console: createBuyable(() => ({ + console: createRepeatable(() => ({ resName: "Game Console", requirements: createCostRequirement(() => ({ resource: factory.consoles, @@ -638,7 +638,7 @@ const layer = createLayer(id, function (this: BaseLayer) { }, style: "width: 150px; min-height: 60px" })), - classroom: createBuyable(() => ({ + classroom: createRepeatable(() => ({ resName: "Classroom", requirements: createCostRequirement(() => ({ resource: createResource(management.classrooms.amount, "classrooms"), @@ -658,7 +658,7 @@ const layer = createLayer(id, function (this: BaseLayer) { }, style: "width: 150px; min-height: 60px" })), - tick: createBuyable(() => ({ + tick: createRepeatable(() => ({ resName: "Factory Tick Rate", requirements: createCostRequirement(() => ({ resource: createResource(factory.computedTickRate, "factory tick rate"), @@ -678,7 +678,7 @@ const layer = createLayer(id, function (this: BaseLayer) { }, style: "width: 150px; min-height: 60px" })) - } as Record; + } as Record; const metaMilestones = { 0: createMilestone(() => ({ diff --git a/src/data/layers/sleigh.tsx b/src/data/layers/sleigh.tsx index 89fb643..4b9a9e4 100644 --- a/src/data/layers/sleigh.tsx +++ b/src/data/layers/sleigh.tsx @@ -7,7 +7,7 @@ import Spacer from "components/layout/Spacer.vue"; import { createCollapsibleMilestones } from "data/common"; import { main } from "data/projEntry"; 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 { createMilestone } from "features/milestones/milestone"; import { Resource } from "features/resources/resource"; @@ -41,7 +41,7 @@ const layer = createLayer(id, function (this: BaseLayer) { ); } const sleighProgress = computed(() => sleigh.amount); - const sleigh = createBuyable(() => ({ + const sleigh = createRepeatable(() => ({ requirements: [ createCostRequirement(() => ({ resource: trees.logs, @@ -65,7 +65,7 @@ const layer = createLayer(id, function (this: BaseLayer) { }, visibility: () => showIf(Decimal.lt(sleighProgress.value.value, 100)), style: "width: 600px" - })) as GenericBuyable; + })) as GenericRepeatable; const shouldShowPopups = computed(() => true); const milestone1 = createMilestone(() => ({ diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index dd816af..3aaa2e3 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -10,7 +10,7 @@ import { setUpDailyProgressTracker } from "data/common"; import { main } from "data/projEntry"; -import { createBuyable, GenericBuyable } from "features/buyable"; +import { createRepeatable, GenericRepeatable } from "features/repeatable"; import { jsx, showIf } from "features/feature"; import { createMilestone, GenericMilestone } from "features/milestones/milestone"; import MainDisplay from "features/resources/MainDisplay.vue"; @@ -47,7 +47,7 @@ const layer = createLayer(id, function (this: BaseLayer) { "toys" ); - const clothesBuyable = createBuyable(() => ({ + const clothesBuyable = createRepeatable(() => ({ requirements: [ createCostRequirement(() => ({ resource: cloth.cloth, @@ -87,8 +87,8 @@ const layer = createLayer(id, function (this: BaseLayer) { onPurchase() { clothes.value = Decimal.add(clothes.value, 1); } - })) as GenericBuyable; - const woodenBlocksBuyable = createBuyable(() => ({ + })) as GenericRepeatable; + const woodenBlocksBuyable = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: trees.logs, cost() { @@ -113,8 +113,8 @@ const layer = createLayer(id, function (this: BaseLayer) { onPurchase() { woodenBlocks.value = Decimal.add(woodenBlocks.value, 1); } - })) as GenericBuyable; - const trucksBuyable = createBuyable(() => ({ + })) as GenericRepeatable; + const trucksBuyable = createRepeatable(() => ({ requirements: [ createCostRequirement(() => ({ resource: metal.metal, @@ -153,7 +153,7 @@ const layer = createLayer(id, function (this: BaseLayer) { onPurchase() { trucks.value = Decimal.add(trucks.value, 1); } - })) as GenericBuyable; + })) as GenericRepeatable; const buyables = [clothesBuyable, woodenBlocksBuyable, trucksBuyable]; const trucksUpgrade1 = createUpgrade(() => ({ requirements: createCostRequirement(() => ({ diff --git a/src/data/layers/trees.tsx b/src/data/layers/trees.tsx index b1a99a4..33b8740 100644 --- a/src/data/layers/trees.tsx +++ b/src/data/layers/trees.tsx @@ -8,7 +8,7 @@ import Modal from "components/Modal.vue"; import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { main } from "data/projEntry"; import { createBar } from "features/bars/bar"; -import { createBuyable } from "features/buyable"; +import { createRepeatable } from "features/repeatable"; import { createClickable } from "features/clickables/clickable"; import { jsx, showIf } from "features/feature"; import { createHotkey } from "features/hotkey"; @@ -237,7 +237,7 @@ const layer = createLayer(id, function (this: BaseLayer) { researchUpgrade2 ]; - const autoCuttingBuyable1 = createBuyable(() => ({ + const autoCuttingBuyable1 = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(logs), cost() { @@ -266,7 +266,7 @@ const layer = createLayer(id, function (this: BaseLayer) { }, visibility: () => showIf(researchUpgrade2.bought.value) })) as ElfBuyable; - const autoPlantingBuyable1 = createBuyable(() => ({ + const autoPlantingBuyable1 = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(logs), cost() { @@ -302,7 +302,7 @@ const layer = createLayer(id, function (this: BaseLayer) { }, visibility: () => showIf(researchUpgrade2.bought.value) })) as ElfBuyable; - const expandingForestBuyable = createBuyable(() => ({ + const expandingForestBuyable = createRepeatable(() => ({ requirements: createCostRequirement(() => ({ resource: noPersist(logs), cost() { diff --git a/src/data/layers/wrapping-paper.tsx b/src/data/layers/wrapping-paper.tsx index eca5195..a61d54b 100644 --- a/src/data/layers/wrapping-paper.tsx +++ b/src/data/layers/wrapping-paper.tsx @@ -1,6 +1,6 @@ import Spacer from "components/layout/Spacer.vue"; 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 { jsx, JSXFunction, showIf } from "features/feature"; import { createMilestone } from "features/milestones/milestone"; @@ -29,7 +29,7 @@ const baseSecondaryRatio = 1.2; interface WrappingPaper { name: string; - buyable: GenericBuyable; + buyable: GenericRepeatable; display: JSXFunction; } @@ -54,8 +54,8 @@ const layer = createLayer(id, () => { const name = "Wrapping Paper"; const color = "gold"; - const createWrappingPaper = (options: WrappingPaperOptions & Partial) => { - const buyable: GenericBuyable = createBuyable(() => { + const createWrappingPaper = (options: WrappingPaperOptions & Partial) => { + const buyable: GenericRepeatable = createRepeatable(() => { return { requirements: (Object.entries(options.ratio) as [enumColor, Scaling][]).map( ([color, ratio]) => {