Merge pull request #3 from thepaperpilot/day-17-toys

merge day 17
This commit is contained in:
unsoftcapped3 2022-12-20 16:26:07 -08:00 committed by GitHub
commit cb83e058ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 485 additions and 19 deletions

View file

@ -35,6 +35,7 @@ import management from "./management";
import oil from "./oil";
import paper from "./paper";
import trees from "./trees";
import toys from "./toys";
interface Dye {
name: string;
@ -55,7 +56,7 @@ type DyeUpg =
| "blueDyeUpg2"
| "coalUpg";
export type enumColor = "blue" | "red" | "green" | "yellow" | "purple" | "orange";
export type enumColor = "red" | "green" | "blue" | "yellow" | "purple" | "orange" | "black";
const id = "dyes";
const day = 11;
@ -212,6 +213,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
case "red":
case "yellow":
case "blue":
case "black":
dyeBook = paper.books.primaryDyeBook;
break;
case "orange":
@ -487,6 +489,31 @@ const layer = createLayer(id, function (this: BaseLayer) {
],
dyesToReset: []
}),
black: createDye({
name: "Black Dye",
color: "black",
key: "a",
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.black1.value)} oil gain.`)
}
],
dyesToReset: [],
visibility: () => showIf(toys.milestones.milestone2.earned.value)
}),
orange: createDye({
name: "Orange Dye",
color: "orange",
@ -664,7 +691,12 @@ const layer = createLayer(id, function (this: BaseLayer) {
.pow(upgrades.coalUpg.bought.value ? 1.2 : 1)
.pow(management.elfTraining.clothElfTraining.milestones[3].earned.value ? 1.1 : 1)
),
purple2: computed(() => Decimal.add(dyes.purple.amount.value, 1).log2().plus(1))
purple2: computed(() => Decimal.add(dyes.purple.amount.value, 1).log2().plus(1)),
black1: computed(() =>
Decimal.pow(2, Decimal.add(dyes.black.amount.value, 1).log2().sqrt())
.pow(upgrades.coalUpg.bought.value ? 1.2 : 1)
.pow(management.elfTraining.clothElfTraining.milestones[3].earned.value ? 1.1 : 1)
)
};
const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [
@ -683,6 +715,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
modifier: dyes.blue.toGenerate,
base: 0
},
{
title: "Black Dye Creation",
modifier: dyes.black.toGenerate,
base: 0
},
{
title: "Orange Dye Creation",
modifier: dyes.orange.toGenerate,
@ -913,6 +950,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
</>
) : null}
<div style="width: 620px">
{renderRow(dyes.black.display)}
{renderRow(dyes.black.buyable)}
<Spacer />
{renderRow(dyes.red.display, dyes.yellow.display, dyes.blue.display)}
{renderRow(dyes.red.buyable, dyes.yellow.buyable, dyes.blue.buyable)}
<Spacer />

View file

@ -24,6 +24,7 @@ import { createBuyable, GenericBuyable } from "features/buyable";
import metal from "./metal";
import plastic from "./plastic";
import paper from "./paper";
import dyes from "./dyes";
import SqrtVue from "components/math/Sqrt.vue";
import { globalBus } from "game/events";
import { main } from "data/projEntry";
@ -215,6 +216,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
multiplier: () => Decimal.div(paperBuyable.amount.value, 2).add(1),
description: "Printed Labels"
}))
]);
const computedLettersGain = computed(() => lettersGain.apply(1));
const processingCooldown = createSequentialModifier(() => [

View file

@ -36,6 +36,7 @@ import paper from "./paper";
import plastic from "./plastic";
import workshop from "./workshop";
import wrappingPaper from "./wrapping-paper";
import toys from "./toys";
const id = "metal";
const day = 7;
@ -207,6 +208,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
multiplier: () => Decimal.add(industrialCrucible.amount.value, 1).sqrt(),
description: "100,000 Letters Processed",
enabled: letters.milestones.industrialCrucibleMilestone.earned
})),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.add(toys.clothes.value, 1),
description: "Give elves clothes to wear",
enabled: toys.row1Upgrades[1].bought
}))
]);
const computedAutoSmeltMulti = computed(() => autoSmeltMulti.apply(1));
@ -282,6 +288,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
multiplier: () => Decimal.add(dyes.dyes.blue.amount.value, 1).sqrt(),
description: "1000 Letters Processed",
enabled: letters.milestones.miningMilestone.earned
})),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.add(toys.clothes.value, 1),
description: "Give elves clothes to wear",
enabled: toys.row1Upgrades[1].bought
}))
]);
const computedOreAmount = computed(() => oreAmount.apply(1));

View file

@ -40,6 +40,7 @@ import management from "./management";
import workshop from "./workshop";
import { WithRequired } from "util/common";
import { ElfBuyable } from "./elves";
import toys from "./toys";
const id = "oil";
const day = 9;
@ -874,6 +875,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
description: "Cocoa Level 3",
enabled: management.elfTraining.oilElfTraining.milestones[2].earned
})),
createMultiplicativeModifier(() => ({
multiplier: 4,
description: "Workshop 1200%",
enabled: workshop.milestones.extraExpansionMilestone6.earned
})),
createMultiplicativeModifier(() => ({
multiplier: () => coalEffectiveness.value,
description: "Effectiveness",
@ -942,6 +948,15 @@ const layer = createLayer(id, function (this: BaseLayer) {
multiplier: 2,
description: "Cocoa Level 3",
enabled: management.elfTraining.oilElfTraining.milestones[2].earned
})),
createMultiplicativeModifier(() => ({
multiplier: () => dyes.boosts.black1.value,
description: "Black Dye Boost"
})),
createMultiplicativeModifier(() => ({
multiplier: 50,
description: "350 toys",
enabled: toys.milestones.milestone4.earned.value
}))
]) as WithRequired<Modifier, "description" | "revert">;
const computedOilSpeed = computed(() => oilSpeed.apply(0));

View file

@ -36,6 +36,7 @@ import metal from "./metal";
import oil from "./oil";
import paper from "./paper";
import workshop from "./workshop";
import toys from "./toys";
const id = "plastic";
const day = 10;
@ -373,6 +374,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
multiplier: () => Decimal.div(buildRefinery.amount.value, 100).add(1),
description: "Tinsel Level 4",
enabled: management.elfTraining.plasticElfTraining.milestones[3].earned
})),
createMultiplicativeModifier(() => ({
multiplier: 50,
description: "350 toys",
enabled: toys.milestones.milestone4.earned.value
}))
]);
const computedPlasticGain = computed(() => plasticGain.apply(0));

View file

@ -48,3 +48,18 @@
);
}
}
@keyframes toys-bar {
from {
background: 0 0 / 114px 114px repeat repeating-linear-gradient(-45deg,
#4bdc13 0 10px,
green 10px 20px
);
}
to {
background: 114px 0px / 114px 114px repeat repeating-linear-gradient(-45deg,
#4bdc13 0 10px,
green 10px 20px
);
}
}

340
src/data/layers/toys.tsx Normal file
View file

@ -0,0 +1,340 @@
/**
* @module
* @hidden
*/
import Spacer from "components/layout/Spacer.vue";
import Modal from "components/Modal.vue";
import { main } from "data/projEntry";
import { createBar } from "features/bars/bar";
import {
createCollapsibleMilestones,
createCollapsibleModifierSections,
setUpDailyProgressTracker
} from "data/common";
import { createBuyable, GenericBuyable } from "features/buyable";
import { createClickable } from "features/clickables/clickable";
import { jsx, showIf } from "features/feature";
import { createHotkey } from "features/hotkey";
import MainDisplay from "features/resources/MainDisplay.vue";
import { createMilestone } from "features/milestones/milestone";
import { createResource, Resource } from "features/resources/resource";
import { createUpgrade } from "features/upgrades/upgrade";
import { globalBus } from "game/events";
import { BaseLayer, createLayer } from "game/layers";
import {
createAdditiveModifier,
createExponentialModifier,
createMultiplicativeModifier,
createSequentialModifier,
Modifier
} from "game/modifiers";
import { noPersist, persistent } from "game/persistence";
import Decimal, { DecimalSource, format, formatGain, formatLimit, formatWhole } from "util/bignum";
import { Direction, WithRequired } from "util/common";
import { render, renderGrid, renderRow } from "util/vue";
import { computed, ref } from "vue";
import metal from "./metal";
import plastic from "./plastic";
import cloth from "./cloth";
import trees from "./trees";
import dyes from "./dyes";
import paper from "./paper";
import workshop from "./workshop";
const id = "toys";
const day = 17;
const layer = createLayer(id, function (this: BaseLayer) {
const name = "Toys";
const colorBright = "#4BDC13";
const colorDark = "green";
const clothes = createResource<DecimalSource>(0, "clothes");
const woodenBlocks = createResource<DecimalSource>(0, " wooden blocks");
const trucks = createResource<DecimalSource>(0, "trucks");
const toyGain = createSequentialModifier(() => []);
const toySum = createResource(
computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)),
"toys"
);
const clothesCost = computed(() => {
let clothFactor = Decimal.add(1, clothesBuyable.amount.value);
if (milestones.milestone1.earned.value) {
clothFactor = clothFactor.div(
Decimal.div(workshop.foundationProgress.value, 100).floor()
);
}
return {
cloth: clothFactor.mul(1e13),
dye: clothFactor.mul(2e14)
};
});
const clothesBuyable = createBuyable(() => ({
display: jsx(() => (
<>
<h3>Make Clothes</h3>
<div>Click this buyable to make some clothes!</div>
<div>You have {formatWhole(clothes.value)} clothes.</div>
<div>
Costs {format(clothesCost.value.cloth)} cloth and requires{" "}
{format(clothesCost.value.dye)} of red, yellow, and blue dye
</div>
</>
)),
canPurchase(): boolean {
return (
clothesCost.value.cloth.lte(cloth.cloth.value) &&
clothesCost.value.dye.lte(dyes.dyes.blue.amount.value) &&
clothesCost.value.dye.lte(dyes.dyes.red.amount.value) &&
clothesCost.value.dye.lte(dyes.dyes.yellow.amount.value)
);
},
onPurchase() {
cloth.cloth.value = Decimal.sub(cloth.cloth.value, clothesCost.value.cloth);
this.amount.value = Decimal.add(this.amount.value, 1);
clothes.value = this.amount.value;
}
})) as GenericBuyable;
const woodenBlocksCost = computed(() => {
let woodFactor = Decimal.add(1, woodenBlocksBuyable.amount.value).pow(5);
if (milestones.milestone1.earned.value) {
woodFactor = woodFactor.div(
Decimal.div(workshop.foundationProgress.value, 100).floor()
);
}
return {
wood: woodFactor.mul(1e63)
};
});
const woodenBlocksBuyable = createBuyable(() => ({
display: jsx(() => (
<>
<h3>Make Wooden Blocks</h3>
<div>Click this buyable to make some wooden blocks!</div>
<div>You have {formatWhole(woodenBlocks.value)} wooden blocks.</div>
<div>Costs {format(woodenBlocksCost.value.wood)} logs</div>
</>
)),
canPurchase(): boolean {
return woodenBlocksCost.value.wood.lte(trees.logs.value);
},
onPurchase() {
trees.logs.value = Decimal.sub(trees.logs.value, woodenBlocksCost.value.wood);
this.amount.value = Decimal.add(this.amount.value, 1);
woodenBlocks.value = this.amount.value;
}
})) as GenericBuyable;
const trucksCost = computed(() => {
let factor = Decimal.add(1, trucksBuyable.amount.value).pow(3);
let plasticFactor = Decimal.add(1, trucksBuyable.amount.value);
if (milestones.milestone1.earned.value) {
factor = factor.div(Decimal.div(workshop.foundationProgress.value, 100).floor());
plasticFactor = plasticFactor.div(
Decimal.div(workshop.foundationProgress.value, 100).floor()
);
}
return {
metal: factor.mul(1e43),
plastic: plasticFactor.mul(1e14)
};
});
const trucksBuyable = createBuyable(() => ({
display: jsx(() => (
<>
<h3>Make Trucks</h3>
<div>Click this buyable to make some trucks!</div>
<div>You have {formatWhole(trucks.value)} trucks.</div>
<div>
Costs {format(trucksCost.value.metal)} metal and{" "}
{format(trucksCost.value.plastic)} plastic
</div>
</>
)),
canPurchase(): boolean {
return (
trucksCost.value.metal.lte(metal.metal.value) &&
trucksCost.value.plastic.lte(plastic.plastic.value)
);
},
onPurchase() {
metal.metal.value = Decimal.sub(metal.metal.value, trucksCost.value.metal);
plastic.plastic.value = Decimal.sub(plastic.plastic.value, trucksCost.value.plastic);
this.amount.value = Decimal.add(this.amount.value, 1);
trucks.value = this.amount.value;
}
})) as GenericBuyable;
const buyables = [clothesBuyable, woodenBlocksBuyable, trucksBuyable];
const trucksUpgrade1 = createUpgrade(() => ({
resource: noPersist(trucks),
cost: 10,
display: {
title: "Load logs onto trucks",
description: "Log gain is doubled."
}
}));
const clothesUpgrade1 = createUpgrade(() => ({
resource: noPersist(clothes),
cost: 30,
display: {
title: "Give elves clothes to wear",
description:
"Multiply ore per mining operation and auto-smelt purity by the number of clothes you have."
}
}));
const woodenBlocksUpgrade1 = createUpgrade(() => ({
resource: noPersist(woodenBlocks),
cost: 15,
display: {
title: "Build wooden towers",
description: "You can now build 2 extra tall workshops!"
}
}));
const row1Upgrades = [trucksUpgrade1, clothesUpgrade1, woodenBlocksUpgrade1];
const milestone1 = createMilestone(() => ({
display: {
requirement: "10 toys",
effectDisplay:
"The cost of making toys is divided by the number of complete workshops you have."
},
shouldEarn: () => Decimal.gte(toySum.value, 10)
}));
const milestone2 = createMilestone(() => ({
display: {
requirement: "100 toys",
effectDisplay: "Unlock black dyes."
},
shouldEarn: () => Decimal.gte(toySum.value, 100)
}));
const milestone3 = createMilestone(() => ({
display: {
requirement: "200 toys",
effectDisplay: "Beach wrapping paper is much more powerful."
},
shouldEarn: () => Decimal.gte(toySum.value, 200)
}));
const milestone4 = createMilestone(() => ({
display: {
requirement: "350 toys",
effectDisplay: "Gain 50x oil and plastic."
},
shouldEarn: () => Decimal.gte(toySum.value, 350)
}));
const milestones = { milestone1, milestone2, milestone3, milestone4 };
const { collapseMilestones, display: milestonesDisplay } =
createCollapsibleMilestones(milestones);
const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [
{
title: `Toy Gain`,
modifier: toyGain,
base: 1,
visible: true
}
]);
const showModifiersModal = ref(false);
const modifiersModal = jsx(() => (
<Modal
modelValue={showModifiersModal.value}
onUpdate:modelValue={(value: boolean) => (showModifiersModal.value = value)}
v-slots={{
header: () => <h2>{name} Modifiers</h2>,
body: generalTab
}}
/>
));
globalBus.on("update", diff => {
if (Decimal.lt(main.day.value, day)) {
return;
}
if (Decimal.lt(clothes.value, clothesBuyable.amount.value)) {
clothesBuyable.amount.value = clothes.value;
}
if (Decimal.lt(woodenBlocks.value, woodenBlocksBuyable.amount.value)) {
woodenBlocksBuyable.amount.value = woodenBlocks.value;
}
if (Decimal.lt(trucks.value, trucksBuyable.amount.value)) {
trucksBuyable.amount.value = trucks.value;
}
});
const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({
resource: toySum,
goal: 500,
name,
day,
background: {
gradient: "toys-bar",
duration: "15s"
},
modal: {
show: showModifiersModal,
display: modifiersModal
}
});
return {
name,
day,
color: colorBright,
clothes,
woodenBlocks,
trucks,
toySum,
totalToys,
buyables,
row1Upgrades,
milestones,
generalTabCollapsed,
collapseMilestones,
minWidth: 700,
display: jsx(() => (
<>
{render(trackerDisplay)}
<Spacer />
<MainDisplay
resource={clothes}
color={colorBright}
style="margin-bottom: 0"
productionDisplay={undefined}
/>
<MainDisplay
resource={woodenBlocks}
color={colorDark}
style="margin-bottom: 0"
productionDisplay={undefined}
/>
<MainDisplay
resource={trucks}
color={colorDark}
style="margin-bottom: 0"
productionDisplay={undefined}
/>
<Spacer />
{renderRow(...buyables)}
<Spacer />
{renderGrid(row1Upgrades)}
<Spacer />
{milestonesDisplay()}
</>
)),
minimizedDisplay: jsx(() => (
<div>
{name} - {format(toySum.value)} {"total toys"}
</div>
))
};
});
export default layer;

View file

@ -38,6 +38,7 @@ import management from "./management";
import paper from "./paper";
import workshop from "./workshop";
import wrappingPaper from "./wrapping-paper";
import toys from "./toys";
const id = "trees";
const day = 1;
@ -540,6 +541,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
description: "Trees Decoration",
enabled: masteryEffectActive
})),
createMultiplicativeModifier(() => ({
multiplier: 2,
description: "Load logs onto trucks",
enabled: toys.row1Upgrades[0].bought
})),
createExponentialModifier(() => ({
exponent: 1.2,
description: "100% Foundation Completed",

View file

@ -33,6 +33,7 @@ import elves from "./elves";
import management from "./management";
import trees from "./trees";
import wrappingPaper from "./wrapping-paper";
import toys from "./toys";
const id = "workshop";
const day = 2;
@ -48,7 +49,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
scaling: addHardcap(
addSoftcap(addSoftcap(createPolynomialScaling(250, 1.5), 5423, 1 / 1e10), 1e20, 3e8),
computed(() =>
management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100
toys.row1Upgrades[2].bought
? 1200
: management.elfTraining.expandersElfTraining.milestones[2].earned.value
? 1000
: 100
)
),
baseResource: trees.logs,
@ -69,6 +74,16 @@ const layer = createLayer(id, function (this: BaseLayer) {
exponent: 1 / 0.99,
description: "Holly Level 5",
enabled: management.elfTraining.cutterElfTraining.milestones[4].earned
})),
createExponentialModifier(() => ({
exponent: 0.1,
description: "Scaling Jump at 1000%",
enabled: computed(() => Decimal.gte(foundationProgress.value, 1000))
})),
createMultiplicativeModifier(() => ({
multiplier: 6969, // note: 6969 is a magic number. Don't touch this or it'll self-destruct.
description: "Scaling Jump at 1000%",
enabled: computed(() => Decimal.gte(foundationProgress.value, 1000))
}))
])
}));
@ -98,7 +113,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
showIf(
Decimal.lt(
foundationProgress.value,
management.elfTraining.expandersElfTraining.milestones[2].earned.value
toys.row1Upgrades[2].bought.value
? 1200
: management.elfTraining.expandersElfTraining.milestones[2].earned.value
? 1000
: 100
)
@ -110,14 +127,14 @@ const layer = createLayer(id, function (this: BaseLayer) {
if (main.isMastery.value && main.currentlyMastering.value?.name === "Trees") {
return false;
}
if (
Decimal.gte(
foundationProgress.value,
management.elfTraining.expandersElfTraining.milestones[2].earned.value
? 1000
: 100
)
) {
let cap = 100;
if (management.elfTraining.expandersElfTraining.milestones[2].earned.value) {
cap = 1000;
}
if (toys.row1Upgrades[2].bought.value) {
cap = 1200;
}
if (Decimal.gte(foundationProgress.value, cap)) {
return false;
}
return true;
@ -278,6 +295,16 @@ const layer = createLayer(id, function (this: BaseLayer) {
),
showPopups: shouldShowPopups
}));
const extraExpansionMilestone6 = createMilestone(() => ({
display: {
requirement: "1200% Foundation Completed",
effectDisplay: "Quadruple oil gain"
},
shouldEarn: () => Decimal.gte(foundationProgress.value, 1200),
visibility: () =>
showIf(extraExpansionMilestone5.earned.value && toys.row1Upgrades[2].bought.value),
showPopups: shouldShowPopups
}));
const milestones = {
logGainMilestone1,
autoCutMilestone1,
@ -291,7 +318,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
extraExpansionMilestone2,
extraExpansionMilestone3,
extraExpansionMilestone4,
extraExpansionMilestone5
extraExpansionMilestone5,
extraExpansionMilestone6
};
const { collapseMilestones, display: milestonesDisplay } =
createCollapsibleMilestones(milestones);

View file

@ -16,6 +16,7 @@ import { computed, Ref, unref, watchEffect } from "vue";
import { main } from "../projEntry";
import { default as dyes, type enumColor } from "./dyes";
import elves from "./elves";
import toys from "./toys";
const id = "wrappingPaper";
const day = 15;
@ -277,7 +278,7 @@ const layer = createLayer(id, () => {
beach1: computed(() =>
main.isMastery.value
? 1
: Decimal.add(wrappingPaper.beach.buyable.amount.value, 1).log10().add(1)
: Decimal.add(wrappingPaper.beach.buyable.amount.value, 1).log10().add(1).pow(toys.milestones.milestone3.earned.value ? 1.6 : 1)
)
};
const wrappingPaperSum = createResource(

View file

@ -30,10 +30,11 @@ import metal from "./layers/metal";
import oil from "./layers/oil";
import paper from "./layers/paper";
import plastic from "./layers/plastic";
import ribbon from "./layers/ribbon";
import toys from "./layers/toys";
import trees from "./layers/trees";
import workshop from "./layers/workshop";
import wrappingPaper from "./layers/wrapping-paper";
import ribbon from "./layers/ribbon";
import boxesSymbol from "./symbols/cardboardBox.png";
import clothSymbol from "./symbols/cloth.png";
import coalSymbol from "./symbols/coal.png";
@ -415,7 +416,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
createDay(() => ({
day: 17,
shouldNotify: false,
layer: null, // "toys 1"
layer: "toys", // "toys1"
symbol: "",
story: "",
completedStory: "",
@ -424,7 +425,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
createDay(() => ({
day: 18,
shouldNotify: false,
layer: null, // "toys 2"
layer: null, // "toys2"
symbol: "",
story: "",
completedStory: "",
@ -433,7 +434,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
createDay(() => ({
day: 19,
shouldNotify: false,
layer: null, // "toys 3"
layer: null, // "toys3"
symbol: "",
story: "",
completedStory: "",
@ -591,7 +592,8 @@ export const getInitialLayers = (
management,
letters,
wrappingPaper,
ribbon
ribbon,
toys
];
/**