v10.2.5 #577

Merged
uberwald merged 5 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2022-11-19 16:47:18 +01:00
5 changed files with 28 additions and 15 deletions
Showing only changes of commit 5565bb7a48 - Show all commits

View File

@ -1280,6 +1280,10 @@ export class RdDActor extends Actor {
await item.delete(); await item.delete();
} }
isSurenc() {
return this.isPersonnage() ? (this.system.compteurs.surenc.value < 0) : false
}
/* -------------------------------------------- */ /* -------------------------------------------- */
computeMalusSurEncombrement() { computeMalusSurEncombrement() {
switch (this.type) { switch (this.type) {

View File

@ -50,14 +50,16 @@ export class RdDRoll extends Dialog {
diffConditions: 0, diffConditions: 0,
diffLibre: rollData.competence?.system.default_diffLibre ?? 0, diffLibre: rollData.competence?.system.default_diffLibre ?? 0,
malusArmureValue: actor.getMalusArmure(), malusArmureValue: actor.getMalusArmure(),
surencMalusFlag: actor.isPersonnage() ? (actorData.compteurs.surenc.value < 0) : false,
surencMalusValue: actor.computeMalusSurEncombrement(), 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. */ 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 */ 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, isMalusEncombrementTotal: rollData.competence ? RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) : 0,
useMalusEncTotal: false,
encTotal: actor.getEncTotal(), encTotal: actor.getEncTotal(),
ajustementAstrologique: actor.ajustementAstrologique(), ajustementAstrologique: actor.ajustementAstrologique(),
surprise: actor.getSurprise(false), surprise: actor.getSurprise(false),
@ -244,6 +246,14 @@ export class RdDRoll extends Dialog {
this.rollData[attribute] = event.currentTarget.checked; this.rollData[attribute] = event.currentTarget.checked;
this.updateRollResult(); 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 */ html.find('.appel-moral').click((event) => { /* l'appel au moral, qui donne un bonus de +1 */
this.rollData.useMoral = !this.rollData.useMoral; this.rollData.useMoral = !this.rollData.useMoral;
const appelMoral = html.find('.icon-appel-moral')[0]; 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); $(".div-sort-ptreve-fixe").text(sort.system.ptreve);
const diffVariable = RdDItemSort.isDifficulteVariable(sort); const diffVariable = RdDItemSort.isDifficulteVariable(sort);
const coutVariable = RdDItemSort.isCoutVariable(sort); const coutVariable = RdDItemSort.isCoutVariable(sort);
HtmlUtility._showControlWhen($(".div-sort-non-rituel"), !sort.system.isrituel); HtmlUtility._showControlWhen($(".div-sort-non-rituel"), !sort.system.isrituel);
HtmlUtility._showControlWhen($(".div-sort-difficulte-var"), diffVariable); HtmlUtility._showControlWhen($(".div-sort-difficulte-var"), diffVariable);
HtmlUtility._showControlWhen($(".div-sort-difficulte-fixe"), !diffVariable); HtmlUtility._showControlWhen($(".div-sort-difficulte-fixe"), !diffVariable);
@ -318,6 +329,8 @@ export class RdDRoll extends Dialog {
RollDataAjustements.calcul(rollData, this.actor); RollDataAjustements.calcul(rollData, this.actor);
rollData.finalLevel = this._computeFinalLevel(rollData); 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($(".diffMoral"), rollData.ajustements.moralTotal.used);
HtmlUtility._showControlWhen($(".divAppelAuMoral"), rollData.use.appelAuMoral); HtmlUtility._showControlWhen($(".divAppelAuMoral"), rollData.use.appelAuMoral);
HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData)); HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData));

View File

@ -63,13 +63,13 @@ export const referenceAjustements = {
}, },
encTotal: { encTotal: {
isVisible: (rollData, actor) => RdDItemCompetence.isMalusEncombrementTotal(rollData.competence), isVisible: (rollData, actor) => RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
isUsed: (rollData, actor) => rollData.useMalusEncTotal, isUsed: (rollData, actor) => rollData.use.encTotal,
getLabel: (rollData, actor) => 'Encombrement total', getLabel: (rollData, actor) => 'Encombrement total',
getValue: (rollData, actor) => -actor.getEncTotal() getValue: (rollData, actor) => -actor.getEncTotal()
}, },
surenc: { surenc: {
isVisible: (rollData, actor) => rollData.useMalusSurenc, isVisible: (rollData, actor) => actor.isSurenc(),
isUsed: (rollData, actor) => rollData.useMalusSurenc, isUsed: (rollData, actor) => rollData.use.surenc,
getLabel: (rollData, actor) => 'Sur-encombrement', getLabel: (rollData, actor) => 'Sur-encombrement',
getValue: (rollData, actor) => actor.computeMalusSurEncombrement() getValue: (rollData, actor) => actor.computeMalusSurEncombrement()
}, },

View File

@ -1,8 +1,6 @@
{{#if ajustements.encTotal.visible}} <div class="flexrow use-encTotal">
<div class="flexrow">
<label> <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}}) ? Appliquer l'encombrement comme malus ({{encTotal}}) ?
</label> </label>
</div> </div>
{{/if}}

View File

@ -1,8 +1,6 @@
{{#if surencMalusFlag}} <div class="flexrow use-surenc">
<div class="flexrow">
<label> <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 Appliquer le sur-encombrement
</label> </label>
</div> </div>
{{/if}}