mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-11-21 08:12:41 +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 plastic from "./plastic";
|
||||||
import trees from "./trees";
|
import trees from "./trees";
|
||||||
import workshop from "./workshop";
|
import workshop from "./workshop";
|
||||||
|
import wrappingPaper from "./wrapping-paper"
|
||||||
|
|
||||||
export type BoxesBuyable = GenericBuyable & {
|
export type BoxesBuyable = GenericBuyable & {
|
||||||
resource: Resource;
|
resource: Resource;
|
||||||
|
@ -219,7 +220,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
if (management.elfTraining.boxElfTraining.milestones[2].earned.value) {
|
if (management.elfTraining.boxElfTraining.milestones[2].earned.value) {
|
||||||
scaling--;
|
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),
|
visibility: () => showIf(logsUpgrade.bought.value),
|
||||||
freeLevels: computed(() =>
|
freeLevels: computed(() =>
|
||||||
|
|
|
@ -40,6 +40,7 @@ import paper from "./paper";
|
||||||
import trees from "./trees";
|
import trees from "./trees";
|
||||||
import dyes from "./dyes";
|
import dyes from "./dyes";
|
||||||
import management from "./management";
|
import management from "./management";
|
||||||
|
import wrappingPaper from "./wrapping-paper";
|
||||||
|
|
||||||
interface BetterFertilizerUpgOptions {
|
interface BetterFertilizerUpgOptions {
|
||||||
canAfford: () => boolean;
|
canAfford: () => boolean;
|
||||||
|
@ -429,6 +430,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
if (management.elfTraining.heatedCutterElfTraining.milestones[0].earned.value) {
|
if (management.elfTraining.heatedCutterElfTraining.milestones[0].earned.value) {
|
||||||
v = Decimal.pow(0.95, paper.books.heatedCuttersBook.amount.value).times(v);
|
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);
|
return Decimal.add(v, 1).pow(2.5).times(10);
|
||||||
},
|
},
|
||||||
display: {
|
display: {
|
||||||
|
@ -452,6 +454,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
if (management.elfTraining.heatedPlanterElfTraining.milestones[0].earned.value) {
|
if (management.elfTraining.heatedPlanterElfTraining.milestones[0].earned.value) {
|
||||||
v = Decimal.pow(0.95, paper.books.heatedPlantersBook.amount.value).times(v);
|
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);
|
return Decimal.add(v, 1).pow(2.5).times(10);
|
||||||
},
|
},
|
||||||
display: {
|
display: {
|
||||||
|
@ -475,6 +478,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
if (management.elfTraining.fertilizerElfTraining.milestones[1].earned.value) {
|
if (management.elfTraining.fertilizerElfTraining.milestones[1].earned.value) {
|
||||||
v = Decimal.pow(0.95, paper.books.fertilizerBook.amount.value).times(v);
|
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);
|
return Decimal.add(v, 1).pow(1.5).times(50000);
|
||||||
},
|
},
|
||||||
display: {
|
display: {
|
||||||
|
|
|
@ -30,6 +30,7 @@ import management from "./management";
|
||||||
import oil from "./oil";
|
import oil from "./oil";
|
||||||
import trees from "./trees";
|
import trees from "./trees";
|
||||||
import wrappingPaper from "./wrapping-paper";
|
import wrappingPaper from "./wrapping-paper";
|
||||||
|
import paper from "./paper";
|
||||||
|
|
||||||
interface Dye {
|
interface Dye {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -195,6 +196,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
let v = buyable.amount.value;
|
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, 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
|
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);
|
return Decimal.div(v, 10).plus(1);
|
||||||
},
|
},
|
||||||
canPurchase: computed((cost?: DecimalSource) => {
|
canPurchase: computed((cost?: DecimalSource) => {
|
||||||
|
@ -208,17 +210,19 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
}),
|
}),
|
||||||
onPurchase(cost?: DecimalSource) {
|
onPurchase(cost?: DecimalSource) {
|
||||||
const trueCost = cost ?? unref(buyable.cost) ?? Decimal.dInf;
|
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);
|
amount.value = Decimal.add(amount.value, computedToGenerate.value);
|
||||||
buyable.amount.value = Decimal.add(buyable.amount.value, 1);
|
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 plastic from "./plastic";
|
||||||
import trees from "./trees";
|
import trees from "./trees";
|
||||||
import workshop from "./workshop";
|
import workshop from "./workshop";
|
||||||
|
import wrappingPaper from "./wrapping-paper";
|
||||||
|
import dyes from "./dyes";
|
||||||
|
|
||||||
const id = "elves";
|
const id = "elves";
|
||||||
const day = 4;
|
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(() => [
|
const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [
|
||||||
{
|
{
|
||||||
title: "Holly Auto-Buy Frequency",
|
title: "Holly Auto-Buy Frequency",
|
||||||
|
@ -508,7 +518,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
));
|
));
|
||||||
|
|
||||||
const trainingCost = computed(() => {
|
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)) {
|
if (Decimal.gte(totalElves.value, 9)) {
|
||||||
cost = Decimal.times(cost, 1e15);
|
cost = Decimal.times(cost, 1e15);
|
||||||
}
|
}
|
||||||
|
@ -520,13 +530,13 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
buyable:
|
buyable:
|
||||||
| (GenericBuyable & { resource: Resource })
|
| (GenericBuyable & { resource?: Resource })
|
||||||
| (GenericBuyable & { resource: Resource })[];
|
| (GenericBuyable & { resource?: Resource })[];
|
||||||
cooldownModifier: Modifier;
|
cooldownModifier: Modifier;
|
||||||
customCost?: (amount: DecimalSource) => DecimalSource;
|
customCost?: (amount: DecimalSource) => DecimalSource;
|
||||||
hasToggle?: boolean;
|
hasToggle?: boolean;
|
||||||
toggleDesc?: string;
|
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
|
onPurchase?: VoidFunction; // Will get overriden by the custom onpurchase, but that's fine
|
||||||
canBuy?: Computable<boolean>;
|
canBuy?: Computable<boolean>;
|
||||||
buyMax?: Computable<boolean>;
|
buyMax?: Computable<boolean>;
|
||||||
|
@ -550,12 +560,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
buyable => {
|
buyable => {
|
||||||
while (buyMax ? true : Decimal.gte(buyProgress.value, cooldown)) {
|
while (buyMax ? true : Decimal.gte(buyProgress.value, cooldown)) {
|
||||||
if (
|
if (
|
||||||
options.customCost == undefined
|
options.customCost && buyable.resource
|
||||||
? unref(buyable.canPurchase)
|
? Decimal.gte(
|
||||||
: Decimal.gte(
|
buyable.resource.value,
|
||||||
buyable.resource.value,
|
options.customCost(buyable.amount.value)
|
||||||
options.customCost(buyable.amount.value)
|
) : unref(buyable.canPurchase)
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
buyable.amount.value = Decimal.add(buyable.amount.value, 1);
|
buyable.amount.value = Decimal.add(buyable.amount.value, 1);
|
||||||
buyProgress.value = Decimal.sub(buyProgress.value, cooldown);
|
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)
|
showIf(management.elfTraining.expandersElfTraining.milestones[4].earned.value)
|
||||||
});
|
});
|
||||||
const managementElves2 = [metalElf];
|
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 = {
|
const elves = {
|
||||||
cuttersElf,
|
cuttersElf,
|
||||||
plantersElf,
|
plantersElf,
|
||||||
|
@ -846,7 +865,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
miningDrillElf,
|
miningDrillElf,
|
||||||
heavyDrillElf,
|
heavyDrillElf,
|
||||||
oilElf,
|
oilElf,
|
||||||
metalElf
|
metalElf,
|
||||||
|
dyeElf,
|
||||||
};
|
};
|
||||||
const totalElves = computed(() => Object.values(elves).filter(elf => elf.bought.value).length);
|
const totalElves = computed(() => Object.values(elves).filter(elf => elf.bought.value).length);
|
||||||
|
|
||||||
|
@ -1032,7 +1052,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
fireElves,
|
fireElves,
|
||||||
plasticElves,
|
plasticElves,
|
||||||
managementElves,
|
managementElves,
|
||||||
managementElves2
|
managementElves2.concat(wrappingPaperElves)
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{milestonesDisplay()}
|
{milestonesDisplay()}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import trees from "./trees";
|
||||||
import dyes from "./dyes";
|
import dyes from "./dyes";
|
||||||
import management from "./management";
|
import management from "./management";
|
||||||
import workshop from "./workshop";
|
import workshop from "./workshop";
|
||||||
|
import wrappingPaper from "./wrapping-paper";
|
||||||
|
|
||||||
const id = "paper";
|
const id = "paper";
|
||||||
const day = 5;
|
const day = 5;
|
||||||
|
@ -225,6 +226,13 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
visibility: () =>
|
visibility: () =>
|
||||||
showIf(management.elfTraining.expandersElfTraining.milestones[4].earned.value)
|
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 = {
|
const books = {
|
||||||
cuttersBook,
|
cuttersBook,
|
||||||
plantersBook,
|
plantersBook,
|
||||||
|
@ -241,7 +249,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
miningDrillBook,
|
miningDrillBook,
|
||||||
heavyDrillBook,
|
heavyDrillBook,
|
||||||
oilBook,
|
oilBook,
|
||||||
metalBook
|
metalBook,
|
||||||
|
dyeBook
|
||||||
};
|
};
|
||||||
const sumBooks = computed(() =>
|
const sumBooks = computed(() =>
|
||||||
Object.values(books).reduce((acc, curr) => acc.add(curr.amount.value), new Decimal(0))
|
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,
|
multiplier: 2,
|
||||||
description: "1000% Foundation Completed",
|
description: "1000% Foundation Completed",
|
||||||
enabled: workshop.milestones.extraExpansionMilestone5.earned
|
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">;
|
]) as WithRequired<Modifier, "description" | "revert">;
|
||||||
const ashCost = createSequentialModifier(() => [
|
const ashCost = createSequentialModifier(() => [
|
||||||
|
|
|
@ -36,6 +36,7 @@ import elves from "./elves";
|
||||||
import management from "./management";
|
import management from "./management";
|
||||||
import paper from "./paper";
|
import paper from "./paper";
|
||||||
import workshop from "./workshop";
|
import workshop from "./workshop";
|
||||||
|
import wrappingPaper from "./wrapping-paper";
|
||||||
const id = "trees";
|
const id = "trees";
|
||||||
const day = 1;
|
const day = 1;
|
||||||
|
|
||||||
|
@ -505,6 +506,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
description: "Noel Level 1",
|
description: "Noel Level 1",
|
||||||
enabled: management.elfTraining.fertilizerElfTraining.milestones[0].earned
|
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(() => ({
|
createExponentialModifier(() => ({
|
||||||
exponent: 1.2,
|
exponent: 1.2,
|
||||||
description: "100% Foundation Completed",
|
description: "100% Foundation Completed",
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { createHotkey } from "features/hotkey";
|
||||||
import { createMilestone } from "features/milestones/milestone";
|
import { createMilestone } from "features/milestones/milestone";
|
||||||
import { createResource, displayResource } from "features/resources/resource";
|
import { createResource, displayResource } from "features/resources/resource";
|
||||||
import { BaseLayer, createLayer } from "game/layers";
|
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 { noPersist } 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 } from "util/common";
|
||||||
|
@ -26,6 +26,7 @@ import { computed, unref, watchEffect } from "vue";
|
||||||
import elves from "./elves";
|
import elves from "./elves";
|
||||||
import management from "./management";
|
import management from "./management";
|
||||||
import trees from "./trees";
|
import trees from "./trees";
|
||||||
|
import wrappingPaper from "./wrapping-paper";
|
||||||
|
|
||||||
const id = "workshop";
|
const id = "workshop";
|
||||||
const day = 2;
|
const day = 2;
|
||||||
|
@ -50,8 +51,13 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
trees.logs.value = Decimal.sub(trees.logs.value, spent);
|
trees.logs.value = Decimal.sub(trees.logs.value, spent);
|
||||||
},
|
},
|
||||||
costModifier: createSequentialModifier(() => [
|
costModifier: createSequentialModifier(() => [
|
||||||
|
createMultiplicativeModifier(() => ({
|
||||||
|
multiplier: computed(() => wrappingPaper.boosts.beach1.value),
|
||||||
|
description: "Beach Wrapping Paper",
|
||||||
|
enabled: computed(() => Decimal.gt(wrappingPaper.boosts.beach1.value,1))
|
||||||
|
})),
|
||||||
createExponentialModifier(() => ({
|
createExponentialModifier(() => ({
|
||||||
exponent: 0.95,
|
exponent: 0.95, // Needs fixing
|
||||||
description: "Holly Level 5",
|
description: "Holly Level 5",
|
||||||
enabled: management.elfTraining.cutterElfTraining.milestones[4].earned
|
enabled: management.elfTraining.cutterElfTraining.milestones[4].earned
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -19,7 +19,6 @@ export default defineConfig({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
server: { hmr: { clientPort: process.env.CODESPACES ? 443 : undefined } },
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
vue: "vue/dist/vue.esm-bundler.js"
|
vue: "vue/dist/vue.esm-bundler.js"
|
||||||
|
|
Loading…
Reference in a new issue