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