RC-125 | Add ability reference in the Skill data model
This commit is contained in:
parent
16c46e9649
commit
f39c1b7721
3 changed files with 34 additions and 9 deletions
|
|
@ -2,10 +2,21 @@ import { gameTerms } from "../../gameTerms.mjs";
|
|||
|
||||
const { fields } = foundry.data;
|
||||
|
||||
const abilityPaths = [`grit`, `gait`, `grip`, `glim`, `thin-glim`];
|
||||
|
||||
export class SkillData extends foundry.abstract.TypeDataModel {
|
||||
// MARK: Schema
|
||||
static defineSchema() {
|
||||
const schema = {};
|
||||
const schema = {
|
||||
ability: new fields.StringField({
|
||||
initial: abilityPaths[0],
|
||||
blank: true,
|
||||
trim: true,
|
||||
nullable: false,
|
||||
required: true,
|
||||
choices: () => abilityPaths,
|
||||
}),
|
||||
};
|
||||
|
||||
const advances = {};
|
||||
for (const rank of Object.values(gameTerms.Rank)) {
|
||||
|
|
@ -35,7 +46,19 @@ export class SkillData extends foundry.abstract.TypeDataModel {
|
|||
|
||||
// #region Sheet Data
|
||||
getFormFields(_ctx) {
|
||||
const fields = [];
|
||||
const fields = [
|
||||
{
|
||||
id: `fate-path`,
|
||||
type: `dropdown`,
|
||||
label: `RipCrypt.common.ability`,
|
||||
path: `system.ability`,
|
||||
value: this.ability,
|
||||
options: abilityPaths.map(ability => ({
|
||||
label: `RipCrypt.common.abilities.${ability}`,
|
||||
value: ability,
|
||||
})),
|
||||
},
|
||||
];
|
||||
return fields;
|
||||
};
|
||||
// #endregion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue