change armor and weapon to be attachableItem

This commit is contained in:
psitacus 2025-07-11 18:50:21 -06:00
parent fbe551624d
commit 1fc136c81b
3 changed files with 15 additions and 6 deletions

View file

@ -1,10 +1,10 @@
import BaseDataItem from './base.mjs'; import AttachableItem from './attachableItem.mjs';
import ActionField from '../fields/actionField.mjs'; import ActionField from '../fields/actionField.mjs';
import { armorFeatures } from '../../config/itemConfig.mjs'; import { armorFeatures } from '../../config/itemConfig.mjs';
import { actionsTypes } from '../action/_module.mjs'; import { actionsTypes } from '../action/_module.mjs';
import { handleAttachmentEffectsOnEquipChange } from '../../helpers/attachmentHelper.mjs'; import { handleAttachmentEffectsOnEquipChange } from '../../helpers/attachmentHelper.mjs';
export default class DHArmor extends BaseDataItem { export default class DHArmor extends AttachableItem {
/** @inheritDoc */ /** @inheritDoc */
static get metadata() { static get metadata() {
return foundry.utils.mergeObject(super.metadata, { return foundry.utils.mergeObject(super.metadata, {
@ -42,7 +42,6 @@ export default class DHArmor extends BaseDataItem {
major: new fields.NumberField({ integer: true, initial: 0 }), major: new fields.NumberField({ integer: true, initial: 0 }),
severe: new fields.NumberField({ integer: true, initial: 0 }) severe: new fields.NumberField({ integer: true, initial: 0 })
}), }),
attached: new fields.ArrayField(new fields.DocumentUUIDField({ type: "Item", nullable: true })),
actions: new fields.ArrayField(new ActionField()) actions: new fields.ArrayField(new ActionField())
}; };
} }

View file

@ -0,0 +1,11 @@
import BaseDataItem from './base.mjs';
export default class AttachableItem extends BaseDataItem {
static defineSchema() {
const fields = foundry.data.fields;
return {
...super.defineSchema(),
attached: new fields.ArrayField(new fields.DocumentUUIDField({ type: "Item", nullable: true }))
};
}
}

View file

@ -1,9 +1,9 @@
import BaseDataItem from './base.mjs'; import AttachableItem from './attachableItem.mjs';
import { actionsTypes } from '../action/_module.mjs'; import { actionsTypes } from '../action/_module.mjs';
import ActionField from '../fields/actionField.mjs'; import ActionField from '../fields/actionField.mjs';
import { handleAttachmentEffectsOnEquipChange } from '../../helpers/attachmentHelper.mjs'; import { handleAttachmentEffectsOnEquipChange } from '../../helpers/attachmentHelper.mjs';
export default class DHWeapon extends BaseDataItem { export default class DHWeapon extends AttachableItem {
/** @inheritDoc */ /** @inheritDoc */
static get metadata() { static get metadata() {
return foundry.utils.mergeObject(super.metadata, { return foundry.utils.mergeObject(super.metadata, {
@ -67,7 +67,6 @@ export default class DHWeapon extends BaseDataItem {
} }
} }
}), }),
attached: new fields.ArrayField(new fields.DocumentUUIDField({ type: "Item", nullable: true })),
actions: new fields.ArrayField(new ActionField()) actions: new fields.ArrayField(new ActionField())
}; };
} }