Expand pre-2024 {@atk} tags to full attack type labels in stat blocks

Old 5etools data uses {@atk mw} instead of {@atkr m}, which the generic
tag handler was reducing to bare "mw" text. Adds dedicated handling for
all {@atk} variants and bumps the bestiary cache version to clear stale
processed data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-24 10:11:54 +01:00
parent 968cc7239b
commit cfd4aef724
4 changed files with 80 additions and 4 deletions

View File

@@ -300,6 +300,44 @@ describe("normalizeBestiary", () => {
expect(creatures[0].proficiencyBonus).toBe(6);
});
it("normalizes pre-2024 {@atk mw} tags to full attack type text", () => {
const raw = {
monster: [
{
name: "Adult Black Dragon",
source: "MM",
size: ["H"],
type: "dragon",
ac: [19],
hp: { average: 195, formula: "17d12 + 85" },
speed: { walk: 40, fly: 80, swim: 40 },
str: 23,
dex: 14,
con: 21,
int: 14,
wis: 13,
cha: 17,
passive: 21,
cr: "14",
action: [
{
name: "Bite",
entries: [
"{@atk mw} {@hit 11} to hit, reach 10 ft., one target. {@h}17 ({@damage 2d10 + 6}) piercing damage plus 4 ({@damage 1d8}) acid damage.",
],
},
],
},
],
};
const creatures = normalizeBestiary(raw);
const bite = creatures[0].actions?.[0];
expect(bite?.text).toContain("Melee Weapon Attack:");
expect(bite?.text).not.toContain("mw");
expect(bite?.text).not.toContain("{@");
});
it("handles fly speed with hover condition", () => {
const raw = {
monster: [