Première release testée

This commit is contained in:
2026-04-23 15:49:58 +02:00
parent 9e9d2c4f3e
commit 2fbcfa52aa
76 changed files with 3335 additions and 184 deletions

View File

@@ -178,6 +178,12 @@ export class ChiaroscuroDiceDialog extends FormApplication {
this.object.useAssistance = event.target.checked;
this.render(false);
});
// Roll button — explicit submit trigger
html.find("button[name='roll']").on("click", (event) => {
event.preventDefault();
this._onSubmit(event);
});
}
async _updateObject(event, formData) {
@@ -185,7 +191,8 @@ export class ChiaroscuroDiceDialog extends FormApplication {
const skillRank = this.object.skill.rank;
const skillBonus = this.object.skill.bonus;
const flatModifier = this.object.modifier;
const difficulty = this.object.difficulty.value;
const difficultyObj = this.object.difficulty;
const difficultyValue = difficultyObj.value;
// Roll the dice using FoundryVTT Roll API
const roll = await new Roll(`${nbDice}d6`).evaluate();
@@ -199,8 +206,8 @@ export class ChiaroscuroDiceDialog extends FormApplication {
// Compute total
const rawSum = adjustedResults.reduce((a, b) => a + b, 0);
const total = rawSum + skillBonus + flatModifier;
const success = total >= difficulty;
const bonus = success ? total - difficulty : 0;
const success = total >= difficultyValue;
const bonus = success ? total - difficultyValue : 0;
// Update aspect gauge after roll
if (this._actor && this.object.useAspectPoint) {
@@ -218,7 +225,7 @@ export class ChiaroscuroDiceDialog extends FormApplication {
total,
skillBonus,
flatModifier,
difficulty,
difficulty: difficultyObj,
success,
bonus,
});