Replace previously-wielded items when wielding

When wielding a new item, put any previously-wielded items back in the
character's backpack.
This commit is contained in:
Griffin Smith 2019-12-31 11:23:54 -05:00
parent ffc8e793d5
commit 0373e06c02

View file

@ -250,7 +250,9 @@ handleCommand Wield = do
selectItemFromInventory_ ["wield", "menu"] Cancellable asWieldedItem
(say_ ["wield", "nothing"])
$ \(MenuResult item) -> do
character . inventory . wielded .= inRightHand item
prevItems <- character . inventory . wielded <<.= inRightHand item
character . inventory . backpack
<>= fromList (prevItems ^.. wieldedItems . wieldedItem)
say ["wield", "wielded"] item
continue