Add concept of GameRoom, check viewing distance based on rooms

This commit is contained in:
2021-09-02 23:24:29 +01:00
parent 9d2f42dbc9
commit c69af7a5f4
30 changed files with 295 additions and 151 deletions
+8 -8
View File
@@ -34,12 +34,12 @@ incCharMode
:: Int -- ^ Inventory selection
-> World
-> World
incCharMode i = creatures . ix 0 . crInv . ix i . itAttachment . _Just %~ incCharMode'
incCharMode i = creatures . ix 0 . crInv . ix i . itAttachment %~ incCharMode'
decCharMode
:: Int -- ^ Inventory selection
-> World
-> World
decCharMode i = creatures . ix 0 . crInv . ix i . itAttachment . _Just %~ decCharMode'
decCharMode i = creatures . ix 0 . crInv . ix i . itAttachment %~ decCharMode'
charFiringStrat
:: [(Char, Creature -> World -> World)] -- ^ Different firing effects for different characters
@@ -47,7 +47,7 @@ charFiringStrat
-> World
-> World
charFiringStrat strats cr w = case w ^? creatures . ix cid . crInv
. ix (_crInvSel $ _creatures w IM.! cid) . itAttachment . _Just . itCharMode of
. ix (_crInvSel $ _creatures w IM.! cid) . itAttachment . itCharMode of
Just (c :<| _) -> fromJust (Prelude.lookup c strats) cr w
_ -> w
where
@@ -60,7 +60,7 @@ charFiringStratI
-> World
-> World
charFiringStratI strats eff item cr w = case w ^? creatures . ix cid . crInv
. ix (_crInvSel $ _creatures w IM.! cid) . itAttachment . _Just . itCharMode of
. ix (_crInvSel $ _creatures w IM.! cid) . itAttachment . itCharMode of
Just (c :<| _) -> fromJust (Prelude.lookup c strats) eff item cr w
_ -> w
where
@@ -75,8 +75,8 @@ increaseFuse fuse itid w = w
& creatures . ix 0 . crInv . ix itid %~
( itScrollUp .~ decreaseFuse newTime )
. (itScrollDown .~ increaseFuse newTime )
. ( itAttachment ?~ ItFuse newTime )
. ( itZoom .~ defaultItZoom{_itAimZoomMax = zm, _itAimZoomMin = zm} )
. ( itAttachment .~ ItFuse newTime )
. ( itAimZoom .~ defaultItZoom{_itZoomMax = zm, _itZoomMin = zm} )
where
newTime = min (fuse + 5) 90
zm = 50 / fromIntegral newTime
@@ -89,8 +89,8 @@ decreaseFuse fuse itid w = w
& creatures . ix 0 . crInv . ix itid %~
( itScrollUp .~ decreaseFuse newTime )
. ( itScrollDown .~ increaseFuse newTime )
. ( itAttachment ?~ ItFuse newTime )
. ( itZoom .~ defaultItZoom {_itAimZoomMax = zm, _itAimZoomMin = zm} )
. ( itAttachment .~ ItFuse newTime )
. ( itAimZoom .~ defaultItZoom {_itZoomMax = zm, _itZoomMin = zm} )
where
newTime = max (fuse - 5) 20
zm = 50 / fromIntegral newTime