Skip to content

Commit

Permalink
Fix issue with deleting a spell that was being concentrated on.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyorl committed Mar 21, 2024
1 parent f79b48e commit 4fdc6b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion module/documents/actor/actor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ export default class Actor5e extends SystemDocumentMixin(Actor) {
const data = effect.getFlag("dnd5e", "itemData");
concentration.effects.add(effect);
if ( data ) {
const item = this.items.get(data) ?? new Item.implementation(data, { keepId: true, parent: this });
const item = typeof data === "string"
? this.items.get(data)
: new Item.implementation(data, { keepId: true, parent: this });
if ( item ) concentration.items.add(item);
}
}
Expand Down
3 changes: 3 additions & 0 deletions module/documents/item.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2451,6 +2451,9 @@ export default class Item5e extends SystemDocumentMixin(Item) {
await Item.deleteDocuments(Array.from(contents.map(i => i.id)), { pack: this.pack, parent: this.parent });
}

// End concentration on any effects.
this.parent?.endConcentration?.(this);

// Assign a new original class
if ( this.parent && (this.type === "class") && (this.id === this.parent.system.details.originalClass) ) {
this.parent._assignPrimaryClass();
Expand Down

0 comments on commit 4fdc6b9

Please sign in to comment.