Fold some ammo data into its own type

This commit is contained in:
2021-11-27 13:40:56 +00:00
parent bfdac2fad5
commit 92a8dd59b8
21 changed files with 175 additions and 115 deletions
+5 -5
View File
@@ -120,16 +120,16 @@ wheelEvent y w = case (_carteDisplay w, _inventoryMode w) of
invKeyDown = ScancodeCapsLock `S.member` _keys w
moveYourAmmoSel :: Int -> World -> World
moveYourAmmoSel i w = case yourItem w ^? wpAmmo . amPjParams of
moveYourAmmoSel i w = case yourItem w ^? wpAmmo . aoType. amPjParams of
Just l -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w))
. wpAmmo . amParamSel %~ (`mod` length l) . subtract i
. wpAmmo . aoType. amParamSel %~ (`mod` length l) . subtract i
_ -> w
moveYourAmmoParam :: Int -> World -> World
moveYourAmmoParam i w = case yourItem w ^? wpAmmo . amPjParams . ix paramid . pjMaxParam of
moveYourAmmoParam i w = case yourItem w ^? wpAmmo . aoType. amPjParams . ix paramid . pjMaxParam of
Just n -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w))
. wpAmmo . amPjParams . ix paramid . pjIntParam %~ (`mod` n) . (+ i)
. wpAmmo . aoType. amPjParams . ix paramid . pjIntParam %~ (`mod` n) . (+ i)
_ -> w
where
paramid = _amParamSel $ _wpAmmo $ yourItem w
paramid = _amParamSel $ _aoType $ _wpAmmo $ yourItem w