Input more combinations

This commit is contained in:
2021-12-04 11:45:43 +00:00
parent 0114a2f9f2
commit 30abc318ae
5 changed files with 44 additions and 6 deletions
+3
View File
@@ -22,6 +22,9 @@ itemCombinations = map (first toMultiset) $
, p [VERYLONGPIPE,HARDWARE] bangRod
, p [PIPE,PIPE] $ makeTypeCraft LONGPIPE
, p [LONGPIPE,PIPE] $ makeTypeCraft VERYLONGPIPE
, p [BANGSTICK 1,CAN] revolver
, p [BANGSTICK 1,TIN] pistol
, p [PISTOL, SPRING, HARDWARE] ltAutoGun
] ++
map (\i -> ([PIPE,BANGSTICK i],bangStick (i+1))) [1..8]
where
+3
View File
@@ -44,6 +44,9 @@ data CombineType
| VERYLONGPIPE
| HARDWARE
| SPRING
| CAN
| TIN
| DRUM
| TPipe
| NoCombineType
| TLongPipe
+2
View File
@@ -172,6 +172,8 @@ testInventory :: IM.IntMap Item
testInventory = IM.fromList $ zip [0..]
[ makeTypeCraftNum 9 PIPE
, makeTypeCraft HARDWARE
, makeTypeCraft CAN
, makeTypeCraft TIN
]
stackedInventory :: IM.IntMap Item
stackedInventory = IM.fromList $ zip [0..]
+20 -6
View File
@@ -1,5 +1,6 @@
module Dodge.Item.Weapon.BulletGuns
( pistol
, revolver
, bangStick
, bangRod
, bangCane
@@ -91,7 +92,9 @@ autoGunPic it = noPic $
x = fromIntegral $ _ammoLoaded $ _itConsumption it
bangStick :: Int -> Item
bangStick i = defaultGun
{ _itName = "BANGSTICK"++ show i
{ _itName = case i of
1 -> "BANGSTICK"
_ -> "BANGSTICKx"++ show i
, _itCombineType = BANGSTICK i
, _itConsumption = defaultAmmo
{ _aoType = basicBullet
@@ -100,8 +103,7 @@ bangStick i = defaultGun
, _reloadType = ActivePartial 1
}
, _itUse = useAmmoParamsRate 8 upHammer
[ ammoCheckI
, hammerCheckI
[ ammoHammerCheck
, useTimeCheck
, withSoundStart tap3S
, useAllAmmo
@@ -154,6 +156,18 @@ bangRod = bangCane
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
revolver :: Item
revolver = pistol
{ _itName = "REVOLVER"
, _itConsumption = defaultAmmo
{ _aoType = basicBullet
, _ammoMax = 6
, _ammoLoaded = 0
, _reloadTime = 15
, _reloadType = ActivePartial 1
}
}
pistol :: Item
pistol = defaultGun
{ _itName = "PISTOL"
@@ -161,9 +175,9 @@ pistol = defaultGun
, _itConsumption = defaultAmmo
{ _aoType = basicBullet
, _ammoMax = 15
, _ammoLoaded = 15
, _reloadTime = 15
, _reloadType = ActivePartial 1
, _ammoLoaded = 0
, _reloadTime = 90
, _reloadType = ActiveClear
}
, _itUse = useAmmoParamsRate 8 upHammer
[ ammoCheckI
+16
View File
@@ -37,6 +37,7 @@ module Dodge.Item.Weapon.TriggerType
, ammoCheckI
, applyInaccuracy
, modClock
, ammoHammerCheck
)
where
import Dodge.Data
@@ -102,6 +103,21 @@ ammoCheckI eff item cr w
-- | _reloadState (_itConsumption item) /= Nothing' = w
| otherwise = eff item cr $ w & creatures . ix (_crID cr) %~ crStopReloading
-- combined ammo and hammer check: want to be able to auto-reload even if the
-- hammer is down?
ammoHammerCheck :: ChainEffect
ammoHammerCheck eff it cr w
| _ammoLoaded (_itConsumption it) <= 0 = fromMaybe w (startReloadingWeapon cr w)
& setHammerDown
| otherwise = case it ^? itUse . useHammer . hammerPosition of
Just HammerUp -> eff it cr $ setHammerDown w & creatures . ix (_crID cr) %~ crStopReloading
_ -> setHammerDown w
where
cid = _crID cr
setHammerDown = creatures . ix cid . crInv . ix (_crInvSel cr) . itUse
. useHammer . hammerPosition .~ HammerDown
itUseAmmo :: Int -> Item -> Item
itUseAmmo x = itConsumption . ammoLoaded %~ (max 0 . subtract x)