From 65c5c392bd564ddbdd4f329553dded6c1cd6dffa Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 29 Apr 2023 16:06:43 -0500 Subject: [PATCH] Add pow procgen upgrade type --- src/data/planes.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/data/planes.tsx b/src/data/planes.tsx index d1b96da..fddeb62 100644 --- a/src/data/planes.tsx +++ b/src/data/planes.tsx @@ -27,6 +27,7 @@ import { addTooltip } from "features/tooltips/tooltip"; import { GenericAchievement, createAchievement } from "features/achievements/achievement"; import { Computable } from "util/computed"; import { BoardNode } from "features/boards/board"; +import { createExponentialModifier } from "game/modifiers"; export type Treasure = GenericAchievement & { update?: (diff: number) => void; @@ -90,7 +91,8 @@ export function createPlane(id: string, tier: Resources, seed: number) { for (let j = 0; j < 4; j++) { const upgradeTypeWeights = { add: 1, - mult: i === 0 && j === 0 ? 0 : 1 + mult: i === 0 && j === 0 ? 0 : 1, + pow: i === 0 ? 0 : 0.5 }; const sumUpgradeTypeWeights = Object.values(upgradeTypeWeights).reduce( (a, b) => a + b @@ -153,6 +155,21 @@ export function createPlane(id: string, tier: Resources, seed: number) { })); break; } + case "pow": { + const exponent = random() / 5 + 1; + description = `Raise ${resource.displayName} gain to the ^${format( + exponent + )}`; + costFormula = costFormula.step(t.value, c => { + const beforeStep = Decimal.sub(t.value, c.evaluate()); + return c.add(beforeStep).pow(exponent).sub(beforeStep); + }); + modifier = createExponentialModifier(() => ({ + exponent, + description: title, + enabled: upgrade.bought + })); + } } t.value = Decimal.times(difficulty, random() + 0.5) .pow_base(2)