Corrections sur anneaux

This commit is contained in:
2026-05-20 23:03:10 +02:00
parent 3c92532601
commit 7b2e521a8b
+12 -4
View File
@@ -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,
});
}
}