Fix des malus encombrement

This commit is contained in:
Vincent Vandemeulebrouck
2022-11-19 01:35:01 +01:00
parent f953348f4e
commit 5565bb7a48
5 changed files with 28 additions and 15 deletions

View File

@ -50,14 +50,16 @@ export class RdDRoll extends Dialog {
diffConditions: 0,
diffLibre: rollData.competence?.system.default_diffLibre ?? 0,
malusArmureValue: actor.getMalusArmure(),
surencMalusFlag: actor.isPersonnage() ? (actorData.compteurs.surenc.value < 0) : false,
surencMalusValue: actor.computeMalusSurEncombrement(),
useMalusSurenc: false,
useMoral: false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */
perteMoralEchec: false, /* Pour l'affichage dans le chat */
use: { libre: true, conditions: true, surenc: false, encTotal: false },
use: {
libre: true,
conditions: true,
surenc: false,
encTotal: false
},
isMalusEncombrementTotal: rollData.competence ? RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) : 0,
useMalusEncTotal: false,
encTotal: actor.getEncTotal(),
ajustementAstrologique: actor.ajustementAstrologique(),
surprise: actor.getSurprise(false),
@ -244,6 +246,14 @@ export class RdDRoll extends Dialog {
this.rollData[attribute] = event.currentTarget.checked;
this.updateRollResult();
});
html.find('input.use-encTotal').change((event) => {
this.rollData.use.encTotal = event.currentTarget.checked;
this.updateRollResult();
});
html.find('input.use-surenc').change((event) => {
this.rollData.use.surenc = event.currentTarget.checked;
this.updateRollResult();
});
html.find('.appel-moral').click((event) => { /* l'appel au moral, qui donne un bonus de +1 */
this.rollData.useMoral = !this.rollData.useMoral;
const appelMoral = html.find('.icon-appel-moral')[0];
@ -286,6 +296,7 @@ export class RdDRoll extends Dialog {
$(".div-sort-ptreve-fixe").text(sort.system.ptreve);
const diffVariable = RdDItemSort.isDifficulteVariable(sort);
const coutVariable = RdDItemSort.isCoutVariable(sort);
HtmlUtility._showControlWhen($(".div-sort-non-rituel"), !sort.system.isrituel);
HtmlUtility._showControlWhen($(".div-sort-difficulte-var"), diffVariable);
HtmlUtility._showControlWhen($(".div-sort-difficulte-fixe"), !diffVariable);
@ -318,6 +329,8 @@ export class RdDRoll extends Dialog {
RollDataAjustements.calcul(rollData, this.actor);
rollData.finalLevel = this._computeFinalLevel(rollData);
HtmlUtility._showControlWhen($(".use-encTotal"), rollData.ajustements.encTotal.visible);
HtmlUtility._showControlWhen($(".use-surenc"), rollData.ajustements.surenc.visible);
HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used);
HtmlUtility._showControlWhen($(".divAppelAuMoral"), rollData.use.appelAuMoral);
HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData));