Add lasCircle
This commit is contained in:
@@ -32,7 +32,7 @@ itemCombinations =
|
|||||||
|
|
||||||
-- , po [cr PIPE, cr HARDWARE] (volleyGun 1)
|
-- , po [cr PIPE, cr HARDWARE] (volleyGun 1)
|
||||||
, po [BANGSTICK 1,cr PLANK] rifle
|
, po [BANGSTICK 1,cr PLANK] rifle
|
||||||
, p [p 3 $ BANGSTICK 1] (volleyGun 3)
|
, po [BANGSTICK 1,BANGSTICK 1,BANGSTICK 1] (volleyGun 3)
|
||||||
, po [RIFLE,cr TIN] repeater
|
, po [RIFLE,cr TIN] repeater
|
||||||
, po [REPEATER,cr SPRING] autoRifle
|
, po [REPEATER,cr SPRING] autoRifle
|
||||||
, po [REPEATER,cr CAN] burstRifle
|
, po [REPEATER,cr CAN] burstRifle
|
||||||
@@ -63,9 +63,10 @@ itemCombinations =
|
|||||||
-- , p [o LASGUN,o $ cr PRISM] lasSway
|
-- , p [o LASGUN,o $ cr PRISM] lasSway
|
||||||
-- , p [o LASGUN,o $ cr HARDWARE] lasSwing
|
-- , p [o LASGUN,o $ cr HARDWARE] lasSwing
|
||||||
-- , p [o LASGUN,o PIPE] lasGunPulse
|
-- , p [o LASGUN,o PIPE] lasGunPulse
|
||||||
, p [p 2 LASGUN,p 1 $ cr HARDWARE] dualBeam
|
, po [LASGUN,LASGUN,cr HARDWARE] dualBeam
|
||||||
-- , p [o LASGUN,o $ cr PIPE, o $ cr PRISM] lasWidePulse
|
-- , p [o LASGUN,o $ cr PIPE, o $ cr PRISM] lasWidePulse
|
||||||
, p [o LASGUN,o $ cr TRANSFORMER] (lasWide 2)
|
, po [LASGUN, cr TRANSFORMER] (lasWide 2)
|
||||||
|
, po [LASGUN,LASGUN,LASGUN,cr HARDWARE] lasCircle
|
||||||
|
|
||||||
, p [o $ cr TRANSFORMER,p 2 $ cr CAN] sparkGun
|
, p [o $ cr TRANSFORMER,p 2 $ cr CAN] sparkGun
|
||||||
, p [o SPARKGUN,p 2 $ cr PIPE] teslaGun
|
, p [o SPARKGUN,p 2 $ cr PIPE] teslaGun
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ data ItemBaseType
|
|||||||
| SPARKGUN
|
| SPARKGUN
|
||||||
| TESLAGUN
|
| TESLAGUN
|
||||||
| LASGUN
|
| LASGUN
|
||||||
|
| LASCIRCLE
|
||||||
| LASPULSE
|
| LASPULSE
|
||||||
| DUALBEAM
|
| DUALBEAM
|
||||||
| LASGUNSWING
|
| LASGUNSWING
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ useItem cr' w = fromMaybe (f w) $ do
|
|||||||
itemEffect :: Creature -> Item -> World -> World
|
itemEffect :: Creature -> Item -> World -> World
|
||||||
itemEffect cr it w = case it ^? itUse of
|
itemEffect cr it w = case it ^? itUse of
|
||||||
Just RightUse {_rUse = eff,_useMods = usemods}
|
Just RightUse {_rUse = eff,_useMods = usemods}
|
||||||
-> hammerTest $ tryClickReload cr it w $ foldr ($) eff usemods it cr
|
-> hammerTest $ tryReload cr it w $ foldr ($) eff usemods it cr
|
||||||
Just LeftUse {} -> doequipmentchange
|
Just LeftUse {} -> doequipmentchange
|
||||||
Just EquipUse{} -> doequipmentchange
|
Just EquipUse{} -> doequipmentchange
|
||||||
-- ConsumeUse will cause problems if the item is not selected
|
-- ConsumeUse will cause problems if the item is not selected
|
||||||
@@ -40,8 +40,8 @@ itemEffect cr it w = case it ^? itUse of
|
|||||||
doequipmentchange = setuhamdown $ hammerTest (toggleEquipmentAt (_rbOptions w) (crSel cr) cr
|
doequipmentchange = setuhamdown $ hammerTest (toggleEquipmentAt (_rbOptions w) (crSel cr) cr
|
||||||
. activateEquipmentAt (_rbOptions w) cr)
|
. activateEquipmentAt (_rbOptions w) cr)
|
||||||
|
|
||||||
tryClickReload :: Creature -> Item -> World -> (World -> World) -> World -> World
|
tryReload :: Creature -> Item -> World -> (World -> World) -> World -> World
|
||||||
tryClickReload cr it w f
|
tryReload cr it w f
|
||||||
| _crID cr == _yourID w && itNeedsLoading it && _mouseButtons w M.!? SDL.ButtonLeft == Just False
|
| _crID cr == _yourID w && itNeedsLoading it && _mouseButtons w M.!? SDL.ButtonLeft == Just False
|
||||||
= crToggleReloading cr
|
= crToggleReloading cr
|
||||||
| otherwise
|
| otherwise
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import Control.Lens
|
|||||||
import Text.Read (readMaybe)
|
import Text.Read (readMaybe)
|
||||||
import Data.List --(isPrefixOf, isInfixOf, intercalate)
|
import Data.List --(isPrefixOf, isInfixOf, intercalate)
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Control.Applicative
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
@@ -61,10 +62,15 @@ applyTerminalCommand s = case s of
|
|||||||
applyTerminalCommandArguments :: String -> [String] -> Universe -> Universe
|
applyTerminalCommandArguments :: String -> [String] -> Universe -> Universe
|
||||||
applyTerminalCommandArguments command args u = case command of
|
applyTerminalCommandArguments command args u = case command of
|
||||||
"ITEM" -> fromMaybe u $ do
|
"ITEM" -> fromMaybe u $ do
|
||||||
ibt <- safeHead args >>= readMaybe
|
ibt <- (safeHead args >>= readMaybe) <|> (safeTake2 args >>= (readMaybe . unwords))
|
||||||
return $ u & uvWorld %~ (snd . createPutItem (itemFromBase ibt))
|
n <- (args ^? ix 1 >>= readMaybe) <|> Just 1
|
||||||
|
return $ u & uvWorld %~ (flip (foldr ($)) $ replicate n (snd . createPutItem (itemFromBase ibt)))
|
||||||
_ -> u
|
_ -> u
|
||||||
|
|
||||||
|
safeTake2 :: [a] -> Maybe [a]
|
||||||
|
safeTake2 (x:y:_) = Just (x:y:[])
|
||||||
|
safeTake2 _ = Nothing
|
||||||
|
|
||||||
showTerminalError :: String -> String -> Universe -> Universe
|
showTerminalError :: String -> String -> Universe -> Universe
|
||||||
showTerminalError cmd s = menuLayers .:~ InputScreen (T.pack cmd) s
|
showTerminalError cmd s = menuLayers .:~ InputScreen (T.pack cmd) s
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ itemFromBase ibt = case ibt of
|
|||||||
SPARKGUN -> sparkGun
|
SPARKGUN -> sparkGun
|
||||||
TESLAGUN -> teslaGun
|
TESLAGUN -> teslaGun
|
||||||
LASGUN -> lasGun
|
LASGUN -> lasGun
|
||||||
|
LASCIRCLE -> lasCircle
|
||||||
LASPULSE -> lasPulse
|
LASPULSE -> lasPulse
|
||||||
DUALBEAM -> dualBeam
|
DUALBEAM -> dualBeam
|
||||||
LASGUNSWING -> lasSwing
|
LASGUNSWING -> lasSwing
|
||||||
@@ -200,6 +201,7 @@ baseToFamily ibt = case ibt of
|
|||||||
SPARKGUN -> HeldFamily
|
SPARKGUN -> HeldFamily
|
||||||
TESLAGUN -> HeldFamily
|
TESLAGUN -> HeldFamily
|
||||||
LASGUN -> HeldFamily
|
LASGUN -> HeldFamily
|
||||||
|
LASCIRCLE -> HeldFamily
|
||||||
LASPULSE -> HeldFamily
|
LASPULSE -> HeldFamily
|
||||||
DUALBEAM -> HeldFamily
|
DUALBEAM -> HeldFamily
|
||||||
LASGUNSWING -> HeldFamily
|
LASGUNSWING -> HeldFamily
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module Dodge.Item.Weapon.BatteryGuns
|
module Dodge.Item.Weapon.BatteryGuns
|
||||||
( lasGun
|
( lasGun
|
||||||
|
, lasCircle
|
||||||
, dualBeam
|
, dualBeam
|
||||||
, lasWide
|
, lasWide
|
||||||
-- , lasWidePulse
|
-- , lasWidePulse
|
||||||
@@ -122,14 +123,16 @@ lasPulse = lasGun
|
|||||||
& itParams . lasDamage .~ ceiling ((22 :: Float) * frac it)
|
& itParams . lasDamage .~ ceiling ((22 :: Float) * frac it)
|
||||||
& itParams . lasColor .~ frac it * orange
|
& itParams . lasColor .~ frac it * orange
|
||||||
frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1))
|
frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1))
|
||||||
|
|
||||||
lasWide :: Int -> Item
|
lasCircle :: Item
|
||||||
lasWide n = lasGun
|
lasCircle = lasGun
|
||||||
& itType . iyBase .~ LASWIDE n
|
& itType . iyBase .~ LASCIRCLE
|
||||||
& itParams . lasColor .~ orange
|
& itParams . lasColor .~ orange
|
||||||
& itParams . lasDamage .~ 2
|
& itParams . lasDamage .~ 2
|
||||||
|
& itConsumption . laMax .~ 10000
|
||||||
& itUse . rUse .~ shootLaser
|
& itUse . rUse .~ shootLaser
|
||||||
& itUse . useDelay .~ NoDelay
|
& itUse . useDelay .~ NoDelay
|
||||||
|
& itUse . rUse .~ circleLaser
|
||||||
& itUse . useMods .~
|
& itUse . useMods .~
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||||
@@ -137,11 +140,31 @@ lasWide n = lasGun
|
|||||||
, withSoundForI tone440sawtoothquietS 2
|
, withSoundForI tone440sawtoothquietS 2
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withItemUpdate' increasecycle
|
, withItemUpdate' increasecycle
|
||||||
, withItem $ \it -> duplicateOffsetsV2 (xs it)
|
, duplicateItem f
|
||||||
]
|
]
|
||||||
& itUse . useAim . aimWeight .~ 6
|
& itUse . useAim . aimWeight .~ 6
|
||||||
& itUse . useAim . aimRange .~ 1
|
& itUse . useAim . aimRange .~ 1
|
||||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
& 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
|
where
|
||||||
increasecycle it = case _useHammer (_itUse it) of
|
increasecycle it = case _useHammer (_itUse it) of
|
||||||
HammerUp -> it & itParams . lasCycle .~ 1
|
HammerUp -> it & itParams . lasCycle .~ 1
|
||||||
@@ -265,27 +288,27 @@ lasSwing = lasGun
|
|||||||
x' = _lasCycle $ _itParams it
|
x' = _lasCycle $ _itParams it
|
||||||
lasGun :: Item
|
lasGun :: Item
|
||||||
lasGun = defaultAutoBatteryGun
|
lasGun = defaultAutoBatteryGun
|
||||||
{ _itConsumption = defaultLoadable
|
& itConsumption .~ ( defaultLoadable
|
||||||
& laMax .~ 200
|
& laMax .~ 200
|
||||||
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
|
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
|
||||||
, _itParams = Refracting
|
)
|
||||||
|
& itParams .~ Refracting
|
||||||
{ _phaseV = 1
|
{ _phaseV = 1
|
||||||
, _lasColor = yellow
|
, _lasColor = yellow
|
||||||
, _lasColor2 = yellow
|
, _lasColor2 = yellow
|
||||||
, _lasCycle = 0
|
, _lasCycle = 0
|
||||||
, _lasDamage = 11
|
, _lasDamage = 11
|
||||||
}
|
}
|
||||||
, _itTweaks = Tweakable
|
& itTweaks .~ Tweakable
|
||||||
{ _tweakParams = IM.fromList [(0,lasGunTweak)]
|
{ _tweakParams = IM.fromList [(0,lasGunTweak)]
|
||||||
, _tweakSel = 0
|
, _tweakSel = 0
|
||||||
}
|
}
|
||||||
, _itDimension = ItemDimension
|
& itDimension .~ ItemDimension
|
||||||
{ _dimRad = 10
|
{ _dimRad = 10
|
||||||
, _dimCenter = V3 15 0 0
|
, _dimCenter = V3 15 0 0
|
||||||
, _dimPortage = HeldItem 5 30
|
, _dimPortage = HeldItem 5 30
|
||||||
, _dimSPic = lasGunPic
|
, _dimSPic = lasGunPic
|
||||||
}
|
}
|
||||||
}
|
|
||||||
& itUse . rUse .~ shootLaser
|
& itUse . rUse .~ shootLaser
|
||||||
& itUse . useDelay .~ NoDelay
|
& itUse . useDelay .~ NoDelay
|
||||||
& itUse . useMods .~
|
& itUse . useMods .~
|
||||||
@@ -294,6 +317,7 @@ lasGun = defaultAutoBatteryGun
|
|||||||
, withSoundForI tone440sawtoothquietS 2
|
, withSoundForI tone440sawtoothquietS 2
|
||||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
|
, crAtMuzPos
|
||||||
]
|
]
|
||||||
& itUse . useAim . aimWeight .~ 6
|
& itUse . useAim . aimWeight .~ 6
|
||||||
& itUse . useAim . aimRange .~ 1
|
& itUse . useAim . aimRange .~ 1
|
||||||
@@ -413,11 +437,26 @@ shootTeslaArc it cr w = w'
|
|||||||
shootLaser :: Item -> Creature -> World -> World
|
shootLaser :: Item -> Creature -> World -> World
|
||||||
shootLaser it cr = instantParticles .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
|
shootLaser it cr = instantParticles .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
|
||||||
where
|
where
|
||||||
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
--pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||||
|
pos = _crPos cr
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
phasev = _phaseV . _itParams $ _crInv cr IM.! crSel cr
|
phasev = _phaseV . _itParams $ _crInv cr IM.! crSel cr
|
||||||
dam = _lasDamage $ _itParams it
|
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 :: Item -> Creature -> World -> World
|
||||||
shootDualLaser it cr w = w'
|
shootDualLaser it cr w = w'
|
||||||
& newBeams . positronBeams .:~ dualRayAt (_lasBeam $ _itParams it) itid w (_lasColor $ _itParams it) dam phasev posl dirl
|
& 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
|
, withMuzFlareI
|
||||||
, withMuzPos
|
, withMuzPos
|
||||||
, withMuzPosShift
|
, withMuzPosShift
|
||||||
|
, crAtMuzPos
|
||||||
, withOldDir
|
, withOldDir
|
||||||
, trigDoAlso
|
, trigDoAlso
|
||||||
, withTempLight
|
, withTempLight
|
||||||
@@ -46,10 +47,12 @@ module Dodge.Item.Weapon.TriggerType
|
|||||||
, spreadLoaded
|
, spreadLoaded
|
||||||
, repeatOnFrames
|
, repeatOnFrames
|
||||||
, sideEffectOnFrame
|
, sideEffectOnFrame
|
||||||
|
, duplicateItem
|
||||||
, duplicateLoadedBarrels
|
, duplicateLoadedBarrels
|
||||||
, duplicateLoaded
|
, duplicateLoaded
|
||||||
, duplicateOffsets
|
, duplicateOffsets
|
||||||
, duplicateOffsetsV2
|
, duplicateOffsetsV2
|
||||||
|
, duplicateOffsetsV2Dir
|
||||||
, duplicateOffsetsFocus
|
, duplicateOffsetsFocus
|
||||||
, hammerCheckI
|
, hammerCheckI
|
||||||
, hammerCheckL
|
, hammerCheckL
|
||||||
@@ -403,10 +406,13 @@ withMuzPosShift p g f it cr w = g (pos `v2z` 20)
|
|||||||
$ f it cr w
|
$ f it cr w
|
||||||
where
|
where
|
||||||
pos = _crPos cr
|
pos = _crPos cr
|
||||||
+.+ rotateV dir p
|
+.+ rotateV dir p
|
||||||
+.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
+.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||||
dir = _crDir cr
|
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,
|
{- | Applies the effect to a randomly rotated creature,
|
||||||
- rotation amount given by inaccuracy in itParams -}
|
- rotation amount given by inaccuracy in itParams -}
|
||||||
applyInaccuracy :: ChainEffect
|
applyInaccuracy :: ChainEffect
|
||||||
@@ -587,6 +593,11 @@ duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
|||||||
-.- (_crPos cr +.+ pos))
|
-.- (_crPos cr +.+ pos))
|
||||||
| otherwise = argV (mouseWorldPos w -.- (_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 :: [Point2] -> ChainEffect
|
||||||
duplicateOffsetsV2 xs eff item cr w = foldr f w poss
|
duplicateOffsetsV2 xs eff item cr w = foldr f w poss
|
||||||
where
|
where
|
||||||
@@ -599,3 +610,12 @@ duplicateOffsets xs eff item cr w = foldr f w poss
|
|||||||
poss :: [V2 Float]
|
poss :: [V2 Float]
|
||||||
poss = map (rotateV (_crDir cr) . V2 0 ) xs
|
poss = map (rotateV (_crDir cr) . V2 0 ) xs
|
||||||
f pos = eff item (cr & crPos +.+.~ pos)
|
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
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ module Geometry.Zone
|
|||||||
, xIntercepts
|
, xIntercepts
|
||||||
, yIntercepts
|
, yIntercepts
|
||||||
, divTo
|
, divTo
|
||||||
|
, modTo
|
||||||
, zoneOfPoint
|
, zoneOfPoint
|
||||||
, zoneOfSeg
|
, zoneOfSeg
|
||||||
, zoneInsideCirc
|
, zoneInsideCirc
|
||||||
|
|||||||
Reference in New Issue
Block a user