Improve dual lasers
This commit is contained in:
@@ -86,7 +86,7 @@ itemCombinations =
|
||||
, p [p 2 PLATE] flatShield
|
||||
]
|
||||
++ map (\i -> po [LASGUNWIDE i,TRANSFORMER,PRISM] $ lasGunWide (i+1)) [1..9]
|
||||
++ map (\i -> po [LASGUNWIDE i,HARDWARE] $ lasGunFocus (i)) [1..10]
|
||||
++ map (\i -> po [LASGUNWIDE i,HARDWARE] $ lasGunFocus i) [1..10]
|
||||
++ map (\i -> po [PIPE,BANGSTICK i] $ bangStick (i+1)) [1..8]
|
||||
++ map (\i -> po [REVOLVERX i,CAN] $ revolverX (i+1)) [1..5]
|
||||
++ map (\i -> p [o (BANGCANEX i),p 2 PIPE] $ bangCaneX (i+1)) [1..5]
|
||||
|
||||
@@ -666,6 +666,7 @@ data ItemParams
|
||||
| Refracting
|
||||
{ _phaseV :: Float
|
||||
, _lasColor :: Color
|
||||
, _lasColor2 :: Color
|
||||
, _lasCycle :: Int
|
||||
, _lasDamage :: Int
|
||||
}
|
||||
|
||||
@@ -212,11 +212,13 @@ lasGunDual :: Item
|
||||
lasGunDual = lasGun
|
||||
& itName .~ "DUALAS"
|
||||
& itType .~ LASGUNDUAL
|
||||
& itParams . lasColor .~ red
|
||||
& itParams . lasColor .~ orange
|
||||
& itParams . lasColor2 .~ blue
|
||||
& itUse .~ (ruseInstant shootDualLaser NoHammer
|
||||
[ ammoCheckI
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, withItem $ \it -> withMuzPosShift (V2 0 10) $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, withItem $ \it -> withMuzPosShift (V2 0 (-10)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, useAmmoAmount 1
|
||||
]
|
||||
@@ -266,6 +268,7 @@ lasGun = defaultAutoBatteryGun
|
||||
, _itParams = Refracting
|
||||
{ _phaseV = 1
|
||||
, _lasColor = yellow
|
||||
, _lasColor2 = yellow
|
||||
, _lasCycle = 0
|
||||
, _lasDamage = 11
|
||||
}
|
||||
@@ -434,8 +437,8 @@ shootLaser it cr = instantParticles .:~ lasRayAt (_lasColor $ _itParams it) dam
|
||||
|
||||
shootDualLaser :: Item -> Creature -> World -> World
|
||||
shootDualLaser it cr w = w
|
||||
& newBeams . positronBeams .:~ dualRayAt w orange dam phasev posl dirl
|
||||
& newBeams . electronBeams .:~ dualRayAtNoFlame w blue dam phasev posr dirr
|
||||
& newBeams . positronBeams .:~ dualRayAt w (_lasColor $ _itParams it) dam phasev posl dirl
|
||||
& newBeams . electronBeams .:~ dualRayAtNoFlame w (_lasColor2 $ _itParams it) dam phasev posr dirr
|
||||
where
|
||||
dir = _crDir cr
|
||||
pos = _crPos cr +.+ aimlength *.* unitVectorAtAngle dir
|
||||
@@ -474,7 +477,6 @@ dualRayAt w col dam phasev pos dir = Beam
|
||||
, _bmFirstPoints = []
|
||||
, _bmType = BeamCombine
|
||||
$ \(p,(a,b,_),(x,y,_)) -> makeFlame p (2 *.* normalizeV (normalizeV (b-.-a)+.+normalizeV (y-.-x)))
|
||||
-- $ \(p,(a,b,_),(x,y,_)) -> makeFlame p (V2 5 0)
|
||||
}
|
||||
where
|
||||
(_,ps) = reflectLaserAlong phasev [] pos (pos +.+ 800 *.* unitVectorAtAngle dir) w
|
||||
@@ -493,8 +495,7 @@ dualRayAtNoFlame w col dam phasev pos dir = Beam
|
||||
, _bmPoints = pos:ps
|
||||
, _bmFirstPoints = []
|
||||
, _bmType = BeamCombine
|
||||
$ \_ -> id
|
||||
-- $ \(p,(a,b,_),(x,y,_)) -> makeFlame p (V2 5 0)
|
||||
$ const id
|
||||
}
|
||||
where
|
||||
(_,ps) = reflectLaserAlong phasev [] pos (pos +.+ 800 *.* unitVectorAtAngle dir) w
|
||||
|
||||
@@ -8,6 +8,7 @@ module Dodge.Item.Weapon.TriggerType
|
||||
, lockInvFor
|
||||
, withMuzFlareI
|
||||
, withMuzPos
|
||||
, withMuzPosShift
|
||||
, withOldDir
|
||||
, trigDoAlso
|
||||
, withTempLight
|
||||
@@ -389,10 +390,14 @@ withMuzFlareI f it cr w = makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) flashPos
|
||||
cdir = _crDir cr
|
||||
|
||||
withMuzPos :: (Point3 -> World -> World) -> ChainEffect
|
||||
withMuzPos g f it cr w = g (pos `v2z` 20)
|
||||
withMuzPos = withMuzPosShift (V2 0 0)
|
||||
withMuzPosShift :: Point2 -> (Point3 -> World -> World) -> ChainEffect
|
||||
withMuzPosShift p g f it cr w = g (pos `v2z` 20)
|
||||
$ f it cr w
|
||||
where
|
||||
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
pos = _crPos cr
|
||||
+.+ rotateV dir p
|
||||
+.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
dir = _crDir cr
|
||||
|
||||
{- | Applies the effect to a randomly rotated creature,
|
||||
|
||||
+7
-4
@@ -23,6 +23,7 @@ import Data.Maybe
|
||||
--import Data.Function
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import qualified Data.Map.Strict as M
|
||||
import Control.Applicative
|
||||
--import qualified Data.Set as S
|
||||
--import Data.Monoid
|
||||
--import System.Random
|
||||
@@ -170,15 +171,16 @@ intersectBeamBeams :: Beam -> [Beam]
|
||||
intersectBeamBeams bm bms = f [] $ _bmPoints bm
|
||||
where
|
||||
f ps (x:y:ys) = case intersectSegBeams x y bms of
|
||||
Just (z,a) -> ((z:x:ps), Just (z,(x,y,bm),a))
|
||||
Just (z,a) -> (z:x:ps, Just (z,(x,y,bm),a))
|
||||
Nothing -> f (x:ps) (y:ys)
|
||||
f ps (x:[]) = (x:ps, Nothing)
|
||||
f ps [x] = (x:ps, Nothing)
|
||||
f _ _ = error "made an empty beam"
|
||||
|
||||
intersectSegBeams :: Point2 -> Point2 -> [Beam] -> Maybe (Point2,(Point2,Point2,Beam))
|
||||
intersectSegBeams sp ep (bm:bms) = case intersectSegBeam sp ep bm of
|
||||
Nothing -> intersectSegBeams sp ep bms
|
||||
Just a@(z,_) -> maybe (Just a) Just $ intersectSegBeams sp z bms
|
||||
--Just a@(z,_) -> maybe (Just a) Just $ intersectSegBeams sp z bms
|
||||
Just a@(z,_) -> intersectSegBeams sp z bms <|> Just a
|
||||
intersectSegBeams _ _ _ = Nothing
|
||||
|
||||
intersectSegBeam :: Point2 -> Point2 -> Beam -> Maybe (Point2,(Point2,Point2,Beam))
|
||||
@@ -188,7 +190,8 @@ intersectSegBeam sp ep bm = case intersectSegSegs' sp ep (_bmPoints bm) of
|
||||
|
||||
intersectSegSegs' :: Point2 -> Point2 -> [Point2] -> Maybe (Point2,Point2,Point2)
|
||||
intersectSegSegs' sp ep (x:y:ys) = case intersectSegSeg sp ep x y of
|
||||
Just z -> maybe (Just (z,x,y)) Just $ intersectSegSegs' sp z (y:ys)
|
||||
--Just z -> maybe (Just (z,x,y)) Just $ intersectSegSegs' sp z (y:ys)
|
||||
Just z -> intersectSegSegs' sp z (y:ys) <|> Just (z,x,y)
|
||||
Nothing -> intersectSegSegs' sp ep (y:ys)
|
||||
intersectSegSegs' _ _ _ = Nothing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user