This commit is contained in:
2025-06-14 23:16:29 +01:00
parent 02498e5abb
commit 078a3cc7ea
19 changed files with 29 additions and 60 deletions
+4 -4
View File
@@ -77,7 +77,7 @@ checkDeath :: Creature -> World -> World
checkDeath cr w
| _crHP cr > 0 =
w
& cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage .~ []
& cWorld . lWorld . creatures . ix (_crID cr) . crDamage .~ []
| _crHP cr <= -200 =
w
& dropByState cr -- the order of
@@ -86,7 +86,7 @@ checkDeath cr w
& addCrGibs cr
| _crHP cr > -200 && _crDeathTimer cr < 5 =
w
& cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage .~ []
& cWorld . lWorld . creatures . ix (_crID cr) . crDamage .~ []
& cWorld . lWorld . creatures . ix (_crID cr) . crDeathTimer +~ 1
| otherwise =
w
@@ -104,7 +104,7 @@ checkDeath cr w
-- could look at the amount of damage here (given by maxDamage) too
corpseOrGib :: Creature -> World -> World
corpseOrGib cr = case cr ^? crState . csDamage . to maxDamageType . _Just . _1 of
corpseOrGib cr = case cr ^? crDamage . to maxDamageType . _Just . _1 of
Just CookingDamage -> plNew (cWorld . lWorld . corpses) cpID (thecorpse & cpSPic %~ scorchSPic)
Just PoisonDamage -> plNew (cWorld . lWorld . corpses) cpID (thecorpse & cpSPic %~ poisonSPic)
Just PhysicalDamage | _crPastDamage cr > 200 -> addCrGibs cr
@@ -134,7 +134,7 @@ dropByState cr w = foldl' (flip (dropItem cr)) w $ IM.keys $ _crInv cr
doDamage :: Creature -> World -> World
doDamage cr = applyPastDamages cr . applyCreatureDamage dams cr
where
dams = _csDamage $ _crState cr
dams = cr ^. crDamage
-- TODO generalise shake to arbitrary damage amounts
applyPastDamages :: Creature -> World -> World