mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-22 15:33:37 +02:00
Merged with v14-Dev
This commit is contained in:
commit
956b168122
105 changed files with 984 additions and 832 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,
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ export class ActionField extends foundry.data.fields.ObjectField {
|
|||
/** @override */
|
||||
_cleanType(value, options, _state) {
|
||||
if (!(typeof value === 'object')) value = {};
|
||||
value = super._cleanType(value, options, _state);
|
||||
const cls = this.getModel(value);
|
||||
if (cls) return cls.cleanData(value, options, _state);
|
||||
return value;
|
||||
|
|
@ -309,7 +310,7 @@ export function ActionMixin(Base) {
|
|||
}
|
||||
};
|
||||
|
||||
ChatMessage.applyRollMode(msg, game.settings.get('core', 'rollMode'));
|
||||
ChatMessage.applyMode(msg, game.settings.get('core', 'messageMode'));
|
||||
cls.create(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue