Add randomness to chase crit corpses

This commit is contained in:
2026-04-08 23:11:36 +01:00
parent 68eaf84ec2
commit 34192777a6
3 changed files with 16 additions and 13 deletions
+5 -5
View File
@@ -133,7 +133,7 @@ toDeathCarriage = \case
-- 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
corpseOrGib cr w = w & case cr ^? crDamage . to maxDamageType . _Just . _1 of
Just CookingDamage ->
sethp (CrIsCorpse $ scorchSPic thecorpse)
. dodeathsound CookDeath
@@ -150,16 +150,16 @@ corpseOrGib cr = case cr ^? crDamage . to maxDamageType . _Just . _1 of
. dodeathsound PlainDeath
where
dodeathsound dt = f dt . stopSoundFrom (CrMouth cid)
f dt w = fromMaybe w $ do
let (msid, g) = runState (maybeTakeOne (crDeathSounds cr dt)) (_randGen w)
f dt w' = fromMaybe w' $ do
let (msid, g) = runState (maybeTakeOne (crDeathSounds cr dt)) (_randGen w')
sid <- msid
return $
w
w'
& soundStart (CrMouth cid) (cr ^. crPos . _xy) sid Nothing
& randGen .~ g
cid = cr ^. crID
sethp x = cWorld . lWorld . creatures . ix (_crID cr) . crHP .~ x
thecorpse = makeCorpse cr
thecorpse = makeCorpse (w ^. randGen) cr
scorchSPic :: SPic -> SPic
scorchSPic = _1 %~ overColSH (mixColors 0.9 0.1 black . normalizeColor)