diff --git a/module/actor.js b/module/actor.js index b1a05dae..7c882855 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1547,18 +1547,27 @@ export class RdDActor extends Actor { difficultesLibres: CONFIG.RDD.difficultesLibres, etat: this.data.data.compteurs.etat.value, diffConditions: 0, - forceValue :this.data.data.carac.force.value, // Utilisé pour le jet de recul + forceValue : (this.data.data.carac.force) ? this.data.data.carac.force.value : 0, // Utilisé pour le jet de recul diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0, attackerRoll: attackerRoll, finalLevel: 0, coupsNonMortels: false, - malusArmureValue: (this.data.data.attributs) ? this.data.data.attributs.malusarmure.value : 0, - surencMalusFlag: (this.data.data.compteurs.surenc.value < 0), - surencMalusValue: this.data.data.compteurs.surenc.value, + malusArmureValue: 0, + surencMalusFlag: false, + surencMalusValue: 0, surencMalusApply: false, - isNatation: name.toLowerCase().includes("natation"), + isNatation: false, useEncForNatation: false, - encValueForNatation: (this.encombrementTotal) ? Math.round(this.encombrementTotal) : 0 + encValueForNatation: 0 + } + if ( this.type == 'personnage ') { + rollData.malusArmureValue = (this.data.data.attributs) ? this.data.data.attributs.malusarmure.value : 0; + rollData.surencMalusFlag = (this.data.data.compteurs.surenc.value < 0); + rollData.surencMalusValue = this.data.data.compteurs.surenc.value; + rollData.surencMalusApply = false; + rollData.isNatation = name.toLowerCase().includes("natation"); + rollData.useEncForNatation = false; + rollData.encValueForNatation = (this.encombrementTotal) ? Math.round(this.encombrementTotal) : 0; } if ( competence.type == 'competencecreature') { // Specific case for Creatures @@ -1696,7 +1705,11 @@ export class RdDActor extends Actor { { let armeItem = this.getOwnedItem(armeId); // Item.data.data ! console.log("Going to PARY !!!!!!!!!", armeItem, attackerRoll.diffLibre); - this.rollCompetence( armeItem.data.data.competence, armeItem.data, attackerRoll, attacker); + if (armeItem.type == 'competencecreature') { + this.rollCompetence( armeItem.name, armeItem.data, attackerRoll, attacker); + } else { + this.rollCompetence( armeItem.data.data.competence, armeItem.data, attackerRoll, attacker); + } } /* -------------------------------------------- */ diff --git a/module/rdd-utility.js b/module/rdd-utility.js index fe0d2cf5..ace85b4a 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -631,6 +631,8 @@ export class RdDUtility { /* -------------------------------------------- */ static getArmeCategory( arme ) { + if ( arme.data.competence == undefined) return 'competencecreature'; + let compname = arme.data.competence.toLowerCase(); if ( compname.match("hache") ) return "hache"; if ( compname.match("hast") ) return "hast"; @@ -669,13 +671,17 @@ export class RdDUtility { rollMode: true }; - if ( rollData.competence.data.categorie == 'melee' || rollData.competence.data.categorie == 'creature') { // Melee attack or creature + if ( rollData.competence.data.categorie == 'melee' || rollData.competence.data.categorie == 'competencecreature') { // Melee attack or creature let defenderArmes = []; for (const arme of myTarget.data.items) { if (arme.type == "arme" && this.isArmeMelee(arme.data.competence)) { defenderArmes.push( arme ); defenseMsg.content += "
Parer avec " + arme.name + ""; } + if (arme.type == "competencecreature" && arme.data.isparade) { + defenderArmes.push( arme ); + defenseMsg.content += "
Parer avec " + arme.name + ""; + } } defenseMsg.content += "
Esquiver"; } diff --git a/template.json b/template.json index ef915574..06589c9e 100644 --- a/template.json +++ b/template.json @@ -599,6 +599,7 @@ "niveau": 0, "carac_value": 0, "iscombat": false, + "isparade": false, "dommages": 0, "description": "Compétence : ..." }, diff --git a/templates/item-competencecreature-sheet.html b/templates/item-competencecreature-sheet.html index f7a3ab31..9f1ac5ed 100644 --- a/templates/item-competencecreature-sheet.html +++ b/templates/item-competencecreature-sheet.html @@ -20,6 +20,10 @@ +
+ + +