Allow for more variation in death timers
This commit is contained in:
@@ -42,7 +42,6 @@ updateCreature cr
|
||||
| cr ^. crPos . _z < negate 100 = (tocr . crHP .~ CrIsPitted) . destroyAllInvItems cr
|
||||
| CrIsCorpse _ <- cr ^. crHP = updateCarriage (_crID cr) . chasmTestCorpse cr
|
||||
| null (cr ^? crHP . _HP) = id
|
||||
-- | cr ^. crPos . _z < 0 = (tocr . crZVel -~ 0.5) . (tocr . crPos . _z +~ _crZVel cr)
|
||||
| otherwise = updateLivingCreature cr
|
||||
where
|
||||
tocr = cWorld . lWorld . creatures . ix (_crID cr)
|
||||
@@ -103,10 +102,14 @@ checkDeath cid w = maybe id checkDeath' (w ^? cWorld . lWorld . creatures . ix c
|
||||
checkDeath' :: Creature -> World -> World
|
||||
checkDeath' cr w = case cr ^. crHP of
|
||||
HP x | x > 0 -> w & tocr . crDamage .~ []
|
||||
HP x | x > -200 && _crDeathTimer cr > 0 ->
|
||||
HP x | x > -200 && null (cr ^. crDeathTimer)
|
||||
-> w & tocr %~ startDeathTimer
|
||||
HP x | x > -200
|
||||
,Just y <- cr ^. crDeathTimer
|
||||
, y > 0 ->
|
||||
w
|
||||
& tocr . crDamage .~ []
|
||||
& tocr . crDeathTimer -~ 1
|
||||
& tocr . crDeathTimer . _Just -~ 1
|
||||
HP _ ->
|
||||
w
|
||||
& dropAll cr -- the order of these is possibly important
|
||||
@@ -117,6 +120,12 @@ checkDeath' cr w = case cr ^. crHP of
|
||||
where
|
||||
tocr = cWorld . lWorld . creatures . ix (_crID cr)
|
||||
|
||||
startDeathTimer :: Creature -> Creature
|
||||
startDeathTimer cr = cr
|
||||
& crDeathTimer ?~ case cr ^. crType of
|
||||
HoverCrit {} -> 0
|
||||
_ -> 5
|
||||
|
||||
toDeathCarriage :: Carriage -> Carriage
|
||||
toDeathCarriage = \case
|
||||
Flying {} -> Falling
|
||||
|
||||
Reference in New Issue
Block a user