Start implementing attachable scroll items
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
module Dodge.Base.You where
|
||||
|
||||
import Dodge.Data.World
|
||||
import Dodge.HeldScroll
|
||||
import qualified IntMapHelp as IM
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
|
||||
you :: World -> Creature
|
||||
you w = w ^?! cWorld . lWorld . creatures . ix 0
|
||||
@@ -15,6 +17,14 @@ yourItem w = do
|
||||
i <- you w ^? crManipulation . manObject . inInventory . ispItem
|
||||
_crInv (you w) IM.!? i
|
||||
|
||||
yourScrollAttachment :: World -> Maybe (Int,ScrollAttachParams)
|
||||
yourScrollAttachment w = do
|
||||
i <- you w ^? crManipulation . manObject . inInventory . ispItem
|
||||
itm <- _crInv (you w) IM.!? i
|
||||
atparams <- you w ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams
|
||||
guard (canHeldScrollAttach itm atparams)
|
||||
return (i - 1, atparams)
|
||||
|
||||
yourInv :: World -> IM.IntMap Item
|
||||
yourInv = _crInv . you
|
||||
|
||||
|
||||
Reference in New Issue
Block a user