Strip all angle brackets in PF2e attack traits and damage
Broaden stripDiceBrackets to stripAngleBrackets to handle all PF2e tools angle-bracket formatting (e.g. <10 feet>, <15 feet>), not just dice notation. Also strip in damage text. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -114,8 +114,8 @@ describe("normalizePf2eBestiary", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("attack traits formatting", () => {
|
||||
it("strips angle-bracket dice notation from traits", () => {
|
||||
describe("attack formatting", () => {
|
||||
it("strips angle brackets from traits", () => {
|
||||
const [creature] = normalizePf2eBestiary({
|
||||
creature: [
|
||||
minimalCreature({
|
||||
@@ -140,6 +140,34 @@ describe("normalizePf2eBestiary", () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("strips angle brackets from reach values in traits", () => {
|
||||
const [creature] = normalizePf2eBestiary({
|
||||
creature: [
|
||||
minimalCreature({
|
||||
attacks: [
|
||||
{
|
||||
name: "tentacle",
|
||||
range: "Melee",
|
||||
attack: 18,
|
||||
traits: ["agile", "chaotic", "magical", "reach <10 feet>"],
|
||||
damage: "2d8+6 piercing",
|
||||
},
|
||||
],
|
||||
}),
|
||||
],
|
||||
});
|
||||
const attack = creature.attacks?.[0];
|
||||
expect(attack).toBeDefined();
|
||||
expect(attack?.segments[0]).toEqual(
|
||||
expect.objectContaining({
|
||||
type: "text",
|
||||
value: expect.stringContaining(
|
||||
"(agile, chaotic, magical, reach 10 feet)",
|
||||
),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("resistances formatting", () => {
|
||||
|
||||
Reference in New Issue
Block a user