Tweak dual beams

This commit is contained in:
2022-04-07 09:28:52 +01:00
parent 1da07f1c4a
commit 4e80e73f13
3 changed files with 25 additions and 9 deletions
+20 -8
View File
@@ -223,8 +223,8 @@ lasGunDual = lasGun
& itType .~ LASGUNDUAL
& itParams .~ DualBeam
{ _phaseV = 1
, _lasColor = yellow
, _lasColor2 = yellow
, _lasColor = orange
, _lasColor2 = blue
, _lasCycle = 0
, _lasDamage = 11
, _lasBeam = BeamCombine lasBeamCombine
@@ -388,14 +388,23 @@ tractorGunPic it =
col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red
-- | assumes that the item is held
shootTeslaArc :: Item -> Creature -> World -> World
shootTeslaArc it cr w = w & randGen .~ g
& instantParticles .:~ aTeslaArcAt col newarc
& creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itParams . currentArc ?~ newarc
shootTeslaArc it cr w = w'
& creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itParams .~ ip
where
(w',ip) = shootTeslaArc' (_itParams it) pos dir w
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
dir = _crDir cr
shootTeslaArc' :: ItemParams -> Point2 -> Float -> World -> (World,ItemParams)
shootTeslaArc' ip pos dir w =
(w & randGen .~ g
& instantParticles .:~ aTeslaArcAt col newarc
, ip & currentArc .~ Just newarc
)
where
(col,g) = takeOne [white,azure,blue,cyan] & runState $ _randGen w
newarc = createArc (_itParams it) w pos dir & evalState $ _randGen w
newarc = createArc ip w pos dir & evalState $ _randGen w
createArc :: ItemParams
-> World
@@ -540,8 +549,11 @@ splitBeamCombine (p,(a,b,_),(x,y,_))
teslaBeamCombine :: (Point2,(Point2,Point2,Beam),(Point2,Point2,Beam))
-> World -> World
teslaBeamCombine (p,(a,b,_),(x,y,_))
= instantParticles .:~ lasRayAt yellow 11 1 p (argV (normalizeV (b-.-a)+.+normalizeV (y-.-x)))
teslaBeamCombine (p,(a,b,bm),(x,y,_)) w
= w'
where
dir = argV (normalizeV (b-.-a)+.+normalizeV (y-.-x))
(w',ip) = shootTeslaArc' (_beamItemParams $ _bmType bm) p dir w
lasRayAt :: Color -> Int -> Float -> Point2 -> Float -> Particle
lasRayAt col dam phasev pos dir = LaserParticle