mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-28 19:11:42 +00:00
Add pow procgen upgrade type
This commit is contained in:
parent
189cac6942
commit
65c5c392bd
1 changed files with 18 additions and 1 deletions
|
@ -27,6 +27,7 @@ import { addTooltip } from "features/tooltips/tooltip";
|
||||||
import { GenericAchievement, createAchievement } from "features/achievements/achievement";
|
import { GenericAchievement, createAchievement } from "features/achievements/achievement";
|
||||||
import { Computable } from "util/computed";
|
import { Computable } from "util/computed";
|
||||||
import { BoardNode } from "features/boards/board";
|
import { BoardNode } from "features/boards/board";
|
||||||
|
import { createExponentialModifier } from "game/modifiers";
|
||||||
|
|
||||||
export type Treasure = GenericAchievement & {
|
export type Treasure = GenericAchievement & {
|
||||||
update?: (diff: number) => void;
|
update?: (diff: number) => void;
|
||||||
|
@ -90,7 +91,8 @@ export function createPlane(id: string, tier: Resources, seed: number) {
|
||||||
for (let j = 0; j < 4; j++) {
|
for (let j = 0; j < 4; j++) {
|
||||||
const upgradeTypeWeights = {
|
const upgradeTypeWeights = {
|
||||||
add: 1,
|
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(
|
const sumUpgradeTypeWeights = Object.values(upgradeTypeWeights).reduce(
|
||||||
(a, b) => a + b
|
(a, b) => a + b
|
||||||
|
@ -153,6 +155,21 @@ export function createPlane(id: string, tier: Resources, seed: number) {
|
||||||
}));
|
}));
|
||||||
break;
|
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)
|
t.value = Decimal.times(difficulty, random() + 0.5)
|
||||||
.pow_base(2)
|
.pow_base(2)
|
||||||
|
|
Loading…
Reference in a new issue