Add bangcone

This commit is contained in:
2021-12-04 18:52:03 +00:00
parent cb670bdfd8
commit cbf344e73e
6 changed files with 221 additions and 30 deletions
+11 -6
View File
@@ -5,7 +5,7 @@ import Dodge.Data
--import Dodge.Combine.Data --import Dodge.Combine.Data
import Multiset import Multiset
import Dodge.Item.Weapon.BulletGuns import Dodge.Item.Weapon.BulletGuns
import Dodge.Item.Craftable --import Dodge.Item.Craftable
import Control.Lens import Control.Lens
import Data.Bifunctor import Data.Bifunctor
@@ -18,14 +18,19 @@ import Data.List (scanl')
itemCombinations :: [ (M.Map CombineType Int, Item) ] itemCombinations :: [ (M.Map CombineType Int, Item) ]
itemCombinations = map (first toMultiset) $ itemCombinations = map (first toMultiset) $
[ p [PIPE,HARDWARE] (bangStick 1) [ p [PIPE,HARDWARE] (bangStick 1)
, p [LONGPIPE,HARDWARE] bangCane , p [PIPE,PIPE,HARDWARE] bangCane
, p [VERYLONGPIPE,HARDWARE] bangRod , p [PIPE,PIPE,PIPE,HARDWARE] bangRod
, p [PIPE,PIPE] $ makeTypeCraft LONGPIPE
, p [LONGPIPE,PIPE] $ makeTypeCraft VERYLONGPIPE
, p [BANGSTICK 1,CAN] revolver , p [BANGSTICK 1,CAN] revolver
, p [BANGSTICK 1,TIN] pistol , p [BANGSTICK 1,TIN] pistol
, p [PISTOL, SPRING, HARDWARE] ltAutoGun , p [PISTOL, SPRING, HARDWARE] autoPistol
, p [AUTOPISTOL, PLANK, HARDWARE] smg
, p [AUTOPISTOL, HARDWARE] machinePistol
, p [REVOLVER, SPRING, HARDWARE] $ revolverX 1 , p [REVOLVER, SPRING, HARDWARE] $ revolverX 1
, p [PIPE,TUBE,HARDWARE] bangCone
, p [BANGCONE,PLANK] blunderbuss
, p [BANGCONE,PUMP,HARDWARE] $ grenadeLauncher 1
, p [GRENADELAUNCHER 1,MOTOR,DRUM] $ grenadeLauncher 2
, p [BLUNDERBUSS,TUBE] grapeShotCannon
] ]
++ map (\i -> ([PIPE,BANGSTICK i],bangStick (i+1))) [1..8] ++ map (\i -> ([PIPE,BANGSTICK i],bangStick (i+1))) [1..8]
++ map (\i -> ([REVOLVERX i,CAN] ,revolverX (i+1))) [1..6] ++ map (\i -> ([REVOLVERX i,CAN] ,revolverX (i+1))) [1..6]
+18 -3
View File
@@ -6,14 +6,24 @@ data CombineType
= NOTDEFINED = NOTDEFINED
-- Weapons -- Weapons
| BANGSTICK Int | BANGSTICK Int
| BANGCANE
| BANGROD | BANGROD
| PISTOL | PISTOL
| REVOLVER | REVOLVER
| REVOLVERX Int | REVOLVERX Int
| HVAUTOGUN | HVAUTOGUN
| LTAUTOGUN | LTAUTOGUN
| MACHINEPISTOL
| AUTOPISTOL
| SMG
| BANGCONE
| BLUNDERBUSS
| GRAPESHOTCANNON
| GRENADELAUNCHER Int -- number of chambers that can be reloaded
| MORTAR
| MINIGUN | MINIGUN
| BANGCANE
| BANGCANEX Int
| RIFLE
| AUTOGUN | AUTOGUN
| SPREADGUN | SPREADGUN
| MULTGUN | MULTGUN
@@ -42,13 +52,18 @@ data CombineType
| JETPACK | JETPACK
-- Crafting -- Crafting
| PIPE | PIPE
| LONGPIPE | TUBE
| VERYLONGPIPE
| HARDWARE | HARDWARE
| SPRING | SPRING
| CAN | CAN
| TIN | TIN
| DRUM | DRUM
| PLANK
| SHARDGLASS
| PUMP
| MOTOR
| PRISM
| MAGNET
| TPipe | TPipe
| NoCombineType | NoCombineType
| TLongPipe | TLongPipe
+4 -5
View File
@@ -171,18 +171,17 @@ startInventory = IM.fromList $ zip [0..] startInvList
testInventory :: IM.IntMap Item testInventory :: IM.IntMap Item
testInventory = IM.fromList $ zip [0..] testInventory = IM.fromList $ zip [0..]
[ makeTypeCraftNum 9 PIPE [ makeTypeCraftNum 9 PIPE
, makeTypeCraftNum 3 TUBE
, makeTypeCraftNum 5 HARDWARE , makeTypeCraftNum 5 HARDWARE
, makeTypeCraftNum 3 SPRING , makeTypeCraftNum 3 SPRING
, makeTypeCraft CAN , makeTypeCraftNum 3 CAN
, makeTypeCraft TIN , makeTypeCraftNum 3 TIN
, makeTypeCraftNum 3 PLANK
] ]
stackedInventory :: IM.IntMap Item stackedInventory :: IM.IntMap Item
stackedInventory = IM.fromList $ zip [0..] stackedInventory = IM.fromList $ zip [0..]
[spreadGun [spreadGun
, pipe , pipe
, makeTypeCraft LONGPIPE
, makeTypeCraft VERYLONGPIPE
, makeTypeCraft HARDWARE
,rewindGun ,rewindGun
,tractorGun ,tractorGun
,longGun ,longGun
+1 -6
View File
@@ -4,6 +4,7 @@ module Dodge.Item.Attachment
, changeFuse , changeFuse
) where ) where
import Dodge.Data import Dodge.Data
import Dodge.ChainEffect
import Dodge.Default import Dodge.Default
import Control.Lens hiding ((|>),(<|)) import Control.Lens hiding ((|>),(<|))
@@ -38,12 +39,6 @@ decCharMode = itAttachment . itCharMode %~ cycleR
cycleR (xs :|> x) = x <| xs cycleR (xs :|> x) = x <| xs
cycleR xs = xs cycleR xs = xs
type ChainEffect =
(Item -> Creature -> World -> World)
-> Item
-> Creature
-> World
-> World
charFiringStratI charFiringStratI
:: [(Char, ChainEffect)] -- ^ Different firing effects for different characters :: [(Char, ChainEffect)] -- ^ Different firing effects for different characters
-> ChainEffect -> ChainEffect
+161 -10
View File
@@ -1,5 +1,8 @@
module Dodge.Item.Weapon.BulletGuns module Dodge.Item.Weapon.BulletGuns
( pistol ( pistol
, autoPistol
, machinePistol
, smg
, revolver , revolver
, revolverX , revolverX
, bangStick , bangStick
@@ -8,6 +11,10 @@ module Dodge.Item.Weapon.BulletGuns
, autoGun , autoGun
, multGun , multGun
, miniGun , miniGun
, bangCone
, blunderbuss
, grapeShotCannon
, grenadeLauncher
, spreadGun , spreadGun
, ltAutoGun , ltAutoGun
, hvAutoGun , hvAutoGun
@@ -17,6 +24,7 @@ module Dodge.Item.Weapon.BulletGuns
) )
where where
import Dodge.Data import Dodge.Data
import Dodge.ChainEffect
import Dodge.TweakBullet import Dodge.TweakBullet
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.Item.Weapon.InventoryDisplay import Dodge.Item.Weapon.InventoryDisplay
@@ -33,10 +41,13 @@ import Picture
import Geometry import Geometry
import ShapePicture import ShapePicture
import Shape import Shape
import Sound.Data
import Data.Maybe import Data.Maybe
import qualified Data.Sequence as Seq import qualified Data.Sequence as Seq
import Control.Lens import Control.Lens
import Control.Monad.State
import System.Random
autoGun :: Item autoGun :: Item
autoGun = defaultAutoGun autoGun = defaultAutoGun
@@ -91,6 +102,12 @@ autoGunPic it = noPic $
<> translateSHf 0 (-1) (rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW (negate $ 3 + 0.25 * x) 0 3 (-5)) <> translateSHf 0 (-1) (rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW (negate $ 3 + 0.25 * x) 0 3 (-5))
where where
x = fromIntegral $ _ammoLoaded $ _itConsumption it x = fromIntegral $ _ammoLoaded $ _itConsumption it
bangStickSoundChoice :: Item -> SoundID
bangStickSoundChoice it
| _ammoLoaded (_itConsumption it) < 2 = tap3S
| otherwise = shotgunS
bangStick :: Int -> Item bangStick :: Int -> Item
bangStick i = defaultGun bangStick i = defaultGun
{ _itName = case i of { _itName = case i of
@@ -106,7 +123,7 @@ bangStick i = defaultGun
, _itUse = useAmmoParamsRate 8 upHammer , _itUse = useAmmoParamsRate 8 upHammer
[ ammoHammerCheck [ ammoHammerCheck
, useTimeCheck , useTimeCheck
, withSoundStart tap3S , withSoundItemChoiceStart bangStickSoundChoice
, useAllAmmo , useAllAmmo
-- , applyInaccuracy -- , applyInaccuracy
, withMuzFlareI , withMuzFlareI
@@ -176,6 +193,98 @@ revolverX i = revolver
, withRecoilI 25 , withRecoilI 25
] ]
} & itConsumption . ammoMax .~ i * 6 } & itConsumption . ammoMax .~ i * 6
bangCone :: Item
bangCone = defaultGun
{ _itName = "BANGCONE"
, _itCombineType = BANGCONE
, _itConsumption = defaultAmmo
{ _aoType = basicBullet
, _ammoMax = 5
, _reloadTime = 25
, _reloadType = ActiveClear
}
, _itUse = useAmmoParamsRate 20 upHammer
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, torqueAfterI 0.6
, withRecoilI 150
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffsetI 12
, withRandomItemParams coneRandItemParams
]
& useAim . aimSpeed .~ 0.4
, _itParams = BulletShooter
{ _muzVel = 0.7
, _rifling = 0.8
, _bore = 5
, _gunBarrels = SingleBarrel 0.5
}
, _itFloorPict = spreadGunPic
, _itTweaks = defaultBulletSelTweak
}
coneRandItemParams :: State StdGen ItemParams
coneRandItemParams = do
muzv <- state $ randomR (0.5,1)
rifl <- state $ randomR (0.3,0.9)
return $ BulletShooter
{ _muzVel = muzv
, _rifling = rifl
, _bore = 5
, _gunBarrels = SingleBarrel 0.5
}
blunderbuss :: Item
blunderbuss = bangCone
{_itName = "BLUNDERBUSS"
,_itCombineType = BLUNDERBUSS
,_itUse = useAmmoParamsRate 20 upHammer
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, torqueAfterI 0.1
, withRecoilI 150
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffsetI 12
, withRandomItemParams coneRandItemParams
]
& useAim . aimStance .~ TwoHandTwist
}
grapeShotCannon :: Item
grapeShotCannon = blunderbuss
{_itName = "GRAPESHOTCANNON"
,_itCombineType = GRAPESHOTCANNON
,_itUse = useAmmoParamsRate 20 upHammer
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, torqueAfterI 0.1
, withRecoilI 150
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffsetI 12
, withRandomItemParams coneRandItemParams
]
& useAim . aimStance .~ TwoHandTwist
}
& itConsumption . ammoMax .~ 15
& itConsumption . reloadTime .~ 30
grenadeLauncher :: Int -> Item
grenadeLauncher _ = bangCone
revolver :: Item revolver :: Item
revolver = pistol revolver = pistol
@@ -190,6 +299,40 @@ revolver = pistol
} }
} }
pistolAfterHamMods :: [ChainEffect]
pistolAfterHamMods =
[ useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, torqueAfterI 0.2
, withRecoilI 10
, withSidePushI 50
, withMuzFlareI
]
machinePistolAfterHamMods :: [ChainEffect]
machinePistolAfterHamMods =
[ useTimeCheck
, useAmmoAmount 1
, withSoundStart tap1S
, applyInaccuracy
, torqueAfterI 0.3
, withSidePushI 50
, withRecoilI 20
, withMuzFlareI
]
smgAfterHamMods :: [ChainEffect]
smgAfterHamMods =
[ useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, torqueAfterI 0.05
, withRecoilI 10
, withSidePushI 30
, withMuzFlareI
]
pistol :: Item pistol :: Item
pistol = defaultGun pistol = defaultGun
{ _itName = "PISTOL" { _itName = "PISTOL"
@@ -198,17 +341,11 @@ pistol = defaultGun
{ _aoType = basicBullet { _aoType = basicBullet
, _ammoMax = 15 , _ammoMax = 15
, _ammoLoaded = 0 , _ammoLoaded = 0
, _reloadTime = 90 , _reloadTime = 70
, _reloadType = ActiveClear , _reloadType = ActiveClear
} }
, _itUse = useAmmoParamsRate 8 upHammer , _itUse = useAmmoParamsRate 6 upHammer
[ ammoHammerCheck (ammoHammerCheck : pistolAfterHamMods)
, useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, withMuzFlareI
]
, _itFloorPict = pistolPic , _itFloorPict = pistolPic
-- , _itZoom = defaultItZoom -- , _itZoom = defaultItZoom
, _itEquipPict = pictureWeaponAim pistolPic , _itEquipPict = pictureWeaponAim pistolPic
@@ -277,6 +414,20 @@ hvAutoGunPic it =
) )
where where
am = _ammoLoaded $ _itConsumption it am = _ammoLoaded $ _itConsumption it
autoPistol :: Item
autoPistol = pistol & itUse . useMods .~ (ammoCheckI : pistolAfterHamMods)
& itName .~ "AUTOPISTOL"
& itCombineType .~ AUTOPISTOL
machinePistol :: Item
machinePistol = autoPistol & itUse . useDelay . rateMax .~ 2
& itUse . useMods .~ (ammoCheckI : machinePistolAfterHamMods)
& itName .~ "MACHINEPISTOL"
& itCombineType .~ MACHINEPISTOL
smg :: Item
smg = autoPistol -- & some parameter affecting stability
& itUse . useMods .~ (ammoCheckI : smgAfterHamMods)
& itName .~ "SMG"
& itCombineType .~ SMG
ltAutoGun :: Item ltAutoGun :: Item
ltAutoGun = defaultAutoGun ltAutoGun = defaultAutoGun
{ _itName = "AUTO-LT" { _itName = "AUTO-LT"
+26
View File
@@ -15,7 +15,9 @@ module Dodge.Item.Weapon.TriggerType
, torqueBefore , torqueBefore
, torqueBeforeAtLeast , torqueBeforeAtLeast
, torqueAfterI , torqueAfterI
, withRandomItemParams
, withSoundStart , withSoundStart
, withSoundItemChoiceStart
, withSoundContinue , withSoundContinue
, withSoundForI , withSoundForI
, withSmoke , withSmoke
@@ -33,6 +35,7 @@ module Dodge.Item.Weapon.TriggerType
, repeatOnFrames , repeatOnFrames
-- , numBarrels -- , numBarrels
, duplicateLoadedBarrels , duplicateLoadedBarrels
, duplicateLoaded
, randWalkAngle -- ^ should be made into a modifier, perhaps , randWalkAngle -- ^ should be made into a modifier, perhaps
, hammerCheckI , hammerCheckI
, hammerCheckL , hammerCheckL
@@ -178,6 +181,15 @@ withWarmUp soundID f item cr w
pointerToItem = creatures . ix cid . crInv . ix itRef pointerToItem = creatures . ix cid . crInv . ix itRef
curWarmUp = _warmTime . _useDelay $ _itUse item curWarmUp = _warmTime . _useDelay $ _itUse item
maxWarmUp = _warmMax . _useDelay $ _itUse item maxWarmUp = _warmMax . _useDelay $ _itUse item
withSoundItemChoiceStart
:: (Item -> SoundID)
-> ChainEffect
withSoundItemChoiceStart soundf f it cr
= soundMultiFrom [CrWeaponSound cid 0,CrWeaponSound cid 1,CrWeaponSound cid 2] (_crPos cr)
(soundf it) Nothing
. f it cr
where
cid = _crID cr
{- | Adds a sound to a creature based world effect. {- | Adds a sound to a creature based world effect.
The sound is emitted from the creature's position. -} The sound is emitted from the creature's position. -}
withSoundStart withSoundStart
@@ -368,6 +380,14 @@ withOldDir
-> ChainEffect -> ChainEffect
withOldDir aFrac eff item cr withOldDir aFrac eff item cr
= eff item (cr & crDir %~ tweenAngles aFrac (_crOldDir cr)) = eff item (cr & crDir %~ tweenAngles aFrac (_crOldDir cr))
withRandomItemParams
:: State StdGen ItemParams
-> ChainEffect
withRandomItemParams rip eff it cr w = eff (it & itParams .~ it') cr $ w & randGen .~ g
where
(it',g) = runState rip (_randGen w)
{- | Apply the effect to a translated creature. -} {- | Apply the effect to a translated creature. -}
withRandomOffsetI withRandomOffsetI
:: Float -- ^ Max possible translate :: Float -- ^ Max possible translate
@@ -453,6 +473,12 @@ repeatOnFrames is f it cr w = f it cr w
cr' <- w' ^? creatures . ix (_crID cr) cr' <- w' ^? creatures . ix (_crID cr)
return $ f it cr' w' return $ f it cr' w'
duplicateLoaded :: ChainEffect
duplicateLoaded eff it cr w = foldr f w [1..numBul]
where
f _ = eff it cr
numBul = _ammoLoaded $ _itConsumption it
duplicateLoadedBarrels :: ChainEffect duplicateLoadedBarrels :: ChainEffect
duplicateLoadedBarrels eff item cr w = foldr f w poss duplicateLoadedBarrels eff item cr w = foldr f w poss
where where