mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 22:46:12 +01:00
Fixed effect stacking
This commit is contained in:
parent
79057b0718
commit
617f1d64c1
7 changed files with 37 additions and 28 deletions
|
|
@ -106,22 +106,11 @@ export default class EffectsField extends fields.ArrayField {
|
|||
}
|
||||
|
||||
/**
|
||||
* Apply an Effect to a target or enable it if already on it
|
||||
* Apply an Effect to a target
|
||||
* @param {object} effect Effect object containing ActiveEffect UUID
|
||||
* @param {object} actor Actor Document
|
||||
*/
|
||||
static async applyEffect(effect, actor) {
|
||||
const existingEffect = actor.effects.find(e => e.origin === effect.uuid);
|
||||
if (existingEffect) {
|
||||
return effect.update(
|
||||
foundry.utils.mergeObject({
|
||||
...effect.constructor.getInitialDuration(),
|
||||
disabled: false
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// Otherwise, create a new effect on the target
|
||||
const effectData = foundry.utils.mergeObject({
|
||||
...(effect.toObject?.() ?? effect),
|
||||
disabled: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue