feat: ajoute la règle Fortune dans les jets
Règle : si Fortune > 0, le joueur peut cocher 'Fortune' pour lancer 1d8 + 8 au lieu de 2d8 (contraint les probabilités vers le haut). - character.mjs : passe fortuneValue dans roll.prompt() - roll.mjs : checkbox Fortune, formule 1d8 + 8 + totalModifier si cochée - roll-dialog.hbs : bloc Fortune (visible si fortuneValue > 0), preview mis à jour - chat-message.hbs : affiche '+8' dans la zone dés, ligne formule avec badge Fortune - roll.less : styles .form-fortune-row, .fl-mod.fortune, .fortune-fixed-badge - lang/fr.json : Roll.fortune/fortuneBonus/fortuneFixed/usedFortune Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -82,6 +82,21 @@
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{{!-- Fortune (1d8+8) — seulement si Fortune > 0 --}}
|
||||
{{#if fortuneValue}}
|
||||
<div class="form-fortune-row">
|
||||
<label class="fortune-toggle" for="useFortune">
|
||||
<input type="checkbox" id="useFortune" name="useFortune">
|
||||
<span class="fortune-icon">⚜</span>
|
||||
<span class="fortune-text">
|
||||
<span class="fortune-main">{{localize "CELESTOPOL.Roll.fortune"}}</span>
|
||||
<span class="fortune-bonus">{{localize "CELESTOPOL.Roll.fortuneBonus"}}</span>
|
||||
</span>
|
||||
<span class="fortune-badge">{{fortuneValue}}</span>
|
||||
</label>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{!-- Visibilité --}}
|
||||
<div class="form-row-line form-visibility">
|
||||
<label for="visibility">{{localize "CELESTOPOL.Roll.visibility"}}</label>
|
||||
@@ -114,18 +129,25 @@
|
||||
const modifier = parseInt(wrap.querySelector('#modifier')?.value ?? 0) || 0;
|
||||
const aspectMod = parseInt(wrap.querySelector('#aspectModifier')?.value ?? 0) || 0;
|
||||
const useDestin = wrap.querySelector('#useDestin')?.checked;
|
||||
const useFortune= wrap.querySelector('#useFortune')?.checked;
|
||||
const ndice = useDestin ? 3 : 2;
|
||||
const totalMod = skillVal + woundMalus + modifier + aspectMod;
|
||||
|
||||
let formula = `${ndice}d8`;
|
||||
if (totalMod > 0) formula += ` + ${totalMod}`;
|
||||
if (totalMod < 0) formula += ` − ${Math.abs(totalMod)}`;
|
||||
let formula;
|
||||
if (useFortune) {
|
||||
const fm = totalMod + 8;
|
||||
formula = `1d8` + (fm > 0 ? ` + ${fm}` : fm < 0 ? ` − ${Math.abs(fm)}` : ``);
|
||||
} else {
|
||||
formula = `${ndice}d8`;
|
||||
if (totalMod > 0) formula += ` + ${totalMod}`;
|
||||
if (totalMod < 0) formula += ` − ${Math.abs(totalMod)}`;
|
||||
}
|
||||
|
||||
const previewEl = wrap.querySelector('#preview-formula');
|
||||
if (previewEl) previewEl.textContent = formula;
|
||||
}
|
||||
|
||||
wrap.querySelectorAll('#modifier, #aspectModifier, #useDestin').forEach(el => {
|
||||
wrap.querySelectorAll('#modifier, #aspectModifier, #useDestin, #useFortune').forEach(el => {
|
||||
el.addEventListener('change', update);
|
||||
el.addEventListener('input', update);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user