some new content

This commit is contained in:
someoneWasTaken94 2022-12-24 02:12:28 +00:00
parent 529eabbcd0
commit b9f304b656
6 changed files with 418 additions and 17 deletions

File diff suppressed because one or more lines are too long

View file

@ -28,6 +28,7 @@ import { render, renderGrid } from "util/vue";
import { computed, ComputedRef, ref, unref } from "vue";
import dyes from "./dyes";
import elves, { ElfBuyable } from "./elves";
import factory from "./factory";
import management from "./management";
import paper from "./paper";
import plastic from "./plastic";
@ -587,7 +588,36 @@ const layer = createLayer(id, function (this: BaseLayer) {
Decimal.add(plasticBoxesBuyable.amount.value, plasticBoxesBuyable.freeLevels.value)
)
})) as BoxesBuyable;
const presentBuyable = createBuyable(() => ({
display: {
title: "Carry presents in boxes",
description: jsx(() => (
<>
Use boxes to carry presents, boosting its gain
<br />
<br />
<div>Amount: {formatWhole(presentBuyable.amount.value)} boxes</div>
</>
)),
effectDisplay: jsx(() => (
<>{format(Decimal.div(presentBuyable.amount.value, 10).add(1).pow(2))}x</>
)),
showAmount: false
},
resource: noPersist(boxes),
cost() {
return Decimal.pow(2, presentBuyable.amount.value).mul(1e87);
},
inverseCost(x: DecimalSource) {
const amt = Decimal.div(x, 1e87).log2();
return Decimal.isNaN(amt) ? Decimal.dZero : amt.floor().max(0);
},
freeLevels: computed(() => 0),
totalAmount: computed(() => presentBuyable.amount.value),
visibility: () => showIf(factory.upgrades[3][3].bought.value)
})) as BoxesBuyable;
const buyables2 = { oreBoxesBuyable, metalBoxesBuyable, plasticBoxesBuyable };
const buyables3 = { presentBuyable };
globalBus.on("update", diff => {
if (Decimal.lt(main.day.value, day)) {
return;
@ -677,6 +707,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
row3Upgrades,
buyables,
buyables2,
buyables3,
minWidth: 700,
generalTabCollapsed,
display: jsx(() => (
@ -703,7 +734,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
Object.values(row3Upgrades)
)}
<Spacer />
{renderGrid(Object.values(buyables), Object.values(buyables2))}
{renderGrid(
Object.values(buyables),
Object.values(buyables2),
Object.values(buyables3)
)}
</>
)),
minimizedDisplay: jsx(() => (

View file

@ -876,7 +876,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
name: "Bell",
description:
"Bell will automatically purchase all box buyables you can afford, without actually spending any boxes.",
buyable: [...Object.values(boxes.buyables), ...Object.values(boxes.buyables2)],
buyable: [
...Object.values(boxes.buyables),
...Object.values(boxes.buyables2),
...Object.values(boxes.buyables3)
],
cooldownModifier: boxCooldown,
visibility: () => showIf(plastic.elfUpgrades.boxElf.bought.value)
});

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="50"
height="50"
viewBox="0 0 13.229166 13.229167"
version="1.1"
id="svg5"
sodipodi:docname="advent.svg"
inkscape:version="1.2.1 (9c6d41e4, 2022-07-14)"
inkscape:export-filename="advent/boxmaker.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xml:space="preserve"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="3.0909964"
inkscape:cx="3.0734426"
inkscape:cy="59.527731"
inkscape:window-width="1309"
inkscape:window-height="804"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="0"
inkscape:current-layer="layer1" /><defs
id="defs2" /><g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"><rect
style="fill:#e6e6e6;fill-opacity:1;stroke:#838390;stroke-width:0.764057;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:6;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="rect28545-6"
width="12.46511"
height="12.46511"
x="0.38202849"
y="0.38202882"
rx="1.246511" /><image
width="11.600364"
height="11.600364"
preserveAspectRatio="none"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABHNCSVQICAgIfAhkiAAADmZJREFU
eJzt3VtsHFcZB/B/bG9sbzxjx04czzgmTVIn2dlce0ENhKIkEpUQfQAJRHkp4gEBDyBAXAS8FIHo
CxeJBxAPiL4gcXsBxKUiqYCWVvSWNNnZpG6SpolnHCd2vbO+Zn3hYXGbuN6z38zO2R03/5+0ause
z3673v+enZkz3wJERERERERERERERERERERERERERERERERERERERERERERERGuZ3egCwmhudAF0
R3kfgByAjwHYBWA9gKsASo0siigpvgZgaZXbSQDfRjlAFBOr0QVQaH/F6gG59TYG4HcAPg9gd2PK
XJvaAXwEwA8BnEL5yXx/QyuiMJoB3ET1gKy8vQrg5wA+AWBT3atOuMMAvgXgBFZ/8r7euNIopA8h
fDhWuz0L4PsAjgNYV9dHkAC7AHwOwG8B3ED1J+tvjSmTIvgB4gnIrbcZAH8G8FUAB+v3UOqnB8DH
AfwMwHmEf4JKAFrqXjVF8V/EH5CVt6sAngDwaQADdXlUGhwD8D0A/0E8T8pD9S2fIuiF/nCsdjsN
4McAHgaQ1v4oIzoA4CsA/gRgGvE/CY/X76FQRI+gMQFZeTsJ4Dto8OHkrQAeBfArAFeg/0E/X5dH
RbX4BRofjpW3cZQPJ38Bmg8nLx9+/RHePvxa79sWnQ+QanYB1f+Gi4IxOm9DKB9OfhSAUesDPozy
mc9Kh1/rfftUrQ+ItMmg8a+PsLfPLhcvPQK0C+Xjzkf//89u4e/Vy1EAv250EbSq48Jxoz/55IHF
l9+YGMr7xVTOC/ZMzc13aa2ssieX/6VSQDpQXlB2GOUHOFiHoipZQvUTQtI/AtXfUcmgB3b0XNiY
Xn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gD0BUQk7wW4d5t0nyuczUYr+sw2jARaL4kmhdLCIk5fKeD0lXLzm43pFBzbLAem38TGtLwb6fXi
HLyJGenwRAekiHLXxaofoVwNATnnF5HzAgyNTjIcCfPmdAnPvDaGZ14rHz8Z6G6HY5lw7PIMk2qu
/Ik/xBfDhu6eqKJryfdJCAKSi+Fz6tXxGeS8Aly/CNcPcHNeugqaGu3K+AyujM/g77ny8rmMZSJr
GXBsEzt7b18x5Hri10rkaz9WozMgj1Ub5E/MYLQ4h16jVbzhiekSzg4HyPsBXL+A8SltV/FSneX9
8t8VLw0j3dqCrGUgY5s4NNCF5y5Kj9pHv3pwNevi3NgKExB+8xBRjLKI0CCuEh2HeZfFOtURCcXa
f01nQGKd6ogagTMIkYLOfRBAeF3GE5+5X3MZtNY9+ktR4xwg5te0zhmEaM1jQIgUGBAiBQaESIEB
IVJgQIgUGBAiBQaESIEBIVJgQIgUGBAiBQaESIEBIVJgQIgUGBAiBQaESIEBIVJgQIgUGBAiBQaE
SIEBIVJgQIgUGBAiBQaESIEBIVJgQIgUGBAiBQaESIEBIVJgQIgUGBAiBQaESIEBIVJgQIgUGBAi
BQaESIEBIVJgQIgUGBAiBQaESIEBIVJgQIgUGBAiBQaESIEBIVJgQIgUGBAiBQaESIEBIVJgQIgU
GBAiBQaESIEBIVJgQIgUGBAiBQaESIEBIVJgQIgUGBAiBQaESIEBIVJgQIgUGBAiBQaESIEBIVJg
QIgUGBAiBQaESIEBIVJYp3n7S5q3T7RSrK9pziBECgwIkQIDQqTAgBApMCBECgwIkQIDQqTAgBAp
MCBEREREREREREREREREREREREREREREREREREREdIf7Hyed5/3C5bPrAAAAAElFTkSuQmCC
"
id="image727"
x="0.74370372"
y="0.35876995" /></g></svg>

After

Width:  |  Height:  |  Size: 6.9 KiB

View file

@ -40,9 +40,11 @@ import _plastic from "../symbols/plastic.png";
import boxes from "./boxes";
import coal from "./coal";
import dyes from "./dyes";
import _box from "../symbols/cardboardBox.png";
import _bear from "./factory-components/bear.svg";
import _bearMaker from "./factory-components/bearmaker.svg";
import _block from "./factory-components/block.svg";
import _boxMaker from "./factory-components/boxmaker.svg";
import _blockMaker from "./factory-components/blockmaker.svg";
import _bucket from "./factory-components/bucket.svg";
import _bucketMaker from "./factory-components/bucketmaker.svg";
@ -75,6 +77,7 @@ import _truck from "./factory-components/truck.svg";
import _truckMaker from "./factory-components/truckmaker.svg";
import _wheel from "./factory-components/wheel.svg";
import _wheelMaker from "./factory-components/wheelmaker.svg";
import _present from "./factory-components/presentmaker.svg";
import Factory from "./Factory.vue";
import metal from "./metal";
import oil from "./oil";
@ -94,6 +97,7 @@ const presentsDay = 20;
const toyGoal = 750;
const advancedToyGoal = 1500;
const presentsGoal = 8e9;
// 20x20 block size
// TODO: unhardcode stuff
@ -138,6 +142,16 @@ const factory = createLayer(id, () => {
const bears = createResource<DecimalSource>(0, "teddy bears");
const bucketAndShovels = createResource<DecimalSource>(0, "shovel and pails");
const consoles = createResource<DecimalSource>(0, "consoles");
const presents = createResource<DecimalSource>(0, "presents");
const allToys = {
clothes: toys.clothes,
woodenBlocks: toys.woodenBlocks,
trucks: toys.trucks,
bears,
bucketAndShovels,
consoles
};
function getRelativeCoords(e: MouseEvent) {
const rect = (e.target as HTMLElement).getBoundingClientRect();
@ -172,6 +186,11 @@ const factory = createLayer(id, () => {
multiplier: 1.4,
description: "6000 toys",
enabled: toys.milestones.milestone6.earned
})),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.log10(trees.logs.value).div(100).add(1),
description: "Burn some logs",
enabled: betterLighting.bought
}))
]) as WithRequired<Modifier, "revert" | "description">;
const computedEnergy = computed(() => energy.apply(0));
@ -227,9 +246,27 @@ const factory = createLayer(id, () => {
addend: expandFactory.amount,
description: "Expand Factory",
enabled: () => Decimal.gt(expandFactory.amount.value, 0)
})),
createAdditiveModifier(() => ({
addend: 5,
description: "Factory eXPerience",
enabled: betterFactory.bought
}))
]);
const computedFactorySize = computed(() => new Decimal(factorySize.apply(7)).toNumber());
const presentMultipliers = createSequentialModifier(() => [
createMultiplicativeModifier(() => ({
multiplier: computedToyMultiplier,
description: "Tickspeed overflow",
enabled: () => computedToyMultiplier.value.gt(1)
})),
createMultiplicativeModifier(() => ({
multiplier: Decimal.div(boxes.buyables3.presentBuyable.amount.value, 10).add(1).pow(2),
description: "Carry boxes in... presents?",
enabled: carryPresents.bought
}))
]);
const computedPresentMultipliers = computed(() => presentMultipliers.apply(1));
const energyBar = createBar(() => ({
width: 680,
@ -317,6 +354,10 @@ const factory = createLayer(id, () => {
return str;
}
// this keeps track of which toy the present factory has consumed
// it cycles around, so each toy is used evenly
let toysIndex = 0;
const FACTORY_COMPONENTS = {
cursor: {
imageSrc: _cursor,
@ -459,6 +500,26 @@ const factory = createLayer(id, () => {
plank: {
amount: computed(() => (upgrades[0][0].bought.value ? 2 : 1))
}
},
visible: main.days[presentsDay - 1].opened
} as FactoryComponentDeclaration,
boxMaker: {
imageSrc: _boxMaker,
key: "ctrl+8",
name: "Box Maker",
type: "processor",
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.boxMaker)),
energyCost: 3,
tick: 1,
inputs: {
plank: {
amount: 2
}
},
outputs: {
box: {
amount: 2
}
}
} as FactoryComponentDeclaration,
thread: {
@ -755,6 +816,57 @@ const factory = createLayer(id, () => {
}
},
visible: main.days[advancedDay - 1].opened
} as FactoryComponentDeclaration,
present: {
imageSrc: _present,
type: "processor",
// idk about this
key: "ctrl+7",
name: "Present Wrapper",
description: computed(
() =>
`Takes in 4 dye, 4 plastic, 1 cloth, 2 boxes, and ${formatWhole(
computedToyMultiplier.value
)} toys of any type (from storage) to produce ${formatWhole(
computedPresentMultipliers.value
)} presents every tick.`
),
tick: 1,
energyCost: 20,
inputs: {
dye: {
amount: 4
},
plastic: {
amount: 4
},
cloth: {
amount: 1
},
box: {
amount: 2
}
},
canProduce: computed(() => {
return Object.values(allToys).some(i =>
Decimal.gte(i.value, computedToyMultiplier.value)
);
}),
onProduce(times, stock) {
const value = Object.values(allToys);
while (times > 0) {
while (Decimal.lt(value[toysIndex].value, computedToyMultiplier.value)) {
toysIndex = (toysIndex + 1) % value.length;
}
const toyToPick = Object.values(allToys)[toysIndex];
toysIndex = (toysIndex + 1) % value.length;
toyToPick.value = Decimal.sub(toyToPick.value, computedToyMultiplier.value);
times--;
presents.value = Decimal.add(presents.value, computedPresentMultipliers.value);
}
},
visible: main.days[presentsDay - 1].opened
} as FactoryComponentDeclaration
} as Record<string, FactoryComponentDeclaration>;
const RESOURCES = {
@ -784,6 +896,10 @@ const factory = createLayer(id, () => {
name: "Planks",
imageSrc: _plank
},
box: {
name: "Boxes",
imageSrc: _box
},
thread: {
name: "Thread",
imageSrc: _thread
@ -903,7 +1019,7 @@ const factory = createLayer(id, () => {
outputs?: Stock;
/** on produce, do something */
onProduce?: (times: number) => void;
onProduce?: (times: number, stock: Stock | undefined) => void;
/** can it produce? (in addtion to the stock check) */
canProduce?: ComputedRef<boolean>;
}
@ -956,10 +1072,21 @@ const factory = createLayer(id, () => {
// trained elves
const costCheapener = createSequentialModifier(() => [
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.add(presents.value, 1).log10().add(1),
description: "Excitment Upgrade",
enabled: excitmentUpgrade.bought
}))
]);
const computedCostCheapeners = computed(() => costCheapener.apply(1));
const clothesBuyable = createBuyable(() => ({
resource: toys.clothes,
cost() {
return Decimal.pow(2, Decimal.add(this.amount.value, 5));
return Decimal.pow(2, Decimal.add(this.amount.value, 5)).div(
computedCostCheapeners.value
);
},
display: {
title: "Train elves to make clothes",
@ -970,7 +1097,9 @@ const factory = createLayer(id, () => {
const blocksBuyable = createBuyable(() => ({
resource: toys.woodenBlocks,
cost() {
return Decimal.pow(2, Decimal.add(this.amount.value, 5));
return Decimal.pow(2, Decimal.add(this.amount.value, 5)).div(
computedCostCheapeners.value
);
},
display: {
title: "Train elves to make wooden blocks",
@ -981,7 +1110,9 @@ const factory = createLayer(id, () => {
const trucksBuyable = createBuyable(() => ({
resource: toys.trucks,
cost() {
return Decimal.pow(2, Decimal.add(this.amount.value, 5));
return Decimal.pow(2, Decimal.add(this.amount.value, 5)).div(
computedCostCheapeners.value
);
},
display: {
title: "Train elves to make toy trucks",
@ -992,7 +1123,9 @@ const factory = createLayer(id, () => {
const bearsBuyable = createBuyable(() => ({
resource: noPersist(bears),
cost() {
return Decimal.pow(2, Decimal.add(this.amount.value, 5));
return Decimal.pow(2, Decimal.add(this.amount.value, 5)).div(
computedCostCheapeners.value
);
},
display: {
title: "Train elves to make bears",
@ -1004,7 +1137,9 @@ const factory = createLayer(id, () => {
const bucketBuyable = createBuyable(() => ({
resource: noPersist(bucketAndShovels),
cost() {
return Decimal.pow(2, Decimal.add(this.amount.value, 5));
return Decimal.pow(2, Decimal.add(this.amount.value, 5)).div(
computedCostCheapeners.value
);
},
display: {
title: "Train elves to make shovel and pails",
@ -1016,7 +1151,9 @@ const factory = createLayer(id, () => {
const consolesBuyable = createBuyable(() => ({
resource: noPersist(consoles),
cost() {
return Decimal.pow(2, Decimal.add(this.amount.value, 5));
return Decimal.pow(2, Decimal.add(this.amount.value, 5)).div(
computedCostCheapeners.value
);
},
display: {
title: "Train elves to make consoles",
@ -1089,7 +1226,63 @@ const factory = createLayer(id, () => {
style: "width: 200px",
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
})) as GenericBuyable;
const factoryBuyables = { expandFactory, oilFuel, carryToys };
const betterFactory = createUpgrade(() => ({
resource: noPersist(presents),
cost: 100,
display: {
title: "Factory eXPerience",
description: "Factory size is increased by 5."
},
visibility: () => showIf(main.days[presentsDay - 1].opened.value)
}));
const betterLighting = createUpgrade(() => ({
resource: noPersist(presents),
cost: 300,
display: {
title: "Burn some logs",
description: "More energy needed? Let's burn some logs! Logs boosts maximum energy.",
effectDisplay: jsx(() => (
<>x{format(Decimal.log10(trees.logs.value).div(100).add(1))}</>
))
},
visibility: () => showIf(betterFactory.bought.value)
}));
const excitmentUpgrade = createUpgrade(() => ({
resource: noPersist(presents),
cost: 1000,
display: {
title: "Faster Elf Training",
description:
"Apparently elves like presents. Let's use it to train them to work on the factory faster! Presents divides the requirement for factory elf training.",
effectDisplay: jsx(() => <>/{format(Decimal.add(presents.value, 1).log10().add(1))}</>)
},
visibility: () => showIf(betterLighting.bought.value)
}));
const carryPresents = createUpgrade(() => ({
resource: noPersist(presents),
cost: 5000,
display: {
title: "Carrying more stuff in boxes",
description:
"Boxes seem really useful for carrying stuff. Why don't we use them to carry presents as well? Unlocks 2 new rebuyables (one of them is in the boxes layer)."
}
}));
const carryBoxes = createBuyable(() => ({
resource: noPersist(presents),
cost() {
return Decimal.add(carryBoxes.amount.value, 1).pow(1.5)
.mul(Decimal.pow(2, carryBoxes.amount.value))
.mul(1000);
},
display: {
title: "Carry boxes in... presents?",
description:
"Presents are made out of boxes, so shouldn't they be able to hold boxes as well? Apparently it makes the boxes more durable. Each level multiplies boxes gain by 1.5.",
effectDisplay: jsx(() => <>x{format(Decimal.pow(1.5, carryBoxes.amount.value))}</>)
}
})) as GenericBuyable;
const factoryBuyables = { expandFactory, oilFuel, carryToys, carryBoxes };
const upgrades = [
[
createUpgrade(() => ({
@ -1205,7 +1398,8 @@ const factory = createLayer(id, () => {
},
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
}))
]
],
[betterFactory, betterLighting, excitmentUpgrade, carryPresents]
];
// pixi
@ -1378,7 +1572,7 @@ const factory = createLayer(id, () => {
if (data.ticksDone >= factoryData.tick) {
if (compData.canProduce.value) {
const cyclesDone = Math.floor(data.ticksDone / factoryData.tick);
factoryData.onProduce?.(cyclesDone);
factoryData.onProduce?.(cyclesDone, factoryData.inputs);
if (factoryData.inputs !== undefined) {
if (data.inputStock === undefined) data.inputStock = {};
for (const [key, val] of Object.entries(factoryData.inputs)) {
@ -1825,6 +2019,20 @@ const factory = createLayer(id, () => {
function togglePaused() {
paused.value = !paused.value;
}
function handleDrag(drag: DragEvent, name: FactoryCompNames) {
drag.dataTransfer!.setData("name", name);
}
function handleDrop(drag: DragEvent) {
drag.preventDefault();
const { tx, ty } = spriteContainer.localTransform;
let { x, y } = getRelativeCoords(drag);
x = roundDownTo(x - tx, blockSize) / blockSize;
y = roundDownTo(y - ty, blockSize) / blockSize;
const name = drag.dataTransfer!.getData("name");
if (components.value[x + "x" + y] == null) {
addFactoryComp(x, y, { type: name });
}
}
// ------------------------------------------------------------------------------- Tabs
@ -1850,6 +2058,8 @@ const factory = createLayer(id, () => {
src={item.imageSrc}
class={{ selected: compSelected.value === key }}
onClick={() => onCompClick(key)}
draggable="true"
onDragstart={drag => handleDrag(drag, key)}
/>
{item.extraImage == null ? null : (
<img src={item.extraImage} class="producedItem" />
@ -2002,6 +2212,8 @@ const factory = createLayer(id, () => {
? `Reach ${format(
advancedToyGoal
)} for each toy to complete the day`
: main.day.value === presentsDay
? `Reach ${format(presentsGoal)} presents`
: `${name} Complete!`}{" "}
-{" "}
<button
@ -2022,7 +2234,7 @@ const factory = createLayer(id, () => {
color="cornflowerblue"
/>
<Toy resource={toys.trucks} image={_truck} color="cadetblue" />
{main.days[advancedDay - 1].opened.value ? (
{main.days[advancedDay - 1].opened.value === true ? (
<>
<Toy resource={bears} image={_bear} color="teal" />
<Toy
@ -2037,6 +2249,11 @@ const factory = createLayer(id, () => {
/>
</>
) : null}
{main.days[presentsDay - 1].opened.value === true ? (
<>
<Toy resource={presents} image={_present} color="green" />
</>
) : undefined}
</Row>
<Spacer />
<MainDisplay
@ -2050,6 +2267,7 @@ const factory = createLayer(id, () => {
<Spacer />
{renderRow(...Object.values(factoryBuyables))}
<Spacer />
<Spacer />
{renderGrid(...(upgrades as VueFeature[][]))}
</>
))
@ -2069,6 +2287,8 @@ const factory = createLayer(id, () => {
onPointerenter={onFactoryMouseEnter}
onPointerleave={onFactoryMouseLeave}
onContextmenu={(e: MouseEvent) => e.preventDefault()}
onDrop={(e: DragEvent) => handleDrop(e)}
onDragover={(e: DragEvent) => e.preventDefault()}
/>
{componentsList()}
{hoveredComponent()}
@ -2095,6 +2315,11 @@ const factory = createLayer(id, () => {
modifier: tickRate,
base: 1,
unit: "/s"
},
{
title: "Present Multipliers",
modifier: presentMultipliers,
base: 1
}
]);
const showModifiersModal = ref(false);
@ -2111,7 +2336,10 @@ const factory = createLayer(id, () => {
<>
<br />
Note: the actual tick rate is capped at 5 TPS, but you'll gain extra
toys based on excessive tick rate as a compensation.
toys based on excessive tick rate as compensation.{" "}
{main.days[presentsDay - 1].opened.value === true
? "Present maker's toy requirement and production is also affected by tick overflow."
: undefined}
</>
) : (
""
@ -2139,6 +2367,8 @@ const factory = createLayer(id, () => {
.map(r => Decimal.div(r.value, advancedToyGoal).clampMax(1))
.reduce(Decimal.add, Decimal.dZero)
.div(6)
: main.day.value === presentsDay
? Decimal.div(presents.value, presentsGoal).clampMax(1)
: 1,
display: jsx(() =>
main.day.value === day ? (
@ -2164,6 +2394,10 @@ const factory = createLayer(id, () => {
}{" "}
/ 6
</>
) : main.day.value === presentsDay ? (
<>
{formatWhole(presents.value)}/{formatWhole(presentsGoal)} presents
</>
) : (
""
)
@ -2190,6 +2424,8 @@ const factory = createLayer(id, () => {
].filter(d => Decimal.gte(d.value, advancedToyGoal)).length >= 6
) {
main.completeDay();
} else if (main.day.value === presentsDay && Decimal.gte(presents.value, presentsGoal)) {
main.completeDay();
}
});
@ -2206,8 +2442,10 @@ const factory = createLayer(id, () => {
bears,
bucketAndShovels,
consoles,
presents,
tabs,
factoryBuyables,
carryBoxes,
generalTabCollapsed,
hotkeys,
upgrades,
@ -2219,4 +2457,4 @@ const factory = createLayer(id, () => {
))
};
});
export default factory;
export default factory;

View file

@ -464,9 +464,9 @@ export const main = createLayer("main", function (this: BaseLayer) {
createDay(() => ({
day: 20,
shouldNotify: false,
layer: null, // "presents"
layer: "factory", // "presents"
symbol: wrappingPaperSymbol,
story: "",
story: "Santa comes by again, and tells you that just toys may not be appealing enough. He tells you that you should probably wrap them in some wrapping paper so that it's more of a surprise. You try to argue that you've already done too much for him and deserve a day off, but Santa argues that it's for the benefit of everyone and that you'll get your vacation soon. Oh well, time to get back to the factory and expand it even more. Here we go again!",
completedStory: "",
masteredStory: ""
})),