Cleanup damages further

This commit is contained in:
2022-03-25 11:37:16 +00:00
parent af6cdfd048
commit cb9bdf9c55
8 changed files with 102 additions and 70 deletions
+24 -5
View File
@@ -6,6 +6,7 @@ module Dodge.WorldEvent.SpawnParticle
, aStaticBall
, makeStaticBall
, incBall
, incBall'
, concBall
) where
import Dodge.Data
@@ -83,16 +84,16 @@ moveFlame :: Point2 -- ^ Rotation direction
moveFlame rotd w pt
| time <= 0 = (makeFlamerSmokeAt (addZ 20 ep) w, Nothing)
| otherwise = case thingsHitExceptCr (_ptCrIgnore pt) sp ep w of
((_,Left _):_) -> (doSound $ damwls damcrs , mvPt 0.7)
((_,Left _):_) -> (doSound $ damwls damcrs , mvPt' 0.7)
((p,Right wl):_) -> (doSound $ damwls damcrs , rfl wl p)
_ -> (ptFlicker pt . damwls $ doSound damcrs , mvPt 0.98)
_ -> (ptFlicker pt . damwls $ doSound damcrs , mvPt' 0.98)
where
time = _ptTimer pt
doSound = soundContinue Flame (V2 x y) fireLoudS (Just 2)
sp@(V2 x y) = _ptPos pt
vel = _ptVel pt
ep = sp +.+ vel
mvPt speed = Just $ pt
mvPt' speed = Just $ pt
{ _ptTimer = time - 1
, _ptPos = ep
, _ptCrIgnore = Nothing
@@ -130,6 +131,24 @@ incBall vel = do
, _ptZ = 20
}
incBall' :: Particle -> Either Creature Wall -> Damage -> State StdGen Particle
incBall' bt ecrwl dm = do
rot <- state $ randomR (0,3)
return PtZ
{ _ptDraw = drawFlameletZ rot
, _ptUpdate = moveFlamelet
, _ptVel = vel
, _ptColor = red
, _ptPos = p
, _ptCrIgnore = Nothing
, _ptWidth = 3
, _ptTimer = 20
, _ptHitEff = damageBothTypeAmount Flaming 20
, _ptZ = 20
}
where
vel = 0
p = _dmFrom dm
concBall :: Point2 -> State g Particle
concBall _ = return Shockwave
{ _ptDraw = drawShockwave
@@ -284,9 +303,9 @@ Applies movement and attaches damage to nearby creatures. -}
moveFlamelet :: World -> Particle -> (World, Maybe Particle)
moveFlamelet w pt
| _ptTimer pt <= 0 = ( w, Nothing)
| otherwise = (ptFlicker pt $ damageInRadius 5 mvPt w, Just mvPt)
| otherwise = (ptFlicker pt $ damageInRadius 5 mvPt' w, Just mvPt')
where
mvPt = pt
mvPt' = pt
& ptTimer -~ 1
& ptPos .~ _ptPos pt +.+ _ptVel pt
& ptCrIgnore .~ Nothing