Use NewIntMap InvInt for crInv
This commit is contained in:
@@ -6,6 +6,7 @@ module Dodge.Creature.Statistics (
|
||||
crIntelligence,
|
||||
) where
|
||||
|
||||
import NewInt
|
||||
import Dodge.Data.LWorld
|
||||
import Data.Maybe
|
||||
import qualified IntMapHelp as IM
|
||||
@@ -54,8 +55,8 @@ equipmentStrValue itm = case _itType itm of
|
||||
EQUIP POWERLEGS -> 3
|
||||
_ -> 0
|
||||
|
||||
crCurrentEquipment :: LWorld -> Creature -> IM.IntMap Item
|
||||
crCurrentEquipment lw = IM.filter (isJust . (^? itLocation . ilEquipSite . _Just)) . fmap f . _crInv
|
||||
crCurrentEquipment :: LWorld -> Creature -> NewIntMap InvInt Item
|
||||
crCurrentEquipment lw = over unNIntMap (IM.filter (isJust . (^? itLocation . ilEquipSite . _Just))) . fmap f . _crInv
|
||||
where
|
||||
f i = lw ^?! items . ix i
|
||||
|
||||
@@ -63,7 +64,8 @@ strFromHeldItem :: LWorld -> Creature -> Int
|
||||
strFromHeldItem lw cr = fromMaybe 0 $ do
|
||||
Aiming <- cr ^? crStance . posture
|
||||
i <- cr ^? crManipulation . manObject . imRootSelectedItem
|
||||
fmap (negate . itemWeight) $ lw ^? items . ix i
|
||||
j <- cr ^? crInv . ix i
|
||||
fmap (negate . itemWeight) $ lw ^? items . ix j
|
||||
|
||||
itemWeight :: Item -> Int
|
||||
itemWeight it = case it ^. itType of
|
||||
|
||||
Reference in New Issue
Block a user