Bug: Two-handed weapons allow off-hand slot selection in Equipment tab #152
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.tslines 48-56, thegetValidSlotsForEquipmentTypefunction returns['mainHand', 'offHand']for two-handed weapons, when it should only return['mainHand'].The underlying equip logic in
crafting-utils.tsandequipment-actions.tscorrectly 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.tsfromreturn ['mainHand', 'offHand']toreturn ['mainHand'].Affected Files
src/lib/game/data/equipment/utils.tsline 50src/components/game/tabs/EquipmentTab/InventoryList.tsxlines 47, 99 (downstream consumer — no code change needed if utils.ts is fixed)Starting work on #152 — Two-handed weapons allow off-hand slot selection in Equipment tab. Will fix the
getValidSlotsForEquipmentTypefunction inutils.ts.Fixed #152 — Two-handed weapons no longer show off-hand slot option.
Root cause:
getValidSlotsForEquipmentTypeinutils.tsreturned['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.