Changed plastic to give elf

This commit is contained in:
thepaperpilot 2022-12-19 22:21:21 -06:00
parent 268f9a20f6
commit 969b555043
7 changed files with 233 additions and 92 deletions

View file

@ -6,7 +6,7 @@ import Spacer from "components/layout/Spacer.vue";
import Modal from "components/Modal.vue";
import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common";
import { main } from "data/projEntry";
import { createBuyable, GenericBuyable } from "features/buyable";
import { createBuyable } from "features/buyable";
import { createClickable } from "features/clickables/clickable";
import { createCumulativeConversion, createPolynomialScaling } from "features/conversion";
import { jsx, showIf } from "features/feature";
@ -21,10 +21,10 @@ import {
createSequentialModifier,
Modifier
} from "game/modifiers";
import { isPersistent, noPersist, persistent } from "game/persistence";
import { noPersist, persistent } from "game/persistence";
import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
import { WithRequired } from "util/common";
import { render, renderGrid, renderRow } from "util/vue";
import { render, renderGrid } from "util/vue";
import { computed, ComputedRef, ref, unref } from "vue";
import dyes from "./dyes";
import elves, { ElfBuyable } from "./elves";
@ -419,7 +419,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
resource: noPersist(boxes),
cost() {
let v = this.amount.value;
v = Decimal.pow(0.95, paper.books.boxBook.amount.value).times(v);
v = Decimal.pow(0.95, paper.books.boxBook.totalAmount.value).times(v);
let scaling = 10;
if (management.elfTraining.boxElfTraining.milestones[2].earned.value) {
scaling--;
@ -487,7 +487,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
resource: noPersist(boxes),
cost() {
let v = this.amount.value;
v = Decimal.pow(0.95, paper.books.boxBook.amount.value).times(v);
v = Decimal.pow(0.95, paper.books.boxBook.totalAmount.value).times(v);
let scaling = 15;
if (management.elfTraining.boxElfTraining.milestones[2].earned.value) {
scaling--;
@ -549,7 +549,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
resource: noPersist(boxes),
cost() {
let v = this.amount.value;
v = Decimal.pow(0.95, paper.books.boxBook.amount.value).times(v);
v = Decimal.pow(0.95, paper.books.boxBook.totalAmount.value).times(v);
let scaling = 20;
if (management.elfTraining.boxElfTraining.milestones[2].earned.value) {
scaling--;

View file

@ -419,7 +419,6 @@ const layer = createLayer(id, function (this: BaseLayer) {
enabled: elvesMilestone2.earned
}))
]);
const dyeCooldown = createSequentialModifier(() => [
createMultiplicativeModifier(() => ({
multiplier: 2,
@ -438,6 +437,23 @@ const layer = createLayer(id, function (this: BaseLayer) {
enabled: elvesMilestone2.earned
}))
]);
const plasticCooldown = createSequentialModifier(() => [
createMultiplicativeModifier(() => ({
multiplier: 2,
description: "6 Elves Trained",
enabled: elvesMilestone.earned
})),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.times(paper.books.plasticBook.totalAmount.value, 0.1).add(1),
description: "One Plastic Bag",
enabled: () => Decimal.gt(paper.books.plasticBook.totalAmount.value, 0)
})),
createMultiplicativeModifier(() => ({
multiplier: 2,
description: "10 Elves Trained",
enabled: elvesMilestone2.earned
}))
]);
const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [
{
@ -551,6 +567,20 @@ const layer = createLayer(id, function (this: BaseLayer) {
base: 10,
unit: "/s",
visible: management.elfTraining.fertilizerElfTraining.milestones[4].earned
},
{
title: "Carol Auto-Buy Frequency",
modifier: dyeCooldown,
base: 10,
unit: "/s",
visible: wrappingPaper.unlockDyeElfMilestone.earned.value && !main.isMastery.value
},
{
title: "Tinsel Auto-Buy Frequency",
modifier: plasticCooldown,
base: 10,
unit: "/s",
visible: plastic.masteryEffectActive.value
}
]);
const showModifiersModal = ref(false);
@ -947,7 +977,16 @@ const layer = createLayer(id, function (this: BaseLayer) {
buyable.amount.value = Decimal.add(buyable.amount.value, amount);
}
});
const wrappingPaperElves = [dyeElf];
const plasticElf = createElf({
name: "Tinsel",
description:
"Tinsel will automatically purchase all plastic buyables you can afford, without actually spending any resources.",
buyable: Object.values(plastic.buyables),
cooldownModifier: plasticCooldown,
visibility: () => showIf(plastic.masteryEffectActive.value),
buyMax: () => management.elfTraining.plasticElfTraining.milestones[4].earned.value
});
const wrappingPaperElves = [dyeElf, plasticElf];
const elves = {
cuttersElf,
plantersElf,
@ -965,7 +1004,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
heavyDrillElf,
oilElf,
metalElf,
dyeElf
dyeElf,
plasticElf
};
const totalElves = computed(() => Object.values(elves).filter(elf => elf.bought.value).length);
@ -1207,6 +1247,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
buyProgress: persistent<DecimalSource>(0),
amountOfTimesDone: persistent<number>(0),
bought: persistent<boolean>(false)
},
plasticElf: {
buyProgress: persistent<DecimalSource>(0),
amountOfTimesDone: persistent<number>(0),
bought: persistent<boolean>(false)
}
},
milestones: [

View file

@ -187,7 +187,8 @@ const layer = createLayer(id, () => {
"Frosty",
"Cocoa",
"Twinkle",
"Carol"
"Carol",
"Tinsel"
].indexOf(elf.name) + 1;
if (elf.name == "Star" || elf.name == "Bell") {
costMulti /= 3;
@ -849,8 +850,7 @@ const layer = createLayer(id, () => {
createMilestone(() => ({
display: {
requirement: "Gingersnap Level 4",
effectDisplay:
"Raise secondary dyes' first effects to the 1.1"
effectDisplay: "Raise secondary dyes' first effects to the 1.1"
},
visibility: () => showIf(clothElfMilestones[2].earned.value && main.day.value >= 13),
shouldEarn: () => clothElfTraining.level.value >= 4
@ -1093,6 +1093,52 @@ const layer = createLayer(id, () => {
visibility: () => showIf(dyeElfMilestones[3].earned.value && main.day.value >= 16)
}))
] as Array<GenericMilestone>;
const plasticElfMilestones = [
createMilestone(() => ({
display: {
requirement: "Tinsel Level 1",
effectDisplay: "Double plastic gain"
},
shouldEarn: () => plasticElfTraining.level.value >= 1
})),
createMilestone(() => ({
display: {
requirement: "Tinsel Level 2",
effectDisplay: jsx(() => (
<>
Every plastic buyable adds <Sqrt>level</Sqrt> levels to the other plastic
buyables.
</>
))
},
shouldEarn: () => plasticElfTraining.level.value >= 2,
visibility: () => showIf(plasticElfMilestones[0].earned.value)
})),
createMilestone(() => ({
display: {
requirement: "Tinsel Level 3",
effectDisplay: "Refineries don't spend oil"
},
shouldEarn: () => plasticElfTraining.level.value >= 3,
visibility: () => showIf(plasticElfMilestones[1].earned.value)
})),
createMilestone(() => ({
display: {
requirement: "Tinsel Level 4",
effectDisplay: "Increase plastic gain by +1% for each refinery"
},
shouldEarn: () => plasticElfTraining.level.value >= 4,
visibility: () => showIf(plasticElfMilestones[2].earned.value && main.day.value >= 16)
})),
createMilestone(() => ({
display: {
requirement: "Tinsel Level 5",
effectDisplay: "Buy maximum plastic buyables"
},
shouldEarn: () => plasticElfTraining.level.value >= 5,
visibility: () => showIf(plasticElfMilestones[3].earned.value && main.day.value >= 16)
}))
] as Array<GenericMilestone>;
// ------------------------------------------------------------------------------- Milestone display
const currentShown = persistent<string>("Holly");
@ -1160,7 +1206,7 @@ const layer = createLayer(id, () => {
}))
);
const clothElfTraining = createElfTraining(elves.elves.clothElf, clothElfMilestones);
const plasticElfTraining = [paperElfTraining, boxElfTraining, clothElfTraining];
const plasticElvesTraining = [paperElfTraining, boxElfTraining, clothElfTraining];
const coalDrillElfTraining = createElfTraining(
elves.elves.coalDrillElf,
coalDrillElfMilestones
@ -1172,8 +1218,9 @@ const layer = createLayer(id, () => {
heavyDrillElfMilestones
);
const dyeElfTraining = createElfTraining(elves.elves.dyeElf, dyeElfMilestones);
const plasticElfTraining = createElfTraining(elves.elves.plasticElf, plasticElfMilestones);
const row5Elves = [coalDrillElfTraining, heavyDrillElfTraining, oilElfTraining];
const row6Elves = [metalElfTraining, dyeElfTraining];
const row6Elves = [metalElfTraining, dyeElfTraining, plasticElfTraining];
const elfTraining = {
cutterElfTraining,
planterElfTraining,
@ -1191,7 +1238,8 @@ const layer = createLayer(id, () => {
metalElfTraining,
oilElfTraining,
heavyDrillElfTraining,
dyeElfTraining
dyeElfTraining,
plasticElfTraining
};
const day12Elves = [
cutterElfTraining,
@ -1707,6 +1755,12 @@ const layer = createLayer(id, () => {
modifier: dyeElfTraining.elfXPGain,
base: 0.1,
unit: " XP"
},
{
title: "Tinsel XP Gain per Action",
modifier: plasticElfTraining.elfXPGain,
base: 0.1,
unit: " XP"
}
]);
const showModifiersModal = ref(false);
@ -1904,6 +1958,16 @@ const layer = createLayer(id, () => {
{ earned: persistent<boolean>(false) },
{ earned: persistent<boolean>(false) }
]
},
plasticElfTraining: {
exp: persistent<DecimalSource>(0),
milestones: [
{ earned: persistent<boolean>(false) },
{ earned: persistent<boolean>(false) },
{ earned: persistent<boolean>(false) },
{ earned: persistent<boolean>(false) },
{ earned: persistent<boolean>(false) }
]
}
},
teaching: { bought: persistent<boolean>(false) },
@ -1990,7 +2054,7 @@ const layer = createLayer(id, () => {
treeElfTraining,
coalElfTraining,
fireElfTraining,
plasticElfTraining,
plasticElvesTraining,
row5Elves,
row6Elves
)}

View file

@ -298,6 +298,12 @@ const layer = createLayer(id, function (this: BaseLayer) {
visibility: () =>
showIf(elves.elves.dyeElf.bought.value && ribbon.milestones.dyeBook.earned.value)
});
const plasticBook = createBook({
name: "One Plastic Bag",
elfName: "Tinsel",
buyableName: "Plastic Buyables",
visibility: () => showIf(plastic.masteryEffectActive.value)
});
const books = {
cuttersBook,
plantersBook,
@ -316,7 +322,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
oilBook,
metalBook,
primaryDyeBook,
secondaryDyeBook
secondaryDyeBook,
plasticBook
};
const sumBooks = computed(() =>
Object.values(books).reduce((acc, curr) => acc.add(curr.amount.value), new Decimal(0))
@ -503,7 +510,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
oilBook: { amount: persistent<DecimalSource>(0) },
metalBook: { amount: persistent<DecimalSource>(0) },
primaryDyeBook: { amount: persistent<DecimalSource>(0) },
secondaryDyeBook: { amount: persistent<DecimalSource>(0) }
secondaryDyeBook: { amount: persistent<DecimalSource>(0) },
plasticBook: { amount: persistent<DecimalSource>(0) }
},
upgrades: {
clothUpgrade: { bought: persistent<boolean>(false) },

View file

@ -28,13 +28,14 @@ import { noPersist, persistent } from "game/persistence";
import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
import { render, renderCol, renderRow } from "util/vue";
import { computed, ComputedRef, ref, unref } from "vue";
import boxes from "./boxes";
import boxes, { BoxesBuyable } from "./boxes";
import dyes from "./dyes";
import elves from "./elves";
import management from "./management";
import metal from "./metal";
import oil from "./oil";
import dyes from "./dyes";
import management from "./management";
import paper from "./paper";
import workshop from "./workshop";
import elves from "./elves";
const id = "plastic";
const day = 10;
@ -65,9 +66,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
const activeRefinery = persistent<DecimalSource>(0);
const oilCost = computed(() =>
Decimal.times(activeRefinery.value, 100).times(
management.elfTraining.oilElfTraining.milestones[3].earned.value ? 5 : 1
)
management.elfTraining.plasticElfTraining.milestones[2].earned.value
? 0
: Decimal.times(activeRefinery.value, 100).times(
management.elfTraining.oilElfTraining.milestones[3].earned.value ? 5 : 1
)
) as ComputedRef<DecimalSource>;
const buildRefinery = createBuyable(() => ({
resource: metal.metal,
@ -206,92 +209,104 @@ const layer = createLayer(id, function (this: BaseLayer) {
const passivePaper = createBuyable(() => ({
resource: noPersist(plastic),
cost() {
const amount = this.amount.value;
return Decimal.pow(1.3, amount).times(100);
let v = passivePaper.amount.value;
v = Decimal.pow(0.95, paper.books.plasticBook.totalAmount.value).times(v);
return Decimal.pow(1.3, v).times(100);
},
inverseCost(x: DecimalSource) {
let v = Decimal.div(x, 100).log(1.3);
v = v.div(Decimal.pow(0.95, paper.books.plasticBook.totalAmount.value));
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
},
visibility: () => showIf(paperElf.bought.value),
display: {
title: "Plastic Printing Press",
description: "Gain +1% of your paper gain per second",
effectDisplay: jsx(() => <>{formatWhole(passivePaper.amount.value)}%</>),
effectDisplay: jsx(() => <>{formatWhole(passivePaper.totalAmount.value)}%</>),
showAmount: false
},
purchase() {
if (!unref(passivePaper.canClick)) {
return;
freeLevels: computed(() => {
let levels: DecimalSource = 0;
if (management.elfTraining.plasticElfTraining.milestones[1].earned.value) {
levels = Decimal.max(passiveBoxes.amount.value, 1)
.sqrt()
.floor()
.add(Decimal.max(clothGains.amount.value, 1).sqrt().floor());
}
const cost = unref(passivePaper.cost) as DecimalSource;
if (!masteryEffectActive.value) {
passivePaper.resource!.value = Decimal.sub(
passivePaper.resource!.value,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
cost!
);
}
passivePaper.amount.value = Decimal.add(passivePaper.amount.value, 1);
passivePaper.onPurchase?.(cost);
}
})) as GenericBuyable;
return levels;
}),
totalAmount: computed(() =>
Decimal.add(passivePaper.amount.value, passivePaper.freeLevels.value)
)
})) as BoxesBuyable;
const passiveBoxes = createBuyable(() => ({
resource: noPersist(plastic),
cost() {
const amount = this.amount.value;
return Decimal.pow(1.3, amount).times(100);
let v = passiveBoxes.amount.value;
v = Decimal.pow(0.95, paper.books.plasticBook.totalAmount.value).times(v);
return Decimal.pow(1.3, v).times(100);
},
inverseCost(x: DecimalSource) {
let v = Decimal.div(x, 100).log(1.3);
v = v.div(Decimal.pow(0.95, paper.books.plasticBook.totalAmount.value));
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
},
visibility: () => showIf(boxElf.bought.value),
display: {
title: "Plastic Box Folder",
description: "Gain +1% of your box gain per second",
effectDisplay: jsx(() => <>{formatWhole(passiveBoxes.amount.value)}%</>),
effectDisplay: jsx(() => <>{formatWhole(passiveBoxes.totalAmount.value)}%</>),
showAmount: false
},
purchase() {
if (!unref(passiveBoxes.canClick)) {
return;
freeLevels: computed(() => {
let levels: DecimalSource = 0;
if (management.elfTraining.plasticElfTraining.milestones[1].earned.value) {
levels = Decimal.max(passivePaper.amount.value, 1)
.sqrt()
.floor()
.add(Decimal.max(clothGains.amount.value, 1).sqrt().floor());
}
const cost = unref(passiveBoxes.cost) as DecimalSource;
if (!masteryEffectActive.value) {
passiveBoxes.resource!.value = Decimal.sub(
passiveBoxes.resource!.value,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
cost!
);
}
passiveBoxes.amount.value = Decimal.add(passiveBoxes.amount.value, 1);
passiveBoxes.onPurchase?.(cost);
}
})) as GenericBuyable;
return levels;
}),
totalAmount: computed(() =>
Decimal.add(passiveBoxes.amount.value, passiveBoxes.freeLevels.value)
)
})) as BoxesBuyable;
const clothGains = createBuyable(() => ({
resource: noPersist(plastic),
cost() {
const amount = this.amount.value;
return Decimal.pow(1.3, amount).times(100);
let v = clothGains.amount.value;
v = Decimal.pow(0.95, paper.books.plasticBook.totalAmount.value).times(v);
return Decimal.pow(1.3, v).times(100);
},
inverseCost(x: DecimalSource) {
let v = Decimal.div(x, 100).log(1.3);
v = v.div(Decimal.pow(0.95, paper.books.plasticBook.totalAmount.value));
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
},
visibility: () => showIf(clothElf.bought.value),
display: {
title: "Plastic Shepherd",
description: "All cloth actions are +10% more efficient",
effectDisplay: jsx(() => (
<>{formatWhole(Decimal.times(clothGains.amount.value, 10))}%</>
<>{formatWhole(Decimal.times(clothGains.totalAmount.value, 10))}%</>
)),
showAmount: false
},
purchase() {
if (!unref(clothGains.canClick)) {
return;
freeLevels: computed(() => {
let levels: DecimalSource = 0;
if (management.elfTraining.plasticElfTraining.milestones[1].earned.value) {
levels = Decimal.max(passivePaper.amount.value, 1)
.sqrt()
.floor()
.add(Decimal.max(passiveBoxes.amount.value, 1).sqrt().floor());
}
const cost = unref(clothGains.cost) as DecimalSource;
if (!masteryEffectActive.value) {
clothGains.resource!.value = Decimal.sub(
clothGains.resource!.value,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
cost!
);
}
clothGains.amount.value = Decimal.add(clothGains.amount.value, 1);
clothGains.onPurchase?.(cost);
}
})) as GenericBuyable;
return levels;
}),
totalAmount: computed(() =>
Decimal.add(clothGains.amount.value, clothGains.freeLevels.value)
)
})) as BoxesBuyable;
const buyables = { passivePaper, passiveBoxes, clothGains };
const plasticGain = createSequentialModifier(() => [
@ -348,6 +363,16 @@ const layer = createLayer(id, function (this: BaseLayer) {
multiplier: () => Decimal.add(dyes.secondaryDyeSum.value, 1).cbrt(),
description: "Colorful Plastic",
enabled: oil.row3Upgrades[2].bought
})),
createMultiplicativeModifier(() => ({
multiplier: 2,
description: "Tinsel Level 1",
enabled: management.elfTraining.plasticElfTraining.milestones[0].earned
})),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.div(buildRefinery.amount.value, 100).add(1),
description: "Tinsel Level 4",
enabled: management.elfTraining.plasticElfTraining.milestones[3].earned
}))
]);
const computedPlasticGain = computed(() => plasticGain.apply(0));
@ -422,8 +447,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
<div class="decoration-effect ribbon">
Decoration effect:
<br />
Repeatable purchases don't spend plastic, and upgrades go up in cost
slower
Unlock a new elf for training, and upgrades go up in cost slower
</div>
<Spacer />
</>
@ -463,7 +487,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
</div>
)),
mastery,
mastered
mastered,
masteryEffectActive
};
});

