Gumbo Simple

//This is a simple ai {string,VERSION,1} {number,MAX_ATTACKS,1} {number,DEFAULT_LOOPS,3}

[DECIDE_MINOR] IF EVALUATE HAS_MOVETO RETURN true IF EVALUATE HAS_PATROL RETURN true RETURN false

[DECIDE_MAJOR] IF EVALUATE HAS_MOVETO RETURN true IF EVALUATE HAS_PATROL RETURN true IF IS ENEMY MATCH(alive) RETURN true RETURN false

[MAJOR_START] IF RUN DO_MOVETO ELSEIF RUN ENGAGE ELSEIF RUN SEARCHER ELSEIF RUN DO_PATROL IF IS AP>0 LOOP RETURN

[MINOR_START] IF RUN DO_MOVETO ELSEIF RUN DO_PATROL RETURN

[CAN_ENGAGE] RETURN ENEMY MATCH(alive, in_sight)

[ENGAGE] @gate=CAN_ENGAGE IF SELECT ENEMY MATCH(alive, in_sight) MOVE ACTOR_SELECTION in_cover, sweet_range ELSEIF SELECT INVENTORY MATCH(attack) DO ITEM_SELECTION RETURN

[CAN_SEARCH] RETURN ENEMY MATCH(alive)

[SEARCHER] @gate=CAN_SEARCH IF SELECT ENEMY MATCH(alive) MOVE ACTOR_SELECTION RETURN

[HAS_MOVETO] RETURN SELF MATCH(moveto)

[DO_MOVETO] @gate=HAS_MOVETO MOVE moveto LOOP

[HAS_PATROL] RETURN SELF MATCH(patrol)

[DO_PATROL] @gate=HAS_PATROL MOVE patrol LOOP