Make _targetCr an Int id rather than a full creature

This commit is contained in:
2025-10-15 20:09:17 +01:00
parent 57ca53638a
commit 5e6ed1d793
13 changed files with 122 additions and 123 deletions
+3 -7
View File
@@ -6,11 +6,7 @@ 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 w cr = case cr ^? crPerception . cpAwareness . ix 0 of
--Just (Cognizant _) -> cr & crIntention . targetCr ?~ _creatures (_cWorld w) IM.! 0
Just (Cognizant _) -> cr & crIntention . targetCr ?~ (w ^?! cWorld . lWorld . creatures . ix 0)
targetYouWhenCognizant :: World -> Creature -> Creature
targetYouWhenCognizant _ cr = case cr ^? crPerception . cpAwareness . ix 0 of
Just (Cognizant _) -> cr & crIntention . targetCr ?~ 0
_ -> cr & crIntention . targetCr .~ Nothing