remove attachment only logic in favor of just transfer

This commit is contained in:
psitacus 2025-07-10 22:35:12 -06:00
parent a9e584d619
commit 896f317c6d
4 changed files with 10 additions and 23 deletions

View file

@ -952,7 +952,8 @@
}
},
"Attachments": {
"attachHint": "Drop items here to attach them"
"attachHint": "Drop items here to attach them",
"transferHint": "If checked, this effect will be applied to any actor that owns this Effect's parent Item. The effect is always applied if this Item is attached to another one."
}
},
"GENERAL": {

View file

@ -30,6 +30,13 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
async _preparePartContext(partId, context) {
const partContext = await super._preparePartContext(partId, context);
switch (partId) {
case 'details':
// Add your custom checkbox field here
partContext.fields.yourCustomField = new foundry.data.fields.BooleanField({
label: "DAGGERHEART.EFFECTS.YourCustomField.label",
hint: "DAGGERHEART.EFFECTS.YourCustomField.hint"
});
break;
case 'changes':
const fieldPaths = [];
const validFieldPath = fieldPath => this.validFieldPath(fieldPath, this.#unapplicablePaths);

View file

@ -6,12 +6,6 @@ export default class DhActiveEffect extends ActiveEffect {
return false;
}
// First check for attachment-only effects - these should ALWAYS be suppressed on the original item
// They only work through copied versions when attached
if (this.isAttachmentOnly) {
return true;
}
// Then apply the standard suppression rules
if (['weapon', 'armor'].includes(this.parent?.type)) {
return !this.parent.system.equipped;
@ -24,14 +18,6 @@ export default class DhActiveEffect extends ActiveEffect {
return super.isSuppressed;
}
/**
* Check if this effect is marked as attachment-only
* @returns {boolean}
*/
get isAttachmentOnly() {
return this.flags?.daggerheart?.attachmentOnly === true;
}
/**
* Check if the parent item is currently attached to another item
* @returns {boolean}

View file

@ -7,14 +7,7 @@
{{formGroup fields.origin value=source.origin rootId=rootId disabled=true}}
{{/if}}
{{#if isItemEffect}}
{{formGroup fields.transfer value=source.transfer rootId=rootId label=legacyTransfer.label hint=legacyTransfer.hint}}
{{!-- Attachment-only flag for item effects TODO figure out how to do this with formGroups--}}
<div class="form-group">
<label for="{{rootId}}-attachmentOnly">{{localize "DAGGERHEART.Effect.AttachmentOnly.Label"}}</label>
<input type="checkbox" id="{{rootId}}-attachmentOnly" name="flags.daggerheart.attachmentOnly" {{#if source.flags.daggerheart.attachmentOnly}}checked{{/if}}>
<p class="hint">{{localize "DAGGERHEART.Effect.AttachmentOnly.Hint"}}</p>
</div>
{{formGroup fields.transfer value=source.transfer rootId=rootId label=legacyTransfer.label hint=(localize "DAGGERHEART.EFFECTS.Attachments.transferHint")}}
{{/if}}
{{formGroup fields.statuses value=source.statuses options=statuses rootId=rootId classes="statuses"}}