This commit is contained in:
2022-06-07 21:34:34 +01:00
parent d2c3d14e46
commit e85bd36fe4
28 changed files with 222 additions and 232 deletions
+3 -3
View File
@@ -24,7 +24,7 @@ onBoth :: (a -> b -> c) -> (d -> a) -> (d -> b) -> d -> c
onBoth f g h x = f (g x) (h x)
crIsReloading :: Creature -> Bool
crIsReloading cr = case cr ^? crInv . ix (_crInvSel cr) . itConsumption . reloadState . _Just' of
crIsReloading cr = case cr ^? crInv . ix (_crInvSel cr) . itConsumption . laReloadState . _Just' of
Just t -> t > 0
_ -> False
@@ -54,7 +54,7 @@ crStratConMatches :: Strategy -> Creature -> Bool
crStratConMatches strat cr = eqConstr strat (_crStrategy $ _crActionPlan cr)
crAwayFromPost :: Creature -> Bool
crAwayFromPost cr = case find sentinelGoal $ _crGoal $ _crActionPlan cr of
crAwayFromPost cr = case find sentinelGoal . _crGoal $ _crActionPlan cr of
Just (SentinelAt p _) -> dist p (_crPos cr) > 15
_ -> False
where
@@ -62,7 +62,7 @@ crAwayFromPost cr = case find sentinelGoal $ _crGoal $ _crActionPlan cr of
sentinelGoal _ = False
crHasAmmo :: Creature -> Bool
crHasAmmo cr = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded
crHasAmmo cr = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . laLoaded
crCanShoot :: Creature -> Bool
crCanShoot p = crIsAiming p && crHasAmmo p