encaissement non mortel
This commit is contained in:
@ -2,54 +2,57 @@
|
||||
* Extend the base Dialog entity by defining a custom window to perform roll.
|
||||
* @extends {Dialog}
|
||||
*/
|
||||
|
||||
export class RdDEncaisser extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor(html, actor) {
|
||||
let myButtons = { rollButton: {
|
||||
label: "Lancer",
|
||||
callback: html => this.performEncaisser(html, false)
|
||||
} };
|
||||
// Common conf
|
||||
let dialogConf = {
|
||||
let dialogConf = {
|
||||
title: "Jet d'Encaissement",
|
||||
content: html,
|
||||
buttons: myButtons,
|
||||
default: "rollButton"
|
||||
buttons: {
|
||||
"mortel": { label: "mortel", callback: html => this.performEncaisser(html, "mortel") },
|
||||
"non-mortel": { label: "non-mortel", callback: html => this.performEncaisser(html, "non-mortel") },
|
||||
"cauchemar": { label: "cauchemar", callback: html => this.performEncaisser(html, "cauchemar") }
|
||||
},
|
||||
default: "coupMortel"
|
||||
}
|
||||
let dialogOptions = { classes: [ "rdddialog"] }
|
||||
|
||||
|
||||
let dialogOptions = {
|
||||
classes: ["rdddialog"],
|
||||
width: 320,
|
||||
height: 240
|
||||
}
|
||||
|
||||
// Select proper roll dialog template and stuff
|
||||
dialogConf.title = "Jet d'Encaissement",
|
||||
dialogOptions.width = 320;
|
||||
dialogOptions.height = 160;
|
||||
super(dialogConf, dialogOptions);
|
||||
|
||||
this.actor = actor;
|
||||
this.actor = actor;
|
||||
this.modifier = 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
performEncaisser (html, isReserve=false) {
|
||||
//console.log("On va encaisser !!", this.modifier);
|
||||
let result = Number(new Roll("2d10").roll().result);
|
||||
result += Number(this.modifier);
|
||||
this.actor.encaisserDommagesHorsCombat(result);
|
||||
//console.log("ENCAISSER:", result);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
/* -------------------------------------------- */
|
||||
performEncaisser(html, mortalite = "mortel") {
|
||||
this.actor.encaisserDommages({
|
||||
degats: new Roll("2d10").roll().total,
|
||||
domArmePlusDom: Number(this.modifier),
|
||||
loc: { result: 0, label: "Corps" },
|
||||
mortalite: mortalite
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Setup everything onload
|
||||
$(function() {
|
||||
$("#modificateurDegats").val( "0" );
|
||||
$(function () {
|
||||
$("#modificateurDegats").val("0");
|
||||
});
|
||||
|
||||
html.find('#modificateurDegats').click((event) => {
|
||||
html.find('#modificateurDegats').click((event) => {
|
||||
this.modifier = event.currentTarget.value; // Update the selected bonus/malus
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user