This commit is contained in:
2022-03-03 23:27:45 +00:00
parent d5f11109cd
commit ae219f2ddf
5 changed files with 30 additions and 108 deletions
+6 -5
View File
@@ -93,11 +93,11 @@ bangCaneX i = bangCane
, useTimeCheck
, withSoundItemChoiceStart caneStickSoundChoice
, useAllAmmo
, torqueAfterI 0.5
, withTorqueAfter
, duplicateLoadedBarrels
, applyInaccuracy
, withMuzFlareI
, withRecoilI 50
, withRecoil
]
, _itDimension = ItemDimension
{ _dimRad = 8
@@ -122,6 +122,7 @@ bangCaneX i = bangCane
,_brlNum = i
,_brlInaccuracy = 0.1
}
& itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i
caneStickSoundChoice :: Item -> SoundID
caneStickSoundChoice it
| _ammoLoaded (_itConsumption it) < 2 = tap3S
@@ -194,7 +195,7 @@ burstRifle = repeater
, useAmmoAmount 1
, applyInaccuracy
, withMuzFlareI
, withRecoilI 50
, withRecoil
]
fastBurstRifle :: Item
fastBurstRifle = repeater
@@ -212,7 +213,7 @@ fastBurstRifle = repeater
, useAmmoAmount 1
, applyInaccuracy
, withMuzFlareI
, withRecoilI 50
, withRecoil
]
completeBurstRifle :: Item
completeBurstRifle = repeater
@@ -231,7 +232,7 @@ completeBurstRifle = repeater
, useAmmoAmount 1
, applyInaccuracy
, withMuzFlareI
, withRecoilI 50
, withRecoil
]
miniGunUse :: Int -> ItemUse
miniGunUse i = ruseInstant (useAmmoParams $ Just 1) NoHammer $
+4 -2
View File
@@ -98,12 +98,14 @@ elephantGun = bangRod
, useTimeCheck
, withSoundStart bangEchoS
, useAmmoAmount 1
, torqueAfterI 0.1
, withTorqueAfter
, applyInaccuracy
, withThickSmokeI
, withMuzFlareI
, withRecoilI 50
, withRecoil
]
& itParams . recoil .~ 50
& itParams . torqueAfter .~ 0.1
amr :: Item
amr = elephantGun
& itName .~ "ANTIMATERIELRIFLE"
+12 -8
View File
@@ -142,8 +142,8 @@ pistolAfterHamMods =
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, torqueAfterI 0.2
, withRecoilI 10
, withTorqueAfter
, withRecoil
, withSidePushI 50
, withMuzFlareI
]
@@ -153,9 +153,9 @@ machinePistolAfterHamMods =
, useAmmoAmount 1
, withSoundStart tap1S
, applyInaccuracy
, torqueAfterI 0.2
, withTorqueAfter
, withSidePushI 50
, withRecoilI 20
, withRecoil
, withMuzFlareI
]
smgAfterHamMods :: [ChainEffect]
@@ -164,8 +164,8 @@ smgAfterHamMods =
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, torqueAfterI 0.05
, withRecoilI 10
, withTorqueAfter
, withRecoil
, withSidePushI 30
, withMuzFlareI
]
@@ -194,6 +194,8 @@ pistol = (bangStick 1)
. ( rifling .~ 0.8 )
. ( bore .~ 2 )
. ( gunBarrels .~ SingleBarrel 0.05 )
. ( recoil .~ 10 )
. ( torqueAfter .~ 0.2 )
)
autoPistol :: Item
autoPistol = pistol
@@ -208,6 +210,7 @@ machinePistol = autoPistol
& itName .~ "MACHINEPISTOL"
& itType .~ MACHINEPISTOL
& itModules . at ModAutoMag .~ Nothing
& itParams . recoil .~ 20
smg :: Item
smg = autoPistol -- & some parameter affecting stability
& itUse . useMods .~ (ammoCheckI : smgAfterHamMods)
@@ -215,6 +218,7 @@ smg = autoPistol -- & some parameter affecting stability
& itType .~ SMG
& itUse . useAim . aimStance .~ TwoHandTwist
& itDimension . dimPortage . handlePos .~ 2
& itParams . torqueAfter .~ 0.05
& itDimension . dimSPic .~ \it -> noPic (baseSMGShape
<> makeTinClipAt 0 (V3 7 (-2) 0) it)
revolverX :: Int -> Item
@@ -233,7 +237,7 @@ revolverX i = revolver
, applyInaccuracy
, withMuzFlareI
-- , spreadLoaded
, torqueAfterI 0.2
, withRecoilI 10
, withTorqueAfter
, withRecoil
]
} & itConsumption . ammoBaseMax .~ i * 6
+6 -31
View File
@@ -4,7 +4,6 @@ module Dodge.Item.Weapon.BulletGuns
, bigBlunderbuss
, biggerBlunderbuss
, biggestBlunderbuss
, grapeShotCannon
, grenadeLauncher
, spreadGun
, ltAutoGun
@@ -215,31 +214,6 @@ biggestBlunderbuss = biggerBlunderbuss
& itParams . torqueAfter .~ 0.7
& itParams . randomOffset .~ 24
grapeShotCannon :: Item
grapeShotCannon = blunderbuss
{_itName = "GRAPESHOTCANNON"
,_itType = GRAPESHOTCANNON
,_itUse = ruseAmmoParamsRate 20 upHammer
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, torqueAfterI 0.1
, withRecoilI 150
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffsetI 12
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
& useAim . aimStance .~ TwoHandTwist
& useAim . aimSpeed .~ 0.4
}
& itConsumption . ammoBaseMax .~ 15
& itConsumption . reloadTime .~ 30
grenadeLauncher :: Int -> Item
grenadeLauncher _ = bangCone
@@ -255,7 +229,7 @@ hvAutoGun = defaultAutoGun
}
, _itUse = ruseAmmoParamsRate 25 NoHammer
[ ammoCheckI
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) (torqueAfterI 0.2)
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
, withSoundStart bangEchoS
, withThinSmokeI
, withMuzFlareI
@@ -272,6 +246,7 @@ hvAutoGun = defaultAutoGun
,"* " ++ fromMaybe " " (maybeRateStatus it) ++ " *"
]
}
& itParams. torqueAfter .~ 0.2
ltAutoGun :: Item
ltAutoGun = defaultAutoGun
{ _itName = "AUTO-LT"
@@ -288,7 +263,7 @@ ltAutoGun = defaultAutoGun
, withSoundStart tap1S
, useAmmoAmount 1
, applyInaccuracy
, torqueAfterI 0.2
, withTorqueAfter
, withSidePushI 50
, modClock 2 withMuzFlareI
]
@@ -317,7 +292,7 @@ spreadGun = defaultGun
, useTimeCheck
, withSoundStart shotgunS
, useAmmoAmount 1
, withRecoilI 100
, withRecoil
, withMuzFlareI
, spreadNumI
]
@@ -351,7 +326,7 @@ multGun = defaultGun
, useTimeCheck
, withSoundStart shotgunS
, useAllAmmo
, withRecoilI 200
, withRecoil
, withMuzFlareI
, duplicateLoadedBarrels
]
@@ -390,7 +365,7 @@ longGun = defaultGun
, withSoundStart bangEchoS
, useAmmoAmount 1
, withThickSmokeI
, torqueAfterI 0.05
, withTorqueAfter
, withMuzFlareI
]
& useAim . aimSpeed .~ 0.2
+2 -62
View File
@@ -14,7 +14,7 @@ module Dodge.Item.Weapon.TriggerType
, rateIncAB
, torqueBefore
, torqueBeforeAtLeast
, torqueAfterI
-- , torqueAfterI
, withTorqueAfter
, torqueSideEffect
, withRandomItemParams
@@ -29,10 +29,8 @@ module Dodge.Item.Weapon.TriggerType
, withPositionOffset
, withPositionWallCheck
, withPosDirWallCheck
, withRandomOffsetI
, withRandomOffset
, withRandomDirI
, withRecoilI
, withRecoil
, afterRecoil
, withSidePushAfterI
@@ -42,10 +40,8 @@ module Dodge.Item.Weapon.TriggerType
, spreadLoaded
, repeatOnFrames
, sideEffectOnFrame
-- , numBarrels
, duplicateLoadedBarrels
, duplicateLoaded
, randWalkAngle -- ^ should be made into a modifier, perhaps
, hammerCheckI
, hammerCheckL
, shootL
@@ -54,8 +50,7 @@ module Dodge.Item.Weapon.TriggerType
, applyInaccuracy
, modClock
, ammoHammerCheck
)
where
) where
import Dodge.Data
import Dodge.Base.Collide
import Dodge.SoundLogic
@@ -238,13 +233,6 @@ afterRecoil recoilAmount eff item cr = eff item (pushback cr) . over (creatures
where
cid = _crID cr
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((-recoilAmount) / _crMass cr ) 0))
withRecoilI
:: Float -- ^ Recoil amount
-> ChainEffect
withRecoilI recoilAmount eff item cr = eff item cr . over (creatures . ix cid) pushback
where
cid = _crID cr
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((-recoilAmount) / _crMass cr ) 0))
withRecoil :: ChainEffect
withRecoil eff it cr = eff it cr . over (creatures . ix cid) pushback
where
@@ -434,14 +422,6 @@ withPosDirWallCheck h f it cr w
(p,a) = h it cr w
{- | Apply the effect to a translated creature. -}
withRandomOffsetI
:: Float -- ^ Max possible translate
-> ChainEffect
withRandomOffsetI offsetAmount f item cr w = f item (cr & crPos %~ (+.+ offV)) $ set randGen g w
where
(offsetVal , g) = randomR (-offsetAmount,offsetAmount) $ _randGen w
offV = rotateV (_crDir cr) (V2 0 offsetVal)
{- | Apply the effect to a translated creature. -}
withRandomOffset :: ChainEffect
withRandomOffset f item cr w = f item (cr & crPos %~ (+.+ offV)) $ set randGen g w
where
@@ -479,19 +459,6 @@ torqueBeforeAtLeast minTorque exTorque feff item cr w
rot' | rot < 0 = rot - minTorque
| otherwise = rot + minTorque
-- | Rotate a randomly creature after applying an effect.
torqueAfterI :: Float -- ^ Max possible rotation
-> ChainEffect
torqueAfterI torque feff item cr w
-- | cid == 0 = rotateScope $ set randGen g $ over cameraRot (+rot) $ feff item cr w
| cid == 0 = set randGen g $ over cameraRot (+rot) $ feff item cr w
| otherwise = set randGen g $ over (creatures . ix cid . crDir) (+rot) $ feff item cr w
where
cid = _crID cr
(rot, g) = randomR (-torque,torque) $ _randGen w
-- rotateScope = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
-- . itAttachment . scopePos %~ rotateV rot
--
-- | Rotate a randomly creature after applying an effect.
withTorqueAfter :: ChainEffect
withTorqueAfter feff item cr w
-- | cid == 0 = rotateScope $ set randGen g $ over cameraRot (+rot) $ feff item cr w
@@ -563,30 +530,3 @@ duplicateLoadedBarrels eff item cr w = foldr f w poss
f pos = eff item (cr & crPos %~ (+.+ pos))
numBar = _brlNum . _gunBarrels $ _itParams item
numBul = _ammoLoaded $ _itConsumption item
--numBarrels :: ChainEffect
--numBarrels eff item cr w = foldr f w poss
-- where
-- cp :: Float
-- cp = -0.5 * fromIntegral numBul
-- poss :: [V2 Float]
-- poss = map (rotateV (_crDir cr) . V2 0 . (*5) . (+ cp) . fromIntegral) [0 .. numBul - 1]
-- f pos = eff item (cr & crPos %~ (+.+ pos))
-- numBul = _brlNum . _gunBarrels $ _itParams item
{- | Uses '_wpSpread' as a parameter for the current offset angle. -}
randWalkAngle
:: (Creature -> World -> World) -- ^ Underlying effect
-> Creature -- ^ Creature id
-> World
-> World
randWalkAngle f cr w = w
& f (cr & crDir +~ a)
& creatures . ix cid . crInv . ix i . itParams . currentWalkAngle .~ newa
where
cid = _crID cr
a = _currentWalkAngle $ _itParams it
(walka, _) = randomR (-aspeed,aspeed) (_randGen w)
newa = min ma $ max (negate ma) (a + walka)
i = _crInvSel $ _creatures w IM.! cid
it = _crInv cr IM.! i
ma = _maxWalkAngle $ _itParams it
aspeed = _walkSpeed $ _itParams it