Add displays to influences

This commit is contained in:
thepaperpilot 2023-04-30 15:52:17 -05:00
parent 2fe39e3891
commit a4d1e73762

View file

@ -223,6 +223,7 @@ export type Passives = keyof typeof passives;
export const influences = { export const influences = {
increaseResources: { increaseResources: {
display: "+resource",
description: (state: InfluenceState) => { description: (state: InfluenceState) => {
const resources = state.data as Resources[]; const resources = state.data as Resources[];
if (resources.length === 0) { if (resources.length === 0) {
@ -237,6 +238,7 @@ export const influences = {
initialData: [] initialData: []
}, },
decreaseResources: { decreaseResources: {
display: "-resource",
description: (state: InfluenceState) => { description: (state: InfluenceState) => {
const resources = state.data as Resources[]; const resources = state.data as Resources[];
if (resources.length === 0) { if (resources.length === 0) {
@ -251,51 +253,61 @@ export const influences = {
initialData: [] initialData: []
}, },
increaseLength: { increaseLength: {
display: "+length",
description: "Increase length", description: "Increase length",
cost: 100, cost: 100,
initialData: undefined initialData: undefined
}, },
increaseCaches: { increaseCaches: {
display: "+caches",
description: "Increase caches odds", description: "Increase caches odds",
cost: 10, cost: 10,
initialData: undefined initialData: undefined
}, },
increaseGens: { increaseGens: {
display: "+gens",
description: "Increase generators odds", description: "Increase generators odds",
cost: 10, cost: 10,
initialData: undefined initialData: undefined
}, },
increaseInfluences: { increaseInfluences: {
display: "+influences",
description: "Increase influences odds", description: "Increase influences odds",
cost: 10, cost: 10,
initialData: undefined initialData: undefined
}, },
increaseEnergyMults: { increaseEnergyMults: {
display: "+energy mults",
description: "Increase energy mults odds", description: "Increase energy mults odds",
cost: 10, cost: 10,
initialData: undefined initialData: undefined
}, },
increaseResourceMults: { increaseResourceMults: {
display: "+resource mults",
description: "Increase resource mults odds", description: "Increase resource mults odds",
cost: 10, cost: 10,
initialData: undefined initialData: undefined
}, },
increaseDiff: { increaseDiff: {
display: "+diff",
description: "Increase difficulty/rewards odds", description: "Increase difficulty/rewards odds",
cost: 10, cost: 10,
initialData: undefined initialData: undefined
}, },
decreaseDiff: { decreaseDiff: {
display: "-diff",
description: "Decrease difficulty/rewards odds", description: "Decrease difficulty/rewards odds",
cost: 10, cost: 10,
initialData: undefined initialData: undefined
}, },
increaseRewards: { increaseRewards: {
display: "+rewards",
description: "Increase rewards level", description: "Increase rewards level",
cost: 1e4, cost: 1e4,
initialData: undefined initialData: undefined
} }
// relic: { // relic: {
// display: "+relic",
// description: "Max length/difficulty, add tier-unique relic", // description: "Max length/difficulty, add tier-unique relic",
// cost: 1e6, // cost: 1e6,
// initialData: undefined // initialData: undefined
@ -303,6 +315,7 @@ export const influences = {
} as const satisfies Record< } as const satisfies Record<
string, string,
{ {
display: string;
description: string | ((state: InfluenceState) => string); description: string | ((state: InfluenceState) => string);
cost: DecimalSource; cost: DecimalSource;
initialData?: State; initialData?: State;
@ -465,7 +478,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
if ("tools" in (node.state as object)) { if ("tools" in (node.state as object)) {
return (node.state as { tools: Passives[] }).tools.length > 0; return (node.state as { tools: Passives[] }).tools.length > 0;
} }
return true; return false;
} }
}; };
@ -1059,6 +1072,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
addLayer( addLayer(
createPlane( createPlane(
`portal-${id}`, `portal-${id}`,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
tier!, tier!,
Math.floor(Math.random() * 4294967296), Math.floor(Math.random() * 4294967296),
influences.map( influences.map(
@ -1148,9 +1162,13 @@ export const main = createLayer("main", function (this: BaseLayer) {
draggable: true draggable: true
}, },
influence: { influence: {
shape: Shape.Circle, shape: node =>
(node.state as unknown as InfluenceState).type === "increaseResources" ||
(node.state as unknown as InfluenceState).type === "decreaseResources"
? Shape.Diamond
: Shape.Circle,
size: 50, size: 50,
title: node => (node.state as unknown as InfluenceState).type, title: node => influences[(node.state as unknown as InfluenceState).type].display,
label: node => { label: node => {
if (node === board.selectedNode.value) { if (node === board.selectedNode.value) {
const state = node.state as unknown as InfluenceState; const state = node.state as unknown as InfluenceState;