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 [VERYLONGPIPE,HARDWARE] bangRod
, p [PIPE,PIPE] $ makeTypeCraft LONGPIPE , p [PIPE,PIPE] $ makeTypeCraft LONGPIPE
, p [LONGPIPE,PIPE] $ makeTypeCraft VERYLONGPIPE , 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] map (\i -> ([PIPE,BANGSTICK i],bangStick (i+1))) [1..8]
where where
+3
View File
@@ -44,6 +44,9 @@ data CombineType
| VERYLONGPIPE | VERYLONGPIPE
| HARDWARE | HARDWARE
| SPRING | SPRING
| CAN
| TIN
| DRUM
| TPipe | TPipe
| NoCombineType | NoCombineType
| TLongPipe | TLongPipe
+2
View File
@@ -172,6 +172,8 @@ testInventory :: IM.IntMap Item
testInventory = IM.fromList $ zip [0..] testInventory = IM.fromList $ zip [0..]
[ makeTypeCraftNum 9 PIPE [ makeTypeCraftNum 9 PIPE
, makeTypeCraft HARDWARE , makeTypeCraft HARDWARE
, makeTypeCraft CAN
, makeTypeCraft TIN
] ]
stackedInventory :: IM.IntMap Item stackedInventory :: IM.IntMap Item
stackedInventory = IM.fromList $ zip [0..] stackedInventory = IM.fromList $ zip [0..]
+20 -6
View File
@@ -1,5 +1,6 @@
module Dodge.Item.Weapon.BulletGuns module Dodge.Item.Weapon.BulletGuns
( pistol ( pistol
, revolver
, bangStick , bangStick
, bangRod , bangRod
, bangCane , bangCane
@@ -91,7 +92,9 @@ autoGunPic it = noPic $
x = fromIntegral $ _ammoLoaded $ _itConsumption it x = fromIntegral $ _ammoLoaded $ _itConsumption it
bangStick :: Int -> Item bangStick :: Int -> Item
bangStick i = defaultGun bangStick i = defaultGun
{ _itName = "BANGSTICK"++ show i { _itName = case i of
1 -> "BANGSTICK"
_ -> "BANGSTICKx"++ show i
, _itCombineType = BANGSTICK i , _itCombineType = BANGSTICK i
, _itConsumption = defaultAmmo , _itConsumption = defaultAmmo
{ _aoType = basicBullet { _aoType = basicBullet
@@ -100,8 +103,7 @@ bangStick i = defaultGun
, _reloadType = ActivePartial 1 , _reloadType = ActivePartial 1
} }
, _itUse = useAmmoParamsRate 8 upHammer , _itUse = useAmmoParamsRate 8 upHammer
[ ammoCheckI [ ammoHammerCheck
, hammerCheckI
, useTimeCheck , useTimeCheck
, withSoundStart tap3S , withSoundStart tap3S
, useAllAmmo , useAllAmmo
@@ -154,6 +156,18 @@ bangRod = bangCane
& itUse . useAim . aimStance .~ TwoHandTwist & itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} & 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 :: Item
pistol = defaultGun pistol = defaultGun
{ _itName = "PISTOL" { _itName = "PISTOL"
@@ -161,9 +175,9 @@ pistol = defaultGun
, _itConsumption = defaultAmmo , _itConsumption = defaultAmmo
{ _aoType = basicBullet { _aoType = basicBullet
, _ammoMax = 15 , _ammoMax = 15
, _ammoLoaded = 15 , _ammoLoaded = 0
, _reloadTime = 15 , _reloadTime = 90
, _reloadType = ActivePartial 1 , _reloadType = ActiveClear
} }
, _itUse = useAmmoParamsRate 8 upHammer , _itUse = useAmmoParamsRate 8 upHammer
[ ammoCheckI [ ammoCheckI
+16
View File
@@ -37,6 +37,7 @@ module Dodge.Item.Weapon.TriggerType
, ammoCheckI , ammoCheckI
, applyInaccuracy , applyInaccuracy
, modClock , modClock
, ammoHammerCheck
) )
where where
import Dodge.Data import Dodge.Data
@@ -102,6 +103,21 @@ ammoCheckI eff item cr w
-- | _reloadState (_itConsumption item) /= Nothing' = w -- | _reloadState (_itConsumption item) /= Nothing' = w
| otherwise = eff item cr $ w & creatures . ix (_crID cr) %~ crStopReloading | 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 :: Int -> Item -> Item
itUseAmmo x = itConsumption . ammoLoaded %~ (max 0 . subtract x) itUseAmmo x = itConsumption . ammoLoaded %~ (max 0 . subtract x)