Fix volleyGun
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
|
|
||||||
module Dodge.BaseTriggerType (
|
module Dodge.BaseTriggerType (
|
||||||
baseTriggerType,
|
itemTriggerType,
|
||||||
module Dodge.Data.TriggerType,
|
module Dodge.Data.TriggerType,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@@ -9,8 +9,8 @@ import Control.Lens
|
|||||||
import Dodge.Data.Item
|
import Dodge.Data.Item
|
||||||
import Dodge.Data.TriggerType
|
import Dodge.Data.TriggerType
|
||||||
|
|
||||||
baseTriggerType :: Item -> TriggerType
|
itemTriggerType :: Item -> TriggerType
|
||||||
baseTriggerType itm = case itm ^. itType of
|
itemTriggerType itm = case itm ^. itType of
|
||||||
HELD hit -> heldTriggerType hit
|
HELD hit -> heldTriggerType hit
|
||||||
_ -> NoTrigger
|
_ -> NoTrigger
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ heldTriggerType = \case
|
|||||||
BLUNDERBUSS -> HammerTrigger
|
BLUNDERBUSS -> HammerTrigger
|
||||||
GRAPECANNON{} -> HammerTrigger
|
GRAPECANNON{} -> HammerTrigger
|
||||||
MINIGUNX{} -> AutoTrigger
|
MINIGUNX{} -> AutoTrigger
|
||||||
VOLLEYGUN i -> BurstTrigger [1 .. i-1]
|
VOLLEYGUN i -> BurstTrigger $ fmap (3*) [1 .. i-1]
|
||||||
RIFLE -> HammerTrigger
|
RIFLE -> HammerTrigger
|
||||||
ALTERIFLE -> HammerTrigger
|
ALTERIFLE -> HammerTrigger
|
||||||
AUTORIFLE -> AutoTrigger
|
AUTORIFLE -> AutoTrigger
|
||||||
|
|||||||
+34
-23
@@ -81,14 +81,11 @@ hammerCheck ::
|
|||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
hammerCheck f pt it cr
|
hammerCheck f pt it cr
|
||||||
| BurstTrigger is <- baseTriggerType (it ^. ldtValue)
|
| BurstTrigger is <- itemTriggerType (it ^. ldtValue)
|
||||||
, pt == InitialPress =
|
, pt == InitialPress =
|
||||||
f it cr
|
f it cr . (cWorld . lWorld . delayedEvents .++~ map g is)
|
||||||
. (cWorld . lWorld . delayedEvents .++~ map g is)
|
| BurstTrigger{} <- itemTriggerType (it ^. ldtValue) = id
|
||||||
| BurstTrigger{} <- baseTriggerType (it ^. ldtValue)
|
| t <- itemTriggerType (it ^. ldtValue)
|
||||||
, pt /= InitialPress =
|
|
||||||
id
|
|
||||||
| t <- baseTriggerType (it ^. ldtValue)
|
|
||||||
, t == HammerTrigger || t == AlwaysSingleTrigger
|
, t == HammerTrigger || t == AlwaysSingleTrigger
|
||||||
, isNothing $ lookup MakeAutoLink (it ^. ldtRight)
|
, isNothing $ lookup MakeAutoLink (it ^. ldtRight)
|
||||||
, pt /= InitialPress =
|
, pt /= InitialPress =
|
||||||
@@ -97,8 +94,9 @@ hammerCheck f pt it cr
|
|||||||
where
|
where
|
||||||
g x = (x, WdWdBurstFireRepetition (_crID cr) (it ^?! ldtValue . itLocation . ilInvID))
|
g x = (x, WdWdBurstFireRepetition (_crID cr) (it ^?! ldtValue . itLocation . ilInvID))
|
||||||
|
|
||||||
-- | Applies a world effect after an item use cooldown check.
|
{- | Applies a world effect after an item use cooldown check.
|
||||||
-- input buffering?
|
input buffering?
|
||||||
|
-}
|
||||||
useTimeCheck :: ChainEffect
|
useTimeCheck :: ChainEffect
|
||||||
useTimeCheck f item cr w = case useDelay $ item ^. ldtValue of
|
useTimeCheck f item cr w = case useDelay $ item ^. ldtValue of
|
||||||
FixedRate rate
|
FixedRate rate
|
||||||
@@ -117,7 +115,8 @@ useTimeCheck f item cr w = case useDelay $ item ^. ldtValue of
|
|||||||
& soundContinue (CrWeaponSound cid 0) (_crPos cr) (warmupSound $ item ^. ldtValue . itType) (Just 2)
|
& soundContinue (CrWeaponSound cid 0) (_crPos cr) (warmupSound $ item ^. ldtValue . itType) (Just 2)
|
||||||
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itParams . wTime +~ 1
|
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itParams . wTime +~ 1
|
||||||
WarmUpCoolDown _ cs _
|
WarmUpCoolDown _ cs _
|
||||||
| _wTime (_itParams $ _ldtValue item) < cs -> f item cr w & setwarming
|
| _wTime (_itParams $ _ldtValue item) < cs ->
|
||||||
|
f item cr w & setwarming
|
||||||
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itParams . wTime +~ 1
|
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itParams . wTime +~ 1
|
||||||
WarmUpCoolDown{} -> w & setwarming
|
WarmUpCoolDown{} -> w & setwarming
|
||||||
NoDelay -> f item cr w
|
NoDelay -> f item cr w
|
||||||
@@ -144,12 +143,15 @@ heldEffectMuzzles t cr w =
|
|||||||
.~ w ^. cWorld . lWorld . lClock
|
.~ w ^. cWorld . lWorld . lClock
|
||||||
itid = t ^?! ldtValue . itLocation . ilInvID
|
itid = t ^?! ldtValue . itLocation . ilInvID
|
||||||
|
|
||||||
|
|
||||||
itemMuzzles :: Item -> [Muzzle]
|
itemMuzzles :: Item -> [Muzzle]
|
||||||
itemMuzzles itm = case itm ^. itType of
|
itemMuzzles itm = case itm ^. itType of
|
||||||
HELD ALTERIFLE ->
|
HELD ALTERIFLE ->
|
||||||
dbwMuzzles & ix 0 . mzPos .~ V2 25 0
|
dbwMuzzles & ix 0 . mzPos .~ V2 25 0
|
||||||
& ix 0 . mzAmmoSlot .~ _alteRifleSwitch (_itParams itm)
|
& ix 0 . mzAmmoSlot .~ _alteRifleSwitch (_itParams itm)
|
||||||
|
HELD (VOLLEYGUN i) -> fromMaybe [] $ do
|
||||||
|
j <- itm ^? itParams . unfiredBarrels . ix 0
|
||||||
|
x <- vgunMuzzles i ^? ix j
|
||||||
|
return [x]
|
||||||
HELD hit -> heldItemMuzzles hit
|
HELD hit -> heldItemMuzzles hit
|
||||||
DETECTOR{} ->
|
DETECTOR{} ->
|
||||||
dbwMuzzles & ix 0 . mzEffect .~ MuzzleDetector
|
dbwMuzzles & ix 0 . mzEffect .~ MuzzleDetector
|
||||||
@@ -167,8 +169,8 @@ heldItemMuzzles = \case
|
|||||||
NoFlare
|
NoFlare
|
||||||
MuzzleShootBullet
|
MuzzleShootBullet
|
||||||
(UseExactly 1)
|
(UseExactly 1)
|
||||||
-- 0
|
| -- 0
|
||||||
| a <- spreadAroundCenter i baseStickSpread
|
a <- spreadAroundCenter i baseStickSpread
|
||||||
]
|
]
|
||||||
& ix 0 . mzFlareType .~ NoLightFlare
|
& ix 0 . mzFlareType .~ NoLightFlare
|
||||||
& ix (i `div` 2) . mzFlareType .~ BasicFlare
|
& ix (i `div` 2) . mzFlareType .~ BasicFlare
|
||||||
@@ -212,7 +214,7 @@ heldItemMuzzles = \case
|
|||||||
BLUNDERBUSS -> [Muzzle (V2 30 0) 0 0.5 0 BasicFlare MuzzleShootBullet (UseUpTo 15)]
|
BLUNDERBUSS -> [Muzzle (V2 30 0) 0 0.5 0 BasicFlare MuzzleShootBullet (UseUpTo 15)]
|
||||||
GRAPECANNON _ -> [Muzzle (V2 30 0) 0 0.5 0 BasicFlare MuzzleShootBullet (UseUpTo 15)]
|
GRAPECANNON _ -> [Muzzle (V2 30 0) 0 0.5 0 BasicFlare MuzzleShootBullet (UseUpTo 15)]
|
||||||
TORCH -> dbwMuzzles & ix 0 . mzPos .~ V2 10 0
|
TORCH -> dbwMuzzles & ix 0 . mzPos .~ V2 10 0
|
||||||
VOLLEYGUN i -> vgunMuzzles i
|
VOLLEYGUN {} -> error "should get volleygun muzzles earlier"
|
||||||
FLAMETHROWER -> flameMuzzles
|
FLAMETHROWER -> flameMuzzles
|
||||||
FLAMESPITTER -> flameMuzzles & ix 0 . mzEffect . nzPressure .~ UniRandFloat 3 4
|
FLAMESPITTER -> flameMuzzles & ix 0 . mzEffect . nzPressure .~ UniRandFloat 3 4
|
||||||
RLAUNCHER ->
|
RLAUNCHER ->
|
||||||
@@ -324,13 +326,20 @@ vgunMuzzles i =
|
|||||||
|
|
||||||
doHeldUseEffect :: LabelDoubleTree CLinkType Item -> Creature -> World -> World
|
doHeldUseEffect :: LabelDoubleTree CLinkType Item -> Creature -> World -> World
|
||||||
doHeldUseEffect t cr w = case t ^. ldtValue . itType of
|
doHeldUseEffect t cr w = case t ^. ldtValue . itType of
|
||||||
-- HELD (VOLLEYGUN x) -> fromMaybe w $ do
|
HELD (VOLLEYGUN j) -> case itm ^? itParams . unfiredBarrels of
|
||||||
-- i <- t ^? ldtValue . itLocation . ilInvID
|
Just [_] -> fromMaybe w $ do
|
||||||
-- let g = w ^. randGen
|
let (is, g) = runState (shuffle [0 .. j -1]) $ w ^. randGen
|
||||||
-- (is, g') = runState (shuffle [0 .. x -1]) g
|
i <- itm ^? itLocation . ilInvID
|
||||||
-- return $
|
return $ w
|
||||||
-- w & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix i . itUse . heldMuzzles %~ zipWith (\j mz -> mz & mzFrame .~ j) is
|
& randGen .~ g
|
||||||
-- & randGen .~ g'
|
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix i
|
||||||
|
. itParams . unfiredBarrels %~ const is
|
||||||
|
Just (_:_:_) -> fromMaybe w $ do
|
||||||
|
i <- itm ^? itLocation . ilInvID
|
||||||
|
return $ w
|
||||||
|
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix i
|
||||||
|
. itParams . unfiredBarrels %~ tail
|
||||||
|
_ -> w
|
||||||
HELD ALTERIFLE -> fromMaybe w $ do
|
HELD ALTERIFLE -> fromMaybe w $ do
|
||||||
i <- t ^? ldtValue . itLocation . ilInvID
|
i <- t ^? ldtValue . itLocation . ilInvID
|
||||||
return $
|
return $
|
||||||
@@ -344,6 +353,8 @@ doHeldUseEffect t cr w = case t ^. ldtValue . itType of
|
|||||||
-- . mzAmmoSlot
|
-- . mzAmmoSlot
|
||||||
%~ ((`mod` 2) . (+ 1))
|
%~ ((`mod` 2) . (+ 1))
|
||||||
_ -> w
|
_ -> w
|
||||||
|
where
|
||||||
|
itm = t ^. ldtValue
|
||||||
|
|
||||||
--doHeldUseEffect t cr w = case t ^? ldtValue . itUse . heldUseEffect of
|
--doHeldUseEffect t cr w = case t ^? ldtValue . itUse . heldUseEffect of
|
||||||
-- Just (RandomiseMuzzleFrames x) -> fromMaybe w $ do
|
-- Just (RandomiseMuzzleFrames x) -> fromMaybe w $ do
|
||||||
@@ -388,8 +399,8 @@ applyCME itm cr cme
|
|||||||
. applyRecoil itm cr
|
. applyRecoil itm cr
|
||||||
| otherwise = case itm ^. itType of
|
| otherwise = case itm ^. itType of
|
||||||
HELD MACHINEPISTOL ->
|
HELD MACHINEPISTOL ->
|
||||||
cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itid . itParams .~
|
cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itid . itParams
|
||||||
WarmTime (coolstart - 1) True Nothing
|
.~ WarmTime (coolstart - 1) True Nothing
|
||||||
-- the above is quite hacky for now
|
-- the above is quite hacky for now
|
||||||
_ -> failsound
|
_ -> failsound
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -6,18 +6,18 @@ module Dodge.Item.BackgroundEffect (
|
|||||||
removeShieldWall,
|
removeShieldWall,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Dodge.Creature.Radius
|
|
||||||
import Color
|
import Color
|
||||||
import Dodge.Default.Wall
|
|
||||||
import Dodge.Wall.Delete
|
|
||||||
import Dodge.Item.HeldOffset
|
|
||||||
import Dodge.Creature.Test
|
|
||||||
import Geometry.Vector
|
|
||||||
import Dodge.Wall.Move
|
|
||||||
import Dodge.Wall.Create
|
|
||||||
import Dodge.Item.Location
|
|
||||||
import Dodge.Data.World
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
import Dodge.Creature.Radius
|
||||||
|
import Dodge.Creature.Test
|
||||||
|
import Dodge.Data.World
|
||||||
|
import Dodge.Default.Wall
|
||||||
|
import Dodge.Item.HeldOffset
|
||||||
|
import Dodge.Item.Location
|
||||||
|
import Dodge.Wall.Create
|
||||||
|
import Dodge.Wall.Delete
|
||||||
|
import Dodge.Wall.Move
|
||||||
|
import Geometry.Vector
|
||||||
|
|
||||||
cancelExamineInventory :: World -> World
|
cancelExamineInventory :: World -> World
|
||||||
cancelExamineInventory = hud . hudElement . subInventory %~ f
|
cancelExamineInventory = hud . hudElement . subInventory %~ f
|
||||||
@@ -39,7 +39,7 @@ rootNotrootEff f g it
|
|||||||
createShieldWall :: Item -> Creature -> World -> World
|
createShieldWall :: Item -> Creature -> World -> World
|
||||||
createShieldWall it cr w = case it ^? itParams . flatShieldWlMIX . _Just of
|
createShieldWall it cr w = case it ^? itParams . flatShieldWlMIX . _Just of
|
||||||
Nothing ->
|
Nothing ->
|
||||||
let (wlid, w') = createWall ((shieldWall' crid){_wlLine = wlline, _wlID = wlid}) w
|
let (wlid, w') = createWall ((shieldWall crid){_wlLine = wlline, _wlID = wlid}) w
|
||||||
in w' & pointerToItem it . itParams .~ FlatShieldParams (Just wlid)
|
in w' & pointerToItem it . itParams .~ FlatShieldParams (Just wlid)
|
||||||
Just wid -> moveWallID wid wlline w
|
Just wid -> moveWallID wid wlline w
|
||||||
where
|
where
|
||||||
@@ -67,14 +67,15 @@ itEffectOnPickup _ _ = id
|
|||||||
itEffectOnDrop :: Item -> Creature -> World -> World
|
itEffectOnDrop :: Item -> Creature -> World -> World
|
||||||
itEffectOnDrop itm cr w = case itm ^. itType of
|
itEffectOnDrop itm cr w = case itm ^. itType of
|
||||||
HELD MINIGUNX{} -> w & pointerToItemID (_itID itm) . itParams . wTime .~ 0
|
HELD MINIGUNX{} -> w & pointerToItemID (_itID itm) . itParams . wTime .~ 0
|
||||||
HELD MACHINEPISTOL{} -> w & pointerToItemID (_itID itm) . itParams
|
HELD MACHINEPISTOL{} ->
|
||||||
|
w & pointerToItemID (_itID itm) . itParams
|
||||||
.~ WarmTime 0 False Nothing
|
.~ WarmTime 0 False Nothing
|
||||||
ITEMSCAN -> cancelExamineInventory w
|
ITEMSCAN -> cancelExamineInventory w
|
||||||
HELD FLATSHIELD -> removeShieldWall itm cr w
|
HELD FLATSHIELD -> removeShieldWall itm cr w
|
||||||
_ -> w
|
_ -> w
|
||||||
|
|
||||||
shieldWall' :: Int -> Wall
|
shieldWall :: Int -> Wall
|
||||||
shieldWall' crid =
|
shieldWall crid =
|
||||||
defaultWall
|
defaultWall
|
||||||
{ _wlColor = yellow
|
{ _wlColor = yellow
|
||||||
, _wlOpacity = SeeAbove
|
, _wlOpacity = SeeAbove
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
|||||||
_ -> ([], [])
|
_ -> ([], [])
|
||||||
|
|
||||||
getAutoSpringLinks :: Item -> [(ItemStructuralFunction, CLinkType)]
|
getAutoSpringLinks :: Item -> [(ItemStructuralFunction, CLinkType)]
|
||||||
getAutoSpringLinks itm = case baseTriggerType itm of
|
getAutoSpringLinks itm = case itemTriggerType itm of
|
||||||
HammerTrigger -> [(MakeAutoSF, MakeAutoLink)]
|
HammerTrigger -> [(MakeAutoSF, MakeAutoLink)]
|
||||||
_ -> []
|
_ -> []
|
||||||
|
|
||||||
|
|||||||
@@ -13,34 +13,19 @@ import Dodge.Default
|
|||||||
import LensHelp
|
import LensHelp
|
||||||
|
|
||||||
volleyGun :: Int -> Item
|
volleyGun :: Int -> Item
|
||||||
volleyGun i =
|
volleyGun i = defaultHeldItem & itType .~ HELD (VOLLEYGUN i)
|
||||||
defaultHeldItem
|
& itParams .~ VolleyUnfiredBarrels [0..i-1]
|
||||||
-- & itUse . heldMuzzles .~ getZipList
|
|
||||||
-- (ZipList [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 6]
|
|
||||||
-- <*> ZipList [0..i-1]
|
|
||||||
-- <*> pure MiniGunFlare
|
|
||||||
-- <*> pure MuzzleShootBullet
|
|
||||||
-- <*> pure (UseExactly 1)
|
|
||||||
-- <*> ZipList [0..i-1]
|
|
||||||
-- )
|
|
||||||
& itType .~ HELD (VOLLEYGUN i)
|
|
||||||
-- & itAmmoSlots .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
|
|
||||||
-- & itUse . heldUseEffect .~ RandomiseMuzzleFrames i
|
|
||||||
|
|
||||||
rifle :: Item
|
rifle :: Item
|
||||||
rifle = defaultHeldItem & itType .~ HELD RIFLE
|
rifle = defaultHeldItem & itType .~ HELD RIFLE
|
||||||
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 25 0
|
|
||||||
|
|
||||||
alteRifle :: Item
|
alteRifle :: Item
|
||||||
alteRifle = rifle
|
alteRifle = rifle
|
||||||
& itType .~ HELD ALTERIFLE
|
& itType .~ HELD ALTERIFLE
|
||||||
-- & itAmmoSlots .~ IM.fromList (zip [0..1] $ repeat BulletAmmo)
|
|
||||||
& itParams .~ AlteRifleSwitch 0
|
& itParams .~ AlteRifleSwitch 0
|
||||||
|
|
||||||
autoRifle :: Item
|
autoRifle :: Item
|
||||||
autoRifle =
|
autoRifle = rifle & itType .~ HELD AUTORIFLE
|
||||||
rifle
|
|
||||||
& itType .~ HELD AUTORIFLE
|
|
||||||
|
|
||||||
burstRifle :: Item
|
burstRifle :: Item
|
||||||
burstRifle = rifle & itType .~ HELD BURSTRIFLE
|
burstRifle = rifle & itType .~ HELD BURSTRIFLE
|
||||||
@@ -48,14 +33,5 @@ burstRifle = rifle & itType .~ HELD BURSTRIFLE
|
|||||||
miniGunX :: Int -> Item
|
miniGunX :: Int -> Item
|
||||||
miniGunX i =
|
miniGunX i =
|
||||||
autoRifle
|
autoRifle
|
||||||
-- & itUse . heldDelay .~ WarmUpNoDelay{
|
|
||||||
-- --_warmTime = 0,
|
|
||||||
-- _warmMax = 100, _warmSound = crankSlowS}
|
|
||||||
-- & itAmmoSlots .~ singleAmmo BeltBulletAmmo
|
|
||||||
-- & itUse . heldMuzzles
|
|
||||||
-- .~ replicate i
|
|
||||||
-- (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1) 0)
|
|
||||||
& itType .~ HELD (MINIGUNX i)
|
& itType .~ HELD (MINIGUNX i)
|
||||||
-- & itEffect . ieInv .~ ItemReduceWarmTime
|
|
||||||
-- & itEffect . ieOnDrop .~ ItemSetWarmTime 0
|
|
||||||
& itParams .~ WarmTime 0 False Nothing
|
& itParams .~ WarmTime 0 False Nothing
|
||||||
|
|||||||
Reference in New Issue
Block a user