diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js
index cf66eba..fb146f0 100644
--- a/modules/pegasus-actor.js
+++ b/modules/pegasus-actor.js
@@ -764,17 +764,17 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
modifyStun(incDec) {
- if ( incDec < 0 && (this.system.secondary.confidence.status == "anxious" || this.system.secondary.confidence.status == "lostface") ) {
+ if (incDec < 0 && (this.system.secondary.confidence.status == "anxious" || this.system.secondary.confidence.status == "lostface")) {
ui.notifications.warn("Unable to recover STUN because of Confidence status : " + this.system.secondary.confidence.status)
return
}
let myself = this
let combat = duplicate(myself.system.combat)
combat.stunlevel += incDec
- let daze = this.effects.find( e => e.label == "Daze")
+ let daze = this.effects.find(e => e.label == "Daze")
if (daze && combat.stunlevel == 0) {
- this.deleteEmbeddedDocuments("ActiveEffect", [ daze.id ] )
+ this.deleteEmbeddedDocuments("ActiveEffect", [daze.id])
}
if (combat.stunlevel >= 0) {
myself.update({ 'system.combat': combat })
@@ -786,7 +786,7 @@ export class PegasusActor extends Actor {
if (!daze) {
this.createEmbeddedDocuments("ActiveEffect", [
{ label: 'Daze', icon: 'icons/svg/daze.svg', flags: { core: { statusId: 'daze' } } }
- ])
+ ])
}
if (incDec > 0) {
chatData.content = `
${this.name} suffered a Stun level.
0 ) {
+ if (this.system.combat.stunlevel > 0) {
ui.notifications.warn("Unable to gain/use Momentum while stunned")
return
}
@@ -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
@@ -1578,8 +1578,8 @@ 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.mod + 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 = this.baseMDL + Number(w.system.damage)
@@ -1614,11 +1614,11 @@ export class PegasusActor extends Actor {
if (role?.name?.toLowerCase() == "defender") { // Add defender bonus to ADRL
roleBonus = this.getRoleLevel()
}
- 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
+ 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 = this.baseADRL + a.system.resistance
+ let adrl = this.baseADRL + a.system.resistance
if (adrl != a.system.adrl) {
updates.push({ _id: a.id, "system.adrl": adrl })
}
@@ -1924,6 +1924,18 @@ export class PegasusActor extends Actor {
await this.createEmbeddedDocuments('Item', newItems)
}
+ /* -------------------------------------------- */
+ checkEFfectsHindranceDeletion(statKey) {
+ let toRem = []
+ let effects = this.items.filter(effect => effect.type == 'effect' && effect.system.oneuse &&
+ effect.system.hindrance && (effect.system.stataffected == statKey || effect.system.stataffected == "all"))
+ for (let effect of effects) {
+ toRem.push(effect.id)
+ }
+ if (toRem.length > 0) {
+ this.deleteEmbeddedDocuments('Item', toRem)
+ }
+ }
/* -------------------------------------------- */
computeCurrentHindrances(statKey) {
@@ -1935,15 +1947,9 @@ export class PegasusActor extends Actor {
if (overCapacity > 0) {
hindrancesDices += overCapacity
}
- let effects = this.items.filter(item => item.type == 'effect')
+ let effects = this.items.filter(effect => effect.type == 'effect' && effect.system.hindrance && (effect.system.stataffected == statKey || effect.system.stataffected == "all"))
for (let effect of effects) {
- 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])
- }
- }
+ hindrancesDices += effect.system.effectlevel
}
if (statKey.toLowerCase() == "stl" && this.system.secondary.concealment.status == "exposed") {
hindrancesDices += 1
@@ -2298,7 +2304,7 @@ export class PegasusActor extends Actor {
}
/* -------------------------------------------- */
getExtraTICsFromEffect() {
- let effects = this.items.filter(it => it.type == "effect" && Number(it.system.extratics)>0)
+ let effects = this.items.filter(it => it.type == "effect" && Number(it.system.extratics) > 0)
let nbTics = 0
for (let e of effects) {
nbTics += Number(e.system.extratics)
@@ -2427,8 +2433,8 @@ export class PegasusActor extends Actor {
rollData.title = "MR / Initiative"
rollData.nbTIC = ((this.type == "character") ? 2 : 1) + this.getExtraTICsFromEffect()
rollData.TICs = []
- for(let i=0; i 0) {
- //console.log("Going to remove one use effects", toRem)
- let actor = game.actors.get(rollData.actorId)
actor.deleteEmbeddedDocuments('Item', toRem)
}
+ actor.checkEFfectsHindranceDeletion(rollData.statKey)
}
/* -------------------------------------------- */
diff --git a/system.json b/system.json
index 089f7df..7f7482c 100644
--- a/system.json
+++ b/system.json
@@ -252,7 +252,7 @@
],
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
- "version": "11.0.20",
- "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.20.zip",
+ "version": "11.0.21",
+ "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.21.zip",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
}
\ No newline at end of file