Implement copier, an item that copies the value displayed by other items

This commit is contained in:
2025-01-08 14:29:25 +00:00
parent 47aa8655b1
commit 21b7b863c7
12 changed files with 184 additions and 142 deletions
+18 -12
View File
@@ -8,6 +8,7 @@ module Dodge.HeldUse (
mcUseHeld,
) where
import Dodge.Inventory.Path
import Color
import Control.Applicative
import Control.Monad
@@ -790,18 +791,23 @@ dropInventoryPath ::
Creature ->
World ->
World
dropInventoryPath i ip loc cr w = case ip of
ABSOLUTE -> fromMaybe w $ do
guard $ i `IM.member` (cr ^. crInv)
return $ dropItem cr i w
RELCURS -> fromMaybe w $ do
j <- cr ^? crManipulation . manObject . imSelectedItem
guard $ (i + j) `IM.member` (cr ^. crInv)
return $ dropItem cr (i + j) w
RELITEM -> fromMaybe w $ do
j <- loc ^? locLDT . ldtValue . _1 . itLocation . ilInvID
guard $ (i + j) `IM.member` (cr ^. crInv)
return $ dropItem cr (i + j) w
dropInventoryPath i ip loc cr = fromMaybe id $ do
invid <- loc ^? locLDT . ldtValue . _1 . itLocation . ilInvID
j <- getInventoryPath i ip invid cr
return $ dropItem cr j
--dropInventoryPath i ip loc cr w = case ip of
-- ABSOLUTE -> fromMaybe w $ do
-- guard $ i `IM.member` (cr ^. crInv)
-- return $ dropItem cr i w
-- RELCURS -> fromMaybe w $ do
-- j <- cr ^? crManipulation . manObject . imSelectedItem
-- guard $ (i + j) `IM.member` (cr ^. crInv)
-- return $ dropItem cr (i + j) w
-- RELITEM -> fromMaybe w $ do
-- j <- loc ^? locLDT . ldtValue . _1 . itLocation . ilInvID
-- guard $ (i + j) `IM.member` (cr ^. crInv)
-- return $ dropItem cr (i + j) w
useInventoryPath ::
PressType ->