288 lines
8.7 KiB
Haskell
288 lines
8.7 KiB
Haskell
module Dodge.Item.Weapon.BulletGun.Cane
|
|
( bangCane
|
|
, bangCaneX
|
|
, rifle
|
|
, autoRifle
|
|
, assaultRifle
|
|
, miniGun
|
|
) where
|
|
import Dodge.Item.Weapon.BulletGun.Clip
|
|
import Dodge.Data
|
|
--import Dodge.ChainEffect
|
|
import Dodge.TweakBullet
|
|
import Dodge.Default.Weapon
|
|
import Dodge.Item.Weapon.InventoryDisplay
|
|
import Dodge.Default
|
|
--import Dodge.Item.Attachment
|
|
--import Dodge.Item.Weapon.ExtraEffect
|
|
--import Dodge.Item.Weapon.InventoryDisplay
|
|
import Dodge.Item.Weapon.AmmoParams
|
|
import Dodge.Item.Draw
|
|
import Dodge.Item.Weapon.Bullet
|
|
import Dodge.Item.Weapon.TriggerType
|
|
import Dodge.SoundLogic.LoadSound
|
|
import Picture
|
|
import Geometry
|
|
import ShapePicture
|
|
import Shape
|
|
import Sound.Data
|
|
import LensHelp
|
|
|
|
import Data.Maybe
|
|
--import qualified Data.Sequence as Seq
|
|
--import Control.Lens
|
|
--import Control.Monad.State
|
|
--import System.Random
|
|
|
|
bangCane :: Item
|
|
bangCane = defaultGun
|
|
{ _itName = "BANGCANE"
|
|
, _itType = BANGCANE
|
|
,_itParams = BulletShooter
|
|
{ _muzVel = 0.8
|
|
, _rifling = 0.9
|
|
, _bore = 2
|
|
, _gunBarrels = SingleBarrel 0.1
|
|
}
|
|
, _itConsumption = defaultAmmo
|
|
{ _aoType = basicBullet
|
|
, _ammoMax = 1
|
|
, _reloadTime = 20
|
|
, _reloadType = ActivePartial 1
|
|
}
|
|
, _itUse = useAmmoParamsRate 6 upHammer
|
|
[ ammoHammerCheck
|
|
, useTimeCheck
|
|
, withSoundStart tap3S
|
|
, useAmmoAmount 1
|
|
, torqueAfterI 0.1
|
|
, applyInaccuracy
|
|
, withMuzFlareI
|
|
, withRecoilI 50
|
|
]
|
|
, _itTweaks = defaultBulletSelTweak
|
|
, _itDimension = ItemDimension
|
|
{ _dimRad = 8
|
|
, _dimCenter = V3 5 0 0
|
|
, _dimPortage = HeldItem
|
|
{_handlePos = 5
|
|
,_muzPos = 20
|
|
}
|
|
, _dimSPic = \it -> noPic $ baseCaneShape
|
|
<> caneClip it
|
|
}
|
|
} & itUse . useAim . aimSpeed .~ 0.4
|
|
& itUse . useAim . aimRange .~ 1
|
|
& itUse . useAim . aimStance .~ OneHand
|
|
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
|
caneClip :: Item -> Shape
|
|
caneClip it = case it ^? itConsumption . ammoLoaded of
|
|
Just 0 -> mempty
|
|
_ -> translateSH (V3 5 0 3) $ upperPrismPoly 1 $ square 1.5
|
|
bangCaneX :: Int -> Item
|
|
bangCaneX i = bangCane
|
|
{ _itName = "BANGCANEx"++show i
|
|
, _itType = BANGCANEX i
|
|
, _itUse = useAmmoParamsRate 6 upHammer
|
|
[ ammoHammerCheck
|
|
, useTimeCheck
|
|
, withSoundItemChoiceStart caneStickSoundChoice
|
|
, useAllAmmo
|
|
, torqueAfterI 0.5
|
|
, duplicateLoadedBarrels
|
|
, applyInaccuracy
|
|
, withMuzFlareI
|
|
, withRecoilI 50
|
|
]
|
|
, _itDimension = ItemDimension
|
|
{ _dimRad = 8
|
|
, _dimCenter = V3 5 0 0
|
|
, _dimPortage = HeldItem
|
|
{_handlePos = 5
|
|
,_muzPos = 15
|
|
}
|
|
, _dimSPic = \it -> noPic $
|
|
(colorSH red $ foldMap
|
|
(\y -> upperPrismPoly 3 $ map (+.+ V2 0 y) $ rectXH 15 2)
|
|
$ map (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5)) [0..i-1]
|
|
) <> caneClipX i it
|
|
}
|
|
} & itUse . useAim . aimSpeed .~ 0.4
|
|
& itUse . useAim . aimRange .~ 1
|
|
& itUse . useAim . aimStance .~ TwoHandFlat
|
|
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
|
& itConsumption . ammoMax .~ i
|
|
& itParams . gunBarrels .~ MultiBarrel
|
|
{_brlSpread = AlignedBarrels
|
|
,_brlNum = i
|
|
,_brlInaccuracy = 0.1
|
|
}
|
|
caneStickSoundChoice :: Item -> SoundID
|
|
caneStickSoundChoice it
|
|
| _ammoLoaded (_itConsumption it) < 2 = tap3S
|
|
| otherwise = shotgunS
|
|
caneClipX :: Int -> Item -> Shape
|
|
caneClipX i it = case it ^? itConsumption . ammoLoaded of
|
|
Just la | la > 0 -> foldMap
|
|
(\y -> translateSH (V3 5 0 3) . upperPrismPoly 1 $ map (+.+ V2 0 y) $ square 1.5)
|
|
$ map (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5)) [0..la-1]
|
|
_ -> mempty
|
|
|
|
|
|
rifle :: Item
|
|
rifle = bangCane
|
|
{ _itDimension = ItemDimension
|
|
{ _dimRad = 8
|
|
, _dimCenter = V3 5 0 0
|
|
, _dimPortage = HeldItem
|
|
{_handlePos = 5
|
|
,_muzPos = 25
|
|
}
|
|
, _dimSPic = \it -> noPic $ baseCaneShape
|
|
<> makeClipAt 0 (V3 10 (-2) 0) it
|
|
}
|
|
}
|
|
& itUse . useAim . aimStance .~ TwoHandTwist
|
|
& itName .~ "RIFLE"
|
|
& itType .~ RIFLE
|
|
& itConsumption . ammoMax .~ 15
|
|
& itConsumption . reloadType .~ ActiveClear
|
|
& itConsumption . reloadTime .~ 80
|
|
|
|
baseCaneShape :: Shape
|
|
baseCaneShape = colorSH red $ upperPrismPoly 3 $ rectXH 15 2
|
|
|
|
|
|
autoRifle :: Item
|
|
autoRifle = rifle
|
|
& itName .~ "AUTORIFLE"
|
|
& itType .~ AUTORIFLE
|
|
& itUse . useMods %~ ((ammoCheckI :) . tail)
|
|
-- & itUse . useDelay . rateMax .~ 6
|
|
assaultRifle :: Item
|
|
assaultRifle = rifle
|
|
& itName .~ "ASSAULTRIFLE"
|
|
& itType .~ ASSAULTRIFLE
|
|
& itUse . useDelay . rateMax .~ 18
|
|
& itUse . useMods .~
|
|
[ ammoHammerCheck
|
|
, useTimeCheck
|
|
, torqueAfterI 0.2
|
|
, lockInvFor 10
|
|
, \f it -> repeatOnFrames (take (_ammoLoaded (_itConsumption it) - 1) [3,6]) f it
|
|
, withSoundStart tap3S
|
|
, useAmmoAmount 1
|
|
, applyInaccuracy
|
|
, withMuzFlareI
|
|
, withRecoilI 50
|
|
]
|
|
miniGun :: Item
|
|
miniGun = defaultAutoGun
|
|
{ _itName = "MINIGUN"
|
|
, _itType = MINIGUN
|
|
, _itConsumption = defaultAmmo
|
|
{ _aoType = basicBullet
|
|
, _ammoMax = 1500
|
|
, _ammoLoaded = 1500
|
|
, _reloadTime = 200
|
|
}
|
|
, _itUse = ruseInstant (useAmmoParamsVelMod vm4) NoHammer
|
|
[ ammoCheckI
|
|
, withWarmUp crankSlowS
|
|
--, afterRecoil recoilAmount
|
|
, withSoundForI mini1S 2
|
|
--, withThinSmokeI
|
|
, torqueAfterI 0.05
|
|
, withSidePushI 53
|
|
, afterRecoil recoilAmount
|
|
, withRandomOffsetI 12
|
|
, trigDoAlso (useAmmoParamsVelMod vm1)
|
|
--, torqueBeforeForcedI 0.001
|
|
, withSidePushI 52
|
|
, afterRecoil recoilAmount
|
|
, withRandomOffsetI 11
|
|
, withOldDir od1
|
|
, trigDoAlso (useAmmoParamsVelMod vm2)
|
|
--, torqueBeforeForcedI 0.001
|
|
, withSidePushI 51
|
|
, afterRecoil recoilAmount
|
|
, withRandomOffsetI 10
|
|
, withOldDir od2
|
|
, trigDoAlso (useAmmoParamsVelMod vm3)
|
|
--, torqueBeforeForcedI 0.001
|
|
, withSidePushI 50
|
|
, afterRecoil recoilAmount
|
|
, withRandomOffsetI 9
|
|
, withOldDir od3
|
|
, useAmmoAmount 4
|
|
, withMuzFlareI
|
|
, withSmoke 1 black 20 200 5
|
|
]
|
|
& useDelay .~ WarmUpNoDelay {_warmTime = 0,_warmMax = 200}
|
|
& useAim . aimSpeed .~ 0.4
|
|
& useAim . aimRange .~ 1
|
|
& useAim . aimStance .~ TwoHandTwist
|
|
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
|
-- , _itFloorPict = miniGunPictItem
|
|
, _itParams = BulletShooter
|
|
{ _muzVel = 1
|
|
, _rifling = 0.9
|
|
, _bore = 2
|
|
, _gunBarrels = MultiBarrel
|
|
{_brlSpread = RotatingBarrels 0.01
|
|
,_brlNum = 4
|
|
,_brlInaccuracy = 0
|
|
}
|
|
}
|
|
, _itEquipPict = pictureWeaponAim miniGunPictItem
|
|
, _itTweaks = defaultBulletSelTweak
|
|
, _itInvSize = 4
|
|
, _itInvDisplay = \it -> head (basicItemDisplay it) :
|
|
["*" ++ replicate 13 ' ' ++ "*"
|
|
,"* " ++ fromMaybe " " (maybeWarmupStatus it) ++ " *"
|
|
,"*" ++ replicate 13 ' ' ++ "*" ]
|
|
-- [" " ++ replicate 8 ch
|
|
-- ," " ++ replicate 2 ch ++ fromMaybe " " (maybeWarmupStatus it) ++ replicate 2 ch
|
|
-- ," " ++ replicate 8 ch]
|
|
}
|
|
where
|
|
--ch = '*'
|
|
recoilAmount = 5
|
|
[vm1,vm2,vm3,vm4] =
|
|
[ 0.25
|
|
, 0.5
|
|
, 0.75
|
|
, 1
|
|
]
|
|
[od1,od2,od3] =
|
|
[ 0.25, 0.5, 0.9]
|
|
--[ 0.75, 0.5, 0.25]
|
|
--[ 0, 0, 0]
|
|
miniGunPictItem :: Item -> SPic
|
|
miniGunPictItem it = miniGunPict spin (_ammoLoaded $ _itConsumption it)
|
|
where
|
|
spin = (-10) * _ammoLoaded (_itConsumption it) + _warmTime (_useDelay $ _itUse it)
|
|
|
|
miniGunPict :: Int -> Int -> SPic
|
|
miniGunPict spin am =
|
|
( colorSH red (rotateSHx a barrels)
|
|
<> colorSH red (upperPrismPoly 5 $ rectNESW 8 8 (-8) 4)
|
|
<> colorSH red (prismPoly
|
|
(map (addZ 5) $ rectNESW 2 12 (-2) (-12))
|
|
(map (addZ 0) $ rectNESW 4 12 (-4) (-16))
|
|
)
|
|
<> clip (-1) 0
|
|
<> clip (-7) 0
|
|
, mempty
|
|
)
|
|
where
|
|
aBarrel = translateSH (V3 7 0 9) $ prismPoly
|
|
(map (addZ 5) $ rectNESW 2 12 (-2) (-1))
|
|
(map (addZ 0) $ rectNESW 4 12 (-4) (-5))
|
|
barrels = concatMap (\an -> aBarrel & rotateSHx an) [0,0.5* pi, pi, 1.5*pi]
|
|
a = fromIntegral spin / 100
|
|
x = fromIntegral am / 10
|
|
clip y z = translateSH (V3 0 (-1) z) (rotateSHx (negate $ pi/4)
|
|
. upperPrismPoly 2
|
|
$ rectNESW (negate $ 3 + 0.25 * x) y 3 (y-5))
|