feat: Update ability cost when certain values change on the character sheet
This commit is contained in:
23
index.html
23
index.html
@@ -666,6 +666,8 @@
|
|||||||
if (abilityEffort > maxEffort) {
|
if (abilityEffort > maxEffort) {
|
||||||
inpAbilityEffort.value = maxEffort;
|
inpAbilityEffort.value = maxEffort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateAbilityCostDisplay();
|
||||||
};
|
};
|
||||||
|
|
||||||
const calculateAbilityCost = () => {
|
const calculateAbilityCost = () => {
|
||||||
@@ -700,6 +702,18 @@
|
|||||||
dspAbilityCost.appendChild(document.createTextNode(cost));
|
dspAbilityCost.appendChild(document.createTextNode(cost));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const poolValueChanged = () => {
|
||||||
|
updateAbilityCostDisplay();
|
||||||
|
};
|
||||||
|
|
||||||
|
const poolEdgeChanged = () => {
|
||||||
|
updateAbilityCostDisplay();
|
||||||
|
};
|
||||||
|
|
||||||
|
const abilityCostChanged = () => {
|
||||||
|
updateAbilityCostDisplay();
|
||||||
|
};
|
||||||
|
|
||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
"DOMContentLoaded",
|
"DOMContentLoaded",
|
||||||
() => {
|
() => {
|
||||||
@@ -716,6 +730,15 @@
|
|||||||
.querySelectorAll("input[name=pool-selector]")
|
.querySelectorAll("input[name=pool-selector]")
|
||||||
.forEach((elem) => {elem.addEventListener("change", poolSelectionChanged)});
|
.forEach((elem) => {elem.addEventListener("change", poolSelectionChanged)});
|
||||||
|
|
||||||
|
for (var poolValueInput of Object.values(inpPoolValue)) {
|
||||||
|
poolValueInput.addEventListener("input", poolValueChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var poolEdgeInput of Object.values(inpPoolEdge)) {
|
||||||
|
poolEdgeInput.addEventListener("input", poolEdgeChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
inpAbilityCost.addEventListener("input", abilityCostChanged);
|
||||||
inpAbilityEffort.addEventListener("input", abilityEffortChanged);
|
inpAbilityEffort.addEventListener("input", abilityEffortChanged);
|
||||||
|
|
||||||
btnNoCharCreateCharacter.addEventListener("click", createCharacter);
|
btnNoCharCreateCharacter.addEventListener("click", createCharacter);
|
||||||
|
Reference in New Issue
Block a user