Start implementing attachable scroll items

This commit is contained in:
2023-11-08 18:39:38 +00:00
parent 8f0dd8cd1b
commit f26d380c1b
20 changed files with 119 additions and 116 deletions
+10
View File
@@ -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