shape change fix powers and skill issue

This commit is contained in:
Mike Bloy 2024-05-30 15:29:39 -05:00
parent 5c9556471e
commit 4ffed673db
2 changed files with 6 additions and 6 deletions

View File

@ -802,8 +802,11 @@ export class ActorFolderEffect extends PowerEffect {
adds[documentType] = [];
updates[documentType] = [];
for (const newDocKey in newDocs[documentType]) {
const newDoc = newDocs[documentType][newDocKey];
const newDoc = newDocs[documentType][newDocKey].toObject();
const oldDoc = collection.find((doc) => this.#documentFinder(documentType, doc, newDoc));
if (newDoc.type === 'power' && newDoc?.system?.choiceSets?.length > 0) {
newDoc.system.choiceSets = [];
}
if (oldDoc) {
const _id = oldDoc.id;
updates[documentType].push({ ...newDoc, _id });

View File

@ -119,12 +119,9 @@ export class ShapeChangeEffect extends ActorFolderEffect {
for (const item of this.target.actor.items.filter(
(i) =>
(i.type === 'skill' && ['smarts', 'spirit'].includes(i.system.attribute)) ||
['edge', 'hindrance', 'action'].includes(i.type),
['power', 'edge', 'hindrance', 'action'].includes(i.type),
)) {
const doc = deepClone(await this.target.actor.getEmbeddedDocument('Item', item.id));
if (doc.type === 'power' && doc?.system?.choiceSets?.length > 0 && !doc.system.choiceSets[0].choice) {
doc.system.choiceSets[0].choice = 1;
}
const doc = await this.target.actor.getEmbeddedDocument('Item', item.id);
this.data.embeddedUpdates.Item[item.name] = doc;
}
}