Add files, minimal working rewind gun that must be equipped to charge
This commit is contained in:
@@ -26,8 +26,11 @@ rewindGun = defaultGun
|
|||||||
, _itUse = Left $ \cr invid -> useRewindGun (_crInv cr IM.! invid) cr
|
, _itUse = Left $ \cr invid -> useRewindGun (_crInv cr IM.! invid) cr
|
||||||
}
|
}
|
||||||
rewindEffect :: ItEffect -> Creature -> Int -> World -> World
|
rewindEffect :: ItEffect -> Creature -> Int -> World -> World
|
||||||
rewindEffect _ cr invid w = w & rewindWorlds %~ (take 250 . (w' : ))
|
rewindEffect _ cr invid w
|
||||||
& creatures . ix (_crID cr) . crInv . ix invid . wpLoadedAmmo .~ length (_rewindWorlds w)
|
| Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take 250 . (w' : ))
|
||||||
|
& creatures . ix (_crID cr) . crInv . ix invid . wpLoadedAmmo .~ length (_rewindWorlds w)
|
||||||
|
| otherwise = w & rewindWorlds .~ []
|
||||||
|
& creatures . ix (_crID cr) . crInv . ix invid . wpLoadedAmmo .~ 0
|
||||||
where
|
where
|
||||||
w' = w & rewindWorlds .~ []
|
w' = w & rewindWorlds .~ []
|
||||||
& rewinding .~ True
|
& rewinding .~ True
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
module ListHelp
|
||||||
|
(module Data.List
|
||||||
|
,initOrNull
|
||||||
|
)where
|
||||||
|
import Data.List
|
||||||
|
|
||||||
|
initOrNull :: [a] -> [a]
|
||||||
|
initOrNull [] = []
|
||||||
|
initOrNull xs = init xs
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
{-# LANGUAGE StrictData #-}
|
||||||
|
module MaybeHelp where
|
||||||
|
import Control.Lens
|
||||||
|
|
||||||
|
-- | Strict maybe
|
||||||
|
data Maybe' a
|
||||||
|
= Just' {_Just' :: a }
|
||||||
|
| Nothing'
|
||||||
|
|
||||||
|
fromJust' :: Maybe' a -> a
|
||||||
|
fromJust' mx = case mx of
|
||||||
|
Just' x -> x
|
||||||
|
Nothing' -> error "no fromJust'"
|
||||||
|
makeLenses ''Maybe'
|
||||||
Reference in New Issue
Block a user