Continue bullet refactor

This commit is contained in:
2022-07-16 22:02:01 +01:00
parent 301946ff8f
commit c9f7f39f22
12 changed files with 31 additions and 51 deletions
+7 -9
View File
@@ -1,7 +1,7 @@
module Dodge.Particle.Damage where
import Dodge.Data
import Geometry
import LensHelp
--import LensHelp
import System.Random
import Control.Monad.State
@@ -14,7 +14,7 @@ spawnAtBulDams thespawn bt p =
, Damage PUSHDAM 1 sp p ep . PushBackDamage $ 2 *.* bulVel
]
where
sp = head $ _buTrail bt
sp = _buPos bt
bulVel = _buVel bt
ep = sp +.+ bulVel
@@ -27,9 +27,7 @@ simpleDam dt amount bt p = [ Damage dt amount sp p ep NoDamageEffect ]
simpleDam' :: DamageType -> Int -> Bullet -> Point2 -> [Damage]
simpleDam' dt amount bt p = [ Damage dt amount sp p ep NoDamageEffect ]
where
sp = case bt ^? buTrail of
Nothing -> 0
Just xs -> head xs
sp = _buPos bt
bulVel = _buVel bt
ep = sp +.+ bulVel
@@ -39,7 +37,7 @@ heavyBulDams bt p =
, Damage PUSHDAM 1 sp p ep . PushBackDamage $ 2 *.* bulVel
]
where
sp = head $ _buTrail bt
sp = _buPos bt
bulVel = _buVel bt
ep = sp +.+ bulVel
@@ -49,7 +47,7 @@ basicBulDams bt p =
, Damage PUSHDAM 1 sp p ep . PushBackDamage $ 2 *.* bulVel
]
where
sp = head $ _buTrail bt
sp = _buPos bt
bulVel = _buVel bt
ep = sp +.+ bulVel
@@ -72,7 +70,7 @@ hvBulDams bt p =
, Damage PUSHDAM 1 sp p ep . PushBackDamage $ 3 *.* (ep -.- sp)
]
where
sp = head $ _buTrail bt
sp = _buPos bt
bulVel = _buVel bt
ep = sp +.+ bulVel
@@ -82,6 +80,6 @@ bounceBulDams bt p =
, Damage PUSHDAM 1 sp p ep . PushBackDamage $ 2 *.* bulVel
]
where
sp = head $ _buTrail bt
sp = _buPos bt
bulVel = _buVel bt
ep = sp +.+ bulVel