diff --git a/modules/yggdrasill-actor-sheet.js b/modules/yggdrasill-actor-sheet.js index ef30404..8c77380 100644 --- a/modules/yggdrasill-actor-sheet.js +++ b/modules/yggdrasill-actor-sheet.js @@ -48,12 +48,14 @@ export class YggdrasillActorSheet extends ActorSheet { blessures: this.actor.getBlessures(), armes: this.actor.getArmes(), armures: this.actor.getArmures(), + boucliers: this.actor.getBoucliers(), prouessesMartiales: this.actor.getProuessesMartiales(), equipements: this.actor.getToutEquipements(), effetsmagiques: this.actor.getEffetsMagiques(), effetsRunes: this.actor.getEffetsDeRunes(), encTotal: this.actor.getEncTotal(), protectionTotal: this.actor.getProtectionTotal(), + dpBouclier: this.actor.getDpBouclier(), monnaies: this.actor.getMonnaies(), sortsSejdr:this.actor.getSortsSejdr(), sortsGaldr:this.actor.getSortsGaldr(), @@ -81,10 +83,10 @@ export class YggdrasillActorSheet extends ActorSheet { dm.total = dm.max + Number(dm.bonusmalus); } /* -------------------------------------------- */ - updateDP( data ) { +updateDP( data ) { let dp = data.caracsecondaire.defensephy; dp.total = dp.max + Number(dp.bonusmalus); - dp.total += (dp.bouclierequipe) ? 3 : 0; + dp.total += this.actor.getDpBouclier(); } /* -------------------------------------------- */ diff --git a/modules/yggdrasill-actor.js b/modules/yggdrasill-actor.js index 221598b..c2ae4d4 100644 --- a/modules/yggdrasill-actor.js +++ b/modules/yggdrasill-actor.js @@ -280,7 +280,7 @@ export class YggdrasillActor extends Actor { } /* -------------------------------------------- */ getToutEquipements() { - return this.data.items.filter( item => item.type == 'equipement' || item.type == 'armure' || item.type == 'armecc' || item.type == 'armedist'); + return this.data.items.filter( item => item.type == 'equipement' || item.type == 'armure' || item.type == 'armecc' || item.type == 'armedist' || item.type == 'bouclier'); } /* -------------------------------------------- */ getArmes() { @@ -289,6 +289,9 @@ export class YggdrasillActor extends Actor { /* -------------------------------------------- */ getArmures() { return this.data.items.filter( item => item.type == 'armure' && item.data.data.equipe ); + } + getBoucliers() { + return this.data.items.filter( item => item.type == 'bouclier' && item.data.data.equipe ); } getProuessesMartiales() { let prouesse = this.data.items.filter( item => item.type == 'prouesse' ); @@ -738,13 +741,19 @@ export class YggdrasillActor extends Actor { getEncTotal( ) { let encTotal = 0; for( let item of this.data.items) { - if (item.type == "equipement" || item.type == "armecc" - || item.type == "armedist" || item.type == "armure" || item.type == "monnaie") { - encTotal += item.data.data.enc; + if (item.type == "equipement" || item.type == "armecc" + || item.type == "armedist" || item.type == "armure" || item.type == "monnaie" || item.type == "bouclier") { + encTotal += (item.data.data.enc * item.data.data.quantite); + } + } + for( let item of this.data.items) { + if (item.type == "bouclier" && item.data.data.equipe) { + encTotal -= (item.data.data.enc * item.data.data.quantite); + encTotal += (item.data.data.enccomb * item.data.data.quantite); } } return encTotal; - } + } /* -------------------------------------------- */ getProtectionTotal( ) { @@ -756,6 +765,16 @@ export class YggdrasillActor extends Actor { } return protectionTotal; } + /* -------------------------------------------- */ + getDpBouclier( ) { + let dpBouclier = 0; + for( let item of this.data.items) { + if (item.type == "bouclier" && item.data.data.equipe) { + dpBouclier += Number(item.data.data.defensebonus); + } + } + return dpBouclier; + } /* -------------------------------------------- */ async incrementeQuantite( objetId ) { diff --git a/system.json b/system.json index f649687..2f4a8a6 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "fvtt-yggdrasill", "title": "Yggdrasill", "description": "Système non-officiel Yggdrasill (7ième Cercle) pour FoundryVTT", - "version": "1.2.0", + "version": "1.2.1", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "9", "compatibleCoreVersion": "9", diff --git a/template.json b/template.json index e3ad41c..36882a4 100644 --- a/template.json +++ b/template.json @@ -128,7 +128,6 @@ "defensephy": { "value": 0, "bonusmalus": 0, - "bouclierequipe": false, "max": 0, "label": "Défense Physique", "abbrev": "dp" @@ -330,6 +329,16 @@ "enc": 0, "valeur": 0, "description": "" + }, + "bouclier": { + "categorie": "", + "equipe": false, + "defensebonus": 0, + "enc": 0, + "enccomb": 0, + "solidite": 0, + "valeur": 0, + "description": "" }, "equipement": { "equipe": false, diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index daef49d..8ec4ffc 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -156,10 +156,6 @@ {{/select}} -
  • - Bouclier ? - -
  • Total : {{caracsec.total}}
  • @@ -372,6 +368,31 @@ {{/each}} + +

    Bouclier (Bonus de défense physique : {{dpBouclier}})

    + + diff --git a/templates/item-bouclier-sheet.html b/templates/item-bouclier-sheet.html new file mode 100644 index 0000000..4ca82ef --- /dev/null +++ b/templates/item-bouclier-sheet.html @@ -0,0 +1,35 @@ +
    +
    + +
    +

    +
    +
    + + {{!-- Sheet Body --}} +
    + +
    +
      +
    • + +
    • +
    • + +
    • +
    • +
    • +
    • +
    • +
    • +
    + + {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} +
    + +
    +