rename EncombrementTotal

This commit is contained in:
Vincent Vandemeulebrouck 2021-01-05 18:39:12 +01:00
parent 6f8858d9c8
commit 3aaef70891
3 changed files with 14 additions and 10 deletions

View File

@ -203,8 +203,12 @@ export class RdDActor extends Actor {
return duplicate(list[0]); return duplicate(list[0]);
} }
getEncombrementTotal() { getEncTotal() {
return this.encTotal ? Math.floor(this.encTotal) : 0 return Math.floor(this.encTotal ?? 0);
}
getSurenc(){
return this.data.data.compteurs?.surenc?.value ?? 0;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -46,10 +46,10 @@ export class RdDRoll extends Dialog {
malusArmureValue: actor.isPersonnage() ? actor.data.data.attributs?.malusarmure?.value ?? 0 : 0, malusArmureValue: actor.isPersonnage() ? actor.data.data.attributs?.malusarmure?.value ?? 0 : 0,
surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false, surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false,
surencMalusValue: actor.isPersonnage() ? actor.data.data.compteurs.surenc.value : 0, surencMalusValue: actor.isPersonnage() ? actor.data.data.compteurs.surenc.value : 0,
surencMalusApply: false, useMalusSurenc: false,
isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence), isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
useMalusEncTotal: false, useMalusEncTotal: false,
encTotal: actor.getEncombrementTotal(), encTotal: actor.getEncTotal(),
ajustementAstrologique: actor.ajustementAstrologique(), ajustementAstrologique: actor.ajustementAstrologique(),
surprise: actor.getSurprise() surprise: actor.getSurprise()
} }
@ -127,7 +127,7 @@ export class RdDRoll extends Dialog {
// Sort management // Sort management
if (rollData.selectedSort) { if (rollData.selectedSort) {
rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord), rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord);
//console.log("Toggle show/hide", rollData.selectedSort); //console.log("Toggle show/hide", rollData.selectedSort);
HtmlUtility._showControlWhen($("#div-sort-difficulte"), RdDItemSort.isDifficulteVariable(rollData.selectedSort)) HtmlUtility._showControlWhen($("#div-sort-difficulte"), RdDItemSort.isDifficulteVariable(rollData.selectedSort))
HtmlUtility._showControlWhen($("#div-sort-ptreve"), RdDItemSort.isCoutVariable(rollData.selectedSort)) HtmlUtility._showControlWhen($("#div-sort-ptreve"), RdDItemSort.isCoutVariable(rollData.selectedSort))
@ -210,8 +210,8 @@ export class RdDRoll extends Dialog {
this.rollData.tactique = event.currentTarget.value; this.rollData.tactique = event.currentTarget.value;
updateRollResult(rollData); updateRollResult(rollData);
}); });
html.find('#surencMalusApply').change((event) => { html.find('#useMalusSurenc').change((event) => {
this.rollData.surencMalusApply = event.currentTarget.checked; this.rollData.useMalusSurenc = event.currentTarget.checked;
updateRollResult(rollData); updateRollResult(rollData);
}); });
html.find('#useMalusEncTotal').change((event) => { html.find('#useMalusEncTotal').change((event) => {
@ -260,7 +260,7 @@ export class RdDRoll extends Dialog {
_computeFinalLevel(rollData) { _computeFinalLevel(rollData) {
const etat = this._isIgnoreEtatGeneral(rollData) ? 0 : Misc.toInt(rollData.etat); const etat = this._isIgnoreEtatGeneral(rollData) ? 0 : Misc.toInt(rollData.etat);
const diffConditions = Misc.toInt(rollData.diffConditions); const diffConditions = Misc.toInt(rollData.diffConditions);
const malusEnc = (rollData.surencMalusApply) ? rollData.surencMalusValue : 0; const malusSurenc = (rollData.useMalusSurenc) ? rollData.surencMalusValue : 0;
const bonusTactique = RdDBonus.bonusAttaque(rollData.tactique); const bonusTactique = RdDBonus.bonusAttaque(rollData.tactique);
const malusEncTotal = (rollData.useMalusEncTotal) ? -rollData.encTotal : 0; const malusEncTotal = (rollData.useMalusEncTotal) ? -rollData.encTotal : 0;
const ajustementChance = RdDResolutionTable.isAjustementAstrologique(rollData) ? rollData.ajustementAstrologique : 0; const ajustementChance = RdDResolutionTable.isAjustementAstrologique(rollData) ? rollData.ajustementAstrologique : 0;
@ -272,7 +272,7 @@ export class RdDRoll extends Dialog {
const diffCompetence = this._computeDiffCompetence(rollData); const diffCompetence = this._computeDiffCompetence(rollData);
const diffMoral = rollData.selectedCarac == this.actor.data.data.carac.volonte ? rollData.moral : 0; const diffMoral = rollData.selectedCarac == this.actor.data.data.carac.volonte ? rollData.moral : 0;
return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusEnc + malusEncTotal + malusArmureValue + diffMeditation + ajustementChance + bonusTactique; return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusSurenc + malusEncTotal + malusArmureValue + diffMeditation + ajustementChance + bonusTactique;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -1,6 +1,6 @@
{{#if surencMalusFlag}} {{#if surencMalusFlag}}
<div class="form-group"> <div class="form-group">
<label for="xp">Appliquer le malus de sur-encombrement ? </label> <label for="xp">Appliquer le malus de sur-encombrement ? </label>
<input class="attribute-value" type="checkbox" id="surencMalusApply" name="surencMalusApply" {{#if surencMalusApply}}checked{{/if}}/> <input class="attribute-value" type="checkbox" id="useMalusSurenc" name="useMalusSurenc" {{#if useMalusSurenc}}checked{{/if}}/>
</div> </div>
{{/if}} {{/if}}