|
|
|
@ -495,7 +495,7 @@ export class PegasusActor extends Actor {
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async activateViceOrVirtue(itemId) {
|
|
|
|
|
let item = this.items.find(item => item.id == itemId)
|
|
|
|
|
if (item && item.system) {
|
|
|
|
|
if (item?.system) {
|
|
|
|
|
let nrg = duplicate(this.system.nrg)
|
|
|
|
|
if (!item.system.activated) { // Current value
|
|
|
|
|
|
|
|
|
@ -581,7 +581,7 @@ export class PegasusActor extends Actor {
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async activatePower(itemId) {
|
|
|
|
|
let item = this.items.find(item => item.id == itemId)
|
|
|
|
|
if (item && item.system) {
|
|
|
|
|
if (item?.system) {
|
|
|
|
|
|
|
|
|
|
let nrg = duplicate(this.system.nrg)
|
|
|
|
|
if (!item.system.activated) { // Current value
|
|
|
|
@ -1467,7 +1467,7 @@ export class PegasusActor extends Actor {
|
|
|
|
|
updates['system.momentum.max'] = momentum
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let mrLevel = (this.system.statistics.agi.value + + this.system.statistics.agi.mod + this.system.statistics.str.value + this.system.statistics.str.mod) - (this.system.statistics.phy.value+this.system.statistics.phy.mod)
|
|
|
|
|
let mrLevel = (this.system.statistics.agi.value + this.system.statistics.agi.mod + this.system.statistics.str.value + this.system.statistics.str.mod) - (this.system.statistics.phy.value+this.system.statistics.phy.mod)
|
|
|
|
|
mrLevel = (mrLevel < 1) ? 1 : mrLevel;
|
|
|
|
|
if (mrLevel != this.system.mr.value) {
|
|
|
|
|
updates['system.mr.value'] = mrLevel
|
|
|
|
@ -1517,6 +1517,11 @@ export class PegasusActor extends Actor {
|
|
|
|
|
let effect = await PegasusUtility.getEffectFromCompendium("Fear")
|
|
|
|
|
this.createEmbeddedDocuments('Item', [effect])
|
|
|
|
|
}
|
|
|
|
|
} else { // Remove fear if healed
|
|
|
|
|
let fear = this.items.find(it => it.name.toLowerCase() == "fear" && it.type == "effect")
|
|
|
|
|
if (fear) {
|
|
|
|
|
this.deleteEmbeddedDocuments('Item', [fear.id])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* Manage flag state for status */
|
|
|
|
|
this.defeatedDisplayed = this.defeatedDisplayed && this.system.secondary.health.status != "defeated"
|
|
|
|
@ -1573,10 +1578,11 @@ export class PegasusActor extends Actor {
|
|
|
|
|
for (let e of effects) {
|
|
|
|
|
meleeBonus += Number(e.system.effectlevel)
|
|
|
|
|
}
|
|
|
|
|
this.baseMDL = this.system.biodata.sizenum + this.system.biodata.sizebonus + this.system.statistics.str.value + this.system.statistics.str.bonuseffect + meleeBonus
|
|
|
|
|
this.baseMDL = this.system.biodata.sizenum + this.system.biodata.sizebonus + this.system.statistics.str.value +
|
|
|
|
|
this.system.statistics.str.mod + this.system.statistics.str.bonuseffect + meleeBonus
|
|
|
|
|
let weaponsMelee = this.items.filter(it => it.type == "weapon" && it.system.damagestatistic.toLowerCase() == "str")
|
|
|
|
|
for (let w of weaponsMelee) {
|
|
|
|
|
let damage = Number(w.system.damage) + this.system.biodata.sizenum + this.system.biodata.sizebonus + this.system.statistics.str.value + this.system.statistics.str.bonuseffect + meleeBonus
|
|
|
|
|
let damage = this.baseMDL + Number(w.system.damage)
|
|
|
|
|
if (damage != w.system.mdl) {
|
|
|
|
|
updates.push({ _id: w.id, "system.mdl": damage })
|
|
|
|
|
}
|
|
|
|
@ -1590,9 +1596,10 @@ export class PegasusActor extends Actor {
|
|
|
|
|
if (role?.name?.toLowerCase() == "ranged") { // Add ranged bonus to ADRL
|
|
|
|
|
roleBonus = this.getRoleLevel()
|
|
|
|
|
}
|
|
|
|
|
this.baseRDL = roleBonus + rangedBonus
|
|
|
|
|
let weaponsRanged = this.items.filter(it => it.type == "weapon" && it.system.damagestatistic.toLowerCase() == "pre")
|
|
|
|
|
for (let w of weaponsRanged) {
|
|
|
|
|
let damage = roleBonus + Number(w.system.damage) + rangedBonus
|
|
|
|
|
let damage = this.baseRDL + Number(w.system.damage)
|
|
|
|
|
if (damage != w.system.rdl) {
|
|
|
|
|
updates.push({ _id: w.id, "system.rdl": damage })
|
|
|
|
|
}
|
|
|
|
@ -1607,10 +1614,11 @@ export class PegasusActor extends Actor {
|
|
|
|
|
if (role?.name?.toLowerCase() == "defender") { // Add defender bonus to ADRL
|
|
|
|
|
roleBonus = this.getRoleLevel()
|
|
|
|
|
}
|
|
|
|
|
this.baseADRL = roleBonus + this.system.statistics.phy.value + this.system.statistics.phy.bonuseffect + this.system.biodata.sizenum + this.system.biodata.sizebonus
|
|
|
|
|
this.baseADRL = roleBonus + armorBonus + this.system.statistics.phy.value + this.system.statistics.phy.mod +
|
|
|
|
|
this.system.statistics.phy.bonuseffect + this.system.biodata.sizenum + this.system.biodata.sizebonus
|
|
|
|
|
let armors = this.items.filter(it => it.type == "armor")
|
|
|
|
|
for (let a of armors) {
|
|
|
|
|
let adrl = roleBonus + this.system.statistics.phy.value + this.system.statistics.phy.bonuseffect + this.system.biodata.sizenum + this.system.biodata.sizebonus + a.system.resistance + armorBonus
|
|
|
|
|
let adrl = this.baseADRL + a.system.resistance
|
|
|
|
|
if (adrl != a.system.adrl) {
|
|
|
|
|
updates.push({ _id: a.id, "system.adrl": adrl })
|
|
|
|
|
}
|
|
|
|
@ -1929,8 +1937,12 @@ export class PegasusActor extends Actor {
|
|
|
|
|
}
|
|
|
|
|
let effects = this.items.filter(item => item.type == 'effect')
|
|
|
|
|
for (let effect of effects) {
|
|
|
|
|
if (effect.system.hindrance) {
|
|
|
|
|
if (effect.system.hindrance && ( effect.system.stataffected == statKey || effect.system.stataffected == "all")) {
|
|
|
|
|
hindrancesDices += effect.system.effectlevel
|
|
|
|
|
if ( effect.system.oneuse) {
|
|
|
|
|
effect.system.isUSed = true // Ensure deletion
|
|
|
|
|
this.deleteEmbeddedDocuments('Item', [effect.id])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (statKey.toLowerCase() == "stl" && this.system.secondary.concealment.status == "exposed") {
|
|
|
|
|