Allow equipable items to set targeting
This commit is contained in:
@@ -289,14 +289,8 @@ crSetTargeting cr = fromMaybe cr $ do
|
|||||||
|
|
||||||
crDoTargeting :: Creature -> World -> World
|
crDoTargeting :: Creature -> World -> World
|
||||||
crDoTargeting cr = fromMaybe id $ do
|
crDoTargeting cr = fromMaybe id $ do
|
||||||
itm <- find hastargeting $ helditem ++ IM.elems (getCrEquipment cr)
|
tt <- cr ^? crTargeting . ctType . _Just
|
||||||
invid <- itm ^? itLocation . ipInvID
|
return $ updateTargeting tt cr
|
||||||
return $ doItemTargeting invid cr
|
|
||||||
where
|
|
||||||
helditem = maybeToList $ cr ^? crInv . ix (crSel cr)
|
|
||||||
hastargeting itm = case itm ^? itUse . useTargeting of
|
|
||||||
Just _ -> True
|
|
||||||
_ -> False
|
|
||||||
|
|
||||||
doItemTargeting :: Int -> Creature -> World -> World
|
doItemTargeting :: Int -> Creature -> World -> World
|
||||||
doItemTargeting invid cr w = case cr ^? crInv . ix invid . itUse . useTargeting . _Just of
|
doItemTargeting invid cr w = case cr ^? crInv . ix invid . itUse . useTargeting . _Just of
|
||||||
|
|||||||
Reference in New Issue
Block a user