diff --git a/src/data/layers/elves.tsx b/src/data/layers/elves.tsx index c6dca5a..7eb2a81 100644 --- a/src/data/layers/elves.tsx +++ b/src/data/layers/elves.tsx @@ -318,11 +318,11 @@ const layer = createLayer(id, function (this: BaseLayer) { description: "6 Elves Trained", enabled: elvesMilestone.earned })), - // createMultiplicativeModifier(() => ({ - // multiplier: () => Decimal.times(paper.books.clothBook.amount.value, 0.1).add(1), - // description: "Fuzzy Bee and Friends", - // enabled: () => Decimal.gt(paper.books.clothBook.amount.value, 0) - // })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.times(paper.books.miningDrillBook.amount.value, 0.1).add(1), + description: "Drills and Mills", + enabled: () => Decimal.gt(paper.books.miningDrillBook.amount.value, 0) + })), createMultiplicativeModifier(() => ({ multiplier: 2, description: "10 Elves Trained", @@ -335,11 +335,11 @@ const layer = createLayer(id, function (this: BaseLayer) { description: "6 Elves Trained", enabled: elvesMilestone.earned })), - // createMultiplicativeModifier(() => ({ - // multiplier: () => Decimal.times(paper.books.clothBook.amount.value, 0.1).add(1), - // description: "Fuzzy Bee and Friends", - // enabled: () => Decimal.gt(paper.books.clothBook.amount.value, 0) - // })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.times(paper.books.metalBook.amount.value, 0.1).add(1), + description: "Physical Metallurgy", + enabled: () => Decimal.gt(paper.books.metalBook.amount.value, 0) + })), createMultiplicativeModifier(() => ({ multiplier: 2, description: "10 Elves Trained", @@ -352,11 +352,11 @@ const layer = createLayer(id, function (this: BaseLayer) { description: "6 Elves Trained", enabled: elvesMilestone.earned })), - // createMultiplicativeModifier(() => ({ - // multiplier: () => Decimal.times(paper.books.clothBook.amount.value, 0.1).add(1), - // description: "Fuzzy Bee and Friends", - // enabled: () => Decimal.gt(paper.books.clothBook.amount.value, 0) - // })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.times(paper.books.heavyDrillBook.amount.value, 0.1).add(1), + description: "Deep in the Earth", + enabled: () => Decimal.gt(paper.books.heavyDrillBook.amount.value, 0) + })), createMultiplicativeModifier(() => ({ multiplier: 2, description: "10 Elves Trained", diff --git a/src/data/layers/management.tsx b/src/data/layers/management.tsx index b1a95e3..de2c372 100644 --- a/src/data/layers/management.tsx +++ b/src/data/layers/management.tsx @@ -12,7 +12,12 @@ import { createMilestone, GenericMilestone } from "features/milestones/milestone import { createUpgrade } from "features/upgrades/upgrade"; import { globalBus } from "game/events"; import { createLayer } from "game/layers"; -import { createMultiplicativeModifier, createSequentialModifier, Modifier } from "game/modifiers"; +import { + createAdditiveModifier, + createMultiplicativeModifier, + createSequentialModifier, + Modifier +} from "game/modifiers"; import { persistent } from "game/persistence"; import Decimal, { DecimalSource, format, formatTime, formatWhole } from "util/bignum"; import { Direction } from "util/common"; @@ -160,7 +165,7 @@ const layer = createLayer(id, () => { createMultiplicativeModifier(() => ({ multiplier: focusMulti, description: "Focus Multiplier", - enabled: () => focusTime.value > 0 && focusTargets.value[elf.name] == true + enabled: () => Decimal.gt(focusTime.value, 0) && focusTargets.value[elf.name] == true })), ...modifiers ]); @@ -894,14 +899,13 @@ const layer = createLayer(id, () => { ); } } - focusTime.value = Math.max(focusTime.value - diff, 0); - focusCooldown.value = Math.max(focusCooldown.value - diff, 0); - if (focusTime.value > 0) { + focusTime.value = Decimal.sub(focusTime.value, diff).max(0) + focusCooldown.value = Decimal.sub(focusCooldown.value, diff).max(0) + if (Decimal.eq(focusTime.value, 0)) { focusMulti.value = Decimal.pow( focusMaxMulti.value, 1 - Math.abs(Math.sin((Date.now() / 1000) * 2)) ); - } }); @@ -909,10 +913,35 @@ const layer = createLayer(id, () => { const focusMulti = persistent(1); const focusTargets = persistent>({}); - const focusCooldown = persistent(0); - const focusTime = persistent(0); + const focusCooldown = persistent(0); + const focusTime = persistent(0); - const focusMaxMulti = computed(() => focusUpgrade1.bought.value ? 20 : 10); + const focusMaxMultiModifiers = createSequentialModifier(() => [ + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Focus Upgrade 1", + enabled: focusUpgrade1.bought + })) + ]); + const maximumElvesModifier = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: 1, + description: "Focus Upgrade 2", + enabled: focusUpgrade2.bought + })) + ]); + + const cooldownModifiers = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: -5, + description: "Focus Upgrade 3", + enabled: focusUpgrade3.bought + })) + ]); + + const focusMaxMulti = computed(() => focusMaxMultiModifiers.apply(10)); + const maximumElves = computed(() => maximumElvesModifier.apply(3)); + const cooldown = computed(() => Number(cooldownModifiers.apply(15))); const focusMeter = createBar(() => ({ direction: Direction.Right, @@ -933,7 +962,7 @@ const layer = createLayer(id, () => { <> Motivate elves to focus, multiplying 3 random elves' XP gain by up to{" "} {format(focusMaxMulti.value)}x, equal to the focus bars' effect. - {focusCooldown.value > 0 ? ( + {Decimal.gte(focusCooldown.value, 0) ? ( <>
Reroll cooldown: {formatTime(focusCooldown.value)} @@ -947,19 +976,21 @@ const layer = createLayer(id, () => { style: { width: "300px" }, - canClick: () => focusCooldown.value === 0, + canClick: () => Decimal.eq(focusCooldown.value, 0), onClick() { - focusCooldown.value = focusUpgrade3.bought.value ? 10 : 15; + focusCooldown.value = cooldown.value; focusTime.value = 10; - rerollFocusTargets(12, focusUpgrade2.bought.value ? 4 : 3); + + // better choice? this has to be a number + rerollFocusTargets(12, maximumElves.value); } })); - function rerollFocusTargets(range: number, count: number) { + function rerollFocusTargets(range: number, count: DecimalSource) { let x = 0; focusTargets.value = {}; - count = Math.min(count, range); - while (x < count) { + const newCount = Decimal.min(count, range) + while (newCount.gte(x)) { const roll = Object.values(elfTraining)[Math.floor(Math.random() * range)]?.name ?? ""; if (!focusTargets.value[roll]) { focusTargets.value[roll] = true; @@ -970,9 +1001,9 @@ const layer = createLayer(id, () => { const focusUpgrade1 = createUpgrade(() => ({ display: { title: "Focus Booster", - description: "Double experience multiplier from focus" + description: "Multiplies the maximum experience multiplier from focus by 2" }, - resource: trees.trees, + resource: trees.logs, cost: 1e30 })); const focusUpgrade2 = createUpgrade(() => ({ @@ -980,7 +1011,7 @@ const layer = createLayer(id, () => { title: "Focus Buffer", description: "Increase elves affected by focus by 1" }, - resource: trees.trees, + resource: trees.logs, cost: 1e40 })); const focusUpgrade3 = createUpgrade(() => ({ @@ -988,7 +1019,7 @@ const layer = createLayer(id, () => { title: "Focus Upgrader", description: "Focus can now be rerolled every 10 seconds" }, - resource: trees.trees, + resource: trees.logs, cost: 1e50 })); const upgrades = { focusUpgrade1, focusUpgrade2, focusUpgrade3 }; @@ -1114,6 +1145,22 @@ const layer = createLayer(id, () => { // ------------------------------------------------------------------------------- Modifiers const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ + { + title: "Elves affected by Focus", + modifier: maximumElvesModifier, + base: 3 + }, + { + title: "Maximum Focus Effect", + modifier: focusMaxMultiModifiers, + base: 10 + }, + { + title: "Focus Cooldown", + modifier: cooldownModifiers, + unit: " secs", + base: 15 + }, { title: "Global XP Gain", modifier: globalXPModifier, @@ -1227,7 +1274,6 @@ const layer = createLayer(id, () => { focusTargets, focusCooldown, focusTime, - display: jsx(() => ( <> diff --git a/src/data/layers/paper.tsx b/src/data/layers/paper.tsx index 94022e3..6edcfe8 100644 --- a/src/data/layers/paper.tsx +++ b/src/data/layers/paper.tsx @@ -187,6 +187,24 @@ const layer = createLayer(id, function (this: BaseLayer) { buyableName: "Cloth Buyables", visibility: () => showIf(elves.elves.clothElf.bought.value) }); + const miningDrillBook = createBook({ + name: "Drills and Mills", + elfName: "Peppermint", + buyableName: "Mining Drill", + visibility: () => showIf(management.elfTraining.expandersElfTraining.milestones[3].earned.value) + }); + const metalBook = createBook({ + name: "Physical Metallurgy", + elfName: "Twinkle", + buyableName: "Metal Buyables", + visibility: () => showIf(management.elfTraining.expandersElfTraining.milestones[4].earned.value) + }); + const heavyDrillBook = createBook({ + name: "Deep in the Earth", + elfName: "Frosty", + buyableName: "Oil Drills", + visibility: () => showIf(management.elfTraining.heatedCutterElfTraining.milestones[4].earned.value) + }); const books = { cuttersBook, plantersBook, @@ -199,7 +217,10 @@ const layer = createLayer(id, function (this: BaseLayer) { kilnBook, paperBook, boxBook, - clothBook + clothBook, + miningDrillBook, + metalBook, + heavyDrillBook }; const sumBooks = computed(() => Object.values(books).reduce((acc, curr) => acc.add(curr.amount.value), new Decimal(0))); diff --git a/src/data/layers/trees.tsx b/src/data/layers/trees.tsx index f14f3c2..5e67dae 100644 --- a/src/data/layers/trees.tsx +++ b/src/data/layers/trees.tsx @@ -422,7 +422,7 @@ const layer = createLayer(id, function (this: BaseLayer) { const lastAutoPlantedAmount = ref(0); setInterval(() => watch(computedAutoPlantingAmount, planted => { lastAutoPlantedAmount.value = planted; - }),0); + }), 0); const logGain = createSequentialModifier(() => [ createMultiplicativeModifier(() => ({