From 2348827842312d94b6f4b94059e67752a1bc815b Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Wed, 20 May 2026 23:03:10 +0200 Subject: [PATCH] Corrections sur anneaux --- system/scripts/dice/chiaroscuro-dice-dialog.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/system/scripts/dice/chiaroscuro-dice-dialog.js b/system/scripts/dice/chiaroscuro-dice-dialog.js index cef119d..cdf9474 100644 --- a/system/scripts/dice/chiaroscuro-dice-dialog.js +++ b/system/scripts/dice/chiaroscuro-dice-dialog.js @@ -104,9 +104,9 @@ export class ChiaroscuroDiceDialog extends FormApplication { set ringId(ringId) { this.object.ring.id = CONFIG.l5r5e.stances.includes(ringId) ? ringId : "void"; this.object.ring.value = this._actor?.system?.rings?.[this.object.ring.id] || 1; - // Auto-derive aspect type from ring (fire/earth → solar, air/water → lunar; void = manual) + // Auto-derive aspect type from ring (air/fire → solar, water/earth → lunar; void = manual) if (this.object.ring.id !== "void") { - this.object.aspectType = ["fire", "earth"].includes(this.object.ring.id) ? "solar" : "lunar"; + this.object.aspectType = ["air", "fire"].includes(this.object.ring.id) ? "solar" : "lunar"; } } @@ -291,9 +291,14 @@ export class ChiaroscuroDiceDialog extends FormApplication { : "system.aspects"; const aspects = foundry.utils.getProperty(this._actor, aspectsPath) ?? {}; - const gaugeDirection = this.object.aspectType === "solar" ? 1 : -1; + const isSolar = this.object.aspectType === "solar"; + const gaugeDirection = isSolar ? 1 : -1; const newGauge = (aspects.gauge ?? 0) + gaugeDirection; + // Decrement the consumed aspect point + const aspectKey = isSolar ? "solar" : "lunar"; + const newAspectValue = Math.max(0, (aspects[aspectKey] ?? 0) - 1); + if (Math.abs(newGauge) >= 10) { // Full reset await this._actor.update({ @@ -302,7 +307,10 @@ export class ChiaroscuroDiceDialog extends FormApplication { [`${aspectsPath}.lunar`]: 0, }); } else { - await this._actor.update({ [`${aspectsPath}.gauge`]: newGauge }); + await this._actor.update({ + [`${aspectsPath}.gauge`]: newGauge, + [`${aspectsPath}.${aspectKey}`]: newAspectValue, + }); } }