#56 Afficher valeur réussites
This commit is contained in:
parent
260cce4de5
commit
d160e647fd
@ -9,6 +9,7 @@ import { RdDUtility } from "./rdd-utility.js";
|
|||||||
|
|
||||||
export class RdDCombat {
|
export class RdDCombat {
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static isActive() {
|
static isActive() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -22,6 +23,7 @@ export class RdDCombat {
|
|||||||
return this.create(attacker, target ? target.actor : undefined, target)
|
return this.create(attacker, target ? target.actor : undefined, target)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static getTarget() {
|
static getTarget() {
|
||||||
if (game.user.targets && game.user.targets.size == 1) {
|
if (game.user.targets && game.user.targets.size == 1) {
|
||||||
for (let target of game.user.targets) {
|
for (let target of game.user.targets) {
|
||||||
@ -31,10 +33,12 @@ export class RdDCombat {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static create(attacker, defender, target = undefined) {
|
static create(attacker, defender, target = undefined) {
|
||||||
return new RdDCombat(attacker, defender, target)
|
return new RdDCombat(attacker, defender, target)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static createForEvent(event) {
|
static createForEvent(event) {
|
||||||
let attackerId = event.currentTarget.attributes['data-attackerId'].value;
|
let attackerId = event.currentTarget.attributes['data-attackerId'].value;
|
||||||
let attacker = game.actors.get(attackerId);
|
let attacker = game.actors.get(attackerId);
|
||||||
@ -49,6 +53,7 @@ export class RdDCombat {
|
|||||||
return this.createUsingTarget(attacker)
|
return this.createUsingTarget(attacker)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
constructor(attacker, defender, target) {
|
constructor(attacker, defender, target) {
|
||||||
this.attacker = attacker;
|
this.attacker = attacker;
|
||||||
this.defender = defender;
|
this.defender = defender;
|
||||||
@ -94,7 +99,8 @@ export class RdDCombat {
|
|||||||
console.log("RdDCombat.attaque >>>", rollData);
|
console.log("RdDCombat.attaque >>>", rollData);
|
||||||
|
|
||||||
const dialog = await RdDRoll.create(this.attacker, 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',
|
name: 'jet-attaque',
|
||||||
label: 'Attaque: ' + (arme ? arme.name : competence.name),
|
label: 'Attaque: ' + (arme ? arme.name : competence.name),
|
||||||
callbacks: [
|
callbacks: [
|
||||||
@ -249,6 +255,7 @@ export class RdDCombat {
|
|||||||
return arme => (arme.type == "arme" && RdDItemCompetence.isCompetenceMelee(arme.data.competence)) || (arme.type == "competencecreature" && arme.data.isparade)
|
return arme => (arme.type == "arme" && RdDItemCompetence.isCompetenceMelee(arme.data.competence)) || (arme.type == "competencecreature" && arme.data.isparade)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_calculMortaliteEncaissement(rollData) {
|
_calculMortaliteEncaissement(rollData) {
|
||||||
const mortalite = this.defender.isEntiteCauchemar() ? "cauchemar" : (rollData.mortalite ? rollData.mortalite : "mortel");
|
const mortalite = this.defender.isEntiteCauchemar() ? "cauchemar" : (rollData.mortalite ? rollData.mortalite : "mortel");
|
||||||
@ -257,6 +264,7 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
_onAttaqueEchecTotal(rollData) {
|
_onAttaqueEchecTotal(rollData) {
|
||||||
console.log("RdDCombat.onEchecTotal >>>", rollData);
|
console.log("RdDCombat.onEchecTotal >>>", rollData);
|
||||||
// TODO: proposer un résultat d'échec total
|
// TODO: proposer un résultat d'échec total
|
||||||
@ -266,6 +274,7 @@ export class RdDCombat {
|
|||||||
ChatUtility.chatWithRollMode(chatOptions, this.attacker.name)
|
ChatUtility.chatWithRollMode(chatOptions, this.attacker.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
_onAttaqueEchec(rollData) {
|
_onAttaqueEchec(rollData) {
|
||||||
console.log("RdDCombat.onAttaqueEchec >>>", rollData);
|
console.log("RdDCombat.onAttaqueEchec >>>", rollData);
|
||||||
let chatOptions = {
|
let chatOptions = {
|
||||||
@ -293,7 +302,8 @@ export class RdDCombat {
|
|||||||
let rollData = this._prepareParade(attackerRoll, arme);
|
let rollData = this._prepareParade(attackerRoll, arme);
|
||||||
|
|
||||||
const dialog = await RdDRoll.create(this.defender, rollData,
|
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',
|
name: 'jet-parade',
|
||||||
label: 'Parade: ' + (arme ? arme.name : rollData.competence.name),
|
label: 'Parade: ' + (arme ? arme.name : rollData.competence.name),
|
||||||
callbacks: [
|
callbacks: [
|
||||||
|
Loading…
Reference in New Issue
Block a user