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 Multiset
import Dodge.Item.Weapon.BulletGuns
import Dodge.Item.Craftable
--import Dodge.Item.Craftable
import Control.Lens
import Data.Bifunctor
@@ -18,14 +18,19 @@ import Data.List (scanl')
itemCombinations :: [ (M.Map CombineType Int, Item) ]
itemCombinations = map (first toMultiset) $
[ p [PIPE,HARDWARE] (bangStick 1)
, p [LONGPIPE,HARDWARE] bangCane
, p [VERYLONGPIPE,HARDWARE] bangRod
, p [PIPE,PIPE] $ makeTypeCraft LONGPIPE
, p [LONGPIPE,PIPE] $ makeTypeCraft VERYLONGPIPE
, p [PIPE,PIPE,HARDWARE] bangCane
, p [PIPE,PIPE,PIPE,HARDWARE] bangRod
, p [BANGSTICK 1,CAN] revolver
, 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 [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 -> ([REVOLVERX i,CAN] ,revolverX (i+1))) [1..6]
+18 -3
View File
@@ -6,14 +6,24 @@ data CombineType
= NOTDEFINED
-- Weapons
| BANGSTICK Int
| BANGCANE
| BANGROD
| PISTOL
| REVOLVER
| REVOLVERX Int
| HVAUTOGUN
| LTAUTOGUN
| MACHINEPISTOL
| AUTOPISTOL
| SMG
| BANGCONE
| BLUNDERBUSS
| GRAPESHOTCANNON
| GRENADELAUNCHER Int -- number of chambers that can be reloaded
| MORTAR
| MINIGUN
| BANGCANE
| BANGCANEX Int
| RIFLE
| AUTOGUN
| SPREADGUN
| MULTGUN
@@ -42,13 +52,18 @@ data CombineType
| JETPACK
-- Crafting
| PIPE
| LONGPIPE
| VERYLONGPIPE
| TUBE
| HARDWARE
| SPRING
| CAN
| TIN
| DRUM
| PLANK
| SHARDGLASS
| PUMP
| MOTOR
| PRISM
| MAGNET
| TPipe
| NoCombineType
| TLongPipe
+4 -5
View File
@@ -171,18 +171,17 @@ startInventory = IM.fromList $ zip [0..] startInvList
testInventory :: IM.IntMap Item
testInventory = IM.fromList $ zip [0..]
[ makeTypeCraftNum 9 PIPE
, makeTypeCraftNum 3 TUBE
, makeTypeCraftNum 5 HARDWARE
, makeTypeCraftNum 3 SPRING
, makeTypeCraft CAN
, makeTypeCraft TIN
, makeTypeCraftNum 3 CAN
, makeTypeCraftNum 3 TIN
, makeTypeCraftNum 3 PLANK
]
stackedInventory :: IM.IntMap Item
stackedInventory = IM.fromList $ zip [0..]
[spreadGun
, pipe
, makeTypeCraft LONGPIPE
, makeTypeCraft VERYLONGPIPE
, makeTypeCraft HARDWARE
,rewindGun
,tractorGun
,longGun
+1 -6
View File
@@ -4,6 +4,7 @@ module Dodge.Item.Attachment
, changeFuse
) where
import Dodge.Data
import Dodge.ChainEffect
import Dodge.Default
import Control.Lens hiding ((|>),(<|))
@@ -38,12 +39,6 @@ decCharMode = itAttachment . itCharMode %~ cycleR
cycleR (xs :|> x) = x <| xs
cycleR xs = xs
type ChainEffect =
(Item -> Creature -> World -> World)
-> Item
-> Creature
-> World
-> World
charFiringStratI
:: [(Char, ChainEffect)] -- ^ Different firing effects for different characters
-> ChainEffect
+161 -10
View File
@@ -1,5 +1,8 @@
module Dodge.Item.Weapon.BulletGuns
( pistol
, autoPistol
, machinePistol
, smg
, revolver
, revolverX
, bangStick
@@ -8,6 +11,10 @@ module Dodge.Item.Weapon.BulletGuns
, autoGun
, multGun
, miniGun
, bangCone
, blunderbuss
, grapeShotCannon
, grenadeLauncher
, spreadGun
, ltAutoGun
, hvAutoGun
@@ -17,6 +24,7 @@ module Dodge.Item.Weapon.BulletGuns
)
where
import Dodge.Data
import Dodge.ChainEffect
import Dodge.TweakBullet
import Dodge.Default.Weapon
import Dodge.Item.Weapon.InventoryDisplay
@@ -33,10 +41,13 @@ import Picture
import Geometry
import ShapePicture
import Shape
import Sound.Data
import Data.Maybe
import qualified Data.Sequence as Seq
import Control.Lens
import Control.Monad.State
import System.Random
autoGun :: Item
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))
where
x = fromIntegral $ _ammoLoaded $ _itConsumption it
bangStickSoundChoice :: Item -> SoundID
bangStickSoundChoice it
| _ammoLoaded (_itConsumption it) < 2 = tap3S
| otherwise = shotgunS
bangStick :: Int -> Item
bangStick i = defaultGun
{ _itName = case i of
@@ -106,7 +123,7 @@ bangStick i = defaultGun
, _itUse = useAmmoParamsRate 8 upHammer
[ ammoHammerCheck
, useTimeCheck
, withSoundStart tap3S
, withSoundItemChoiceStart bangStickSoundChoice
, useAllAmmo
-- , applyInaccuracy
, withMuzFlareI
@@ -176,6 +193,98 @@ revolverX i = revolver
, withRecoilI 25
]
} & 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 = 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 = defaultGun
{ _itName = "PISTOL"
@@ -198,17 +341,11 @@ pistol = defaultGun
{ _aoType = basicBullet
, _ammoMax = 15
, _ammoLoaded = 0
, _reloadTime = 90
, _reloadTime = 70
, _reloadType = ActiveClear
}
, _itUse = useAmmoParamsRate 8 upHammer
[ ammoHammerCheck
, useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, withMuzFlareI
]
, _itUse = useAmmoParamsRate 6 upHammer
(ammoHammerCheck : pistolAfterHamMods)
, _itFloorPict = pistolPic
-- , _itZoom = defaultItZoom
, _itEquipPict = pictureWeaponAim pistolPic
@@ -277,6 +414,20 @@ hvAutoGunPic it =
)
where
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 = defaultAutoGun
{ _itName = "AUTO-LT"
+26
View File
@@ -15,7 +15,9 @@ module Dodge.Item.Weapon.TriggerType
, torqueBefore
, torqueBeforeAtLeast
, torqueAfterI
, withRandomItemParams
, withSoundStart
, withSoundItemChoiceStart
, withSoundContinue
, withSoundForI
, withSmoke
@@ -33,6 +35,7 @@ module Dodge.Item.Weapon.TriggerType
, repeatOnFrames
-- , numBarrels
, duplicateLoadedBarrels
, duplicateLoaded
, randWalkAngle -- ^ should be made into a modifier, perhaps
, hammerCheckI
, hammerCheckL
@@ -178,6 +181,15 @@ withWarmUp soundID f item cr w
pointerToItem = creatures . ix cid . crInv . ix itRef
curWarmUp = _warmTime . _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.
The sound is emitted from the creature's position. -}
withSoundStart
@@ -368,6 +380,14 @@ withOldDir
-> ChainEffect
withOldDir aFrac eff item 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. -}
withRandomOffsetI
:: Float -- ^ Max possible translate
@@ -453,6 +473,12 @@ repeatOnFrames is f it cr w = f it cr w
cr' <- w' ^? creatures . ix (_crID cr)
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 eff item cr w = foldr f w poss
where