about summary refs log tree commit diff
path: root/src/Xanthous/App.hs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-12-31T16·23-0500
committerGriffin Smith <root@gws.fyi>2019-12-31T16·23-0500
commit0373e06c02d16a30e1cc39da9962618c066d14e7 (patch)
treec862e29ee9be9f241767ccf7a0ef611de28d071d /src/Xanthous/App.hs
parentffc8e793d5ca8a73f8a6ec0f0a4f2efb2c98cf93 (diff)
Replace previously-wielded items when wielding
When wielding a new item, put any previously-wielded items back in the
character's backpack.
Diffstat (limited to 'src/Xanthous/App.hs')
-rw-r--r--src/Xanthous/App.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Xanthous/App.hs b/src/Xanthous/App.hs
index 808654e1abe3..1db75bb58565 100644
--- a/src/Xanthous/App.hs
+++ b/src/Xanthous/App.hs
@@ -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