Fix inventory swapping equipment bug

This commit is contained in:
2022-05-22 15:50:25 +01:00
parent fd40da2d4a
commit b83392d441
8 changed files with 45 additions and 18 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ crMvAbsolute p' cr = advanceStepCounter (magV p) cr
strengthFactor :: Int -> Float
strengthFactor i
| i > 9 = 1
| i < 1 = 0.1
| i < 1 = 0
| otherwise = 0.1 * fromIntegral i
crMvForward
+4 -2
View File
@@ -71,11 +71,13 @@ eqSiteToPos cr es = case es of
useLeftItem :: Int -> World -> World
useLeftItem cid w
| _crInvLock cr = w
| itConsumable = useItem cr w
| itmShouldBeUsed = useItem cr w
| otherwise = fromMaybe w $ do
invid <- _crLeftInvSel cr
f <- cr ^? crInv . ix invid . itUse . lUse
return $ f cr invid w
where
cr = _creatures w IM.! cid
itConsumable = isJust $ cr ^? crInv . ix (_crInvSel cr) . itUse . cUse
itmShouldBeUsed = isJust (cr ^? crInv . ix (_crInvSel cr) . itUse . cUse)
|| isJust (cr ^? crInv . ix (_crInvSel cr) . itUse . eqUse)
-- TODO determine itmShouldBeUsed with reference to config options