Cleanup
This commit is contained in:
+32
-73
@@ -88,10 +88,12 @@ hammerCheck ::
|
||||
World
|
||||
hammerCheck f pt it cr
|
||||
| BurstTrigger is <- baseTriggerType (it ^. ldtValue)
|
||||
, pt == InitialPress = f it cr
|
||||
, pt == InitialPress =
|
||||
f it cr
|
||||
. (cWorld . lWorld . delayedEvents .++~ map g is)
|
||||
| BurstTrigger {} <- baseTriggerType (it ^. ldtValue)
|
||||
, pt /= InitialPress = id
|
||||
| BurstTrigger{} <- baseTriggerType (it ^. ldtValue)
|
||||
, pt /= InitialPress =
|
||||
id
|
||||
| t <- baseTriggerType (it ^. ldtValue)
|
||||
, t == HammerTrigger || t == AlwaysSingleTrigger
|
||||
, isNothing $ lookup MakeAutoLink (it ^. ldtRight)
|
||||
@@ -103,8 +105,9 @@ hammerCheck f pt it cr
|
||||
upitm x =
|
||||
it -- & ldtValue . itUse . heldParams . weaponRepeat .~ []
|
||||
& ldtValue . itUse . heldFrame .~ x
|
||||
--g x = (x, WdWdBurstFireRepeats (_crID cr) (it ^?! ldtValue . itLocation . ilInvID))
|
||||
|
||||
|
||||
--g x = (x, WdWdBurstFireRepeats (_crID cr) (it ^?! ldtValue . itLocation . ilInvID))
|
||||
|
||||
-- | Applies a world effect after an item use cooldown check.
|
||||
useTimeCheck :: ChainEffect
|
||||
useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
|
||||
@@ -134,8 +137,9 @@ heldEffectMuzzles :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -
|
||||
heldEffectMuzzles t cr w =
|
||||
doHeldUseEffect t cr $
|
||||
uncurry (applyCME (_ldtValue t) cr) cmew
|
||||
-- & doWeaponRepetitions upitm cr
|
||||
where
|
||||
-- & doWeaponRepetitions upitm cr
|
||||
|
||||
muzzles = t ^. ldtValue . itUse . heldMuzzles
|
||||
--(upitm, loadedmuzzles) = mapAccumR loadMuzzle t muzzles
|
||||
(_, loadedmuzzles) = mapAccumR loadMuzzle t muzzles
|
||||
@@ -191,7 +195,7 @@ applyCME itm cr cme
|
||||
|
||||
itemSidePush :: HeldItemType -> Float
|
||||
itemSidePush = \case
|
||||
BANGSTICK {} -> 0
|
||||
BANGSTICK{} -> 0
|
||||
REWINDER -> 0
|
||||
TIMESTOPPER -> 0
|
||||
TIMESCROLLER -> 0
|
||||
@@ -201,7 +205,7 @@ itemSidePush = \case
|
||||
SMG -> 30
|
||||
BANGCONE -> 0
|
||||
BLUNDERBUSS -> 0
|
||||
GRAPECANNON {} -> 0
|
||||
GRAPECANNON{} -> 0
|
||||
MINIGUNX i -> 10 + fromIntegral i
|
||||
VOLLEYGUN{} -> 0
|
||||
RIFLE -> 0
|
||||
@@ -234,11 +238,11 @@ itemSidePush = \case
|
||||
BLINKERUNSAFE -> 0
|
||||
|
||||
applyInvLock :: Item -> Creature -> World -> World
|
||||
applyInvLock itm cr
|
||||
applyInvLock itm cr
|
||||
| i <- itemInvLock itm
|
||||
, i > 0 =
|
||||
(cWorld . lWorld . delayedEvents .:~ (i, UnlockInv cid))
|
||||
. lockInv cid
|
||||
, i > 0 =
|
||||
(cWorld . lWorld . delayedEvents .:~ (i, UnlockInv cid))
|
||||
. lockInv cid
|
||||
| otherwise = id
|
||||
where
|
||||
cid = _crID cr
|
||||
@@ -266,9 +270,9 @@ applySoundCME itm cr = fromMaybe id $ do
|
||||
cid = _crID cr
|
||||
|
||||
applyRecoil :: Item -> Creature -> World -> World
|
||||
applyRecoil itm cr = cWorld . lWorld . creatures . ix (_crID cr) . crPos +~ pushback
|
||||
where
|
||||
pushback = rotateV (_crDir cr) (V2 ((- recoilAmount itm) / _crMass cr) 0)
|
||||
applyRecoil itm cr =
|
||||
cWorld . lWorld . creatures . ix (_crID cr) . crPos
|
||||
+~ rotateV (_crDir cr) (V2 ((- recoilAmount itm) / _crMass cr) 0)
|
||||
|
||||
recoilAmount :: Item -> Float
|
||||
recoilAmount itm
|
||||
@@ -368,24 +372,19 @@ applySidePush :: Float -> Creature -> World -> World
|
||||
applySidePush 0 _ w = w
|
||||
applySidePush maxSide cr w =
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix cid %~ push
|
||||
& cWorld . lWorld . creatures . ix cid . crPos +~ push
|
||||
& randGen .~ g
|
||||
where
|
||||
cid = _crID cr
|
||||
push = over crPos (+.+ rotateV (_crDir cr) (V2 0 (pushAmount / _crMass cr)))
|
||||
push = rotateV (_crDir cr) (V2 0 (pushAmount / _crMass cr))
|
||||
(pushAmount, g) = randomR (- maxSide, maxSide) $ _randGen w
|
||||
|
||||
applyTorqueCME :: Item -> Creature -> World -> World
|
||||
applyTorqueCME itm cr w
|
||||
| cid == 0 =
|
||||
w
|
||||
& wCam . camRot -~ rot
|
||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||
& randGen .~ g
|
||||
| otherwise =
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||
& randGen .~ g
|
||||
applyTorqueCME itm cr w =
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||
& randGen .~ g
|
||||
& if cid == 0 then wCam . camRot -~ rot else id
|
||||
where
|
||||
cid = _crID cr
|
||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
@@ -685,16 +684,6 @@ shootLaser so lt pv p dir col w =
|
||||
}
|
||||
& soundContinue so p tone440sawtoothquietS (Just 2)
|
||||
|
||||
--lasRayAt :: Color -> Int -> Float -> Point2 -> Float -> Laser
|
||||
--lasRayAt col dam phasev pos dir =
|
||||
-- Laser
|
||||
-- { _lpType = DamageLaser dam
|
||||
-- , _lpPhaseV = phasev
|
||||
-- , _lpPos = pos
|
||||
-- , _lpDir = dir
|
||||
-- , _lpColor = col
|
||||
-- }
|
||||
|
||||
removeAmmoFromMag :: Int -> Maybe Int -> Creature -> World -> World
|
||||
removeAmmoFromMag x mid cr = fromMaybe id $ do
|
||||
magid <- mid
|
||||
@@ -708,9 +697,7 @@ removeAmmoFromMag x mid cr = fromMaybe id $ do
|
||||
. iaLoaded
|
||||
-~ x
|
||||
|
||||
getBulletType ::
|
||||
LabelDoubleTree ComposeLinkType Item ->
|
||||
Maybe Bullet
|
||||
getBulletType :: LabelDoubleTree ComposeLinkType Item -> Maybe Bullet
|
||||
getBulletType magtree =
|
||||
magtree ^? ldtValue . itConsumables . magParams . ampBullet
|
||||
-- <&> buTrajectory .~ btraj
|
||||
@@ -776,7 +763,7 @@ makeBullet' bu itm cr mz w = makeBullet bu itm bulpos dir . (randGen .~ g) $ w
|
||||
|
||||
itemRandomOffset :: HeldItemType -> Float
|
||||
itemRandomOffset = \case
|
||||
BANGSTICK {} -> 0
|
||||
BANGSTICK{} -> 0
|
||||
REWINDER -> 0
|
||||
TIMESTOPPER -> 0
|
||||
TIMESCROLLER -> 0
|
||||
@@ -787,7 +774,7 @@ itemRandomOffset = \case
|
||||
BANGCONE -> 12
|
||||
BLUNDERBUSS -> 12
|
||||
GRAPECANNON i -> 12 + 4 * fromIntegral i
|
||||
MINIGUNX {} -> 10
|
||||
MINIGUNX{} -> 10
|
||||
VOLLEYGUN{} -> 0
|
||||
RIFLE -> 0
|
||||
ALTERIFLE -> 0
|
||||
@@ -818,7 +805,6 @@ itemRandomOffset = \case
|
||||
BLINKER -> 0
|
||||
BLINKERUNSAFE -> 0
|
||||
|
||||
|
||||
makeBullet :: Bullet -> Item -> Point2 -> Float -> World -> World
|
||||
makeBullet thebullet itm bulpos dir w =
|
||||
w & randGen .~ g''
|
||||
@@ -933,15 +919,9 @@ mcUseHeld hit = case hit of
|
||||
|
||||
useGasParams :: Maybe Int -> Muzzle -> Item -> Creature -> World -> World
|
||||
useGasParams mmagid mz itm cr w =
|
||||
createGas
|
||||
gastype
|
||||
pressure
|
||||
pos
|
||||
dir
|
||||
cr
|
||||
w
|
||||
& randGen
|
||||
.~ g'
|
||||
w
|
||||
& createGas gastype pressure pos dir cr
|
||||
& randGen .~ g'
|
||||
where
|
||||
(pressure, g) = doGenFloat (_nzPressure $ _mzEffect mz) (_randGen w)
|
||||
gastype = fromMaybe (error "cannot find gas ammo") $ do
|
||||
@@ -1004,29 +984,8 @@ doGenFloat :: RandomGen g => GenFloat -> g -> (Float, g)
|
||||
doGenFloat (ConstFloat x) g = (x, g)
|
||||
doGenFloat (UniRandFloat x y) g = randomR (x, y) g
|
||||
|
||||
--caneStickSoundChoice :: Item -> SoundID
|
||||
--caneStickSoundChoice _ = tap3S
|
||||
-- -- | (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded) < 2 = tap3S
|
||||
-- -- | otherwise = shotgunS
|
||||
|
||||
--bangStickSoundChoice :: Item -> SoundID
|
||||
--bangStickSoundChoice = caneStickSoundChoice
|
||||
|
||||
-- do
|
||||
-- wth <- state $ randomR (1, 5)
|
||||
-- return (itUse . heldConsumption . laAmmoType . amBullet . buWidth .~ wth)
|
||||
|
||||
--coneRandItemParams :: State StdGen (Item -> Item)
|
||||
--coneRandItemParams = do
|
||||
-- muzv <- state $ randomR (0.5, 1)
|
||||
-- rifl <- state $ randomR (0.3, 0.9)
|
||||
-- return $ \it ->
|
||||
-- it & itUse . heldParams . muzVel .~ muzv
|
||||
-- & itUse . heldParams . rifling .~ rifl
|
||||
|
||||
mcShootLaser :: Item -> Machine -> World -> World
|
||||
mcShootLaser _ mc =
|
||||
--cWorld . lWorld . lasers .:~ lasRayAt yellow dam phasev pos dir
|
||||
shootLaser (MachineSound (_mcID mc)) (DamageLaser 11) 1 pos dir yellow
|
||||
where
|
||||
pos = _mcPos mc +.+ 20 *.* unitVectorAtAngle dir
|
||||
|
||||
@@ -15,10 +15,7 @@ bangCone =
|
||||
defaultBulletWeapon
|
||||
& itUse . heldDelay . rateMax .~ 20
|
||||
& itUse . heldMuzzles
|
||||
.~ replicate
|
||||
15
|
||||
(Muzzle (V2 15 0) 0 0.5 0 NoFlare MuzzleShootBullet (UseExactly 1) 0)
|
||||
& itUse . heldMuzzles . ix 0 . mzFlareType .~ BasicFlare
|
||||
.~ [Muzzle (V2 15 0) 0 0.5 0 BasicFlare MuzzleShootBullet (UseUpTo 15) 0]
|
||||
& itType .~ HELD BANGCONE
|
||||
|
||||
blunderbuss :: Item
|
||||
|
||||
Reference in New Issue
Block a user