Merge branch 'main' into day-20-factory

This commit is contained in:
thepaperpilot 2022-12-22 22:57:55 -06:00
commit 9e42512908
8 changed files with 279 additions and 136 deletions

View file

@ -36,6 +36,7 @@ import oil from "./oil";
import paper from "./paper"; import paper from "./paper";
import trees from "./trees"; import trees from "./trees";
import toys from "./toys"; import toys from "./toys";
import factory from "./factory";
interface Dye { interface Dye {
name: string; name: string;
@ -56,7 +57,7 @@ type DyeUpg =
| "blueDyeUpg2" | "blueDyeUpg2"
| "coalUpg"; | "coalUpg";
export type enumColor = "red" | "green" | "blue" | "yellow" | "purple" | "orange" | "black"; export type enumColor = "red" | "green" | "blue" | "yellow" | "purple" | "orange" | "black" | "white";
const id = "dyes"; const id = "dyes";
const day = 11; const day = 11;
@ -214,6 +215,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
case "yellow": case "yellow":
case "blue": case "blue":
case "black": case "black":
case "white":
dyeBook = paper.books.primaryDyeBook; dyeBook = paper.books.primaryDyeBook;
break; break;
case "orange": case "orange":
@ -520,6 +522,31 @@ const layer = createLayer(id, function (this: BaseLayer) {
dyesToReset: [], dyesToReset: [],
visibility: () => showIf(toys.milestones.milestone2.earned.value) visibility: () => showIf(toys.milestones.milestone2.earned.value)
}), }),
white: createDye({
name: "White Dye",
color: "white",
key: "q",
costs: () => [
{
base: "1e60",
root: 5,
res: trees.logs
},
{
base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "1e17" : "2e17")),
root: 2,
res: oil.oil
}
],
listedBoosts: [
{
visible: true,
desc: computed(() => `*${format(boosts.white1.value)} plastic gain.`)
}
],
dyesToReset: [],
visibility: () => showIf(factory.upgrades[2][2].bought.value)
}),
orange: createDye({ orange: createDye({
name: "Orange Dye", name: "Orange Dye",
color: "orange", color: "orange",
@ -702,6 +729,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
Decimal.pow(2, Decimal.add(dyes.black.amount.value, 1).log2().sqrt()) Decimal.pow(2, Decimal.add(dyes.black.amount.value, 1).log2().sqrt())
.pow(upgrades.coalUpg.bought.value ? 1.2 : 1) .pow(upgrades.coalUpg.bought.value ? 1.2 : 1)
.pow(management.elfTraining.clothElfTraining.milestones[3].earned.value ? 1.1 : 1) .pow(management.elfTraining.clothElfTraining.milestones[3].earned.value ? 1.1 : 1)
),
white1: computed(() =>
Decimal.pow(2, Decimal.add(dyes.white.amount.value, 1).log2().sqrt())
.pow(upgrades.coalUpg.bought.value ? 1.2 : 1)
.pow(management.elfTraining.clothElfTraining.milestones[3].earned.value ? 1.1 : 1)
) )
}; };
@ -726,6 +758,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
modifier: dyes.black.toGenerate, modifier: dyes.black.toGenerate,
base: 0 base: 0
}, },
{
title: "White Dye Creation",
modifier: dyes.white.toGenerate,
base: 0
},
{ {
title: "Orange Dye Creation", title: "Orange Dye Creation",
modifier: dyes.orange.toGenerate, modifier: dyes.orange.toGenerate,
@ -956,8 +993,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
</> </>
) : null} ) : null}
<div style="width: 620px"> <div style="width: 620px">
{renderRow(dyes.black.display)} {renderRow(dyes.black.display, dyes.white.display)}
{renderRow(dyes.black.buyable)} {renderRow(dyes.black.buyable, dyes.white.buyable)}
<Spacer /> <Spacer />
{renderRow(dyes.red.display, dyes.yellow.display, dyes.blue.display)} {renderRow(dyes.red.display, dyes.yellow.display, dyes.blue.display)}
{renderRow(dyes.red.buyable, dyes.yellow.buyable, dyes.blue.buyable)} {renderRow(dyes.red.buyable, dyes.yellow.buyable, dyes.blue.buyable)}

View file

