Add lasCircle
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
module Dodge.Item.Weapon.BatteryGuns
|
||||
( lasGun
|
||||
, lasCircle
|
||||
, dualBeam
|
||||
, lasWide
|
||||
-- , lasWidePulse
|
||||
@@ -122,14 +123,16 @@ lasPulse = lasGun
|
||||
& itParams . lasDamage .~ ceiling ((22 :: Float) * frac it)
|
||||
& itParams . lasColor .~ frac it * orange
|
||||
frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1))
|
||||
|
||||
lasWide :: Int -> Item
|
||||
lasWide n = lasGun
|
||||
& itType . iyBase .~ LASWIDE n
|
||||
|
||||
lasCircle :: Item
|
||||
lasCircle = lasGun
|
||||
& itType . iyBase .~ LASCIRCLE
|
||||
& itParams . lasColor .~ orange
|
||||
& itParams . lasDamage .~ 2
|
||||
& itConsumption . laMax .~ 10000
|
||||
& itUse . rUse .~ shootLaser
|
||||
& itUse . useDelay .~ NoDelay
|
||||
& itUse . rUse .~ circleLaser
|
||||
& itUse . useMods .~
|
||||
[ ammoCheckI
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
@@ -137,11 +140,31 @@ lasWide n = lasGun
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, useAmmoAmount 1
|
||||
, withItemUpdate' increasecycle
|
||||
, withItem $ \it -> duplicateOffsetsV2 (xs it)
|
||||
, duplicateItem f
|
||||
]
|
||||
& itUse . useAim . aimWeight .~ 6
|
||||
& itUse . useAim . aimRange .~ 1
|
||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||
where
|
||||
increasecycle it = it & itParams . lasCycle %~ (flip mod 2000 . (+ 1))
|
||||
--f it = [it & itParams . lasCycle +~ x | x <- [0,100 .. 1900] ]
|
||||
f it = [it & itParams . lasCycle +~ x | x <- [0,50 .. 1999] ]
|
||||
|
||||
lasWide :: Int -> Item
|
||||
lasWide n = lasGun
|
||||
& itType . iyBase .~ LASWIDE n
|
||||
& itParams . lasColor .~ yellow
|
||||
& itParams . lasDamage .~ 2
|
||||
& itUse . useMods .~
|
||||
[ ammoCheckI
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, useAmmoAmount 1
|
||||
, crAtMuzPos
|
||||
, withItemUpdate' increasecycle
|
||||
, withItem $ \it -> duplicateOffsetsV2 (xs it)
|
||||
]
|
||||
where
|
||||
increasecycle it = case _useHammer (_itUse it) of
|
||||
HammerUp -> it & itParams . lasCycle .~ 1
|
||||
@@ -265,27 +288,27 @@ lasSwing = lasGun
|
||||
x' = _lasCycle $ _itParams it
|
||||
lasGun :: Item
|
||||
lasGun = defaultAutoBatteryGun
|
||||
{ _itConsumption = defaultLoadable
|
||||
& itConsumption .~ ( defaultLoadable
|
||||
& laMax .~ 200
|
||||
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
|
||||
, _itParams = Refracting
|
||||
)
|
||||
& itParams .~ Refracting
|
||||
{ _phaseV = 1
|
||||
, _lasColor = yellow
|
||||
, _lasColor2 = yellow
|
||||
, _lasCycle = 0
|
||||
, _lasDamage = 11
|
||||
}
|
||||
, _itTweaks = Tweakable
|
||||
& itTweaks .~ Tweakable
|
||||
{ _tweakParams = IM.fromList [(0,lasGunTweak)]
|
||||
, _tweakSel = 0
|
||||
}
|
||||
, _itDimension = ItemDimension
|
||||
& itDimension .~ ItemDimension
|
||||
{ _dimRad = 10
|
||||
, _dimCenter = V3 15 0 0
|
||||
, _dimPortage = HeldItem 5 30
|
||||
, _dimSPic = lasGunPic
|
||||
}
|
||||
}
|
||||
& itUse . rUse .~ shootLaser
|
||||
& itUse . useDelay .~ NoDelay
|
||||
& itUse . useMods .~
|
||||
@@ -294,6 +317,7 @@ lasGun = defaultAutoBatteryGun
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, useAmmoAmount 1
|
||||
, crAtMuzPos
|
||||
]
|
||||
& itUse . useAim . aimWeight .~ 6
|
||||
& itUse . useAim . aimRange .~ 1
|
||||
@@ -413,11 +437,26 @@ shootTeslaArc it cr w = w'
|
||||
shootLaser :: Item -> Creature -> World -> World
|
||||
shootLaser it cr = instantParticles .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
|
||||
where
|
||||
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
--pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
pos = _crPos cr
|
||||
dir = _crDir cr
|
||||
phasev = _phaseV . _itParams $ _crInv cr IM.! crSel cr
|
||||
dam = _lasDamage $ _itParams it
|
||||
|
||||
-- this has the feel of a left click item
|
||||
circleLaser :: Item -> Creature -> World -> World
|
||||
circleLaser it cr w
|
||||
| hasLOSIndirect cpos pos w = w
|
||||
& instantParticles .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
|
||||
| otherwise = w
|
||||
where
|
||||
cpos = _crPos cr
|
||||
mwp = mouseWorldPos w
|
||||
pos = _crPos cr +.+ rotateV dir (V2 0 (max 70 $ dist cpos mwp))
|
||||
dir = fromIntegral (_lasCycle (_itParams it)) * pi / 1000
|
||||
phasev = _phaseV . _itParams $ _crInv cr IM.! crSel cr
|
||||
dam = _lasDamage $ _itParams it
|
||||
|
||||
shootDualLaser :: Item -> Creature -> World -> World
|
||||
shootDualLaser it cr w = w'
|
||||
& newBeams . positronBeams .:~ dualRayAt (_lasBeam $ _itParams it) itid w (_lasColor $ _itParams it) dam phasev posl dirl
|
||||
|
||||
@@ -9,6 +9,7 @@ module Dodge.Item.Weapon.TriggerType
|
||||
, withMuzFlareI
|
||||
, withMuzPos
|
||||
, withMuzPosShift
|
||||
, crAtMuzPos
|
||||
, withOldDir
|
||||
, trigDoAlso
|
||||
, withTempLight
|
||||
@@ -46,10 +47,12 @@ module Dodge.Item.Weapon.TriggerType
|
||||
, spreadLoaded
|
||||
, repeatOnFrames
|
||||
, sideEffectOnFrame
|
||||
, duplicateItem
|
||||
, duplicateLoadedBarrels
|
||||
, duplicateLoaded
|
||||
, duplicateOffsets
|
||||
, duplicateOffsetsV2
|
||||
, duplicateOffsetsV2Dir
|
||||
, duplicateOffsetsFocus
|
||||
, hammerCheckI
|
||||
, hammerCheckL
|
||||
@@ -403,10 +406,13 @@ withMuzPosShift p g f it cr w = g (pos `v2z` 20)
|
||||
$ f it cr w
|
||||
where
|
||||
pos = _crPos cr
|
||||
+.+ rotateV dir p
|
||||
+.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
+.+ rotateV dir p
|
||||
+.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
dir = _crDir cr
|
||||
|
||||
crAtMuzPos :: ChainEffect
|
||||
crAtMuzPos f it cr = f it (cr & crPos +.+.~ (aimingMuzzlePos cr it *.* unitVectorAtAngle (_crDir cr)))
|
||||
|
||||
{- | Applies the effect to a randomly rotated creature,
|
||||
- rotation amount given by inaccuracy in itParams -}
|
||||
applyInaccuracy :: ChainEffect
|
||||
@@ -587,6 +593,11 @@ duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
||||
-.- (_crPos cr +.+ pos))
|
||||
| otherwise = argV (mouseWorldPos w -.- (_crPos cr +.+ pos))
|
||||
|
||||
duplicateItem :: (Item -> [Item]) -> ChainEffect
|
||||
duplicateItem fit eff itm cr w = foldr f w (fit itm)
|
||||
where
|
||||
f itm' = eff itm' cr
|
||||
|
||||
duplicateOffsetsV2 :: [Point2] -> ChainEffect
|
||||
duplicateOffsetsV2 xs eff item cr w = foldr f w poss
|
||||
where
|
||||
@@ -599,3 +610,12 @@ duplicateOffsets xs eff item cr w = foldr f w poss
|
||||
poss :: [V2 Float]
|
||||
poss = map (rotateV (_crDir cr) . V2 0 ) xs
|
||||
f pos = eff item (cr & crPos +.+.~ pos)
|
||||
|
||||
duplicateOffsetsV2Dir :: [(Point2,Float)] -> ChainEffect
|
||||
duplicateOffsetsV2Dir xs eff item cr w = foldr f w
|
||||
-- $ xs
|
||||
$ map (over _1 (rotateV (_crDir cr))) xs
|
||||
where
|
||||
f (pos,dir) = eff item $ cr
|
||||
& crPos +.+.~ pos
|
||||
& crDir +~ dir
|
||||
|
||||
Reference in New Issue
Block a user