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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user