Update modules/yggdrasill-actor.js

This commit is contained in:
Archonoir-dev 2022-02-21 21:51:38 +00:00
parent 6ea56b85e6
commit 7f029f67f2

View File

@ -280,7 +280,7 @@ export class YggdrasillActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getToutEquipements() { 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() { getArmes() {
@ -289,6 +289,9 @@ export class YggdrasillActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
getArmures() { getArmures() {
return this.data.items.filter( item => item.type == 'armure' && item.data.data.equipe ); 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() { getProuessesMartiales() {
let prouesse = this.data.items.filter( item => item.type == 'prouesse' ); let prouesse = this.data.items.filter( item => item.type == 'prouesse' );
@ -738,13 +741,19 @@ export class YggdrasillActor extends Actor {
getEncTotal( ) { getEncTotal( ) {
let encTotal = 0; let encTotal = 0;
for( let item of this.data.items) { for( let item of this.data.items) {
if (item.type == "equipement" || item.type == "armecc" if (item.type == "equipement" || item.type == "armecc"
|| item.type == "armedist" || item.type == "armure" || item.type == "monnaie") { || item.type == "armedist" || item.type == "armure" || item.type == "monnaie" || item.type == "bouclier") {
encTotal += item.data.data.enc; 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; return encTotal;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getProtectionTotal( ) { getProtectionTotal( ) {
@ -756,6 +765,16 @@ export class YggdrasillActor extends Actor {
} }
return protectionTotal; 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 ) { async incrementeQuantite( objetId ) {