Skip to content

Commit

Permalink
Update FamiliarPF2e#_preUpdate´ and the normalizeActionChangeData` …
Browse files Browse the repository at this point in the history
…helper for v12 (foundryvtt#14672)
  • Loading branch information
In3luki authored and CarlosFdez committed May 29, 2024
1 parent 2bab574 commit 2c1515a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/module/actor/familiar/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ class FamiliarPF2e<TParent extends TokenDocumentPF2e | null = TokenDocumentPF2e
options: FamiliarUpdateContext<TParent>,
user: UserPF2e,
): Promise<boolean | void> {
if (changed.system?.master?.id) {
const newId = changed.system?.master?.id ?? this.system.master.id;
if (newId !== this.system.master.id) {
options.previousMaster = this.master?.uuid;
}

Expand Down
2 changes: 2 additions & 0 deletions src/module/item/ability/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ function normalizeActionChangeData(document: SourceWithActionData, changed: Deep
if (changed.system && ("actionType" in changed.system || "actions" in changed.system)) {
const actionType = changed.system?.actionType?.value ?? document.system.actionType.value;
const actionCount = Number(changed.system?.actions?.value ?? document.system.actions.value);
if (actionType === document.system.actionType.value && actionCount === Number(document.system.actions.value))
return;
changed.system = fu.mergeObject(changed.system, {
actionType: { value: actionType },
actions: { value: actionType !== "action" ? null : Math.clamp(actionCount, 1, 3) },
Expand Down

0 comments on commit 2c1515a

Please sign in to comment.