Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2348827842 | |||
| 3c92532601 |
@@ -714,6 +714,7 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
|
|||||||
return {
|
return {
|
||||||
uuid: item.uuid,
|
uuid: item.uuid,
|
||||||
skill: item.system.skill,
|
skill: item.system.skill,
|
||||||
|
bonus: parseInt(item.system.bonus || 0),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
|
|||||||
const weapon = this._getWeaponInfos(el.data("weapon-id") || null);
|
const weapon = this._getWeaponInfos(el.data("weapon-id") || null);
|
||||||
const skillId = weapon?.skill || el.data("skill");
|
const skillId = weapon?.skill || el.data("skill");
|
||||||
const ringId = el.data("ring") || this.actor.system?.default_ring || "void";
|
const ringId = el.data("ring") || this.actor.system?.default_ring || "void";
|
||||||
new game.l5r5e.ChiaroscuroDiceDialog({ actor: this.actor, ringId, skillId, itemUuid: weapon?.uuid }).render(true);
|
new game.l5r5e.ChiaroscuroDiceDialog({ actor: this.actor, ringId, skillId, itemUuid: weapon?.uuid, arcaneBonus: weapon?.bonus ?? 0 }).render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -127,6 +127,6 @@ export class NpcSheetL5r5e extends BaseCharacterSheetL5r5e {
|
|||||||
const weapon = this._getWeaponInfos(el.data("weapon-id") || null);
|
const weapon = this._getWeaponInfos(el.data("weapon-id") || null);
|
||||||
const skillId = weapon?.skill || el.data("skill");
|
const skillId = weapon?.skill || el.data("skill");
|
||||||
const ringId = el.data("ring") || this.actor.system?.default_ring || "void";
|
const ringId = el.data("ring") || this.actor.system?.default_ring || "void";
|
||||||
new game.l5r5e.ChiaroscuroDiceDialog({ actor: this.actor, ringId, skillId, itemUuid: weapon?.uuid }).render(true);
|
new game.l5r5e.ChiaroscuroDiceDialog({ actor: this.actor, ringId, skillId, itemUuid: weapon?.uuid, arcaneBonus: weapon?.bonus ?? 0 }).render(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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