foundry.utils.mergeObject
This commit is contained in:
parent
d14de3d385
commit
06f26c264c
@ -146,9 +146,9 @@ export class BalefulPolymorphEffect extends ActorFolderEffect {
|
||||
|
||||
get spawnUpdates() {
|
||||
const updates = super.spawnUpdates;
|
||||
mergeObject(updates.actor, this.data.actorUpdates);
|
||||
mergeObject(updates.token, this.data.tokenUpdates);
|
||||
mergeObject(updates.embedded, this.data.embeddedUpdates);
|
||||
foundry.utils.mergeObject(updates.actor, this.data.actorUpdates);
|
||||
foundry.utils.mergeObject(updates.token, this.data.tokenUpdates);
|
||||
foundry.utils.mergeObject(updates.embedded, this.data.embeddedUpdates);
|
||||
return updates;
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ export class PowerFormApplication extends FormApplication {
|
||||
}
|
||||
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ['sheet', 'mbSwadeForm', 'mbSwadePowerEffectsForm'],
|
||||
popOut: true,
|
||||
template: templates['powerDialog.html'],
|
||||
|
||||
@ -78,7 +78,7 @@ export class EntangleEffect extends PowerEffect {
|
||||
const docLabel = this.data.raise ? 'SWADE.Bound' : 'SWADE.Entangled';
|
||||
const docName = this.data.raise ? 'Bound' : 'Entangled';
|
||||
const doc = await PowerEffect.getStatus(docLabel, docName, false);
|
||||
doc.flags = mergeObject(doc.flags ?? {}, {
|
||||
doc.flags = foundry.utils.mergeObject(doc.flags ?? {}, {
|
||||
[moduleName]: {
|
||||
powerEffect: true,
|
||||
maintId,
|
||||
|
||||
@ -50,7 +50,7 @@ export class FlyEffect extends PowerEffect {
|
||||
const docName = 'Flying';
|
||||
const doc = await PowerEffect.getStatus(docLabel, docName, false);
|
||||
doc.description = `<p>From <strong>${this.source.name}</strong> casting <em>${this.name}</em></p>`;
|
||||
doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
|
||||
doc.flags = foundry.utils.mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
|
||||
this.baseEffectDoc = doc;
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ export class InvisibliltyEffect extends PowerEffect {
|
||||
await super.parseValues();
|
||||
const doc = await PowerEffect.getStatus('EFFECT.StatusInvisible', 'Invisible');
|
||||
doc.description = `<p>From <strong>${this.source.name}</strong> casting <em>${this.name}</em></p>`;
|
||||
doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
|
||||
doc.flags = foundry.utils.mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
|
||||
this.basePrimaryEffectDoc = doc;
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ export class ProtectionEffect extends PowerEffect {
|
||||
async parseValues() {
|
||||
await super.parseValues();
|
||||
const doc = await PowerEffect.getStatus('SWADE.Protection', 'Protection', false);
|
||||
doc.flags = mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
|
||||
doc.flags = foundry.utils.mergeObject(doc.flags ?? {}, { [moduleName]: { powerEffect: true } });
|
||||
this.data.effect = doc;
|
||||
}
|
||||
|
||||
|
||||
@ -190,9 +190,9 @@ export class ShapeChangeEffect extends ActorFolderEffect {
|
||||
|
||||
get spawnUpdates() {
|
||||
const updates = super.spawnUpdates;
|
||||
mergeObject(updates.actor, this.data.actorUpdates);
|
||||
mergeObject(updates.token, this.data.tokenUpdates);
|
||||
mergeObject(updates.embedded, this.data.embeddedUpdates);
|
||||
foundry.utils.mergeObject(updates.actor, this.data.actorUpdates);
|
||||
foundry.utils.mergeObject(updates.token, this.data.tokenUpdates);
|
||||
foundry.utils.mergeObject(updates.embedded, this.data.embeddedUpdates);
|
||||
return updates;
|
||||
}
|
||||
|
||||
|
||||
@ -110,9 +110,9 @@ class SpiritualWeaponEffect extends BaseSummonEffect {
|
||||
|
||||
get spawnUpdates() {
|
||||
const updates = super.spawnUpdates;
|
||||
mergeObject(updates.actor, this.data.actorUpdates);
|
||||
mergeObject(updates.token, this.data.tokenUpdates);
|
||||
mergeObject(updates.embedded, this.data.embeddedUpdates);
|
||||
foundry.utils.mergeObject(updates.actor, this.data.actorUpdates);
|
||||
foundry.utils.mergeObject(updates.token, this.data.tokenUpdates);
|
||||
foundry.utils.mergeObject(updates.embedded, this.data.embeddedUpdates);
|
||||
return updates;
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ export class SmiteEffect extends PowerEffect {
|
||||
async parseValues() {
|
||||
await super.parseValues();
|
||||
this.baseDoc = await PowerEffect.getStatus('SWADE.Smite', 'Smite', false);
|
||||
this.baseDoc.flags = mergeObject(this.baseDoc.flags ?? {}, {
|
||||
this.baseDoc.flags = foundry.utils.mergeObject(this.baseDoc.flags ?? {}, {
|
||||
[moduleName]: { powerEffect: true },
|
||||
});
|
||||
this.data.bonus = (this.data.raise ? 4 : 2) + (this.data.greater ? 2 : 0);
|
||||
|
||||
@ -220,9 +220,9 @@ class BaseAllyEffect extends BaseSummonEffect {
|
||||
|
||||
get spawnUpdates() {
|
||||
const updates = super.spawnUpdates;
|
||||
mergeObject(updates.actor, this.data.actorUpdates);
|
||||
mergeObject(updates.token, this.data.tokenUpdates);
|
||||
mergeObject(updates.embedded, this.data.embeddedUpdates);
|
||||
foundry.utils.mergeObject(updates.actor, this.data.actorUpdates);
|
||||
foundry.utils.mergeObject(updates.token, this.data.tokenUpdates);
|
||||
foundry.utils.mergeObject(updates.embedded, this.data.embeddedUpdates);
|
||||
return updates;
|
||||
}
|
||||
|
||||
@ -335,7 +335,7 @@ export class SummonAllyEffect extends BaseAllyEffect {
|
||||
return;
|
||||
}
|
||||
const mirrorActor = this.source.actor;
|
||||
mergeObject(this.data.actorUpdates, {
|
||||
foundry.utils.mergeObject(this.data.actorUpdates, {
|
||||
system: mirrorActor.system
|
||||
.clone({
|
||||
'fatigue.value': 0,
|
||||
@ -349,7 +349,7 @@ export class SummonAllyEffect extends BaseAllyEffect {
|
||||
img: mirrorActor.img,
|
||||
});
|
||||
this.data.actorUpdates.system.wildcard = false;
|
||||
mergeObject(this.data.tokenUpdates, {
|
||||
foundry.utils.mergeObject(this.data.tokenUpdates, {
|
||||
name: `Mirror ${this.source.name}`,
|
||||
texture: {
|
||||
src: this.source.document.texture.src,
|
||||
|
||||
@ -55,7 +55,7 @@ export class SummonCostApplication extends FormApplication {
|
||||
}
|
||||
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ['sheet', 'mbSwadeForm', 'mbSwadeSummonCostForm'],
|
||||
popOut: true,
|
||||
template: templates['summonCosts.html'],
|
||||
@ -126,7 +126,7 @@ export class SummonCostApplication extends FormApplication {
|
||||
for (const key of Object.keys(updates)) {
|
||||
const update = updates[key];
|
||||
const flagValue = this.actors[key].getFlag(moduleName, 'summonData') ?? {};
|
||||
mergeObject(flagValue, update);
|
||||
foundry.utils.mergeObject(flagValue, update);
|
||||
const result = this.actors[key].setFlag(moduleName, 'summonData', flagValue);
|
||||
console.log('update', key, result);
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ export class WarriorsGiftEffect extends PowerEffect {
|
||||
continue;
|
||||
}
|
||||
const edgeDoc = edge.toObject();
|
||||
mergeObject(edgeDoc, {
|
||||
foundry.utils.mergeObject(edgeDoc, {
|
||||
name: `${edge.name} (from ${this.name})`,
|
||||
flags: { [moduleName]: { maintId: this.data.maintId } },
|
||||
});
|
||||
|
||||
@ -227,9 +227,9 @@ export class ZombieEffect extends BaseSummonEffect {
|
||||
|
||||
get spawnUpdates() {
|
||||
const updates = super.spawnUpdates;
|
||||
mergeObject(updates.actor, this.data.actorUpdates);
|
||||
mergeObject(updates.token, this.data.tokenUpdates);
|
||||
mergeObject(updates.embedded, this.data.embeddedUpdates);
|
||||
foundry.utils.mergeObject(updates.actor, this.data.actorUpdates);
|
||||
foundry.utils.mergeObject(updates.token, this.data.tokenUpdates);
|
||||
foundry.utils.mergeObject(updates.embedded, this.data.embeddedUpdates);
|
||||
return updates;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user