diff options
author | Griffin Smith <root@gws.fyi> | 2019-12-31T16·23-0500 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-12-31T16·23-0500 |
commit | 0373e06c02d16a30e1cc39da9962618c066d14e7 (patch) | |
tree | c862e29ee9be9f241767ccf7a0ef611de28d071d | |
parent | ffc8e793d5ca8a73f8a6ec0f0a4f2efb2c98cf93 (diff) |
Replace previously-wielded items when wielding
When wielding a new item, put any previously-wielded items back in the character's backpack.
-rw-r--r-- | src/Xanthous/App.hs | 4 |
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 |