Fix des malus encombrement
This commit is contained in:
parent
f953348f4e
commit
5565bb7a48
@ -1280,6 +1280,10 @@ export class RdDActor extends Actor {
|
||||
await item.delete();
|
||||
}
|
||||
|
||||
isSurenc() {
|
||||
return this.isPersonnage() ? (this.system.compteurs.surenc.value < 0) : false
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeMalusSurEncombrement() {
|
||||
switch (this.type) {
|
||||
|
@ -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));
|
||||
|
@ -63,13 +63,13 @@ export const referenceAjustements = {
|
||||
},
|
||||
encTotal: {
|
||||
isVisible: (rollData, actor) => RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
|
||||
isUsed: (rollData, actor) => rollData.useMalusEncTotal,
|
||||
isUsed: (rollData, actor) => rollData.use.encTotal,
|
||||
getLabel: (rollData, actor) => 'Encombrement total',
|
||||
getValue: (rollData, actor) => -actor.getEncTotal()
|
||||
},
|
||||
surenc: {
|
||||
isVisible: (rollData, actor) => rollData.useMalusSurenc,
|
||||
isUsed: (rollData, actor) => rollData.useMalusSurenc,
|
||||
isVisible: (rollData, actor) => actor.isSurenc(),
|
||||
isUsed: (rollData, actor) => rollData.use.surenc,
|
||||
getLabel: (rollData, actor) => 'Sur-encombrement',
|
||||
getValue: (rollData, actor) => actor.computeMalusSurEncombrement()
|
||||
},
|
||||
|
@ -1,8 +1,6 @@
|
||||
{{#if ajustements.encTotal.visible}}
|
||||
<div class="flexrow">
|
||||
<div class="flexrow use-encTotal">
|
||||
<label>
|
||||
<input class="attribute-value checkbox-by-name" type="checkbox" name="useMalusEncTotal" {{#if useMalusEncTotal}}checked{{/if}}/>
|
||||
<input class="attribute-value use-encTotal" type="checkbox" {{#if use.encTotal}}checked{{/if}}/>
|
||||
Appliquer l'encombrement comme malus ({{encTotal}}) ?
|
||||
</label>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
@ -1,8 +1,6 @@
|
||||
{{#if surencMalusFlag}}
|
||||
<div class="flexrow">
|
||||
<div class="flexrow use-surenc">
|
||||
<label>
|
||||
<input class="attribute-value checkbox-by-name" type="checkbox" name="useMalusSurenc" {{#if useMalusSurenc}}checked{{/if}}/>
|
||||
<input class="attribute-value use-surenc" type="checkbox" {{#if useMalusSurenc}}checked{{/if}}/>
|
||||
Appliquer le sur-encombrement
|
||||
</label>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
Loading…
Reference in New Issue
Block a user