Cleanup equipment item function
This commit is contained in:
@@ -6,10 +6,12 @@ module Dodge.Creature.Statistics (
|
|||||||
crIntelligence,
|
crIntelligence,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Data.Equipment.Misc
|
||||||
|
import qualified Data.Map.Strict as M
|
||||||
import NewInt
|
import NewInt
|
||||||
import Dodge.Data.LWorld
|
import Dodge.Data.LWorld
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import qualified IntMapHelp as IM
|
--import qualified IntMapHelp as IM
|
||||||
import LensHelp
|
import LensHelp
|
||||||
|
|
||||||
crDexterity :: Creature -> Int
|
crDexterity :: Creature -> Int
|
||||||
@@ -55,10 +57,10 @@ equipmentStrValue itm = case _itType itm of
|
|||||||
EQUIP POWERLEGS -> 3
|
EQUIP POWERLEGS -> 3
|
||||||
_ -> 0
|
_ -> 0
|
||||||
|
|
||||||
crCurrentEquipment :: LWorld -> Creature -> NewIntMap InvInt Item
|
crCurrentEquipment :: LWorld -> Creature -> M.Map EquipSite Item
|
||||||
crCurrentEquipment lw = over unNIntMap (IM.filter (isJust . (^? itLocation . ilEquipSite . _Just))) . fmap f . _crInv
|
crCurrentEquipment lw = fmap f . _crEquipment
|
||||||
where
|
where
|
||||||
f i = lw ^?! items . ix i
|
f i = lw ^?! items . ix (_unNInt i)
|
||||||
|
|
||||||
strFromHeldItem :: LWorld -> Creature -> Int
|
strFromHeldItem :: LWorld -> Creature -> Int
|
||||||
strFromHeldItem lw cr = fromMaybe 0 $ do
|
strFromHeldItem lw cr = fromMaybe 0 $ do
|
||||||
|
|||||||
Reference in New Issue
Block a user