Cleanup
This commit is contained in:
@@ -24,6 +24,7 @@ import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
import Control.Applicative
|
||||
import Data.Maybe
|
||||
import Data.Bifunctor
|
||||
|
||||
overrideMeleeCloseTarget :: Creature -> Creature
|
||||
overrideMeleeCloseTarget cr = maybe cr (tryMeleeAttack cr) (_targetCr $ _crIntention cr)
|
||||
@@ -117,7 +118,8 @@ reloadOverride cr
|
||||
reloadActions =
|
||||
[ holsterWeapon
|
||||
, 1 `WaitThen`
|
||||
DoActionWhileInterrupt NoAction crIsReloading (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
DoActionWhileInterrupt NoAction (const crIsReloading)
|
||||
(DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
|
||||
overrideInternal :: (Creature -> Bool) -> (Creature -> Creature) -> Creature -> Creature
|
||||
@@ -126,13 +128,13 @@ overrideInternal test update cr
|
||||
| otherwise = cr
|
||||
|
||||
watchUpdateStrat
|
||||
:: [ ((World, Creature) -> Bool, World -> Creature -> Strategy) ]
|
||||
:: [ (World -> Creature -> Bool, World -> Creature -> Strategy) ]
|
||||
-> World
|
||||
-> Creature
|
||||
-> Creature
|
||||
watchUpdateStrat fs w cr = case cr ^? crActionPlan . crStrategy of
|
||||
Just WatchAndWait -> cr
|
||||
& crActionPlan . crStrategy .~ listGuard (fs, \_ _ -> WatchAndWait) (w, cr) w cr
|
||||
& crActionPlan . crStrategy .~ listGuard (map (first uncurry) fs, \_ _ -> WatchAndWait) (w, cr) w cr
|
||||
_ -> cr
|
||||
|
||||
listGuard :: ([(a -> Bool, b)] , b) -> a -> b
|
||||
|
||||
Reference in New Issue
Block a user