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": { "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": { "GENERAL": {

View file

@ -30,6 +30,13 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
async _preparePartContext(partId, context) { async _preparePartContext(partId, context) {
const partContext = await super._preparePartContext(partId, context); const partContext = await super._preparePartContext(partId, context);
switch (partId) { 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': case 'changes':
const fieldPaths = []; const fieldPaths = [];
const validFieldPath = fieldPath => this.validFieldPath(fieldPath, this.#unapplicablePaths); const validFieldPath = fieldPath => this.validFieldPath(fieldPath, this.#unapplicablePaths);

View file

@ -6,12 +6,6 @@ export default class DhActiveEffect extends ActiveEffect {
return false; 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 // Then apply the standard suppression rules
if (['weapon', 'armor'].includes(this.parent?.type)) { if (['weapon', 'armor'].includes(this.parent?.type)) {
return !this.parent.system.equipped; return !this.parent.system.equipped;
@ -24,14 +18,6 @@ export default class DhActiveEffect extends ActiveEffect {
return super.isSuppressed; 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 * Check if the parent item is currently attached to another item
* @returns {boolean} * @returns {boolean}

View file

@ -7,14 +7,7 @@
{{formGroup fields.origin value=source.origin rootId=rootId disabled=true}} {{formGroup fields.origin value=source.origin rootId=rootId disabled=true}}
{{/if}} {{/if}}
{{#if isItemEffect}} {{#if isItemEffect}}
{{formGroup fields.transfer value=source.transfer rootId=rootId label=legacyTransfer.label hint=legacyTransfer.hint}} {{formGroup fields.transfer value=source.transfer rootId=rootId label=legacyTransfer.label hint=(localize "DAGGERHEART.EFFECTS.Attachments.transferHint")}}
{{!-- 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>
{{/if}} {{/if}}
{{formGroup fields.statuses value=source.statuses options=statuses rootId=rootId classes="statuses"}} {{formGroup fields.statuses value=source.statuses options=statuses rootId=rootId classes="statuses"}}