Rethink item ammo to item consumables, start item type datatype
This commit is contained in:
@@ -35,12 +35,12 @@ onBoth :: (a -> b -> c) -> (d -> a) -> (d -> b) -> d -> c
|
||||
onBoth f g h x = f (g x) (h x)
|
||||
|
||||
crIsReloading :: (World, Creature) -> Bool
|
||||
crIsReloading (_,cr) = case cr ^? crInv . ix (_crInvSel cr) . wpAmmo . wpReloadState of
|
||||
crIsReloading (_,cr) = case cr ^? crInv . ix (_crInvSel cr) . itConsumption . wpReloadState of
|
||||
Just t -> t > 0
|
||||
_ -> False
|
||||
|
||||
crIsReloadingR :: Creature -> Reader World Bool
|
||||
crIsReloadingR cr = return $ case cr ^? crInv . ix (_crInvSel cr) . wpAmmo . wpReloadState of
|
||||
crIsReloadingR cr = return $ case cr ^? crInv . ix (_crInvSel cr) . itConsumption . wpReloadState of
|
||||
Just t -> t > 0
|
||||
_ -> False
|
||||
|
||||
@@ -114,7 +114,7 @@ crAwayFromPostR cr = return $ case find sentinelGoal $ _crGoal $ _crActionPlan c
|
||||
sentinelGoal _ = False
|
||||
|
||||
crHasAmmo :: (World,Creature) -> Bool
|
||||
crHasAmmo (_,cr) = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . wpAmmo . wpLoadedAmmo
|
||||
crHasAmmo (_,cr) = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . wpLoadedAmmo
|
||||
|
||||
crCanShoot :: (World,Creature) -> Bool
|
||||
crCanShoot p = crIsAiming p && crHasAmmo p
|
||||
|
||||
Reference in New Issue
Block a user