This commit is contained in:
2022-03-25 14:04:42 +00:00
parent 1607879014
commit e98ecfffb3
5 changed files with 168 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
module Dodge.Particle.Damage where
import Dodge.Data
import Geometry
--import LensHelp
import System.Random
import Control.Monad.State
spawnAtBulDams :: (Point2 -> State StdGen Particle)
-> Particle -> Point2 -> [Damage]
spawnAtBulDams thespawn bt p =
[ Damage Piercing 50 sp p ep (DamageSpawn $ \_ dm -> thespawn (_dmAt dm))
, Damage PushDam 1 sp p ep . PushBackDamage $ 2 *.* bulVel
]
where
sp = head $ _ptTrail bt
bulVel = _ptVel bt
ep = sp +.+ bulVel
simpleDam :: DamageType -> Int -> Particle -> Point2 -> [Damage]
simpleDam dt amount bt p =
[ Damage dt amount sp p ep NoDamageEffect
]
where
sp = head $ _ptTrail bt
bulVel = _ptVel bt
ep = sp +.+ bulVel
basicBulDams :: Particle -> Point2 -> [Damage]
basicBulDams bt p =
[ Damage Piercing 100 sp p ep NoDamageEffect
, Damage PushDam 1 sp p ep . PushBackDamage $ 2 *.* bulVel
]
where
sp = head $ _ptTrail bt
bulVel = _ptVel bt
ep = sp +.+ bulVel
basicSparkDams :: Particle -> Point2 -> [Damage]
basicSparkDams bt p =
[ Damage SparkDam 1 sp p ep NoDamageEffect
]
where
sp = head $ _ptTrail bt
bulVel = _ptVel bt
ep = sp +.+ bulVel
hvBulDams :: Particle -> Point2 -> [Damage]
hvBulDams bt p =
[ Damage Piercing 100 sp p ep NoDamageEffect
, Damage Blunt 50 sp p ep NoDamageEffect
, Damage TorqueDam 1 sp p ep $ TorqueDamage 0.7
, Damage PushDam 1 sp p ep . PushBackDamage $ 3 *.* (ep -.- sp)
]
where
sp = head $ _ptTrail bt
bulVel = _ptVel bt
ep = sp +.+ bulVel
bounceBulDams :: Particle -> Point2 -> [Damage]
bounceBulDams bt p =
[ Damage Piercing 80 sp p ep (BounceBullet bt)
, Damage PushDam 1 sp p ep . PushBackDamage $ 2 *.* bulVel
]
where
sp = head $ _ptTrail bt
bulVel = _ptVel bt
ep = sp +.+ bulVel