From 5e5ddd1c3bd61d70e91e844c13d8c7f99a5f47f7 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Sat, 8 Apr 2023 20:21:09 +0200 Subject: [PATCH] Rework combat --- modules/heritiers-utility.js | 21 +++++++++++---------- system.json | 4 ++-- templates/chat-generic-result.html | 6 ------ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/modules/heritiers-utility.js b/modules/heritiers-utility.js index d4e18e0..a34f2da 100644 --- a/modules/heritiers-utility.js +++ b/modules/heritiers-utility.js @@ -334,7 +334,7 @@ export class HeritiersUtility { } } - + /* -------------------------------------------- */ static computeArmeDegats(rollData, actor) { rollData.degatsArme = rollData.arme.system.degats + rollData.marge @@ -416,18 +416,19 @@ export class HeritiersUtility { actor.setFlag("world", "last-initiative", rollData.finalResult) } - // Compute damages, cf p 187 - if (rollData.arme && rollData.isSuccess) { - this.computeArmeDegats(rollData, actor) - } - this.createChatWithRollMode(rollData.alias, { content: await renderTemplate(`systems/fvtt-les-heritiers/templates/chat-generic-result.html`, rollData) }, rollData) - if (rollData.defenderTokenId && rollData.arme && rollData.arme.system.categorie != "trait") { - await this.displayUneDefense(rollData, actor, "Parade", rollData.defenderParade) - await this.displayUneDefense(rollData, actor, "Esquive", rollData.defenderEsquive) + if (rollData.defenderTokenId && rollData.arme) { + if (rollData.arme.system.categorie != "trait" && rollData.arme.system.categorie != "poing" && rollData.arme.system.categorie != "epaule" ) { + await this.displayUneDefense(rollData, actor, "Parade", rollData.defenderParade) + await this.displayUneDefense(rollData, actor, "Esquive", rollData.defenderEsquive) + } else if (rollData.sdValue) { + this.displayUneDefense(rollData, actor, "A Distance", rollData.sdValue) + } else { + ui.notifications.warn("Pas de difficulté positionnée pour l'attaque à distance.") + } } } @@ -559,7 +560,7 @@ export class HeritiersUtility { /* -------------------------------------------- */ static createChatWithRollMode(name, chatOptions, rollData = undefined, rollMode = undefined) { - if ( rollMode == undefined) { + if (rollMode == undefined) { rollMode = game.settings.get("core", "rollMode") } this.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions, rollData) diff --git a/system.json b/system.json index 477295e..d1bfe82 100644 --- a/system.json +++ b/system.json @@ -1,7 +1,7 @@ { "id": "fvtt-les-heritiers", "description": "Les Héritiers pour FoundryVTT", - "version": "10.0.34", + "version": "10.0.35", "authors": [ { "name": "Uberwald/LeRatierBretonnien", @@ -19,7 +19,7 @@ "gridUnits": "m", "license": "LICENSE.txt", "manifest": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/raw/branch/master/system.json", - "download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.0.34.zip", + "download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.0.35.zip", "languages": [ { "lang": "fr", diff --git a/templates/chat-generic-result.html b/templates/chat-generic-result.html index 96d1292..3784c98 100644 --- a/templates/chat-generic-result.html +++ b/templates/chat-generic-result.html @@ -47,9 +47,6 @@ {{#if (gt sdValue "-1")}} {{#if isSuccess}}
  • Succès... - {{#if arme}} -
  • Dégats : {{degatsArme}}
  • - {{/if}} {{else}}
  • Echec...
  • @@ -65,9 +62,6 @@ {{#if isCriticalSuccess}}
  • Réussite Critique !!!
  • - {{#if arme}} -
  • Vous pouvez augmenter les dégats de +2 ou bien bénéficier d'une Aubaine.
  • - {{/if}} {{/if}} {{#if isCriticalFailure}}
  • Echec Critique !!!