mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Added PreCreate/Create/Delete logic for Class/Subclass and set it as foreignUUID fields in PC
This commit is contained in:
parent
53be047e12
commit
a5aa2e914d
11 changed files with 177 additions and 167 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { getPathValue } from '../helpers/utils.mjs';
|
||||
import ForeignDocumentUUIDField from './fields/foreignDocumentUUIDField.mjs';
|
||||
import { LevelOptionType } from './levelTier.mjs';
|
||||
|
||||
const fields = foundry.data.fields;
|
||||
|
|
@ -96,6 +97,14 @@ export default class DhpPC extends foundry.abstract.TypeDataModel {
|
|||
max: new fields.NumberField({ initial: 6, integer: true }),
|
||||
value: new fields.NumberField({ initial: 0, integer: true })
|
||||
}),
|
||||
class: new fields.SchemaField({
|
||||
value: new ForeignDocumentUUIDField({ type: 'Item', nullable: true }),
|
||||
subclass: new ForeignDocumentUUIDField({ type: 'Item', nullable: true })
|
||||
}),
|
||||
multiclass: new fields.SchemaField({
|
||||
value: new ForeignDocumentUUIDField({ type: 'Item', nullable: true }),
|
||||
subclass: new ForeignDocumentUUIDField({ type: 'Item', nullable: true })
|
||||
}),
|
||||
levelData: new fields.EmbeddedDataField(DhPCLevelData)
|
||||
};
|
||||
}
|
||||
|
|
@ -108,14 +117,6 @@ export default class DhpPC extends foundry.abstract.TypeDataModel {
|
|||
return this.parent.items.find(x => x.type === 'ancestry') ?? null;
|
||||
}
|
||||
|
||||
get class() {
|
||||
return this.parent.items.find(x => x.type === 'class' && !x.system.multiclass) ?? null;
|
||||
}
|
||||
|
||||
get multiclass() {
|
||||
return this.parent.items.find(x => x.type === 'class' && x.system.multiclass) ?? null;
|
||||
}
|
||||
|
||||
get multiclassSubclass() {
|
||||
return this.parent.items.find(x => x.type === 'subclass' && x.system.multiclass) ?? null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue