Work on Falling carriage type

This commit is contained in:
2026-04-03 11:03:05 +01:00
parent 43a5817ef3
commit d65a4529be
6 changed files with 54 additions and 33 deletions
+7
View File
@@ -1,3 +1,4 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Creature.Update (updateCreature) where
import Color
@@ -93,10 +94,16 @@ checkDeath' cr w = case cr ^. crHP of
& dropAll cr -- the order of these is possibly important
& stopSoundFrom (CrWeaponSound (_crID cr) 0)
& corpseOrGib cr
& tocr . crStance . carriage %~ toDeathCarriage
_ -> w
where
tocr = cWorld . lWorld . creatures . ix (_crID cr)
toDeathCarriage :: Carriage -> Carriage
toDeathCarriage = \case
Flying {} -> Falling 0 RightForward
x -> x
-- could look at the amount of damage here (given by maxDamage) too
corpseOrGib :: Creature -> World -> World
corpseOrGib cr = case cr ^? crDamage . to maxDamageType . _Just . _1 of