28 lines
782 B
Haskell
28 lines
782 B
Haskell
module Dodge.Creature.Strategy (
|
|
goToPostStrat,
|
|
) where
|
|
|
|
import Data.List
|
|
import Dodge.Creature.Test
|
|
import Dodge.Creature.Volition
|
|
import Dodge.Data.Creature
|
|
|
|
goToPostStrat :: Creature -> Strategy
|
|
goToPostStrat cr = case find sentinelGoal $ _apGoal $ _crActionPlan cr of
|
|
Just (SentinelAt p _) ->
|
|
StrategyActions
|
|
(GetTo p)
|
|
[ DoActionThen (WaitThen 150 holsterIfAiming) $
|
|
DoActionThen
|
|
(PathTo p NoAction)
|
|
NoAction
|
|
-- $ DoImpulses [ChangeStrategy WatchAndWait]
|
|
]
|
|
_ -> WatchAndWait
|
|
where
|
|
sentinelGoal (SentinelAt _ _) = True
|
|
sentinelGoal _ = False
|
|
holsterIfAiming
|
|
| crIsAiming cr = holsterWeapon
|
|
| otherwise = NoAction
|