This commit is contained in:
2025-01-04 21:08:46 +00:00
parent 698bb081dd
commit 86173f9f6a
2 changed files with 1 additions and 14 deletions
-10
View File
@@ -1,10 +0,0 @@
module Dodge.Base.Arithmetic where
import MaybeHelp
decreaseToZero :: Int -> Int
decreaseToZero = max 0 . subtract 1
decreaseToNothing' :: (Num a, Ord a) => Maybe' a -> Maybe' a
decreaseToNothing' ma = case ma of
Just' x | x > 0 -> Just' (x - 1)
_ -> Nothing'
+1 -4
View File
@@ -159,7 +159,7 @@ applyPastDamages cr w
-- a map updating all inventory items
updateInv :: Creature -> World -> World
updateInv cr = cWorld . lWorld . creatures . ix (_crID cr) . crInv . each
. itUse . heldDelay %~ useDelayUpdate
. itUse . heldDelay . warmTime %~ (max 0 . subtract 1)
-- a loop going over all inventory items
invSideEff :: Creature -> World -> World
@@ -426,9 +426,6 @@ setRBCreatureTargeting cr w ituse
cpos <- w ^? cWorld . lWorld . creatures . ix cid . crPos
Just $ hasLOS cpos (_crPos cr) w
useDelayUpdate :: UseDelay -> UseDelay
useDelayUpdate = ( warmTime %~ decreaseToZero)
--updateAutoRecharge :: Item -> Item
--updateAutoRecharge it = case it ^? itUse . leftConsumption of
-- Just (AutoRecharging l m t p)