Update skill sheet

This commit is contained in:
2026-01-14 14:16:31 +01:00
parent 56492c40a0
commit 7283f5f15b
18 changed files with 266 additions and 331 deletions
+30 -23
View File
@@ -1,4 +1,5 @@
import { CORE_SKILLS_CHOICES, CORE_SKILL_BONUS, CORE_SKILLS } from "../config/skill.mjs"
import { SUB_ATTRIBUTES } from "../config/character.mjs"
/**
* Core Skill data model for Prism RPG
@@ -21,14 +22,6 @@ export default class PrismRPGSkill extends foundry.abstract.TypeDataModel {
initial: ""
})
// Core Skill type (from the 18 available Core Skills)
schema.coreSkill = new fields.StringField({
required: true,
initial: "acrobatics",
choices: CORE_SKILLS_CHOICES,
label: "Core Skill"
})
// Is this the character's chosen Core Skill?
schema.isCoreSkill = new fields.BooleanField({
required: true,
@@ -36,18 +29,18 @@ export default class PrismRPGSkill extends foundry.abstract.TypeDataModel {
label: "Is Core Skill"
})
// Primary attribute for this skill (str, dex, con, int, wis, cha)
schema.primaryAttribute = new fields.StringField({
// First sub-attribute for this skill
schema.subAttribute1 = new fields.StringField({
required: true,
initial: "dex",
label: "Primary Attribute"
initial: "prowess",
label: "Sub-Attribute 1"
})
// If Core Skill, which attribute receives the +2 bonus?
schema.attributeBonus = new fields.StringField({
// Second sub-attribute for this skill
schema.subAttribute2 = new fields.StringField({
required: true,
initial: "",
label: "Attribute Bonus"
initial: "initiative",
label: "Sub-Attribute 2"
})
// Skill modifier (includes Core Skill bonus if applicable)
@@ -114,9 +107,9 @@ export default class PrismRPGSkill extends foundry.abstract.TypeDataModel {
prepareDerivedData() {
super.prepareDerivedData()
// D&D 5e style: Core Skill gives +2 proficiency bonus
// Core Skill gives +5 proficiency bonus
if (this.isCoreSkill) {
this.modifier = 2
this.modifier = 5
this.canAdvancedCheck = true
} else {
this.modifier = 0
@@ -126,16 +119,30 @@ export default class PrismRPGSkill extends foundry.abstract.TypeDataModel {
/**
* Calculate skill check bonus
* @param {string} attributeKey The attribute to use (str, dex, con, int, wis, cha)
* @param {string} subAttributeKey The sub-attribute to use (prowess, vigor, etc.)
* @returns {number} Total skill check bonus
*/
getSkillCheckBonus(attributeKey) {
getSkillCheckBonus(subAttributeKey) {
let actor = this.parent?.actor
if (!actor) return this.modifier
const attribute = actor.system.characteristics?.[attributeKey]
const attributeMod = attribute?.mod || 0
const subAttribute = actor.system.subAttributes?.[subAttributeKey]
const subAttributeMod = subAttribute?.value || 0
return attributeMod + this.modifier
return subAttributeMod + this.modifier
}
/**
* Get the available sub-attribute choices for this skill
*/
get subAttributeChoices() {
const choices = {}
if (this.subAttribute1) {
choices[this.subAttribute1] = SUB_ATTRIBUTES[this.subAttribute1]?.label || this.subAttribute1
}
if (this.subAttribute2) {
choices[this.subAttribute2] = SUB_ATTRIBUTES[this.subAttribute2]?.label || this.subAttribute2
}
return choices
}
}