Add delay before game over

This commit is contained in:
2022-06-03 10:45:20 +01:00
parent 0c5eeb405f
commit 60f75fb133
5 changed files with 15 additions and 5 deletions
+6 -2
View File
@@ -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)