Remove ssaTri, bullet movement is broken

This commit is contained in:
2021-12-15 17:34:20 +00:00
parent dccacd9d22
commit adab32bf68
13 changed files with 74 additions and 213 deletions
+14 -14
View File
@@ -28,7 +28,7 @@ bulHitCr bt p cr w
| otherwise = addDamage . bulletHitSound p $ w
where
sp = head $ _btTrail' bt
bulVel = _btVel' bt
bulVel = _ptVel bt
ep = sp +.+ bulVel
mvDams = [ PushDam 1 $ 2 *.* bulVel ]
addDamage = creatures . ix cid . crState . crDamage %~ ((Piercing 100 sp p ep : mvDams) ++ )
@@ -46,7 +46,7 @@ bulBounceArmCr' bt p cr w
| otherwise = addDamage . bulletHitSound p $ w
where
sp = head $ _btTrail' bt
bulVel = _btVel' bt
bulVel = _ptVel bt
ep = sp +.+ bulVel
mvDams = [ PushDam 1 $ 2 *.* bulVel ]
addDamage = creatures . ix cid . crState . crDamage %~ ((Piercing 100 sp p ep : mvDams) ++ )
@@ -77,9 +77,9 @@ bulPenCr' bt p cr w
(d1,_) = randomR (-0.7,0.7) $ _randGen w
cid = _crID cr
sp = head $ _btTrail' bt
ep = sp +.+ _btVel' bt
ep = sp +.+ _ptVel bt
addPiercer = over particles (piercer :)
piercer = (aGenBulAt (Just cid) p (_btVel' bt) (_btDrag bt)
piercer = (aGenBulAt (Just cid) p (_ptVel bt) (_btDrag bt)
(_btHitEffect' bt) (_btWidth' bt)
) {_btTimer' = _btTimer' bt - 1}
{- | Heavy bullet effects when hitting creature:
@@ -100,7 +100,7 @@ hvBulHitCr bt p cr w
(d1,_) = randomR (-0.7,0.7) $ _randGen w
cid = _crID cr
sp = head $ _btTrail' bt
ep = sp +.+ _btVel' bt
ep = sp +.+ _ptVel bt
{- | Create a flamelet when hitting a creature. -}
bulIncCr :: Particle -> Point2 -> Creature -> World -> World
bulIncCr bt p cr w
@@ -112,7 +112,7 @@ bulIncCr bt p cr w
where
cid = _crID cr
sp = head $ _btTrail' bt
ep = sp +.+ _btVel' bt
ep = sp +.+ _ptVel bt
v = evalState (randInCirc 1) $ _randGen w
incFlamelets = over worldEvents $ (.) (makeFlameletTimed p 20 v Nothing 3 20)
{- | Creates a shockwave when hitting a creature. -}
@@ -124,23 +124,23 @@ bulConCr bt p cr
where
cid = _crID cr
sp = head $ _btTrail' bt
ep = sp +.+ _btVel' bt
ep = sp +.+ _ptVel bt
{- | Hitting wall effects: create a spark, damage blocks. -}
bulHitWall :: Particle -> Point2 -> Wall -> World -> World
bulHitWall bt p = damageWall (Piercing 100 sp p ep)
where
ep = sp +.+ _btVel' bt
ep = sp +.+ _ptVel bt
sp = head $ _btTrail' bt
{- | Bounce off walls, do damage to blocks. -}
bulBounceWall :: Particle -> Point2 -> Wall -> World -> World
bulBounceWall bt p wl = damageWall (Blunt 50 sp p ep) wl . over worldEvents addBouncer
where
ep = sp +.+ _btVel' bt
ep = sp +.+ _ptVel bt
sp = head $ _btTrail' bt
pOut = p +.+ squashNormalizeV (sp -.- p)
bouncer = (aGenBulAt Nothing pOut reflectVel 0.5 (_btHitEffect' bt) (_btWidth' bt)
) {_btTimer' = _btTimer' bt - 1}
reflectVel = reflVelWall wl (_btVel' bt)
reflectVel = reflVelWall wl (_ptVel bt)
addBouncer = ( over particles (bouncer : ) . )
-- the hack is to get around the fact that the particles list gets reset after
-- all projectiles in it are checked, so we cannot add to it as we accumulate over
@@ -155,11 +155,11 @@ bulIncWall
-> World
bulIncWall bt p wl = damageWall (Blunt 50 sp p ep) wl . incFlamelets
where
ep = sp +.+ _btVel' bt
ep = sp +.+ _ptVel bt
sp = head $ _btTrail' bt
pOut = p +.+ squashNormalizeV (sp -.- p)
wallV = uncurry (-.-) (_wlLine wl)
reflectVel = squashNormalizeV $ reflectIn wallV (_btVel' bt)
reflectVel = squashNormalizeV $ reflectIn wallV (_ptVel bt)
incFlamelets = over worldEvents $ (.) (makeFlameletTimed pOut 20 reflectVel Nothing 3 20)
{- | Create a shockwave on wall-}
bulConWall
@@ -171,7 +171,7 @@ bulConWall
bulConWall bt p wl = damageWall (Blunt 10 sp p ep) wl .
over worldEvents ( makeShockwaveAt [] p 15 4 1 white . )
where
ep = sp +.+ _btVel' bt
ep = sp +.+ _ptVel bt
sp = head $ _btTrail' bt
hvBulHitWall
@@ -184,7 +184,7 @@ hvBulHitWall bt p wl w = damageWall (Piercing 200 sp p ep) wl
. damageWall (Blunt 100 sp p ep) wl
$ set randGen g $ foldr ($) w (sparks pOut sv)
where
ep = sp +.+ _btVel' bt
ep = sp +.+ _ptVel bt
sp = head $ _btTrail' bt
pOut = p +.+ squashNormalizeV (sp -.- p)
(a, g) = randomR (-0.2,0.2) $ _randGen w