Use a creature to "use" the weapon of a turret

This commit is contained in:
2021-12-11 18:06:04 +00:00
parent 15e1fbc060
commit cdeb3dfa67
10 changed files with 80 additions and 34 deletions
+1
View File
@@ -202,5 +202,6 @@ targetYouWhenCognizantR cr = reader $ \w -> case cr ^? crPerception . crAwarenes
targetYouWhenCognizant :: World -> Creature -> Creature
targetYouWhenCognizant w cr = case cr ^? crPerception . crAwarenessLevel . ix 0 of
-- so this caused a space leak: be careful with ?~
-- consider changing targeted creature to be just an index
Just (Cognizant _) -> _creatures w IM.! 0 `seq` cr & crIntention . targetCr ?~ _creatures w IM.! 0
_ -> cr & crIntention . targetCr .~ Nothing