This commit is contained in:
2024-09-30 12:54:31 +01:00
parent 65564c993b
commit fc5539cb38
58 changed files with 802 additions and 1255 deletions
+5 -3
View File
@@ -4,9 +4,10 @@ module Dodge.Inventory.CheckSlots (
crInvSize,
) where
import Control.Lens
import Data.Monoid
import Dodge.Base.You
import Dodge.Data.World
import Dodge.Item.SlotsTaken
import qualified IntMapHelp as IM
{- | checks whether or not an item will fit in your inventory
@@ -14,7 +15,7 @@ import qualified IntMapHelp as IM
-}
checkInvSlotsYou :: Item -> World -> Maybe Int
checkInvSlotsYou it w
| crNumFreeSlots ycr >= ceiling (_itInvSize it) =
| crNumFreeSlots ycr >= _itInvSize it =
Just $ findItemSlot (_crInv ycr)
| otherwise = Nothing
where
@@ -38,4 +39,5 @@ crInvSize :: Creature -> Int
crInvSize = invSize . _crInv
invSize :: IM.IntMap Item -> Int
invSize = sum . fmap itSlotsTaken
invSize = alaf Sum foldMap _itInvSize
--invSize = sum . fmap _itInvSize