Files
loop/src/Dodge/Default/Weapon.hs
T
2022-02-22 11:07:19 +00:00

156 lines
3.9 KiB
Haskell

module Dodge.Default.Weapon
where
import Dodge.Data
import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Draw
import Picture
import ShapePicture
import Shape
--import Geometry.Vector3D
import Geometry
--import Dodge.TweakBullet
import qualified Data.Map.Strict as M
import Control.Lens
defaultAmmo :: ItemConsumption
defaultAmmo = LoadableAmmo
{ _aoType = GenericAmmo
, _ammoBaseMax = 15
, _ammoLoaded = 0
, _reloadTime = 40
, _reloadState = Nothing'
, _reloadType = ActiveClear
}
ruseRate :: Int
-> (Item -> Creature -> World -> World)
-> HammerType
-> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
-> ItemUse
ruseRate i f ht usemods = RightUse
{ _rUse = f
, _useDelay = FixedRate
{ _rateMax = i
, _rateTime = 0
}
, _useMods = usemods
, _useHammer = ht
, _useAim = defaultAimParams
}
ruseInstant
:: (Item -> Creature -> World -> World)
-> HammerType
-> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
-> ItemUse
ruseInstant f ht usemods = RightUse
{ _rUse = f
, _useDelay = NoDelay
, _useMods = usemods
, _useHammer = ht
, _useAim = defaultAimParams
}
defaultrUse :: ItemUse
defaultrUse = RightUse
{ _rUse = \_ _ -> id
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
, _useMods = []
, _useHammer = HasHammer HammerUp
, _useAim = defaultAimParams
}
defaultlUse :: ItemUse
defaultlUse = LeftUse
{ _lUse = \_ _ -> id
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
, _useHammer = NoHammer
}
luseInstantNoH :: (Creature -> Int -> World -> World) -> ItemUse
luseInstantNoH f = LeftUse
{ _lUse = f
, _useDelay = NoDelay
, _useHammer = NoHammer
}
defaultAimParams :: AimParams
defaultAimParams = AimParams
{ _aimSpeed = 1
, _aimRange = 0
, _aimZoom = ItZoom 20 0.2 1
, _aimStance = OneHand
}
defaultGun :: Item
defaultGun = Item
{ _itName = "default"
, _itType = NoCombineType
, _itCurseStatus = Uncursed
, _itConsumption = defaultAmmo
, _itUse = defaultrUse
, _itDimension = defItDimCol white
, _itEquipPict = pictureWeaponOnAim
, _itScroll = \_ _ -> id
, _itAttachment = NoItAttachment
, _itID = Nothing
, _itEffect = NoItEffect
, _itInvDisplay = basicItemDisplay
, _itInvColor = white
, _itInvSize = 1
, _itTargeting = Nothing
, _itParams = NoParams
, _itTweaks = NoTweaks
, _itModules = M.fromList [(ModBullet , DefaultModule)
,(ModBulletTarget,DefaultModule)
]
, _itScope = NoScope
, _itTargeting' = NoTargeting
}
defaultCraftable :: Item
defaultCraftable = Item
{ _itName = "default"
, _itType = NoCombineType
, _itCurseStatus = Uncursed
, _itConsumption = NoConsumption
, _itUse = NoUse
, _itEquipPict = pictureWeaponOnAim
, _itScroll = \_ _ -> id
, _itAttachment = NoItAttachment
, _itID = Nothing
, _itEffect = NoItEffect
, _itInvDisplay = basicItemDisplay
, _itInvColor = green
, _itInvSize = 1
, _itTargeting = Nothing
, _itParams = NoParams
, _itDimension = defItDimCol green
, _itTweaks = NoTweaks
, _itModules = M.empty
, _itScope = NoScope
, _itTargeting' = NoTargeting
}
defItDim :: ItemDimension
defItDim = ItemDimension
{ _dimRad = 2
, _dimCenter = V3 0 0 0
, _dimPortage = HeldItem
{ _handlePos = 0
, _muzPos = 0
}
, _dimSPic = const $ noPic $ colorSH green $ upperPrismPoly 3 $ square 4
}
defItDimCol :: Color -> ItemDimension
defItDimCol col = ItemDimension
{ _dimRad = 2
, _dimCenter = V3 0 0 0
, _dimPortage = HeldItem
{ _handlePos = 0
, _muzPos = 0
}
, _dimSPic = const $ noPic $ colorSH col $ upperPrismPoly 3 $ square 4
}
defaultAutoGun :: Item
defaultAutoGun = defaultGun
& itUse . useAim . aimStance .~ TwoHandTwist