Cleanup damages further

This commit is contained in:
2022-03-25 11:37:16 +00:00
parent af6cdfd048
commit cb9bdf9c55
8 changed files with 100 additions and 68 deletions
+5 -2
View File
@@ -7,6 +7,8 @@ import Color
import Geometry
import LensHelp
import Control.Monad.State
import System.Random
import Data.List
defaultApplyDamage :: [Damage] -> Creature -> (World -> World, Creature)
@@ -39,8 +41,9 @@ applyDamageEffect dm de (f,cr) = case de of
reflectVel = magV bulVel *.* newDir
newDir = squashNormalizeV (p -.- _crPos cr)
bulVel = _ptVel bt
SparkBullet _ -> (f, cr) -- TODO
_ -> (f,cr)
DamageSpawn f -> (instantParticles .:~ thepart, cr)
where
thepart = evalState (f (Left cr) dm) $ mkStdGen 0
where
fromDir = _dmFrom dm
p = _dmAt dm