Bug: Two-handed weapons allow off-hand slot selection in Equipment tab #152

Closed
opened 2026-05-27 10:22:54 +02:00 by Anexim · 2 comments
Owner

Bug Description

When equipping a two-handed weapon like a staff, the Equipment tab shows a slot selector dropdown offering both "mainHand" and "offHand". Only "mainHand" should be a valid target for a two-handed weapon. Selecting off-hand silently fails.

Root Cause

In src/lib/game/data/equipment/utils.ts lines 48-56, the getValidSlotsForEquipmentType function returns ['mainHand', 'offHand'] for two-handed weapons, when it should only return ['mainHand'].

The underlying equip logic in crafting-utils.ts and equipment-actions.ts correctly blocks equipping a two-handed weapon in the off-hand, but the UI is misleading by presenting it as an option.

Fix Required

Change line 50 in utils.ts from return ['mainHand', 'offHand'] to return ['mainHand'].

Affected Files

  • src/lib/game/data/equipment/utils.ts line 50
  • src/components/game/tabs/EquipmentTab/InventoryList.tsx lines 47, 99 (downstream consumer — no code change needed if utils.ts is fixed)
## Bug Description When equipping a two-handed weapon like a staff, the Equipment tab shows a slot selector dropdown offering both "mainHand" and "offHand". Only "mainHand" should be a valid target for a two-handed weapon. Selecting off-hand silently fails. ## Root Cause In `src/lib/game/data/equipment/utils.ts` lines 48-56, the `getValidSlotsForEquipmentType` function returns `['mainHand', 'offHand']` for two-handed weapons, when it should only return `['mainHand']`. The underlying equip logic in `crafting-utils.ts` and `equipment-actions.ts` correctly blocks equipping a two-handed weapon in the off-hand, but the UI is misleading by presenting it as an option. ## Fix Required Change line 50 in `utils.ts` from `return ['mainHand', 'offHand']` to `return ['mainHand']`. ## Affected Files - `src/lib/game/data/equipment/utils.ts` line 50 - `src/components/game/tabs/EquipmentTab/InventoryList.tsx` lines 47, 99 (downstream consumer — no code change needed if utils.ts is fixed)
Anexim added the ai:todo label 2026-05-27 10:22:54 +02:00
n8n-gitea was assigned by Anexim 2026-05-27 10:22:54 +02:00
Author
Owner

Starting work on #152 — Two-handed weapons allow off-hand slot selection in Equipment tab. Will fix the getValidSlotsForEquipmentType function in utils.ts.

Starting work on #152 — Two-handed weapons allow off-hand slot selection in Equipment tab. Will fix the `getValidSlotsForEquipmentType` function in `utils.ts`.
Author
Owner

Fixed #152 — Two-handed weapons no longer show off-hand slot option.

Root cause: getValidSlotsForEquipmentType in utils.ts returned ['mainHand', 'offHand'] for two-handed weapons, but they should only be equipable in mainHand (since they occupy both hands).

Fix: Changed to return ['mainHand'] for two-handed weapons. Updated comment for clarity.

All 902 tests pass. Committed and pushed as 428d308.

Fixed #152 — Two-handed weapons no longer show off-hand slot option. **Root cause**: `getValidSlotsForEquipmentType` in `utils.ts` returned `['mainHand', 'offHand']` for two-handed weapons, but they should only be equipable in mainHand (since they occupy both hands). **Fix**: Changed to return `['mainHand']` for two-handed weapons. Updated comment for clarity. All 902 tests pass. Committed and pushed as 428d308.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#152