From 189411eef89671c9236d40183d63b5e5882d4299 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Thu, 25 May 2023 07:23:25 +0200 Subject: [PATCH] v10/v11 compatibility --- modules/hawkmoon-actor.js | 12 +++++++++--- modules/hawkmoon-roll-dialog.js | 10 +++++++--- modules/hawkmoon-utility.js | 16 +++++++++++----- system.json | 5 +++-- templates/chat-generic-result.html | 12 +++++++++++- templates/roll-dialog-generic.html | 8 ++++++++ 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/modules/hawkmoon-actor.js b/modules/hawkmoon-actor.js index 703a3aa..6b7514b 100644 --- a/modules/hawkmoon-actor.js +++ b/modules/hawkmoon-actor.js @@ -599,11 +599,17 @@ export class HawkmoonActor extends Actor { } console.log("DEGATS", arme) let roll + let bonus = 0 if (rollDataInput?.isHeroique) { - roll = new Roll("2d10rr10+" + arme.system.totalDegats).roll({ async: false }) - + if (rollDataInput?.attaqueCharge) { + bonus = 5 + } + roll = new Roll("2d10rr10+" + arme.system.totalDegats + "+" + bonus).roll({ async: false }) } else { - roll = new Roll("1d10+" + arme.system.totalDegats).roll({ async: false }) + if (rollDataInput?.attaqueCharge) { + bonus = 3 + } + roll = new Roll("1d10+" + arme.system.totalDegats + "+" + bonus).roll({ async: false }) } await HawkmoonUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode")); let nbEtatPerdus = 0 diff --git a/modules/hawkmoon-roll-dialog.js b/modules/hawkmoon-roll-dialog.js index d319038..f6e0ba5 100644 --- a/modules/hawkmoon-roll-dialog.js +++ b/modules/hawkmoon-roll-dialog.js @@ -102,9 +102,13 @@ export class HawkmoonRollDialog extends Dialog { html.find('#defenseur-immobilise').change((event) => { this.rollData.defenseurImmobilise = event.currentTarget.checked }) + html.find('#attaque-charge').change((event) => { + this.rollData.attaqueCharge = event.currentTarget.checked + }) + html.find('#attaque-desarme').change((event) => { + this.rollData.attaqueDesarme = event.currentTarget.checked + }) - - - + } } \ No newline at end of file diff --git a/modules/hawkmoon-utility.js b/modules/hawkmoon-utility.js index 9c2060e..0ae3e5d 100644 --- a/modules/hawkmoon-utility.js +++ b/modules/hawkmoon-utility.js @@ -325,7 +325,7 @@ export class HawkmoonUtility { let pa = Math.floor((valueSC - (po * 400)) / 20) let sc = valueSC - (po * 400) - (pa * 20) return { - po: po, pa: pa, sc: sc, valueSC: valueSC + po, pa, sc, valueSC } } @@ -419,7 +419,7 @@ export class HawkmoonUtility { rollData.diceFormula += `+5` } - if (rollData.arme && rollData.arme.system.isDistance) { + if (rollData.arme?.system.isDistance) { rollData.difficulte = __distanceDifficulte[rollData.distanceTir] rollData.difficulte += __tireurDeplacement[rollData.tireurDeplacement] rollData.difficulte += __cibleCouvert[rollData.cibleCouvert] @@ -427,6 +427,10 @@ export class HawkmoonUtility { rollData.difficulte += rollData.cibleDeplace ? 3 : 0 rollData.difficulte += rollData.cibleCaC ? 3 : 0 } + if (rollData.attaqueDesarme) { + rollData.difficulte += 10 + } + // Ajout adversités rollData.diceFormula += `-${rollData.nbAdversites}` @@ -436,7 +440,7 @@ export class HawkmoonUtility { let myRoll = new Roll(rollData.diceFormula).roll({ async: false }) await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")) - rollData.roll = myRoll + rollData.roll = duplicate(myRoll) console.log(">>>> ", myRoll) rollData.finalResult = myRoll.total @@ -457,7 +461,7 @@ export class HawkmoonUtility { let bonusRoll = new Roll(rollData.bonusFormula).roll({ async: false }) await this.showDiceSoNice(bonusRoll, game.settings.get("core", "rollMode")); - rollData.bonusRoll = bonusRoll + rollData.bonusRoll = duplicate(bonusRoll) rollData.finalResult += rollData.bonusRoll.total @@ -571,7 +575,9 @@ export class HawkmoonUtility { tailleCible: "normal", tireurDeplacement: "immobile", cibleCouvert: "aucun", - distanceTir: "porteemoyenne" + distanceTir: "porteemoyenne", + attaqueCharge: false, + attaqueDesarme: false } return rollData } diff --git a/system.json b/system.json index 90a0dfc..a2d6f73 100644 --- a/system.json +++ b/system.json @@ -1,7 +1,7 @@ { "id": "fvtt-hawkmoon-cyd", "description": "Hawkmoon RPG for FoundryVTT (CYD system - French)", - "version": "10.1.14", + "version": "11.0.0", "authors": [ { "name": "Uberwald/LeRatierBretonnien", @@ -35,7 +35,7 @@ "gridUnits": "m", "license": "LICENSE.txt", "manifest": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/raw/branch/master/system.json", - "download": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/archive/fvtt-hawkmoon-cyd-10.1.14.zip", + "download": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/archive/fvtt-hawkmoon-cyd-11.0.0.zip", "languages": [ { "lang": "fr", @@ -156,6 +156,7 @@ "background": "systems/fvtt-hawkmoon-cyd/assets/ui/fond_hawkmoon.webp", "compatibility": { "minimum": "10", + "maximum": "11", "verified": "10" } } \ No newline at end of file diff --git a/templates/chat-generic-result.html b/templates/chat-generic-result.html index d3e50a1..be1d1cf 100644 --- a/templates/chat-generic-result.html +++ b/templates/chat-generic-result.html @@ -42,12 +42,19 @@
  • Total : {{finalResult}}
  • + {{#if attaqueCharge}} +
  • Vous avez chargé : vos adversaires bénéficient de +3 pour vous attaquer
  • + {{/if}} + {{#if difficulte}}
  • SD : {{difficulte}}
  • - + {{#if isSuccess}}
  • Succés...
  • + {{#if attaqueDesarme}} +
  • Vous désarmez votre adversaire ! Son arme tombe hors de sa portée.
  • + {{/if}} {{else}}
  • Echec...
  • {{/if}} @@ -55,6 +62,9 @@ {{#if isHeroique}}
  • Héroïque !!!
  • + {{#if attaqueDesarme}} +
  • ... Et en plus vous récupérez l'arme de votre adversaire dans votre main (si vous le souhaitez) !.
  • + {{/if}} {{/if}} {{#if isDramatique}}
  • Dramatique !!!
  • diff --git a/templates/roll-dialog-generic.html b/templates/roll-dialog-generic.html index 986dd6c..4609032 100644 --- a/templates/roll-dialog-generic.html +++ b/templates/roll-dialog-generic.html @@ -90,6 +90,14 @@ Défenseur immobilisé (+5)? +
    + Charge ? + +
    +
    + Désarmer (SD+10)? + +
    {{else}}
    Tireur en déplacement ?