RC-125 | Add ability reference in the Skill data model

This commit is contained in:
Oliver-Akins 2025-01-29 20:47:59 -07:00
parent 16c46e9649
commit f39c1b7721
3 changed files with 34 additions and 9 deletions

View file

@ -19,12 +19,14 @@
"HeroSkillsCardV1": "Hero Skill Card" "HeroSkillsCardV1": "Hero Skill Card"
}, },
"common": { "common": {
"ability": { "abilities": {
"grit": "Grit", "grit": "Grit",
"gait": "Gait", "gait": "Gait",
"grip": "Grip", "grip": "Grip",
"glim": "Glim" "glim": "Glim",
"thin-glim": "Thin Glim"
}, },
"ability": "Ability",
"access": { "access": {
"Common": "Common", "Common": "Common",
"Uncommon": "Uncommon", "Uncommon": "Uncommon",
@ -95,10 +97,10 @@
"Apps": { "Apps": {
"move-run": "@RipCrypt.common.move • @RipCrypt.common.run", "move-run": "@RipCrypt.common.move • @RipCrypt.common.run",
"traits-range": "@RipCrypt.common.traits • @RipCrypt.common.range", "traits-range": "@RipCrypt.common.traits • @RipCrypt.common.range",
"grit-skills": "@RipCrypt.common.ability.grit Skills", "grit-skills": "@RipCrypt.common.abilities.grit Skills",
"gait-skills": "@RipCrypt.common.ability.gait Skills", "gait-skills": "@RipCrypt.common.abilities.gait Skills",
"grip-skills": "@RipCrypt.common.ability.grip Skills", "grip-skills": "@RipCrypt.common.abilities.grip Skills",
"glim-skills": "@RipCrypt.common.ability.glim Skills", "glim-skills": "@RipCrypt.common.abilities.glim Skills",
"a11y": { "a11y": {
"guts-value-edit": "The current amount of guts the character has", "guts-value-edit": "The current amount of guts the character has",
"guts-value-readonly": "The current amount of guts the character has", "guts-value-readonly": "The current amount of guts the character has",

View file

@ -125,7 +125,7 @@ export class HeroSummaryCardV1 extends GenericAppMixin(HandlebarsApplicationMixi
ctx.abilities.push({ ctx.abilities.push({
id: key, id: key,
name: localizer( name: localizer(
`RipCrypt.common.ability.${key}`, `RipCrypt.common.abilities.${key}`,
{ value: ctx.actor.system.ability[key] }, { value: ctx.actor.system.ability[key] },
), ),
value: ctx.meta.limited ? `?` : ctx.actor.system.ability[key], value: ctx.meta.limited ? `?` : ctx.actor.system.ability[key],

View file

@ -2,10 +2,21 @@ import { gameTerms } from "../../gameTerms.mjs";
const { fields } = foundry.data; const { fields } = foundry.data;
const abilityPaths = [`grit`, `gait`, `grip`, `glim`, `thin-glim`];
export class SkillData extends foundry.abstract.TypeDataModel { export class SkillData extends foundry.abstract.TypeDataModel {
// MARK: Schema // MARK: Schema
static defineSchema() { 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 = {}; const advances = {};
for (const rank of Object.values(gameTerms.Rank)) { for (const rank of Object.values(gameTerms.Rank)) {
@ -35,7 +46,19 @@ export class SkillData extends foundry.abstract.TypeDataModel {
// #region Sheet Data // #region Sheet Data
getFormFields(_ctx) { 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; return fields;
}; };
// #endregion // #endregion