Implement basic attention and awareness

This commit is contained in:
2021-05-08 17:34:25 +02:00
parent 1aa59cc205
commit 86faf9fd01
12 changed files with 243 additions and 135 deletions
+14
View File
@@ -2,8 +2,22 @@ module Dodge.Creature.ChooseTarget
where
import Dodge.Data
import Dodge.Base
import Dodge.Creature.AlertLevel.Data
import Control.Lens
import qualified Data.IntMap.Strict as IM
targetYouLOS :: Creature -> World -> Maybe Creature
targetYouLOS cr w
| hasLOS (_crPos cr) (_crPos $ you w) w = Just $ you w
| otherwise = Nothing
targetYouCognizant :: Creature -> World -> Maybe Creature
targetYouCognizant cr w
| hasLOS (_crPos cr) (_crPos $ you w) w
&& isCog (cr ^? crAwarenessLevel . ix 0) = Just $ you w
| otherwise = Nothing
where
isCog x = case x of
Just (Cognizant _) -> True
_ -> False