Move toward adding multiple equipable items that are not directly usable
This commit is contained in:
@@ -25,11 +25,27 @@ itemEffect :: Creature -> Item -> World -> World
|
||||
--itemEffect cr Consumable{_cnEffect=eff } w = maybe w (rmSelectedInvItem (_crID cr)) (eff (_crID cr) w)
|
||||
itemEffect cr it w = case it ^? itUse of
|
||||
Just RightUse {_rUse = eff,_useMods = usemods} -> foldr ($) eff usemods it cr w
|
||||
Just LeftUse {} -> w
|
||||
& lSelHammerPosition .~ HammerDown
|
||||
& docycle
|
||||
_ -> w
|
||||
Just LeftUse {} -> lhammer setEquipLeftItem
|
||||
-- Just LeftUse {} -> w
|
||||
-- & lSelHammerPosition .~ HammerDown
|
||||
-- & docycle
|
||||
--Just EquipUse -> w & creatures . ix (_crID cr) . crInvEquipped . at (_crInvSel cr) %~ f
|
||||
Just EquipUse -> lhammer setEquipment
|
||||
Just NoUse -> w
|
||||
Nothing -> w
|
||||
where
|
||||
f Nothing = Just ()
|
||||
f (Just ()) = Nothing
|
||||
-- toggleEquip invid =
|
||||
lhammer f = w
|
||||
& lSelHammerPosition .~ HammerDown
|
||||
& case _lSelHammerPosition w of
|
||||
HammerUp -> creatures . ix (_crID cr) %~ f
|
||||
_ -> id
|
||||
setEquipLeftItem cr = case _crLeftInvSel cr of
|
||||
Just i | i == _crInvSel cr -> cr & crLeftInvSel .~ Nothing
|
||||
_ -> cr & crLeftInvSel .~ (Just $ _crInvSel cr)
|
||||
setEquipment = crInvEquipped . at (_crInvSel cr) %~ f
|
||||
docycle | _lSelHammerPosition w == HammerUp = creatures . ix (_crID cr) . crLeftInvSel %~ cyclelsel
|
||||
| otherwise = id
|
||||
cyclelsel mi = case mi of
|
||||
|
||||
Reference in New Issue
Block a user