From 44131d21a6170879a4cc6418c562636ea4a5cbee Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Sun, 8 Feb 2026 18:01:30 +0100 Subject: [PATCH] [Fix] Beastform Effects (#1635) * Fixed so that beastform items always have a beastformEffect on them that can't be removed * Fixed so that you can drag an active effect onto a character --- .../sheets/api/application-mixin.mjs | 8 ++++++-- module/data/item/beastform.mjs | 16 ++++++++++++++++ module/documents/activeEffect.mjs | 5 +++-- .../sheets/global/partials/inventory-item-V2.hbs | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/module/applications/sheets/api/application-mixin.mjs b/module/applications/sheets/api/application-mixin.mjs index 3c0444eb..49f7dcf0 100644 --- a/module/applications/sheets/api/application-mixin.mjs +++ b/module/applications/sheets/api/application-mixin.mjs @@ -433,7 +433,7 @@ export default function DHApplicationMixin(Base) { icon: 'fa-solid fa-lightbulb', condition: target => { const doc = getDocFromElementSync(target); - return doc && !doc.disabled; + return doc && !doc.disabled && doc.type !== 'beastform'; }, callback: async target => (await getDocFromElement(target)).update({ disabled: true }) }, @@ -442,7 +442,7 @@ export default function DHApplicationMixin(Base) { icon: 'fa-regular fa-lightbulb', condition: target => { const doc = getDocFromElementSync(target); - return doc && doc.disabled; + return doc && doc.disabled && doc.type !== 'beastform'; }, callback: async target => (await getDocFromElement(target)).update({ disabled: false }) } @@ -536,6 +536,10 @@ export default function DHApplicationMixin(Base) { options.push({ name: 'CONTROLS.CommonDelete', icon: 'fa-solid fa-trash', + condition: target => { + const doc = getDocFromElementSync(target); + return doc && doc.type !== 'beastform'; + }, callback: async (target, event) => { const doc = await getDocFromElement(target); if (event.shiftKey) return doc.delete(); diff --git a/module/data/item/beastform.mjs b/module/data/item/beastform.mjs index dd491169..3a41aa7e 100644 --- a/module/data/item/beastform.mjs +++ b/module/data/item/beastform.mjs @@ -253,4 +253,20 @@ export default class DHBeastform extends BaseDataItem { return false; } + + _onCreate(_data, _options, userId) { + if (!this.actor && game.user.id === userId) { + const hasBeastformEffect = this.parent.effects.some(x => x.type === 'beastform'); + if (!hasBeastformEffect) + this.parent.createEmbeddedDocuments('ActiveEffect', [ + { + type: 'beastform', + name: game.i18n.localize('DAGGERHEART.ITEMS.Beastform.beastformEffect'), + img: 'icons/creatures/abilities/paw-print-pair-purple.webp' + } + ]); + + return; + } + } } diff --git a/module/documents/activeEffect.mjs b/module/documents/activeEffect.mjs index 5e9b0c3b..d0e329ff 100644 --- a/module/documents/activeEffect.mjs +++ b/module/documents/activeEffect.mjs @@ -61,14 +61,15 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect { update.img = 'icons/magic/life/heart-cross-blue.webp'; } + const statuses = Object.keys(data.statuses ?? {}); const immuneStatuses = - data.statuses?.filter( + statuses.filter( status => this.parent.system.rules?.conditionImmunities && this.parent.system.rules.conditionImmunities[status] ) ?? []; if (immuneStatuses.length > 0) { - update.statuses = data.statuses.filter(x => !immuneStatuses.includes(x)); + update.statuses = statuses.filter(x => !immuneStatuses.includes(x)); const conditions = CONFIG.DH.GENERAL.conditions(); const scrollingTexts = immuneStatuses.map(status => ({ text: game.i18n.format('DAGGERHEART.ACTIVEEFFECT.immuneStatusText', { diff --git a/templates/sheets/global/partials/inventory-item-V2.hbs b/templates/sheets/global/partials/inventory-item-V2.hbs index dbacd1e4..76e13a5c 100644 --- a/templates/sheets/global/partials/inventory-item-V2.hbs +++ b/templates/sheets/global/partials/inventory-item-V2.hbs @@ -113,7 +113,7 @@ Parameters: data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.inVault 'sendToLoadout' 'sendToVault' }}"> - {{else if (eq type 'effect')}} + {{else if (and (eq type 'effect') (not (eq item.type 'beastform')))}}