{- | Not a good name, perhaps: internal creature actions. -} module Dodge.Creature.Volition ( holsterWeapon , drawWeapon , shootTillEmpty , fleeFrom , shootFirstMiss ) where import Dodge.Data --import Dodge.Base.Collide import Dodge.Creature.Test import Dodge.Creature.Stance.Data import Dodge.SoundLogic.LoadSound import Geometry holsterWeapon, drawWeapon :: Action holsterWeapon = DoImpulses [ChangePosture AtEase, MakeSound whiteNoiseFadeOutS] drawWeapon = DoImpulses [ChangePosture Aiming, MakeSound whiteNoiseFadeInS] fleeFrom :: Creature -> Maybe Creature -> Action fleeFrom cr mtcr = case mtcr of Just tcr -> DoImpulses [MoveForward 3, TurnToward ((2 *.* _crPos cr) -.- _crPos tcr) (pi/4)] Nothing -> NoAction shootTillEmpty :: Action --shootTillEmpty = (crCanShoot `DoActionWhile` DoImpulses [UseItem]) shootTillEmpty = (crCanShoot `DoActionWhile` DoImpulses [UseItem]) `DoActionThen` 20 `WaitThen` holsterWeapon --advanceShoot :: Int -> Action --advanceShoot tcid = lostest `DoActionWhile` -- advanceShoot' `DoActionThen` -- 75 `DoReplicate` -- advanceShoot' -- where -- lostest (w,cr) = canSee (_crID cr) tcid w -- advanceShoot' = ImpulsesList [[UseItem, MoveForward 3]] shootFirstMiss :: Action shootFirstMiss = LeadTarget (V2 30 50) `DoActionThen` DoImpulses [UseItem] `DoActionThen` (crCanShoot `DoActionWhile` DoActions [LeadTarget (V2 0 0),DoImpulses [UseItem]]) `DoActionThen` 20 `WaitThen` holsterWeapon