Rework jet éthylisme
This commit is contained in:
parent
31c5be26a3
commit
710a768bb6
@ -1590,7 +1590,8 @@ export class RdDActor extends Actor {
|
||||
etat: this.getEtatGeneral({ ethylisme: true }),
|
||||
diffNbDoses: -Number(actorData.data.compteurs.ethylisme.nb_doses || 0),
|
||||
finalLevel: 0,
|
||||
diffConditions: 0
|
||||
diffConditions: 0,
|
||||
ajustementsForce: CONFIG.RDD.difficultesLibres,
|
||||
}
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ethylisme.html', rollData);
|
||||
new RdDRollDialogEthylisme(html, rollData, this, r => this.performEthylisme(r)).render(true);
|
||||
|
@ -16,7 +16,7 @@ export class RdDRollDialogEthylisme extends Dialog {
|
||||
default: "rollButton",
|
||||
buttons: { "rollButton": { label: "Test d'éthylisme", callback: html => this.onButton(html) } }
|
||||
};
|
||||
let dialogOptions = { classes: ["rdddialog"], width: 400, height: 220, 'z-index': 99999 }
|
||||
let dialogOptions = { classes: ["rdddialog"], width: 400, height: 270, 'z-index': 99999 }
|
||||
super(dialogConf, dialogOptions)
|
||||
|
||||
//console.log("ETH", rollData);
|
||||
@ -36,28 +36,27 @@ export class RdDRollDialogEthylisme extends Dialog {
|
||||
this.bringToTop(); // Ensure top level
|
||||
// Get the rollData stuff
|
||||
var rollData = this.rollData;
|
||||
|
||||
function updateRollResult(rollData) {
|
||||
|
||||
rollData.finalLevel = Number(rollData.etat) + Number(rollData.forceAlcool) + rollData.diffNbDoses;
|
||||
|
||||
// Mise à jour valeurs
|
||||
$("#roll-param").text(rollData.vieValue + " / " + Misc.toSignedString(rollData.finalLevel));
|
||||
$(".table-resolution").remove();
|
||||
$("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(rollData.vieValue, rollData.finalLevel));
|
||||
}
|
||||
var dialog = this;
|
||||
|
||||
// Setup everything onload
|
||||
$(function () {
|
||||
$("#forceAlcool").val(Misc.toInt(rollData.forceAlcool));
|
||||
updateRollResult(rollData);
|
||||
dialog.updateRollResult();
|
||||
});
|
||||
|
||||
// Update !
|
||||
html.find('#forceAlcool').change((event) => {
|
||||
rollData.forceAlcool = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus
|
||||
updateRollResult(rollData);
|
||||
dialog.updateRollResult();
|
||||
});
|
||||
}
|
||||
async updateRollResult() {
|
||||
|
||||
this.rollData.finalLevel = Number(this.rollData.etat) + Number(this.rollData.forceAlcool) + this.rollData.diffNbDoses;
|
||||
|
||||
// Mise à jour valeurs
|
||||
$("#roll-param").text(this.rollData.vieValue + " / " + Misc.toSignedString(this.rollData.finalLevel));
|
||||
$(".table-resolution").remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,27 +1,19 @@
|
||||
<form class="rdddialog">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Vie : {{vieValue}}</label>
|
||||
<label>Etat général : {{etat}}</label>
|
||||
<label>Déjà bu : {{diffNbDoses}}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="div-sort-difficulte">
|
||||
<label>Force du breuvage </label>
|
||||
<h2>Boire</h2>
|
||||
<img class="chat-icon" src="systems/foundryvtt-reve-de-dragon/icons/objets/chope_gres.webp" alt="Chope d'alcool"/>
|
||||
<div class="grid grid-2col">
|
||||
<label>Vie</label><label class="flexrow"> {{vieValue}}</label>
|
||||
<label>Etat général</label><label class="flexrow">{{etat}}</label>
|
||||
<label>Déjà bu</label><label class="flexrow">{{diffNbDoses}}</label>
|
||||
<label>Force du breuvage</label>
|
||||
<select name="forceAlcool" id="forceAlcool" data-dtype="number">
|
||||
{{#select forceAlcool}}
|
||||
{{#each ajustementsConditions as |key|}}
|
||||
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||
{{#each ajustementsForce as |key|}}
|
||||
<option value={{key}}>{{key}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
<label>Ajustement final</label><label id="roll-param">10 / 0</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Ajustement final : <label id="roll-param">10 / 0</label> <label name="addon-message" id="addon-message"></label></label>
|
||||
</div>
|
||||
|
||||
<div id="tableResolution"></div>
|
||||
<div id="tableProbaReussite"></div>
|
||||
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user