mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
Feature(Item) now has subtype instead of primary as a field
This commit is contained in:
parent
e9967a27ca
commit
e2ca4506cd
5 changed files with 28 additions and 10 deletions
|
|
@ -20,10 +20,18 @@ export default class DHAncestry extends BaseDataItem {
|
|||
}
|
||||
|
||||
get primaryFeature() {
|
||||
return this.features.find(x => x?.system?.primary) ?? (this.features.length > 0 ? {} : null);
|
||||
return (
|
||||
this.features.find(x => x?.system?.subType === CONFIG.DH.ITEM.featureSubTypes.primary) ??
|
||||
(this.features.filter(x => !x).length > 0 ? {} : null)
|
||||
);
|
||||
}
|
||||
|
||||
get secondaryFeature() {
|
||||
return this.features.find(x => !x?.system?.primary);
|
||||
return (
|
||||
this.features.find(x => x?.system?.subType === CONFIG.DH.ITEM.featureSubTypes.secondary) ??
|
||||
(this.features.filter(x => !x || x.system.subType === CONFIG.DH.ITEM.featureSubTypes.primary).length > 1
|
||||
? {}
|
||||
: null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ export default class DHFeature extends BaseDataItem {
|
|||
return {
|
||||
...super.defineSchema(),
|
||||
type: new fields.StringField({ choices: CONFIG.DH.ITEM.featureTypes, nullable: true, initial: null }),
|
||||
subType: new fields.StringField({ choices: CONFIG.DH.ITEM.featureSubTypes, nullable: true, initial: null }),
|
||||
originId: new fields.StringField({ nullable: true, initial: null }),
|
||||
identifier: new fields.StringField(),
|
||||
actions: new fields.ArrayField(new ActionField()),
|
||||
primary: new fields.BooleanField({ nullable: true, initial: null })
|
||||
actions: new fields.ArrayField(new ActionField())
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue