Continue reload refactor
This commit is contained in:
@@ -24,12 +24,12 @@ 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 ^? crStance . posture of
|
||||
Just Reloading -> True
|
||||
crIsReloading cr = case cr ^? crInvSel . iselAction of
|
||||
Just ReloadAction {} -> True
|
||||
_ -> False
|
||||
|
||||
crWeaponReady :: Creature -> Bool
|
||||
crWeaponReady cr = isNothing $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . laProgress . _Just
|
||||
crWeaponReady cr = isNothing $ cr ^? crInv . ix (crSel cr) . itConsumption . laProgress . _Just
|
||||
|
||||
crCanSeeCr :: Creature -> (World, Creature) -> Bool
|
||||
crCanSeeCr tcr (w,cr) = hasLOS (_crPos cr) (_crPos tcr) w
|
||||
@@ -65,14 +65,14 @@ 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 . laLoaded
|
||||
crHasAmmo cr = maybe False (> 0) $ cr ^? crInv . ix (crSel cr) . itConsumption . laLoaded
|
||||
|
||||
crCanShoot :: Creature -> Bool
|
||||
crCanShoot p = crIsAiming p && crHasAmmo p
|
||||
|
||||
crInAimStance :: AimStance -> Creature -> Bool
|
||||
crInAimStance as cr = crIsAiming cr -- || (_posture (_crStance cr) == Reloading && hasAmmo cr)
|
||||
&& cr ^? crInv . ix (_crInvSel cr) . itUse . useAim . aimStance == Just as
|
||||
&& cr ^? crInv . ix (crSel cr) . itUse . useAim . aimStance == Just as
|
||||
|
||||
oneH :: Creature -> Bool
|
||||
oneH = crInAimStance OneHand
|
||||
|
||||
Reference in New Issue
Block a user