View file

@ -172,14 +172,8 @@ const layer = createLayer(id, () => {
if (!player.tabs.includes(layer)) {
main.openDay(layer);
}
if (layer === "paper") {
// Purchase first 6 elves
elves.elves.cuttersElf.bought.value = true;
elves.elves.plantersElf.bought.value = true;
elves.elves.expandersElf.bought.value = true;
elves.elves.heatedCuttersElf.bought.value = true;
elves.elves.heatedPlantersElf.bought.value = true;
elves.elves.fertilizerElf.bought.value = true;
if (layer === "cloth") {
elves.elves.plasticElf.bought.value = true;
}
},
style: {

View file

@ -289,7 +289,8 @@ export const main = createLayer("main", function (this: BaseLayer) {
story: "You watch all these elves carrying incredibly large loads just in their open elf-sized hands, and realize there's probably a better way. You need to put the toys in boxes anyways, so why don't we get started working on those so the workers can take advantage as well?",
completedStory:
"Wow, those boxes are really convenient! The workshop feels more and more proper with every day. You tick another requirement on your list and start looking towards tomorrow. Good Job!",
masteredStory: "You look at your massive amounts of boxes, but something doesn't feel right. Oh wait, the elves are only filling the boxes to half the amount that it can actually store! As realisation hits you on how you can make boxes more efficent by using simple methods, you realize that you ought to teach the art of dumping-more-stuff-in-boxes-also-known-as-hoarding to the elves. Whew, that was a lot of work. Great Job!"
masteredStory:
"You look at your massive amounts of boxes, but something doesn't feel right. Oh wait, the elves are only filling the boxes to half the amount that it can actually store! As realisation hits you on how you can make boxes more efficent by using simple methods, you realize that you ought to teach the art of dumping-more-stuff-in-boxes-also-known-as-hoarding to the elves. Whew, that was a lot of work. Great Job!"
})),
createDay(() => ({
day: 7,
@ -299,7 +300,8 @@ export const main = createLayer("main", function (this: BaseLayer) {
story: "You woke up ready to make some toys, before realizing most toys these days are made out of more than just wood! You're sure you're close to really getting to work, but there's a few more materials you're going to need - like metal! Lots of things need metal!",
completedStory:
"The sounds of drills and metal clanging join the already loud din as yet another piece of the puzzle fits into place. You're making solid progress, Good Job!",
masteredStory: "Cling clang clang clang. The sounds of even more drills hit your ears. As you fondly look back at the terrific work you've done, you become more motivated to work harder. Just then, Santa appears in front of you and you scream. He says, \"I see you're working hard. I suggest that you take a break.\" You thank Santa for the break, sit in a chair made by the elves as a gift, and relax."
masteredStory:
"Cling clang clang clang. The sounds of even more drills hit your ears. As you fondly look back at the terrific work you've done, you become more motivated to work harder. Just then, Santa appears in front of you and you scream. He says, \"I see you're working hard. I suggest that you take a break.\" You thank Santa for the break, sit in a chair made by the elves as a gift, and relax."
})),
createDay(() => ({
day: 8,
@ -489,6 +491,9 @@ export const main = createLayer("main", function (this: BaseLayer) {
(completedLayer as any).mastered.value = true;
}
toggleMastery();
if (completedLayer.id === "cloth") {
elves.elves.plasticElf.bought.value = true;
}
}
return {