Corrections sur anneaux
This commit is contained in:
@@ -104,9 +104,9 @@ export class ChiaroscuroDiceDialog extends FormApplication {
|
|||||||
set ringId(ringId) {
|
set ringId(ringId) {
|
||||||
this.object.ring.id = CONFIG.l5r5e.stances.includes(ringId) ? ringId : "void";
|
this.object.ring.id = CONFIG.l5r5e.stances.includes(ringId) ? ringId : "void";
|
||||||
this.object.ring.value = this._actor?.system?.rings?.[this.object.ring.id] || 1;
|
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") {
|
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";
|
: "system.aspects";
|
||||||
const aspects = foundry.utils.getProperty(this._actor, aspectsPath) ?? {};
|
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;
|
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) {
|
if (Math.abs(newGauge) >= 10) {
|
||||||
// Full reset
|
// Full reset
|
||||||
await this._actor.update({
|
await this._actor.update({
|
||||||
@@ -302,7 +307,10 @@ export class ChiaroscuroDiceDialog extends FormApplication {
|
|||||||
[`${aspectsPath}.lunar`]: 0,
|
[`${aspectsPath}.lunar`]: 0,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await this._actor.update({ [`${aspectsPath}.gauge`]: newGauge });
|
await this._actor.update({
|
||||||
|
[`${aspectsPath}.gauge`]: newGauge,
|
||||||
|
[`${aspectsPath}.${aspectKey}`]: newAspectValue,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user