feat(xanthous): Allow selecting hand for wielding
When wielding items, allow selecting which hand the item should be wielded in. Currently this has no actual effect on the mechanics of combat - that'll come next. Change-Id: Ic289ca2d8fa6f5fc0ad5bd0b012818a3acd8599e Reviewed-on: https://cl.tvl.fyi/c/depot/+/5470 Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
8da2fce9ef
commit
632c4280b5
4 changed files with 119 additions and 30 deletions
|
|
@ -54,12 +54,12 @@ import Xanthous.Physics (throwDistance, bluntThrowDamage)
|
|||
import Xanthous.Data.EntityMap.Graphics (lineOfSight)
|
||||
import Xanthous.Data.EntityMap (EntityID)
|
||||
--------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
import Xanthous.Entities.Common
|
||||
( InventoryPosition, describeInventoryPosition, backpack
|
||||
, wieldableItem, wieldedItems, wielded, itemsWithPosition
|
||||
, removeItemFromPosition, asWieldedItem, inRightHand
|
||||
, wieldedItem, items
|
||||
, removeItemFromPosition, asWieldedItem
|
||||
, wieldedItem, items, Hand (..), describeHand, wieldInHand
|
||||
, WieldedItem
|
||||
)
|
||||
import qualified Xanthous.Entities.Character as Character
|
||||
import Xanthous.Entities.Character hiding (pickUpItem)
|
||||
|
|
@ -296,14 +296,30 @@ handleCommand DescribeInventory = do
|
|||
|
||||
|
||||
handleCommand Wield = do
|
||||
takeItemFromInventory_ ["wield", "menu"] Cancellable asWieldedItem
|
||||
(say_ ["wield", "nothing"])
|
||||
$ \(MenuResult item) -> do
|
||||
prevItems <- character . inventory . wielded <<.= inRightHand item
|
||||
selectItem $ \(MenuResult (item :: WieldedItem)) -> do
|
||||
selectHand $ \(MenuResult hand) -> do
|
||||
prevItems <- character . inventory . wielded %%= wieldInHand hand item
|
||||
character . inventory . backpack
|
||||
<>= fromList (prevItems ^.. wieldedItems . wieldedItem)
|
||||
say ["wield", "wielded"] item
|
||||
<>= fromList (map (view wieldedItem) prevItems)
|
||||
say ["wield", "wielded"] $ object [ "item" A..= item
|
||||
, "hand" A..= describeHand hand
|
||||
]
|
||||
continue
|
||||
where
|
||||
selectItem =
|
||||
takeItemFromInventory_ ["wield", "menu"] Cancellable asWieldedItem
|
||||
(say_ ["wield", "nothing"])
|
||||
selectHand
|
||||
= menu_
|
||||
["wield", "hand"]
|
||||
Cancellable
|
||||
handsMenu
|
||||
handsMenu = mapFromList
|
||||
. map (second $ MenuOption =<< describeHand)
|
||||
$ [ ('l', LeftHand)
|
||||
, ('r', RightHand)
|
||||
, ('b', BothHands)
|
||||
]
|
||||
|
||||
handleCommand Fire = do
|
||||
selectItemFromInventory_ ["fire", "menu"] Cancellable id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue