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]);
}
getEncombrementTotal() {
return this.encTotal ? Math.floor(this.encTotal) : 0
getEncTotal() {
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,
surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false,
surencMalusValue: actor.isPersonnage() ? actor.data.data.compteurs.surenc.value : 0,
surencMalusApply: false,
useMalusSurenc: false,
isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
useMalusEncTotal: false,
encTotal: actor.getEncombrementTotal(),
encTotal: actor.getEncTotal(),
ajustementAstrologique: actor.ajustementAstrologique(),
surprise: actor.getSurprise()
}
@ -127,7 +127,7 @@ export class RdDRoll extends Dialog {
// Sort management
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);
HtmlUtility._showControlWhen($("#div-sort-difficulte"), RdDItemSort.isDifficulteVariable(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;
updateRollResult(rollData);
});
html.find('#surencMalusApply').change((event) => {
this.rollData.surencMalusApply = event.currentTarget.checked;
html.find('#useMalusSurenc').change((event) => {
this.rollData.useMalusSurenc = event.currentTarget.checked;
updateRollResult(rollData);
});
html.find('#useMalusEncTotal').change((event) => {
@ -260,7 +260,7 @@ export class RdDRoll extends Dialog {
_computeFinalLevel(rollData) {
const etat = this._isIgnoreEtatGeneral(rollData) ? 0 : Misc.toInt(rollData.etat);
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 malusEncTotal = (rollData.useMalusEncTotal) ? -rollData.encTotal : 0;
const ajustementChance = RdDResolutionTable.isAjustementAstrologique(rollData) ? rollData.ajustementAstrologique : 0;
@ -272,7 +272,7 @@ export class RdDRoll extends Dialog {
const diffCompetence = this._computeDiffCompetence(rollData);
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}}
<div class="form-group">
<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>
{{/if}}