Implement copier, an item that copies the value displayed by other items
This commit is contained in:
+19
-4
@@ -1,13 +1,17 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
|
||||
module Dodge.ItEffect (
|
||||
doInvEffect,
|
||||
) where
|
||||
|
||||
import Dodge.BlBl
|
||||
import Dodge.Item.Location
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.BlBl
|
||||
import Dodge.Data.World
|
||||
import Dodge.Euse
|
||||
import Dodge.Inventory.Path
|
||||
import Dodge.Inventory.SelectionList
|
||||
import Dodge.Item.Location
|
||||
|
||||
doInvEffect :: ItInvEffect -> Item -> Creature -> World -> World
|
||||
doInvEffect = \case
|
||||
@@ -17,9 +21,20 @@ doInvEffect = \case
|
||||
RemoveShieldWall -> removeShieldWall
|
||||
EffectWhileRoot f -> rootNotrootEff f NoInvEffect
|
||||
EffectWhileAttached f -> effectWhileAttached f
|
||||
ItemUseToggle f -> \itm _
|
||||
-> pointerToItemID (itm ^. itID) . itUse . useToggle %~ doBlBl f
|
||||
ItemUseToggle f -> \itm _ ->
|
||||
pointerToItemID (itm ^. itID) . itUse . useToggle %~ doBlBl f
|
||||
ItemCancelExamineInventory -> \_ _ -> cancelExamineInventory
|
||||
ItemCopierUpdate -> copierItemUpdate
|
||||
|
||||
copierItemUpdate :: Item -> Creature -> World -> World
|
||||
copierItemUpdate itm cr w = fromMaybe w $ do
|
||||
x <- itm ^? itScroll . itsInt
|
||||
invid <- itm ^? itLocation . ilInvID
|
||||
ip <- itm ^? itType . ibtPathing
|
||||
i <- getInventoryPath x ip invid cr
|
||||
itm' <- cr ^? crInv . ix i
|
||||
v <- getItemValue itm' w cr
|
||||
return $ w & pointerToItem itm . itUse . uValue .~ v
|
||||
|
||||
cancelExamineInventory :: World -> World
|
||||
cancelExamineInventory = hud . hudElement . subInventory %~ f
|
||||
|
||||
Reference in New Issue
Block a user