module Dodge.Creature.SwarmCrit
    ( swarmCrit
    ) where
import Dodge.Data
import Dodge.Default
import Dodge.Creature.Picture
import Dodge.Creature.Update
--import Dodge.Creature.ChainUpdates
import Dodge.Creature.Boid
import Dodge.Creature.ReaderUpdate
import Dodge.Creature.Perception
--import Dodge.Creature.Impulse
--import Dodge.Creature.State
import Picture

import Control.Lens

swarmCrit :: Creature
swarmCrit = defaultCreature
    { _crUpdate =  defaultImpulsive
        [ flockToPointUsing' (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
        , const (crMeleeCooldown %~ max 0 . subtract 1)
        , perceptionUpdate [0]
        , const doStrategyActions
        , targetYouWhenCognizant
        ]
--        , doStrategyActions
--        , targetYouWhenCognizant
        
    , _crHP = 1
    , _crRad = 2
    , _crMass = 2
    , _crPict = basicCrPict
    , _crCorpse = basicCrCorpse
    , _crFaction = ColorFaction yellow
    , _crMeleeCooldown = 0
    }
    & crSkin . skinUpper .~ light4 yellow

--swarmCritMoveFunc :: Creature -> Point2 -> Creature -> Point2
--swarmCritMoveFunc tcr cenp cr 
--    | targBehindCrit 
--  where
--    cpos = _crPos cr
--    ypos = _crPos tcr


