MDL/ADRL fixes + MR fixes

This commit is contained in:
LeRatierBretonnien 2023-09-19 13:52:09 +02:00
parent 552ff9564a
commit bbf0f31d4c
3 changed files with 32 additions and 26 deletions

View File

@ -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])
}
}
}
if (statKey.toLowerCase() == "stl" && this.system.secondary.concealment.status == "exposed") {
hindrancesDices += 1

View File

@ -801,11 +801,11 @@ export class PegasusUtility {
}
}
}
if (toRem.length > 0) {
//console.log("Going to remove one use effects", toRem)
let actor = game.actors.get(rollData.actorId)
if (toRem.length > 0) {
actor.deleteEmbeddedDocuments('Item', toRem)
}
actor.checkEFfectsHindranceDeletion(rollData.statKey)
}
/* -------------------------------------------- */

View File

@ -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"
}