import { ItemCategory } from "./itemCategories.js"; import { MaterialTier, MATERIAL_TIER_ORDER, MATERIAL_DISPLAY_NAME, tierMinSkillLevel } from "./materialTiers.js"; import { EquipmentKind } from "./equipmentKinds.js"; import { equipImageName } from "./tileSprites.js"; /** * Metal armour — shared overlay sprites in items/armour/*-equip.png, * per-tier tint via magenta mask. Shield (offhand) not included yet. */ export const ArmourItemId = Object.freeze({ bronzeChestplate: 91, bronzeGreaves: 92, bronzeBoots: 93, bronzeHelmet: 94, bronzeFullHelm: 95, bronzeHornedHelm: 96, ironChestplate: 97, ironGreaves: 98, ironBoots: 99, ironHelmet: 100, ironFullHelm: 101, ironHornedHelm: 102, steelChestplate: 103, steelGreaves: 104, steelBoots: 105, steelHelmet: 106, steelFullHelm: 107, steelHornedHelm: 108, mithrilChestplate: 109, mithrilGreaves: 110, mithrilBoots: 111, mithrilHelmet: 112, mithrilFullHelm: 113, mithrilHornedHelm: 114, adamantiumChestplate: 115, adamantiumGreaves: 116, adamantiumBoots: 117, adamantiumHelmet: 118, adamantiumFullHelm: 119, adamantiumHornedHelm: 120, orichalcumChestplate: 121, orichalcumGreaves: 122, orichalcumBoots: 123, orichalcumHelmet: 124, orichalcumFullHelm: 125, orichalcumHornedHelm: 126, dragonChestplate: 127, dragonGreaves: 128, dragonBoots: 129, dragonHelmet: 130, dragonFullHelm: 131, dragonHornedHelm: 132 }); const ARMOUR_PIECES = Object.freeze([ Object.freeze({ suffix: "chestplate", slot: "chest", label: "chestplate", overlay: "chestplate", idKey: "Chestplate", ingots: 6 }), Object.freeze({ suffix: "greaves", slot: "legs", label: "greaves", overlay: "greaves", idKey: "Greaves", ingots: 4 }), Object.freeze({ suffix: "boots", slot: "boots", label: "boots", overlay: "boots", idKey: "Boots", ingots: 2 }), Object.freeze({ suffix: "helmet", slot: "head", label: "helmet", overlay: "helmet", idKey: "Helmet", ingots: 2 }), Object.freeze({ suffix: "full-helm", slot: "head", label: "full helm", overlay: "fullhelm", idKey: "FullHelm", ingots: 3, fullHelm: true }), Object.freeze({ suffix: "horned-helm", slot: "head", label: "horned helm", overlay: "hornedhelm", idKey: "HornedHelm", ingots: 2, needsBone: true }) ]); export function armourItemIdForTier (tier, idKey) { return ArmourItemId[`${tier}${idKey}`] ?? null; } function armourDef (itemId, tier, piece) { const tierName = MATERIAL_DISPLAY_NAME[tier] ?? tier; const key = `${tier}-${piece.suffix}`; const equipment = { slot: piece.slot, tier, kind: EquipmentKind.metalArmour, tintFromTier: true, equipSprite: equipImageName("item", "armour", piece.overlay) }; if (piece.fullHelm) { equipment.minSkillLevel = tierMinSkillLevel(tier) + 1; } return Object.freeze({ itemId, key, displayName: `${tierName} ${piece.label}`, description: `Worn ${tierName.toLowerCase()} ${piece.label}, forged for the road.`, seedValue: 12, stackable: false, maxStackSize: 1, uniqueInstance: false, category: ItemCategory.finished, /** Shared magenta icons under items/armour/{overlay}.png */ iconKey: "armour", defaultState: piece.overlay, tintFromTier: true, equipment: Object.freeze(equipment) }); } function buildArmourDefinitions () { const defs = {}; for (const tier of MATERIAL_TIER_ORDER) { for (const piece of ARMOUR_PIECES) { const idProp = `${tier}${piece.idKey}`; const itemId = ArmourItemId[idProp]; if (itemId == null) { throw new Error(`Missing ArmourItemId for ${idProp}`); } defs[itemId] = armourDef(itemId, tier, piece); } } return Object.freeze(defs); } export const ARMOUR_ITEM_DEFINITIONS = buildArmourDefinitions(); /** Shared piece metadata for smithing recipes (anvil). */ export { ARMOUR_PIECES as ARMOUR_CRAFT_PIECES };