Remove data Hammers
This commit is contained in:
@@ -15,14 +15,14 @@ import Dodge.HeldUse
|
||||
--import Dodge.Hotkey
|
||||
import Dodge.Inventory
|
||||
import Dodge.Item.Grammar
|
||||
import Dodge.Item.Location
|
||||
--import Dodge.Item.Location
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
useItem :: Int -> PressType -> World -> World
|
||||
useItem invid pt w = (worldEventFlags . at InventoryChange ?~ ()) . fromMaybe w $ do
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
itmloc <- allInvLocs (_crInv cr) ^? ix invid . _2
|
||||
usedloc <- useLocation' itmloc
|
||||
usedloc <- useLocation itmloc
|
||||
useItemLoc cr usedloc pt w
|
||||
|
||||
useItemLoc :: Creature -> LocationLDT ItemLink ComposedItem -> PressType
|
||||
@@ -30,15 +30,15 @@ useItemLoc :: Creature -> LocationLDT ItemLink ComposedItem -> PressType
|
||||
useItemLoc cr loc pt w = case loc ^. locLDT . ldtValue . _2 of
|
||||
HeldPlatformSF ->
|
||||
return $
|
||||
heldEffect (bimap _iatType (^. _1) ldt) cr w
|
||||
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
heldEffect pt (bimap _iatType (^. _1) ldt) cr w
|
||||
-- & pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
GadgetPlatformSF ->
|
||||
return $
|
||||
heldEffect (bimap _iatType (^. _1) ldt) cr w
|
||||
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
heldEffect pt (bimap _iatType (^. _1) ldt) cr w
|
||||
-- & pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
RemoteDetonatorSF -> do
|
||||
return $ activateDetonator ldt w
|
||||
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
-- & pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
_ | isJust $ itm ^? itUse . uequipEffect -> do
|
||||
invid' <- itm ^? itLocation . ilInvID
|
||||
return $ toggleEquipmentAt invid' cr w
|
||||
@@ -47,9 +47,9 @@ useItemLoc cr loc pt w = case loc ^. locLDT . ldtValue . _2 of
|
||||
ldt = loc ^. locLDT
|
||||
itm = ldt ^. ldtValue . _1
|
||||
|
||||
useLocation' :: LocationLDT ItemLink ComposedItem
|
||||
useLocation :: LocationLDT ItemLink ComposedItem
|
||||
-> Maybe (LocationLDT ItemLink ComposedItem)
|
||||
useLocation' loc
|
||||
useLocation loc
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itUse . uequipEffect = return loc
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itUse . uaParams . apLinkedProjectile . _Just
|
||||
= return loc
|
||||
@@ -57,34 +57,34 @@ useLocation' loc
|
||||
= return loc
|
||||
| otherwise = return $ locToTop loc
|
||||
|
||||
useSelectedItem :: Int -> World -> World
|
||||
useSelectedItem crid w = (worldEventFlags . at InventoryChange ?~ ()) . fromMaybe w $ do
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix crid
|
||||
invid <- cr ^? crManipulation . manObject . imSelectedItem
|
||||
itmloc <- allInvLocs (_crInv cr) ^? ix invid . _2
|
||||
let usedloc = case useLocation itmloc of
|
||||
UseFromLocation -> itmloc ^. locLDT
|
||||
UseFromRoot -> locToTop itmloc ^. locLDT
|
||||
let itm = usedloc ^. ldtValue . _1
|
||||
case usedloc ^. ldtValue . _2 of
|
||||
HeldPlatformSF ->
|
||||
return $
|
||||
heldEffect (bimap _iatType fst3 usedloc) cr w
|
||||
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
GadgetPlatformSF ->
|
||||
return $
|
||||
heldEffect (bimap _iatType fst3 usedloc) cr w
|
||||
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
RemoteDetonatorSF -> do
|
||||
return $ activateDetonator usedloc w
|
||||
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
_ | isJust $ itm ^? itUse . uequipEffect -> do
|
||||
-- guard (_crHammerPosition cr == HammerUp)
|
||||
invid' <- itm ^? itLocation . ilInvID
|
||||
return $ toggleEquipmentAt invid' cr w
|
||||
_ -> Nothing
|
||||
where
|
||||
fst3 (x, _, _) = x
|
||||
--useSelectedItem :: Int -> World -> World
|
||||
--useSelectedItem crid w = (worldEventFlags . at InventoryChange ?~ ()) . fromMaybe w $ do
|
||||
-- cr <- w ^? cWorld . lWorld . creatures . ix crid
|
||||
-- invid <- cr ^? crManipulation . manObject . imSelectedItem
|
||||
-- itmloc <- allInvLocs (_crInv cr) ^? ix invid . _2
|
||||
-- let usedloc = case useLocation itmloc of
|
||||
-- UseFromLocation -> itmloc ^. locLDT
|
||||
-- UseFromRoot -> locToTop itmloc ^. locLDT
|
||||
-- let itm = usedloc ^. ldtValue . _1
|
||||
-- case usedloc ^. ldtValue . _2 of
|
||||
-- HeldPlatformSF ->
|
||||
-- return $
|
||||
-- heldEffect (bimap _iatType fst3 usedloc) cr w
|
||||
-- & pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
-- GadgetPlatformSF ->
|
||||
-- return $
|
||||
-- heldEffect (bimap _iatType fst3 usedloc) cr w
|
||||
-- & pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
-- RemoteDetonatorSF -> do
|
||||
-- return $ activateDetonator usedloc w
|
||||
-- & pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
-- _ | isJust $ itm ^? itUse . uequipEffect -> do
|
||||
---- guard (_crHammerPosition cr == HammerUp)
|
||||
-- invid' <- itm ^? itLocation . ilInvID
|
||||
-- return $ toggleEquipmentAt invid' cr w
|
||||
-- _ -> Nothing
|
||||
-- where
|
||||
-- fst3 (x, _, _) = x
|
||||
|
||||
activateDetonator ::
|
||||
LabelDoubleTree ItemLink ComposedItem ->
|
||||
@@ -94,15 +94,6 @@ activateDetonator det = fromMaybe id $ do
|
||||
pjid <- det ^? ldtValue . _1 . itUse . uaParams . apProjectiles . ix 0
|
||||
return $ cWorld . lWorld . projectiles . ix pjid . pjTimer .~ 0
|
||||
|
||||
useLocation :: LocationLDT ItemLink ComposedItem -> UseFocus
|
||||
useLocation loc
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itUse . uequipEffect = UseFromLocation
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itUse . uaParams . apLinkedProjectile . _Just =
|
||||
UseFromLocation
|
||||
| isJust $ loc ^? locLDT . ldtValue . _1 . itUse . uaParams . apProjectiles . ix 0 =
|
||||
UseFromLocation
|
||||
| otherwise = UseFromRoot
|
||||
|
||||
toggleEquipmentAt :: Int -> Creature -> World -> World
|
||||
toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
||||
DoNotMoveEquipment -> w
|
||||
|
||||
Reference in New Issue
Block a user