Commit before partial cleanup, continue weapon effect refactor

This commit is contained in:
2024-09-21 16:04:23 +01:00
parent bb18831393
commit 9dff2fcd7a
37 changed files with 817 additions and 856 deletions
+5
View File
@@ -105,3 +105,8 @@ bulletSynthesizer :: Item
bulletSynthesizer = defaultHeldItem
& itType . iyBase .~ ATTACH BULLETSYNTHESIZER
& itUse .~ AttachUse NoAttachParams
rocketHomer :: Item
rocketHomer = defaultHeldItem
& itType . iyBase .~ ATTACH ROCKETHOMER
& itUse .~ AttachUse NoAttachParams
+8 -5
View File
@@ -51,7 +51,8 @@ basicItemDisplay :: Item -> [String]
basicItemDisplay itm =
Prelude.take (itSlotsTaken itm) $
itemBaseName itm :
catMaybes [maybeWarmupStatus itm, maybeRateStatus itm]
--catMaybes [maybeWarmupStatus itm, maybeRateStatus itm]
catMaybes [maybeWarmupStatus itm]
++ moduleStrings itm
++ repeat "*"
@@ -75,6 +76,8 @@ showAttachItem t = case t of
SCROLLATTACH x -> show x
TARGETATTACH x -> show x
BULLETSYNTHESIZER -> "BSYNTH"
ROCKETREMOTESCREEN -> "REMOTE SCREEN"
ROCKETHOMER -> "HOMING MOD"
showEquipItem :: EquipItemType -> String
showEquipItem eit = case eit of
@@ -182,7 +185,7 @@ maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
let n = show x
in Just $ Prelude.take (5 - Prelude.length n) "*WARM" ++ n
maybeRateStatus :: Item -> Maybe String
maybeRateStatus it = case it ^? itUse . heldDelay . rateMaxMax of
Nothing -> Nothing
_ -> Just $ leftPad 3 ' ' (show (_rateMax . _heldDelay $ _itUse it))
--maybeRateStatus :: Item -> Maybe String
--maybeRateStatus it = case it ^? itUse . heldDelay . rateMaxMax of
-- Nothing -> Nothing
-- _ -> Just $ leftPad 3 ' ' (show (_rateMax . _heldDelay $ _itUse it))
+16 -16
View File
@@ -177,7 +177,7 @@ heldItemSPic ht it = case ht of
AMR -> noPic $ baseAMRShape <> addTinClip it
AUTOAMR -> noPic $ baseAMRShape <> addTinClip it
SNIPERRIFLE -> noPic $ baseAMRShape -- <> addBullets it
MACHINEGUN -> noPic $ baseAMRShape <> addTinClip it
-- MACHINEGUN -> noPic $ baseAMRShape <> addTinClip it
FLAMESPITTER -> flamerPic it
FLAMETHROWER -> flamerPic it
FLAMETORRENT -> flamerPic it
@@ -187,8 +187,8 @@ heldItemSPic ht it = case ht of
TESLAGUN -> teslaGunPic
LASGUN -> lasGunPic it
-- LASCIRCLE -> lasGunPic it
DUALBEAM -> dualBeamPic it
LASWIDE _ -> lasGunPic it
-- DUALBEAM -> dualBeamPic it
-- LASWIDE _ -> lasGunPic it
--SONICGUN -> noPic baseSonicShape
TRACTORGUN -> tractorGunPic it
LAUNCHER -> launcherPic it
@@ -468,19 +468,19 @@ lasGunPic _ =
amFrac = 0.5
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
dualBeamPic :: Item -> SPic
dualBeamPic it =
( colorSH blue $
upperBoxST 4 (rectNESW gap 3 (- gap) 1)
<> upperBoxSU 4 (rectNESW gap (-1) (- gap) (-3))
<> upperBoxSU 1 (rectNESW gap 3 (- gap) (-3))
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW gap 1 (- gap) (-1)
)
where
--amFrac = fractionLoadedAmmo it
amFrac = 0.5
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
gap = _dbGap (_itParams it) - 3
--dualBeamPic :: Item -> SPic
--dualBeamPic it =
-- ( colorSH blue $
-- upperBoxST 4 (rectNESW gap 3 (- gap) 1)
-- <> upperBoxSU 4 (rectNESW gap (-1) (- gap) (-3))
-- <> upperBoxSU 1 (rectNESW gap 3 (- gap) (-3))
-- , setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW gap 1 (- gap) (-1)
-- )
-- where
-- --amFrac = fractionLoadedAmmo it
-- amFrac = 0.5
-- col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
-- gap = _dbGap (_itParams it) - 3
tractorGunPic :: Item -> SPic
tractorGunPic = lasGunPic
+9 -3
View File
@@ -30,13 +30,19 @@ singleLDT x = LDT x [] []
baseComposedItem :: ItemBaseType -> Item -> CIL
baseComposedItem ibt itm = case ibt of
HELD _ -> heldComposedItem itm
HELD hit -> heldComposedItem itm hit
AMMOMAG _ -> ammoComposedItem itm
ATTACH BULLETSYNTHESIZER -> (AmmoModifierCI BulletAmmo, [], [])
ATTACH (TARGETATTACH{}) -> (WeaponTargetingCI, [], [])
ATTACH (SCROLLATTACH ZOOMSCOPE) -> (WeaponScopeCI, [], [])
ATTACH ROCKETHOMER -> (AmmoModifierCI ProjectileAmmo, [], [])
ATTACH ROCKETREMOTESCREEN -> (AmmoModifierCI ProjectileAmmo, [], [])
_ -> (UncomposableCI, [], [])
heldComposedItem :: Item -> CIL
heldComposedItem itm = (WeaponCI, map f ats, [])
heldComposedItem :: Item -> HeldItemType -> CIL
heldComposedItem itm hit = case hit of
_ -> (WeaponCI, map f ats,
[(WeaponTargetingLink,WeaponTargetingCI),(WeaponScopeLink,WeaponScopeCI)])
where
ats = maybe [] IM.toList $ itm ^? itUse . heldAmmoTypes
f (i,atype) = (AmmoInLink i atype,AmmoCI atype)
+3 -3
View File
@@ -46,7 +46,7 @@ itemFromHeldType ht = case ht of
AMR -> amr
AUTOAMR -> autoAmr
SNIPERRIFLE -> sniperRifle
MACHINEGUN -> machineGun
-- MACHINEGUN -> machineGun
FLAMESPITTER -> flameSpitter
FLAMETHROWER -> flameThrower
FLAMETORRENT -> flameTorrent
@@ -56,8 +56,8 @@ itemFromHeldType ht = case ht of
TESLAGUN -> teslaGun
LASGUN -> lasGun
-- LASCIRCLE -> lasCircle
DUALBEAM -> dualBeam
LASWIDE i -> lasWide i
-- DUALBEAM -> dualBeam
-- LASWIDE i -> lasWide i
TRACTORGUN -> tractorGun
LAUNCHER -> launcher
LAUNCHERX i -> launcherX i
+38 -37
View File
@@ -2,8 +2,8 @@ module Dodge.Item.Held.BatteryGuns where
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Default.Item
import Dodge.Base
import Dodge.Data.Beam
--import Dodge.Base
--import Dodge.Data.Beam
import Color
import Control.Lens
import qualified Data.Map.Strict as M
@@ -32,7 +32,7 @@ teslaGun =
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimStance .~ TwoHandFlat
-- & itUse . heldAim . aimMuzPos .~ 4
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0 0 TeslaGunFlare MuzzleTesla]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0 0 TeslaGunFlare MuzzleTesla Nothing]
& itType . iyBase .~ HELD TESLAGUN
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldTriggerType .~ AutoTrigger
@@ -46,7 +46,7 @@ lasGun =
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldDelay .~ NoDelay
& itUse . heldTriggerType .~ AutoTrigger
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 LasGunFlare MuzzleLaser]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 LasGunFlare MuzzleLaser Nothing]
& itParams
.~ Refracting
{ _phaseV = 1
@@ -91,7 +91,8 @@ tractorGun =
-- & itUse . heldMods .~ TractorMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleTractor]
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ DefaultFlareType
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleTractor
& itType . iyBase .~ HELD TRACTORGUN
tractorGunTweak :: TweakParam
@@ -102,15 +103,15 @@ tractorGunTweak =
, _tweakMax = 4
}
lasWide :: Int -> Item
lasWide n =
lasGun
& itType . iyBase .~ HELD (LASWIDE n)
& itParams . lasColor .~ yellow
& itParams . lasDamage .~ 2
& itUse . heldMods .~ LasWideMod n
& itUse . heldAim . aimMuzzles
.~ [Muzzle (V2 30 y) 0 0 0 DefaultFlareType MuzzleLaser | y <- spreadFromCenter n 1]
--lasWide :: Int -> Item
--lasWide n =
-- lasGun
-- & itType . iyBase .~ HELD (LASWIDE n)
-- & itParams . lasColor .~ yellow
-- & itParams . lasDamage .~ 2
-- & itUse . heldMods .~ LasWideMod n
-- & itUse . heldAim . aimMuzzles
-- .~ [Muzzle (V2 30 y) 0 0 0 DefaultFlareType MuzzleLaser Nothing | y <- spreadFromCenter n 1]
defaultBatteryGun :: Item
defaultBatteryGun =
@@ -136,26 +137,26 @@ batteryModules =
-- & itUse . heldAim . aimWeight .~ 6
-- & itUse . heldAim . aimRange .~ 1
dualBeam :: Item
dualBeam =
lasGun
& itType . iyBase .~ HELD DUALBEAM
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleLaser]
& itParams
.~ DualBeam
{ _phaseV = 1
, _lasColor = red
, _lasColor2 = green
, _lasCycle = 0
, _lasDamage = 11
, _lasBeam = BeamCombine LasBeamCombine
, _subParams = Nothing
, _dbGap = 20
}
-- & itUse . heldUse .~ HeldDualLaser --shootDualLaser
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ DualBeamMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandFlat
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
--dualBeam :: Item
--dualBeam =
-- lasGun
-- & itType . iyBase .~ HELD DUALBEAM
-- & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleLaser Nothing]
-- & itParams
-- .~ DualBeam
-- { _phaseV = 1
-- , _lasColor = red
-- , _lasColor2 = green
-- , _lasCycle = 0
-- , _lasDamage = 11
-- , _lasBeam = BeamCombine LasBeamCombine
-- , _subParams = Nothing
-- , _dbGap = 20
-- }
---- & itUse . heldUse .~ HeldDualLaser --shootDualLaser
-- & itUse . heldDelay .~ NoDelay
-- & itUse . heldMods .~ DualBeamMod
-- & itUse . heldAim . aimWeight .~ 6
-- & itUse . heldAim . aimRange .~ 1
-- & itUse . heldAim . aimStance .~ TwoHandFlat
-- & itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
+2 -2
View File
@@ -28,7 +28,6 @@ defaultBangCane =
-- & itUse . heldMods .~ BangCaneMod
& itUse . heldAim . aimStance .~ OneHand
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet]
volleyGun :: Int -> Item
volleyGun i =
@@ -43,6 +42,7 @@ volleyGun i =
<*> ZipList [0..i-1]
<*> pure PistolFlare
<*> pure MuzzleShootBullet
<*> pure Nothing
)
& itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
& itUse . heldParams . recoil .~ 20 + 10 * fromIntegral i
@@ -97,7 +97,7 @@ miniGunX i =
& itUse . heldParams . bulGunSound ?~ (mini1S,2)
& itUse . heldAim . aimTurnSpeed .~ 0.5
& itUse . heldAim . aimMuzzles
.~ replicate i (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet)
.~ replicate i (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet Nothing)
& itUse . heldParams . recoil .~ 10 * fromIntegral i
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
+1 -1
View File
@@ -17,7 +17,7 @@ bangCone =
& itUse . heldMods .~ PistolMod
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles
.~ replicate 15 (Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType MuzzleShootBullet)
.~ replicate 15 (Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType MuzzleShootBullet Nothing)
& itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8
& itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8
& itUse . heldParams . recoil .~ 150
+3 -1
View File
@@ -34,7 +34,8 @@ launcher =
& itUse . heldAim . aimStance .~ TwoHandOver
-- & itUse . heldAim . aimHandlePos .~ V2 3 0
-- & itUse . heldAim . aimMuzPos .~ 20
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0 0 DefaultFlareType MuzzleLauncher]
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleLauncher
& itUse . heldAmmoTypes .~ singleAmmo ProjectileAmmo
& itType . iyBase .~ HELD LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
@@ -55,6 +56,7 @@ launcherX i =
<*> ZipList [0..]
<*> pure DefaultFlareType
<*> pure MuzzleLauncher
<*> pure Nothing
)
& itUse . heldAmmoTypes .~ IM.fromList [(j,ProjectileAmmo) | j <- [0..i-1]]
where
+18 -17
View File
@@ -4,7 +4,7 @@ module Dodge.Item.Held.Rod (
amr,
autoAmr,
sniperRifle,
machineGun,
-- machineGun,
) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
@@ -31,7 +31,8 @@ bangRod =
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1 0 HeavySmokeFlare MuzzleShootBullet]
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 30 0
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ HeavySmokeFlare
-- & itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
elephantGun :: Item
@@ -59,18 +60,18 @@ sniperRifle =
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5,_izFac = 1}
machineGun :: Item
machineGun =
bangRod
& itType . iyBase .~ HELD MACHINEGUN
-- & itUse . heldMods .~ MachineGunMod
& itUse . heldMods .~ PistolMod
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldDelay .~ VariableRate
{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
& itInvSize .~ 3
& itUse . heldParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
& itUse . heldTriggerType .~ AutoTrigger
--machineGun :: Item
--machineGun =
-- bangRod
-- & itType . iyBase .~ HELD MACHINEGUN
---- & itUse . heldMods .~ MachineGunMod
-- & itUse . heldMods .~ PistolMod
-- & itUse . heldAim . aimWeight .~ 8
-- & itUse . heldAim . aimRange .~ 1
-- & itUse . heldAim . aimStance .~ TwoHandUnder
-- & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
-- & itUse . heldDelay .~ VariableRate
-- {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
-- & itInvSize .~ 3
-- & itUse . heldParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
-- & itUse . heldTriggerType .~ AutoTrigger
+7 -2
View File
@@ -33,8 +33,12 @@ flameSpitter =
& itType . iyBase .~ HELD FLAMESPITTER
-- & itParams . sprayNozzles . ix 0 . nzPressure .~ 4
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldDelay .~ FixedRate{_rateMax = 12, _rateTime = 0}
& itUse . heldMods .~ FlameSpitterMod
& itUse . heldDelay .~ FixedRate{_rateMax = 3, _rateTime = 0}
-- & itUse . heldMods .~ FlameSpitterMod
& itUse . heldParams . weaponInvLock .~ 10
& itUse . heldParams . weaponRepeat .~ [1..9]
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect . nzPressure .~ UniRandFloat 3 4
& itUse . heldTriggerType .~ HammerTrigger
flameTorrent :: Item
flameTorrent =
@@ -88,6 +92,7 @@ flameThrower =
, _nzWalkSpeed = 0.01
, _nzCurrentWalkAngle = 0
}
Nothing
]
& itUse . heldAmmoTypes .~ singleAmmo GasAmmo
& itType . iyBase .~ HELD FLAMETHROWER
+1 -1
View File
@@ -27,7 +27,7 @@ bangStick i =
-- & itUse . heldMods .~ BangStickMod
& itUse . heldMods .~ PistolMod
& itUse . heldAim . aimMuzzles
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet | a <- spreadAroundCenter i baseStickSpread]
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet Nothing | a <- spreadAroundCenter i baseStickSpread]
baseStickSpread :: Float
baseStickSpread = 0.2
+4 -2
View File
@@ -40,11 +40,12 @@ forceFieldGun =
-- & itUse . heldUse .~ HeldForceField --useForceFieldGun
& itUse . heldDelay .~ NoDelay
-- & itUse . heldMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
& itUse . heldMods .~ ForceFieldMod -- this is slightly different
-- & itUse . heldMods .~ ForceFieldMod -- this is slightly different
-- than the list below
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType . iyBase .~ HELD FORCEFIELDGUN
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleForceField
{- |
Sends out pulses that display walls.
@@ -55,7 +56,8 @@ clickDetector dt =
& itUse . heldDelay . rateMax .~ 20
-- & itUse . heldUse .~ HeldDetectorEffect dt --detectorEffect dt
-- & itUse . heldMods .~ AmmoUseCheckMod
& itUse . heldMods .~ DetectorMod dt --detectorEffect dt
-- & itUse . heldMods .~ DetectorMod dt --detectorEffect dt
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
& itType . iyBase .~ HELD (HELDDETECTOR dt)
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleDetector
+6 -1
View File
@@ -3,12 +3,17 @@ module Dodge.Item.Held.Weapons where
import Dodge.Default.Item
import Dodge.Data.Item
import Control.Lens
import Linear.V2
shatterGun :: Item
shatterGun =
defaultHeldItem
& itType . iyBase .~ HELD SHATTERGUN
& itUse . heldDelay . rateMax .~ 10
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 30 0
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleShatter
-- & itUse . heldUse .~ HeldShatter --shootShatter
& itUse . heldMods .~ ShatterMod
-- & itUse . heldMods .~ ShatterMod
& itUse . heldAim . aimStance .~ TwoHandFlat
+3 -3
View File
@@ -81,7 +81,7 @@ heldInfo hit = case hit of
AMR -> "An antimateriel rifle, designed to disable military equipment. Its long barrel is fed by a magazine that must be replaced when reloading the weapon."
AUTOAMR -> "An automatic antimateriel rifle, designed to disable military equipment. Its long barrel is fed by a magazine that must be replaced when reloading the weapon."
SNIPERRIFLE -> "A firearm designed with long range capability in mind. Its long barrel requires reloading after each shot."
MACHINEGUN -> "A heavy firearm whose rate of fire increases during a barrage."
-- MACHINEGUN -> "A heavy firearm whose rate of fire increases during a barrage."
FLAMESPITTER -> "A weapon that globs out burning fuel."
FLAMETHROWER -> "A weapon that squirts out burning fuel."
FLAMETORRENT -> "A weapon that streams out burning fuel in a torrent."
@@ -91,8 +91,8 @@ heldInfo hit = case hit of
TESLAGUN -> "A weapon that discharges a sustained arc of electricity. The arc will attempt to discharge at a nearby object."
LASGUN -> "A weapon that continuously emits photons in a narrow beam."
-- LASCIRCLE -> "A extensive configuration of prisms and mirrors that produces multiple laser beams around its user."
DUALBEAM -> "A weapon that emits two beams that converge at a selectable point in front of the user."
LASWIDE _ -> "A weapon that continuously emits photons in a narrow beam. The beam expands as the weapon heats up."
-- DUALBEAM -> "A weapon that emits two beams that converge at a selectable point in front of the user."
-- LASWIDE _ -> "A weapon that continuously emits photons in a narrow beam. The beam expands as the weapon heats up."
TRACTORGUN -> "An item that produces a beam of gravitons."
LAUNCHER -> "A large tube that can launch self propelled projectiles. Moving the tube after launch will cause the projectile to spin."
LAUNCHERX i -> over _head toUpper (showInt i) ++ " tubes that can launch self propelled projectiles. Tubes that do not face forward launch their projecitles at an angle."
+3 -3
View File
@@ -45,7 +45,7 @@ heldBounds hit = case hit of
AMR -> amrs
AUTOAMR -> amrs
SNIPERRIFLE -> amrs
MACHINEGUN -> amrs
-- MACHINEGUN -> amrs
FLAMESPITTER -> fs
FLAMETHROWER -> fs
FLAMETORRENT -> fs
@@ -55,8 +55,8 @@ heldBounds hit = case hit of
TESLAGUN -> ts
LASGUN -> ls
-- LASCIRCLE -> ls
DUALBEAM -> ls
LASWIDE _ -> ls
-- DUALBEAM -> ls
--LASWIDE _ -> ls
TRACTORGUN -> ls
LAUNCHER -> launchs
LAUNCHERX _ -> launchs
+7
View File
@@ -1,6 +1,7 @@
module Dodge.Item.Scope (
zoomScope,
targetingScope,
rocketRemoteScreen,
) where
import Control.Lens
@@ -18,3 +19,9 @@ targetingScope tt =
defaultHeldItem
& itType . iyBase .~ ATTACH (TARGETATTACH tt)
& itUse .~ AttachUse TargetAttachParams
rocketRemoteScreen :: Item
rocketRemoteScreen =
defaultHeldItem
& itType . iyBase .~ ATTACH ROCKETREMOTESCREEN
& itUse .~ AttachUse NoAttachParams
+43 -42
View File
@@ -18,7 +18,7 @@ module Dodge.Item.Weapon.TriggerType (
withItem,
withItemUpdate,
withItemUpdateFirst,
rateIncAB,
-- rateIncAB,
torqueBefore,
torqueBeforeAtLeast,
withTorqueAfter,
@@ -161,44 +161,44 @@ itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
--itUseAmmo :: Int -> Item -> Item
--itUseAmmo x = itUse . heldConsumption . laSource . _InternalSource . iaLoaded %~ (max 0 . subtract x)
{- | Fires at an increasing rate.
Has different effect after first fire.
Applies ammo check and use cooldown check.
-}
rateIncAB ::
-- | Extra effect on first fire
ChainEffect ->
-- | Extra effect on continued fire
ChainEffect ->
ChainEffect
rateIncAB exeffFirst exeffCont eff item cr w
| repeatFire =
w
& pointItem
%~ ( (itUse . heldDelay . rateMax .~ max fastRate (currentRate - 1))
-- . itUseAmmo 1
. (itUse . heldDelay . rateTime .~ currentRate)
)
& exeffCont eff item cr
| firstFire =
w
& pointItem
%~ ( (itUse . heldDelay . rateMax .~ startRate - 1)
-- . itUseAmmo 1
. (itUse . heldDelay . rateTime .~ startRate)
)
& exeffFirst eff item cr
| otherwise = w
where
item' = _ldtValue item
fastRate = _rateMinMax . _heldDelay $ _itUse item'
startRate = _rateMaxMax . _heldDelay $ _itUse item'
cid = _crID cr
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
pointItem = cWorld . lWorld . creatures . ix cid . crInv . ix itRef
currentRate = _rateMax (_heldDelay (_itUse item'))
repeatFire = crWeaponReady cr && _rateTime (_heldDelay (_itUse item')) == 1
firstFire = crWeaponReady cr && _rateTime (_heldDelay (_itUse item')) == 0
--{- | Fires at an increasing rate.
--Has different effect after first fire.
--Applies ammo check and use cooldown check.
---}
--rateIncAB ::
-- -- | Extra effect on first fire
-- ChainEffect ->
-- -- | Extra effect on continued fire
-- ChainEffect ->
-- ChainEffect
--rateIncAB exeffFirst exeffCont eff item cr w
-- | repeatFire =
-- w
-- & pointItem
-- %~ ( (itUse . heldDelay . rateMax .~ max fastRate (currentRate - 1))
---- . itUseAmmo 1
-- . (itUse . heldDelay . rateTime .~ currentRate)
-- )
-- & exeffCont eff item cr
-- | firstFire =
-- w
-- & pointItem
-- %~ ( (itUse . heldDelay . rateMax .~ startRate - 1)
---- . itUseAmmo 1
-- . (itUse . heldDelay . rateTime .~ startRate)
-- )
-- & exeffFirst eff item cr
-- | otherwise = w
-- where
-- item' = _ldtValue item
-- fastRate = _rateMinMax . _heldDelay $ _itUse item'
-- startRate = _rateMaxMax . _heldDelay $ _itUse item'
-- cid = _crID cr
-- itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
-- pointItem = cWorld . lWorld . creatures . ix cid . crInv . ix itRef
-- currentRate = _rateMax (_heldDelay (_itUse item'))
-- repeatFire = crWeaponReady cr && _rateTime (_heldDelay (_itUse item')) == 1
-- firstFire = crWeaponReady cr && _rateTime (_heldDelay (_itUse item')) == 0
-- | Apply effect after a warm up.
@@ -377,7 +377,7 @@ Applies a world effect after an item use cooldown check.
-}
useTimeCheck :: ChainEffect
useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
Just (FixedRate _ 0) -> f item cr $ setUseTime w
Just (FixedRate _ 0) -> f item cr $ setUseRate w
Just (FixedRate _ _) -> w
Just (WarmUpNoDelay wt wm ws) | wt < wm -> w
& soundContinue (CrWeaponSound cid 0) (_crPos cr) ws (Just 2)
@@ -385,10 +385,11 @@ useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
Just (WarmUpNoDelay _ wm _) -> f item cr w
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . warmTime .~ (wm+1)
Just NoDelay -> f item cr w
_ -> w
-- Just (VariableRate rmax rtime rmaxmax rminmax) -> undefined
Nothing -> w
where
cid = _crID cr
setUseTime = cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . rateTime
setUseRate = cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . rateTime
+~ userate
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
userate = fromMaybe 0 $ item ^? ldtValue . itUse . heldDelay . rateMax