@ -18,17 +18,18 @@ import { createResource, Resource } from "features/resources/resource";
import { createTab } from "features/tabs/tab"; import { createTab } from "features/tabs/tab";
import { createTabFamily } from "features/tabs/tabFamily"; import { createTabFamily } from "features/tabs/tabFamily";
import Tooltip from "features/tooltips/Tooltip.vue"; import Tooltip from "features/tooltips/Tooltip.vue";
import { createUpgrade } from "features/upgrades/upgrade";
import { globalBus } from "game/events"; import { globalBus } from "game/events";
import { createLayer } from "game/layers"; import { createLayer } from "game/layers";
import { createUpgrade, GenericUpgrade } from "features/upgrades/upgrade";
import { import {
createAdditiveModifier, createAdditiveModifier,
createMultiplicativeModifier, createMultiplicativeModifier,
createSequentialModifier createSequentialModifier,
Modifier
} from "game/modifiers"; } from "game/modifiers";
import { noPersist, Persistent, persistent, State } from "game/persistence"; import { noPersist, Persistent, persistent, State } from "game/persistence";
import Decimal, { DecimalSource, format, formatWhole } from "util/bignum"; import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
import { Direction } from "util/common"; import { Direction, WithRequired } from "util/common";
import { ProcessedComputable } from "util/computed"; import { ProcessedComputable } from "util/computed";
import { render, renderGrid, renderRow, VueFeature } from "util/vue"; import { render, renderGrid, renderRow, VueFeature } from "util/vue";
import { computed, ComputedRef, reactive, ref, shallowRef, unref, watchEffect } from "vue"; import { computed, ComputedRef, reactive, ref, shallowRef, unref, watchEffect } from "vue";
@ -38,22 +39,23 @@ import _metal from "../symbols/metal.png";
import _plastic from "../symbols/plastic.png"; import _plastic from "../symbols/plastic.png";
import boxes from "./boxes"; import boxes from "./boxes";
import coal from "./coal"; import coal from "./coal";
import dyes from "./dyes";
import _bear from "./factory-components/bear.svg"; import _bear from "./factory-components/bear.svg";
import _bearMaker from "./factory-components/bearmaker.svg"; import _bearMaker from "./factory-components/bearmaker.svg";
import _stuffing from "./factory-components/stuffing.svg";
import _console from "./factory-components/console.svg";
import _circuitBoard from "./factory-components/circuit.svg";
import _stuffingMaker from "./factory-components/stuffingmaker.svg";
import _consoleMaker from "./factory-components/consolemaker.svg";
import _circuitBoardMaker from "./factory-components/circuitmaker.svg";
import _block from "./factory-components/block.svg"; import _block from "./factory-components/block.svg";
import _blockMaker from "./factory-components/blockmaker.svg"; import _blockMaker from "./factory-components/blockmaker.svg";
import _bucket from "./factory-components/bucket.svg"; import _bucket from "./factory-components/bucket.svg";
import _bucketMaker from "./factory-components/bucketmaker.svg"; import _bucketMaker from "./factory-components/bucketmaker.svg";
import _bucketShovel from "./factory-components/bucketshovel.svg"; import _bucketShovel from "./factory-components/bucketshovel.svg";
import _bucketShovelMaker from "./factory-components/bucketshovelmaker.svg"; import _bucketShovelMaker from "./factory-components/bucketshovelmaker.svg";
import _button from "./factory-components/button.svg";
import _buttonMaker from "./factory-components/buttonmaker.svg";
import _circuitBoard from "./factory-components/circuit.svg";
import _circuitBoardMaker from "./factory-components/circuitmaker.svg";
import _clothes from "./factory-components/clothes.svg"; import _clothes from "./factory-components/clothes.svg";
import _clothesMaker from "./factory-components/clothesmaker.svg"; import _clothesMaker from "./factory-components/clothesmaker.svg";
import _console from "./factory-components/console.svg";
import _consoleMaker from "./factory-components/consolemaker.svg";
import _conveyor from "./factory-components/conveyor.png"; import _conveyor from "./factory-components/conveyor.png";
import _cursor from "./factory-components/cursor.svg"; import _cursor from "./factory-components/cursor.svg";
import _delete from "./factory-components/delete.svg"; import _delete from "./factory-components/delete.svg";
@ -63,10 +65,10 @@ import _rotateLeft from "./factory-components/rotateLeft.svg";
import _rotateRight from "./factory-components/rotateRight.svg"; import _rotateRight from "./factory-components/rotateRight.svg";
import _plankMaker from "./factory-components/sawmill.svg"; import _plankMaker from "./factory-components/sawmill.svg";
import _shed from "./factory-components/shed.svg"; import _shed from "./factory-components/shed.svg";
import _button from "./factory-components/button.svg";
import _shovel from "./factory-components/shovel.svg"; import _shovel from "./factory-components/shovel.svg";
import _shovelMaker from "./factory-components/shovelmaker.svg"; import _shovelMaker from "./factory-components/shovelmaker.svg";
import _buttonMaker from "./factory-components/buttonmaker.svg"; import _stuffing from "./factory-components/stuffing.svg";
import _stuffingMaker from "./factory-components/stuffingmaker.svg";
import _thread from "./factory-components/thread.svg"; import _thread from "./factory-components/thread.svg";
import _threadMaker from "./factory-components/threadmaker.svg"; import _threadMaker from "./factory-components/threadmaker.svg";
import _truck from "./factory-components/truck.svg"; import _truck from "./factory-components/truck.svg";
@ -74,16 +76,15 @@ import _truckMaker from "./factory-components/truckmaker.svg";
import _wheel from "./factory-components/wheel.svg"; import _wheel from "./factory-components/wheel.svg";
import _wheelMaker from "./factory-components/wheelmaker.svg"; import _wheelMaker from "./factory-components/wheelmaker.svg";
import Factory from "./Factory.vue"; import Factory from "./Factory.vue";
import metal from "./metal";
import oil from "./oil"; import oil from "./oil";
import paper from "./paper";
import plastic from "./plastic";
import "./styles/factory.css"; import "./styles/factory.css";
import Toy from "./Toy.vue"; import Toy from "./Toy.vue";
import toys from "./toys"; import toys from "./toys";
import trees from "./trees"; import trees from "./trees";
import workshop from "./workshop"; import workshop from "./workshop";
import paper from "./paper";
import metal from "./metal";
import dyes from "./dyes";
import plastic from "./plastic";
const id = "factory"; const id = "factory";
@ -92,7 +93,7 @@ const advancedDay = 19;
const presentsDay = 20; const presentsDay = 20;
const toyGoal = 750; const toyGoal = 750;
const advancedToyGoal = 2000; const advancedToyGoal = 1500;
// 20x20 block size // 20x20 block size
// TODO: unhardcode stuff // TODO: unhardcode stuff
@ -100,13 +101,6 @@ const advancedToyGoal = 2000;
function roundDownTo(num: number, multiple: number) { function roundDownTo(num: number, multiple: number) {
return Math.floor((num + multiple / 2) / multiple) * multiple; return Math.floor((num + multiple / 2) / multiple) * multiple;
} }
function getRelativeCoords(e: MouseEvent) {
const rect = (e.target as HTMLElement).getBoundingClientRect();
return {
x: e.clientX - rect.left,
y: e.clientY - rect.top
};
}
function rotateDir(dir: Direction, relative = Direction.Right) { function rotateDir(dir: Direction, relative = Direction.Right) {
const directions = [Direction.Up, Direction.Right, Direction.Down, Direction.Left]; const directions = [Direction.Up, Direction.Right, Direction.Down, Direction.Left];
let index = directions.indexOf(dir); let index = directions.indexOf(dir);
@ -145,6 +139,15 @@ const factory = createLayer(id, () => {
const bucketAndShovels = createResource<DecimalSource>(0, "shovel and pails"); const bucketAndShovels = createResource<DecimalSource>(0, "shovel and pails");
const consoles = createResource<DecimalSource>(0, "consoles"); const consoles = createResource<DecimalSource>(0, "consoles");
function getRelativeCoords(e: MouseEvent) {
const rect = (e.target as HTMLElement).getBoundingClientRect();
const offset = computedFactorySize.value % 2 === 0 ? -blockSize / 2 : 0;
return {
x: e.clientX - rect.left + offset,
y: e.clientY - rect.top + offset
};
}
const energy = createSequentialModifier(() => [ const energy = createSequentialModifier(() => [
createAdditiveModifier(() => ({ createAdditiveModifier(() => ({
addend: () => Decimal.add(1, coal.coal.value).log10(), addend: () => Decimal.add(1, coal.coal.value).log10(),
@ -162,10 +165,15 @@ const factory = createLayer(id, () => {
})), })),
createMultiplicativeModifier(() => ({ createMultiplicativeModifier(() => ({
multiplier: 1.4, multiplier: 1.4,
description: "2000 toys", description: "1500 toys",
enabled: toys.milestones.milestone6.earned
})),
createMultiplicativeModifier(() => ({
multiplier: 1.4,
description: "6000 toys",
enabled: toys.milestones.milestone6.earned enabled: toys.milestones.milestone6.earned
})) }))
]); ]) as WithRequired<Modifier, "revert" | "description">;
const computedEnergy = computed(() => energy.apply(0)); const computedEnergy = computed(() => energy.apply(0));
const energyConsumption = computed(() => const energyConsumption = computed(() =>
Object.values(components.value) Object.values(components.value)
@ -189,6 +197,23 @@ const factory = createLayer(id, () => {
multiplier: energyEfficiency, multiplier: energyEfficiency,
description: "Energy Consumption", description: "Energy Consumption",
enabled: () => Decimal.gt(energyConsumption.value, computedEnergy.value) enabled: () => Decimal.gt(energyConsumption.value, computedEnergy.value)
})),
createMultiplicativeModifier(() => ({
multiplier: Decimal.add(paper.paper.value, 1).log10().div(100).add(1),
description: "News Ticker",
enabled: () => upgrades[0][1].bought.value
})),
createMultiplicativeModifier(() => ({
multiplier: Decimal.lt(energyEfficiency.value, 1)
? 1
: Decimal.sub(2, Decimal.div(energyConsumption.value, computedEnergy.value)),
description: "Brighter work rooms",
enabled: () => upgrades[2][1].bought.value
})),
createMultiplicativeModifier(() => ({
multiplier: 1.5,
description: "Carry ticks in boxes",
enabled: () => upgrades[2][3].bought.value
})) }))
]); ]);
const computedTickRate = computed(() => tickRate.apply(1)); const computedTickRate = computed(() => tickRate.apply(1));
@ -351,7 +376,7 @@ const factory = createLayer(id, () => {
tick: 1, tick: 1,
outputs: { outputs: {
dye: { dye: {
amount: 1 amount: computed(() => (upgrades[1][1].bought.value ? 4 : 1))
} }
} }
} as FactoryComponentDeclaration, } as FactoryComponentDeclaration,
@ -381,7 +406,7 @@ const factory = createLayer(id, () => {
tick: 1, tick: 1,
outputs: { outputs: {
plastic: { plastic: {
amount: 1 amount: computed(() => (upgrades[1][2].bought.value ? 4 : 1))
} }
} }
} as FactoryComponentDeclaration, } as FactoryComponentDeclaration,
@ -395,12 +420,12 @@ const factory = createLayer(id, () => {
tick: 1, tick: 1,
inputs: { inputs: {
wood: { wood: {
amount: 1 amount: computed(() => (upgrades[0][0].bought.value ? 2 : 1))
} }
}, },
outputs: { outputs: {
plank: { plank: {
amount: 1 amount: computed(() => (upgrades[0][0].bought.value ? 2 : 1))
} }
} }
} as FactoryComponentDeclaration, } as FactoryComponentDeclaration,
@ -522,7 +547,7 @@ const factory = createLayer(id, () => {
} }
}, },
outputs: { outputs: {
shovel: { bucket: {
amount: 1 amount: 1
} }
}, },
@ -566,7 +591,7 @@ const factory = createLayer(id, () => {
}, },
outputs: { outputs: {
block: { block: {
amount: 1, amount: computed(() => (upgrades[1][0].bought.value ? 3 : 1)),
resource: toys.woodenBlocks resource: toys.woodenBlocks
} }
} }
@ -645,7 +670,7 @@ const factory = createLayer(id, () => {
}, },
outputs: { outputs: {
bear: { bear: {
amount: 1, amount: computed(() => (upgrades[1][3].bought.value ? 2 : 1)),
resource: bears resource: bears
} }
}, },
@ -697,7 +722,7 @@ const factory = createLayer(id, () => {
}, },
outputs: { outputs: {
console: { console: {
amount: 1, amount: computed(() => (upgrades[1][3].bought.value ? 3 : 1)),
resource: consoles resource: consoles
} }
}, },
@ -1009,7 +1034,7 @@ const factory = createLayer(id, () => {
const oilFuel = createBuyable(() => ({ const oilFuel = createBuyable(() => ({
resource: oil.oil, resource: oil.oil,
cost() { cost() {
return Decimal.pow(10, this.amount.value).times(1e24); return Decimal.pow(10, this.amount.value).times(1e23);
}, },
display: { display: {
title: "Oil Fuel", title: "Oil Fuel",
@ -1037,73 +1062,128 @@ const factory = createLayer(id, () => {
visible: () => showIf(main.days[advancedDay - 1].opened.value) visible: () => showIf(main.days[advancedDay - 1].opened.value)
})) as GenericBuyable; })) as GenericBuyable;
const factoryBuyables = { expandFactory, oilFuel, carryToys }; const factoryBuyables = { expandFactory, oilFuel, carryToys };
const upgrades = [[createUpgrade(() => ({ const upgrades = [
resource: trees.logs, [
cost: () =>Decimal.pow(10, upgradeAmount.value).mul(1e80), createUpgrade(() => ({
display: { resource: trees.logs,
title: "Sawmill Efficiency", cost: () => Decimal.pow(5, upgradeAmount.value).mul(1e75),
description: "Metal increases sawmill consumption and production by *log(metal)/10" display: {
}, title: "Sawmill Efficiency",
visible: () => showIf(main.days[advancedDay - 1].opened.value) description:
})), "Double sawmill consumption and production and metal supplier efficiency"
createUpgrade(() => ({ },
resource: paper.paper, visible: () => showIf(main.days[advancedDay - 1].opened.value)
cost: () =>Decimal.pow(10, upgradeAmount.value).mul(1e94), })),
display: { createUpgrade(() => ({
title: "News Ticker", resource: paper.paper,
description: "Paper boosts tick speed" // formula: *1+log(x)/100 cost: () => Decimal.pow(5, upgradeAmount.value).mul(1e90),
}, display: {
visible: () => showIf(main.days[advancedDay - 1].opened.value) title: "News Ticker",
})), description: "Paper boosts tick speed"
createUpgrade(() => ({ },
resource: toys.trucks, visible: () => showIf(main.days[advancedDay - 1].opened.value)
cost: () =>Decimal.pow(10, upgradeAmount.value).mul(1000), })),
display: { createUpgrade(() => ({
title: "Haul wood in trucks", resource: toys.trucks,
description: "Trucks multiply wood gain" cost: () => Decimal.pow(1.2, upgradeAmount.value).mul(1000),
}, display: {
visible: () => showIf(main.days[advancedDay - 1].opened.value) title: "Haul wood in trucks",
})), description: "Trucks multiply wood gain"
createUpgrade(() => ({ },
resource: metal.metal, visible: () => showIf(main.days[advancedDay - 1].opened.value)
cost: () =>Decimal.pow(10, upgradeAmount.value).mul(1e55), })),
display: { createUpgrade(() => ({
title: "Diamond-tipped drills", resource: metal.metal,
description: "Drill power ^1.2" cost: () => Decimal.pow(3, upgradeAmount.value).mul(1e53),
}, display: {
visible: () => showIf(main.days[advancedDay - 1].opened.value) title: "Diamond-tipped drills",
}))], description: "Drill power ^1.2"
[createUpgrade(() => ({ },
resource: toys.woodenBlocks, visible: () => showIf(main.days[advancedDay - 1].opened.value)
cost: () =>Decimal.pow(10, upgradeAmount.value).mul(1000), }))
display: { ],
title: "Larger wood pieces", [
description: "Wooden block producers produce 3x as much" createUpgrade(() => ({
}, resource: toys.woodenBlocks,
visible: () => showIf(main.days[advancedDay - 1].opened.value) cost: () => Decimal.pow(1.2, upgradeAmount.value).mul(2000),
})), display: {
createUpgrade(() => ({ title: "Larger wood pieces",
resource: dyes.dyes.red.amount, description: "Wooden block producers produce 3x as much"
cost: () =>Decimal.pow(10, upgradeAmount.value).mul(1e17), },
display: { visible: () => showIf(main.days[advancedDay - 1].opened.value)
title: "Colorful clothes", })),
description: "Dye producers produce 4x as much" createUpgrade(() => ({
}, resource: dyes.dyes.red.amount,
visible: () => showIf(main.days[advancedDay - 1].opened.value) cost: () => Decimal.pow(1.5, upgradeAmount.value).mul(4e16),
})), display: {
createUpgrade(() => ({ title: "Colorful clothes",
resource: plastic.plastic, description: "Dye producers produce 4x as much"
cost: () =>Decimal.pow(10, upgradeAmount.value).mul(1e17), },
display: { visible: () => showIf(main.days[advancedDay - 1].opened.value)
title: "Improved plastic producers", })),
description: "Plastic producers produce 4x as much" createUpgrade(() => ({
}, resource: plastic.plastic,
visible: () => showIf(main.days[advancedDay - 1].opened.value) cost: () => Decimal.pow(2, upgradeAmount.value).mul(1e17),
}))], display: {
] title: "Improved plastic producers",
description: "Plastic producers produce 4x as much"
},
visible: () => showIf(main.days[advancedDay - 1].opened.value)
})),
createUpgrade(() => ({
resource: oil.oil,
cost: () => Decimal.pow(1.5, upgradeAmount.value).mul(1e22),
display: {
title: "Capitalism",
description: "Console production is tripled"
},
visible: () => showIf(main.days[advancedDay - 1].opened.value)
}))
],
[
createUpgrade(() => ({
resource: coal.coal,
cost: () => Decimal.pow(5, upgradeAmount.value).mul(1e130),
display: {
title: "Brighter work rooms",
description: "Unused electricity makes ticks faster"
},
visible: () => showIf(main.days[advancedDay - 1].opened.value)
})),
createUpgrade(() => ({
resource: dyes.dyes.blue.amount,
cost: () => Decimal.pow(1.4, upgradeAmount.value).mul(1e15),
display: {
title: "Colorful teddy bears",
description: "Teddy bears produce 2x as much"
},
visible: () => showIf(main.days[advancedDay - 1].opened.value)
})),
createUpgrade(() => ({
resource: dyes.dyes.black.amount,
cost: () => Decimal.pow(1.5, upgradeAmount.value).mul(1e6),
display: {
title: "New Colors",
description: "Unlock white dye"
},
visible: () => showIf(main.days[advancedDay - 1].opened.value)
})),
createUpgrade(() => ({
resource: boxes.boxes,
cost: () => Decimal.pow(3, upgradeAmount.value).mul(1e80),
display: {
title: "Carry ticks in boxes",
description: "Tick speed x1.5"
},
visible: () => showIf(main.days[advancedDay - 1].opened.value)
}))
]
];
// pixi // pixi
const upgradeAmount = computed(() => upgrades.flat().filter(u => u.bought.value).length) as ComputedRef<number> const upgradeAmount = computed(
() => upgrades.flat().filter(u => u.bought.value).length
) as ComputedRef<number>;
// load every sprite here so pixi doesn't complain about loading multiple times // load every sprite here so pixi doesn't complain about loading multiple times
const assetsLoading = Promise.all([ const assetsLoading = Promise.all([
Assets.load(Object.values(FACTORY_COMPONENTS).map(x => x.imageSrc)), Assets.load(Object.values(FACTORY_COMPONENTS).map(x => x.imageSrc)),
@ -1170,8 +1250,6 @@ const factory = createLayer(id, () => {
} }
} }
updateGraphics();
loaded = true; loaded = true;
watchEffect(updateGraphics); watchEffect(updateGraphics);
}); });
@ -1526,19 +1604,20 @@ const factory = createLayer(id, () => {
graphicContainer.removeChild(hoverSprite); graphicContainer.removeChild(hoverSprite);
if (isMouseHoverShown.value && compSelected.value !== "cursor") { if (isMouseHoverShown.value && compSelected.value !== "cursor") {
// Offset half a block if factory size is even
const factorySizeOffset = computedFactorySize.value % 2 === 0 ? blockSize / 2 : 0;
const { tx, ty } = spriteContainer.localTransform; const { tx, ty } = spriteContainer.localTransform;
const x =
roundDownTo(mouseCoords.x - tx, blockSize) + factorySizeOffset + tx - blockSize / 2;
const y =
roundDownTo(mouseCoords.y - ty, blockSize) + factorySizeOffset + ty - blockSize / 2;
graphicContainer.lineStyle(4, 0x808080, 1); graphicContainer.lineStyle(4, 0x808080, 1);
graphicContainer.drawRect( graphicContainer.drawRect(x, y, blockSize, blockSize);
roundDownTo(mouseCoords.x - tx, blockSize) + tx - blockSize / 2,
roundDownTo(mouseCoords.y - ty, blockSize) + ty - blockSize / 2,
blockSize,
blockSize
);
const factoryBaseData = FACTORY_COMPONENTS[compSelected.value]; const factoryBaseData = FACTORY_COMPONENTS[compSelected.value];
const sheet = Assets.get(factoryBaseData.imageSrc); const sheet = Assets.get(factoryBaseData.imageSrc);
hoverSprite = new Sprite(sheet); hoverSprite = new Sprite(sheet);
hoverSprite.x = roundDownTo(mouseCoords.x - tx, blockSize) + tx - blockSize / 2; hoverSprite.x = x;
hoverSprite.y = roundDownTo(mouseCoords.y - ty, blockSize) + ty - blockSize / 2; hoverSprite.y = y;
hoverSprite.width = blockSize; hoverSprite.width = blockSize;
hoverSprite.height = blockSize; hoverSprite.height = blockSize;
hoverSprite.alpha = 0.5; hoverSprite.alpha = 0.5;
@ -1710,7 +1789,6 @@ const factory = createLayer(id, () => {
const hovered = ref(false); const hovered = ref(false);
const componentsList = jsx(() => { const componentsList = jsx(() => {
return ( return (
<div class={{ "comp-container": true, hovered: hovered.value }}> <div class={{ "comp-container": true, hovered: hovered.value }}>
<div class="comp-list"> <div class="comp-list">
<div <div
@ -1792,22 +1870,24 @@ const factory = createLayer(id, () => {
); );
} }
const hoveredComponent = jsx(() => const hoveredComponent = jsx(() => {
compHovered.value !== undefined && compInternalHovered.value !== undefined ? ( if (compHovered.value == null || compInternalHovered.value == null) {
return "";
}
const factorySizeOffset = computedFactorySize.value % 2 === 0 ? blockSize / 2 : 0;
const x = mouseCoords.x + factorySizeOffset;
const y = mouseCoords.y + factorySizeOffset;
const onRight =
x + (document.getElementById("factory-info")?.clientWidth ?? 0) > app.view.width - 30;
const onTop =
y + (document.getElementById("factory-info")?.clientHeight ?? 0) > app.view.height - 30;
return (
<div <div
class="info-container" class="info-container"
id="factory-info" id="factory-info"
style={{ style={{
...(mouseCoords.x + ...(onRight ? { right: app.view.width - x + "px" } : { left: x + 148 + "px" }),
(document.getElementById("factory-info")?.clientWidth ?? 0) > ...(onTop ? { bottom: app.view.height - y + "px" } : { top: y + "px" })
app.view.width - 30
? { right: app.view.width - mouseCoords.x + "px" }
: { left: mouseCoords.x + 148 + "px" }),
...(mouseCoords.y +
(document.getElementById("factory-info")?.clientHeight ?? 0) >
app.view.height - 30
? { bottom: app.view.height - mouseCoords.y + "px" }
: { top: mouseCoords.y + "px" })
}} }}
> >
<h3>{FACTORY_COMPONENTS[compHovered.value.type].name}</h3> <h3>{FACTORY_COMPONENTS[compHovered.value.type].name}</h3>
@ -1852,10 +1932,8 @@ const factory = createLayer(id, () => {
</> </>
) : undefined} ) : undefined}
</div> </div>
) : ( );
"" });
)
);
const tabs = createTabFamily( const tabs = createTabFamily(
{ {
@ -1918,7 +1996,7 @@ const factory = createLayer(id, () => {
<Spacer /> <Spacer />
{renderRow(...Object.values(factoryBuyables))} {renderRow(...Object.values(factoryBuyables))}
<Spacer /> <Spacer />
{renderGrid(...upgrades as VueFeature[][])} {renderGrid(...(upgrades as VueFeature[][]))}
</> </>
)) ))
})), })),

View file

@ -25,6 +25,7 @@ import {
createSequentialModifier, createSequentialModifier,
createAdditiveModifier, createAdditiveModifier,
createMultiplicativeModifier, createMultiplicativeModifier,
createExponentialModifier,
Modifier Modifier
} from "game/modifiers"; } from "game/modifiers";
import { main } from "data/projEntry"; import { main } from "data/projEntry";
@ -41,6 +42,7 @@ import workshop from "./workshop";
import { WithRequired } from "util/common"; import { WithRequired } from "util/common";
import { ElfBuyable } from "./elves"; import { ElfBuyable } from "./elves";
import toys from "./toys"; import toys from "./toys";
import factory from "./factory";
const id = "oil"; const id = "oil";
const day = 9; const day = 9;
@ -889,6 +891,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
multiplier: dyes.boosts.red2, multiplier: dyes.boosts.red2,
description: "Red Dye", description: "Red Dye",
enabled: dyes.masteryEffectActive enabled: dyes.masteryEffectActive
})),
createExponentialModifier(() => ({
exponent: 1.2,
description: "Diamond-tipped drills",
enabled: factory.upgrades[0][3].bought
})) }))
]); ]);
const computedDrillPower = computed(() => drillPower.apply(0)); const computedDrillPower = computed(() => drillPower.apply(0));

