mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2025-04-01 13:31:07 +00:00
Add displays for influence cost multipliers
This commit is contained in:
parent
cd69af37c0
commit
c8efdea999
1 changed files with 18 additions and 3 deletions
|
@ -53,6 +53,7 @@ import {
|
||||||
} from "./data";
|
} from "./data";
|
||||||
import { GenericPlane, createPlane } from "./planes";
|
import { GenericPlane, createPlane } from "./planes";
|
||||||
import { main } from "./projEntry";
|
import { main } from "./projEntry";
|
||||||
|
import { exponentialFormat } from "util/bignum";
|
||||||
|
|
||||||
export const mine = {
|
export const mine = {
|
||||||
shape: Shape.Diamond,
|
shape: Shape.Diamond,
|
||||||
|
@ -461,12 +462,19 @@ export const portalGenerator = {
|
||||||
};
|
};
|
||||||
} else if (draggingNode?.type === "influence") {
|
} else if (draggingNode?.type === "influence") {
|
||||||
const influence = (draggingNode.state as unknown as InfluenceState).type;
|
const influence = (draggingNode.state as unknown as InfluenceState).type;
|
||||||
const { influences } = node.state as unknown as PortalGeneratorState;
|
const selectedInfluences = (node.state as unknown as PortalGeneratorState).influences;
|
||||||
if (influences.includes(influence)) {
|
if (selectedInfluences.includes(influence)) {
|
||||||
return { text: "Disconnect", color: "var(--accent2)" };
|
return { text: "Disconnect", color: "var(--accent2)" };
|
||||||
}
|
}
|
||||||
|
const cost = influences[influence].cost;
|
||||||
|
let costDisplay;
|
||||||
|
if (Decimal.lt(cost, 1e3)) {
|
||||||
|
costDisplay = formatWhole(cost);
|
||||||
|
} else {
|
||||||
|
costDisplay = exponentialFormat(cost, 0);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
text: "Add influence",
|
text: `Add influence (${costDisplay}x cost)`,
|
||||||
color: "var(--accent2)"
|
color: "var(--accent2)"
|
||||||
};
|
};
|
||||||
} else if (draggingNode?.type === "portal") {
|
} else if (draggingNode?.type === "portal") {
|
||||||
|
@ -650,6 +658,13 @@ export const influence = {
|
||||||
: Shape.Circle,
|
: Shape.Circle,
|
||||||
size: 50,
|
size: 50,
|
||||||
title: node => influences[(node.state as unknown as InfluenceState).type].display,
|
title: node => influences[(node.state as unknown as InfluenceState).type].display,
|
||||||
|
subtitle: node => {
|
||||||
|
const cost = influences[(node.state as unknown as InfluenceState).type].cost;
|
||||||
|
if (Decimal.lt(cost, 1e3)) {
|
||||||
|
return `${formatWhole(cost)}x cost`;
|
||||||
|
}
|
||||||
|
return `${exponentialFormat(cost, 0)}x cost`;
|
||||||
|
},
|
||||||
label: node => {
|
label: node => {
|
||||||
if (node === main.board.selectedNode.value) {
|
if (node === main.board.selectedNode.value) {
|
||||||
const state = node.state as unknown as InfluenceState;
|
const state = node.state as unknown as InfluenceState;
|
||||||
|
|
Loading…
Add table
Reference in a new issue