From f5deb4e81fad27cef21c13bb3d9dce7679e08d76 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 22 Jan 2021 23:18:19 +0100 Subject: [PATCH 1/3] Fix /rdd significative --- module/rdd-commands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/rdd-commands.js b/module/rdd-commands.js index 6f1eac94..fccca115 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -215,7 +215,7 @@ export class RdDCommands { caracValue: carac, finalLevel: diff, showDice: true, - diviseur: significative ? 2 : 1, + diviseurSignificative: significative ? 2 : 1, show: { title: "Table de résolution" } }; await RdDResolutionTable.rollData(rollData); From d032d9e5107940a5745758d4a9c0ec966a150a34 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 22 Jan 2021 23:19:17 +0100 Subject: [PATCH 2/3] Plus d'attaque avec l'esquive --- module/actor-sheet.js | 15 +++++---------- templates/actor-sheet.html | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 06db623b..79880544 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -90,16 +90,11 @@ export class RdDActorSheet extends ActorSheet { data.data.combat = duplicate(RdDUtility.checkNull(data.itemsByType['arme'])); data.data.combat = RdDUtility._finalizeArmeList(data.data.combat, data.itemsByType.competence, data.data.carac); - if (data.competenceByCategory && data.competenceByCategory.melee) { - //Specific case for Esquive and Corps à Corps - for (const melee of data.competenceByCategory.melee) { - if (melee.name == "Esquive") - data.data.combat.push({ name: "Esquive", data: { niveau: melee.data.niveau, description: "", force: 6, initiative: "", competence: "Esquive", dommages: 0 } }); - if (melee.name == "Corps à corps") { - let cc_init = RdDUtility.calculInitiative(melee.data.niveau, data.data.carac['melee'].value); - data.data.combat.push(RdDItemArme.mainsNues({ niveau: melee.data.niveau, initiative: cc_init })); - } - } + data.esquive = { name: "Esquive", niveau: data.competenceByCategory?.melee.find(it => it.name == 'Esquive')?.data.niveau ?? -6}; + let corpsACorps = data.competenceByCategory?.melee.find(it => it.name == 'Corps à corps'); + if (corpsACorps) { + let cc_init = RdDUtility.calculInitiative(corpsACorps.data.niveau, data.data.carac['melee'].value); + data.data.combat.push(RdDItemArme.mainsNues({ niveau: corpsACorps.data.niveau, initiative: cc_init })); } this.armesList = duplicate(data.data.combat); diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index f3c9bcc3..5597990d 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -529,14 +529,21 @@ {{#each data.combat as |arme key|}}
  • - {{arme.name}} - {{arme.data.initiative}} + {{arme.name}} + {{arme.data.initiative}} {{arme.data.competence}} - {{numberFormat arme.data.niveau decimals=0 sign=true}} - {{numberFormat arme.data.dommages decimals=0 sign=true}} + {{numberFormat arme.data.niveau decimals=0 sign=true}} + {{numberFormat arme.data.dommages decimals=0 sign=true}}
  • {{/each}} - +
  • + {{esquive.name}} + + + {{numberFormat esquive.niveau decimals=0 sign=true}} + +
  • + {{!-- Compteurs/Blessures Tab --}} From c8ba2f6da936cb68cc77fd4651261e7f6a842c0d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 23 Jan 2021 00:29:03 +0100 Subject: [PATCH 3/3] Fix /tmrr --- module/rdd-commands.js | 13 ++++++++----- module/tmr-utility.js | 15 +++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/module/rdd-commands.js b/module/rdd-commands.js index fccca115..1523cb26 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -31,8 +31,11 @@ export class RdDCommands { rddCommands.registerCommand({ path: ["/tmra"], func: (content, msg, params) => TMRUtility.getTMRAleatoire(), descr: "Tire une case aléatoire des Terres médianes" }); rddCommands.registerCommand({ - path: ["/tmrr"], func: (content, msg, params) => rddCommands.getRencontreTMR(msg, params), - descr: "Exemple: /tmrr forêt 47
    Détermine quelle est la rencontre dans une case 'forêt' pour un jet de dé de 47" + path: ["/tmrr"], func: (content, msg, params) => rddCommands.getRencontreTMR(params), + descr: ` + Exemple: /tmrr foret lance un d100 et détermine la rencontre correspondante en 'forêt' + Exemple: /tmrr forêt 47 détermine la rencontre en 'forêt' pour un jet de dé de 47 + ` }); rddCommands.registerCommand({ @@ -182,8 +185,8 @@ export class RdDCommands { } /* -------------------------------------------- */ - getRencontreTMR(params) { - if (params.length == 2) { + async getRencontreTMR(params) { + if (params.length == 1 || params.length ==2) { return TMRUtility.getRencontre(params[0], params[1]) } else { @@ -226,7 +229,7 @@ export class RdDCommands { async rollDeDraconique(msg) { let ddr = new DeDraconique().evaluate(); ddr.showDice = true; - await RdDDice.show(ddr); + await RdDDice.showDiceSoNice(ddr); RdDCommands._chatAnswer(msg, `Lancer d'un Dé draconique: ${ddr.total}`); } diff --git a/module/tmr-utility.js b/module/tmr-utility.js index 22778d15..29f9a6fd 100644 --- a/module/tmr-utility.js +++ b/module/tmr-utility.js @@ -400,26 +400,25 @@ export class TMRUtility { /* -------------------------------------------- */ /** * Retourne une recontre en fonction de la case et du tirage - * @param {*} caseName + * @param {*} terrain * @param {*} roll */ - static async getRencontre( caseName, roll ) { - if ( !caseName) { + static async getRencontre( terrain, roll ) { + if ( !terrain) { ChatMessage.create({ content: "Un nom de case doit être indiqué (ie /tmrr desert ou /tmrr cite)" }); return false; } - if (roll == undefined) { - roll = new Roll("1d100").evaluate().total; - } + + roll = roll ?? new Roll("1d100").evaluate().total; roll = Math.max(1, Math.min(roll, 100)); - let rencontre = await this.rencontreTMRTypeCase(caseName, roll); + let rencontre = await this.rencontreTMRTypeCase(terrain, roll); if (rencontre) { let force = await this.evaluerForceRencontre(rencontre); ChatMessage.create({ user: game.user._id, whisper: [game.user._id], - content: "Rencontre en " + caseName + "(jet : " + roll + "%)
    Vous rencontrez un " + rencontre.name + " d'une force de " + force + " Points de Rêve"}); + content: `Rencontre en ${terrain} (jet : ${roll}%)
    Vous rencontrez un ${rencontre.name} de ${force} Points de Rêve`}); } return false; }