Refactor des fiches de creatures

This commit is contained in:
2026-03-30 09:27:11 +02:00
parent 1b5da3e144
commit 6fda4b9246
71 changed files with 547 additions and 231 deletions
+9 -2
View File
@@ -13,6 +13,8 @@
* Each category is associated with one of the five aspects in Wu Xing cycle order.
*/
import { MAGICS } from "../config/constants.js"
const RESULT_TEMPLATE = "systems/fvtt-chroniques-de-l-etrange/templates/form/cde-dice-result.html"
const SKILL_PROMPT_TEMPLATE = "systems/fvtt-chroniques-de-l-etrange/templates/form/cde-skill-dice-prompt.html"
const SKILL_SPECIAL_PROMPT_TEMPLATE = "systems/fvtt-chroniques-de-l-etrange/templates/form/cde-skill-special-dice-prompt.html"
@@ -288,6 +290,11 @@ export async function rollForActor(actor, rollKey) {
numberofdice = sys.aspect[skillLibel]?.value ?? 0
title = game.i18n.localize(sys.aspect[skillLibel]?.label ?? "CDE.Roll")
break
case "aptitude":
// NPC aptitude roll — flat pool with WuXing prompt
numberofdice = sys.aptitudes?.[skillLibel]?.value ?? 0
title = game.i18n.localize(`CDE.${skillLibel.charAt(0).toUpperCase() + skillLibel.slice(1)}`)
break
case "skill":
numberofdice = sys.skills[skillLibel]?.value ?? 0
title = game.i18n.localize(sys.skills[skillLibel]?.label ?? "CDE.Roll")
@@ -329,7 +336,7 @@ export async function rollForActor(actor, rollKey) {
ui.notifications.warn(game.i18n.localize("CDE.Error6"))
return
}
title = `${game.i18n.localize(MAGIC_I18N_KEYS[skillLibel] ?? "CDE.Magics")} [${game.i18n.localize(game.system.CONST?.MAGICS?.[skillLibel]?.speciality?.[specialLibel]?.label ?? "")}]`
title = `${game.i18n.localize(MAGIC_I18N_KEYS[skillLibel] ?? "CDE.Magics")} [${game.i18n.localize(MAGICS?.[skillLibel]?.speciality?.[specialLibel]?.label ?? "")}]`
break
case "itemkungfu": {
// skillLibel = item._id — look up the kungfu item to find which skill + aspect to use
@@ -474,7 +481,7 @@ export async function rollForActor(actor, rollKey) {
let defaultSpecialAspect = 0
if (isMagicSpecial && specialLibel) {
// Look up the speciality's element from the MAGICS config constant
const specialCfg = game.system.CONST?.MAGICS?.[skillLibel]?.speciality?.[specialLibel]
const specialCfg = MAGICS?.[skillLibel]?.speciality?.[specialLibel]
const aspectName = LABELELEMENT_TO_ASPECT[specialCfg?.labelelement]
if (aspectName) {
defaultSpecialAspect = ASPECT_NAMES.indexOf(aspectName)