diff --git a/modules/mournblade-actor.js b/modules/mournblade-actor.js index 3516082..c640fd6 100644 --- a/modules/mournblade-actor.js +++ b/modules/mournblade-actor.js @@ -162,8 +162,8 @@ export class MournbladeActor extends Actor { } /* -------------------------------------------- */ - canEclatDoubleD20( ) { - return ( this.getAlignement() == "loyal" && this.data.data.eclat.value> 0) + canEclatDoubleD20() { + return (this.getAlignement() == "loyal" && this.data.data.eclat.value > 0) } /* -------------------------------------------- */ @@ -234,11 +234,14 @@ export class MournbladeActor extends Actor { rollData.img = this.img rollData.canEclatDoubleD20 = this.canEclatDoubleD20() rollData.doubleD20 = false - + rollData.attributs = MournbladeUtility.getAttributs() + if (attrKey) { rollData.attrKey = attrKey - rollData.actionImg = "systems/fvtt-mournblade/assets/icons/" + this.data.data.attributs[attrKey].labelnorm + ".webp" - rollData.attr = duplicate(this.data.data.attributs[attrKey]) + if (attrKey != "tochoose") { + rollData.actionImg = "systems/fvtt-mournblade/assets/icons/" + this.data.data.attributs[attrKey].labelnorm + ".webp" + rollData.attr = duplicate(this.data.data.attributs[attrKey]) + } } if (compId) { rollData.competence = duplicate(this.data.items.get(compId) || {}) diff --git a/modules/mournblade-roll-dialog.js b/modules/mournblade-roll-dialog.js index b32ec97..da4f9e0 100644 --- a/modules/mournblade-roll-dialog.js +++ b/modules/mournblade-roll-dialog.js @@ -63,6 +63,9 @@ export class MournbladeRollDialog extends Dialog { html.find('#difficulte').change(async (event) => { this.rollData.difficulte = Number(event.currentTarget.value) }) + html.find('#attrKey').change(async (event) => { + this.rollData.attrKey = String(event.currentTarget.value) + }) html.find('#doubleD20').change(async (event) => { this.rollData.doubleD20 = event.currentTarget.checked }) diff --git a/modules/mournblade-utility.js b/modules/mournblade-utility.js index b25b5d6..bbd84b2 100644 --- a/modules/mournblade-utility.js +++ b/modules/mournblade-utility.js @@ -288,11 +288,20 @@ export class MournbladeUtility { /* -------------------------------------------- */ static async rollMournblade(rollData) { + let actor = game.actors.get(rollData.actorId) + if (rollData.attrKey == "tochoose") { // No attr selected, force address + rollData.attrKey = "adr" + } + if ( !rollData.attr) { + console.log("ATTR!!!", rollData.attrKey) + rollData.actionImg = "systems/fvtt-mournblade/assets/icons/" + actor.data.data.attributs[rollData.attrKey].labelnorm + ".webp" + rollData.attr = duplicate(actor.data.data.attributs[rollData.attrKey]) + } + rollData.diceFormula = rollData.mainDice if ( rollData.doubleD20) { // Multiply result ! rollData.diceFormula += "*2" if (!rollData.isReroll) { - let actor = game.actors.get(rollData.actorId) actor.changeEclat(-1) } } diff --git a/system.json b/system.json index 1f0eee0..cc86b02 100644 --- a/system.json +++ b/system.json @@ -17,7 +17,7 @@ "library": false, "license": "LICENSE.txt", "manifest": "https://www.uberwald.me/gitea/public/fvtt-mournblade/raw/branch/main/system.json", - "download": "https://www.uberwald.me/gitea/public/fvtt-mournblade/archive/fvtt-mournblade-0.0.10.zip", + "download": "https://www.uberwald.me/gitea/public/fvtt-mournblade/archive/fvtt-mournblade-0.0.11.zip", "manifestPlusVersion": "1.0.0", "media": [], "minimumCoreVersion": "0.8.0", @@ -70,9 +70,9 @@ "styles": [ "styles/simple.css" ], - "templateVersion": 8, + "templateVersion": 9, "title": "Mournblade", "url": "", - "version": "0.0.10", + "version": "0.0.11", "background": "./images/ui/mournblade_welcome.webp" } \ No newline at end of file diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 3989329..9bfb23b 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -104,7 +104,7 @@ {{#each skills as |skill key|}}