Commit before tweaking item id/locations
This commit is contained in:
@@ -5,6 +5,7 @@ module Dodge.Creature.Impulse.UseItem (
|
||||
useItemHotkey,
|
||||
) where
|
||||
|
||||
import Dodge.SelectUse
|
||||
import Dodge.Item.Grammar
|
||||
import Dodge.Data.ComposedItem
|
||||
import Dodge.Data.DoubleTree
|
||||
@@ -40,17 +41,14 @@ itemEffect cr it w = case it ^. ldtValue . itUse of
|
||||
EquipUse{} -> doequipmentchange
|
||||
(ConsumeUse eff) -> useC eff (_ldtValue it) cr w
|
||||
CraftUse{} -> w
|
||||
AttachUse{} -> w
|
||||
AttachUse{} -> selectUse it cr w
|
||||
AmmoMagUse{} -> w
|
||||
where
|
||||
itm = it ^. ldtValue
|
||||
hammerTest f = case _crHammerPosition cr of
|
||||
HammerUp -> f w -- & setuhamdown
|
||||
_ -> w -- & setuhamdown
|
||||
-- setuhamdown = cWorld . lWorld . creatures . ix (_crID cr) . crHammerPosition .~ HammerDown
|
||||
doequipmentchange = fromMaybe w $ do
|
||||
guard (_crHammerPosition cr == HammerUp)
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
return $ hammerTest $ toggleEquipmentAt invid cr
|
||||
return $ toggleEquipmentAt invid cr w
|
||||
|
||||
toggleEquipmentAt :: Int -> Creature -> World -> World
|
||||
toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
||||
|
||||
Reference in New Issue
Block a user