module Dodge.Item.Weapon.Targeting
    ( useTargetPos
    , removeItTarget
    ) where
import Dodge.Data
import Geometry.Data

import Control.Lens
--import qualified Data.IntMap.Strict as IM
useTargetPos 
    :: (Maybe Point2 -> Creature -> World -> World)
    -> Creature
    -> World
    -> World
useTargetPos f cr w = case cr ^? crInv . ix (crSel cr) . itTargeting . tgPos of
    Nothing -> w
    Just p -> f p cr w

removeItTarget :: Item -> Item
removeItTarget = itTargeting . tgPos .~ Nothing
