Fix bugs in zoning
This commit is contained in:
+11
-13
@@ -7,12 +7,12 @@ module Dodge.Spark (
|
||||
randSpark,
|
||||
) where
|
||||
|
||||
import Dodge.Damage
|
||||
import Color
|
||||
import Control.Monad.State
|
||||
import Dodge.Data.World
|
||||
import Dodge.WorldEvent.ThingsHit
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
import System.Random
|
||||
|
||||
@@ -37,8 +37,7 @@ sparkDam ::
|
||||
World ->
|
||||
World
|
||||
sparkDam sk sp ep mayEiCrWl = case mayEiCrWl of
|
||||
(hitp, Left cr) -> cWorld . creatures . ix (_crID cr) . crState . csDamage .:~ thedam hitp
|
||||
(hitp, Right wl) -> cWorld . wallDamages %~ IM.insertWith (++) (_wlID wl) [thedam hitp]
|
||||
(hitp, eicrwl) -> damageCrWl (thedam hitp) eicrwl
|
||||
where
|
||||
thedam hitp = Damage (_skDamageType sk) 1 sp hitp ep NoDamageEffect
|
||||
|
||||
@@ -56,22 +55,21 @@ randColDirSpark ::
|
||||
World
|
||||
randColDirSpark randcol randdir pos w =
|
||||
w
|
||||
& cWorld . sparks .:~ spark
|
||||
& randGen .~ g
|
||||
& cWorld . sparks
|
||||
.:~ Spark
|
||||
{ _skVel = rotateV dir (V2 5 0)
|
||||
, _skColor = col
|
||||
, _skPos = pos
|
||||
, _skOldPos = pos
|
||||
, _skWidth = 1
|
||||
, _skDamageType = SPARKING
|
||||
}
|
||||
where
|
||||
((col, dir), g) = (`runState` _randGen w) $ do
|
||||
c <- randcol
|
||||
d <- randdir
|
||||
return (c, d)
|
||||
spark =
|
||||
Spark
|
||||
{ _skVel = rotateV dir (V2 5 0)
|
||||
, _skColor = col
|
||||
, _skPos = pos
|
||||
, _skOldPos = pos
|
||||
, _skWidth = 1
|
||||
, _skDamageType = SPARKING
|
||||
}
|
||||
|
||||
randSpark ::
|
||||
DamageType ->
|
||||
|
||||
Reference in New Issue
Block a user