View file

@ -379,6 +379,10 @@ const layer = createLayer(id, function (this: BaseLayer) {
multiplier: 50, multiplier: 50,
description: "350 toys", description: "350 toys",
enabled: toys.milestones.milestone4.earned enabled: toys.milestones.milestone4.earned
})),
createMultiplicativeModifier(() => ({
multiplier: () => dyes.boosts.white1.value,
description: "White Dye Boost"
})) }))
]); ]);
const computedPlasticGain = computed(() => plasticGain.apply(0)); const computedPlasticGain = computed(() => plasticGain.apply(0));

View file

@ -288,6 +288,15 @@ const layer = createLayer(id, function (this: BaseLayer) {
visibility: () => visibility: () =>
showIf(milestone6.earned.value && main.days[factory.advancedDay - 1].opened.value) showIf(milestone6.earned.value && main.days[factory.advancedDay - 1].opened.value)
})) as GenericMilestone; })) as GenericMilestone;
const milestone8 = createMilestone(() => ({
display: {
requirement: "6000 toys",
effectDisplay: "Running out of energy? Let's increase the limit! Multiply energy capacity by 1.4"
},
shouldEarn: () => Decimal.gte(toySum.value, 6000),
visibility: () =>
showIf(milestone6.earned.value && main.days[factory.advancedDay - 1].opened.value)
})) as GenericMilestone;
const milestones = { const milestones = {
milestone1, milestone1,
milestone2, milestone2,
@ -295,7 +304,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
milestone4, milestone4,
milestone5, milestone5,
milestone6, milestone6,
milestone7 milestone7,
milestone8
}; };
const { collapseMilestones, display: milestonesDisplay } = const { collapseMilestones, display: milestonesDisplay } =
createCollapsibleMilestones(milestones); createCollapsibleMilestones(milestones);

