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
-2
View File
@@ -138,7 +138,6 @@ makeFragBullets p w = w & cWorld . lWorld . bullets .++~ bus
& buDrag .~ 0.8
& buPos .~ p
& buOldPos .~ p
& buWidth .~ 1
makeFlak :: Bullet -> Point2 -> World -> World
makeFlak bu _ w = w & cWorld . lWorld . bullets .++~ [f x | x <- xs]
@@ -148,7 +147,6 @@ makeFlak bu _ w = w & cWorld . lWorld . bullets .++~ [f x | x <- xs]
f x =
bu & buVel %~ g x
& buPayload .~ BulPlain 25
& buWidth .~ 0.5
g x v = v +.+ x *.* normalizeV (vNormal v)
hitEffFromBul :: World -> Bullet -> (World, Bullet)
+1 -1
View File
@@ -11,4 +11,4 @@ drawBullet pt =
setLayer BloomLayer
. setDepth 20
. color (V4 200 200 200 2)
$ thickLine (_buWidth pt) [_buOldPos pt, _buPos pt]
$ thickLine 2 [_buOldPos pt, _buPos pt]
+4 -4
View File
@@ -27,7 +27,7 @@ blinkActionMousePos cr w =
& blinkDistortions cpos p3
& cWorld . lWorld . creatures . ix cid . crPos .~ p3
& blinkShockwave cid p3
& inverseShockwaveAt cpos 40 2 2
& inverseShockwaveAt (cpos `v2z` 20) 40 2 2
where
cid = _crID cr
p1 = w ^. cWorld . lWorld . lAimPos
@@ -63,7 +63,7 @@ unsafeBlinkAction cr w
. blinkDistortions cpos mwp
. set (cWorld . lWorld . creatures . ix cid . crPos) mwp
. blinkShockwave cid mwp
$ inverseShockwaveAt cpos 40 2 2 w
$ inverseShockwaveAt (cpos `v2z` 20) 40 2 2 w
| otherwise =
w
& blinkActionFail cr
@@ -82,7 +82,7 @@ blinkShockwave ::
Point2 ->
World ->
World
blinkShockwave i p = makeShockwaveAt [i] p 60 1 2 cyan
blinkShockwave i p = makeShockwaveAt [i] (p `v2z` 20) 60 1 2 cyan
-- | Like a blink action, but no ingoing distortion
blinkActionFail ::
@@ -94,7 +94,7 @@ blinkActionFail cr w =
& soundMultiFrom [TeleSound 0, TeleSound 1] p3 teleS Nothing
& cWorld . lWorld . distortions .:~ distortionBulge
& cWorld . lWorld . creatures . ix cid . crPos .~ p3
& inverseShockwaveAt cpos 40 2 2
& inverseShockwaveAt (cpos `v2z` 20) 40 2 2
where
distR = 120
distortionBulge = RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) 1.9
+1 -1
View File
@@ -22,7 +22,7 @@ data Bullet = Bullet
, _buDrag :: Float
, _buPos :: Point2
, _buOldPos :: Point2
, _buWidth :: Float
-- , _buWidth :: Float
}
deriving (Show, Eq, Ord, Read) --Generic, Flat)
+1 -1
View File
@@ -18,7 +18,7 @@ data Shockwave = Shockwave
{ _swColor :: Color
, _swDirection :: ShockwaveDirection
, _swInvulnerableCrs :: [Int]
, _swPos :: Point2
, _swPos :: Point3
, _swRad :: Float
, _swDam :: Int
, _swPush :: Float
-2
View File
@@ -16,8 +16,6 @@ defaultBullet =
, _buDrag = 1
, _buPos = 0
, _buOldPos = 0
, _buWidth = 2
-- , _buDamages = basicBulDams
}
--basicBulDams :: [Damage]
+2 -5
View File
@@ -8,7 +8,6 @@ import RandomHelp
import Control.Monad
import Color
import Dodge.WorldEvent.Shockwave
import Geometry.Vector3D
import Dodge.Data.World
import Dodge.SoundLogic
import Dodge.WorldEvent.Explosion
@@ -27,8 +26,8 @@ makeShrapnelAt p' vel' w =
w
& soundMultiFrom [Explosion 0, Explosion 1] p bangS Nothing
& cWorld . lWorld . worldEvents
.:~ MakeTempLight (LSParam (addZ 20 p) 150 (V3 0.8 0.8 0.8)) 20
& makeShockwaveAt [] p 50 5 0 white
.:~ MakeTempLight (LSParam p' 150 (V3 0.8 0.8 0.8)) 20
& makeShockwaveAt [] p' 50 5 0 white
& cWorld . lWorld . bullets .++~ buls
where
p = p' ^. _xy
@@ -44,5 +43,3 @@ makeShrapnelAt p' vel' w =
& buDrag .~ drag
& buPos .~ (p - v)
& buOldPos .~ (p - v)
-- & buDamages .~ [Damage PIERCING 10 0 0 0 $ PushBackDamage 2]
& buWidth .~ 1
+1 -2
View File
@@ -18,7 +18,6 @@ data PJStabiliser
| StabSpinIncrease
-- assumes the mscreen is in your inventory
-- TODO take into account creature aimstance positioning
createShell ::
(Point3, Q.Quaternion Float) ->
Maybe (NewInt ItmInt) ->
@@ -37,7 +36,7 @@ createShell (p,q) mdetonator mscreen stab pjtype payload muz cr w =
& cWorld . lWorld . projectiles . at i
?~ Shell
{ _pjPos = pos `v2z` 20
, _pjVel = (rotateV dir' (V2 speed 0) + crvelcomponent) `v2z` 5
, _pjVel = (rotateV dir' (V2 speed 0) + crvelcomponent) `v2z` 0
, _pjID = i
, _pjDir = dir'
, _pjSpin = 0
+3 -5
View File
@@ -1,14 +1,12 @@
module Dodge.Shockwave.Draw where
module Dodge.Shockwave.Draw (drawShockwave) where
import Dodge.Data.Shockwave
import Geometry
import Picture
drawShockwave :: Shockwave -> Picture
drawShockwave sw =
setDepth 20
. setLayer BloomLayer
. uncurryV translate (_swPos sw)
setLayer BloomLayer
. translate3 (_swPos sw)
. color (_swColor sw)
$ thickCircle rad thickness
where
+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
+2 -2
View File
@@ -76,8 +76,8 @@ makeExplosionAt p' vel' w =
& soundStart (Explosion (w ^. cWorld . lWorld . lClock)) (p) bangS Nothing
& addFlames
& cWorld . lWorld . worldEvents
.:~ MakeTempLight (LSParam (addZ 20 p) 150 (V3 1 0.5 0)) 20
& makeShockwaveAt [] p 50 50 1 white
.:~ MakeTempLight (LSParam (p') 150 (V3 1 0.5 0)) 20
& makeShockwaveAt [] p' 50 50 1 white
where
p = p' ^. _xy
fVs = fmap (`v2z` 0) $ replicateM 100 (randInCirc 1) & evalState $ _randGen w
+2 -2
View File
@@ -13,7 +13,7 @@ makeShockwaveAt ::
-- | IDs of invulnerable creatures.
[Int] ->
-- | Center of shockwave.
Point2 ->
Point3 ->
-- | Maximal radius.
Float ->
-- | Damage caused per frame.
@@ -41,7 +41,7 @@ makeShockwaveAt is p rad dam push col =
{- Create a shockwave going from an outside circle into a center point. -}
inverseShockwaveAt ::
Point2 -> -- Center position
Point3 -> -- Center position
Float -> -- Radius
Int -> -- Damage
Float -> -- Push amount