From d160e647fd12d5dd7e2d59c3a4016e4bb5eea7e8 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 16 Dec 2020 09:07:00 +0100 Subject: [PATCH] =?UTF-8?q?#56=20Afficher=20valeur=20r=C3=A9ussites?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/rdd-combat.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 15853905..05ceae6f 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -9,6 +9,7 @@ import { RdDUtility } from "./rdd-utility.js"; export class RdDCombat { + /* -------------------------------------------- */ static isActive() { return true; } @@ -22,6 +23,7 @@ export class RdDCombat { return this.create(attacker, target ? target.actor : undefined, target) } + /* -------------------------------------------- */ static getTarget() { if (game.user.targets && game.user.targets.size == 1) { for (let target of game.user.targets) { @@ -31,10 +33,12 @@ export class RdDCombat { return undefined; } + /* -------------------------------------------- */ static create(attacker, defender, target = undefined) { return new RdDCombat(attacker, defender, target) } + /* -------------------------------------------- */ static createForEvent(event) { let attackerId = event.currentTarget.attributes['data-attackerId'].value; let attacker = game.actors.get(attackerId); @@ -49,6 +53,7 @@ export class RdDCombat { return this.createUsingTarget(attacker) } + /* -------------------------------------------- */ constructor(attacker, defender, target) { this.attacker = attacker; this.defender = defender; @@ -94,7 +99,8 @@ export class RdDCombat { console.log("RdDCombat.attaque >>>", rollData); const dialog = await RdDRoll.create(this.attacker, rollData, - { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html' }, { + { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html', + options: { height: 540 } }, { name: 'jet-attaque', label: 'Attaque: ' + (arme ? arme.name : competence.name), callbacks: [ @@ -104,7 +110,7 @@ export class RdDCombat { { condition: RdDResolutionTable.isEchecTotal, action: r => this._onAttaqueEchecTotal(r) }, { condition: RdDResolutionTable.isEchec, action: r => this._onAttaqueEchec(r) } ] - }); + } ); dialog.render(true); } @@ -249,6 +255,7 @@ export class RdDCombat { return arme => (arme.type == "arme" && RdDItemCompetence.isCompetenceMelee(arme.data.competence)) || (arme.type == "competencecreature" && arme.data.isparade) } } + /* -------------------------------------------- */ _calculMortaliteEncaissement(rollData) { const mortalite = this.defender.isEntiteCauchemar() ? "cauchemar" : (rollData.mortalite ? rollData.mortalite : "mortel"); @@ -257,6 +264,7 @@ export class RdDCombat { } + /* -------------------------------------------- */ _onAttaqueEchecTotal(rollData) { console.log("RdDCombat.onEchecTotal >>>", rollData); // TODO: proposer un résultat d'échec total @@ -266,6 +274,7 @@ export class RdDCombat { ChatUtility.chatWithRollMode(chatOptions, this.attacker.name) } + /* -------------------------------------------- */ _onAttaqueEchec(rollData) { console.log("RdDCombat.onAttaqueEchec >>>", rollData); let chatOptions = { @@ -293,7 +302,8 @@ export class RdDCombat { let rollData = this._prepareParade(attackerRoll, arme); const dialog = await RdDRoll.create(this.defender, rollData, - { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html' }, { + { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html', + options: { height: 540 } }, { name: 'jet-parade', label: 'Parade: ' + (arme ? arme.name : rollData.competence.name), callbacks: [ @@ -303,7 +313,7 @@ export class RdDCombat { { condition: RdDResolutionTable.isEchecTotal, action: r => this._onParadeEchecTotal(r) }, { condition: RdDResolutionTable.isEchec, action: r => this._onParadeEchec(r) } ] - }); + } ); dialog.render(true); }