Réglage de la difficulté par défaut
Release Creation / build (release) Successful in 1m13s

This commit is contained in:
2026-05-29 18:28:09 +02:00
parent ec0e522145
commit 5c2a364832
37 changed files with 191 additions and 83 deletions
+10 -7
View File
@@ -294,12 +294,13 @@ export class CelestopolRoll extends Roll {
if (!rollContext) return null
// En combat : Corps PNJ = seuil direct ; sinon seuil fixe = 11
// En combat : Corps PNJ = seuil direct ; sinon seuil configurable via setting
const corpsPnj = isCombat ? (parseInt(rollContext.corpsPnj ?? 7) || 7) : null
const difficulty = isCombat ? "combat" : "standard"
const defaultThreshold = game.settings.get(game.celestopol.SYSTEM.id, game.celestopol.DEFAULT_ROLL_THRESHOLD_SETTING)
const diffConfig = isCombat
? { value: corpsPnj, label: "CELESTOPOL.Combat.corpsPnj" }
: { value: 11, label: "CELESTOPOL.Roll.threshold" }
: { value: defaultThreshold, label: "CELESTOPOL.Roll.threshold" }
const autoSuccess = rollContext.modifier === "auto"
const modifier = autoSuccess ? 0 : (parseInt(rollContext.modifier ?? 0) || 0)
const aspectMod = parseInt(rollContext.aspectModifier ?? 0) || 0
@@ -464,7 +465,7 @@ export class CelestopolRoll extends Roll {
/**
* Détermine succès/échec selon la marge (total seuil).
* Seuil : 11 pour les tests normaux, Corps PNJ pour le combat.
* Seuil : configurable via setting pour les tests normaux, Corps PNJ pour le combat.
* Pas de succès/échec critique — seul le Dé de la Lune produit des résultats exceptionnels.
*/
computeResult() {
@@ -479,9 +480,10 @@ export class CelestopolRoll extends Roll {
this.options.margin = null
return
}
const defaultThreshold = game.settings.get(game.celestopol.SYSTEM.id, game.celestopol.DEFAULT_ROLL_THRESHOLD_SETTING)
const threshold = this.options.isCombat
? (this.options.difficultyValue ?? 0)
: 11
: defaultThreshold
if (threshold === 0) {
this.options.resultType = "unknown"
this.options.margin = null
@@ -510,9 +512,10 @@ export class CelestopolRoll extends Roll {
const resultType = this.resultType
const diceResults = this.dice[0]?.results?.map(r => r.result) ?? []
const diceSum = diceResults.reduce((a, b) => a + b, 0)
const defaultThreshold = game.settings.get(game.celestopol.SYSTEM.id, game.celestopol.DEFAULT_ROLL_THRESHOLD_SETTING)
const threshold = this.options.isCombat
? (this.options.difficultyValue ?? 0)
: 11
: defaultThreshold
const margin = this.options.margin
const woundMalus = this.options.woundMalus ?? 0
const armorMalus = this.options.armorMalus ?? 0
@@ -565,12 +568,12 @@ export class CelestopolRoll extends Roll {
})
const actorType = rollingActor?.type ?? this.options.actorType ?? null
// Libellé de difficulté : en combat "Corps PNJ : N", en opposition "vs ?", sinon "Seuil : 11"
// Libellé de difficulté : en combat "Corps PNJ : N", en opposition "vs ?", sinon "Seuil : N"
const difficultyLabel = this.options.isCombat
? `${game.i18n.localize("CELESTOPOL.Combat.corpsPnj")} : ${threshold}`
: isOpposition
? `${game.i18n.localize("CELESTOPOL.Roll.oppositionVs")}`
: `${game.i18n.localize("CELESTOPOL.Roll.threshold")} : 11`
: `${game.i18n.localize("CELESTOPOL.Roll.threshold")} : ${threshold}`
return {
cssClass: [SYSTEM.id, "dice-roll"].join(" "),