Distinguish between selected item and root-selected item
This commit is contained in:
+11
-11
@@ -12,11 +12,11 @@ module Dodge.Creature.Test (
|
||||
oneH,
|
||||
twists,
|
||||
twoFlat,
|
||||
crWeaponReady,
|
||||
-- crWeaponReady,
|
||||
crInAimStance,
|
||||
crNearPoint,
|
||||
isAnimate,
|
||||
crCanShoot,
|
||||
-- crCanShoot,
|
||||
crHasTargetLOS,
|
||||
crAwayFromPost,
|
||||
crHasTarget,
|
||||
@@ -38,12 +38,12 @@ import Geometry
|
||||
-- Just ReloadAction{} -> True
|
||||
-- _ -> False
|
||||
|
||||
-- Assumes the ammotype below the selected item is correct
|
||||
crWeaponReady :: Creature -> Bool
|
||||
crWeaponReady cr = fromMaybe False $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
x <- cr ^? crInv . ix (i + 1) . itUse . amagLoadStatus . iaLoaded
|
||||
return (x > 0)
|
||||
---- Assumes the ammotype below the selected item is correct
|
||||
--crWeaponReady :: Creature -> Bool
|
||||
--crWeaponReady cr = fromMaybe False $ do
|
||||
-- i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
-- x <- cr ^? crInv . ix (i + 1) . itUse . amagLoadStatus . iaLoaded
|
||||
-- return (x > 0)
|
||||
|
||||
crCanSeeCr :: Creature -> (World, Creature) -> Bool
|
||||
crCanSeeCr tcr (w, cr) = hasLOS (_crPos cr) (_crPos tcr) w
|
||||
@@ -82,8 +82,8 @@ crAwayFromPost cr = case find sentinelGoal . _apGoal $ _crActionPlan cr of
|
||||
sentinelGoal (SentinelAt _ _) = True
|
||||
sentinelGoal _ = False
|
||||
|
||||
crCanShoot :: Creature -> Bool
|
||||
crCanShoot cr = crIsAiming cr && crWeaponReady cr
|
||||
--crCanShoot :: Creature -> Bool
|
||||
--crCanShoot cr = crIsAiming cr && crWeaponReady cr
|
||||
|
||||
crInAimStance :: AimStance -> Creature -> Bool
|
||||
crInAimStance as cr =
|
||||
@@ -91,7 +91,7 @@ crInAimStance as cr =
|
||||
&& mitstance == Just as
|
||||
where
|
||||
mitstance = do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
i <- cr ^? crManipulation . manObject . inInventory . imRootItem
|
||||
cr ^? crInv . ix i . itUse . heldAim . aimStance
|
||||
|
||||
oneH :: Creature -> Bool
|
||||
|
||||
Reference in New Issue
Block a user