Rework des fiches creature/PJ et Tinji/Loksyu

This commit is contained in:
2026-03-30 17:37:38 +02:00
parent 40c8c523b7
commit 637ea883dd
48 changed files with 3119 additions and 292 deletions
+17 -48
View File
@@ -1,3 +1,16 @@
/**
* Chroniques de l'Étrange — Système FoundryVTT
*
* Chroniques de l'Étrange est un jeu de rôle édité par Antre-Monde Éditions.
* Ce système FoundryVTT est une implémentation indépendante et n'est pas
* affilié à Antre-Monde Éditions,
* mais a été réalisé avec l'autorisation d'Antre-Monde Éditions.
*
* @author LeRatierBretonnien
* @copyright 20242026 LeRatierBretonnien
* @license CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
*/
/**
* Wu Xing rolling system for Chroniques de l'Étrange.
*
@@ -13,7 +26,7 @@
* Each category is associated with one of the five aspects in Wu Xing cycle order.
*/
import { MAGICS } from "../config/constants.js"
import { MAGICS, ASPECT_LABELS, ASPECT_ICONS, ASPECT_FACES, ASPECT_NAMES, WU_XING_CYCLE } from "../config/constants.js"
import { updateLoksyuFromRoll, updateTinjiFromRoll } from "./apps/singletons.js"
const RESULT_TEMPLATE = "systems/fvtt-chroniques-de-l-etrange/templates/form/cde-dice-result.html"
@@ -31,50 +44,6 @@ const LABELELEMENT_TO_ASPECT = {
"CDE.Wood": "wood",
}
/** Map aspect index → string name used in result template */
const ASPECT_NAMES = ["metal", "water", "earth", "fire", "wood"]
/** Map aspect name → i18n label key */
const ASPECT_LABELS = {
metal: "CDE.Metal",
water: "CDE.Water",
earth: "CDE.Earth",
fire: "CDE.Fire",
wood: "CDE.Wood",
}
/** Map aspect name → image path */
const ASPECT_ICONS = {
metal: "systems/fvtt-chroniques-de-l-etrange/images/cde_metal.webp",
water: "systems/fvtt-chroniques-de-l-etrange/images/cde_eau.webp",
earth: "systems/fvtt-chroniques-de-l-etrange/images/cde_terre.webp",
fire: "systems/fvtt-chroniques-de-l-etrange/images/cde_feu.webp",
wood: "systems/fvtt-chroniques-de-l-etrange/images/cde_bois.webp",
}
/** Map aspect index → die face pair [yin, yang] (face=10 stored as 0) */
const ASPECT_FACES = {
metal: [3, 8],
water: [1, 6],
earth: [0, 5], // 0 = face "10"
fire: [2, 7],
wood: [4, 9],
}
/**
* Wu Xing generating/overcoming cycle:
* wood → fire → earth → metal → water → wood (generating)
* For each active aspect, the five categories in order:
* [successes, auspicious, noxious, loksyu, tinji]
*/
const WU_XING_CYCLE = {
wood: ["wood", "fire", "water", "earth", "metal"],
fire: ["fire", "earth", "wood", "metal", "water"],
earth: ["earth", "metal", "fire", "water", "wood"],
metal: ["metal", "water", "earth", "wood", "fire"],
water: ["water", "wood", "metal", "fire", "earth"],
}
/** Maps weapon range string → dice malus applied to the attack pool */
const RANGE_MALUS = {
contact: 0,
@@ -171,7 +140,7 @@ async function showRollPrompt({ title, template, data, fields }) {
* @param {object} params - Initial values
* @returns {Promise<object|null>}
*/
export async function showSkillPrompt(params) {
async function showSkillPrompt(params) {
return showRollPrompt({
title: params.title,
template: params.isSpecial ? SKILL_SPECIAL_PROMPT_TEMPLATE : SKILL_PROMPT_TEMPLATE,
@@ -190,7 +159,7 @@ export async function showSkillPrompt(params) {
/**
* Open the magic roll prompt and return the user-confirmed parameters.
*/
export async function showMagicPrompt(params) {
async function showMagicPrompt(params) {
return showRollPrompt({
title: params.title,
template: MAGIC_PROMPT_TEMPLATE,
@@ -214,7 +183,7 @@ export async function showMagicPrompt(params) {
/**
* Open the weapon attack roll prompt and return user-confirmed parameters.
*/
export async function showWeaponPrompt(params) {
async function showWeaponPrompt(params) {
return showRollPrompt({
title: params.title,
template: WEAPON_PROMPT_TEMPLATE,