Cleanup
This commit is contained in:
@@ -67,8 +67,7 @@ unsafeBlinkAction cr w
|
||||
| otherwise =
|
||||
w
|
||||
& blinkActionFail cr
|
||||
& cWorld . lWorld . creatures . ix cid . crState . csDamage
|
||||
.:~ Enterrement 100000000
|
||||
& cWorld . lWorld . creatures . ix cid . crDamage .:~ Enterrement 100000000
|
||||
where
|
||||
success = fromMaybe True $ do
|
||||
wl <- snd $ collidePointWallsFilter (const True) mwp cpos w
|
||||
|
||||
@@ -86,7 +86,7 @@ followImpulse cr w imp = case imp of
|
||||
posFromID cid' = w ^?! cWorld . lWorld . creatures . ix cid' . crPos
|
||||
rr a = randomR (- a, a) $ _randGen w
|
||||
hitCr i =
|
||||
( cWorld . lWorld . creatures . ix i . crState . csDamage
|
||||
( cWorld . lWorld . creatures . ix i . crDamage
|
||||
.:~ Blunt 100 (posFromID i) (posFromID i-cpos)-- (PushBackDamage 5)
|
||||
)
|
||||
. soundStart (CrSound cid) cpos hitS Nothing
|
||||
|
||||
@@ -19,10 +19,6 @@ barrel =
|
||||
defaultInanimate
|
||||
{ _crHP = 500
|
||||
, _crType = BarrelCrit PlainBarrel
|
||||
, _crState =
|
||||
defaultState
|
||||
-- { _csSpState = Barrel []
|
||||
-- }
|
||||
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||
}
|
||||
|
||||
@@ -31,10 +27,6 @@ explosiveBarrel =
|
||||
defaultInanimate
|
||||
{ _crHP = 400
|
||||
, _crType = BarrelCrit (ExplosiveBarrel [])
|
||||
, _crState =
|
||||
defaultState
|
||||
-- { _csSpState = Barrel []
|
||||
-- }
|
||||
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||
}
|
||||
-- & crMaterial .~ Crystal
|
||||
|
||||
@@ -13,7 +13,6 @@ launcherCrit :: Creature
|
||||
launcherCrit =
|
||||
defaultCreature
|
||||
{ _crInv = IM.fromList [(0, rLauncher)]
|
||||
, _crState = defaultState
|
||||
, _crHP = 300
|
||||
}
|
||||
-- & crType . skinUpper .~ lightx4 red
|
||||
|
||||
@@ -93,7 +93,7 @@ deadRot cr = overPosSH (Q.rotateToZ d)
|
||||
maybe
|
||||
(V3 1 0 0)
|
||||
(addZ 0 . unitVectorAtAngle . subtract (_crDir cr + pi))
|
||||
(damageDirection . _csDamage $ _crState cr)
|
||||
(damageDirection $ _crDamage cr)
|
||||
|
||||
scalp :: Creature -> Shape
|
||||
{-# INLINE scalp #-}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user