Implemented more buyables

This commit is contained in:
thepaperpilot 2022-12-22 16:32:20 -06:00
parent 2c5bfdb7f3
commit f1de9d8dad
5 changed files with 164 additions and 46 deletions

View file

@ -16,7 +16,7 @@ defineProps<{
</script>
<style scoped>
.toy {
width: 80px;
width: 90px;
display: flex;
flex-direction: column;
margin: 10px !important;

View file

@ -10,8 +10,8 @@ import Modal from "components/Modal.vue";
import { createCollapsibleModifierSections } from "data/common";
import { main } from "data/projEntry";
import { createBar, GenericBar } from "features/bars/bar";
import { createBuyable } from "features/buyable";
import { jsx } from "features/feature";
import { createBuyable, GenericBuyable } from "features/buyable";
import { jsx, showIf } from "features/feature";
import { createHotkey, GenericHotkey } from "features/hotkey";
import MainDisplay from "features/resources/MainDisplay.vue";
import { createResource, Resource } from "features/resources/resource";
@ -80,6 +80,7 @@ import Factory from "./Factory.vue";
import "./styles/factory.css";
import Toy from "./Toy.vue";
import toys from "./toys";
import trees from "./trees";
const id = "factory";
@ -888,7 +889,8 @@ const factory = createLayer(id, () => {
display: {
title: "Train elves to make clothes",
description: "Use your finished toys to train an elf on factory work"
}
},
style: "width: 110px"
}));
const blocksBuyable = createBuyable(() => ({
resource: toys.woodenBlocks,
@ -898,7 +900,8 @@ const factory = createLayer(id, () => {
display: {
title: "Train elves to make wooden blocks",
description: "Use your finished toys to train an elf on factory work"
}
},
style: "width: 110px"
}));
const trucksBuyable = createBuyable(() => ({
resource: toys.trucks,
@ -908,9 +911,53 @@ const factory = createLayer(id, () => {
display: {
title: "Train elves to make toy trucks",
description: "Use your finished toys to train an elf on factory work"
}
},
style: "width: 110px"
}));
const elfBuyables = { clothesBuyable, blocksBuyable, trucksBuyable };
const bearsBuyable = createBuyable(() => ({
resource: bears,
cost() {
return Decimal.pow(2, Decimal.add(this.amount.value, 5));
},
display: {
title: "Train elves to make bears",
description: "Use your finished toys to train an elf on factory work"
},
style: "width: 110px",
visible: () => showIf(main.days[advancedDay - 1].opened.value)
}));
const bucketBuyable = createBuyable(() => ({
resource: bucketAndShovels,
cost() {
return Decimal.pow(2, Decimal.add(this.amount.value, 5));
},
display: {
title: "Train elves to make shovel and pails",
description: "Use your finished toys to train an elf on factory work"
},
style: "width: 110px",
visible: () => showIf(main.days[advancedDay - 1].opened.value)
}));
const consolesBuyable = createBuyable(() => ({
resource: consoles,
cost() {
return Decimal.pow(2, Decimal.add(this.amount.value, 5));
},
display: {
title: "Train elves to make consoles",
description: "Use your finished toys to train an elf on factory work"
},
style: "width: 110px",
visible: () => showIf(main.days[advancedDay - 1].opened.value)
}));
const elfBuyables = {
clothesBuyable,
blocksBuyable,
trucksBuyable,
bearsBuyable,
bucketBuyable,
consolesBuyable
};
const sumElves = computed(() =>
Object.values(elfBuyables)
@ -921,8 +968,22 @@ const factory = createLayer(id, () => {
const elvesEffect = computed(() => Decimal.add(trainedElves.value, 1).log10().add(1));
const expandFactory = createBuyable(() => ({
canPurchase: true
}));
resource: trees.logs,
cost() {
return Decimal.pow(1e4, this.amount.value).times(1e72);
},
display: {
title: "Expand Factory",
description:
"Use some surplus wood to slightly expand the walls of your factory. Also add +100% to the max workshop size",
effectDisplay: jsx(() => (
<>+{formatWhole(expandFactory.amount.value)} each dimension</>
)),
showAmount: false
},
style: "width: 200px",
visible: () => showIf(main.days[advancedDay - 1].opened.value)
})) as GenericBuyable;
const factoryBuyables = { expandFactory };
// pixi
@ -1757,7 +1818,7 @@ const factory = createLayer(id, () => {
: main.day.value === advancedDay
? [toys.clothes, toys.woodenBlocks, toys.trucks, bears, bucketAndShovels, consoles]
.map(r => Decimal.div(r.value, advancedToyGoal).clampMax(1))
.reduce(Decimal.add, 0)
.reduce(Decimal.add, Decimal.dZero)
.div(6)
: 1,
display: jsx(() =>
@ -1816,6 +1877,7 @@ const factory = createLayer(id, () => {
return {
name,
day,
advancedDay,
color,
minWidth: 700,
minimizable: true,

View file

@ -12,7 +12,7 @@ import {
import { main } from "data/projEntry";
import { createBuyable, GenericBuyable } from "features/buyable";
import { jsx, showIf } from "features/feature";
import { createMilestone } from "features/milestones/milestone";
import { createMilestone, GenericMilestone } from "features/milestones/milestone";
import MainDisplay from "features/resources/MainDisplay.vue";
import { createResource } from "features/resources/resource";
import { createUpgrade } from "features/upgrades/upgrade";
@ -25,6 +25,7 @@ import { render, renderGrid, renderRow } from "util/vue";
import { computed, ref } from "vue";
import cloth from "./cloth";
import dyes from "./dyes";
import factory from "./factory";
import metal from "./metal";
import plastic from "./plastic";
import trees from "./trees";
@ -263,21 +264,39 @@ const layer = createLayer(id, function (this: BaseLayer) {
const milestone5 = createMilestone(() => ({
display: {
requirement: "750 toys",
effectDisplay: "The wheel crafter now makes 2 wheels instead of 1! Now you should be able to fit everything in the factory."
effectDisplay:
"The wheel crafter now makes 2 wheels instead of 1! Now you should be able to fit everything in the factory."
},
shouldEarn: () => Decimal.gte(toySum.value, 750),
visibility: () => showIf(milestone4.earned.value)
}));
visibility: () => showIf(milestone4.earned.value && main.days[factory.day - 1].opened.value)
})) as GenericMilestone;
const milestone6 = createMilestone(() => ({
display: {
requirement: "1500 toys",
effectDisplay: "Running out of energy? Let's increase the limit! Multiply energy capacity by 1.4"
effectDisplay:
"Running out of energy? Let's increase the limit! Multiply energy capacity by 1.4"
},
shouldEarn: () => Decimal.gte(toySum.value, 1500),
visibility: () => showIf(milestone5.earned.value)
}));
const milestones = { milestone1, milestone2, milestone3, milestone4, milestone5, milestone6 };
const milestone7 = createMilestone(() => ({
display: {
requirement: "3000 toys",
effectDisplay: "Multiply log gain by the amount of clothes you have"
},
shouldEarn: () => Decimal.gte(toySum.value, 3000),
visibility: () =>
showIf(milestone6.earned.value && main.days[factory.advancedDay - 1].opened.value)
})) as GenericMilestone;
const milestones = {
milestone1,
milestone2,
milestone3,
milestone4,
milestone5,
milestone6,
milestone7
};
const { collapseMilestones, display: milestonesDisplay } =
createCollapsibleMilestones(milestones);

View file

@ -546,6 +546,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
description: "Load logs onto trucks",
enabled: toys.row1Upgrades[0].bought
})),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.add(toys.clothes.value, 1),
description: "3000 Toys",
enabled: toys.milestones.milestone7.earned
})),
createExponentialModifier(() => ({
exponent: 1.2,
description: "100% Foundation Completed",

View file

@ -4,7 +4,8 @@
*/
import HotkeyVue from "components/Hotkey.vue";
import Spacer from "components/layout/Spacer.vue";
import { createCollapsibleMilestones } from "data/common";
import Modal from "components/Modal.vue";
import { createCollapsibleMilestones, createCollapsibleModifierSections } from "data/common";
import { main } from "data/projEntry";
import { createBar } from "features/bars/bar";
import { createClickable } from "features/clickables/clickable";
@ -20,6 +21,7 @@ import { createMilestone } from "features/milestones/milestone";
import { createResource, displayResource } from "features/resources/resource";
import { BaseLayer, createLayer } from "game/layers";
import {
createAdditiveModifier,
createExponentialModifier,
createMultiplicativeModifier,
createSequentialModifier
@ -28,12 +30,13 @@ import { noPersist, persistent } from "game/persistence";
import Decimal, { DecimalSource, formatWhole } from "util/bignum";
import { Direction } from "util/common";
import { render } from "util/vue";
import { computed, unref, watchEffect } from "vue";
import { computed, ref, unref, watchEffect } from "vue";
import elves from "./elves";
import factory from "./factory";
import management from "./management";
import toys from "./toys";
import trees from "./trees";
import wrappingPaper from "./wrapping-paper";
import toys from "./toys";
const id = "workshop";
const day = 2;
@ -44,17 +47,30 @@ const layer = createLayer(id, function (this: BaseLayer) {
const foundationProgress = createResource<DecimalSource>(0, "foundation progress");
const maxFoundation = createSequentialModifier(() => [
createAdditiveModifier(() => ({
addend: 900,
description: "Hope Level 3",
enabled: management.elfTraining.expandersElfTraining.milestones[2].earned
})),
createAdditiveModifier(() => ({
addend: 200,
description: "Build wooden towers",
enabled: toys.row1Upgrades[2].bought
})),
createAdditiveModifier(() => ({
addend: () => Decimal.times(factory.factoryBuyables.expandFactory.amount.value, 100),
description: "Expand Factory",
enabled: () => Decimal.gt(factory.factoryBuyables.expandFactory.amount.value, 0)
}))
]);
const computedMaxFoundation = computed(() => maxFoundation.apply(100));
const foundationConversion = createIndependentConversion(() => ({
// note: 5423 is a magic number. Don't touch this or it'll self-destruct.
scaling: addHardcap(
addSoftcap(addSoftcap(createPolynomialScaling(250, 1.5), 5423, 1 / 1e10), 1e20, 3e8),
computed(() =>
toys.row1Upgrades[2].bought.value
? 1200
: management.elfTraining.expandersElfTraining.milestones[2].earned.value
? 1000
: 100
)
computedMaxFoundation
),
baseResource: trees.logs,
gainResource: noPersist(foundationProgress),
@ -104,17 +120,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
</span>
</>
)),
visibility: () =>
showIf(
Decimal.lt(
foundationProgress.value,
toys.row1Upgrades[2].bought.value
? 1200
: management.elfTraining.expandersElfTraining.milestones[2].earned.value
? 1000
: 100
)
),
visibility: () => showIf(Decimal.lt(foundationProgress.value, computedMaxFoundation.value)),
canClick: () => {
if (Decimal.lt(trees.logs.value, foundationConversion.nextAt.value)) {
return false;
@ -122,14 +128,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
if (main.isMastery.value && main.currentlyMastering.value?.name === "Trees") {
return false;
}
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)) {
if (Decimal.gte(foundationProgress.value, computedMaxFoundation.value)) {
return false;
}
return true;
@ -337,6 +336,25 @@ const layer = createLayer(id, function (this: BaseLayer) {
)
}));
const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [
{
title: "Max Foundation",
modifier: maxFoundation,
base: 100
}
]);
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
}}
/>
));
watchEffect(() => {
if (main.day.value === day && Decimal.gte(foundationProgress.value, 100)) {
main.completeDay();
@ -381,6 +399,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
collapseMilestones,
minWidth: 700,
buildFoundationHK,
generalTabCollapsed,
display: jsx(() => (
<>
<div>
@ -389,8 +408,21 @@ const layer = createLayer(id, function (this: BaseLayer) {
: main.currentlyMastering.value?.name === name
? `Complete the foundation to decorate the day`
: `${name} Complete!`}
{Decimal.gt(computedMaxFoundation.value, 100) ? (
<>
{" - "}
<button
class="button"
style="display: inline-block;"
onClick={() => (showModifiersModal.value = true)}
>
Check Modifiers
</button>
</>
) : null}
</div>
{render(dayProgress)}
{render(modifiersModal)}
<Spacer />
{masteryEffectActive.value ? (
<>