diff --git a/lang/fr.json b/lang/fr.json index 5dfb183..5fb9cca 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -151,7 +151,16 @@ "usedFortune": "Fortune utilisée (1d8+8)", "puiser": "Puiser dans ses ressources", "puiserDesc": "Ignore tous les malus — coche 1 case de Spleen", - "usedPuiser": "Ressources puisées — malus ignorés, +1 Spleen" + "usedPuiser": "Ressources puisées — malus ignorés, +1 Spleen", + "autoSuccess": "Réussite automatique" + }, + "Modifier": { + "evident": "Évident — Réussite automatique", + "malaise": "Malaisé (0)", + "difficile": "Difficile (−2)", + "tres": "Très difficile (−4)", + "extreme": "Extrêmement difficile (−6)", + "incroyable": "Incroyablement difficile (−8)" }, "Moon": { "none": "Aucune phase", diff --git a/module/config/system.mjs b/module/config/system.mjs index 3cf93ab..17533e2 100644 --- a/module/config/system.mjs +++ b/module/config/system.mjs @@ -111,6 +111,16 @@ export const DIFFICULTY_CHOICES = { extreme: { id: "extreme", label: "CELESTOPOL.Difficulty.extreme", value: 13 }, } +/** Modificateurs contextuels (difficulté narrative) pour les jets. */ +export const CONTEXT_MODIFIER_CHOICES = [ + { id: "evident", label: "CELESTOPOL.Modifier.evident", value: "auto" }, + { id: "malaise", label: "CELESTOPOL.Modifier.malaise", value: 0 }, + { id: "difficile", label: "CELESTOPOL.Modifier.difficile", value: -2 }, + { id: "tres", label: "CELESTOPOL.Modifier.tres", value: -4 }, + { id: "extreme", label: "CELESTOPOL.Modifier.extreme", value: -6 }, + { id: "incroyable", label: "CELESTOPOL.Modifier.incroyable", value: -8 }, +] + /** Phases de la lune (dé de lune d8). Index 1-8 = résultat du dé. */ export const MOON_DIE_FACES = [ null, // index 0 non utilisé @@ -172,6 +182,7 @@ export const SYSTEM = { FACTIONS, WOUND_LEVELS, DIFFICULTY_CHOICES, + CONTEXT_MODIFIER_CHOICES, MOON_DIE_FACES, MOON_RESULT_TYPES, EQUIPMENT_TYPES, diff --git a/module/documents/roll.mjs b/module/documents/roll.mjs index 443815c..210b9c2 100644 --- a/module/documents/roll.mjs +++ b/module/documents/roll.mjs @@ -43,7 +43,12 @@ export class CelestopolRoll extends Roll { ? game.i18n.localize(SYSTEM.WOUND_LEVELS[woundLevelId]?.label ?? "") : null - const modifierChoices = [-4, -3, -2, -1, 0, 1, 2, 3, 4].map(v => ({ + const modifierChoices = SYSTEM.CONTEXT_MODIFIER_CHOICES.map(c => ({ + id: c.id, + value: c.value, + label: game.i18n.localize(c.label), + })) + const aspectChoices = [-4, -3, -2, -1, 0, 1, 2, 3, 4].map(v => ({ value: v, label: v > 0 ? `+${v}` : `${v}`, })) @@ -60,6 +65,7 @@ export class CelestopolRoll extends Roll { destGaugeFull, defaultRollMoonDie: options.rollMoonDie ?? false, modifierChoices, + aspectChoices, fortuneValue, } @@ -85,7 +91,9 @@ export class CelestopolRoll extends Roll { } function update() { - const modifier = parseInt(wrap.querySelector('#modifier')?.value ?? 0) || 0 + const rawMod = wrap.querySelector('#modifier')?.value + const autoSucc = rawMod === "auto" + const modifier = autoSucc ? 0 : (parseInt(rawMod ?? 0) || 0) const aspectMod = parseInt(wrap.querySelector('#aspectModifier')?.value ?? 0) || 0 const useDestin = wrap.querySelector('#useDestin')?.checked const useFort = wrap.querySelector('#useFortune')?.checked @@ -110,7 +118,9 @@ export class CelestopolRoll extends Roll { const totalMod = skillValue + effWound + effMod + effAspect let formula - if (useFort) { + if (autoSucc) { + formula = game.i18n.localize("CELESTOPOL.Roll.autoSuccess") + } else if (useFort) { const fm = totalMod + 8 formula = `1d8` + (fm > 0 ? ` + ${fm}` : fm < 0 ? ` − ${Math.abs(fm)}` : ``) } else { @@ -151,7 +161,8 @@ export class CelestopolRoll extends Roll { const difficulty = rollContext.difficulty ?? "normal" const diffConfig = SYSTEM.DIFFICULTY_CHOICES[difficulty] ?? SYSTEM.DIFFICULTY_CHOICES.normal - const modifier = parseInt(rollContext.modifier ?? 0) || 0 + const autoSuccess = rollContext.modifier === "auto" + const modifier = autoSuccess ? 0 : (parseInt(rollContext.modifier ?? 0) || 0) const aspectMod = parseInt(rollContext.aspectModifier ?? 0) || 0 const useDestin = destGaugeFull && (rollContext.useDestin === true || rollContext.useDestin === "true") const useFortune = fortuneValue > 0 && (rollContext.useFortune === true || rollContext.useFortune === "true") @@ -188,6 +199,7 @@ export class CelestopolRoll extends Roll { modifier: effectiveModifier, aspectMod: effectiveAspectMod, woundMalus: effectiveWoundMalus, + autoSuccess, useDestin, useFortune, puiserRessources, @@ -259,6 +271,11 @@ export class CelestopolRoll extends Roll { * - Marge < 0 → échec */ computeResult() { + if (this.options.autoSuccess) { + this.options.resultType = "success" + this.options.margin = null + return + } const threshold = SYSTEM.DIFFICULTY_CHOICES[this.options.difficulty]?.value ?? 0 if (threshold === 0) { this.options.resultType = "unknown" @@ -331,6 +348,7 @@ export class CelestopolRoll extends Roll { marginAbs: margin !== null ? Math.abs(margin) : null, marginAbove: margin !== null && margin >= 0, modifier: this.options.modifier ?? 0, + autoSuccess: this.options.autoSuccess ?? false, aspectMod: this.options.aspectMod ?? 0, skillValue, useDestin: this.options.useDestin ?? false, diff --git a/templates/chat-message.hbs b/templates/chat-message.hbs index 74bb56d..1d8c9ce 100644 --- a/templates/chat-message.hbs +++ b/templates/chat-message.hbs @@ -104,7 +104,10 @@ {{!-- Bandeau résultat --}}
- {{#if isCriticalSuccess}} + {{#if autoSuccess}} + + {{localize "CELESTOPOL.Roll.autoSuccess"}} + {{else if isCriticalSuccess}} ✦✦ {{localize "CELESTOPOL.Roll.criticalSuccess"}} {{localize "CELESTOPOL.Roll.criticalSuccessDesc"}} diff --git a/templates/roll-dialog.hbs b/templates/roll-dialog.hbs index 18c2d95..f5541ce 100644 --- a/templates/roll-dialog.hbs +++ b/templates/roll-dialog.hbs @@ -42,14 +42,14 @@