From ed2c8d08b1975c6cafac14ab4f010179efd7a0c4 Mon Sep 17 00:00:00 2001 From: Seth Posner Date: Fri, 16 Dec 2022 15:57:27 -0800 Subject: [PATCH] Add paper mastery data --- src/data/layers/paper.tsx | 73 +++++++++++++++++++++++++++++++++++---- src/data/projEntry.tsx | 2 +- 2 files changed, 68 insertions(+), 7 deletions(-) diff --git a/src/data/layers/paper.tsx b/src/data/layers/paper.tsx index afd355b..f1299d9 100644 --- a/src/data/layers/paper.tsx +++ b/src/data/layers/paper.tsx @@ -16,7 +16,7 @@ import { createUpgrade, GenericUpgrade } from "features/upgrades/upgrade"; import { globalBus } from "game/events"; import { BaseLayer, createLayer } from "game/layers"; import { createMultiplicativeModifier, createSequentialModifier, Modifier } from "game/modifiers"; -import { noPersist } from "game/persistence"; +import { noPersist, persistent } from "game/persistence"; import Decimal, { DecimalSource, format, formatSmall, formatWhole } from "util/bignum"; import { WithRequired } from "util/common"; import { render, renderCol, renderGrid } from "util/vue"; @@ -466,6 +466,68 @@ const layer = createLayer(id, function (this: BaseLayer) { } }); + const mastery = { + paper: persistent(0), + totalPaper: persistent(0), + books: { + cuttersBook: { amount: persistent(0) }, + plantersBook: { amount: persistent(0) }, + expandersBook: { amount: persistent(0) }, + heatedCuttersBook: { amount: persistent(0) }, + heatedPlantersBook: { amount: persistent(0) }, + fertilizerBook: { amount: persistent(0) }, + smallFireBook: { amount: persistent(0) }, + bonfireBook: { amount: persistent(0) }, + kilnBook: { amount: persistent(0) }, + paperBook: { amount: persistent(0) }, + boxBook: { amount: persistent(0) }, + clothBook: { amount: persistent(0) }, + coalDrillBook: { amount: persistent(0) }, + heavyDrillBook: { amount: persistent(0) }, + oilBook: { amount: persistent(0) }, + metalBook: { amount: persistent(0) }, + dyeBook: { amount: persistent(0) } + }, + upgrades: { + clothUpgrade: { bought: persistent(false) }, + drillingUpgrade: { bought: persistent(false) }, + oilUpgrade: { bought: persistent(false) } + }, + upgrades2: { + ashUpgrade: { bought: persistent(false) }, + bookUpgrade: { bought: persistent(false) }, + treeUpgrade: { bought: persistent(false) } + } + }; + function swapMastery() { + [paper.value, mastery.paper.value] = [mastery.paper.value, paper.value]; + [totalPaper.value, mastery.totalPaper.value] = [mastery.totalPaper.value, totalPaper.value]; + [books.cuttersBook.amount.value, mastery.books.cuttersBook.amount.value] = [mastery.books.cuttersBook.amount.value, books.cuttersBook.amount.value]; + [books.plantersBook.amount.value, mastery.books.plantersBook.amount.value] = [mastery.books.plantersBook.amount.value, books.plantersBook.amount.value]; + [books.expandersBook.amount.value, mastery.books.expandersBook.amount.value] = [mastery.books.expandersBook.amount.value, books.expandersBook.amount.value]; + [books.heatedCuttersBook.amount.value, mastery.books.heatedCuttersBook.amount.value] = [mastery.books.heatedCuttersBook.amount.value, books.heatedCuttersBook.amount.value]; + [books.heatedPlantersBook.amount.value, mastery.books.heatedPlantersBook.amount.value] = [mastery.books.heatedPlantersBook.amount.value, books.heatedPlantersBook.amount.value]; + [books.fertilizerBook.amount.value, mastery.books.fertilizerBook.amount.value] = [mastery.books.fertilizerBook.amount.value, books.fertilizerBook.amount.value]; + [books.smallFireBook.amount.value, mastery.books.smallFireBook.amount.value] = [mastery.books.smallFireBook.amount.value, books.smallFireBook.amount.value]; + [books.bonfireBook.amount.value, mastery.books.bonfireBook.amount.value] = [mastery.books.bonfireBook.amount.value, books.bonfireBook.amount.value]; + [books.kilnBook.amount.value, mastery.books.kilnBook.amount.value] = [mastery.books.kilnBook.amount.value, books.kilnBook.amount.value]; + [books.paperBook.amount.value, mastery.books.paperBook.amount.value] = [mastery.books.paperBook.amount.value, books.paperBook.amount.value]; + [books.boxBook.amount.value, mastery.books.boxBook.amount.value] = [mastery.books.boxBook.amount.value, books.boxBook.amount.value]; + [books.clothBook.amount.value, mastery.books.clothBook.amount.value] = [mastery.books.clothBook.amount.value, books.clothBook.amount.value]; + [books.coalDrillBook.amount.value, mastery.books.coalDrillBook.amount.value] = [mastery.books.coalDrillBook.amount.value, books.coalDrillBook.amount.value]; + [books.heavyDrillBook.amount.value, mastery.books.heavyDrillBook.amount.value] = [mastery.books.heavyDrillBook.amount.value, books.heavyDrillBook.amount.value]; + [books.oilBook.amount.value, mastery.books.oilBook.amount.value] = [mastery.books.oilBook.amount.value, books.oilBook.amount.value]; + [books.metalBook.amount.value, mastery.books.metalBook.amount.value] = [mastery.books.metalBook.amount.value, books.metalBook.amount.value]; + [books.dyeBook.amount.value, mastery.books.dyeBook.amount.value] = [mastery.books.dyeBook.amount.value, books.dyeBook.amount.value]; + [upgrades.clothUpgrade.bought.value, mastery.upgrades.clothUpgrade.bought.value] = [mastery.upgrades.clothUpgrade.bought.value, upgrades.clothUpgrade.bought.value]; + [upgrades.drillingUpgrade.bought.value, mastery.upgrades.drillingUpgrade.bought.value] = [mastery.upgrades.drillingUpgrade.bought.value, upgrades.drillingUpgrade.bought.value]; + [upgrades.oilUpgrade.bought.value, mastery.upgrades.oilUpgrade.bought.value] = [mastery.upgrades.oilUpgrade.bought.value, upgrades.oilUpgrade.bought.value]; + [upgrades2.ashUpgrade.bought.value, mastery.upgrades2.ashUpgrade.bought.value] = [mastery.upgrades2.ashUpgrade.bought.value, upgrades2.ashUpgrade.bought.value]; + [upgrades2.bookUpgrade.bought.value, mastery.upgrades2.bookUpgrade.bought.value] = [mastery.upgrades2.bookUpgrade.bought.value, upgrades2.bookUpgrade.bought.value]; + [upgrades2.treeUpgrade.bought.value, mastery.upgrades2.treeUpgrade.bought.value] = [mastery.upgrades2.treeUpgrade.bought.value, upgrades2.treeUpgrade.bought.value]; + }; + const mastered = persistent(false); + return { name, day, @@ -491,11 +553,10 @@ const layer = createLayer(id, function (this: BaseLayer) { {renderCol(...Object.values(books))} )), - minimizedDisplay: jsx(() => ( -
- {name} - {format(paper.value)} {paper.displayName} -
- )) + minimizedDisplay: jsx(() => (
{name} - {format(paper.value)} {paper.displayName}
)), + mastery, + swapMastery, + mastered }; }); diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 39acb87..978ff88 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -83,7 +83,7 @@ export const main = createLayer("main", function (this: BaseLayer) { workshop, coal, elves, - // paper, + paper, // boxes, // metal, // cloth,