Cleanup bullet effects
This commit is contained in:
@@ -3,8 +3,6 @@ module Dodge.Item.Weapon.Bullet
|
||||
, hvBullet
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Particle.HitEffect
|
||||
import Dodge.Particle.Bullet.HitEffect
|
||||
import Dodge.Particle.Damage
|
||||
import Dodge.Particle.HitEffect.ExpireAndDamage
|
||||
|
||||
@@ -12,7 +10,6 @@ import Geometry.Data
|
||||
basicBullet :: AmmoType
|
||||
basicBullet = BulletAmmo
|
||||
{ _amString = "BASIC"
|
||||
--, _amBulEff = destroyOnImpact bulHitCr bulHitWall
|
||||
, _amBulEff = expireAndDamage basicBulDams
|
||||
, _amBulWth = 2
|
||||
, _amBulVel = V2 50 0
|
||||
@@ -21,7 +18,7 @@ basicBullet = BulletAmmo
|
||||
hvBullet :: AmmoType
|
||||
hvBullet = BulletAmmo
|
||||
{ _amString = "HVBULLET"
|
||||
, _amBulEff = penWalls hvBulHitCr hvBulHitWall
|
||||
, _amBulEff = expireAndDamage hvBulDams
|
||||
, _amBulWth = 6
|
||||
, _amBulVel = V2 80 0
|
||||
, _amBulTraj = BasicBulletTrajectory
|
||||
|
||||
@@ -14,7 +14,8 @@ import Dodge.Default.Weapon
|
||||
--import Dodge.Item.Weapon.InventoryDisplay
|
||||
import Dodge.Default
|
||||
import Dodge.Item.Weapon.ZoomScope
|
||||
--import Dodge.Item.Attachment
|
||||
--import Dodge.Particle.HitEffect.ExpireAndDamage
|
||||
--import Dodge.Particle.Damage
|
||||
import Dodge.Item.Weapon.ExtraEffect
|
||||
--import Dodge.Item.Weapon.InventoryDisplay
|
||||
import Dodge.Item.Weapon.AmmoParams
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
{- | Effects of bullets upon impact with walls or creatures. -}
|
||||
module Dodge.Particle.Bullet.HitEffect
|
||||
( hvBulHitCr
|
||||
, hvBulHitWall
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Particle.Spark
|
||||
import Dodge.Wall.Damage
|
||||
import Dodge.Wall.Reflect
|
||||
import Geometry
|
||||
import Picture
|
||||
import LensHelp
|
||||
|
||||
import System.Random
|
||||
{- | Heavy bullet effects when hitting creature:
|
||||
piercing, blunt, twisting and pushback damage all applied. -}
|
||||
hvBulHitCr :: Particle -> Point2 -> Creature -> World -> World
|
||||
hvBulHitCr bt p cr w = w
|
||||
& creatures . ix cid . crState . crDamage .++~
|
||||
damageGamut 200 100 d1 sp p ep
|
||||
where
|
||||
(d1,_) = randomR (-0.7,0.7) $ _randGen w
|
||||
cid = _crID cr
|
||||
sp = head $ _ptTrail bt
|
||||
ep = sp +.+ _ptVel bt
|
||||
damageGamut :: Int -> Int -> Float -> Point2 -> Point2 -> Point2
|
||||
-> [Damage]
|
||||
damageGamut pdam bdam tor sp p ep =
|
||||
[Damage Piercing pdam sp p ep NoDamageEffect
|
||||
,Damage Blunt bdam sp p ep NoDamageEffect
|
||||
,Damage TorqueDam 1 sp p ep $ TorqueDamage tor
|
||||
,Damage PushDam 1 sp p ep . PushBackDamage $ 3 *.* (ep -.- sp)
|
||||
]
|
||||
|
||||
--bulletDestroyDamage :: (Particle -> Point2 -> [Damage])
|
||||
-- -> Particle
|
||||
-- -> [(Point2, Either Creature Wall)]
|
||||
-- -> World
|
||||
-- -> (World, Maybe Particle)
|
||||
--bulletDestroyDamage fdm bt hitThings w = case hitThings of
|
||||
-- [] -> (w, mvPt bt)
|
||||
-- ((p,Left cr):_) -> (creff cr p w, destroyAt p bt)
|
||||
-- ((p,Right wl):_) -> (wleff wl p, destroyAt p bt)
|
||||
-- where
|
||||
-- creff cr p = addDamage
|
||||
-- where
|
||||
-- dams = fdm bt p
|
||||
-- addDamage = creatures . ix cid . crState . crDamage .++~ dams
|
||||
-- cid = _crID cr
|
||||
-- wleff wl p = foldr (`damageWall` wl) w dams
|
||||
-- where
|
||||
-- dams = fdm bt p
|
||||
|
||||
hvBulHitWall
|
||||
:: Particle
|
||||
-> Point2 -- ^ Impact point
|
||||
-> Wall
|
||||
-> World
|
||||
-> World
|
||||
hvBulHitWall bt p wl w = damageWall (Damage Piercing 200 sp p ep NoDamageEffect) wl
|
||||
. damageWall (Damage Blunt 100 sp p ep NoDamageEffect) wl
|
||||
$ set randGen g $ foldr ($) w (sparks pOut sv)
|
||||
where
|
||||
ep = sp +.+ _ptVel bt
|
||||
sp = head $ _ptTrail bt
|
||||
pOut = p +.+ squashNormalizeV (sp -.- p)
|
||||
(a, g) = randomR (-0.2,0.2) $ _randGen w
|
||||
sv = unitVectorAtAngle $ a + reflDirWall sp p wl
|
||||
cs' = take 10 $ randomRs (0,11) $ _randGen w
|
||||
cs = map (brightX 100 1.5 . numColor) cs'
|
||||
ts = randomRs (4,8) $ _randGen w
|
||||
sparks pos vel = zipWith (\t c -> colSpark t c pos (argV vel)) ts cs
|
||||
@@ -1,7 +1,6 @@
|
||||
module Dodge.Particle.Damage where
|
||||
import Dodge.Data
|
||||
import Geometry
|
||||
--import LensHelp
|
||||
|
||||
import System.Random
|
||||
import Control.Monad.State
|
||||
@@ -47,8 +46,12 @@ basicSparkDams bt p =
|
||||
|
||||
hvBulDams :: Particle -> Point2 -> [Damage]
|
||||
hvBulDams bt p =
|
||||
[ Damage Piercing 100 sp p ep NoDamageEffect
|
||||
, Damage Blunt 50 sp p ep NoDamageEffect
|
||||
[ Damage Piercing 25 sp p ep NoDamageEffect
|
||||
, Damage Piercing 25 sp p ep NoDamageEffect
|
||||
, Damage Piercing 25 sp p ep NoDamageEffect
|
||||
, Damage Piercing 25 sp p ep NoDamageEffect
|
||||
, Damage Piercing 25 sp p ep NoDamageEffect
|
||||
, Damage Piercing 25 sp p ep NoDamageEffect
|
||||
, Damage TorqueDam 1 sp p ep $ TorqueDamage 0.7
|
||||
, Damage PushDam 1 sp p ep . PushBackDamage $ 3 *.* (ep -.- sp)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user