foundry v12 - update deepClone

This commit is contained in:
Mike Bloy 2024-07-09 20:15:39 -05:00
parent 65d8ec2d39
commit 2ef597dc8c
3 changed files with 6 additions and 6 deletions

View File

@ -108,7 +108,7 @@ export class BalefulPolymorphEffect extends ActorFolderEffect {
Item: {}, Item: {},
}; };
for (const effect of this.target.actor.effects) { for (const effect of this.target.actor.effects) {
const doc = deepClone(await this.target.actor.getEmbeddedDocument('ActiveEffect', effect.id)); const doc = foundry.utils.deepClone(await this.target.actor.getEmbeddedDocument('ActiveEffect', effect.id));
this.data.embeddedUpdates.ActiveEffect[effect.name] = doc; this.data.embeddedUpdates.ActiveEffect[effect.name] = doc;
} }
} }

View File

@ -63,7 +63,7 @@ export class PowerFormApplication extends FormApplication {
} }
getData() { getData() {
let modifiers = deepClone(this.powerEffect.modifiers); let modifiers = foundry.utils.deepClone(this.powerEffect.modifiers);
modifiers.sort(PowerFormApplication.sortMods); modifiers.sort(PowerFormApplication.sortMods);
for (const modifier of modifiers) { for (const modifier of modifiers) {
modifier.isCheckbox = modifier.type === 'checkbox'; modifier.isCheckbox = modifier.type === 'checkbox';
@ -132,7 +132,7 @@ export class PowerEffect {
} }
static async getStatus(label, name, favorite = true) { static async getStatus(label, name, favorite = true) {
const effect = deepClone(CONFIG.statusEffects.find((se) => se.label === label)); const effect = foundry.utils.deepClone(CONFIG.statusEffects.find((se) => se.label === label));
effect.name = 'name' in effect ? effect.name : effect.label; effect.name = 'name' in effect ? effect.name : effect.label;
if (!('flags' in effect)) { if (!('flags' in effect)) {
effect.flags = {}; effect.flags = {};
@ -604,11 +604,11 @@ export class PowerEffect {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
async secondaryDocsForTarget(docs, target) { async secondaryDocsForTarget(docs, target) {
return deepClone(docs); return foundry.utils.deepClone(docs);
} }
async primaryDocForTarget(doc, target) { async primaryDocForTarget(doc, target) {
const newDoc = deepClone(doc); const newDoc = foundry.utils.deepClone(doc);
newDoc.flags[moduleName].maintainingId = doc.flags[moduleName].maintId; newDoc.flags[moduleName].maintainingId = doc.flags[moduleName].maintId;
newDoc.flags[moduleName].targetIds = [target.id]; newDoc.flags[moduleName].targetIds = [target.id];
return newDoc; return newDoc;

View File

@ -129,7 +129,7 @@ export class ShapeChangeEffect extends ActorFolderEffect {
Item: {}, Item: {},
}; };
for (const effect of this.target.actor.effects) { for (const effect of this.target.actor.effects) {
const doc = deepClone(await this.target.actor.getEmbeddedDocument('ActiveEffect', effect.id)); const doc = foundry.utils.deepClone(await this.target.actor.getEmbeddedDocument('ActiveEffect', effect.id));
this.data.embeddedUpdates.ActiveEffect[effect.name] = doc; this.data.embeddedUpdates.ActiveEffect[effect.name] = doc;
} }
for (const item of this.target.actor.items.filter( for (const item of this.target.actor.items.filter(