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
+13 -4
View File
@@ -119,18 +119,27 @@ export default class PrismRPGActor extends Actor {
rollTarget = this.items.find((i) => i.type === "miracle" && i.id === rollKey)
rollTarget.rollKey = rollKey
break
case "skill":
case "skill": {
rollTarget = this.items.find((i) => i.type === "skill" && i.id === rollKey)
rollTarget.rollKey = rollKey
if (rollTarget.system.category === "weapon") {
ui.notifications.warn(game.i18n.localize("PRISMRPG.Notifications.rollFromWeapon"))
return
}
// Get the primary attribute for D&D 5e style rolls
const attrKey = rollTarget.system.primaryAttribute || "dex"
rollTarget.characteristicValue = this.system.characteristics[attrKey].value
// Get the two sub-attributes for this skill
const subAttr1 = rollTarget.system.subAttribute1 || "prowess"
const subAttr2 = rollTarget.system.subAttribute2 || "initiative"
// Store both sub-attribute values for the dialog to choose from
rollTarget.subAttribute1 = subAttr1
rollTarget.subAttribute2 = subAttr2
rollTarget.subAttribute1Value = this.system.subAttributes?.[subAttr1]?.value || 0
rollTarget.subAttribute2Value = this.system.subAttributes?.[subAttr2]?.value || 0
rollTarget.subAttribute1Label = game.i18n.localize(SYSTEM.SUB_ATTRIBUTES?.[subAttr1]?.label || subAttr1)
rollTarget.subAttribute2Label = game.i18n.localize(SYSTEM.SUB_ATTRIBUTES?.[subAttr2]?.label || subAttr2)
rollTarget.proficiencyBonus = rollTarget.system.modifier
break
}
case "spell-attack":
case "spell-power":
case "spell-cast":
+39 -12
View File
@@ -127,11 +127,10 @@ export default class PrismRPGRoll extends Roll {
case "skill":
options.rollName = options.rollTarget.name
// D&D 5e style: ability modifier + proficiency bonus
const skillCharValue = options.rollTarget.characteristicValue
const skillAbilityMod = this.getAbilityModifier(skillCharValue)
// D&D 5e style: sub-attribute modifier + proficiency bonus
// Default to first sub-attribute, will be recalculated if player chooses different one
const proficiency = options.rollTarget.proficiencyBonus || 0
options.rollTarget.value = skillAbilityMod + proficiency
options.rollTarget.value = options.rollTarget.subAttribute1Value + proficiency
break
case "weapon-attack":
@@ -158,7 +157,7 @@ export default class PrismRPGRoll extends Roll {
const chaMod = this.getAbilityModifier(actor.system.characteristics.cha.value)
const bestMentalMod = Math.max(intMod, wisMod, chaMod)
options.rollTarget.value = bestMentalMod
// Store which characteristic is being used
if (bestMentalMod === intMod) {
options.rollTarget.mentalCharacteristic = "INT"
@@ -284,7 +283,8 @@ export default class PrismRPGRoll extends Roll {
attackerAimChoices,
hasTarget: options.hasTarget,
modifier: "+0",
advantage: "none"
advantage: "none",
config: SYSTEM
}
const content = await foundry.applications.handlebars.renderTemplate(
@@ -342,6 +342,15 @@ export default class PrismRPGRoll extends Roll {
}
}
// Recalculate bonus if player chose different sub-attribute for skill
if (rollContext.skillSubAttribute && options.rollType === "skill") {
const chosenSubAttrValue = rollContext.skillSubAttribute === options.rollTarget.subAttribute1 ?
options.rollTarget.subAttribute1Value :
options.rollTarget.subAttribute2Value
const proficiencyBonus = options.rollTarget.proficiencyBonus || 0
bonus = chosenSubAttrValue + proficiencyBonus
}
let extraModifier = rollContext.modifier === "" ? 0 : Number.parseInt(rollContext.modifier, 10)
totalModifier = bonus + extraModifier
@@ -388,12 +397,27 @@ export default class PrismRPGRoll extends Roll {
totalManaCost = options.rollTarget.system.manaCost + upcastLevel
totalAPC = options.rollTarget.system.apc + upcastLevel
manaUpkeep = options.rollTarget.system.manaUpkeep
// Get mental characteristic info from rollTarget
mentalCharacteristic = options.rollTarget.mentalCharacteristic
mentalCharValue = options.rollTarget.mentalCharValue
}
// Store skill sub-attribute information
let skillSubAttribute = null
let skillSubAttributeLabel = null
let skillSubAttributeValue = null
if (options.rollType === "skill" && rollContext.skillSubAttribute) {
skillSubAttribute = rollContext.skillSubAttribute
const subAttrConfig = SYSTEM.SUB_ATTRIBUTES?.[skillSubAttribute]
if (subAttrConfig) {
skillSubAttributeLabel = game.i18n.localize(subAttrConfig.label)
}
skillSubAttributeValue = rollContext.skillSubAttribute === options.rollTarget.subAttribute1 ?
options.rollTarget.subAttribute1Value :
options.rollTarget.subAttribute2Value
}
const rollData = {
type: options.rollType,
rollType: options.rollType,
@@ -411,6 +435,9 @@ export default class PrismRPGRoll extends Roll {
manaUpkeep,
mentalCharacteristic,
mentalCharValue,
skillSubAttribute,
skillSubAttributeLabel,
skillSubAttributeValue,
...rollContext,
}
@@ -420,7 +447,7 @@ export default class PrismRPGRoll extends Roll {
if (options.rollType === "spell-cast" && totalManaCost > 0) {
const actor = game.actors.get(options.actorId)
const currentMana = actor.system.manaPoints.value
// Check if enough mana
if (currentMana < totalManaCost) {
ui.notifications.error(
@@ -428,12 +455,12 @@ export default class PrismRPGRoll extends Roll {
)
return null
}
// Spend mana
await actor.update({
"system.manaPoints.value": currentMana - totalManaCost
await actor.update({
"system.manaPoints.value": currentMana - totalManaCost
})
ui.notifications.info(
`Spent ${totalManaCost} Mana (${currentMana}${currentMana - totalManaCost})`
)