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}}