Commit mid add time scroll
This commit is contained in:
+17
-3
@@ -2,19 +2,33 @@ module Dodge.HeldScroll (
|
||||
doHeldScroll,
|
||||
) where
|
||||
|
||||
import Dodge.Base.You
|
||||
import Control.Lens hiding ((<|), (|>))
|
||||
import Data.Sequence
|
||||
import Dodge.Data.Creature
|
||||
import Dodge.Data.World
|
||||
import Dodge.Item.Weapon.ZoomScope
|
||||
import LensHelp hiding ((|>), (<|))
|
||||
-- should be able to just import data.item
|
||||
|
||||
doHeldScroll :: HeldScroll -> Float -> Creature -> Item -> Item
|
||||
doHeldScroll :: HeldScroll -> Float -> Creature -> World -> World
|
||||
doHeldScroll hs = case hs of
|
||||
HeldScrollDoNothing -> const . const id
|
||||
HeldScrollZoom -> zoomLongGun
|
||||
HeldScrollCharMode{} -> \x _ -> itUse . heldScroll . hsCharMode %~ cycleSignum x
|
||||
HeldScrollZoom -> overYourItem zoomLongGun
|
||||
HeldScrollCharMode{} -> overYourItem $ \x _ -> itUse . heldScroll . hsCharMode %~ cycleSignum x
|
||||
HeldScrollTime -> doScrollTime
|
||||
HeldScrollInt{} -> undefined
|
||||
where
|
||||
overYourItem f x cr w = w & cWorld . creatures . ix 0 . crInv . ix (crSel $ you w) %~ f x cr
|
||||
|
||||
doScrollTime :: Float -> Creature -> World -> World
|
||||
doScrollTime x _ w
|
||||
| x > 0 = case _futureWorlds $ _cwTime w of
|
||||
(w':ws) -> w -- & cWorld .~ w'
|
||||
-- & cwTime . futureWorlds %~ tail
|
||||
-- & cwTime . rewindWorlds .:~ _cWorld w
|
||||
_ -> w
|
||||
| otherwise = w
|
||||
cycleSignum :: Float -> Seq a -> Seq a
|
||||
cycleSignum x
|
||||
| x > 0 = cycleL
|
||||
|
||||
Reference in New Issue
Block a user