mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 07:36:26 +01:00
29 lines
849 B
JavaScript
29 lines
849 B
JavaScript
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
|
import BaseDataItem from './base.mjs';
|
|
|
|
export default class DHAncestry extends BaseDataItem {
|
|
/** @inheritDoc */
|
|
static get metadata() {
|
|
return foundry.utils.mergeObject(super.metadata, {
|
|
label: 'TYPES.Item.ancestry',
|
|
type: 'ancestry',
|
|
hasDescription: true
|
|
});
|
|
}
|
|
|
|
/** @inheritDoc */
|
|
static defineSchema() {
|
|
return {
|
|
...super.defineSchema(),
|
|
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
|
};
|
|
}
|
|
|
|
get primaryFeature() {
|
|
return this.features.find(x => x?.system?.primary) ?? (this.features.length > 0 ? {} : null);
|
|
}
|
|
|
|
get secondaryFeature() {
|
|
return this.features.find(x => !x?.system?.primary);
|
|
}
|
|
}
|