Sync effetcts + initiative

This commit is contained in:
2022-01-28 17:27:01 +01:00
parent a4ead72808
commit 44131734bd
10 changed files with 193 additions and 31 deletions

View File

@ -232,6 +232,10 @@ export class PegasusActor extends Actor {
getEquipments() {
return this.data.items.filter(item => item.type == 'shield' || item.type == 'armor' || item.type == "weapon" || item.type == "equipment");
}
/* ------------------------------------------- */
getEquipmentsOnly() {
return duplicate( this.data.items.filter(item => item.type == "equipment") || [] )
}
/* -------------------------------------------- */
getActiveEffects(matching = it => true) {
@ -568,6 +572,25 @@ export class PegasusActor extends Actor {
}
}
}
addWeapons(rollData, statKey) {
let weapons = this.getWeapons()
for (let weapon of weapons) {
if (weapon.data.equipped && weapon.data.statistic == statKey) {
rollData.weaponsList.push( {label: `Attack ${weapon.name}`, type: "attack", applied: false, weapon: weapon, value: 0 } )
}
if (weapon.data.equipped && weapon.data.damagestatistic == statKey) {
rollData.weaponsList.push( {label: `Damage ${weapon.name}`, type: "damage", applied: false, weapon: weapon, value: weapon.data.damage } )
}
}
}
addEquipments(rollData, statKey) {
let equipments = this.getEquipmentsOnly()
for (let equip of equipments) {
if (equip.data.equipped && equip.data.stataffected == statKey) {
rollData.equipmentsList.push( {label: `Item ${equip.name}`, type: "item", applied: false, equip: equip, value: equip.data.level } )
}
}
}
/* -------------------------------------------- */
getCommonRollData(statKey = undefined, useShield = false) {
@ -589,6 +612,8 @@ export class PegasusActor extends Actor {
this.addEffects( rollData)
this.addArmorsShields(rollData, statKey, useShield)
this.addWeapons(rollData, statKey, useShield)
this.addEquipments(rollData, statKey)
return rollData
}