Tweak tesla gun

This commit is contained in:
2022-04-06 19:59:38 +01:00
parent bd255d2e54
commit dd64f3c5db
6 changed files with 143 additions and 72 deletions
+8 -8
View File
@@ -21,9 +21,9 @@ import Control.Monad.State
--import Data.List
--import Data.Maybe
aTeslaArcAt :: Color -> [(Point2,Float,Maybe (Either Creature Wall))] -> Particle
aTeslaArcAt :: Color -> [ArcStep] -> Particle
aTeslaArcAt col thearc = LinearParticle
{ _ptPoints = map (^. _1) thearc
{ _ptPoints = map (^. asPos) thearc
, _ptDraw = drawTeslaArc
, _ptUpdate = moveTeslaArc thearc
, _ptTimer = 2
@@ -37,7 +37,7 @@ drawTeslaArc pt = setLayer 1 $ pictures
]
where
ps = _ptPoints pt
moveTeslaArc :: [(Point2,Float,Maybe (Either Creature Wall))]
moveTeslaArc :: [ArcStep]
-> World
-> Particle
-> (World,Maybe Particle)
@@ -52,11 +52,11 @@ moveTeslaArc thearc w pt
makeaspark = randColDirTimeSpark rcol rdir rtime lp
makesparks = makeaspark . makeaspark . makeaspark
(lp,ld) = case last thearc of
(lp',ld',Nothing) -> (lp',ld')
(lp',ld',Just (Left cr)) -> (lp' -.- (_crRad cr + 1) *.* unitVectorAtAngle ld',ld'+pi)
(lp',ld',Just (Right _)) -> (lp' -.- 2 *.* unitVectorAtAngle ld',ld'+pi)
damthings (_,_,Nothing) = id
damthings (p,dir,Just crwl) = damageCrWall (thedamage p dir) crwl
ArcStep lp' ld' Nothing -> (lp',ld')
ArcStep lp' ld' (Just (Left cr)) -> (lp' -.- (_crRad cr + 1) *.* unitVectorAtAngle ld',ld'+pi)
ArcStep lp' ld' (Just (Right _)) -> (lp' -.- 2 *.* unitVectorAtAngle ld',ld'+pi)
damthings (ArcStep _ _ Nothing) = id
damthings (ArcStep p dir (Just crwl)) = damageCrWall (thedamage p dir) crwl
thedamage p dir = Damage Electrical 50 (p -.- q) p (p +.+ q) NoDamageEffect
where
q = 5 *.* unitVectorAtAngle dir