Move toward adding multiple equipable items that are not directly usable

This commit is contained in:
2021-12-08 17:09:24 +00:00
parent 9f6e5af991
commit a9139db0a8
22 changed files with 260 additions and 137 deletions
+20 -4
View File
@@ -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
+6 -1
View File
@@ -181,9 +181,14 @@ scalp cr
fhead = colorSH (greyN 0.9) . upperPrismPolyHalf 5 $ polyCirc 4 5
crInStance :: AimStance -> Creature -> Bool
crInStance as cr = crIsAiming' cr
crInStance as cr = crIsAiming' cr -- || (_posture (_crStance cr) == Reloading && hasAmmo cr)
&& cr ^? crInv . ix (_crInvSel cr) . itUse . useAim . aimStance == Just as
--hasAmmo :: Creature -> Bool
--hasAmmo cr = case cr ^? crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded of
-- Just x -> x > 0
-- _ -> False
oneH :: Creature -> Bool
oneH = crInStance OneHand