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"
},
"common": {
"ability": {
"abilities": {
"grit": "Grit",
"gait": "Gait",
"grip": "Grip",
"glim": "Glim"
"glim": "Glim",
"thin-glim": "Thin Glim"
},
"ability": "Ability",
"access": {
"Common": "Common",
"Uncommon": "Uncommon",
@ -95,10 +97,10 @@
"Apps": {
"move-run": "@RipCrypt.common.move • @RipCrypt.common.run",
"traits-range": "@RipCrypt.common.traits • @RipCrypt.common.range",
"grit-skills": "@RipCrypt.common.ability.grit Skills",
"gait-skills": "@RipCrypt.common.ability.gait Skills",
"grip-skills": "@RipCrypt.common.ability.grip Skills",
"glim-skills": "@RipCrypt.common.ability.glim Skills",
"grit-skills": "@RipCrypt.common.abilities.grit Skills",
"gait-skills": "@RipCrypt.common.abilities.gait Skills",
"grip-skills": "@RipCrypt.common.abilities.grip Skills",
"glim-skills": "@RipCrypt.common.abilities.glim Skills",
"a11y": {
"guts-value-edit": "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({
id: key,
name: localizer(
`RipCrypt.common.ability.${key}`,
`RipCrypt.common.abilities.${key}`,
{ value: 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 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