diff --git a/lang/fr.json b/lang/fr.json index d08c7fc..75a95d6 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -144,7 +144,11 @@ "visibilityPublic": "Public", "visibilityGM": "MJ uniquement", "visibilitySelf": "Secret (moi)", - "skillValue": "Valeur de compétence" + "skillValue": "Valeur de compétence", + "fortune": "Utiliser la Fortune", + "fortuneBonus": "1d8 + 8 au lieu de 2d8", + "fortuneFixed": "Bonus fixe Fortune", + "usedFortune": "Fortune utilisée (1d8+8)" }, "Moon": { "none": "Aucune phase", diff --git a/module/documents/roll.mjs b/module/documents/roll.mjs index aa68c9f..d6f4ce3 100644 --- a/module/documents/roll.mjs +++ b/module/documents/roll.mjs @@ -38,6 +38,7 @@ export class CelestopolRoll extends Roll { const skillValue = options.skillValue ?? 0 const woundLevelId = options.woundLevel ?? 0 const destGaugeFull = options.destGaugeFull ?? false + const fortuneValue = options.fortuneValue ?? 0 const woundLabel = woundLevelId > 0 ? game.i18n.localize(SYSTEM.WOUND_LEVELS[woundLevelId]?.label ?? "") : null @@ -59,6 +60,7 @@ export class CelestopolRoll extends Roll { destGaugeFull, defaultRollMoonDie: options.rollMoonDie ?? false, modifierChoices, + fortuneValue, } const content = await foundry.applications.handlebars.renderTemplate( @@ -98,10 +100,15 @@ export class CelestopolRoll extends Roll { const modifier = 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") const rollMoonDie = rollContext.rollMoonDie === true || rollContext.rollMoonDie === "true" + + // Fortune : 1d8 + 8 ; Destin : 3d8 ; sinon : 2d8 const nbDice = useDestin ? 3 : 2 const totalModifier = skillValue + woundMalus + aspectMod + modifier - const formula = buildFormula(nbDice, totalModifier) + const formula = useFortune + ? buildFormula(1, totalModifier + 8) + : buildFormula(nbDice, totalModifier) // Jet du dé de lune séparé (narratif) let moonDieResult = null @@ -121,7 +128,8 @@ export class CelestopolRoll extends Roll { modifier, aspectMod, useDestin, - nbDice, + useFortune, + nbDice: useFortune ? 1 : nbDice, formula, rollMode: rollContext.visibility ?? "publicroll", rollMoonDie, @@ -245,6 +253,7 @@ export class CelestopolRoll extends Roll { aspectMod: this.options.aspectMod ?? 0, skillValue, useDestin: this.options.useDestin ?? false, + useFortune: this.options.useFortune ?? false, nbDice: this.options.nbDice ?? diceResults.length, woundMalus, woundLabel, diff --git a/module/models/character.mjs b/module/models/character.mjs index 9616522..e709ca4 100644 --- a/module/models/character.mjs +++ b/module/models/character.mjs @@ -207,6 +207,7 @@ export default class CelestopolCharacter extends foundry.abstract.TypeDataModel difficulty: this.prefs.difficulty, rollMoonDie: this.prefs.rollMoonDie ?? false, destGaugeFull: this.destin.lvl >= 8, + fortuneValue: this.attributs.fortune.value, }) } } diff --git a/styles/roll.less b/styles/roll.less index 4edd4f5..817e566 100644 --- a/styles/roll.less +++ b/styles/roll.less @@ -285,6 +285,81 @@ .form-visibility label { color: #888; } + // ── Ligne Fortune ── + .form-fortune-row { + border: 1px solid rgba(12,76,12,0.4); + border-radius: 4px; + background: rgba(12,76,12,0.06); + padding: 7px 10px; + + .fortune-toggle { + display: flex; + align-items: center; + gap: 8px; + cursor: pointer; + width: 100%; + + input[type="checkbox"] { + width: 16px; + height: 16px; + flex-shrink: 0; + appearance: none; + -webkit-appearance: none; + border: 2px solid var(--cel-border, #7a5c20); + border-radius: 2px; + background: white; + cursor: pointer; + position: relative; + + &:checked { + background: var(--cel-green, #0c4c0c); + border-color: var(--cel-green, #0c4c0c); + &::after { + content: "⚜"; + position: absolute; + inset: 0; + display: flex; + align-items: center; + justify-content: center; + font-size: 0.6em; + color: white; + } + } + } + + .fortune-icon { + font-size: 1.1em; + color: var(--cel-green, #0c4c0c); + flex-shrink: 0; + } + + .fortune-text { + flex: 1; + .fortune-main { + font-family: var(--cel-font-title, "CopaseticNF", serif); + font-size: 0.9em; + color: var(--cel-green, #0c4c0c); + display: block; + } + .fortune-bonus { + font-size: 0.72em; + color: var(--cel-border, #7a5c20); + font-style: italic; + } + } + + .fortune-badge { + font-size: 0.8em; + font-weight: bold; + color: var(--cel-green, #0c4c0c); + background: rgba(12,76,12,0.12); + border: 1px solid rgba(12,76,12,0.3); + border-radius: 10px; + padding: 1px 8px; + } + } + } + // ── Prévisualisation ── .dice-preview { text-align: center; @@ -431,6 +506,8 @@ line-height: 1; } .fl-mod { color: #444; font-weight: bold; } + .fl-mod.fortune { color: var(--cel-green, #0c4c0c); font-weight: bold; } + .fl-mod.wound { color: #922; } .fl-asp { color: var(--cel-orange, #e07b00); font-weight: bold; } .fl-sep { font-weight: bold; color: var(--cel-border, #7a5c20); margin: 0 2px; } .fl-eq { color: #aaa; } @@ -487,6 +564,22 @@ border-top: 1px dashed var(--cel-border, #7a5c20); .used-destin { font-weight: bold; } + .used-fortune { font-weight: bold; color: var(--cel-green, #0c4c0c); } + } + + // ── Fortune fixe badge dans zone dés ── + .fortune-fixed-badge { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 32px; + height: 32px; + border-radius: 4px; + border: 2px solid var(--cel-green, #0c4c0c); + background: rgba(12,76,12,0.1); + color: var(--cel-green, #0c4c0c); + font-weight: bold; + font-size: 0.9em; } // ── Résultat dé de lune ── diff --git a/templates/chat-message.hbs b/templates/chat-message.hbs index 822a7e5..3f40c32 100644 --- a/templates/chat-message.hbs +++ b/templates/chat-message.hbs @@ -20,14 +20,25 @@ {{#each diceResults as |die|}} {{die}} {{/each}} + {{#if useFortune}}+8{{/if}} {{!-- Formule détaillée --}}