Add z levels to shockwaves

This commit is contained in:
2025-08-05 08:30:57 +01:00
parent 09428f2707
commit 22dafda9bd
12 changed files with 27 additions and 39 deletions
+10 -12
View File
@@ -1,10 +1,8 @@
module Dodge.Shockwave.Update (updateShockwave) where
import Linear.V3
import Dodge.Damage
import Dodge.Creature.Radius
import Dodge.Data.World
import Geometry.Vector
import qualified IntMapHelp as IM
import LensHelp
updateShockwave :: World -> Shockwave -> (World, Maybe Shockwave)
@@ -24,7 +22,9 @@ moveShockwave w sw
t = _swTimer sw
tFraction = fromIntegral t / fromIntegral (_swMaxTime sw)
rad = r - (3 / 4) * r * tFraction
doDams = damageInCircle (Explosive dam) p rad
doDams
| (p ^. _z >= 0) && (p ^. _z < 25) = damageInCircle (Explosive dam) (p ^. _xy) rad
| otherwise = id
-- doDams w' =
-- over (cWorld . lWorld . creatures) (IM.map damCr) $
-- foldl'
@@ -47,17 +47,15 @@ moveInverseShockwave ::
(World, Maybe Shockwave)
moveInverseShockwave w sw
| t <= 0 = (w, Nothing)
| otherwise = (dams w, Just $ swTimer -~ 1 $ sw)
| otherwise = (w, Just $ swTimer -~ 1 $ sw)
where
p = _swPos sw
r = _swRad sw
t = _swTimer sw
rad = r - 0.1 * r * fromIntegral (10 - t)
dams = over (cWorld . lWorld . creatures) (IM.map damCr) -- . flip (foldr (damageBlocksBy 1)) hitBlocks
-- rad = r - 0.1 * r * fromIntegral (10 - t)
-- dams = over (cWorld . lWorld . creatures) (IM.map damCr) -- . flip (foldr (damageBlocksBy 1)) hitBlocks
-- hitBlocks = wallsOnCirc' p rad $ wallsNearPoint' p w
damCr cr
| dist (_crPos cr) p >= rad + crRad (cr ^. crType) = cr
| otherwise = cr & crDamage .:~ Explosive 1 p
-- damCr cr
-- | dist (_crPos cr) p >= rad + crRad (cr ^. crType) = cr
-- | otherwise = cr & crDamage .:~ Explosive 1 p
--where
-- cpos = _crPos cr