feat: Create the calculateAbilityCost() helper

This commit is contained in:
2025-06-11 21:07:22 +02:00
parent f5bd48c127
commit 7a09ae57e1

View File

@@ -433,6 +433,7 @@
speed: document.getElementById("inp-pool-edge-speed"),
intellect: document.getElementById("inp-pool-edge-intellect"),
};
const inpAbilityCost = document.getElementById("inp-ability-cost");
const inpAbilityEffort = document.getElementById("inp-ability-effort");
const dspAbilityPool = document.getElementById("dsp-ability-pool");
@@ -665,6 +666,19 @@
}
};
const calculateAbilityCost = () => {
var currentPool = getSelectedPool();
if (currentPool === null) return null;
var cost = Number(inpAbilityCost.value);
var effort = Number(inpAbilityEffort.value);
var effortCost = (effort) ? 3 + (effort - 1) * 2 : 0;
var poolEdge = Number(inpPoolEdge[currentPool].value);
return Math.max(0, cost + effortCost - poolEdge);
};
document.addEventListener(
"DOMContentLoaded",
() => {