This commit is contained in:
2021-12-11 22:08:43 +00:00
parent 7116129a37
commit 6cd59d99bc
17 changed files with 115 additions and 170 deletions
+5 -3
View File
@@ -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