Remove left click/hotkey item data types

This commit is contained in:
2024-12-19 21:55:18 +00:00
parent 910c683eac
commit 3da9490dd4
34 changed files with 708 additions and 883 deletions
+30 -31
View File
@@ -1,8 +1,7 @@
module Dodge.ItEffect
( doInvEffect
) where
module Dodge.ItEffect (
doInvEffect,
) where
import qualified IntMapHelp as IM
import Control.Lens
import Dodge.Data.World
import Dodge.Euse
@@ -10,9 +9,9 @@ import Dodge.Euse
doInvEffect :: ItInvEffect -> Item -> Creature -> World -> World
doInvEffect iie = case iie of
NoInvEffect -> const $ const id
ChargeIfEquipped -> chargeIfEquipped
ChargeIfInInventory -> chargeIfInInventory
SetCharge i -> setItemCharge i
-- ChargeIfEquipped -> chargeIfEquipped
-- ChargeIfInInventory -> chargeIfInInventory
-- SetCharge i -> setItemCharge i
EffectRootNotroot f g -> rootNotrootEff f g
CreateShieldWall -> createShieldWall
RemoveShieldWall -> removeShieldWall
@@ -36,27 +35,27 @@ effectWhileAttached f it
-- , _futureWorlds = []
-- }
setItemCharge :: Int -> Item -> Creature -> World -> World
setItemCharge i itm cr w =
w & ptrWpCharge %~ const i
where
invid = _ilInvID $ _itLocation itm
ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
chargeIfInInventory :: Item -> Creature -> World -> World
chargeIfInInventory itm cr w =
w & ptrWpCharge %~ (min maxcharge . (+ 1))
where
invid = _ilInvID $ _itLocation itm
ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
chargeIfEquipped :: Item -> Creature -> World -> World
chargeIfEquipped itm cr w
| invid `IM.member` (w ^. cWorld . lWorld . imHotkeys) = w &
ptrWpCharge %~ (min maxcharge . (+ 1))
| otherwise = w & ptrWpCharge .~ 0
where
invid = _ilInvID $ _itLocation itm
ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
--setItemCharge :: Int -> Item -> Creature -> World -> World
--setItemCharge i itm cr w =
-- w & ptrWpCharge %~ const i
-- where
-- invid = _ilInvID $ _itLocation itm
-- ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
--
--chargeIfInInventory :: Item -> Creature -> World -> World
--chargeIfInInventory itm cr w =
-- w & ptrWpCharge %~ (min maxcharge . (+ 1))
-- where
-- invid = _ilInvID $ _itLocation itm
-- ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
-- maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
--
--chargeIfEquipped :: Item -> Creature -> World -> World
--chargeIfEquipped itm cr w
-- | invid `IM.member` (w ^. cWorld . lWorld . imHotkeys) = w &
-- ptrWpCharge %~ (min maxcharge . (+ 1))
-- | otherwise = w & ptrWpCharge .~ 0
-- where
-- invid = _ilInvID $ _itLocation itm
-- ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
-- maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge