From 7f029f67f2bef084c72440632eb431f26c4be34c Mon Sep 17 00:00:00 2001 From: Archonoir-dev Date: Mon, 21 Feb 2022 21:51:38 +0000 Subject: [PATCH] Update modules/yggdrasill-actor.js --- modules/yggdrasill-actor.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) 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 ) {