13 lines
475 B
Haskell
13 lines
475 B
Haskell
-- | Deals with setting a target for creatures
|
|
module Dodge.Creature.SetTarget where
|
|
|
|
import Control.Lens
|
|
import Dodge.Data.World
|
|
--import MaybeHelp
|
|
|
|
-- | Assumes that you are id 0: if creature is cognizant of you, sets you as target
|
|
targetYouWhenCognizant :: World -> Creature -> Creature
|
|
targetYouWhenCognizant _ cr = case cr ^? crPerception . cpAwareness . ix 0 of
|
|
Just (Cognizant _) -> cr & crIntention . targetCr ?~ 0
|
|
_ -> cr & crIntention . targetCr .~ Nothing
|