Commit before extending selection sections: overlapping elements

This commit is contained in:
2023-05-19 13:38:21 +01:00
parent 2f0bb5115b
commit ac87621640
13 changed files with 131 additions and 115 deletions
+5 -5
View File
@@ -139,9 +139,9 @@ ammoCheckI :: ChainEffect
ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
Just (InternalSource ia) | _iaLoaded ia <= 0 || not (_iaPrimed ia)
-> w
Just (ExternalSource ea) | fromMaybe True $ do
invid <- ea ^? _Just
x <- cr ^? crInv . ix invid . itUse . equipEffect . eeUse . euseAmmoAmount
Just AboveSource | fromMaybe True $ do
invid <- itm ^? itLocation . ipInvID
x <- cr ^? crInv . ix (invid - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
return $ x <= 0
-> w
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
@@ -370,8 +370,8 @@ useAmmoAmount' :: Int -> Int -> IM.IntMap Item -> IM.IntMap Item
useAmmoAmount' itref x inv = case inv ^? ix itref . itUse . heldConsumption . laSource of
Just InternalSource{}
-> inv & ix itref . itUse . heldConsumption . laSource . _InternalSource . iaLoaded -~ x
Just (ExternalSource (Just eqid))
-> inv & ix eqid . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
Just AboveSource
-> inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
_ -> inv
-- . crInv . ix itRef . itUse . heldConsumption . laSource