Mid refactor of item ruse--broken

This commit is contained in:
2022-07-20 16:30:30 +01:00
parent eeb98eb151
commit 795c4c1987
18 changed files with 238 additions and 185 deletions
+183
View File
@@ -17,6 +17,189 @@ import RandomHelp
import Data.Traversable
useMod :: HeldMod -> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
useMod hm = case hm of
HeldModNothing -> []
PoisonSprayerMod ->
[ ammoCheckI
, withSoundForI foamSprayLoopS 5
, useAmmoAmount 1
]
FlameSpitterMod ->
[ ammoCheckI
, useTimeCheck
, lockInvFor 10
, repeatOnFrames [1..9]
, withRandomItemParams f
, useAmmoAmount 1
, withSidePushI 5
, withSidePushAfterI 20
]
FlameThrowerMod ->
[ ammoCheckI
, useAmmoAmount 1
, withSidePushI 5
--, withTempLight 1 100 (V3 1 0 0)
, withSidePushAfterI 20
]
LauncherMod ->
[ hammerCheckI
, ammoCheckI
, useTimeCheck
, withSoundStart tap4S
, useAmmoAmount 1
]
TeslaMod ->
[ ammoCheckI
, withTempLight 1 100 (V3 0 0 1)
, withSoundForI elecCrackleS 1
, useAmmoAmount 1
]
CircleLaserMod ->
[ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2
, useAmmoAmount 1
, withItemUpdate' increasecycle
, duplicateItem f
]
LasWideMod ->
[ 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)
]
DualBeamMod ->
[ 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
]
LasMod ->
[ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withSoundForI tone440sawtoothquietS 2
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, useAmmoAmount 1
, crAtMuzPos
]
LauncherXMod ->
[ hammerCheckI
, ammoCheckI
, useTimeCheck
, withSoundStart tap4S
, useAmmoAmount i
]
ShatterMod ->
[ ammoHammerCheck
, useTimeCheck
-- , withSoundStart tap3S
, useAmmoAmount 1
]
AmmoCheckMod -> [ ammoCheckI ]
AmmoUseCheckMod -> [ ammoUseCheck ]
AmmoHammerTimeUseOneMod ->
[ ammoHammerCheck
, useTimeCheck
, useAmmoAmount 1
]
BangCaneMod ->
[ ammoHammerCheck
, useTimeCheck
, withSoundStart tap3S
, useAmmoAmount 1
, withTorqueAfter
, applyInaccuracy
, withRecoil
, withSmoke 1 black 20 200 5
, withMuzFlareI
]
VolleyGunMod ->
[ ammoHammerCheck
, useTimeCheck
, withSoundItemChoiceStart caneStickSoundChoice
, useAllAmmo
, withTorqueAfter
, duplicateLoadedBarrels
, applyInaccuracy
, withMuzFlareI
, withRecoil
]
AutoRifleMod -> -- note this is the same as BangCanemMod with the first changed
[ ammoCheckI
, useTimeCheck
, withSoundStart tap3S
, useAmmoAmount 1
, withTorqueAfter
, applyInaccuracy
, withRecoil
, withSmoke 1 black 20 200 5
, withMuzFlareI
]
BangRodMod ->
[ ammoHammerCheck
, useTimeCheck
, withSoundStart bangEchoS
, useAmmoAmount 1
, withTorqueAfter
, applyInaccuracy
, withThickSmokeI
, withMuzFlareI
, withRecoil
]
ElephantGunMod ->
[ ammoHammerCheck
, useTimeCheck
, withSoundStart bangEchoS
, useAmmoAmount 1
, withTorqueAfter
, applyInaccuracy
, withThickSmokeI
, withMuzFlareI
, withRecoil
]
AutoAmrMod ->
[ ammoCheckI -- cf ElephantGun
, useTimeCheck
, withSoundStart bangEchoS
, useAmmoAmount 1
, withTorqueAfter
, applyInaccuracy
, withThickSmokeI
, withMuzFlareI
, withRecoil
]
MachineGunMod ->
[ ammoCheckI
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
, withSoundStart bangEchoS
, withThinSmokeI
, withMuzFlareI
]
ModWithDirectedTeleport hm' ->
withPosDirWallCheck directedTelPos : useMod hm'
BangStickMod ->
[ ammoHammerCheck
, useTimeCheck
, withSoundItemChoiceStart bangStickSoundChoice
, useAllAmmo
, withMuzFlareI
, withTorqueAfter
, spreadLoaded
-- , applyInaccuracy
, withRecoil
]
where
f = do
nzpres <- state $ randomR (3,4)
return $ sprayNozzles . ix 0 . nzPressure .~ nzpres
useHeld :: HeldUse -> Item -> Creature -> World -> World
useHeld hu = case hu of
HeldDoNothing -> const $ const id