diff --git a/components/public/material-poster.tsx b/components/public/material-poster.tsx index 4eed65c..6ee30e3 100644 --- a/components/public/material-poster.tsx +++ b/components/public/material-poster.tsx @@ -39,6 +39,7 @@ function statLabel(key: string): string { function statIconName(key: string): string | null { const normalized = key.toLowerCase().replace(/[^a-z]/gu, ""); + if (key.includes("%") && ["hp", "atk", "def"].includes(normalized)) return `${normalized}-percent`; if (["hp", "atk", "def", "em", "er"].includes(normalized)) return normalized; if (["critrate", "crit", "criticalrate"].includes(normalized)) return "critrate"; if (["critdmg", "critdamage", "criticaldamage"].includes(normalized)) return "critdmg"; diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 2b1add0..5d5da49 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -323,6 +323,13 @@ "when": 1789637567192, "tag": "0045_simple_argent", "breakpoints": true + }, + { + "idx": 46, + "version": "7", + "when": 1789641217244, + "tag": "0046_spicy_lucky_pierre", + "breakpoints": true } ] -} \ No newline at end of file +} diff --git a/lib/guides/schemas.test.ts b/lib/guides/schemas.test.ts index 91b5ce5..c69c1f1 100644 --- a/lib/guides/schemas.test.ts +++ b/lib/guides/schemas.test.ts @@ -104,12 +104,15 @@ describe("structured guide validation", () => { expect(artifactSectionSchema.safeParse({ ...base, recommendedGroups: [{ ...first, note: "x".repeat(2_001) }] }).success).toBe(false); }); - it("accepts flat artifact substats with the same icons as their percentage variants", () => { + it("uses distinct icons for flat and percentage HP, ATK, and DEF stats", () => { const result = artifactSectionSchema.safeParse({ expectedVersion: 1, groups: artifactGroups, sands: [], goblet: [], circlet: [], substats: ["ATK", "HP", "DEF"], targetGroups: [], talents: [], note: null }); expect(result.success).toBe(true); - expect(targetStatIconName("ATK")).toBe(recommendedStatIconName("ATK%")); - expect(targetStatIconName("HP")).toBe(recommendedStatIconName("HP%")); - expect(targetStatIconName("DEF")).toBe(recommendedStatIconName("DEF%")); + expect(recommendedStatIconName("ATK%")).toBe("atk-percent"); + expect(recommendedStatIconName("HP%")).toBe("hp-percent"); + expect(recommendedStatIconName("DEF%")).toBe("def-percent"); + expect(targetStatIconName("ATK")).toBe("atk"); + expect(targetStatIconName("HP")).toBe("hp"); + expect(targetStatIconName("DEF")).toBe("def"); }); it("maps elemental damage recommendations to Lunaris element icons", () => { diff --git a/lib/guides/stats.ts b/lib/guides/stats.ts index fdd7d91..c141219 100644 --- a/lib/guides/stats.ts +++ b/lib/guides/stats.ts @@ -48,6 +48,7 @@ export function recommendedStatIconName(value: string): string | null { if (value.endsWith(" DMG%")) return "elemental-bonus"; const base = value.replace(/%$/, "").toLowerCase(); + if (value.endsWith("%") && ["hp", "atk", "def"].includes(base)) return `${base}-percent`; return ["hp", "atk", "def", "em", "er"].includes(base) ? base : null; } diff --git a/public/icon/stats/atk-percent.webp b/public/icon/stats/atk-percent.webp new file mode 100644 index 0000000..854d9ac Binary files /dev/null and b/public/icon/stats/atk-percent.webp differ diff --git a/public/icon/stats/def-percent.webp b/public/icon/stats/def-percent.webp new file mode 100644 index 0000000..5f1d38a Binary files /dev/null and b/public/icon/stats/def-percent.webp differ diff --git a/public/icon/stats/hp-percent.webp b/public/icon/stats/hp-percent.webp new file mode 100644 index 0000000..b510b2b Binary files /dev/null and b/public/icon/stats/hp-percent.webp differ