Refactor, add bullet modules and weapon effect modifiers
This commit is contained in:
+19
-3
@@ -92,12 +92,16 @@ wheelEvent y w = case (_carteDisplay w, _inventoryMode w) of
|
||||
| otherwise -> w & selLocation %~ (`mod` numLocs) . (+ yi)
|
||||
(_, TopInventory)
|
||||
| rbDown -> fromMaybe (closeObjScrollDir y w) $ (yourItem w ^? itScrollUp)
|
||||
<*> pure (_crInvSel (you w))
|
||||
<*> pure w
|
||||
<*> pure (_crInvSel (you w))
|
||||
<*> pure w
|
||||
| lbDown -> w & cameraZoom +~ y
|
||||
| invKeyDown -> swapInvDir yi $ dirInvPos yi w
|
||||
| otherwise -> dirInvPos yi w
|
||||
(_, TweakInventory) -> w
|
||||
(_, TweakInventory)
|
||||
| invKeyDown && rbDown -> w & moveYourAmmoSel yi
|
||||
| invKeyDown -> dirInvPos yi w
|
||||
| rbDown -> w & moveYourAmmoParam yi
|
||||
| otherwise -> w & moveYourAmmoSel yi
|
||||
(_, _) -> w
|
||||
where
|
||||
yi = round $ signum y
|
||||
@@ -106,6 +110,18 @@ wheelEvent y w = case (_carteDisplay w, _inventoryMode w) of
|
||||
lbDown = ButtonLeft `S.member` _mouseButtons w
|
||||
invKeyDown = ScancodeCapsLock `S.member` _keys w
|
||||
|
||||
moveYourAmmoSel :: Int -> World -> World
|
||||
moveYourAmmoSel i w = case yourItem w ^? wpAmmo . amPjParams of
|
||||
Just l -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w))
|
||||
. wpAmmo . amParamSel %~ (`mod` (length l)) . (subtract i)
|
||||
_ -> w
|
||||
moveYourAmmoParam :: Int -> World -> World
|
||||
moveYourAmmoParam i w = case yourItem w ^? wpAmmo . 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)
|
||||
_ -> w
|
||||
where
|
||||
paramid = _amParamSel $ _wpAmmo $ yourItem w
|
||||
swapInvDir :: Int -> World -> World
|
||||
swapInvDir k w = w & creatures . ix (_yourID w) . crInv %~ IM.swapKeys (i `mod` n) ((i + k) `mod` n)
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user