Automated exhausted condition
This commit is contained in:
@@ -188,6 +188,21 @@ export class ActorL5r5e extends Actor {
|
|||||||
return this._updateActorFromAdvancement(item, false);
|
return this._updateActorFromAdvancement(item, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import("./types").Condition}
|
||||||
|
*
|
||||||
|
* Remove conditions by known string ids
|
||||||
|
* @param conditions {Set<Condition>}
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async removeConditions(conditions) {
|
||||||
|
const effectsToRemove = this.statuses.intersection(conditions);
|
||||||
|
const idsToRemove = this.effects.contents
|
||||||
|
.filter(effect => effect.statuses.isSubsetOf(effectsToRemove))
|
||||||
|
.map(effect => effect.id);
|
||||||
|
await this.deleteEmbeddedDocuments("ActiveEffect", idsToRemove);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alter Actor skill/ring from a advancement
|
* Alter Actor skill/ring from a advancement
|
||||||
* @param {Item} item
|
* @param {Item} item
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ export class GmToolbox extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
await actor.removeConditions(new Set(["exhausted"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
GmToolbox.#uiNotification(allActors, "sleep");
|
GmToolbox.#uiNotification(allActors, "sleep");
|
||||||
@@ -216,7 +217,8 @@ export class GmToolbox extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||||||
static async #onSceneEnd(event) {
|
static async #onSceneEnd(event) {
|
||||||
const allActors = event.button !== 0;
|
const allActors = event.button !== 0;
|
||||||
for await (const actor of game.actors.contents) {
|
for await (const actor of game.actors.contents) {
|
||||||
if (!GmToolbox.#updatableCharacter(allActors, actor)) {
|
if (!GmToolbox.#updatableCharacter(allActors, actor)
|
||||||
|
|| actor.statuses.has("exhausted")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
system/scripts/types.js
Normal file
3
system/scripts/types.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {"afflicted" | "bleeding" | "burning" | "compromised" | "dazed" | "disoriented" | "dying" | "enraged" | "exhausted" | "immobilized" | "incapacitated" | "intoxicated" | "prone" | "silenced" | "unconscious" | "lightlyWoundedFire" | "lightlyWoundedWater" | "lightlyWoundedAir" | "lightlyWoundedEarth" | "lightlyWoundedVoid" | "severelyWoundedFire" | "severelyWoundedWater" | "severelyWoundedAir" | "severelyWoundedEarth" | "severelyWoundedVoid"} Condition
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user