Improve item use hammer, improve wide laser

This commit is contained in:
2022-07-07 10:58:18 +01:00
parent 3759434d92
commit 68cb191063
26 changed files with 328 additions and 301 deletions
+3 -3
View File
@@ -65,7 +65,7 @@ itemCombinations =
-- , p [o LASGUN,o PIPE] lasGunPulse
, p [p 2 LASGUN,p 1 $ cr HARDWARE] dualBeam
-- , p [o LASGUN,o $ cr PIPE, o $ cr PRISM] lasWidePulse
, p [o LASGUN,o $ cr TRANSFORMER] (lasGunWide 2)
, p [o LASGUN,o $ cr TRANSFORMER] (lasWide 2)
, p [o $ cr TRANSFORMER,p 2 $ cr CAN] sparkGun
, p [o SPARKGUN,p 2 $ cr PIPE] teslaGun
@@ -83,7 +83,7 @@ itemCombinations =
, p [p 2 $ cr PLATE] flatShield
]
++ map (\i -> po [LASGUNWIDE i,cr TRANSFORMER] $ lasGunWide (i+1)) [2..9]
++ map (\i -> po [LASWIDE i,cr TRANSFORMER] $ lasWide (i+1)) [2..9]
-- ++ map (\i -> po [LASGUNWIDE i,cr HARDWARE] $ lasFocus i) [2..10]
++ map (\i -> po [cr PIPE,BANGSTICK i] $ bangStick (i+1)) [1..8]
++ map (\i -> po [REVOLVERX i,cr CAN] $ revolverX (i+1)) [1..5]
@@ -182,7 +182,7 @@ batteryGuns =
-- , lasSway
, lasSwing
] ++
[ lasGunWide i | i <- [2..10]
[ lasWide i | i <- [2..10]
]
-- ++
-- [ lasFocus i | i <- [1..10]]
+2 -2
View File
@@ -112,8 +112,8 @@ data ItemBaseType
| DUALBEAM
| LASGUNSWING
-- | LASGUNSWAY
| LASGUNWIDEPULSE
| LASGUNWIDE {_xNum :: Int}
-- | LASGUNWIDEPULSE
| LASWIDE {_xNum :: Int}
-- | LASGUNFOCUS Int
| SONICGUN
| TRACTORGUN
+1 -1
View File
@@ -49,7 +49,7 @@ maxShowX bt = case bt of
MINIGUNX _ -> Just 3
GRAPECANNON _ -> Just 1
LAUNCHERX _ -> Just 2
LASGUNWIDE _ -> Just 2
LASWIDE _ -> Just 2
-- LASGUNFOCUS _ -> Just 2
_ -> Nothing
+1 -1
View File
@@ -230,7 +230,7 @@ inventoryX c = case c of
'J' -> [ lasGun
, lasGun
, dualBeam
, lasWidePulse
-- , lasWidePulse
, makeTypeCraftNum 10 TRANSFORMER
]
_ -> []
-1
View File
@@ -281,7 +281,6 @@ youDropItem' w = case yourItem w ^? _Just . itCurseStatus of
copyInvItemToFloor :: Creature -> Int -> World -> World
copyInvItemToFloor cr i = copyItemToFloor (_crPos cr)
$ _crInv cr IM.! i
& itPos .~ VoidItm
& itIsHeld .~ False
sizeSelf :: Float -> Creature -> World -> Maybe World
+8 -5
View File
@@ -44,8 +44,8 @@ tryClickReload :: Creature -> Item -> World -> (World -> World) -> World -> Worl
tryClickReload cr it w f
| _crID cr == _yourID w && itNeedsLoading it && _mouseButtons w M.!? SDL.ButtonLeft == Just False
= crToggleReloading cr
| otherwise =
(runIdentity . pointToItem (_itPos it) (return . (itUse . useHammer' .~ HammerDown)))
| otherwise
= (runIdentity . pointToItem (_itPos it) (return . (itUse . useHammer .~ HammerDown)))
. f
itNeedsLoading :: Item -> Bool
@@ -96,12 +96,15 @@ toggleEquipmentAt rbops invid cr w = case rbops ^? opAllocateEquipment of
useLeftItem :: Int -> World -> World
useLeftItem cid w
| _crInvLock cr = w
| itmShouldBeUsed = useItem cr w
| itmShouldBeUsed = useItem cr w -- I believe this ONLY sets equipment options
| otherwise = fromMaybe w $ do
invid <- _crLeftInvSel cr
itm <- cr ^? crInv . ix invid
f <- cr ^? crInv . ix invid . itUse . lUse
return $ f itm cr w
f <- cr ^? crInv . ix invid . itUse . lUse
return
. (runIdentity . pointToItem (_itPos itm) (return . (itUse . useHammer .~ HammerDown)))
. f itm cr
$ w
where
cr = _creatures w IM.! cid
itmShouldBeUsed = isJust (cr ^? crInv . ix (crSel cr) . itUse . cUse)
+1 -1
View File
@@ -195,7 +195,7 @@ movementSideEff cr w
(randAng,_) = randomR (0,2*pi) $ _randGen w
useUpdate :: ItemUse -> ItemUse
useUpdate = (useHammer' %~ moveHammerUp)
useUpdate = (useHammer %~ moveHammerUp)
. (useDelay . warmTime %~ decreaseToZero)
. (useDelay . rateTime %~ decreaseToZero)
+30 -28
View File
@@ -1,6 +1,7 @@
module Dodge.Default.Weapon
where
import Dodge.Data
import Dodge.Item.Weapon.AmmoParams
import Dodge.Reloading.Action
import Dodge.Item.Weapon.Bullet
import Dodge.Default.Item
@@ -32,41 +33,41 @@ defaultBulletLoadable = defaultLoadable & laAmmoType .~ basicBullet
defaultChargeable :: ItemConsumption
defaultChargeable = ChargeableAmmo 100 100
ruseRate :: Int
-> (Item -> Creature -> World -> World)
-> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
-> ItemUse
ruseRate i f usemods = RightUse
{ _rUse = f
, _useDelay = FixedRate
{ _rateMax = i
, _rateTime = 0
}
, _useMods = usemods
, _useHammer' = HammerUp
, _useAim = defaultAimParams
, _heldScroll = \_ _ -> id
}
--ruseRate :: Int
-- -> (Item -> Creature -> World -> World)
-- -> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
-- -> ItemUse
--ruseRate i f usemods = RightUse
-- { _rUse = f
-- , _useDelay = FixedRate
-- { _rateMax = i
-- , _rateTime = 0
-- }
-- , _useMods = usemods
-- , _useHammer = HammerUp
-- , _useAim = defaultAimParams
-- , _heldScroll = \_ _ -> id
-- }
ruseInstant
:: (Item -> Creature -> World -> World)
-> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
-> ItemUse
ruseInstant f usemods = RightUse
{ _rUse = f
, _useDelay = NoDelay
, _useMods = usemods
, _useHammer' = HammerUp
, _useAim = defaultAimParams
, _heldScroll = \_ _ -> id
}
--ruseInstant
-- :: (Item -> Creature -> World -> World)
-- -> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
-- -> ItemUse
--ruseInstant f usemods = RightUse
-- { _rUse = f
-- , _useDelay = NoDelay
-- , _useMods = usemods
-- , _useHammer = HammerUp
-- , _useAim = defaultAimParams
-- , _heldScroll = \_ _ -> id
-- }
defaultrUse :: ItemUse
defaultrUse = RightUse
{ _rUse = \_ _ -> id
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
, _useMods = []
, _useHammer' = HammerUp
, _useHammer = HammerUp
, _useAim = defaultAimParams
, _heldScroll = \_ _ -> id
}
@@ -120,6 +121,7 @@ defaultWeapon = defaultItem
defaultBulletWeapon :: Item
defaultBulletWeapon = defaultWeapon & itConsumption .~ defaultBulletLoadable
& itUse .~ ruseAmmoParams
defaultItemValue :: ItemValue
defaultItemValue = ItemValue 10 MundaneItem
+4 -4
View File
@@ -63,8 +63,8 @@ itemFromBase ibt = case ibt of
DUALBEAM -> dualBeam
LASGUNSWING -> lasSwing
--LASGUNSWAY -> lasSway
LASGUNWIDEPULSE -> lasWidePulse
LASGUNWIDE i -> lasGunWide i
-- LASGUNWIDEPULSE -> lasWidePulse
LASWIDE i -> lasWide i
--LASGUNFOCUS i -> lasFocus i
SONICGUN -> sonicGun
TRACTORGUN -> tractorGun
@@ -204,8 +204,8 @@ baseToFamily ibt = case ibt of
DUALBEAM -> HeldFamily
LASGUNSWING -> HeldFamily
-- LASGUNSWAY -> HeldFamily
LASGUNWIDEPULSE -> HeldFamily
LASGUNWIDE _ -> HeldFamily
-- LASGUNWIDEPULSE -> HeldFamily
LASWIDE _ -> HeldFamily
--LASGUNFOCUS _ -> HeldFamily
SONICGUN -> HeldFamily
TRACTORGUN -> HeldFamily
+1 -1
View File
@@ -128,7 +128,7 @@ flatShield = defaultEquipment
{ _rUse = \_ _ -> id
, _useDelay = NoDelay
, _useMods = []
, _useHammer' = HammerUp
, _useHammer = HammerUp
, _useAim = AimParams
{ _aimWeight = 5
, _aimRange = 0
+8 -9
View File
@@ -1,6 +1,6 @@
module Dodge.Item.Weapon.AmmoParams
( useAmmoParams
, ruseAmmoParamsRate
( ruseAmmoParams
, useAmmoParams
, fractionLoadedAmmo
, fractionLoadedAmmo2
) where
@@ -15,17 +15,16 @@ import LensHelp
import Data.Maybe
--import Control.Lens
ruseAmmoParamsRate :: Int
-> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
-> ItemUse
ruseAmmoParamsRate rate usemods = RightUse
ruseAmmoParams :: ItemUse
ruseAmmoParams = RightUse
{ _rUse = useAmmoParams Nothing
, _useDelay = FixedRate {_rateMax = rate,_rateTime = 0}
, _useMods = usemods
, _useHammer' = HammerUp
, _useDelay = FixedRate {_rateMax = 10, _rateTime = 0}
, _useMods = []
, _useHammer = HammerUp
, _useAim = defaultAimParams
, _heldScroll = \_ _ -> id
}
defaultAimParams :: AimParams
defaultAimParams = AimParams
{ _aimWeight = 0
+82 -69
View File
@@ -1,8 +1,8 @@
module Dodge.Item.Weapon.BatteryGuns
( lasGun
, dualBeam
, lasGunWide
, lasWidePulse
, lasWide
-- , lasWidePulse
--, lasSway
, lasSwing
--, lasFocus
@@ -76,14 +76,6 @@ teslaGun = defaultBatteryGun
{ _itConsumption = defaultLoadable
& laMax .~ 200
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseInstant shootTeslaArc
[ ammoCheckI
, withTempLight 1 100 (V3 0 0 1)
, withSoundForI elecCrackleS 1
, useAmmoAmount 1
]
& useAim . aimWeight .~ 6
& useAim . aimStance .~ TwoHandFlat
, _itDimension = ItemDimension
{ _dimRad = 9
, _dimCenter = V3 4 0 0
@@ -95,6 +87,16 @@ teslaGun = defaultBatteryGun
}
, _itParams = teslaParams
}
& itUse . rUse .~ shootTeslaArc
& itUse . useDelay .~ NoDelay
& itUse . useMods .~
[ ammoCheckI
, withTempLight 1 100 (V3 0 0 1)
, withSoundForI elecCrackleS 1
, useAmmoAmount 1
]
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimStance .~ TwoHandFlat
& itType . iyBase .~ TESLAGUN
teslaGunPic :: Item -> SPic
teslaGunPic _ = noPic $ colorSH blue $
@@ -121,54 +123,60 @@ lasPulse = lasGun
& itParams . lasColor .~ frac it * orange
frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1))
lasGunWide :: Int -> Item
lasGunWide n = lasGun
& itType . iyBase .~ LASGUNWIDE n
lasWide :: Int -> Item
lasWide n = lasGun
& itType . iyBase .~ LASWIDE n
& itParams . lasColor .~ orange
& itParams . lasDamage .~ 2
& itUse .~ ( ruseInstant shootLaser
& itUse . rUse .~ shootLaser
& itUse . useDelay .~ NoDelay
& 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
, duplicateOffsets xs
, withItemUpdate' increasecycle
, withItem $ \it -> duplicateOffsetsV2 (xs it)
]
& useAim . aimWeight .~ 6
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
)
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
where
n' = 9 * n
xs = [ 0.5 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
lasWidePulse :: Item
lasWidePulse = lasGun
& itType . iyBase .~ LASGUNWIDEPULSE
& itParams . lasColor .~ orange
& itParams . lasDamage .~ 2
& itUse .~ ( ruseInstant shootLaser
[ ammoCheckI
, withItem $ \it -> withTempLight 1 (100 * frac it) (xyzV4 (_lasColor $ _itParams it))
, withItem $ \it -> withSoundForVol (frac it) tone440sawtoothquietS 2
, withItemUpdate itup
$ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) (frac it * 0.8)
, useAmmoAmount 1
, withItemUpdate itup $ \it -> duplicateOffsets (xs it)
]
& useAim . aimWeight .~ 6
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
)
where
itup it = it
& itParams . lasCycle %~ (\i -> (i+1) `mod` 40)
& itParams . lasDamage .~ ceiling ((22 :: Float) * frac it)
& itParams . lasColor .~ frac it * orange
frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.05))
xs it = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
increasecycle it = case _useHammer (_itUse it) of
HammerUp -> it & itParams . lasCycle .~ 1
_ -> it & itParams . lasCycle %~ (min (n * 5) . (+ 1))
xs it = [ V2 ((0.2*yoff x) ^ (2::Int)) (yoff x) | x <- [(0::Int)..n'-1] ]
where
n' = (ceiling $ (150 :: Float) * frac it) :: Int
yoff x = fromIntegral x - fromIntegral (n'-1) / 2
n' = _lasCycle (_itParams it)
--lasWidePulse :: Item
--lasWidePulse = lasGun
-- & itType . iyBase .~ LASGUNWIDEPULSE
-- & itParams . lasColor .~ orange
-- & itParams . lasDamage .~ 2
-- & itUse .~ ( ruseInstant shootLaser
-- [ ammoCheckI
-- , withItem $ \it -> withTempLight 1 (100 * frac it) (xyzV4 (_lasColor $ _itParams it))
-- , withItem $ \it -> withSoundForVol (frac it) tone440sawtoothquietS 2
-- , withItemUpdate itup
-- $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) (frac it * 0.8)
-- , useAmmoAmount 1
-- , withItemUpdate itup $ \it -> duplicateOffsets (xs it)
-- ]
-- & useAim . aimWeight .~ 6
-- & useAim . aimRange .~ 1
-- & useAim . aimStance .~ TwoHandTwist
-- )
-- where
-- itup it = it
-- & itParams . lasCycle %~ (\i -> (i+1) `mod` 40)
-- & itParams . lasDamage .~ ceiling ((22 :: Float) * frac it)
-- & itParams . lasColor .~ frac it * orange
-- frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.05))
-- xs it = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
-- where
-- n' = (ceiling $ (150 :: Float) * frac it) :: Int
--lasSway :: Item
--lasSway = lasGun
-- & itType . iyBase .~ LASGUNSWAY
@@ -222,17 +230,18 @@ dualBeam = lasGun
, _subParams = Nothing
, _dbGap = 20
}
& itUse .~ (ruseInstant shootDualLaser
& itUse . rUse .~ shootDualLaser
& itUse . useDelay .~ NoDelay
& itUse . useMods .~
[ ammoCheckI
, withItem $ \it -> withMuzPosShift (V2 0 (thegap it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withItem $ \it -> withMuzPosShift (V2 0 (-thegap it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2
, useAmmoAmount 1
]
& useAim . aimWeight .~ 6
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandFlat
)
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandFlat
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
where
thegap = _dbGap . _itParams
@@ -259,16 +268,6 @@ lasGun = defaultAutoBatteryGun
{ _itConsumption = defaultLoadable
& laMax .~ 200
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseInstant shootLaser
[ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withSoundForI tone440sawtoothquietS 2
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, useAmmoAmount 1
]
& useAim . aimWeight .~ 6
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
, _itParams = Refracting
{ _phaseV = 1
, _lasColor = yellow
@@ -287,6 +286,18 @@ lasGun = defaultAutoBatteryGun
, _dimSPic = lasGunPic
}
}
& itUse . rUse .~ shootLaser
& itUse . useDelay .~ NoDelay
& itUse . useMods .~
[ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withSoundForI tone440sawtoothquietS 2
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, useAmmoAmount 1
]
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
& itType . iyBase .~ LASGUN
lasGunPic :: Item -> SPic
@@ -337,12 +348,6 @@ tractorGun = lasGun
{ _itConsumption = defaultLoadable
& laMax .~ 10000
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseInstant aTractorBeam
[ ammoCheckI
]
& useAim . aimWeight .~ 6
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
, _itDimension = ItemDimension
{ _dimRad = 10
, _dimCenter = V3 15 0 0
@@ -355,6 +360,14 @@ tractorGun = lasGun
, _tweakSel = 0
}
}
& itUse . rUse .~ aTractorBeam
& itUse . useDelay .~ NoDelay
& itUse . useMods .~
[ ammoCheckI
]
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
& itType . iyBase .~ TRACTORGUN
tractorGunTweak :: TweakParam
+42 -36
View File
@@ -43,17 +43,6 @@ defaultBangCane = defaultBulletWeapon
, _torqueAfter = 0.1
, _randomOffset = 0
}
, _itUse = ruseAmmoParamsRate 6
[ ammoHammerCheck
, useTimeCheck
, withSoundStart tap3S
, useAmmoAmount 1
, withTorqueAfter
, applyInaccuracy
, withRecoil
, withSmoke 1 black 20 200 5
, withMuzFlareI
]
, _itDimension = ItemDimension
{ _dimRad = 8
, _dimCenter = V3 5 0 0
@@ -64,13 +53,27 @@ defaultBangCane = defaultBulletWeapon
, _dimSPic = \it -> noPic $ baseCaneShape
<> makeSingleClipAt (V3 5 0 3) it
}
} & itUse . useAim . aimStance .~ OneHand
}
& itUse . useDelay . rateMax .~ 6
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
, withSoundStart tap3S
, useAmmoAmount 1
, withTorqueAfter
, applyInaccuracy
, withRecoil
, withSmoke 1 black 20 200 5
, withMuzFlareI
]
& itUse . useAim . aimStance .~ OneHand
& itType . iyBase .~ error "undefined bangCane baseitemtype"
& itConsumption . laMax .~ 1
& itConsumption . laCycle .~ [loadPartialInsert 10 1]
volleyGun :: Int -> Item
volleyGun i = defaultBulletWeapon
& itUse .~ ruseAmmoParamsRate 6
& itUse . useDelay . rateMax .~ 6
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
, withSoundItemChoiceStart caneStickSoundChoice
@@ -224,29 +227,32 @@ burstRifle = repeater
-- , withRecoil
-- ]
miniGunUse :: Int -> ItemUse
miniGunUse i = ruseInstant (useAmmoParams $ Just 1) $
[ ammoCheckI
, withWarmUp crankSlowS
, withSoundForI mini1S 2
--, withThinSmokeI
, withSmoke 1 black 20 200 5
, withMuzFlareI
, useAmmoAmount i
] <>
concat [
[ withSidePushI 50
, torqueBefore 0.05
, afterRecoil recoilAmount
, withRandomOffset
, withOldDir x
, trigDoAlso (useAmmoParams $ Just x)
] | x <- map ((/fromIntegral i) . fromIntegral) [1..i-1]
]
<>
[ withSidePushI 50
, afterRecoil recoilAmount
, withRandomOffset
]
miniGunUse i = ruseAmmoParams
& rUse .~ useAmmoParams (Just 1)
& useDelay .~ NoDelay
& useMods .~
[ ammoCheckI
, withWarmUp crankSlowS
, withSoundForI mini1S 2
--, withThinSmokeI
, withSmoke 1 black 20 200 5
, withMuzFlareI
, useAmmoAmount i
] <>
concat [
[ withSidePushI 50
, torqueBefore 0.05
, afterRecoil recoilAmount
, withRandomOffset
, withOldDir x
, trigDoAlso (useAmmoParams $ Just x)
] | x <- map ((/fromIntegral i) . fromIntegral) [1..i-1]
]
<>
[ withSidePushI 50
, afterRecoil recoilAmount
, withRandomOffset
]
where
recoilAmount = 5
+11 -14
View File
@@ -20,9 +20,6 @@ import Dodge.Item.Weapon.ZoomScope
--import Dodge.Particle.HitEffect.ExpireAndDamage
--import Dodge.Particle.Damage
import Dodge.Item.Weapon.ExtraEffect
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.AmmoParams
--import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Picture
@@ -39,7 +36,7 @@ import LensHelp
bangRod :: Item
bangRod = defaultBulletWeapon
{ _itParams = BulletShooter
& itParams .~ BulletShooter
{ _muzVel = 0.8
, _rifling = 1
, _bore = 2
@@ -48,7 +45,8 @@ bangRod = defaultBulletWeapon
, _torqueAfter = 0.3
, _randomOffset = 0
}
, _itUse = ruseAmmoParamsRate 12
& itUse . useDelay . rateMax .~ 12
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
, withSoundStart bangEchoS
@@ -59,7 +57,7 @@ bangRod = defaultBulletWeapon
, withMuzFlareI
, withRecoil
]
, _itDimension = ItemDimension
& itDimension .~ ItemDimension
{ _dimRad = 12
, _dimCenter = V3 5 0 0
, _dimPortage = HeldItem
@@ -69,7 +67,6 @@ bangRod = defaultBulletWeapon
, _dimSPic = \it -> noPic $ baseRodShape
<> makeSingleClipAt (V3 5 0 3) it
}
}
& itConsumption . laMax .~ 1
& itConsumption . laCycle .~ [loadEject 5, loadInsert 10 , loadPrime 5]
& itType . iyBase .~ BANGROD
@@ -128,19 +125,19 @@ sniperRifle = elephantGun
machineGun :: Item
machineGun = bangRod
& itType . iyBase .~ MACHINEGUN
& itUse .~ (ruseAmmoParamsRate 25
& itUse . useDelay . rateMax .~ 25
& itUse . useMods .~
[ ammoCheckI
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
, withSoundStart bangEchoS
, withThinSmokeI
, withMuzFlareI
]
& useAim . aimWeight .~ 8
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
& useDelay .~ VariableRate {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
)
& itUse . useAim . aimWeight .~ 8
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
& itUse . useDelay .~ VariableRate {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
& itConsumption . laMax .~ 100
& itConsumption . laCycle .~ [loadEject 10, loadInsert 40 , loadPrime 10]
& itInvSize .~ 3
+18 -14
View File
@@ -41,17 +41,19 @@ bangStickSoundChoice it
bangStick :: Int -> Item
bangStick i = defaultBulletWeapon
{ _itUse = ruseAmmoParamsRate 8
[ ammoHammerCheck
, useTimeCheck
, withSoundItemChoiceStart bangStickSoundChoice
, useAllAmmo
, withMuzFlareI
, withTorqueAfter
, spreadLoaded
-- , applyInaccuracy
, withRecoil
]
{ _itUse = ruseAmmoParams
& useDelay . rateMax .~ 8
& useMods .~
[ ammoHammerCheck
, useTimeCheck
, withSoundItemChoiceStart bangStickSoundChoice
, useAllAmmo
, withMuzFlareI
, withTorqueAfter
, spreadLoaded
-- , applyInaccuracy
, withRecoil
]
, _itParams = BulletShooter
{ _muzVel = 0.8
, _rifling = 0.8
@@ -159,7 +161,8 @@ pistol = bangStick 1
& itConsumption .~ ( defaultBulletLoadable
& laMax .~ 15
& laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] )
& itUse .~ ruseAmmoParamsRate 6 (ammoHammerCheck : pistolAfterHamMods)
& itUse . useDelay . rateMax .~ 6
& itUse . useMods .~ (ammoHammerCheck : pistolAfterHamMods)
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it)
& itParams %~
( ( muzVel .~ 0.8 )
@@ -193,7 +196,8 @@ smg = autoPistol -- & some parameter affecting stability
<> makeTinClipAt 0 (V3 7 (-2) 0) it)
revolverX :: Int -> Item
revolverX i = revolver
{ _itUse = ruseAmmoParamsRate 8
& itUse . useDelay . rateMax .~ 8
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
-- rather than locking the inventory, a better solution may be to check
@@ -208,5 +212,5 @@ revolverX i = revolver
, withTorqueAfter
, withRecoil
]
} & itConsumption . laMax .~ i * 6
& itConsumption . laMax .~ i * 6
& itType . iyBase .~ REVOLVERX i
+38 -38
View File
@@ -20,8 +20,6 @@ import Dodge.Data
import Dodge.Default.Weapon
import Dodge.Default
import Dodge.Item.Attachment
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.AmmoParams
import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
@@ -44,7 +42,22 @@ autoGun = defaultAutoGun
, _laLoaded = 30
}
& laCycle .~ [loadEject 30, loadInsert 30 , loadPrime 10]
, _itUse = ruseAmmoParamsRate 4
-- , _itFloorPict = autoGunPic
-- , _itZoom = defaultItZoom
, _itEquipPict = pictureWeaponOnAim
, _itAttachment = AttachCharMode $ Seq.fromList "MS"
, _itParams = BulletShooter
{ _muzVel = 1
, _rifling = 0.9
, _bore = 2
, _gunBarrels = SingleBarrel 0.1
, _recoil = 0
, _torqueAfter = 0
, _randomOffset = 0
}
}
& itUse . useDelay . rateMax .~ 4
& itUse . useMods .~
[ ammoCheckI
, charFiringStratI
[('S', hammerCheckI)
@@ -61,24 +74,10 @@ autoGun = defaultAutoGun
, withMuzFlareI
, withSmoke 1 black 20 200 5
]
& useAim . aimWeight .~ 6
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
-- , _itFloorPict = autoGunPic
-- , _itZoom = defaultItZoom
, _itEquipPict = pictureWeaponOnAim
, _itAttachment = AttachCharMode $ Seq.fromList "MS"
, _itParams = BulletShooter
{ _muzVel = 1
, _rifling = 0.9
, _bore = 2
, _gunBarrels = SingleBarrel 0.1
, _recoil = 0
, _torqueAfter = 0
, _randomOffset = 0
}
}
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
& itUse . heldScroll .~ scrollCharMode
& itType . iyBase .~ AUTOGUN
autoGunPic :: Item -> SPic
@@ -93,22 +92,7 @@ autoGunPic it = noPic $
bangCone :: Item
bangCone = defaultBulletWeapon
{ _itUse = ruseAmmoParamsRate 20
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, withTorqueAfter
, withRecoil
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffset
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
, _itParams = BulletShooter
{ _itParams = BulletShooter
{ _muzVel = 0.7
, _rifling = 0.8
, _bore = 5
@@ -127,7 +111,23 @@ bangCone = defaultBulletWeapon
, _dimSPic = const $ noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 5 2)
<> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 5 15)
}
}
}
& itUse . useDelay . rateMax .~ 20
& itUse . useMods .~
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, withTorqueAfter
, withRecoil
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffset
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
& itType . iyBase .~ BANGCONE
& itConsumption . laMax .~ 5
& itConsumption . laCycle .~ [loadEject 5, loadInsert 20 , loadPrime 5]
+6 -6
View File
@@ -20,17 +20,17 @@ import Control.Lens
droneLauncher :: Item
droneLauncher = defaultWeapon
{ _itUse = ruseRate 20 aDroneWithItemParams
& itUse . useDelay . rateMax .~ 20
& itUse . rUse .~ aDroneWithItemParams
& itUse . useMods .~
[ ammoCheckI
, useTimeCheck
, withSoundStart tap4S
, useAmmoAmount 1
]
& useAim . aimWeight .~ 8
& useAim . aimRange .~ 0.5
& useAim . aimStance .~ TwoHandTwist
, _itEffect = NoItEffect
}
& itUse . useAim . aimWeight .~ 8
& itUse . useAim . aimRange .~ 0.5
& itUse . useAim . aimStance .~ TwoHandTwist
& itConsumption . laAmmoType .~ DroneAmmo { _amString = "LASDRONE" }
& itConsumption . laMax .~ 2
& itType . iyBase .~ DRONELAUNCHER
+1 -1
View File
@@ -124,7 +124,7 @@ throwArmReset x = ItInvEffect {_ieInv = f ,_ieCounter = x }
i = _ipInvID $ _itPos itm
counterDown it
| _ieCounter (_itEffect it) == 0 = it
& itUse . useHammer' .~ HammerUp
& itUse . useHammer .~ HammerUp
& itEquipPict .~ pictureWeaponAim (\_ -> grenadePic 50)
| otherwise = it & itEffect . ieCounter -~ 1
+12 -10
View File
@@ -47,16 +47,6 @@ launcher = defaultWeapon
& laMax .~ 1
& laLoaded .~ 1
& laCycle .~ [loadEject 30, loadInsert 30, loadPrime 10]
, _itUse = ruseRate 20 usePjCreation
[ hammerCheckI
, ammoCheckI
, useTimeCheck
, withSoundStart tap4S
, useAmmoAmount 1
]
& useAim . aimWeight .~ 8
& useAim . aimRange .~ 0.5
& useAim . aimStance .~ TwoHandTwist
, _itParams = ShellLauncher
{ _shellSpinDrag = 1
, _shellSpinAmount = 2
@@ -77,6 +67,18 @@ launcher = defaultWeapon
, _dimSPic = launcherPic
}
}
& itUse . useDelay . rateMax .~ 20
& itUse . rUse .~ usePjCreation
& itUse . useMods .~
[ hammerCheckI
, ammoCheckI
, useTimeCheck
, withSoundStart tap4S
, useAmmoAmount 1
]
& itUse . useAim . aimWeight .~ 8
& itUse . useAim . aimRange .~ 0.5
& itUse . useAim . aimStance .~ TwoHandTwist
& itType . iyBase .~ LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
+6 -6
View File
@@ -23,14 +23,14 @@ import Control.Lens
Sends out pulses that display walls. -}
clickDetector :: Detector -> Item
clickDetector dt = defaultWeapon
{ _itUse = ruseRate 20 (detectorEffect dt)
& itUse . useDelay . rateMax .~ 20
& itUse . rUse .~ detectorEffect dt
& itUse . useMods .~
[ ammoUseCheck
]
& useAim . aimRange .~ 1
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
-- , _itZoom = defaultItZoom { _itZoomMax = 1}
, _itEquipPict = pictureWeaponAim $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
}
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
& itEquipPict .~ pictureWeaponAim (\_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5))
& itType . iyBase .~ CLICKDETECTOR dt
autoDetector :: Detector -> Item
+3 -1
View File
@@ -29,7 +29,9 @@ import LensHelp
shatterGun :: Item
shatterGun = defaultWeapon
& itType . iyBase .~ SHATTERGUN
& itUse .~ ruseRate 10 shootShatter
& itUse . useDelay . rateMax .~ 10
& itUse . rUse .~ shootShatter
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
-- , withSoundStart tap3S
+10 -8
View File
@@ -34,14 +34,6 @@ sonicGun = defaultAutoGun
{ _itConsumption = defaultLoadable
& laMax .~ 10
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseRate 8 aSonicWave
[ ammoHammerCheck
, useTimeCheck
, useAmmoAmount 1
]
& useAim . aimWeight .~ 6
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
, _itParams = NoParams
, _itTweaks = NoTweaks
, _itDimension = ItemDimension
@@ -51,6 +43,16 @@ sonicGun = defaultAutoGun
, _dimSPic = const $ noPic baseSonicShape
}
}
& itUse . useDelay . rateMax .~ 8
& itUse . rUse .~ aSonicWave
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
, useAmmoAmount 1
]
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
& itType . iyBase .~ SONICGUN
baseSonicShape :: Shape
baseSonicShape = colorSH rose $ upperPrismPoly 3 $ rectXH 25 2
+3 -4
View File
@@ -16,13 +16,12 @@ import Control.Lens
Creates a creature next to the creature using the item. -}
spawnGun :: Creature -> Item
spawnGun cr = defaultWeapon
{ _itConsumption = defaultLoadable
, _itUse = ruseRate 100
(\_ -> spawnCrNextTo cr)
& itUse . useDelay . rateMax .~ 100
& itUse . rUse .~ (\_ -> spawnCrNextTo cr)
& itUse . useMods .~
[ ammoCheckI
, hammerCheckI
]
}
& itType . iyBase .~ SPAWNER
spawnCrNextTo
:: Creature -- ^ Creature to spawn
+12 -12
View File
@@ -124,18 +124,6 @@ flameThrower = defaultAutoGun
,_amCreateGas = aFlame
}
& laCycle .~ [loadEject 5, loadInsert 10 , loadPrime 20]
, _itUse = ruseInstant (overNozzles useGasParams)
[ ammoCheckI
, useAmmoAmount 1
, withSidePushI 5
--, withTempLight 1 100 (V3 1 0 0)
, withSidePushAfterI 20
]
& useAim . aimWeight .~ 5
& useAim . aimZoom .~ defaultItZoom {_itZoomMax = 5, _itZoomMin = 1.5}
& useAim . aimStance .~ TwoHandTwist
-- , _itFloorPict = flamerPic
-- , _itZoom = defaultItZoom
, _itParams = Sprayer
{ _sprayNozzles =
[ Nozzle
@@ -159,6 +147,18 @@ flameThrower = defaultAutoGun
}
-- , _itFloorPict = flamerPic
}
& itUse . rUse .~ overNozzles useGasParams
& itUse . useDelay .~ NoDelay
& itUse . useMods .~
[ ammoCheckI
, useAmmoAmount 1
, withSidePushI 5
--, withTempLight 1 100 (V3 1 0 0)
, withSidePushAfterI 20
]
& itUse . useAim . aimWeight .~ 5
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomMax = 5, _itZoomMin = 1.5}
& itUse . useAim . aimStance .~ TwoHandTwist
& itType . iyBase .~ FLAMETHROWER
aGasCloud :: Float -> Point2 -> Float -> Creature -> World -> World
+21 -23
View File
@@ -49,6 +49,7 @@ module Dodge.Item.Weapon.TriggerType
, duplicateLoadedBarrels
, duplicateLoaded
, duplicateOffsets
, duplicateOffsetsV2
, duplicateOffsetsFocus
, hammerCheckI
, hammerCheckL
@@ -136,15 +137,11 @@ ammoCheckI eff itm cr w
ammoHammerCheck :: ChainEffect
ammoHammerCheck eff it cr w
| _laLoaded ic <= 0 || not (_laPrimed ic) = w -- fromMaybe w (startReloadingWeapon cr w)
& setHammerDown
| otherwise = case it ^? itUse . useHammer' of
Just HammerUp -> eff it cr $ setHammerDown w & creatures . ix (_crID cr) %~ crCancelReloading
_ -> setHammerDown w
| otherwise = case it ^? itUse . useHammer of
Just HammerUp -> eff it cr $ w & creatures . ix (_crID cr) %~ crCancelReloading
_ -> w
where
ic = _itConsumption it
cid = _crID cr
setHammerDown = creatures . ix cid . crInv . ix (crSel cr) . itUse
. useHammer' .~ HammerDown
itUseCharge :: Int -> Item -> Item
itUseCharge x = itConsumption . arLoaded %~ (max 0 . subtract x)
@@ -307,13 +304,11 @@ useTimeCheck f item cr w = case item ^? itUse . useDelay . rateTime of
userate = fromMaybe 0 $ item ^? itUse . useDelay . rateMax
{- | Applies a world effect after a hammer position check. -}
hammerCheckI :: ChainEffect
hammerCheckI f it cr w = case it ^? itUse . useHammer' of
Just HammerUp | _laPrimed (_itConsumption it) -> f it cr $ setHammerDown w
_ -> setHammerDown w
where
cid = _crID cr
setHammerDown = creatures . ix cid . crInv . ix (crSel cr) . itUse
. useHammer' .~ HammerDown
hammerCheckI f it cr w = case it ^? itUse . useHammer of
Just HammerUp | _laPrimed (_itConsumption it)
-> f it cr w
_ -> w
{- | Applies a world effect after an ammo check. -}
-- this should be made "safe" incase there is no _rateTime
ammoUseCheck :: ChainEffect
@@ -336,14 +331,10 @@ Arbitrary inventory position. -}
hammerCheckL
:: (Item -> Creature -> World -> World) -- ^ Underlying effect
-> Item -> Creature -> World -> World
hammerCheckL f itm cr w = case itm ^? itUse . useHammer' of
Just HammerUp -> f itm cr $ setHammerDown w
_ -> setHammerDown w
where
cid = _crID cr
invid = _ipInvID $ _itPos itm
setHammerDown = creatures . ix cid . crInv . ix invid
. itUse . useHammer' .~ HammerDown
hammerCheckL f itm cr w = case itm ^? itUse . useHammer of
Just HammerUp -> f itm cr w
_ -> w
{- | Applies a world effect after an ammo check.
Arbitrary inventory position -- cannot be replaced with ammoUseCheck. -}
shootL
@@ -369,8 +360,9 @@ shootL f item cr w
withItem :: (Item -> ChainEffect) -> ChainEffect
withItem g f it = g it f it
-- not ideal
withItemUpdate' :: (Item -> Item) -> ChainEffect
withItemUpdate' up f it cr = f it cr . (creatures . ix (_crID cr) . crInv . ix (crSel cr) %~ up)
withItemUpdate' up f it cr = f (up it) cr . (creatures . ix (_crID cr) . crInv . ix (crSel cr) %~ up)
withItemUpdate :: (Item -> Item) -> (Item -> ChainEffect) -> ChainEffect
withItemUpdate up g f it cr = g it f it cr . (creatures . ix (_crID cr) . crInv . ix (crSel cr) %~ up)
@@ -595,6 +587,12 @@ duplicateOffsetsFocus xs eff item cr w = foldr f w poss
-.- (_crPos cr +.+ pos))
| otherwise = argV (mouseWorldPos w -.- (_crPos cr +.+ pos))
duplicateOffsetsV2 :: [Point2] -> ChainEffect
duplicateOffsetsV2 xs eff item cr w = foldr f w poss
where
poss = map (rotateV (_crDir cr)) xs
f pos = eff item (cr & crPos +.+.~ pos)
duplicateOffsets :: [Float] -> ChainEffect
duplicateOffsets xs eff item cr w = foldr f w poss
where
+4 -3
View File
@@ -117,12 +117,13 @@ autoEffectGun name eff = defaultWeapon
forceFieldGun :: Item
forceFieldGun = defaultWeapon
{ _itConsumption = defaultLoadable & laAmmoType .~ ForceFieldAmmo forceField
, _itUse = ruseInstant useForceFieldGun
[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)]
, _itTargeting = targetRBPress & tgDraw .~ targetDistanceDraw
, _itParams = ParamMID Nothing
}
& itUse . rUse .~ useForceFieldGun
& itUse . useDelay .~ NoDelay
& itUse . useMods .~
[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType . iyBase .~ FORCEFIELDGUN
-- I believe because the targeting returns to nothing straight after you release
-- the rmb, it is possible for this to do nothing