Files
loop/src/Dodge/Default/Weapon.hs
T

133 lines
3.3 KiB
Haskell

module Dodge.Default.Weapon
where
import Dodge.Data
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Draw
import Picture
import ShapePicture
import Shape
import Geometry.Vector3D
import Geometry
import Control.Lens
defaultAmmo :: ItemAmmo
defaultAmmo = LoadableAmmo
{ _aoType = GenericAmmo
, _wpMaxAmmo = 15
, _wpLoadedAmmo = 15
, _wpReloadTime = 40
, _wpReloadState = 0
, _wpReloadType = ActiveReload
}
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 = DelayRate
{ _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 = DelayRate {_rateMax = 8, _rateTime = 0}
, _useMods = []
, _useHammer = HasHammer HammerUp
, _useAim = defaultAimParams
}
defaultlUse :: ItemUse
defaultlUse = LeftUse
{ _lUse = \_ _ -> id
, _useDelay = DelayRate {_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 = Weapon
{ _itName = "default"
, _itCurseStatus = Uncursed
, _itIdentity = Pistol
, _wpAmmo = defaultAmmo
, _wpMaxWarmUp = 0
, _wpCurWarmUp = 0
, _wpMaxCoolDown = 0
, _wpCurCoolDown = 0
, _itUse = defaultrUse
, _wpSpread = 0.02
, _wpRange = 20
, _itFloorPict = const $ noPic $ colorSH green (prismPoly
(map (addZ 3) $ rectNESW 3 3 (-3) (-3))
(map (addZ 0) $ rectNESW 5 3 (-5) (-7))
)
, _itZoom = ItZoom 20 0.2 1
, _itEquipPict = pictureWeaponOnAim
, _itScroll = \_ _ -> id
, _itAttachment = NoItAttachment
, _itID = Nothing
, _itEffect = wpRecock
, _itInvDisplay = basicWeaponDisplay
, _itInvColor = white
, _itTargeting = Nothing
, _itWorldTrigger = Nothing
, _wpNumBarrels = 1
, _itDimension = defaultItemDimension
}
defaultItemDimension :: ItemDimension
defaultItemDimension = ItemDimension
{ _itDim = V3 4 4 4
, _itRad = 10
, _itHandle = V3 2 2 2
, _itCenter = V3 2 2 2
, _muzzleLength = 5 -- how much the item projects out from the cr radius when aiming
}
defaultAutoGun :: Item
defaultAutoGun = defaultGun
& itUse . useAim . aimStance .~ TwoHandTwist
defaultShellAmmo :: AmmoType
defaultShellAmmo = ShellAmmo
{ _amPayload = const id
, _amString = "Shell"
, _amPjParams = []
, _amPjDraw = const mempty
, _amParamSel = 0
}