BlueGit

timfa questward

Add war axes, melee weapon bonuses, and tinderbox lighting overlay.

War axes craft from three bars plus a handle; swords/axes/clubs keep distinct strength and weapon-skill curves, and firestarting shows the tinderbox equip sprite.

timfa Tim Falken · pushed by timfa

Authored 2026-08-30 · 2 months ago

Hash
f5867861d730ffe67e46ff7f434a01150fa51ad7
Parent
6d82116b
16 files changed +303 −50
client/assets/items/tinderbox/tinderbox-equip.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/items/tinderbox/tinderbox.png Binary file +0 −0

The contents of this binary file are not shown.

client/assets/items/waraxe/waraxe-equip.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/items/waraxe/waraxe-head.png added Binary file +0 −0

The contents of this binary file are not shown.

client/assets/items/waraxe/waraxe.png added Binary file +0 −0

The contents of this binary file are not shown.

client/src/render/worldView.js +24 −7
@@ -2213,13 +2213,11 @@ export class WorldView
2213 2213 if (!this.bloomEnabled)
2214 2214 { continue; }
2215 2215 overlay.transform.rotation = walkTilt;
2216 this.#syncLitSprite(
2217 overlay,
2218 tileShade,
2219 flashStrength,
2220 wade,
2221 entity.bloomOverlayTints?.[index] ?? entity.bodyTint ?? null
2222 );
2216 const bloomTint = entity.bloomOverlayTints?.[index] ?? entity.bodyTint ?? null;
2217 if (bloomTint)
2218 { this.#syncUnlitTintSprite(overlay, bloomTint); }
2219 else
2220 { this.#syncLitSprite(overlay, tileShade, flashStrength, wade); }
2223 2221 this.#placePivoted(overlay, pivotX, pivotY, pivotY + 0.002, SORT_ENTITY, entity.visualScale ?? 1);
2224 2222 }
2225 2223 this.#placeHpBar(entity, pivotX, pivotY);
@@ -2236,6 +2234,25 @@ export class WorldView
2236 2234 object.renderer.secondaryMap = null;
2237 2235 }
2238 2236
2237 /** Bloom / unlit overlays that still need magenta channel tint (e.g. elemental sprites). */
2238 #syncUnlitTintSprite (object, tintColor)
2239 {
2240 if (!object?.renderer || !tintColor)
2241 { return; }
2242 const tint = normalizeRgb(tintColor);
2243 const height = object.renderer.sprite?.height ?? SPRITE_SIZE_PX;
2244 object.renderer.shader = getTintLitSpriteShader();
2245 object.renderer.shaderUniforms = {
2246 u_darkness: 0,
2247 u_strength: 0,
2248 u_wade: 0,
2249 u_spriteHeight: height,
2250 u_useTint: 1,
2251 u_tintColor: [tint.r, tint.g, tint.b]
2252 };
2253 object.renderer.secondaryMap = null;
2254 }
2255
2239 2256 #syncLitSprite (object, darkness, flashStrength = 0, wade = false, tintColor = null)
2240 2257 {
2241 2258 if (!object?.renderer || object._lit === false)
@@ -2213,13 +2213,11 @@ export class WorldView
2213 if (!this.bloomEnabled)
2213 if (!this.bloomEnabled)
2214 { continue; }
2214 { continue; }
2215 overlay.transform.rotation = walkTilt;
2215 overlay.transform.rotation = walkTilt;
2216 this.#syncLitSprite(
2216 const bloomTint = entity.bloomOverlayTints?.[index] ?? entity.bodyTint ?? null;
2217 overlay,
2217 if (bloomTint)
2218 tileShade,
2218 { this.#syncUnlitTintSprite(overlay, bloomTint); }
2219 flashStrength,
2219 else
2220 wade,
2220 { this.#syncLitSprite(overlay, tileShade, flashStrength, wade); }
2221 entity.bloomOverlayTints?.[index] ?? entity.bodyTint ?? null
2222 );
2223 this.#placePivoted(overlay, pivotX, pivotY, pivotY + 0.002, SORT_ENTITY, entity.visualScale ?? 1);
2221 this.#placePivoted(overlay, pivotX, pivotY, pivotY + 0.002, SORT_ENTITY, entity.visualScale ?? 1);
2224 }
2222 }
2225 this.#placeHpBar(entity, pivotX, pivotY);
2223 this.#placeHpBar(entity, pivotX, pivotY);
@@ -2236,6 +2234,25 @@ export class WorldView
2236 object.renderer.secondaryMap = null;
2234 object.renderer.secondaryMap = null;
2237 }
2235 }
2238
2236
2237 /** Bloom / unlit overlays that still need magenta channel tint (e.g. elemental sprites). */
2238 #syncUnlitTintSprite (object, tintColor)
2239 {
2240 if (!object?.renderer || !tintColor)
2241 { return; }
2242 const tint = normalizeRgb(tintColor);
2243 const height = object.renderer.sprite?.height ?? SPRITE_SIZE_PX;
2244 object.renderer.shader = getTintLitSpriteShader();
2245 object.renderer.shaderUniforms = {
2246 u_darkness: 0,
2247 u_strength: 0,
2248 u_wade: 0,
2249 u_spriteHeight: height,
2250 u_useTint: 1,
2251 u_tintColor: [tint.r, tint.g, tint.b]
2252 };
2253 object.renderer.secondaryMap = null;
2254 }
2255
2239 #syncLitSprite (object, darkness, flashStrength = 0, wade = false, tintColor = null)
2256 #syncLitSprite (object, darkness, flashStrength = 0, wade = false, tintColor = null)
2240 {
2257 {
2241 if (!object?.renderer || object._lit === false)
2258 if (!object?.renderer || object._lit === false)
server/src/combat/service.js +1 −1
@@ -143,7 +143,7 @@ function playerCombatLevels (ecs, handle, profile, settings = null)
143 143 bonuses[SkillId.mind] = (bonuses[SkillId.mind] ?? 0) + (status.mind ?? 0);
144 144
145 145 return {
146 hitLevel: skillLevel(skills, profile.hitSkillId ?? SkillId.unarmed),
146 hitLevel: effectiveSkillLevel(skills, profile.hitSkillId ?? SkillId.unarmed, bonuses),
147 147 damageLevel: effectiveSkillLevel(skills, profile.damageSkillId ?? SkillId.strength, bonuses),
148 148 agilityLevel: effectiveSkillLevel(skills, SkillId.agility, bonuses),
149 149 defenceLevel: effectiveSkillLevel(skills, SkillId.defence, bonuses)
@@ -143,7 +143,7 @@ function playerCombatLevels (ecs, handle, profile, settings = null)
143 bonuses[SkillId.mind] = (bonuses[SkillId.mind] ?? 0) + (status.mind ?? 0);
143 bonuses[SkillId.mind] = (bonuses[SkillId.mind] ?? 0) + (status.mind ?? 0);
144
144
145 return {
145 return {
146 hitLevel: skillLevel(skills, profile.hitSkillId ?? SkillId.unarmed),
146 hitLevel: effectiveSkillLevel(skills, profile.hitSkillId ?? SkillId.unarmed, bonuses),
147 damageLevel: effectiveSkillLevel(skills, profile.damageSkillId ?? SkillId.strength, bonuses),
147 damageLevel: effectiveSkillLevel(skills, profile.damageSkillId ?? SkillId.strength, bonuses),
148 agilityLevel: effectiveSkillLevel(skills, SkillId.agility, bonuses),
148 agilityLevel: effectiveSkillLevel(skills, SkillId.agility, bonuses),
149 defenceLevel: effectiveSkillLevel(skills, SkillId.defence, bonuses)
149 defenceLevel: effectiveSkillLevel(skills, SkillId.defence, bonuses)
server/src/simulation/spawners.js +28 −18
@@ -1,22 +1,25 @@
1 1 import { GAIT, CHUNK_SIZE } from "../../../shared/protocol/constants.js";
2 import {
3 mobCanFight,
4 mobSkillLevels,
5 mobHealthForLevel,
6 mobSpellCastChancePercent
7 } from "../../../shared/definitions/mobCombat.js";
8 import {
9 normalizeSpawnerConfig,
10 listAmbientMobTypes,
11 mobDefinition,
12 mobSpriteName,
13 MobId,
14 spawnerEquipmentSlot,
15 isTownGuardMob,
16 isHumanoidMob
17 } from "../../../shared/definitions/mobs.js";
2 import
3 {
4 mobCanFight,
5 mobSkillLevels,
6 mobHealthForLevel,
7 mobSpellCastChancePercent
8 } from "../../../shared/definitions/mobCombat.js";
9 import
10 {
11 normalizeSpawnerConfig,
12 listAmbientMobTypes,
13 mobDefinition,
14 mobSpriteName,
15 MobId,
16 spawnerEquipmentSlot,
17 isTownGuardMob,
18 isHumanoidMob
19 } from "../../../shared/definitions/mobs.js";
18 20 import { spellDefinition, SPRITE_BOLT_SPELL_BY_ELEMENT } from "../../../shared/definitions/spells.js";
19 21 import { MAGIC_ELEMENT_ORDER, magicElementTint } from "../../../shared/definitions/attackTypes.js";
22 import { essenceElementDisplayName } from "../../../shared/definitions/essenceItems.js";
20 23 import { LeatherItemId } from "../../../shared/definitions/leatherItems.js";
21 24 import { CENTRAL_EXCHANGE_STAFF } from "../../../shared/market/exchange.js";
22 25 import { emptyEquipment } from "../../../shared/items/inventory.js";
@@ -238,14 +241,21 @@ export function mobComponents (request)
238 241 }
239 242
240 243 let element = request.element ?? null;
241 if (def.randomElementOnSpawn && !element)
244 if ((def.randomElementOnSpawn || def.mobTypeId === MobId.sprite) && !element)
242 245 {
243 246 element = MAGIC_ELEMENT_ORDER[Math.floor(Math.random() * MAGIC_ELEMENT_ORDER.length)];
244 247 }
245 248 if (element)
246 249 {
247 appearance.tint = magicElementTint(element);
250 const tint = magicElementTint(element);
251 appearance.tint = { r: tint.r, g: tint.g, b: tint.b };
248 252 appearance.bloomBody = !!def.bloomBody;
253 if (def.mobTypeId === MobId.sprite || def.randomElementOnSpawn)
254 {
255 const label = essenceElementDisplayName(element);
256 appearance.firstName = `${label} Sprite`;
257 appearance.lastName = "";
258 }
249 259 }
250 260
251 261 const maxHp = mobHealthForLevel(def, level);
@@ -1,22 +1,25 @@
1import { GAIT, CHUNK_SIZE } from "../../../shared/protocol/constants.js";
1import { GAIT, CHUNK_SIZE } from "../../../shared/protocol/constants.js";
2import {
2import
3 mobCanFight,
3 {
4 mobSkillLevels,
4 mobCanFight,
5 mobHealthForLevel,
5 mobSkillLevels,
6 mobSpellCastChancePercent
6 mobHealthForLevel,
7} from "../../../shared/definitions/mobCombat.js";
7 mobSpellCastChancePercent
8import {
8 } from "../../../shared/definitions/mobCombat.js";
9 normalizeSpawnerConfig,
9import
10 listAmbientMobTypes,
10 {
11 mobDefinition,
11 normalizeSpawnerConfig,
12 mobSpriteName,
12 listAmbientMobTypes,
13 MobId,
13 mobDefinition,
14 spawnerEquipmentSlot,
14 mobSpriteName,
15 isTownGuardMob,
15 MobId,
16 isHumanoidMob
16 spawnerEquipmentSlot,
17} from "../../../shared/definitions/mobs.js";
17 isTownGuardMob,
18 isHumanoidMob
19 } from "../../../shared/definitions/mobs.js";
18import { spellDefinition, SPRITE_BOLT_SPELL_BY_ELEMENT } from "../../../shared/definitions/spells.js";
20import { spellDefinition, SPRITE_BOLT_SPELL_BY_ELEMENT } from "../../../shared/definitions/spells.js";
19import { MAGIC_ELEMENT_ORDER, magicElementTint } from "../../../shared/definitions/attackTypes.js";
21import { MAGIC_ELEMENT_ORDER, magicElementTint } from "../../../shared/definitions/attackTypes.js";
22import { essenceElementDisplayName } from "../../../shared/definitions/essenceItems.js";
20import { LeatherItemId } from "../../../shared/definitions/leatherItems.js";
23import { LeatherItemId } from "../../../shared/definitions/leatherItems.js";
21import { CENTRAL_EXCHANGE_STAFF } from "../../../shared/market/exchange.js";
24import { CENTRAL_EXCHANGE_STAFF } from "../../../shared/market/exchange.js";
22import { emptyEquipment } from "../../../shared/items/inventory.js";
25import { emptyEquipment } from "../../../shared/items/inventory.js";
@@ -238,14 +241,21 @@ export function mobComponents (request)
238 }
241 }
239
242
240 let element = request.element ?? null;
243 let element = request.element ?? null;
241 if (def.randomElementOnSpawn && !element)
244 if ((def.randomElementOnSpawn || def.mobTypeId === MobId.sprite) && !element)
242 {
245 {
243 element = MAGIC_ELEMENT_ORDER[Math.floor(Math.random() * MAGIC_ELEMENT_ORDER.length)];
246 element = MAGIC_ELEMENT_ORDER[Math.floor(Math.random() * MAGIC_ELEMENT_ORDER.length)];
244 }
247 }
245 if (element)
248 if (element)
246 {
249 {
247 appearance.tint = magicElementTint(element);
250 const tint = magicElementTint(element);
251 appearance.tint = { r: tint.r, g: tint.g, b: tint.b };
248 appearance.bloomBody = !!def.bloomBody;
252 appearance.bloomBody = !!def.bloomBody;
253 if (def.mobTypeId === MobId.sprite || def.randomElementOnSpawn)
254 {
255 const label = essenceElementDisplayName(element);
256 appearance.firstName = `${label} Sprite`;
257 appearance.lastName = "";
258 }
249 }
259 }
250
260
251 const maxHp = mobHealthForLevel(def, level);
261 const maxHp = mobHealthForLevel(def, level);
shared/crafting/tierRecipes.js +41 −0
@@ -245,6 +245,45 @@ function swordAssembleRecipes ()
245 245 });
246 246 }
247 247
248 function warAxeHeadRecipes ()
249 {
250 return MATERIAL_TIER_ORDER.map((metalTier) => tierRecipe({
251 recipeId: `war-axe-head-${metalTier}`,
252 craftGroup: "war-axe-head",
253 craftGroupLabel: "War axe head",
254 stationId: CraftingStationId.anvil,
255 outputFamily: ItemFamilyId.warAxeHead,
256 outputTier: metalTier,
257 inputs: [{ itemId: familyItemId(ItemFamilyId.bar, metalTier), quantity: 3 }],
258 minSkillLevel: tierSmeltSkillLevel(metalTier),
259 skillId: "smithing",
260 xpMaterial: metalTier
261 }));
262 }
263
264 function warAxeAssembleRecipes ()
265 {
266 return MATERIAL_TIER_ORDER.map((metalTier) =>
267 {
268 const woodTier = woodTierForMetal(metalTier);
269 return tierRecipe({
270 recipeId: `war-axe-${metalTier}`,
271 craftGroup: "war-axe",
272 craftGroupLabel: "War axe",
273 stationId: CraftingStationId.craftingBench,
274 outputFamily: ItemFamilyId.warAxe,
275 outputTier: metalTier,
276 inputs: [
277 { itemId: familyItemId(ItemFamilyId.handle, woodTier), quantity: 1 },
278 { itemId: familyItemId(ItemFamilyId.warAxeHead, metalTier), quantity: 1 }
279 ],
280 minSkillLevel: tierCraftSkillLevel(metalTier),
281 skillId: "crafting",
282 xpMaterial: metalTier
283 });
284 });
285 }
286
248 287 function arrowShaftRecipes ()
249 288 {
250 289 return WOOD_TIER_ORDER.map((woodTier) => tierRecipe({
@@ -392,6 +431,8 @@ export const TIER_FAMILY_RECIPES = Object.freeze([
392 431 ...plantClippersRecipes(),
393 432 ...swordBladeRecipes(),
394 433 ...swordAssembleRecipes(),
434 ...warAxeHeadRecipes(),
435 ...warAxeAssembleRecipes(),
395 436 ...arrowShaftRecipes(),
396 437 ...arrowTipRecipes(),
397 438 ...arrowAssembleRecipes(),
@@ -245,6 +245,45 @@ function swordAssembleRecipes ()
245 });
245 });
246}
246}
247
247
248function warAxeHeadRecipes ()
249{
250 return MATERIAL_TIER_ORDER.map((metalTier) => tierRecipe({
251 recipeId: `war-axe-head-${metalTier}`,
252 craftGroup: "war-axe-head",
253 craftGroupLabel: "War axe head",
254 stationId: CraftingStationId.anvil,
255 outputFamily: ItemFamilyId.warAxeHead,
256 outputTier: metalTier,
257 inputs: [{ itemId: familyItemId(ItemFamilyId.bar, metalTier), quantity: 3 }],
258 minSkillLevel: tierSmeltSkillLevel(metalTier),
259 skillId: "smithing",
260 xpMaterial: metalTier
261 }));
262}
263
264function warAxeAssembleRecipes ()
265{
266 return MATERIAL_TIER_ORDER.map((metalTier) =>
267 {
268 const woodTier = woodTierForMetal(metalTier);
269 return tierRecipe({
270 recipeId: `war-axe-${metalTier}`,
271 craftGroup: "war-axe",
272 craftGroupLabel: "War axe",
273 stationId: CraftingStationId.craftingBench,
274 outputFamily: ItemFamilyId.warAxe,
275 outputTier: metalTier,
276 inputs: [
277 { itemId: familyItemId(ItemFamilyId.handle, woodTier), quantity: 1 },
278 { itemId: familyItemId(ItemFamilyId.warAxeHead, metalTier), quantity: 1 }
279 ],
280 minSkillLevel: tierCraftSkillLevel(metalTier),
281 skillId: "crafting",
282 xpMaterial: metalTier
283 });
284 });
285}
286
248function arrowShaftRecipes ()
287function arrowShaftRecipes ()
249{
288{
250 return WOOD_TIER_ORDER.map((woodTier) => tierRecipe({
289 return WOOD_TIER_ORDER.map((woodTier) => tierRecipe({
@@ -392,6 +431,8 @@ export const TIER_FAMILY_RECIPES = Object.freeze([
392 ...plantClippersRecipes(),
431 ...plantClippersRecipes(),
393 ...swordBladeRecipes(),
432 ...swordBladeRecipes(),
394 ...swordAssembleRecipes(),
433 ...swordAssembleRecipes(),
434 ...warAxeHeadRecipes(),
435 ...warAxeAssembleRecipes(),
395 ...arrowShaftRecipes(),
436 ...arrowShaftRecipes(),
396 ...arrowTipRecipes(),
437 ...arrowTipRecipes(),
397 ...arrowAssembleRecipes(),
438 ...arrowAssembleRecipes(),
shared/definitions/craftingItems.js +3 −0
@@ -80,6 +80,9 @@ export const CRAFTING_ITEM_STUBS = Object.freeze({
80 80 uniqueInstance: true,
81 81 category: ItemCategory.tool,
82 82 iconKey: "tinderbox",
83 defaultState: "tinderbox",
84 /** Show tinderbox-equip while lighting a ground log (not worn gear). */
85 gatherEquipSprite: true,
83 86 npcShopAllowed: true,
84 87 defaultInstance: tinderboxItemInstance()
85 88 }),
@@ -80,6 +80,9 @@ export const CRAFTING_ITEM_STUBS = Object.freeze({
80 uniqueInstance: true,
80 uniqueInstance: true,
81 category: ItemCategory.tool,
81 category: ItemCategory.tool,
82 iconKey: "tinderbox",
82 iconKey: "tinderbox",
83 defaultState: "tinderbox",
84 /** Show tinderbox-equip while lighting a ground log (not worn gear). */
85 gatherEquipSprite: true,
83 npcShopAllowed: true,
86 npcShopAllowed: true,
84 defaultInstance: tinderboxItemInstance()
87 defaultInstance: tinderboxItemInstance()
85 }),
88 }),
shared/definitions/equipmentStatCategories.js +88 −17
@@ -1,21 +1,25 @@
1 1 import { SkillId } from "./skills.js";
2 2 import { EquipmentKind } from "./equipmentKinds.js";
3 import {
4 MATERIAL_TIER_ORDER,
5 WOOD_TIER_ORDER,
6 CLOTH_TIER_ORDER,
7 LEATHER_TIER_ORDER,
8 MATERIAL_DISPLAY_NAME,
9 CLOTH_DISPLAY_NAME,
10 LEATHER_DISPLAY_NAME,
11 WoodTier,
12 tierStatBonus
13 } from "./materialTiers.js";
3 import
4 {
5 MATERIAL_TIER_ORDER,
6 WOOD_TIER_ORDER,
7 CLOTH_TIER_ORDER,
8 LEATHER_TIER_ORDER,
9 MATERIAL_DISPLAY_NAME,
10 CLOTH_DISPLAY_NAME,
11 LEATHER_DISPLAY_NAME,
12 WoodTier,
13 tierStatBonus,
14 tierRank
15 } from "./materialTiers.js";
14 16 import { ARMOUR_CRAFT_PIECES, armourItemIdForTier } from "./armourItems.js";
15 17 import { sweaterItemId, shirtItemId, shortsItemId, skirtItemId, trousersItemId } from "./clothItems.js";
16 18 import { LeatherItemId } from "./leatherItems.js";
17 19 import { ItemId, itemDefinition, ITEM_DEFINITIONS } from "./items.js";
18 20 import { quarterstaffItemIdForWood } from "./woodItems.js";
21 import { swordItemIdForMetal } from "./swordItems.js";
22 import { warAxeItemIdForMetal } from "./warAxeItems.js";
19 23 import { arrowItemId, bowItemId } from "./rangedItems.js";
20 24 import { staffItemIdForWood } from "./gemItems.js";
21 25
@@ -121,21 +125,58 @@ export const EQUIPMENT_STAT_CATEGORIES = Object.freeze([
121 125 Object.freeze({
122 126 id: EquipmentStatCategoryId.meleeWeapons,
123 127 label: "Melee weapons",
124 stats: Object.freeze([SkillId.strength]),
128 stats: Object.freeze([SkillId.strength, SkillId.swordfighting]),
125 129 sections: Object.freeze([
126 130 Object.freeze({
127 131 id: "wood",
132 label: "Clubs",
128 133 tierOrder: WOOD_TIER_ORDER,
129 134 tierDisplayName: woodDisplayName,
130 135 rows: Object.freeze([
131 136 Object.freeze({
132 137 pieceKey: "club",
133 138 label: "Stick / Quarterstaff",
139 /** Strength curve only — cheap; no weapon-skill bonus. */
140 defaultBonusByStat: Object.freeze({ [SkillId.strength]: "tier" }),
134 141 resolveItemId: (tier) => (tier === WoodTier.pine
135 142 ? ItemId.stick
136 143 : quarterstaffItemIdForWood(tier))
137 144 })
138 145 ])
146 }),
147 Object.freeze({
148 id: "swords",
149 label: "Swords",
150 tierOrder: MATERIAL_TIER_ORDER,
151 tierDisplayName: metalDisplayName,
152 rows: Object.freeze([
153 Object.freeze({
154 pieceKey: "sword",
155 label: "Sword",
156 /** Normal strength + swordfighting equal to tier rank (1…7). */
157 defaultBonusByStat: Object.freeze({
158 [SkillId.strength]: "tier",
159 [SkillId.swordfighting]: "rank"
160 }),
161 resolveItemId: (tier) => swordItemIdForMetal(tier)
162 })
163 ])
164 }),
165 Object.freeze({
166 id: "warAxes",
167 label: "War axes",
168 tierOrder: MATERIAL_TIER_ORDER,
169 tierDisplayName: metalDisplayName,
170 rows: Object.freeze([
171 Object.freeze({
172 pieceKey: "warAxe",
173 label: "War axe",
174 /** Normal strength curve +1 at every tier. */
175 defaultBonusByStat: Object.freeze({ [SkillId.strength]: "tier" }),
176 defaultBonusExtra: 1,
177 resolveItemId: (tier) => warAxeItemIdForMetal(tier)
178 })
179 ])
139 180 })
140 181 ])
141 182 }),
@@ -360,14 +401,44 @@ function emptyStatBag (stats)
360 401 return bag;
361 402 }
362 403
404 function resolveDefaultBonusMode (mode, tier, row)
405 {
406 const key = tier === SINGLETON_TIER_KEY ? null : tier;
407 const extra = Number(row.defaultBonusExtra) || 0;
408 if (mode === "rank")
409 { return Math.max(0, Math.floor(tierRank(key) + extra)); }
410 if (mode === "tier" || mode == null)
411 {
412 const base = row.defaultBonus != null
413 ? Number(row.defaultBonus) || 0
414 : tierStatBonus(key);
415 return Math.max(0, Math.floor(base + extra));
416 }
417 const n = Math.floor(Number(mode));
418 return Number.isFinite(n) ? Math.max(0, n) : 0;
419 }
420
363 421 function defaultCellForRow (row, stats, tier)
364 422 {
365 423 const cell = emptyStatBag(stats);
366 const base = row.defaultBonus != null
367 ? Number(row.defaultBonus) || 0
368 : tierStatBonus(tier === SINGLETON_TIER_KEY ? null : tier);
369 const extra = Number(row.defaultBonusExtra) || 0;
370 const value = Math.max(0, Math.floor(base + extra));
424 const byStat = row.defaultBonusByStat;
425 if (byStat && typeof byStat === "object")
426 {
427 for (const [skillId, mode] of Object.entries(byStat))
428 {
429 if (!Object.prototype.hasOwnProperty.call(cell, skillId))
430 { continue; }
431 cell[skillId] = resolveDefaultBonusMode(mode, tier, row);
432 }
433 return cell;
434 }
435 const value = resolveDefaultBonusMode("tier", tier, row);
436 if (row.bonusStat)
437 {
438 if (Object.prototype.hasOwnProperty.call(cell, row.bonusStat))
439 { cell[row.bonusStat] = value; }
440 return cell;
441 }
371 442 for (const skillId of stats)
372 443 { cell[skillId] = value; }
373 444 return cell;
@@ -1,21 +1,25 @@
1import { SkillId } from "./skills.js";
1import { SkillId } from "./skills.js";
2import { EquipmentKind } from "./equipmentKinds.js";
2import { EquipmentKind } from "./equipmentKinds.js";
3import {
3import
4 MATERIAL_TIER_ORDER,
4 {
5 WOOD_TIER_ORDER,
5 MATERIAL_TIER_ORDER,
6 CLOTH_TIER_ORDER,
6 WOOD_TIER_ORDER,
7 LEATHER_TIER_ORDER,
7 CLOTH_TIER_ORDER,
8 MATERIAL_DISPLAY_NAME,
8 LEATHER_TIER_ORDER,
9 CLOTH_DISPLAY_NAME,
9 MATERIAL_DISPLAY_NAME,
10 LEATHER_DISPLAY_NAME,
10 CLOTH_DISPLAY_NAME,
11 WoodTier,
11 LEATHER_DISPLAY_NAME,
12 tierStatBonus
12 WoodTier,
13} from "./materialTiers.js";
13 tierStatBonus,
14 tierRank
15 } from "./materialTiers.js";
14import { ARMOUR_CRAFT_PIECES, armourItemIdForTier } from "./armourItems.js";
16import { ARMOUR_CRAFT_PIECES, armourItemIdForTier } from "./armourItems.js";
15import { sweaterItemId, shirtItemId, shortsItemId, skirtItemId, trousersItemId } from "./clothItems.js";
17import { sweaterItemId, shirtItemId, shortsItemId, skirtItemId, trousersItemId } from "./clothItems.js";
16import { LeatherItemId } from "./leatherItems.js";
18import { LeatherItemId } from "./leatherItems.js";
17import { ItemId, itemDefinition, ITEM_DEFINITIONS } from "./items.js";
19import { ItemId, itemDefinition, ITEM_DEFINITIONS } from "./items.js";
18import { quarterstaffItemIdForWood } from "./woodItems.js";
20import { quarterstaffItemIdForWood } from "./woodItems.js";
21import { swordItemIdForMetal } from "./swordItems.js";
22import { warAxeItemIdForMetal } from "./warAxeItems.js";
19import { arrowItemId, bowItemId } from "./rangedItems.js";
23import { arrowItemId, bowItemId } from "./rangedItems.js";
20import { staffItemIdForWood } from "./gemItems.js";
24import { staffItemIdForWood } from "./gemItems.js";
21
25
@@ -121,21 +125,58 @@ export const EQUIPMENT_STAT_CATEGORIES = Object.freeze([
121 Object.freeze({
125 Object.freeze({
122 id: EquipmentStatCategoryId.meleeWeapons,
126 id: EquipmentStatCategoryId.meleeWeapons,
123 label: "Melee weapons",
127 label: "Melee weapons",
124 stats: Object.freeze([SkillId.strength]),
128 stats: Object.freeze([SkillId.strength, SkillId.swordfighting]),
125 sections: Object.freeze([
129 sections: Object.freeze([
126 Object.freeze({
130 Object.freeze({
127 id: "wood",
131 id: "wood",
132 label: "Clubs",
128 tierOrder: WOOD_TIER_ORDER,
133 tierOrder: WOOD_TIER_ORDER,
129 tierDisplayName: woodDisplayName,
134 tierDisplayName: woodDisplayName,
130 rows: Object.freeze([
135 rows: Object.freeze([
131 Object.freeze({
136 Object.freeze({
132 pieceKey: "club",
137 pieceKey: "club",
133 label: "Stick / Quarterstaff",
138 label: "Stick / Quarterstaff",
139 /** Strength curve only — cheap; no weapon-skill bonus. */
140 defaultBonusByStat: Object.freeze({ [SkillId.strength]: "tier" }),
134 resolveItemId: (tier) => (tier === WoodTier.pine
141 resolveItemId: (tier) => (tier === WoodTier.pine
135 ? ItemId.stick
142 ? ItemId.stick
136 : quarterstaffItemIdForWood(tier))
143 : quarterstaffItemIdForWood(tier))
137 })
144 })
138 ])
145 ])
146 }),
147 Object.freeze({
148 id: "swords",
149 label: "Swords",
150 tierOrder: MATERIAL_TIER_ORDER,
151 tierDisplayName: metalDisplayName,
152 rows: Object.freeze([
153 Object.freeze({
154 pieceKey: "sword",
155 label: "Sword",
156 /** Normal strength + swordfighting equal to tier rank (1…7). */
157 defaultBonusByStat: Object.freeze({
158 [SkillId.strength]: "tier",
159 [SkillId.swordfighting]: "rank"
160 }),
161 resolveItemId: (tier) => swordItemIdForMetal(tier)
162 })
163 ])
164 }),
165 Object.freeze({
166 id: "warAxes",
167 label: "War axes",
168 tierOrder: MATERIAL_TIER_ORDER,
169 tierDisplayName: metalDisplayName,
170 rows: Object.freeze([
171 Object.freeze({
172 pieceKey: "warAxe",
173 label: "War axe",
174 /** Normal strength curve +1 at every tier. */
175 defaultBonusByStat: Object.freeze({ [SkillId.strength]: "tier" }),
176 defaultBonusExtra: 1,
177 resolveItemId: (tier) => warAxeItemIdForMetal(tier)
178 })
179 ])
139 })
180 })
140 ])
181 ])
141 }),
182 }),
@@ -360,14 +401,44 @@ function emptyStatBag (stats)
360 return bag;
401 return bag;
361}
402}
362
403
404function resolveDefaultBonusMode (mode, tier, row)
405{
406 const key = tier === SINGLETON_TIER_KEY ? null : tier;
407 const extra = Number(row.defaultBonusExtra) || 0;
408 if (mode === "rank")
409 { return Math.max(0, Math.floor(tierRank(key) + extra)); }
410 if (mode === "tier" || mode == null)
411 {
412 const base = row.defaultBonus != null
413 ? Number(row.defaultBonus) || 0
414 : tierStatBonus(key);
415 return Math.max(0, Math.floor(base + extra));
416 }
417 const n = Math.floor(Number(mode));
418 return Number.isFinite(n) ? Math.max(0, n) : 0;
419}
420
363function defaultCellForRow (row, stats, tier)
421function defaultCellForRow (row, stats, tier)
364{
422{
365 const cell = emptyStatBag(stats);
423 const cell = emptyStatBag(stats);
366 const base = row.defaultBonus != null
424 const byStat = row.defaultBonusByStat;
367 ? Number(row.defaultBonus) || 0
425 if (byStat && typeof byStat === "object")
368 : tierStatBonus(tier === SINGLETON_TIER_KEY ? null : tier);
426 {
369 const extra = Number(row.defaultBonusExtra) || 0;
427 for (const [skillId, mode] of Object.entries(byStat))
370 const value = Math.max(0, Math.floor(base + extra));
428 {
429 if (!Object.prototype.hasOwnProperty.call(cell, skillId))
430 { continue; }
431 cell[skillId] = resolveDefaultBonusMode(mode, tier, row);
432 }
433 return cell;
434 }
435 const value = resolveDefaultBonusMode("tier", tier, row);
436 if (row.bonusStat)
437 {
438 if (Object.prototype.hasOwnProperty.call(cell, row.bonusStat))
439 { cell[row.bonusStat] = value; }
440 return cell;
441 }
371 for (const skillId of stats)
442 for (const skillId of stats)
372 { cell[skillId] = value; }
443 { cell[skillId] = value; }
373 return cell;
444 return cell;
shared/definitions/familyItemIds.js +6 −0
@@ -12,6 +12,10 @@ import {
12 12 SWORD_BLADE_ITEM_BY_METAL,
13 13 SWORD_ITEM_BY_METAL
14 14 } from "./swordItems.js";
15 import {
16 WAR_AXE_HEAD_ITEM_BY_METAL,
17 WAR_AXE_ITEM_BY_METAL
18 } from "./warAxeItems.js";
15 19 import {
16 20 ARROW_SHAFT_BY_WOOD,
17 21 ARROW_TIP_BY_METAL,
@@ -33,6 +37,8 @@ export const FAMILY_ITEM_IDS = Object.freeze({
33 37 [ItemFamilyId.plantClippers]: PLANT_CLIPPERS_ITEM_BY_METAL,
34 38 [ItemFamilyId.swordBlade]: SWORD_BLADE_ITEM_BY_METAL,
35 39 [ItemFamilyId.sword]: SWORD_ITEM_BY_METAL,
40 [ItemFamilyId.warAxeHead]: WAR_AXE_HEAD_ITEM_BY_METAL,
41 [ItemFamilyId.warAxe]: WAR_AXE_ITEM_BY_METAL,
36 42 [ItemFamilyId.arrowShaft]: ARROW_SHAFT_BY_WOOD,
37 43 [ItemFamilyId.arrowTip]: ARROW_TIP_BY_METAL,
38 44 [ItemFamilyId.arrow]: ARROW_BY_METAL,
@@ -12,6 +12,10 @@ import {
12 SWORD_BLADE_ITEM_BY_METAL,
12 SWORD_BLADE_ITEM_BY_METAL,
13 SWORD_ITEM_BY_METAL
13 SWORD_ITEM_BY_METAL
14} from "./swordItems.js";
14} from "./swordItems.js";
15import {
16 WAR_AXE_HEAD_ITEM_BY_METAL,
17 WAR_AXE_ITEM_BY_METAL
18} from "./warAxeItems.js";
15import {
19import {
16 ARROW_SHAFT_BY_WOOD,
20 ARROW_SHAFT_BY_WOOD,
17 ARROW_TIP_BY_METAL,
21 ARROW_TIP_BY_METAL,
@@ -33,6 +37,8 @@ export const FAMILY_ITEM_IDS = Object.freeze({
33 [ItemFamilyId.plantClippers]: PLANT_CLIPPERS_ITEM_BY_METAL,
37 [ItemFamilyId.plantClippers]: PLANT_CLIPPERS_ITEM_BY_METAL,
34 [ItemFamilyId.swordBlade]: SWORD_BLADE_ITEM_BY_METAL,
38 [ItemFamilyId.swordBlade]: SWORD_BLADE_ITEM_BY_METAL,
35 [ItemFamilyId.sword]: SWORD_ITEM_BY_METAL,
39 [ItemFamilyId.sword]: SWORD_ITEM_BY_METAL,
40 [ItemFamilyId.warAxeHead]: WAR_AXE_HEAD_ITEM_BY_METAL,
41 [ItemFamilyId.warAxe]: WAR_AXE_ITEM_BY_METAL,
36 [ItemFamilyId.arrowShaft]: ARROW_SHAFT_BY_WOOD,
42 [ItemFamilyId.arrowShaft]: ARROW_SHAFT_BY_WOOD,
37 [ItemFamilyId.arrowTip]: ARROW_TIP_BY_METAL,
43 [ItemFamilyId.arrowTip]: ARROW_TIP_BY_METAL,
38 [ItemFamilyId.arrow]: ARROW_BY_METAL,
44 [ItemFamilyId.arrow]: ARROW_BY_METAL,
shared/definitions/items.js +19 −6
@@ -19,6 +19,7 @@ import { SpellbookItemId, SPELLBOOK_ITEM_DEFINITIONS } from "./spellItems.js";
19 19 import { FISH_ITEM_DEFINITIONS, FishingToolItemId } from "./fishItems.js";
20 20 import { GemItemId, GEM_ITEM_DEFINITIONS } from "./gemItems.js";
21 21 import { SwordItemId, SWORD_ITEM_DEFINITIONS } from "./swordItems.js";
22 import { WarAxeItemId, WAR_AXE_ITEM_DEFINITIONS } from "./warAxeItems.js";
22 23 import { EssenceItemId, ESSENCE_ITEM_DEFINITIONS } from "./essenceItems.js";
23 24
24 25 export const ItemId = Object.freeze({
@@ -49,7 +50,9 @@ export const ItemId = Object.freeze({
49 50 ...DyeItemId,
50 51 ...HerbItemId,
51 52 ...RangedItemId,
52 ...GemItemId
53 ...GemItemId,
54 ...SwordItemId,
55 ...WarAxeItemId
53 56 });
54 57
55 58 export const EQUIPMENT_SLOT = Object.freeze({
@@ -285,6 +288,7 @@ export const ITEM_DEFINITIONS = Object.freeze({
285 288 ...FISH_ITEM_DEFINITIONS,
286 289 ...GEM_ITEM_DEFINITIONS,
287 290 ...SWORD_ITEM_DEFINITIONS,
291 ...WAR_AXE_ITEM_DEFINITIONS,
288 292 ...ESSENCE_ITEM_DEFINITIONS,
289 293 [DyeItemId.flower]: FLOWER_ITEM_DEFINITION,
290 294 [DyeItemId.dye]: DYE_ITEM_DEFINITION
@@ -445,13 +449,22 @@ export function itemSpriteName (itemId, instance = null)
445 449 export function itemEquipSprite (itemId)
446 450 {
447 451 const def = itemDefinition(itemId);
448 const equipment = def?.equipment;
449 if (!equipment)
452 if (!def)
450 453 { return null; }
451 454 const folderKey = def.iconKey ?? def.key;
452 return equipment.equipSprite
453 ?? equipment.overlaySpriteId
454 ?? equipImageName("item", folderKey, itemDefaultState(def));
455 const equipment = def.equipment;
456 if (equipment)
457 {
458 if (equipment.hideEquipSprite)
459 { return null; }
460 return equipment.equipSprite
461 ?? equipment.overlaySpriteId
462 ?? equipImageName("item", folderKey, itemDefaultState(def));
463 }
464 /** Inventory tools (e.g. tinderbox) may still show equip art during gather/firestarting. */
465 if (def.gatherEquipSprite)
466 { return equipImageName("item", folderKey, itemDefaultState(def)); }
467 return null;
455 468 }
456 469
457 470 /** Largest equipped light radius (e.g. lantern in offhand). */
@@ -19,6 +19,7 @@ import { SpellbookItemId, SPELLBOOK_ITEM_DEFINITIONS } from "./spellItems.js";
19import { FISH_ITEM_DEFINITIONS, FishingToolItemId } from "./fishItems.js";
19import { FISH_ITEM_DEFINITIONS, FishingToolItemId } from "./fishItems.js";
20import { GemItemId, GEM_ITEM_DEFINITIONS } from "./gemItems.js";
20import { GemItemId, GEM_ITEM_DEFINITIONS } from "./gemItems.js";
21import { SwordItemId, SWORD_ITEM_DEFINITIONS } from "./swordItems.js";
21import { SwordItemId, SWORD_ITEM_DEFINITIONS } from "./swordItems.js";
22import { WarAxeItemId, WAR_AXE_ITEM_DEFINITIONS } from "./warAxeItems.js";
22import { EssenceItemId, ESSENCE_ITEM_DEFINITIONS } from "./essenceItems.js";
23import { EssenceItemId, ESSENCE_ITEM_DEFINITIONS } from "./essenceItems.js";
23
24
24export const ItemId = Object.freeze({
25export const ItemId = Object.freeze({
@@ -49,7 +50,9 @@ export const ItemId = Object.freeze({
49 ...DyeItemId,
50 ...DyeItemId,
50 ...HerbItemId,
51 ...HerbItemId,
51 ...RangedItemId,
52 ...RangedItemId,
52 ...GemItemId
53 ...GemItemId,
54 ...SwordItemId,
55 ...WarAxeItemId
53});
56});
54
57
55export const EQUIPMENT_SLOT = Object.freeze({
58export const EQUIPMENT_SLOT = Object.freeze({
@@ -285,6 +288,7 @@ export const ITEM_DEFINITIONS = Object.freeze({
285 ...FISH_ITEM_DEFINITIONS,
288 ...FISH_ITEM_DEFINITIONS,
286 ...GEM_ITEM_DEFINITIONS,
289 ...GEM_ITEM_DEFINITIONS,
287 ...SWORD_ITEM_DEFINITIONS,
290 ...SWORD_ITEM_DEFINITIONS,
291 ...WAR_AXE_ITEM_DEFINITIONS,
288 ...ESSENCE_ITEM_DEFINITIONS,
292 ...ESSENCE_ITEM_DEFINITIONS,
289 [DyeItemId.flower]: FLOWER_ITEM_DEFINITION,
293 [DyeItemId.flower]: FLOWER_ITEM_DEFINITION,
290 [DyeItemId.dye]: DYE_ITEM_DEFINITION
294 [DyeItemId.dye]: DYE_ITEM_DEFINITION
@@ -445,13 +449,22 @@ export function itemSpriteName (itemId, instance = null)
445export function itemEquipSprite (itemId)
449export function itemEquipSprite (itemId)
446{
450{
447 const def = itemDefinition(itemId);
451 const def = itemDefinition(itemId);
448 const equipment = def?.equipment;
452 if (!def)
449 if (!equipment)
450 { return null; }
453 { return null; }
451 const folderKey = def.iconKey ?? def.key;
454 const folderKey = def.iconKey ?? def.key;
452 return equipment.equipSprite
455 const equipment = def.equipment;
453 ?? equipment.overlaySpriteId
456 if (equipment)
454 ?? equipImageName("item", folderKey, itemDefaultState(def));
457 {
458 if (equipment.hideEquipSprite)
459 { return null; }
460 return equipment.equipSprite
461 ?? equipment.overlaySpriteId
462 ?? equipImageName("item", folderKey, itemDefaultState(def));
463 }
464 /** Inventory tools (e.g. tinderbox) may still show equip art during gather/firestarting. */
465 if (def.gatherEquipSprite)
466 { return equipImageName("item", folderKey, itemDefaultState(def)); }
467 return null;
455}
468}
456
469
457/** Largest equipped light radius (e.g. lantern in offhand). */
470/** Largest equipped light radius (e.g. lantern in offhand). */
shared/definitions/swordItems.js +5 −0
@@ -49,3 +49,8 @@ export const SWORD_ITEM_DEFINITIONS = Object.freeze({
49 49 ...buildFamilyDefinitionMap(ItemFamilyId.swordBlade, SWORD_BLADE_ITEM_BY_METAL),
50 50 ...buildFamilyDefinitionMap(ItemFamilyId.sword, SWORD_ITEM_BY_METAL)
51 51 });
52
53 export function swordItemIdForMetal (metalTier)
54 {
55 return SWORD_ITEM_BY_METAL[metalTier] ?? null;
56 }
@@ -49,3 +49,8 @@ export const SWORD_ITEM_DEFINITIONS = Object.freeze({
49 ...buildFamilyDefinitionMap(ItemFamilyId.swordBlade, SWORD_BLADE_ITEM_BY_METAL),
49 ...buildFamilyDefinitionMap(ItemFamilyId.swordBlade, SWORD_BLADE_ITEM_BY_METAL),
50 ...buildFamilyDefinitionMap(ItemFamilyId.sword, SWORD_ITEM_BY_METAL)
50 ...buildFamilyDefinitionMap(ItemFamilyId.sword, SWORD_ITEM_BY_METAL)
51});
51});
52
53export function swordItemIdForMetal (metalTier)
54{
55 return SWORD_ITEM_BY_METAL[metalTier] ?? null;
56}
shared/definitions/tierFamilies.js +32 −1
@@ -32,6 +32,8 @@ export const ItemFamilyId = Object.freeze({
32 32 axeHead: "axeHead",
33 33 pickaxe: "pickaxe",
34 34 axe: "axe",
35 warAxeHead: "warAxeHead",
36 warAxe: "warAxe",
35 37 swordBlade: "swordBlade",
36 38 sword: "sword",
37 39 plantClippers: "plantClippers",
@@ -184,7 +186,36 @@ export const ITEM_FAMILIES = Object.freeze({
184 186 seedValue: 8,
185 187 dualTintFromTier: true,
186 188 woodTierFromMetal: true,
187 equipmentKind: EquipmentKind.axeTool,
189 equipmentKind: EquipmentKind.axeTool
190 }),
191 [ItemFamilyId.warAxeHead]: Object.freeze({
192 familyId: ItemFamilyId.warAxeHead,
193 axis: TierAxis.metal,
194 label: "war axe head",
195 description: (name) => `A heavy ${name.toLowerCase()} axe head, meant for battle rather than timber.`,
196 category: ItemCategory.intermediate,
197 iconKey: "waraxe",
198 defaultState: "waraxe-head",
199 stackable: true,
200 maxStackSize: DEFAULT_STACK,
201 seedValue: 8,
202 tintFromTier: true
203 }),
204 [ItemFamilyId.warAxe]: Object.freeze({
205 familyId: ItemFamilyId.warAxe,
206 axis: TierAxis.metal,
207 label: "war axe",
208 description: (name) => `A ${name.toLowerCase()} war axe, hafted for the press of combat.`,
209 category: ItemCategory.tool,
210 iconKey: "waraxe",
211 defaultState: "waraxe",
212 stackable: false,
213 maxStackSize: 1,
214 seedValue: 12,
215 /** Red = wood haft, blue = metal head. */
216 dualTintFromTier: true,
217 woodTierFromMetal: true,
218 equipmentKind: EquipmentKind.metalWeapon,
188 219 equipmentAttack: Object.freeze({
189 220 mode: "melee",
190 221 rangeTiles: 1,
@@ -32,6 +32,8 @@ export const ItemFamilyId = Object.freeze({
32 axeHead: "axeHead",
32 axeHead: "axeHead",
33 pickaxe: "pickaxe",
33 pickaxe: "pickaxe",
34 axe: "axe",
34 axe: "axe",
35 warAxeHead: "warAxeHead",
36 warAxe: "warAxe",
35 swordBlade: "swordBlade",
37 swordBlade: "swordBlade",
36 sword: "sword",
38 sword: "sword",
37 plantClippers: "plantClippers",
39 plantClippers: "plantClippers",
@@ -184,7 +186,36 @@ export const ITEM_FAMILIES = Object.freeze({
184 seedValue: 8,
186 seedValue: 8,
185 dualTintFromTier: true,
187 dualTintFromTier: true,
186 woodTierFromMetal: true,
188 woodTierFromMetal: true,
187 equipmentKind: EquipmentKind.axeTool,
189 equipmentKind: EquipmentKind.axeTool
190 }),
191 [ItemFamilyId.warAxeHead]: Object.freeze({
192 familyId: ItemFamilyId.warAxeHead,
193 axis: TierAxis.metal,
194 label: "war axe head",
195 description: (name) => `A heavy ${name.toLowerCase()} axe head, meant for battle rather than timber.`,
196 category: ItemCategory.intermediate,
197 iconKey: "waraxe",
198 defaultState: "waraxe-head",
199 stackable: true,
200 maxStackSize: DEFAULT_STACK,
201 seedValue: 8,
202 tintFromTier: true
203 }),
204 [ItemFamilyId.warAxe]: Object.freeze({
205 familyId: ItemFamilyId.warAxe,
206 axis: TierAxis.metal,
207 label: "war axe",
208 description: (name) => `A ${name.toLowerCase()} war axe, hafted for the press of combat.`,
209 category: ItemCategory.tool,
210 iconKey: "waraxe",
211 defaultState: "waraxe",
212 stackable: false,
213 maxStackSize: 1,
214 seedValue: 12,
215 /** Red = wood haft, blue = metal head. */
216 dualTintFromTier: true,
217 woodTierFromMetal: true,
218 equipmentKind: EquipmentKind.metalWeapon,
188 equipmentAttack: Object.freeze({
219 equipmentAttack: Object.freeze({
189 mode: "melee",
220 mode: "melee",
190 rangeTiles: 1,
221 rangeTiles: 1,
shared/definitions/warAxeItems.js added +56 −0
@@ -0,0 +1,56 @@
1 import {
2 ItemFamilyId,
3 buildFamilyDefinitionMap
4 } from "./tierFamilies.js";
5 import { MaterialTier } from "./materialTiers.js";
6
7 /**
8 * War axe heads (anvil, 3 bars) and complete war axes (crafting bench).
9 * Red = wood haft, blue = metal head. Equip sprite uses native width (22×24).
10 */
11 export const WarAxeItemId = Object.freeze({
12 bronzeWarAxeHead: 461,
13 ironWarAxeHead: 462,
14 steelWarAxeHead: 463,
15 mithrilWarAxeHead: 464,
16 adamantiumWarAxeHead: 465,
17 orichalcumWarAxeHead: 466,
18 dragonWarAxeHead: 467,
19 bronzeWarAxe: 468,
20 ironWarAxe: 469,
21 steelWarAxe: 470,
22 mithrilWarAxe: 471,
23 adamantiumWarAxe: 472,
24 orichalcumWarAxe: 473,
25 dragonWarAxe: 474
26 });
27
28 export const WAR_AXE_HEAD_ITEM_BY_METAL = Object.freeze({
29 [MaterialTier.bronze]: WarAxeItemId.bronzeWarAxeHead,
30 [MaterialTier.iron]: WarAxeItemId.ironWarAxeHead,
31 [MaterialTier.steel]: WarAxeItemId.steelWarAxeHead,
32 [MaterialTier.mithril]: WarAxeItemId.mithrilWarAxeHead,
33 [MaterialTier.adamantium]: WarAxeItemId.adamantiumWarAxeHead,
34 [MaterialTier.orichalcum]: WarAxeItemId.orichalcumWarAxeHead,
35 [MaterialTier.dragon]: WarAxeItemId.dragonWarAxeHead
36 });
37
38 export const WAR_AXE_ITEM_BY_METAL = Object.freeze({
39 [MaterialTier.bronze]: WarAxeItemId.bronzeWarAxe,
40 [MaterialTier.iron]: WarAxeItemId.ironWarAxe,
41 [MaterialTier.steel]: WarAxeItemId.steelWarAxe,
42 [MaterialTier.mithril]: WarAxeItemId.mithrilWarAxe,
43 [MaterialTier.adamantium]: WarAxeItemId.adamantiumWarAxe,
44 [MaterialTier.orichalcum]: WarAxeItemId.orichalcumWarAxe,
45 [MaterialTier.dragon]: WarAxeItemId.dragonWarAxe
46 });
47
48 export const WAR_AXE_ITEM_DEFINITIONS = Object.freeze({
49 ...buildFamilyDefinitionMap(ItemFamilyId.warAxeHead, WAR_AXE_HEAD_ITEM_BY_METAL),
50 ...buildFamilyDefinitionMap(ItemFamilyId.warAxe, WAR_AXE_ITEM_BY_METAL)
51 });
52
53 export function warAxeItemIdForMetal (metalTier)
54 {
55 return WAR_AXE_ITEM_BY_METAL[metalTier] ?? null;
56 }
@@ -0,0 +1,56 @@
1import {
2 ItemFamilyId,
3 buildFamilyDefinitionMap
4} from "./tierFamilies.js";
5import { MaterialTier } from "./materialTiers.js";
6
7/**
8 * War axe heads (anvil, 3 bars) and complete war axes (crafting bench).
9 * Red = wood haft, blue = metal head. Equip sprite uses native width (22×24).
10 */
11export const WarAxeItemId = Object.freeze({
12 bronzeWarAxeHead: 461,
13 ironWarAxeHead: 462,
14 steelWarAxeHead: 463,
15 mithrilWarAxeHead: 464,
16 adamantiumWarAxeHead: 465,
17 orichalcumWarAxeHead: 466,
18 dragonWarAxeHead: 467,
19 bronzeWarAxe: 468,
20 ironWarAxe: 469,
21 steelWarAxe: 470,
22 mithrilWarAxe: 471,
23 adamantiumWarAxe: 472,
24 orichalcumWarAxe: 473,
25 dragonWarAxe: 474
26});
27
28export const WAR_AXE_HEAD_ITEM_BY_METAL = Object.freeze({
29 [MaterialTier.bronze]: WarAxeItemId.bronzeWarAxeHead,
30 [MaterialTier.iron]: WarAxeItemId.ironWarAxeHead,
31 [MaterialTier.steel]: WarAxeItemId.steelWarAxeHead,
32 [MaterialTier.mithril]: WarAxeItemId.mithrilWarAxeHead,
33 [MaterialTier.adamantium]: WarAxeItemId.adamantiumWarAxeHead,
34 [MaterialTier.orichalcum]: WarAxeItemId.orichalcumWarAxeHead,
35 [MaterialTier.dragon]: WarAxeItemId.dragonWarAxeHead
36});
37
38export const WAR_AXE_ITEM_BY_METAL = Object.freeze({
39 [MaterialTier.bronze]: WarAxeItemId.bronzeWarAxe,
40 [MaterialTier.iron]: WarAxeItemId.ironWarAxe,
41 [MaterialTier.steel]: WarAxeItemId.steelWarAxe,
42 [MaterialTier.mithril]: WarAxeItemId.mithrilWarAxe,
43 [MaterialTier.adamantium]: WarAxeItemId.adamantiumWarAxe,
44 [MaterialTier.orichalcum]: WarAxeItemId.orichalcumWarAxe,
45 [MaterialTier.dragon]: WarAxeItemId.dragonWarAxe
46});
47
48export const WAR_AXE_ITEM_DEFINITIONS = Object.freeze({
49 ...buildFamilyDefinitionMap(ItemFamilyId.warAxeHead, WAR_AXE_HEAD_ITEM_BY_METAL),
50 ...buildFamilyDefinitionMap(ItemFamilyId.warAxe, WAR_AXE_ITEM_BY_METAL)
51});
52
53export function warAxeItemIdForMetal (metalTier)
54{
55 return WAR_AXE_ITEM_BY_METAL[metalTier] ?? null;
56}