shape change fix powers and skill issue
This commit is contained in:
parent
5c9556471e
commit
4ffed673db
@ -802,8 +802,11 @@ export class ActorFolderEffect extends PowerEffect {
|
|||||||
adds[documentType] = [];
|
adds[documentType] = [];
|
||||||
updates[documentType] = [];
|
updates[documentType] = [];
|
||||||
for (const newDocKey in newDocs[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));
|
const oldDoc = collection.find((doc) => this.#documentFinder(documentType, doc, newDoc));
|
||||||
|
if (newDoc.type === 'power' && newDoc?.system?.choiceSets?.length > 0) {
|
||||||
|
newDoc.system.choiceSets = [];
|
||||||
|
}
|
||||||
if (oldDoc) {
|
if (oldDoc) {
|
||||||
const _id = oldDoc.id;
|
const _id = oldDoc.id;
|
||||||
updates[documentType].push({ ...newDoc, _id });
|
updates[documentType].push({ ...newDoc, _id });
|
||||||
|
|||||||
@ -119,12 +119,9 @@ export class ShapeChangeEffect extends ActorFolderEffect {
|
|||||||
for (const item of this.target.actor.items.filter(
|
for (const item of this.target.actor.items.filter(
|
||||||
(i) =>
|
(i) =>
|
||||||
(i.type === 'skill' && ['smarts', 'spirit'].includes(i.system.attribute)) ||
|
(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));
|
const doc = 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;
|
|
||||||
}
|
|
||||||
this.data.embeddedUpdates.Item[item.name] = doc;
|
this.data.embeddedUpdates.Item[item.name] = doc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user