#56 Afficher valeur réussites

This commit is contained in:
sladecraven 2020-12-16 09:07:00 +01:00
parent 260cce4de5
commit d160e647fd

View File

@ -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);
}