mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-12-03 13:21:31 +00:00
Implement wrapping paper modifiers
This commit is contained in:
parent
a8e52bba9e
commit
5d9096425b
8 changed files with 78 additions and 24 deletions
|
@ -32,6 +32,7 @@ import paper from "./paper";
|
|||
import plastic from "./plastic";
|
||||
import trees from "./trees";
|
||||
import workshop from "./workshop";
|
||||
import wrappingPaper from "./wrapping-paper"
|
||||
|
||||
export type BoxesBuyable = GenericBuyable & {
|
||||
resource: Resource;
|
||||
|
@ -219,7 +220,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
if (management.elfTraining.boxElfTraining.milestones[2].earned.value) {
|
||||
scaling--;
|
||||
}
|
||||
return Decimal.pow(scaling, v).times(100).div(dyes.boosts.orange2.value);
|
||||
return Decimal.pow(scaling, v).times(100).div(dyes.boosts.orange2.value).div(wrappingPaper.boosts.ocean1.value);
|
||||
},
|
||||
visibility: () => showIf(logsUpgrade.bought.value),
|
||||
freeLevels: computed(() =>
|
||||
|
|
|
@ -40,6 +40,7 @@ import paper from "./paper";
|
|||
import trees from "./trees";
|
||||
import dyes from "./dyes";
|
||||
import management from "./management";
|
||||
import wrappingPaper from "./wrapping-paper";
|
||||
|
||||
interface BetterFertilizerUpgOptions {
|
||||
canAfford: () => boolean;
|
||||
|
@ -429,6 +430,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
if (management.elfTraining.heatedCutterElfTraining.milestones[0].earned.value) {
|
||||
v = Decimal.pow(0.95, paper.books.heatedCuttersBook.amount.value).times(v);
|
||||
}
|
||||
v = v.div(wrappingPaper.boosts.rainbow1.value);
|
||||
return Decimal.add(v, 1).pow(2.5).times(10);
|
||||
},
|
||||
display: {
|
||||
|
@ -452,6 +454,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
if (management.elfTraining.heatedPlanterElfTraining.milestones[0].earned.value) {
|
||||
v = Decimal.pow(0.95, paper.books.heatedPlantersBook.amount.value).times(v);
|
||||
}
|
||||
v = v.div(wrappingPaper.boosts.rainbow1.value);
|
||||
return Decimal.add(v, 1).pow(2.5).times(10);
|
||||
},
|
||||
display: {
|
||||
|
@ -475,6 +478,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
if (management.elfTraining.fertilizerElfTraining.milestones[1].earned.value) {
|
||||
v = Decimal.pow(0.95, paper.books.fertilizerBook.amount.value).times(v);
|
||||
}
|
||||
v = v.div(wrappingPaper.boosts.rainbow1.value);
|
||||
return Decimal.add(v, 1).pow(1.5).times(50000);
|
||||
},
|
||||
display: {
|
||||
|
|
|
@ -30,6 +30,7 @@ import management from "./management";
|
|||
import oil from "./oil";
|
||||
import trees from "./trees";
|
||||
import wrappingPaper from "./wrapping-paper";
|
||||
import paper from "./paper";
|
||||
|
||||
interface Dye {
|
||||
name: string;
|
||||
|
@ -195,6 +196,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
let v = buyable.amount.value;
|
||||
if (Decimal.gte(v, 25)) v = Decimal.pow(v, 2).div(20); // intentional price jump #2
|
||||
if (Decimal.gte(v, 10)) v = Decimal.pow(v, 2).div(5); // intentional price jump
|
||||
v = Decimal.mul(v, Decimal.pow(0.95, paper.books.dyeBook.amount.value))
|
||||
return Decimal.div(v, 10).plus(1);
|
||||
},
|
||||
canPurchase: computed((cost?: DecimalSource) => {
|
||||
|
@ -208,17 +210,19 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
}),
|
||||
onPurchase(cost?: DecimalSource) {
|
||||
const trueCost = cost ?? unref(buyable.cost) ?? Decimal.dInf;
|
||||
unref(costs).forEach(c => {
|
||||
c.res.value = Decimal.sub(
|
||||
c.res.value,
|
||||
Decimal.pow(trueCost, unref(c.root ?? 1)).times(unref(c.base))
|
||||
);
|
||||
});
|
||||
|
||||
amount.value = Decimal.add(amount.value, computedToGenerate.value);
|
||||
buyable.amount.value = Decimal.add(buyable.amount.value, 1);
|
||||
|
||||
options.dyesToReset.forEach(dye => dye.reset());
|
||||
if (!wrappingPaper.milestones.secondaryNoReset.earned) {
|
||||
unref(costs).forEach(c => {
|
||||
c.res.value = Decimal.sub(
|
||||
c.res.value,
|
||||
Decimal.pow(trueCost, unref(c.root ?? 1)).times(unref(c.base))
|
||||
);
|
||||
});
|
||||
options.dyesToReset.forEach(dye => dye.reset());
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -35,6 +35,8 @@ import paper from "./paper";
|
|||
import plastic from "./plastic";
|
||||
import trees from "./trees";
|
||||
import workshop from "./workshop";
|
||||
import wrappingPaper from "./wrapping-paper";
|
||||
import dyes from "./dyes";
|
||||
|
||||
const id = "elves";
|
||||
const day = 4;
|
||||
|
@ -381,6 +383,14 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
}))
|
||||
]);
|
||||
|
||||
const dyeCooldown = createSequentialModifier(() => [
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: Infinity,
|
||||
description: "Dye",
|
||||
enabled: () => true
|
||||
}))
|
||||
]);
|
||||
|
||||
const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [
|
||||
{
|
||||
title: "Holly Auto-Buy Frequency",
|
||||
|
@ -508,7 +518,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
));
|
||||
|
||||
const trainingCost = computed(() => {
|
||||
let cost = Decimal.pow(4, totalElves.value).times(1e6);
|
||||
let cost = Decimal.pow(Decimal.sub(4, wrappingPaper.boosts.jazzy1.value), totalElves.value).times(1e6);
|
||||
if (Decimal.gte(totalElves.value, 9)) {
|
||||
cost = Decimal.times(cost, 1e15);
|
||||
}
|
||||
|
@ -520,13 +530,13 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
name: string;
|
||||
description: string;
|
||||
buyable:
|
||||
| (GenericBuyable & { resource: Resource })
|
||||
| (GenericBuyable & { resource: Resource })[];
|
||||
| (GenericBuyable & { resource?: Resource })
|
||||
| (GenericBuyable & { resource?: Resource })[];
|
||||
cooldownModifier: Modifier;
|
||||
customCost?: (amount: DecimalSource) => DecimalSource;
|
||||
hasToggle?: boolean;
|
||||
toggleDesc?: string;
|
||||
onAutoPurchase?: (buyable: GenericBuyable & { resource: Resource }) => void;
|
||||
onAutoPurchase?: (buyable: GenericBuyable & { resource?: Resource }) => void;
|
||||
onPurchase?: VoidFunction; // Will get overriden by the custom onpurchase, but that's fine
|
||||
canBuy?: Computable<boolean>;
|
||||
buyMax?: Computable<boolean>;
|
||||
|
@ -550,12 +560,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
buyable => {
|
||||
while (buyMax ? true : Decimal.gte(buyProgress.value, cooldown)) {
|
||||
if (
|
||||
options.customCost == undefined
|
||||
? unref(buyable.canPurchase)
|
||||
: Decimal.gte(
|
||||
buyable.resource.value,
|
||||
options.customCost(buyable.amount.value)
|
||||
)
|
||||
options.customCost && buyable.resource
|
||||
? Decimal.gte(
|
||||
buyable.resource.value,
|
||||
options.customCost(buyable.amount.value)
|
||||
) : unref(buyable.canPurchase)
|
||||
) {
|
||||
buyable.amount.value = Decimal.add(buyable.amount.value, 1);
|
||||
buyProgress.value = Decimal.sub(buyProgress.value, cooldown);
|
||||
|
@ -830,6 +839,16 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
showIf(management.elfTraining.expandersElfTraining.milestones[4].earned.value)
|
||||
});
|
||||
const managementElves2 = [metalElf];
|
||||
const dyeElf = createElf({
|
||||
name: "Carol",
|
||||
description:
|
||||
"Carol will automatically purchase all dyes you can afford, without actually spending any resources.",
|
||||
buyable: Object.values(dyes.dyes).map(dye => dye.buyable),
|
||||
cooldownModifier: dyeCooldown, // Note: Buy max will be unlocked at this point
|
||||
visibility: () =>
|
||||
showIf(wrappingPaper.milestones.unlockDyeElf.earned.value)
|
||||
});
|
||||
const wrappingPaperElves = [dyeElf];
|
||||
const elves = {
|
||||
cuttersElf,
|
||||
plantersElf,
|
||||
|
@ -846,7 +865,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
miningDrillElf,
|
||||
heavyDrillElf,
|
||||
oilElf,
|
||||
metalElf
|
||||
metalElf,
|
||||
dyeElf,
|
||||
};
|
||||
const totalElves = computed(() => Object.values(elves).filter(elf => elf.bought.value).length);
|
||||
|
||||
|
@ -1032,7 +1052,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
fireElves,
|
||||
plasticElves,
|
||||
managementElves,
|
||||
managementElves2
|
||||
managementElves2.concat(wrappingPaperElves)
|
||||
)}
|
||||
</div>
|
||||
{milestonesDisplay()}
|
||||
|
|
|
@ -29,6 +29,7 @@ import trees from "./trees";
|
|||
import dyes from "./dyes";
|
||||
import management from "./management";
|
||||
import workshop from "./workshop";
|
||||
import wrappingPaper from "./wrapping-paper";
|
||||
|
||||
const id = "paper";
|
||||
const day = 5;
|
||||
|
@ -225,6 +226,13 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
visibility: () =>
|
||||
showIf(management.elfTraining.expandersElfTraining.milestones[4].earned.value)
|
||||
});
|
||||
const dyeBook = createBook({
|
||||
name: "Arts and Crafts",
|
||||
elfName: "Carol",
|
||||
buyableName: "Dye Buyables",
|
||||
visibility: () =>
|
||||
showIf(elves.elves.dyeElf.bought.value)
|
||||
});
|
||||
const books = {
|
||||
cuttersBook,
|
||||
plantersBook,
|
||||
|
@ -241,7 +249,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
miningDrillBook,
|
||||
heavyDrillBook,
|
||||
oilBook,
|
||||
metalBook
|
||||
metalBook,
|
||||
dyeBook
|
||||
};
|
||||
const sumBooks = computed(() =>
|
||||
Object.values(books).reduce((acc, curr) => acc.add(curr.amount.value), new Decimal(0))
|
||||
|
@ -306,6 +315,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
multiplier: 2,
|
||||
description: "1000% Foundation Completed",
|
||||
enabled: workshop.milestones.extraExpansionMilestone5.earned
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: wrappingPaper.boosts.sunshine1,
|
||||
description: "Sunshine Wrapping Paper",
|
||||
enabled: () => Decimal.gte(wrappingPaper.boosts.sunshine1.value, 2)
|
||||
}))
|
||||
]) as WithRequired<Modifier, "description" | "revert">;
|
||||
const ashCost = createSequentialModifier(() => [
|
||||
|
|
|
@ -36,6 +36,7 @@ import elves from "./elves";
|
|||
import management from "./management";
|
||||
import paper from "./paper";
|
||||
import workshop from "./workshop";
|
||||
import wrappingPaper from "./wrapping-paper";
|
||||
const id = "trees";
|
||||
const day = 1;
|
||||
|
||||
|
@ -505,6 +506,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
description: "Noel Level 1",
|
||||
enabled: management.elfTraining.fertilizerElfTraining.milestones[0].earned
|
||||
})),
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: wrappingPaper.boosts.christmas1,
|
||||
description: "Christmas Wrapping Paper",
|
||||
enabled: computed(() => Decimal.gt(wrappingPaper.boosts.christmas1.value, 1))
|
||||
})),
|
||||
createExponentialModifier(() => ({
|
||||
exponent: 1.2,
|
||||
description: "100% Foundation Completed",
|
||||
|
|
|
@ -17,7 +17,7 @@ import { createHotkey } from "features/hotkey";
|
|||
import { createMilestone } from "features/milestones/milestone";
|
||||
import { createResource, displayResource } from "features/resources/resource";
|
||||
import { BaseLayer, createLayer } from "game/layers";
|
||||
import { createExponentialModifier, createSequentialModifier } from "game/modifiers";
|
||||
import { createExponentialModifier, createMultiplicativeModifier, createSequentialModifier } from "game/modifiers";
|
||||
import { noPersist } from "game/persistence";
|
||||
import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
|
||||
import { Direction } from "util/common";
|
||||
|
@ -26,6 +26,7 @@ import { computed, unref, watchEffect } from "vue";
|
|||
import elves from "./elves";
|
||||
import management from "./management";
|
||||
import trees from "./trees";
|
||||
import wrappingPaper from "./wrapping-paper";
|
||||
|
||||
const id = "workshop";
|
||||
const day = 2;
|
||||
|
@ -50,8 +51,13 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
trees.logs.value = Decimal.sub(trees.logs.value, spent);
|
||||
},
|
||||
costModifier: createSequentialModifier(() => [
|
||||
createMultiplicativeModifier(() => ({
|
||||
multiplier: computed(() => wrappingPaper.boosts.beach1.value),
|
||||
description: "Beach Wrapping Paper",
|
||||
enabled: computed(() => Decimal.gt(wrappingPaper.boosts.beach1.value,1))
|
||||
})),
|
||||
createExponentialModifier(() => ({
|
||||
exponent: 0.95,
|
||||
exponent: 0.95, // Needs fixing
|
||||
description: "Holly Level 5",
|
||||
enabled: management.elfTraining.cutterElfTraining.milestones[4].earned
|
||||
}))
|
||||
|
|
|
@ -19,7 +19,6 @@ export default defineConfig({
|
|||
}
|
||||
}
|
||||
},
|
||||
server: { hmr: { clientPort: process.env.CODESPACES ? 443 : undefined } },
|
||||
resolve: {
|
||||
alias: {
|
||||
vue: "vue/dist/vue.esm-bundler.js"
|
||||
|
|
Loading…
Reference in a new issue