View file

@ -39,6 +39,7 @@ import paper from "./paper";
import workshop from "./workshop"; import workshop from "./workshop";
import wrappingPaper from "./wrapping-paper"; import wrappingPaper from "./wrapping-paper";
import toys from "./toys"; import toys from "./toys";
import factory from "./factory";
const id = "trees"; const id = "trees";
const day = 1; const day = 1;
@ -551,6 +552,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
description: "3000 Toys", description: "3000 Toys",
enabled: toys.milestones.milestone7.earned enabled: toys.milestones.milestone7.earned
})), })),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.add(toys.trucks.value, 1),
description: "Haul wood in trucks",
enabled: factory.upgrades[0][2].bought
})),
createExponentialModifier(() => ({ createExponentialModifier(() => ({
exponent: 1.2, exponent: 1.2,
description: "100% Foundation Completed", description: "100% Foundation Completed",

View file

@ -24,11 +24,12 @@ import {
createAdditiveModifier, createAdditiveModifier,
createExponentialModifier, createExponentialModifier,
createMultiplicativeModifier, createMultiplicativeModifier,
createSequentialModifier createSequentialModifier,
Modifier
} from "game/modifiers"; } from "game/modifiers";
import { noPersist, persistent } from "game/persistence"; import { noPersist, persistent } from "game/persistence";
import Decimal, { DecimalSource, formatWhole } from "util/bignum"; import Decimal, { DecimalSource, formatWhole } from "util/bignum";
import { Direction } from "util/common"; import { Direction, WithRequired } from "util/common";
import { render } from "util/vue"; import { render } from "util/vue";
import { computed, ref, unref, watchEffect } from "vue"; import { computed, ref, unref, watchEffect } from "vue";
import elves from "./elves"; import elves from "./elves";
@ -63,7 +64,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
description: "Expand Factory", description: "Expand Factory",
enabled: () => Decimal.gt(factory.factoryBuyables.expandFactory.amount.value, 0) enabled: () => Decimal.gt(factory.factoryBuyables.expandFactory.amount.value, 0)
})) }))
]); ]) as WithRequired<Modifier, "revert" | "description">;
const computedMaxFoundation = computed(() => maxFoundation.apply(100)); const computedMaxFoundation = computed(() => maxFoundation.apply(100));
const foundationConversion = createIndependentConversion(() => ({ const foundationConversion = createIndependentConversion(() => ({

View file

@ -44,7 +44,7 @@ export type GenericHotkey = Replace<
} }
>; >;
const uppercaseNumbers = [")", "!", "@", "#", "$", "5", "^", "&", "*", "("]; const uppercaseNumbers = [")", "!", "@", "#", "$", "%", "^", "&", "*", "("];
export function createHotkey<T extends HotkeyOptions>( export function createHotkey<T extends HotkeyOptions>(
optionsFunc: OptionsFunc<T, BaseHotkey, GenericHotkey> optionsFunc: OptionsFunc<T, BaseHotkey, GenericHotkey>