Cleanup, remove bullet tweaks
This commit is contained in:
@@ -110,7 +110,7 @@ damageGamut pdam bdam tor sp p ep =
|
||||
,Damage PushDam 1 sp p ep . PushBackDamage $ 3 *.* (ep -.- sp)
|
||||
]
|
||||
|
||||
bulletDestroySpawn :: (Point2 -> Particle)
|
||||
bulletDestroySpawn :: (Point2 -> State StdGen Particle)
|
||||
-> Particle
|
||||
-> [(Point2, Either Creature Wall)]
|
||||
-> World
|
||||
@@ -118,55 +118,37 @@ bulletDestroySpawn :: (Point2 -> Particle)
|
||||
bulletDestroySpawn f = destroyOnImpact (bulDestroyCr f) (bulDestroyWall f)
|
||||
|
||||
{- | Create a flamelet when hitting a creature. -}
|
||||
bulDestroyCr :: (Point2 -> Particle) -> Particle -> Point2 -> Creature -> World -> World
|
||||
bulDestroyCr :: (Point2 -> State StdGen Particle)
|
||||
-> Particle -> Point2 -> Creature -> World -> World
|
||||
bulDestroyCr f bt p cr w = w
|
||||
& instantParticles .:~ (f v & ptPos .~ p)
|
||||
& instantParticles .:~ (pt & ptPos .~ p)
|
||||
& bulletHitSound p
|
||||
& creatures . ix cid . crState . crDamage .:~ Damage Piercing 60 sp p ep NoDamageEffect
|
||||
& randGen .~ g
|
||||
where
|
||||
(pt,g) = randInCirc 1 >>= f & runState $ _randGen w
|
||||
cid = _crID cr
|
||||
sp = head $ _ptTrail bt
|
||||
ep = sp +.+ _ptVel bt
|
||||
v = evalState (randInCirc 1) $ _randGen w
|
||||
|
||||
{- | Create flamelet on wall. -}
|
||||
bulDestroyWall
|
||||
:: (Point2 -> Particle)
|
||||
bulDestroyWall :: (Point2 -> State StdGen Particle)
|
||||
-> Particle
|
||||
-> Point2 -- Impact point
|
||||
-> Wall
|
||||
-> World
|
||||
-> World
|
||||
bulDestroyWall f bt p wl = damageWall (Damage Blunt 50 sp p ep NoDamageEffect) wl
|
||||
. (instantParticles .:~ (f reflectVel & ptPos .~ pOut))
|
||||
bulDestroyWall f bt p wl w = w
|
||||
& damageWall (Damage Piercing 60 sp p ep NoDamageEffect) wl
|
||||
& (instantParticles .:~ (pt & ptPos .~ pOut))
|
||||
& randGen .~ g
|
||||
where
|
||||
(pt,g) = runState (f reflectVel) (_randGen w)
|
||||
ep = sp +.+ _ptVel bt
|
||||
sp = head $ _ptTrail bt
|
||||
pOut = p +.+ squashNormalizeV (sp -.- p)
|
||||
wallV = uncurry (-.-) (_wlLine wl)
|
||||
reflectVel = squashNormalizeV $ reflectIn wallV (_ptVel bt)
|
||||
|
||||
{- | Create a flamelet when hitting a creature. -}
|
||||
bulIncCr :: Particle -> Point2 -> Creature -> World -> World
|
||||
bulIncCr bt p cr w = w
|
||||
& makeFlamelet p 20 v Nothing 3 20
|
||||
& bulletHitSound p
|
||||
& creatures . ix cid . crState . crDamage .:~ Damage Piercing 60 sp p ep NoDamageEffect
|
||||
where
|
||||
cid = _crID cr
|
||||
sp = head $ _ptTrail bt
|
||||
ep = sp +.+ _ptVel bt
|
||||
v = evalState (randInCirc 1) $ _randGen w
|
||||
{- | Creates a shockwave when hitting a creature. -}
|
||||
bulConCr :: Particle -> Point2 -> Creature -> World -> World
|
||||
bulConCr bt p cr
|
||||
= over (creatures . ix cid . crState . crDamage) (Damage Blunt 10 sp p ep NoDamageEffect :)
|
||||
. makeShockwaveAt [] p 15 4 1 white
|
||||
. bulletHitSound p
|
||||
where
|
||||
cid = _crID cr
|
||||
sp = head $ _ptTrail bt
|
||||
ep = sp +.+ _ptVel bt
|
||||
{- | Hitting wall effects: create a spark, damage blocks. -}
|
||||
bulHitWall :: Particle -> Point2 -> Wall -> World -> World
|
||||
bulHitWall bt p = damageWall (Damage Piercing 100 sp p ep NoDamageEffect)
|
||||
|
||||
Reference in New Issue
Block a user