mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2025-02-26 00:11:40 +00:00
Implement relic influence and treasure type
This commit is contained in:
parent
db9ea0b99a
commit
849f438f55
2 changed files with 42 additions and 13 deletions
|
@ -34,6 +34,7 @@ import {
|
||||||
influences as influenceTypes,
|
influences as influenceTypes,
|
||||||
main,
|
main,
|
||||||
mineLootTable,
|
mineLootTable,
|
||||||
|
relics,
|
||||||
resourceNames
|
resourceNames
|
||||||
} from "./projEntry";
|
} from "./projEntry";
|
||||||
import type { ResourceState, Resources, PortalState } from "./projEntry";
|
import type { ResourceState, Resources, PortalState } from "./projEntry";
|
||||||
|
@ -72,11 +73,16 @@ export function createPlane(
|
||||||
if (influences.some(i => i.type === "decreaseDiff")) {
|
if (influences.some(i => i.type === "decreaseDiff")) {
|
||||||
difficultyRand = difficultyRand / 2;
|
difficultyRand = difficultyRand / 2;
|
||||||
}
|
}
|
||||||
|
if (influences.some(i => i.type === "relic")) {
|
||||||
|
difficultyRand = 1;
|
||||||
|
}
|
||||||
const difficulty = difficultyRand + tierIndex + 1;
|
const difficulty = difficultyRand + tierIndex + 1;
|
||||||
const rewardsLevel = influences.some(i => i.type === "increaseRewards")
|
const rewardsLevel = influences.some(i => i.type === "increaseRewards")
|
||||||
? difficulty + 1
|
? difficulty + 1
|
||||||
: difficulty;
|
: difficulty;
|
||||||
let length = Math.ceil(random() * (tierIndex + 2));
|
let length = influences.some(i => i.type === "relic")
|
||||||
|
? tierIndex + 2
|
||||||
|
: Math.ceil(random() * (tierIndex + 2));
|
||||||
if (influences.some(i => i.type === "increaseLength")) {
|
if (influences.some(i => i.type === "increaseLength")) {
|
||||||
length++;
|
length++;
|
||||||
}
|
}
|
||||||
|
@ -350,9 +356,13 @@ export function createPlane(
|
||||||
? 0
|
? 0
|
||||||
: influences.some(i => i.type === "increaseInfluences")
|
: influences.some(i => i.type === "increaseInfluences")
|
||||||
? 20
|
? 20
|
||||||
: 2
|
: 2,
|
||||||
|
relic: 0
|
||||||
};
|
};
|
||||||
const treasureType = pickRandom(treasureWeights, random);
|
let treasureType = pickRandom(treasureWeights, random);
|
||||||
|
if (i === length - 1 && influences.some(i => i.type === "relic")) {
|
||||||
|
treasureType = "relic";
|
||||||
|
}
|
||||||
let description = "";
|
let description = "";
|
||||||
let update: (diff: number) => void;
|
let update: (diff: number) => void;
|
||||||
let onComplete: VoidFunction;
|
let onComplete: VoidFunction;
|
||||||
|
@ -414,9 +424,7 @@ export function createPlane(
|
||||||
onComplete = () => {
|
onComplete = () => {
|
||||||
if (randomInfluence in main.influenceNodes.value) {
|
if (randomInfluence in main.influenceNodes.value) {
|
||||||
toast.warning(
|
toast.warning(
|
||||||
"Error: ignoring duplicate portal influence (" +
|
`Error: ignoring duplicate portal influence (${influenceTypes[randomInfluence].display})`
|
||||||
influenceTypes[randomInfluence].display +
|
|
||||||
")"
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -438,6 +446,27 @@ export function createPlane(
|
||||||
main.board.nodes.value.push(node);
|
main.board.nodes.value.push(node);
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
case "relic":
|
||||||
|
description = `Gain the ${tier}-tier planar relic (${relics[tier]})`;
|
||||||
|
onComplete = () => {
|
||||||
|
if (!(`${tier}Relic` in main.toolNodes.value)) {
|
||||||
|
const node = {
|
||||||
|
id: getUniqueNodeID(main.board),
|
||||||
|
position: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
|
...main.board.types.portal.nodes.value.find(
|
||||||
|
n => (n.state as unknown as PortalState).id === id
|
||||||
|
)!.position
|
||||||
|
},
|
||||||
|
type: "passive",
|
||||||
|
state: `${tier}Relic`
|
||||||
|
};
|
||||||
|
main.board.placeInAvailableSpace(node);
|
||||||
|
main.board.nodes.value.push(node);
|
||||||
|
} else {
|
||||||
|
toast.warning(`Error: ignoring duplicate relic (${relics[tier]})`);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
const milestoneVisibility = visibility;
|
const milestoneVisibility = visibility;
|
||||||
const cost = nextCost.value;
|
const cost = nextCost.value;
|
||||||
|
|
|
@ -207,7 +207,7 @@ const tools = {
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
const relics = {
|
export const relics = {
|
||||||
dirt: "Replicator",
|
dirt: "Replicator",
|
||||||
sand: "Metal Detector",
|
sand: "Metal Detector",
|
||||||
gravel: "Neural Networks",
|
gravel: "Neural Networks",
|
||||||
|
@ -425,13 +425,13 @@ export const influences = {
|
||||||
description: "Increase rewards level",
|
description: "Increase rewards level",
|
||||||
cost: 1e4,
|
cost: 1e4,
|
||||||
initialData: undefined
|
initialData: undefined
|
||||||
|
},
|
||||||
|
relic: {
|
||||||
|
display: "+relic",
|
||||||
|
description: "Max length/difficulty, add tier-unique relic",
|
||||||
|
cost: 1e6,
|
||||||
|
initialData: undefined
|
||||||
}
|
}
|
||||||
// relic: {
|
|
||||||
// display: "+relic",
|
|
||||||
// description: "Max length/difficulty, add tier-unique relic",
|
|
||||||
// cost: 1e6,
|
|
||||||
// initialData: undefined
|
|
||||||
// }
|
|
||||||
} as const satisfies Record<
|
} as const satisfies Record<
|
||||||
string,
|
string,
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue