Work on what happens when creatures fall down chasms

This commit is contained in:
2025-08-05 21:39:44 +01:00
parent df443744db
commit f69956750a
9 changed files with 112 additions and 109 deletions
+2 -4
View File
@@ -119,11 +119,9 @@ scorchSPic = _1 %~ overColSH (mixColors 0.9 0.1 black . normalizeColor)
poisonSPic :: SPic -> SPic
poisonSPic = _1 %~ overColSH (mixColors 0.5 0.5 green . normalizeColor)
{- | Drop items according to the creature state.
TODO make sure this doesn't mess up any ItemPosition
-}
-- reverse keys, otherwise two or more inv items will cause errors
dropAll :: Creature -> World -> World
dropAll cr w = foldl' (flip (dropItem cr)) w $ IM.keys $ _crInv cr
dropAll cr w = foldl' (flip (dropItem cr)) w . reverse . IM.keys $ _crInv cr
doDamage :: Creature -> World -> World
doDamage cr = applyPastDamages cr . applyCreatureDamage (cr ^. crDamage) cr
+12 -1
View File
@@ -14,8 +14,19 @@ import Dodge.Humanoid
import Dodge.Lampoid
import qualified Data.List as List
-- Should separate out creature movement from other parts here
updateCreature :: Creature -> World -> World
updateCreature cr = chasmTest cr . case _crType cr of
updateCreature cr
| _crZ cr < negate 100 = id -- can remove creature and all items
| _crZ cr < 0 = (tocr . crZVel -~ 0.5)
. (tocr . crZ +~ _crZVel cr)
| otherwise = updateCreature' cr
where
tocr = cWorld . lWorld . creatures . ix (_crID cr)
updateCreature' :: Creature -> World -> World
updateCreature' cr = chasmTest cr . case _crType cr of
Avatar{} -> (cWorld . lWorld . creatures . ix 0 . crType . avatarPulse %~ updatePulse)
. crUpdate yourControl cr
LampCrit{} -> updateLampoid cr