Add delay before game over
This commit is contained in:
@@ -7,6 +7,7 @@ module Dodge.Creature.Action
|
||||
, setMinInvSize
|
||||
, dropUnselected
|
||||
, dropExcept
|
||||
, dropItem
|
||||
-- , startReloadingWeapon
|
||||
, blinkAction
|
||||
, unsafeBlinkAction
|
||||
|
||||
@@ -68,11 +68,15 @@ checkDeath :: Creature -> World -> World
|
||||
checkDeath cr w
|
||||
| _crHP cr > 0 = w
|
||||
| otherwise = w
|
||||
& creatures . at (_crID cr) .~ Nothing
|
||||
-- & creatures . at (_crID cr) .~ Nothing
|
||||
& removecr
|
||||
& stopSoundFrom (CrWeaponSound (_crID cr) 0)
|
||||
& over decorations addCorpse
|
||||
& dropByState cr
|
||||
where
|
||||
removecr
|
||||
| _crID cr == 0 = creatures . ix (_crID cr) . crUpdate .~ const id
|
||||
| otherwise = creatures . at (_crID cr) .~ Nothing
|
||||
addCorpse = IM.insertNewKey
|
||||
$ uncurryV translate (_crOldPos cr)
|
||||
$ rotate (_crDir cr)
|
||||
@@ -88,7 +92,7 @@ internalUpdate cr = creatures . ix (_crID cr) %~
|
||||
-- | Drop items according to the creature state.
|
||||
-- TODO make sure this doesn't mess up any ItemPosition
|
||||
dropByState :: Creature -> World -> World
|
||||
dropByState cr w = foldr (copyInvItemToFloor cr) w $ case cr ^. crState . crDropsOnDeath of
|
||||
dropByState cr w = foldr (dropItem cr) w $ case cr ^. crState . crDropsOnDeath of
|
||||
DropAll -> IM.keys $ _crInv cr
|
||||
DropSpecific xs -> xs
|
||||
DropAmount n -> take n $ evalState (shuffle $ IM.keys $ _crInv cr) (_randGen w)
|
||||
|
||||
@@ -143,6 +143,7 @@ data World = World
|
||||
, _genParams :: GenParams
|
||||
, _genPlacements :: IM.IntMap [(Placement,Int)]
|
||||
, _genRooms :: IM.IntMap Room
|
||||
, _deathDelay :: Maybe Int
|
||||
}
|
||||
|
||||
newtype GenParams = GenParams
|
||||
|
||||
@@ -101,6 +101,7 @@ defaultWorld = World
|
||||
, _genParams = GenParams M.empty
|
||||
, _genPlacements = IM.empty
|
||||
, _genRooms = IM.empty
|
||||
, _deathDelay = Nothing
|
||||
}
|
||||
youLight :: TempLightSource
|
||||
youLight = TLS
|
||||
|
||||
+6
-3
@@ -269,9 +269,12 @@ markWallSeen w wl = w { _walls = IM.adjust mw (_wlID wl) $ _walls w }
|
||||
mw wl' = wl' {_wlSeen = True}
|
||||
|
||||
checkEndGame :: World -> World
|
||||
checkEndGame w
|
||||
| _crHP (you w) < 1 = w & sideEffects %~ ( . (menuLayers .~ [gameOverMenu]))
|
||||
| otherwise = w
|
||||
checkEndGame w = case _deathDelay w of
|
||||
Just x | x < 0 -> w & sideEffects %~ ( . (menuLayers .~ [gameOverMenu]))
|
||||
& deathDelay .~ Nothing
|
||||
Just _ -> w & deathDelay . _Just -~ 1
|
||||
_ | _crHP (you w) < 1 -> w & deathDelay ?~ 50
|
||||
_ -> w
|
||||
|
||||
updateGusts :: World -> World
|
||||
updateGusts w = w
|
||||
|
||||
Reference in New Issue
Block a user