#44 - Gestion sur encombrement corrigée

This commit is contained in:
2020-11-27 12:20:13 +01:00
parent dca4e28044
commit 793036d2b8
12 changed files with 83 additions and 29 deletions

View File

@ -142,9 +142,19 @@ export class RdDRollDialog extends Dialog {
console.log("RdDRollDialog - Cout reve", ptreve);
updateRollResult(rollData);
});
html.find('#ptreve-variable').change((event) => {
let ptreve = Misc.toInt(event.currentTarget.value);
this.rollData.selectedSort.data.ptreve_reel = ptreve; // Update the selectedCarac
console.log("RdDRollDialog - Cout reve", ptreve);
updateRollResult(rollData);
});
html.find('#coupsNonMortels').change((event) => {
this.rollData.mortalite = event.currentTarget.checked ? "non-mortel" : "non-mortel";
});
html.find('#surencMalusApply').change((event) => {
this.rollData.surencMalusApply = event.currentTarget.checked;
updateRollResult(rollData);
});
}
/* -------------------------------------------- */
@ -152,14 +162,15 @@ export class RdDRollDialog extends Dialog {
let etat = Misc.toInt(rollData.etat);
const diffLibre = Misc.toInt(rollData.diffLibre);
const diffConditions = Misc.toInt(rollData.diffConditions);
let malusEnc = (rollData.surencMalusApply ) ? rollData.surencMalusValue : 0;
if (rollData.competence) {
return etat + Misc.toInt(rollData.competence.data.niveau) + diffLibre + diffConditions;
return etat + Misc.toInt(rollData.competence.data.niveau) + diffLibre + diffConditions + malusEnc;
}
if (rollData.draconicList) {
let diffSort = (rollData.selectedSort.data.difficulte.toLowerCase() == "variable") ? diffLibre : Misc.toInt(rollData.selectedSort.data.difficulte);
return etat + Misc.toInt(rollData.selectedDraconic.data.niveau) + diffSort + diffConditions;
}
return etat + diffLibre + diffConditions;
return etat + diffLibre + diffConditions + malusEnc;
}
/* -------------------------------------------- */