Continue refactor of reloading

This commit is contained in:
2022-06-20 11:12:24 +01:00
parent 2f4b381484
commit a85cf4d1fb
27 changed files with 243 additions and 299 deletions
+23 -26
View File
@@ -1,6 +1,7 @@
module Dodge.Default.Weapon
where
import Dodge.Data
import Dodge.Item.Weapon.Bullet
import Dodge.Default.Item
import Dodge.Item.Draw
import Picture
@@ -13,15 +14,17 @@ import Geometry
import qualified Data.Map.Strict as M
import Control.Lens
defaultAmmo :: ItemConsumption
defaultAmmo = LoadableAmmo
{ _laType = GenericAmmo
defaultLoadable :: ItemConsumption
defaultLoadable = LoadableAmmo
{ _laAmmoType = GenericAmmo
, _laMax = 15
, _laLoaded = 0
, _laReloadTime = 40
, _laTransfer = NoTransfer
, _laReloadType = ActiveClear
, _laLoadType = ActiveEject 20 20 NoTransfer
}
defaultBulletLoadable :: ItemConsumption
defaultBulletLoadable = defaultLoadable & laAmmoType .~ basicBullet
defaultChargeable :: ItemConsumption
defaultChargeable = ChargeableAmmo 100 100
ruseRate :: Int
-> (Item -> Creature -> World -> World)
@@ -94,26 +97,17 @@ defaultAimParams = AimParams
, _aimStance = OneHand
}
-- TODO change this
defaultLeftItem :: Item
defaultLeftItem = defaultWeapon
defaultGun :: Item
defaultGun = defaultItem
{ _itCurseStatus = Uncursed
, _itConsumption = defaultAmmo
, _itUse = defaultrUse
, _itDimension = defItDimCol white
, _itEquipPict = pictureWeaponOnAim
, _itAttachment = NoItAttachment
, _itID = Nothing
, _itInvPos = Nothing
, _itIsHeld = False
, _itEffect = NoItEffect
, _itInvColor = white
, _itInvSize = 1
, _itParams = NoParams
, _itTweaks = NoTweaks
, _itScope = NoScope
, _itTargeting = NoTargeting
}
defaultWeapon :: Item
defaultWeapon = defaultItem
& itConsumption .~ defaultLoadable
& itUse .~ defaultrUse
& itDimension .~ defItDimCol white
& itEquipPict .~ pictureWeaponOnAim
& itInvColor .~ white
& itType . iyModules .~ M.fromList
[(ModBullet, EMPTYMODULE)
,(ModTarget, EMPTYMODULE)
@@ -121,6 +115,9 @@ defaultGun = defaultItem
,(ModTeleport, EMPTYMODULE)
]
defaultBulletWeapon :: Item
defaultBulletWeapon = defaultWeapon & itConsumption .~ defaultBulletLoadable
defaultItemValue :: ItemValue
defaultItemValue = ItemValue 10 MundaneItem
defaultCraftable :: Item
@@ -161,5 +158,5 @@ defBulletShooter = BulletShooter
}
defaultAutoGun :: Item
defaultAutoGun = defaultGun
defaultAutoGun = defaultBulletWeapon
& itUse . useAim . aimStance .~ TwoHandTwist