Commit before door refactor

This commit is contained in:
2022-06-23 09:30:46 +01:00
parent ee47ee8e95
commit 8e3f03637d
11 changed files with 76 additions and 17 deletions
+5 -4
View File
@@ -145,6 +145,8 @@ ammoHammerCheck eff it cr w
setHammerDown = creatures . ix cid . crInv . ix (crSel cr) . itUse
. useHammer . hammerPosition .~ HammerDown
itUseCharge :: Int -> Item -> Item
itUseCharge x = itConsumption . arLoaded %~ (max 0 . subtract x)
itUseAmmo :: Int -> Item -> Item
itUseAmmo x = itConsumption . laLoaded %~ (max 0 . subtract x)
@@ -353,7 +355,7 @@ shootL
-> World
shootL f item cr w
| fireCondition = f item cr w & pointerToItem %~
( itUseAmmo 1
( itUseCharge 1
. (itUse . useDelay . rateTime .~ _rateMax (_useDelay (_itUse item))) )
-- | reloadCondition = fromMaybe w $ startReloadingWeapon cr w
| otherwise = w
@@ -361,9 +363,8 @@ shootL f item cr w
cid = _crID cr
invid = fromJust $ _itInvPos item
pointerToItem = creatures . ix cid . crInv . ix invid
fireCondition = crWeaponReady cr
&& _rateTime (_useDelay (_itUse item)) == 0
&& _laLoaded (_itConsumption item) > 0
fireCondition = _rateTime (_useDelay (_itUse item)) == 0
&& _arLoaded (_itConsumption item) > 0
-- reloadCondition = _laLoaded (_itConsumption item) == 0
withItem :: (Item -> ChainEffect) -> ChainEffect
withItem g f it = g it f it