Add new weapons

This commit is contained in:
2022-02-16 08:50:19 +00:00
parent 4f0f8cb4c2
commit 505e4123d7
13 changed files with 208 additions and 72 deletions
+46 -7
View File
@@ -4,7 +4,9 @@ module Dodge.Item.Weapon.BulletGun.Cane
, repeater
, rifle
, autoRifle
, assaultRifle
, burstRifle
, completeBurstRifle
, fastBurstRifle
, miniGun
, miniGun'
) where
@@ -171,16 +173,17 @@ autoRifle = repeater
& itType .~ AUTORIFLE
& itUse . useMods %~ ((ammoCheckI :) . tail)
-- & itUse . useDelay . rateMax .~ 6
assaultRifle :: Item
assaultRifle = repeater
& itName .~ "ASSAULTRIFLE"
& itType .~ ASSAULTRIFLE
burstRifle :: Item
burstRifle = repeater
& itName .~ "BURSTRIFLE"
& itType .~ BURSTRIFLE
& itParams . gunBarrels . brlInaccuracy .~ 0.05
& itUse . useDelay . rateMax .~ 18
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
, torqueAfterI 0.2
, lockInvFor 10
, sideEffectOnFrame 7 (torqueSideEffect 0.2)
, lockInvFor 7
, \f it -> repeatOnFrames (take (_ammoLoaded (_itConsumption it) - 1) [3,6]) f it
, withSoundStart tap3S
, useAmmoAmount 1
@@ -188,6 +191,42 @@ assaultRifle = repeater
, withMuzFlareI
, withRecoilI 50
]
fastBurstRifle :: Item
fastBurstRifle = repeater
& itName .~ "FASTBURSTRIFLE"
& itType .~ FASTBURSTRIFLE
& itParams . gunBarrels . brlInaccuracy .~ 0.06
& itUse . useDelay . rateMax .~ 18
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
, sideEffectOnFrame 9 (torqueSideEffect 0.4)
, lockInvFor 9
, \f it -> repeatOnFrames (take (_ammoLoaded (_itConsumption it) - 1) [2,4,6,8]) f it
, withSoundStart tap3S
, useAmmoAmount 1
, applyInaccuracy
, withMuzFlareI
, withRecoilI 50
]
completeBurstRifle :: Item
completeBurstRifle = repeater
& itName .~ "COMPLETEBURSTRIFLE"
& itType .~ COMPLETEBURSTRIFLE
& itParams . gunBarrels . brlInaccuracy .~ 0.1
& itUse . useDelay . rateMax .~ 28
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
, sideEffectOnFrame 15 (torqueSideEffect 0.8)
, lockInvFor 15
, \f it -> repeatOnFrames (take (_ammoLoaded (_itConsumption it) - 1) [1..14]) f it
, withSoundStart tap3S
, useAmmoAmount 1
, applyInaccuracy
, withMuzFlareI
, withRecoilI 50
]
miniGun' :: Item
miniGun' = miniGun & itConsumption . ammoLoaded .~ 0
miniGun :: Item
+85 -2
View File
@@ -1,6 +1,9 @@
module Dodge.Item.Weapon.BulletGuns
( bangCone
, blunderbuss
, bigBlunderbuss
, biggerBlunderbuss
, biggestBlunderbuss
, grapeShotCannon
, grenadeLauncher
, spreadGun
@@ -100,7 +103,6 @@ autoGunPic it = noPic $
where
x = fromIntegral $ _ammoLoaded $ _itConsumption it
bangCone :: Item
bangCone = defaultGun
{ _itName = "BANGCONE"
@@ -117,12 +119,13 @@ bangCone = defaultGun
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, torqueAfterI 0.6
, torqueAfterI 0.1
, withRecoilI 150
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffsetI 12
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
& useAim . aimSpeed .~ 0.4
@@ -144,6 +147,10 @@ bangCone = defaultGun
}
, _itTweaks = defaultBulletSelTweak
}
coneRandItemUpdate :: State StdGen (Item -> Item)
coneRandItemUpdate = do
wth <- state $ randomR (1,5)
return (\it -> it & itConsumption . aoType . amBulWth .~ wth)
coneRandItemParams :: State StdGen ItemParams
coneRandItemParams = do
muzv <- state $ randomR (0.5,1)
@@ -171,6 +178,7 @@ blunderbuss = bangCone
, withMuzFlareI
, applyInaccuracy
, withRandomOffsetI 12
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
& useAim . aimStance .~ TwoHandTwist
@@ -186,6 +194,80 @@ blunderbuss = bangCone
<> upperPrismPoly 6 (rectNSEW 4 (-4) 30 20)
}
}
& itConsumption . ammoMax .~ 25
& itConsumption . reloadTime .~ 30
bigBlunderbuss :: Item
bigBlunderbuss = blunderbuss
{_itName = "BIGBLUNDERBUSS"
,_itType = BIGBLUNDERBUSS
,_itUse = useAmmoParamsRate 20 upHammer
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, torqueAfterI 0.3
, withRecoilI 200
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffsetI 16
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
& useAim . aimStance .~ TwoHandTwist
& useAim . aimSpeed .~ 0.4
}
& itConsumption . ammoMax .~ 50
& itConsumption . reloadTime .~ 36
biggerBlunderbuss :: Item
biggerBlunderbuss = bigBlunderbuss
{_itName = "BIGGERBLUNDERBUSS"
,_itType = BIGGERBLUNDERBUSS
,_itUse = useAmmoParamsRate 20 upHammer
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, torqueAfterI 0.5
, withRecoilI 250
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffsetI 20
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
& useAim . aimStance .~ TwoHandTwist
& useAim . aimSpeed .~ 0.4
}
& itConsumption . ammoMax .~ 75
& itConsumption . reloadTime .~ 43
biggestBlunderbuss :: Item
biggestBlunderbuss = biggerBlunderbuss
{_itName = "BIGGESTBLUNDERBUSS"
,_itType = BIGGESTBLUNDERBUSS
,_itUse = useAmmoParamsRate 20 upHammer
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, torqueAfterI 0.7
, withRecoilI 300
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffsetI 24
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
& useAim . aimStance .~ TwoHandTwist
& useAim . aimSpeed .~ 0.4
}
& itConsumption . ammoMax .~ 100
& itConsumption . reloadTime .~ 50
grapeShotCannon :: Item
grapeShotCannon = blunderbuss
@@ -203,6 +285,7 @@ grapeShotCannon = blunderbuss
, withMuzFlareI
, applyInaccuracy
, withRandomOffsetI 12
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
& useAim . aimStance .~ TwoHandTwist
+28
View File
@@ -15,7 +15,9 @@ module Dodge.Item.Weapon.TriggerType
, torqueBefore
, torqueBeforeAtLeast
, torqueAfterI
, torqueSideEffect
, withRandomItemParams
, withRandomItemUpdate
, withSoundStart
, withSoundItemChoiceStart
, withSoundContinue
@@ -33,6 +35,7 @@ module Dodge.Item.Weapon.TriggerType
, spreadNumI
, spreadLoaded
, repeatOnFrames
, sideEffectOnFrame
-- , numBarrels
, duplicateLoadedBarrels
, duplicateLoaded
@@ -381,6 +384,13 @@ withOldDir
withOldDir aFrac eff item cr
= eff item (cr & crDir %~ tweenAngles aFrac (_crOldDir cr))
withRandomItemUpdate
:: State StdGen (Item -> Item)
-> ChainEffect
withRandomItemUpdate randItUp eff it cr w = eff (f it) cr $ w & randGen .~ g
where
(f,g) = runState randItUp (_randGen w)
withRandomItemParams
:: State StdGen ItemParams
-> ChainEffect
@@ -458,6 +468,24 @@ spreadLoaded eff item cr w = foldr f w dirs
spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
numBulLoaded = _ammoLoaded $ _itConsumption item
sideEffectOnFrame :: Int
-> (Item -> Creature -> World -> World)
-> ChainEffect
sideEffectOnFrame i sf f it cr w = f it cr w
& delayedEvents .:~ (i, f')
where
f' w' = fromMaybe w' $ do
cr' <- w' ^? creatures . ix (_crID cr)
return $ sf it cr' w'
torqueSideEffect :: Float -> Item -> Creature -> World -> World
torqueSideEffect torque _ cr w
| cid == 0 = set randGen g $ over cameraRot (+rot) w
| otherwise = set randGen g $ over (creatures . ix cid . crDir) (+rot) w
where
cid = _crID cr
(rot, g) = randomR (-torque,torque) $ _randGen w
-- pump the updated creature into the chain in later frames
repeatOnFrames :: [Int] -> ChainEffect
repeatOnFrames is f it cr w = f it cr w