Implement pulse rifle with explodable pulse balls
This commit is contained in:
+15
-5
@@ -7,6 +7,8 @@ Description : Simulation update
|
||||
-}
|
||||
module Dodge.Update (updateUniverse) where
|
||||
|
||||
import Dodge.WorldEvent.Explosion
|
||||
import Dodge.Data.Object
|
||||
import Color
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
@@ -633,14 +635,22 @@ updatePulseLaser pz = case pz ^. pzTimer of
|
||||
5 -> (Endo f, [pz & pzTimer -~ 1])
|
||||
_ -> (Endo g, [pz & pzTimer -~ 1])
|
||||
where
|
||||
f w =
|
||||
damThingHitWith
|
||||
(\p2 -> Lasering (pz ^. pzDamage) p2 (xp - sp))
|
||||
thHit
|
||||
f w = dodam thHit ps
|
||||
w
|
||||
& cWorld . lWorld . flares <>~ drawLaser cyan (sp : ps)
|
||||
where
|
||||
(thHit, ps) = reflectLaserAlong phasev sp xp w
|
||||
(thHit, ps) = reflectPulseLaserAlong phasev sp xp w
|
||||
dodam thit ps = case thit of
|
||||
Just (p, OCreature cr) ->
|
||||
cWorld . lWorld . creatures . ix (_crID cr) . crDamage
|
||||
.:~ Lasering (pz ^. pzDamage) p (xp - sp)
|
||||
Just (p, OWall wl) ->
|
||||
cWorld . lWorld . wallDamages . at (_wlID wl) . non mempty
|
||||
.:~ Lasering (pz ^. pzDamage) p (xp - sp)
|
||||
Just (p, OPulseBall pb) ->
|
||||
(cWorld . lWorld . pulseBalls . ix (_pbID pb) . pbTimer .~ 0)
|
||||
. makeExplosionAt (_pbPos pb) 0
|
||||
_ -> id
|
||||
phasev = _pzPhaseV pz
|
||||
sp = _pzPos pz
|
||||
dir = _pzDir pz
|
||||
|
||||
Reference in New Issue
Block a user