Fix equipment stat columns: bows Archery, clubs Clubs, war axes Axes.
Melee/ranged editor sections now use per-section skills instead of one shared category column.
@@ -28,7 +28,8 @@ import
28
28
normalizeEquipmentStatBonuses,
29
29
equipmentStatBonusMapsEqual,
30
30
equipmentStatRowItemId,
31
equipmentStatRowDefaultTier
31
equipmentStatRowDefaultTier,
32
equipmentStatSectionStats
32
33
} from "/shared/definitions/equipmentStatCategories.js";
33
34
import { applyItemIcon } from "/src/render/potionIcon.js";
34
35
@@ -556,6 +557,7 @@ export function initSettingsModal ({ socket, MessageType, onApplied, onPreviewNi
556
557
557
558
for (const section of category.sections)
558
559
{
560
const sectionStats = equipmentStatSectionStats(category, section);
559
561
if (section.label)
560
562
{
561
563
const heading = document.createElement("h3");
@@ -627,7 +629,7 @@ export function initSettingsModal ({ socket, MessageType, onApplied, onPreviewNi
627
629
const draftCell = draftEquipmentStats[category.id]?.[row.pieceKey]?.[tier] ?? {};
628
630
const baseCell = baselineTable[category.id]?.[row.pieceKey]?.[tier] ?? {};
629
631
630
for (const skillId of category.stats)
632
for (const skillId of sectionStats)
631
633
{
632
634
const line = document.createElement("label");
633
635
line.className = "equip-stats-stat";
@@ -28,7 +28,8 @@ import28
normalizeEquipmentStatBonuses,28
normalizeEquipmentStatBonuses,29
equipmentStatBonusMapsEqual,29
equipmentStatBonusMapsEqual,30
equipmentStatRowItemId,30
equipmentStatRowItemId,31
equipmentStatRowDefaultTier31
equipmentStatRowDefaultTier,32
equipmentStatSectionStats32
} from "/shared/definitions/equipmentStatCategories.js";33
} from "/shared/definitions/equipmentStatCategories.js";33
import { applyItemIcon } from "/src/render/potionIcon.js";34
import { applyItemIcon } from "/src/render/potionIcon.js";34
35
@@ -556,6 +557,7 @@ export function initSettingsModal ({ socket, MessageType, onApplied, onPreviewNi556
557
557
for (const section of category.sections)558
for (const section of category.sections)558
{559
{560
const sectionStats = equipmentStatSectionStats(category, section);559
if (section.label)561
if (section.label)560
{562
{561
const heading = document.createElement("h3");563
const heading = document.createElement("h3");@@ -627,7 +629,7 @@ export function initSettingsModal ({ socket, MessageType, onApplied, onPreviewNi627
const draftCell = draftEquipmentStats[category.id]?.[row.pieceKey]?.[tier] ?? {};629
const draftCell = draftEquipmentStats[category.id]?.[row.pieceKey]?.[tier] ?? {};628
const baseCell = baselineTable[category.id]?.[row.pieceKey]?.[tier] ?? {};630
const baseCell = baselineTable[category.id]?.[row.pieceKey]?.[tier] ?? {};629
631
630
for (const skillId of category.stats)632
for (const skillId of sectionStats)631
{633
{632
const line = document.createElement("label");634
const line = document.createElement("label");633
line.className = "equip-stats-stat";635
line.className = "equip-stats-stat";@@ -309,6 +309,39 @@ test("full helm keeps +1 defence only, not magic or archery penalty", () =>
309
309
assert.equal(defaults.bronze.archery, -1);
310
310
});
311
311
312
test("bows bonus archery and arrows bonus dexterity", () =>
313
{
314
const defaults = defaultEquipmentStatBonuses().rangedWeapons;
315
assert.ok(Object.hasOwn(defaults.bow.pine, SkillId.archery));
316
assert.equal(Object.hasOwn(defaults.bow.pine, SkillId.dexterity), false);
317
assert.ok(Object.hasOwn(defaults.arrow.bronze, SkillId.dexterity));
318
assert.equal(Object.hasOwn(defaults.arrow.bronze, SkillId.archery), false);
319
assert.equal(defaults.bow.pine.archery, tierStatBonus(WoodTier.pine));
320
assert.equal(defaults.arrow.bronze.dexterity, tierStatBonus(MaterialTier.bronze));
321
});
322
323
test("melee weapon sections use Clubs, Swords, and Axes skills", () =>
324
{
325
const defaults = defaultEquipmentStatBonuses().meleeWeapons;
326
assert.ok(Object.hasOwn(defaults.club.pine, SkillId.clubfighting));
327
assert.equal(Object.hasOwn(defaults.club.pine, SkillId.swordfighting), false);
328
assert.ok(Object.hasOwn(defaults.sword.bronze, SkillId.swordfighting));
329
assert.ok(Object.hasOwn(defaults.warAxe.bronze, SkillId.axefighting));
330
assert.equal(Object.hasOwn(defaults.warAxe.bronze, SkillId.swordfighting), false);
331
assert.equal(Object.hasOwn(defaults.warAxe.bronze, SkillId.clubfighting), false);
332
});
333
334
test("legacy bow dexterity settings migrate to archery", () =>
335
{
336
const migrated = normalizeEquipmentStatBonuses({
337
rangedWeapons: {
338
bow: { pine: { dexterity: 4 } }
339
}
340
});
341
assert.equal(migrated.rangedWeapons.bow.pine.archery, 4);
342
assert.equal(Object.hasOwn(migrated.rangedWeapons.bow.pine, SkillId.dexterity), false);
343
});
344
312
345
test("wizard robe bottoms use single cloth tint", () =>
313
346
{
314
347
const def = itemDefinition(WizardItemId.cottonRobeBottoms);
@@ -309,6 +309,39 @@ test("full helm keeps +1 defence only, not magic or archery penalty", () =>309
assert.equal(defaults.bronze.archery, -1);309
assert.equal(defaults.bronze.archery, -1);310
});310
});311
311
312
test("bows bonus archery and arrows bonus dexterity", () =>313
{314
const defaults = defaultEquipmentStatBonuses().rangedWeapons;315
assert.ok(Object.hasOwn(defaults.bow.pine, SkillId.archery));316
assert.equal(Object.hasOwn(defaults.bow.pine, SkillId.dexterity), false);317
assert.ok(Object.hasOwn(defaults.arrow.bronze, SkillId.dexterity));318
assert.equal(Object.hasOwn(defaults.arrow.bronze, SkillId.archery), false);319
assert.equal(defaults.bow.pine.archery, tierStatBonus(WoodTier.pine));320
assert.equal(defaults.arrow.bronze.dexterity, tierStatBonus(MaterialTier.bronze));321
});322
323
test("melee weapon sections use Clubs, Swords, and Axes skills", () =>324
{325
const defaults = defaultEquipmentStatBonuses().meleeWeapons;326
assert.ok(Object.hasOwn(defaults.club.pine, SkillId.clubfighting));327
assert.equal(Object.hasOwn(defaults.club.pine, SkillId.swordfighting), false);328
assert.ok(Object.hasOwn(defaults.sword.bronze, SkillId.swordfighting));329
assert.ok(Object.hasOwn(defaults.warAxe.bronze, SkillId.axefighting));330
assert.equal(Object.hasOwn(defaults.warAxe.bronze, SkillId.swordfighting), false);331
assert.equal(Object.hasOwn(defaults.warAxe.bronze, SkillId.clubfighting), false);332
});333
334
test("legacy bow dexterity settings migrate to archery", () =>335
{336
const migrated = normalizeEquipmentStatBonuses({337
rangedWeapons: {338
bow: { pine: { dexterity: 4 } }339
}340
});341
assert.equal(migrated.rangedWeapons.bow.pine.archery, 4);342
assert.equal(Object.hasOwn(migrated.rangedWeapons.bow.pine, SkillId.dexterity), false);343
});344
312
test("wizard robe bottoms use single cloth tint", () =>345
test("wizard robe bottoms use single cloth tint", () =>313
{346
{314
const def = itemDefinition(WizardItemId.cottonRobeBottoms);347
const def = itemDefinition(WizardItemId.cottonRobeBottoms);