Second round de modifications

This commit is contained in:
2026-04-24 13:37:59 +02:00
parent 779b4c60f5
commit d75b6cb945
16 changed files with 404 additions and 3144 deletions

View File

@@ -47,8 +47,12 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
// Min rank = 1
this.actor.system.identity.school_rank = Math.max(1, this.actor.system.identity.school_rank);
// Split Money
sheetData.data.system.money = this._zeniToMoney(this.actor.system.zeni);
// Money — read separate fields directly (koku/bu/zeni stored independently)
sheetData.data.system.money = {
koku: this.actor.system.koku ?? 0,
bu: this.actor.system.bu ?? 0,
zeni: this.actor.system.zeni ?? 0,
};
// Split school advancements by rank, and calculate xp spent and add it to total
this._prepareSchoolAdvancement(sheetData);
@@ -102,6 +106,9 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
// Chiaroscuro: Arcane items
sheetData.data.arcaneItems = sheetData.items.filter((i) => i.type === "arcane");
// Chiaroscuro: Mystere items
sheetData.data.mystereItems = sheetData.items.filter((i) => i.type === "mystere");
// Chiaroscuro: Identity tabs enriched HTML
sheetData.data.enrichedHtml.identity_text1 = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.actor.system.identity_text1 ?? "", { async: true }
@@ -271,14 +278,17 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
);
}
// Store money in Zeni
if (formData["system.money.koku"] || formData["system.money.bu"] || formData["system.money.zeni"]) {
formData["system.zeni"] = this._moneyToZeni(
formData["system.money.koku"] || 0,
formData["system.money.bu"] || 0,
formData["system.money.zeni"] || 0
);
// Remove fake money object
// Store money as separate fields with auto-conversion (10 zeni = 1 bu, 10 bu = 1 koku)
if (formData["system.money.koku"] !== undefined || formData["system.money.bu"] !== undefined || formData["system.money.zeni"] !== undefined) {
let koku = parseInt(formData["system.money.koku"] ?? 0) || 0;
let bu = parseInt(formData["system.money.bu"] ?? 0) || 0;
let zeni = parseInt(formData["system.money.zeni"] ?? 0) || 0;
// Auto-convert
if (zeni >= 10) { bu += Math.floor(zeni / 10); zeni = zeni % 10; }
if (bu >= 10) { koku += Math.floor(bu / 10); bu = bu % 10; }
formData["system.koku"] = koku;
formData["system.bu"] = bu;
formData["system.zeni"] = zeni;
delete formData["system.money.koku"];
delete formData["system.money.bu"];
delete formData["system.money.zeni"];
@@ -352,21 +362,26 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
const elmt = $(event.currentTarget);
const type = elmt.data("type");
let mod = elmt.data("value");
if (!mod || !type) {
return;
}
const mod = parseInt(elmt.data("value")) || 0;
if (!mod || !type) return;
if (type !== "zeni") {
mod = Math.floor(mod * CONFIG.l5r5e.money[type === "koku" ? 0 : 1]);
}
let koku = parseInt(this.actor.system.koku) || 0;
let bu = parseInt(this.actor.system.bu) || 0;
let zeni = parseInt(this.actor.system.zeni) || 0;
this.actor.system.zeni = +this.actor.system.zeni + mod;
this.actor.update({
system: {
zeni: this.actor.system.zeni,
},
});
if (type === "koku") koku += mod;
else if (type === "bu") bu += mod;
else zeni += mod;
// Auto-convert
if (zeni >= 10) { bu += Math.floor(zeni / 10); zeni = zeni % 10; }
if (bu >= 10) { koku += Math.floor(bu / 10); bu = bu % 10; }
// Clamp negatives
if (zeni < 0) { bu += Math.ceil(zeni / 10); zeni = ((zeni % 10) + 10) % 10; }
if (bu < 0) { koku += Math.ceil(bu / 10); bu = ((bu % 10) + 10) % 10; }
koku = Math.max(0, koku);
this.actor.update({ system: { koku, bu, zeni } });
this.render(false);
}

View File

@@ -244,7 +244,7 @@ export const L5R5E = {
skirmish: "tactics",
mass_battle: "command",
},
noHonorSkillsList: ["commerce", "skulduggery", "medicine", "seafaring", "survival", "labor"],
noHonorSkillsList: ["commerce", "urban", "medicine", "seafaring", "survival", "labor"],
sourceReference: {
"core_rulebook": {
value: "core_rulebook",
@@ -403,34 +403,35 @@ L5R5E.techniques.set("mot_invocation", { type: "chiaroscuro", displayInTypes: tr
// *** SkillId - CategoryId ***
L5R5E.skills = new Map();
L5R5E.skills.set("aesthetics", "artisan");
L5R5E.skills.set("art", "artisan");
L5R5E.skills.set("composition", "artisan");
L5R5E.skills.set("design", "artisan");
L5R5E.skills.set("smithing", "artisan");
L5R5E.skills.set("labor", "artisan");
L5R5E.skills.set("archery", "martial");
L5R5E.skills.set("fitness", "martial");
L5R5E.skills.set("melee", "martial");
L5R5E.skills.set("ranged", "martial");
L5R5E.skills.set("unarmed", "martial");
L5R5E.skills.set("meditation", "martial");
L5R5E.skills.set("tactics", "martial");
L5R5E.skills.set("culture", "scholar");
L5R5E.skills.set("government", "scholar");
L5R5E.skills.set("medicine", "scholar");
L5R5E.skills.set("sentiment", "scholar");
L5R5E.skills.set("tactics", "scholar");
L5R5E.skills.set("theology", "scholar");
L5R5E.skills.set("command", "social");
L5R5E.skills.set("courtesy", "social");
L5R5E.skills.set("invocation", "social");
L5R5E.skills.set("games", "social");
L5R5E.skills.set("performance", "social");
L5R5E.skills.set("animal", "trade");
L5R5E.skills.set("commerce", "trade");
L5R5E.skills.set("labor", "trade");
L5R5E.skills.set("seafaring", "trade");
L5R5E.skills.set("skulduggery", "trade");
L5R5E.skills.set("survival", "trade");
L5R5E.skills.set("urban", "trade");
// *** Symbols ***
L5R5E.symbols = new Map();