;;   ___________		     _________		      _____  __
;;   \_	  _____/______   ____   ____ \_   ___ \____________ _/ ____\/  |_
;;    |    __) \_  __ \_/ __ \_/ __ \/    \  \/\_  __ \__  \\   __\\   __|
;;    |     \   |  | \/\  ___/\  ___/\     \____|  | \// __ \|  |   |  |
;;    \___  /   |__|    \___  >\___  >\______  /|__|  (____  /__|   |__|
;;	  \/		    \/	   \/	     \/		   \/
;;  ______________________                           ______________________
;;			  T H E   W A R   B E G I N S
;;	   FreeCraft - A free fantasy real time strategy game engine
;;
;;	ai.ccl		-	Define the AI.
;;
;;	(c) Copyright 2000-2002 by Lutz Sammer
;;
;;	FreeCraft is free software; you can redistribute it and/or modify
;;	it under the terms of the GNU General Public License as published
;;	by the Free Software Foundation; only version 2 of the License.
;;
;;	FreeCraft is distributed in the hope that it will be useful,
;;	but WITHOUT ANY WARRANTY; without even the implied warranty of
;;	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;	GNU General Public License for more details.
;;
;;	$Id: ai.ccl,v 1.50 2002/12/17 06:40:30 nehalmistry Exp $

;(define (ai:sleep) () #t)

(define race1 'alliance)
(define race2 'mythical)

;;=============================================================================
;;
;;	AI helper table, the AI must know where to build units,
;;	where to research spells, where to upgrade units.
;;	If this is allowed and which dependencies exists, isn't
;;	handled	here. (see upgrade.ccl)
;;
;;	NOTE: perhaps this could later be used to build the buttons?
;;
;;	(define-ai-helper (list))
;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;	* Race alliance.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define-ai-helper
    ;;
    ;;	Unit can build which buildings.
    ;;
    (list 'build 'unit-peasant
	'unit-farm 'unit-alliance-barracks 'unit-town-hall 'unit-elven-lumber-mill
	'unit-alliance-blacksmith 'unit-alliance-watch-tower 'unit-human-wall
	'unit-alliance-shipyard 'unit-alliance-foundry 'unit-human-refinery
	'unit-inventor 'unit-stables 'unit-mage-tower 'unit-church
	'unit-gryphon-aviary 'unit-dark-portal 'unit-runestone)
    (list 'build 'unit-peasant-with-gold
	'unit-farm 'unit-alliance-barracks 'unit-town-hall 'unit-elven-lumber-mill
	'unit-alliance-blacksmith 'unit-alliance-watch-tower 'unit-human-wall
	'unit-alliance-shipyard 'unit-alliance-foundry 'unit-human-refinery
	'unit-inventor 'unit-stables 'unit-mage-tower 'unit-church
	'unit-gryphon-aviary 'unit-dark-portal 'unit-runestone)
    (list 'build 'unit-peasant-with-wood
	'unit-farm 'unit-alliance-barracks 'unit-town-hall 'unit-elven-lumber-mill
	'unit-alliance-blacksmith 'unit-alliance-watch-tower 'unit-human-wall
	'unit-alliance-shipyard 'unit-alliance-foundry 'unit-human-refinery
	'unit-inventor 'unit-stables 'unit-mage-tower 'unit-church
	'unit-gryphon-aviary 'unit-dark-portal 'unit-runestone)
    (list 'build 'unit-human-oil-tanker 'unit-alliance-oil-platform)
    (list 'build 'unit-human-oil-tanker-full 'unit-alliance-oil-platform)
    ;;
    ;;	Building can train which units.
    ;;
    (list 'train 'unit-farm 'unit-critter)
    (list 'train 'unit-town-hall 'unit-peasant)
    (list 'train 'unit-keep 'unit-peasant)
    (list 'train 'unit-castle 'unit-peasant)
    (list 'train 'unit-alliance-barracks
	'unit-footman 'unit-archer 'unit-ranger 'unit-ballista 'unit-knight
	'unit-paladin)
    (list 'train 'unit-inventor
	'unit-balloon 'unit-dwarves)
    (list 'train 'unit-mage-tower 'unit-mage)
    (list 'train 'unit-gryphon-aviary 'unit-gryphon-rider)
    (list 'train 'unit-alliance-shipyard
	'unit-human-oil-tanker 'unit-alliance-destroyer 'unit-alliance-transport
	'unit-alliance-submarine 'unit-battleship)
    ;;
    ;;	Building can upgrade which upgrades.
    ;;
    (list 'upgrade 'unit-town-hall 'unit-keep)
    (list 'upgrade 'unit-keep 'unit-castle)
    (list 'upgrade 'unit-alliance-watch-tower
	'unit-alliance-guard-tower 'unit-alliance-cannon-tower)
    ;;
    ;;	Building can research which spells or upgrades.
    ;;
    (list 'research 'unit-alliance-blacksmith
	'upgrade-sword1 'upgrade-sword2
	'upgrade-alliance-shield1 'upgrade-alliance-shield2
	'upgrade-ballista1 'upgrade-ballista2)
    (list 'research 'unit-elven-lumber-mill
	'upgrade-arrow1 'upgrade-arrow2 'upgrade-ranger
	'upgrade-ranger-scouting 'upgrade-longbow 'upgrade-ranger-marksmanship)
    (list 'research 'unit-church
	'upgrade-paladin 'upgrade-healing 'upgrade-exorcism)
    (list 'research 'unit-mage-tower
	'upgrade-slow 'upgrade-flame-shield 'upgrade-invisibility
	'upgrade-polymorph 'upgrade-blizzard)
    (list 'research 'unit-alliance-foundry
	'upgrade-alliance-ship-cannon1 'upgrade-alliance-ship-cannon2
	'upgrade-alliance-ship-armor1 'upgrade-alliance-ship-armor2)
    ;;
    ;;	Unit can repair which units.
    ;;
    (list 'repair 'unit-peasant
	'unit-farm 'unit-alliance-barracks 'unit-town-hall 'unit-keep 'unit-castle
	'unit-elven-lumber-mill 'unit-alliance-blacksmith 'unit-alliance-watch-tower
	'unit-alliance-guard-tower 'unit-alliance-cannon-tower 'unit-human-wall
	'unit-alliance-shipyard 'unit-alliance-foundry 'unit-human-refinery
	'unit-inventor 'unit-stables 'unit-mage-tower 'unit-church
	'unit-gryphon-aviary 'unit-dark-portal 'unit-runestone
	'unit-alliance-transport)
    (list 'repair 'unit-peasant-with-gold
	'unit-farm 'unit-alliance-barracks 'unit-town-hall 'unit-keep 'unit-castle
	'unit-elven-lumber-mill 'unit-alliance-blacksmith 'unit-alliance-watch-tower
	'unit-alliance-guard-tower 'unit-alliance-cannon-tower 'unit-human-wall
	'unit-alliance-shipyard 'unit-alliance-foundry 'unit-human-refinery
	'unit-inventor 'unit-stables 'unit-mage-tower 'unit-church
	'unit-gryphon-aviary 'unit-dark-portal 'unit-runestone
	'unit-alliance-transport)
    (list 'repair 'unit-peasant-with-wood
	'unit-farm 'unit-alliance-barracks 'unit-town-hall 'unit-keep 'unit-castle
	'unit-elven-lumber-mill 'unit-alliance-blacksmith 'unit-alliance-watch-tower
	'unit-alliance-guard-tower 'unit-alliance-cannon-tower 'unit-human-wall
	'unit-alliance-shipyard 'unit-alliance-foundry 'unit-human-refinery
	'unit-inventor 'unit-stables 'unit-mage-tower 'unit-church
	'unit-gryphon-aviary 'unit-dark-portal 'unit-runestone
	'unit-alliance-transport)
    ;;
    ;;	Workers can collect which resource.
    ;;
    (list 'collect 'unit-peasant 'gold 'wood 'ore 'stone 'coal)
    (list 'collect 'unit-human-oil-tanker 'oil )
    ;;
    ;;	Workers with resource.
    ;;
    (list 'with-goods 'unit-peasant-with-gold 'gold)
    (list 'with-goods 'unit-peasant-with-wood 'wood)
    (list 'with-goods 'unit-human-oil-tanker-full 'oil )
    ;;
    ;;	Reduce unit limits.
    ;;
    (list 'unit-limit 'unit-farm 'food)
    ;;
    ;;	Equivalence of units for the resource manager.
    ;;
    (list 'unit-equiv 'unit-town-hall
	'unit-keep 'unit-castle)
    (list 'unit-equiv 'unit-keep
	'unit-castle)
    (list 'unit-equiv 'unit-archer
	'unit-ranger)
    (list 'unit-equiv 'unit-knight
	'unit-paladin)
    (list 'unit-equiv 'unit-peasant
	'unit-peasant-with-gold 'unit-peasant-with-wood)
    (list 'unit-equiv 'unit-human-oil-tanker
	'unit-human-oil-tanker-full)
    (list 'unit-equiv 'unit-alliance-watch-tower
	 'unit-alliance-guard-tower 'unit-alliance-cannon-tower) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;	* Race mythical.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define-ai-helper
    ;;
    ;;	Unit can build which buildings.
    ;;
    (list 'build 'unit-peon
	'unit-pig-farm 'unit-mythical-barracks 'unit-great-hall
	'unit-troll-lumber-mill 'unit-mythical-blacksmith 'unit-mythical-watch-tower
	'unit-orc-wall 'unit-mythical-shipyard 'unit-mythical-foundry 'unit-orc-refinery
	'unit-alchemist 'unit-ogre-mound 'unit-temple-of-the-damned
	'unit-altar-of-storms
	'unit-dragon-roost 'unit-dark-portal 'unit-runestone)
    (list 'build 'unit-peon-with-gold
	'unit-pig-farm 'unit-mythical-barracks 'unit-great-hall
	'unit-troll-lumber-mill 'unit-mythical-blacksmith 'unit-mythical-watch-tower
	'unit-orc-wall 'unit-mythical-shipyard 'unit-mythical-foundry 'unit-orc-refinery
	'unit-alchemist 'unit-ogre-mound 'unit-temple-of-the-damned
	'unit-altar-of-storms
	'unit-dragon-roost 'unit-dark-portal 'unit-runestone)
    (list 'build 'unit-peon-with-wood
	'unit-pig-farm 'unit-mythical-barracks 'unit-great-hall
	'unit-troll-lumber-mill 'unit-mythical-blacksmith 'unit-mythical-watch-tower
	'unit-orc-wall 'unit-mythical-shipyard 'unit-mythical-foundry 'unit-orc-refinery
	'unit-alchemist 'unit-ogre-mound 'unit-temple-of-the-damned
	'unit-altar-of-storms
	'unit-dragon-roost 'unit-dark-portal 'unit-runestone)
    (list 'build 'unit-orc-oil-tanker 'unit-mythical-oil-platform)
    (list 'build 'unit-orc-oil-tanker-full 'unit-mythical-oil-platform)
    ;;
    ;;	Building can train which units.
    ;;
    (list 'train 'unit-pig-farm 'unit-critter)
    (list 'train 'unit-great-hall 'unit-peon)
    (list 'train 'unit-stronghold 'unit-peon)
    (list 'train 'unit-fortress 'unit-peon)
    (list 'train 'unit-mythical-barracks
	'unit-grunt 'unit-axethrower 'unit-berserker 'unit-catapult 'unit-ogre
	'unit-ogre-mage)
    (list 'train 'unit-alchemist
	'unit-zeppelin 'unit-goblin-sappers)
    (list 'train 'unit-temple-of-the-damned 'unit-death-knight)
    (list 'train 'unit-dragon-roost 'unit-dragon)
    (list 'train 'unit-mythical-shipyard
	'unit-orc-oil-tanker 'unit-mythical-destroyer 'unit-mythical-transport
	'unit-mythical-submarine 'unit-ogre-juggernaught)
    ;;
    ;;	Building can upgrade which upgrades.
    ;;
    (list 'upgrade 'unit-great-hall 'unit-stronghold)
    (list 'upgrade 'unit-stronghold 'unit-fortress)
    (list 'upgrade 'unit-mythical-watch-tower
	'unit-mythical-guard-tower 'unit-mythical-cannon-tower)
    ;;
    ;;	Building can research which spells or upgrades.
    ;;
    (list 'research 'unit-mythical-blacksmith
	'upgrade-battle-axe1 'upgrade-battle-axe2
	'upgrade-mythical-shield1 'upgrade-mythical-shield2
	'upgrade-catapult1 'upgrade-catapult2)
    (list 'research 'unit-troll-lumber-mill
	'upgrade-throwing-axe1 'upgrade-throwing-axe2 'upgrade-berserker
	'upgrade-berserker-scouting 'upgrade-light-axes
	'upgrade-berserker-regeneration)
    (list 'research 'unit-altar-of-storms
	'upgrade-ogre-mage 'upgrade-bloodlust 'upgrade-runes)
    (list 'research 'unit-temple-of-the-damned
	'upgrade-haste 'upgrade-raise-dead 'upgrade-whirlwind
	'upgrade-unholy-armor 'upgrade-death-and-decay)
    (list 'research 'unit-mythical-foundry
	'upgrade-mythical-ship-cannon1 'upgrade-mythical-ship-cannon2
	'upgrade-mythical-ship-armor1 'upgrade-mythical-ship-armor2)
    ;;
    ;;	Unit can build which units.
    ;;
    (list 'repair 'unit-peon
	'unit-pig-farm 'unit-mythical-barracks 'unit-great-hall 'unit-stronghold
	'unit-fortress 'unit-troll-lumber-mill 'unit-mythical-blacksmith
	'unit-mythical-watch-tower 'unit-mythical-guard-tower 'unit-mythical-cannon-tower
	'unit-orc-wall 'unit-mythical-shipyard 'unit-mythical-foundry 'unit-orc-refinery
	'unit-alchemist 'unit-ogre-mound 'unit-temple-of-the-damned
	'unit-altar-of-storms 'unit-dragon-roost 'unit-dark-portal
	'unit-runestone 'unit-mythical-transport)
    (list 'repair 'unit-peon-with-gold
	'unit-pig-farm 'unit-mythical-barracks 'unit-great-hall 'unit-stronghold
	'unit-fortress 'unit-troll-lumber-mill 'unit-mythical-blacksmith
	'unit-mythical-watch-tower 'unit-mythical-guard-tower 'unit-mythical-cannon-tower
	'unit-orc-wall 'unit-mythical-shipyard 'unit-mythical-foundry 'unit-orc-refinery
	'unit-alchemist 'unit-ogre-mound 'unit-temple-of-the-damned
	'unit-altar-of-storms 'unit-dragon-roost 'unit-dark-portal
	'unit-runestone 'unit-mythical-transport)
    (list 'repair 'unit-peon-with-wood
	'unit-pig-farm 'unit-mythical-barracks 'unit-great-hall 'unit-stronghold
	'unit-fortress 'unit-troll-lumber-mill 'unit-mythical-blacksmith
	'unit-mythical-watch-tower 'unit-mythical-guard-tower 'unit-mythical-cannon-tower
	'unit-orc-wall 'unit-mythical-shipyard 'unit-mythical-foundry 'unit-orc-refinery
	'unit-alchemist 'unit-ogre-mound 'unit-temple-of-the-damned
	'unit-altar-of-storms 'unit-dragon-roost 'unit-dark-portal
	'unit-runestone 'unit-mythical-transport)
    ;;
    ;;	Workers can collect which resource.
    ;;
    (list 'collect 'unit-peon 'gold 'wood 'ore 'stone 'coal)
    (list 'collect 'unit-orc-oil-tanker 'oil )
    ;;
    ;;	Workers with resource.
    ;;
    (list 'with-goods 'unit-peon-with-gold 'gold)
    (list 'with-goods 'unit-peon-with-wood 'wood)
    (list 'with-goods 'unit-orc-oil-tanker-full 'oil )
    ;;
    ;;	Reduce unit limits.
    ;;
    (list 'unit-limit 'unit-pig-farm 'food)
    ;;
    ;;	Equivalence of units for the resource manager.
    ;;
    (list 'unit-equiv 'unit-great-hall
	'unit-stronghold 'unit-fortress)
    (list 'unit-equiv 'unit-stronghold
	'unit-fortress)
    (list 'unit-equiv 'unit-axethrower
	'unit-berserker)
    (list 'unit-equiv 'unit-ogre
	'unit-ogre-mage)
    (list 'unit-equiv 'unit-peon
	'unit-peon-with-gold 'unit-peon-with-wood)
    (list 'unit-equiv 'unit-orc-oil-tanker
	'unit-orc-oil-tanker-full)
    (list 'unit-equiv 'unit-mythical-watch-tower
	 'unit-mythical-guard-tower 'unit-mythical-cannon-tower) )

;;=============================================================================
;;
;;	AI Script commands
;;
;;	(ai:debug flag) (ai:debug #f)
;;
;;		Enables printing of the AI commands.
;;
;;	(ai:need unit-type) (ai:need 'unit-farm)
;;
;;		Tells the ai that it should have this type of unit.
;;		They are build in the ordered of the commands.
;;		If lost automatic rebuild.
;;
;;	(ai:set unit-type count) (ai:set 'unit-farm 4)
;;
;;		Tells the ai that it should have count units of this type.
;;		If there is already a request of this unit-type it number is
;;		changed. They are build in the ordered of the commands.
;;		If lost automatic rebuild.
;;
;;	(ai:wait unit-type) (ai:wait 'unit-peasant)
;;
;;		Waits until the *first* request of this unit-type is completed.
;;
;;	(ai:force force unit-type1 count1 ... unit-typeN countN)
;;	(ai:force 0 'unit-footman 4 'unit-archer 4)
;;
;;		Defines a force for the AI. Ten forces are supported.
;;		Fmythicale 0 defaults currently to the home defence and send
;;		if a building is attacked.
;;
;;	(ai:wait-force force) (ai:wait-force 1)
;;
;;		Wait until a force is complete, the forces are build in
;;		force number order. First 0, than 1, last 9.
;;
;;	(ai:attack-with-force force) (ai-attack-with-force 1)
;;
;;		Attack the opponent with a force.
;;
;;	(ai:sleep frames) (ai:sleep 1000)
;;
;;		Wait some frames, to let the opponent recover.
;;
;;	(ai:research upgrade) (ai:research 'upgrade-shield1)
;;
;;		Let the AI research an upgrade, upgrades are reseached in
;;		command order. And automatic researched if lost.
;;		Building orders have a higher priority.
;;
;;	(ai:upgrade-to unit-type) (ai:upgrade-to 'unit-keep)
;;
;;		Upgrade units to an improved type. You must give for each
;;		unit you want to upgrade an upgrade command. The computer
;;		automatic searches which unit it upgrades.
;;
;;	(ai:script list) (ai:script '(...))
;;
;;		Execute a new script, can be used for loops, subroutines.
;;
;;	(ai:restart) (ai:restart)
;;
;;		Restart with the main AI script.
;;
;; ----------------------------------------------------------------------------
;;	Planned, not ready.
;;
;;	Enable or disable the AI cheating on unexplored area.
;;	    (set-cheat-unexplored! #t)
;;		The AI sees all area explored.
;;	    (set-cheat-unexplored! #f)
;;		The AI sees unexplored area as it is.
;;
;;	(set-cheat-unexplored! #t)
;;
;;	Enable or disable the AI cheating on visible area.
;;	    (set-cheat-visible! #t)
;;		The AI sees all area visible.
;;	    (set-cheat-visible! #f)
;;		The AI sees visible area as it is.
;;
;;	(set-cheat-visible! #t)
;;


;;=============================================================================
;;
;;	Define an AI engine.
;;
;;	(define-ai name race class script)
;;
;;	name	name of the AI for selection.
;;	class	class of the AI for map editor.
;;	script	Main AI script.
;;
(define-ai "wc2-passive" "*" "passive"
  '(
    ;;	Define the main AI script.
    (ai:sleep	10000)
    (ai:restart)
    ))

;;=============================================================================

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;  grunt-rush tactics
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define ai:mythical-land-rush-endloop
  '((writes nil "Looping !\n")
    (ai:force 0 'unit-grunt 15 'unit-ogre-mage 9 'unit-catapult 3)
    (ai:force 1 'unit-grunt 20)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:script ai:mythical-land-rush-endloop) ) )

(define-ai 'rush race2 "gruntrush"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:need (unit-type 'unit-great-hall))
    (ai:set  'unit-peon 1)
    (ai:wait 'unit-great-hall)
    (ai:wait 'unit-peon)	;; start hangs if nothing available

    (ai:set  'unit-peon 10)
    (ai:set  'unit-pig-farm 2)
    (ai:need 'unit-mythical-barracks)
    (ai:need 'unit-mythical-blacksmith)
    (ai:force 1 'unit-grunt 1)
    (ai:force 0 'unit-grunt 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)


    (ai:force 0 'unit-grunt 2)
    (ai:research 'upgrade-battle-axe1)
    (ai:research 'upgrade-mythical-shield1)
    (ai:research 'upgrade-battle-axe2)
    (ai:research 'upgrade-mythical-shield2)
    (ai:set  'unit-peon 20)
    (ai:force 1 'unit-grunt 6)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:set 'unit-mythical-barracks 3)
    (ai:force 1 'unit-grunt 20)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:set 'unit-mythical-barracks 6)
    (ai:force 1 'unit-grunt 40)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:set  'unit-pig-farm 25)


    (ai:force 0 'unit-grunt 9)
    (ai:force 2 'unit-grunt 20)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:force 0 'unit-grunt 15)
    (ai:force 1 'unit-grunt 20)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:need (unit-type 'unit-great-hall))

    (ai:force 0 'unit-grunt 15)
    (ai:force 2 'unit-grunt 80)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:force 1 'unit-grunt 20)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 2 'unit-grunt 20)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:force 1 'unit-grunt 20)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 2 'unit-grunt 20)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)





    (ai:force 1 'unit-grunt 9)
    (ai:force 2 'unit-grunt 4)
    (ai:force 3 'unit-grunt 5)
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 3)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:set 'unit-ogre-mound 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:force 0 'unit-grunt 9)
    (ai:force 4 'unit-grunt 9)

    (ai:set  'unit-peon 25)

    (ai:set  'unit-pig-farm 20)
    (ai:force 0 'unit-grunt 9 'unit-ogre 1)
    (ai:force 1 'unit-grunt 9)
    (ai:force 2 'unit-grunt 9)
    (ai:force 3 'unit-grunt 12)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:set 'unit-mythical-barracks 9)
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:force 0 'unit-grunt 9 'unit-ogre 3)
    (ai:force 1 'unit-grunt 14)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 3)

    (ai:force 0 'unit-grunt 14 'unit-axethrower 2 'unit-ogre 5 'unit-catapult 1)
    (ai:force 1 'unit-grunt 9)
    (ai:force 2 'unit-grunt 9)
    (ai:force 3 'unit-grunt 9)
    (ai:force 4 'unit-grunt 4)
    (ai:force 5 'unit-grunt 9 'unit-ogre 3)
    (ai:wait-force 4)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)
    (ai:attack-with-force 3)
    (ai:attack-with-force 4)

    (ai:force 6 'unit-grunt 19)
    (ai:force 7 'unit-grunt 19)

    (ai:force 0 'unit-grunt 9 'unit-axethrower 9 'unit-ogre 9 'unit-catapult 2)
    (ai:force 1 'unit-grunt 9 'unit-ogre 3)
    (ai:wait-force 5)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 5)
    (ai:attack-with-force 6)
    (ai:attack-with-force 7)

    (ai:force 1 'unit-grunt 9 'unit-ogre 2)
    (ai:force 2 'unit-grunt 9)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:force 1 'unit-grunt 11 'unit-ogre 4)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 1 'unit-grunt 15)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 1 'unit-grunt 11 'unit-ogre 4)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 1 'unit-grunt 15)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

	(ai:sleep 500)
    (ai:force 0 'unit-grunt 1 'unit-axethrower 0 'unit-ranger 2
	'unit-ogre-mage 6 'unit-catapult 1 'unit-death-knight 5)
    (ai:force 1 'unit-grunt 1 'unit-axethrower 0 'unit-ranger 2
	'unit-ogre-mage 2 'unit-catapult 1 'unit-death-knight 1)
    (ai:force 2 'unit-dragon 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    ;;(ai:sleep 500)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-cannon-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:research 'upgrade-catapult1)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-cannon-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:research 'upgrade-catapult2)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-cannon-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:set  'unit-peon 25)

    ;; Everything researched...

    (ai:script ai:mythical-land-rush-endloop) ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;  goldfever tactics
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define ai:mythical-goldfever-endloop
  '((writes nil "Looping !\n")
    (ai:force 0 'unit-grunt 15)

    (ai:sleep 500)
    (ai:script ai:mythical-goldfever-endloop) ) )

(define-ai 'goldfever race2 "goldfever"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:need (unit-type 'unit-great-hall))
    (ai:set  'unit-peon 1)
    (ai:wait 'unit-great-hall)
    (ai:wait 'unit-peon)	;; start hangs if nothing available

    (ai:set  'unit-pig-farm 1)

    (ai:set  'unit-peon 5)
    (ai:wait 'unit-peon)

    (ai:need 'unit-mythical-barracks)

    (ai:set  'unit-peon 50)
    (ai:script ai:mythical-goldfever-endloop) ))

;;=============================================================================
;;	Air Attack AI, this is an example for a multi race AI.
;;=============================================================================

;;
;;	City-center of the current race.
;;
(define (ai:city-center)
  (if (eq? (ai:get-race) race1)
      'unit-town-hall 'unit-great-hall) )

;;
;;	Better city-center of the current race.
;;
(define (ai:better-city-center)
  (if (eq? (ai:get-race) race1)
      'unit-keep 'unit-stronghold) )

;;
;;	Best city-center of the current race.
;;
(define (ai:best-city-center)
  (if (eq? (ai:get-race) race1)
      'unit-castle 'unit-fortress) )

;;
;;	Worker of the current race.
;;
(define (ai:worker)
  (if (eq? (ai:get-race) race1)
      'unit-peasant 'unit-peon) )

;;
;;	Lumber mill of the current race.
;;
(define (ai:lumber-mill)
  (if (eq? (ai:get-race) race1)
      'unit-elven-lumber-mill 'unit-troll-lumber-mill) )

;;
;;	Blacksmith of the current race.
;;
(define (ai:blacksmith)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-blacksmith 'unit-mythical-blacksmith) )

;;
;;	Upgrade armor 1 of the current race.
;;
(define (ai:upgrade-armor-1)
  (if (eq? (ai:get-race) race1)
      'upgrade-alliance-shield1 'upgrade-mythical-shield1) )

;;
;;	Upgrade armor 2 of the current race.
;;
(define (ai:upgrade-armor-2)
  (if (eq? (ai:get-race) race1)
      'upgrade-alliance-shield2 'upgrade-mythical-shield2) )

;;
;;	Upgrade weapon 1 of the current race.
;;
(define (ai:upgrade-weapon-1)
  (if (eq? (ai:get-race) race1)
      'upgrade-sword1 'upgrade-battle-axe1) )

;;
;;	Upgrade weapon 2 of the current race.
;;
(define (ai:upgrade-weapon-2)
  (if (eq? (ai:get-race) race1)
      'upgrade-sword2 'upgrade-battle-axe2) )

;;
;;	Upgrade missile 1 of the current race.
;;
(define (ai:upgrade-missile-1)
  (if (eq? (ai:get-race) race1)
      'upgrade-arrow1 'upgrade-throwing-axe1) )

;;
;;	Upgrade missile 2 of the current race.
;;
(define (ai:upgrade-missile-2)
  (if (eq? (ai:get-race) race1)
      'upgrade-arrow2 'upgrade-throwing-axe2) )

;;
;;	Upgrade catapult 1 of the current race.
;;
(define (ai:upgrade-catapult-1)
  (if (eq? (ai:get-race) race1)
      'upgrade-ballista1 'upgrade-catapult1) )

;;
;;	Upgrade catapult 2 of the current race.
;;
(define (ai:upgrade-catapult-2)
  (if (eq? (ai:get-race) race1)
      'upgrade-ballista2 'upgrade-catapult2) )

;;
;;	Research of the current race.
;;
(define (ai:scientific)
  (if (eq? (ai:get-race) race1)
      'unit-inventor 'unit-alchemist) )

;;
;;	Cavalry of the current race.
;;
(define (ai:cavalry)
  (if (eq? (ai:get-race) race1)
      'unit-stables 'unit-ogre-mound) )

;;
;;	Temple of the current race.
;;
(define (ai:temple)
  (if (eq? (ai:get-race) race1)
      'unit-church 'unit-altar-of-storms) )

;;
;;	Airport of the current race.
;;
(define (ai:airport)
  (if (eq? (ai:get-race) race1)
      'unit-gryphon-aviary 'unit-dragon-roost) )

;;
;;	Barracks of the current race.
;;
(define (ai:barracks)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-barracks 'unit-mythical-barracks) )

;;
;;	Soldier of the current race.
;;
(define (ai:soldier)
  (if (eq? (ai:get-race) race1)
      'unit-footman 'unit-grunt) )

;;
;;	Shooter of the current race.
;;
(define (ai:shooter)
  (if (eq? (ai:get-race) race1)
      'unit-archer 'unit-axethrower) )

;;
;;	Elite Shooter of the current race.
;;
(define (ai:elite-shooter)
  (if (eq? (ai:get-race) race1)
      'unit-ranger 'unit-berserker) )

;;
;;	Cavalrie of the current race.
;;
(define (ai:cavalrie)
  (if (eq? (ai:get-race) race1)
      'unit-knight 'unit-ogre) )

;;
;;	Cavalrie mages of the current race.
;;
(define (ai:cavalrie-mage)
  (if (eq? (ai:get-race) race1)
      'unit-paladin 'unit-ogre-mage) )

;;
;;	Mage of the current race.
;;
(define (ai:mage)
  (if (eq? (ai:get-race) race1)
      'unit-mage 'unit-death-knight) )

;;
;;	Catapult of the current race.
;;
(define (ai:catapult)
  (if (eq? (ai:get-race) race1)
      'unit-ballista 'unit-catapult) )

;;
;;	Scout of the current race.
;;
(define (ai:scout)
  (if (eq? (ai:get-race) race1)
      'unit-balloon 'unit-zeppelin) )

;;
;;	Flyer of the current race.
;;
(define (ai:flyer)
  (if (eq? (ai:get-race) race1)
      'unit-gryphon-rider 'unit-dragon) )

;;
;;	Tower of the current race.
;;
(define (ai:tower)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-watch-tower 'unit-mythical-watch-tower) )

;;
;;	Guard-Tower of the current race.
;;
(define (ai:guard-tower)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-guard-tower 'unit-mythical-guard-tower) )

;;
;;	Cannon-Tower of the current race.
;;
(define (ai:cannon-tower)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-cannon-tower 'unit-mythical-cannon-tower) )

;;
;;	Harbor of the current race.
;;
(define (ai:harbor)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-shipyard 'unit-mythical-shipyard) )

;;
;;	Refinery of the current race.
;;
(define (ai:refinery)
  (if (eq? (ai:get-race) race1)
      'unit-human-refinery 'unit-orc-refinery) )

;;
;;	Foundry of the current race.
;;
(define (ai:foundry)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-foundry 'unit-mythical-foundry) )

;;
;;	Ship armor 1 of the current race.
;;
(define (ai:upgrade-ship-armor-1)
  (if (eq? (ai:get-race) race1)
      'upgrade-alliance-ship-armor1 'upgrade-mythical-ship-armor1) )

;;
;;	Ship armor 2 of the current race.
;;
(define (ai:upgrade-ship-armor-2)
  (if (eq? (ai:get-race) race1)
      'upgrade-alliance-ship-armor2 'upgrade-mythical-ship-armor2) )

;;
;;	Ship weapon 1 of the current race.
;;
(define (ai:upgrade-ship-cannon-1)
  (if (eq? (ai:get-race) race1)
      'upgrade-alliance-ship-cannon1 'upgrade-mythical-ship-cannon1) )

;;
;;	Ship weapon 2 of the current race.
;;
(define (ai:upgrade-ship-cannon-2)
  (if (eq? (ai:get-race) race1)
      'upgrade-alliance-ship-cannon2 'upgrade-mythical-ship-cannon2) )

;;
;;	Platform of the current race.
;;
(define (ai:platform)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-oil-platform 'unit-mythical-oil-platform) )

;;
;;	Tanker of the current race.
;;
(define (ai:tanker)
  (if (eq? (ai:get-race) race1)
      'unit-human-oil-tanker 'unit-orc-oil-tanker) )

;;
;;	Submarine of the current race.
;;
(define (ai:submarine)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-submarine 'unit-mythical-submarine) )

;;
;;	Destroyer of the current race.
;;
(define (ai:destroyer)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-destroyer 'unit-mythical-destroyer) )

;;
;;	Battleship of the current race.
;;
(define (ai:battleship)
  (if (eq? (ai:get-race) race1)
      'unit-battleship 'unit-ogre-juggernaught) )

;;
;;	Transporter of the current race.
;;
(define (ai:transporter)
  (if (eq? (ai:get-race) race1)
      'unit-alliance-transport 'unit-mythical-transport) )

;;
;;	1st Elite Shooter of the current race.
;;
(define (ai:upgrade-elite-shooter)
  (if (eq? (ai:get-race) race1)
      'upgrade-ranger 'upgrade-berserker) )

;;
;;	1st Upgrade of elite Shooter of the current race.
;;
(define (ai:upgrade-elite-shooter-1)
  (if (eq? (ai:get-race) race1)
      'upgrade-ranger-scouting 'upgrade-berserker-scouting) )

;;
;;	2nd Upgrade of elite Shooter of the current race.
;;
(define (ai:upgrade-elite-shooter-2)
  (if (eq? (ai:get-race) race1)
      'upgrade-longbow 'upgrade-light-axes) )

;;
;;	3th Upgrade of elite Shooter of the current race.
;;
(define (ai:upgrade-elite-shooter-3)
  (if (eq? (ai:get-race) race1)
      'upgrade-ranger-marksmanship 'upgrade-berserker-regeneration) )

;;
;;	Upgrade cavalrie to cavalrie mages of the current race.
;;
(define (ai:upgrade-cavalrie-mage)
  (if (eq? (ai:get-race) race1)
      'upgrade-paladin 'upgrade-ogre-mage) )

;;
;;	1st spell of the cavalrie mages of the current race.
;;
(define (ai:cavalrie-mage-spell-1)
  (if (eq? (ai:get-race) race1)
      'upgrade-healing 'upgrade-bloodlust))

;;
;;	2nd spell of the cavalrie mages of the current race.
;;
(define (ai:cavalrie-mage-spell-2)
  (if (eq? (ai:get-race) race1)
      'upgrade-exorcism 'upgrade-runes))

;;
;;	1st spell of the mages of the current race.
;;
(define (ai:mage-spell-1)
  (if (eq? (ai:get-race) race1)
      'upgrade-slow 'upgrade-haste))

;;
;;	2nd spell of the mages of the current race.
;;
(define (ai:mage-spell-2)
  (if (eq? (ai:get-race) race1)
      'upgrade-flame-shield 'upgrade-raise-dead))

;;
;;	3th spell of the mages of the current race.
;;
(define (ai:mage-spell-3)
  (if (eq? (ai:get-race) race1)
      'upgrade-invisibility 'upgrade-whirlwind))

;;
;;	4th spell of the mages of the current race.
;;
(define (ai:mage-spell-4)
  (if (eq? (ai:get-race) race1)
      'upgrade-polymorph 'upgrade-unholy-armor))

;;
;;	5th spell of the mages of the current race.
;;
(define (ai:mage-spell-5)
  (if (eq? (ai:get-race) race1)
      'upgrade-blizzard 'upgrade-death-and-decay))

;;=============================================================================
;;
;;	Define an AI engine.
;;
;;	(define-ai name race class script)
;;
;;	name	name of the AI for selection.
;;	class	class of the AI for map editor.
;;	script	Main AI script.
;;
(define ai:air-attack-endloop
  '((writes nil "Looping !\n")
    (ai:force 1 (ai:flyer) 2)
    (ai:force 2 (ai:flyer) 2)
    (ai:force 3 (ai:flyer) 2)
    (ai:force 4 (ai:flyer) 2)
    (ai:force 5 (ai:flyer) 2)
    (ai:force 6 (ai:flyer) 1)
    (ai:wait-force 5)
    (ai:wait-force 6)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)
    (ai:attack-with-force 3)
    (ai:attack-with-force 4)
    (ai:attack-with-force 5)
    (ai:sleep 500)
    (ai:script ai:air-attack-endloop) ))

(define-ai "wc2-air-attack" "*" "air-attack"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:set-reserve! #( 0  0 0 0  0 0 0))
    (ai:need (ai:city-center))
    (ai:set  (ai:worker) 1)
    (ai:wait (ai:city-center))
    (ai:wait (ai:worker))	;; start hangs if nothing is available

    (ai:set  (ai:worker) 9)
    (ai:need (ai:lumber-mill))
    (ai:need (ai:barracks))
    (ai:force 0 (ai:soldier) 2)
    (ai:wait-force 0)		;; wait until defence is ready

    (ai:need (ai:blacksmith))
    (ai:upgrade-to (ai:better-city-center))
    (ai:set  (ai:worker) 15)
    (ai:force 0 (ai:soldier) 2 (ai:shooter) 3)
    (ai:wait (ai:better-city-center))

    (ai:need (ai:cavalry))
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:guard-tower))
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:guard-tower))
    (ai:upgrade-to (ai:best-city-center))
    (ai:wait (ai:best-city-center))	;; need this for airport!

    (ai:need (ai:airport))
    (ai:force 2 (ai:flyer) 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:sleep 500)
    (ai:need (ai:city-center))
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:guard-tower))
    (ai:need (ai:airport))
    (ai:force 2 (ai:flyer) 2)
    (ai:wait-force 2)		;; wait until attack party is completed

    (ai:need (ai:city-center))
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:guard-tower))
    (ai:need (ai:airport))
    (ai:set  (ai:worker) 20)
    (ai:force 1 (ai:flyer) 2)
    (ai:attack-with-force 2)

    (ai:sleep 500)
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:guard-tower))
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:cannon-tower))
    (ai:force 2 (ai:flyer) 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 500)
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:guard-tower))
    (ai:need (ai:tower))
    (ai:force 1 (ai:flyer) 2)
    (ai:force 2 (ai:flyer) 2)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 500)
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:guard-tower))
    (ai:need (ai:tower))
    (ai:force 1 (ai:flyer) 1)
    (ai:force 2 (ai:flyer) 2)
    (ai:force 3 (ai:flyer) 2)
    (ai:wait-force 2)
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 2)
    (ai:attack-with-force 3)

    (ai:sleep 500)
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:guard-tower))
    (ai:need (ai:tower))
    (ai:force 1 (ai:flyer) 2)
    (ai:force 2 (ai:flyer) 2)
    (ai:force 3 (ai:flyer) 2)
    (ai:wait-force 2)
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 2)
    (ai:attack-with-force 3)

    (ai:sleep 500)
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:guard-tower))
    (ai:need (ai:tower))
    (ai:force 1 (ai:flyer) 2)
    (ai:force 2 (ai:flyer) 2)
    (ai:force 3 (ai:flyer) 3)
    (ai:wait-force 2)
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 2)
    (ai:attack-with-force 3)

    (ai:sleep 500)
    (ai:need (ai:tower))
    (ai:upgrade-to (ai:guard-tower))
    (ai:need (ai:tower))
    (ai:force 1 (ai:flyer) 2)
    (ai:force 2 (ai:flyer) 3)
    (ai:force 3 (ai:flyer) 3)
    (ai:wait-force 2)
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 2)
    (ai:attack-with-force 3)

    (ai:sleep 500)
    (ai:force 1 (ai:flyer) 1)
    (ai:force 2 (ai:flyer) 2)
    (ai:force 3 (ai:flyer) 2)
    (ai:force 4 (ai:flyer) 2)
    (ai:force 5 (ai:flyer) 2)
    (ai:wait-force 5)		;; wait until attack party is completed
    (ai:attack-with-force 2)
    (ai:attack-with-force 3)
    (ai:attack-with-force 4)
    (ai:attack-with-force 5)

    (ai:sleep 500)
    (ai:script ai:air-attack-endloop) ))

;;=============================================================================
;;
;;	Define an AI engine.
;;
;;	(define-ai name race class script)
;;
;;	name	name of the AI for selection.
;;	class	class of the AI for map editor.
;;	script	Main AI script.
;;
(define ai:sea-attack-endloop
  '((writes nil "Looping !\n")
    (ai:force 1 (ai:destroyer) 6 (ai:battleship) 7 (ai:scout) 1)
    (ai:force 2 (ai:soldier) 4 (ai:cavalrie) 4 (ai:catapult) 4
	(ai:transporter) 2)
    (ai:wait-force 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)
    (ai:sleep 500)
    (ai:script ai:sea-attack-endloop) ))

(define-ai "wc2-sea-attack" "*" "sea-attack"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:need (ai:city-center))
    (ai:set  (ai:worker) 1)
    (ai:wait (ai:city-center))
    (ai:wait (ai:worker))	;; start hangs if nothing is available

    (ai:set  (ai:worker) 9)
    (ai:need (ai:lumber-mill))
    (ai:need (ai:barracks))
    (ai:force 0 (ai:soldier) 3)
    (ai:wait-force 0)		;; wait until defence is ready

    (ai:need (ai:harbor))
    (ai:upgrade-to (ai:better-city-center))
    (ai:need (ai:refinery))
    (ai:need (ai:scientific))
    (ai:set  (ai:worker) 15)
    (ai:set  (ai:tanker) 1)
    (ai:need (ai:platform))
    (ai:wait (ai:better-city-center))

    (ai:set  (ai:tanker) 3)
    (ai:force 1 (ai:submarine) 3)
    (ai:wait-force 1)		;; wait until attack force is ready
    (ai:attack-with-force 1)

    (ai:sleep 500)
    (ai:need (ai:foundry))
    (ai:research (ai:upgrade-ship-armor-1))
    (ai:research (ai:upgrade-ship-armor-2))
    (ai:set  (ai:tanker) 4)
    (ai:force 1 (ai:submarine) 4)
    (ai:wait-force 1)		;; wait until attack force is ready
    (ai:attack-with-force 1)

    (ai:sleep 500)
    (ai:need (ai:harbor))
    (ai:need (ai:blacksmith))
    (ai:force 1 (ai:submarine) 5 (ai:scout) 1)
    (ai:wait-force 1)		;; wait until attack force is ready
    (ai:attack-with-force 1)

    (ai:sleep 500)
    (ai:research (ai:upgrade-catapult-1))
    (ai:need (ai:cavalry))
    (ai:force 0 (ai:soldier) 3 (ai:catapult) 1 (ai:scout) 1)
    (ai:force 1 (ai:submarine) 1 (ai:destroyer) 2 (ai:battleship) 1
	(ai:scout) 2)
    (ai:sleep 3000)
    (ai:wait-force  1)
    (ai:attack-with-force 1)

    (ai:force 0 (ai:soldier) 3 (ai:catapult) 1 (ai:scout) 1)
    (ai:force 3 (ai:destroyer) 1 (ai:scout) 1)
    (ai:force 1 (ai:submarine) 1 (ai:destroyer) 2 (ai:battleship) 2
	(ai:scout) 2)
    (ai:force 2 (ai:catapult) 2 (ai:transporter) 1)
    (ai:wait-force  1)
    (ai:attack-with-force 1)

    (ai:sleep 500)
    (ai:research (ai:upgrade-catapult-2))
    (ai:research (ai:upgrade-ship-cannon-1))
    (ai:force 0 (ai:soldier) 3 (ai:catapult) 1 (ai:scout) 1)
    (ai:force 3 (ai:destroyer) 1 (ai:battleship) 1 (ai:scout) 1)
    (ai:force 1 (ai:submarine) 1 (ai:destroyer) 2 (ai:battleship) 3
	(ai:scout) 1)
    (ai:force 2 (ai:cavalrie) 1 (ai:catapult) 3 (ai:transporter) 1)
    (ai:wait-force  1)
    (ai:attack-with-force 1)

    (ai:sleep 500)
    (ai:research (ai:upgrade-ship-cannon-2))
    (ai:need (ai:city-center))
    (ai:force 0 (ai:soldier) 3 (ai:catapult) 1 (ai:scout) 1)
    (ai:force 3 (ai:destroyer) 1 (ai:battleship) 1 (ai:scout) 1)
    (ai:force 1 (ai:submarine) 1 (ai:destroyer) 3 (ai:battleship) 4
	(ai:scout) 1)
    (ai:force 2 (ai:cavalrie) 3 (ai:catapult) 3 (ai:transporter) 1)
    (ai:wait-force  1)
    (ai:attack-with-force 1)

    (ai:sleep 500)
    (ai:need (ai:harbor))
    (ai:research (ai:upgrade-weapon-1))
    (ai:research (ai:upgrade-armor-1))
    (ai:research (ai:upgrade-weapon-2))
    (ai:research (ai:upgrade-armor-2))
    (ai:set  (ai:tanker) 5)
    (ai:force 0 (ai:soldier) 3 (ai:catapult) 1 (ai:scout) 1)
    (ai:force 3 (ai:destroyer) 1 (ai:battleship) 1 (ai:scout) 1)
    (ai:force 1 (ai:submarine) 1 (ai:destroyer) 4 (ai:battleship) 5
	(ai:scout) 1)
    (ai:force 2 (ai:cavalrie) 3 (ai:catapult) 3 (ai:transporter) 1)
    (ai:wait-force  1)
    (ai:attack-with-force 1)

    (ai:sleep 500)
    (ai:force 0 (ai:soldier) 3 (ai:catapult) 1 (ai:scout) 1)
    (ai:force 3 (ai:destroyer) 1 (ai:battleship) 1 (ai:scout) 1)
    (ai:force 1 (ai:submarine) 1 (ai:destroyer) 5 (ai:battleship) 6
	(ai:scout) 1)
    (ai:force 2 (ai:cavalrie) 4 (ai:catapult) 2 (ai:transporter) 1)
    (ai:wait-force  1)
    (ai:wait-force  2)
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:sleep 500)
    (ai:script ai:sea-attack-endloop) ))

;;=============================================================================
;;
;;	Define an AI engine.
;;
;;	(define-ai name race class script)
;;
;;	name	name of the AI for selection.
;;	class	class of the AI for map editor.
;;	script	Main AI script.
;;
(define ai:alliance-land-attack-endloop
  '((writes nil "Looping !\n")
    (ai:force 0 'unit-footman 1 'unit-ranger 2 'unit-paladin 4 'unit-ballista 1
	'unit-mage 4)
    (ai:force 1 'unit-footman 1 'unit-ranger 2 'unit-paladin 4 'unit-ballista 1
	'unit-mage 2)
    (ai:force 2 'unit-gryphon-rider 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:sleep 500)
    (ai:script ai:alliance-land-attack-endloop) ) )

(define-ai 'my-ai1 race1 "land-attack"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:need (unit-type 'unit-town-hall))
    (ai:set  'unit-peasant 1)
    (ai:wait 'unit-town-hall)
    (ai:wait 'unit-peasant)	;; start hangs if nothing available

    (ai:set  'unit-peasant 4)
    (ai:need 'unit-elven-lumber-mill)
    (ai:need 'unit-alliance-barracks)
    (ai:force 0  'unit-footman 2)
    (ai:force 1  'unit-footman 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:set  'unit-peasant 9)
    (ai:sleep	500)
    (ai:need 'unit-alliance-blacksmith)
    (ai:force 0 'unit-footman 2 'unit-archer 1)
    (ai:force 1 'unit-footman 2 'unit-archer 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:research 'upgrade-sword1)
    (ai:research 'upgrade-alliance-shield1)
    (ai:research 'upgrade-arrow1)
    (ai:research 'upgrade-sword2)
    (ai:research 'upgrade-alliance-shield2)
    (ai:research 'upgrade-arrow2)
    (ai:need 'unit-alliance-barracks)

    (ai:force 0 'unit-footman 3 'unit-archer 2)
    (ai:force 1 'unit-footman 3 'unit-archer 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:set  'unit-peasant 15)
    (ai:force 0 'unit-footman 3 'unit-archer 2)
    (ai:force 1 'unit-footman 3 'unit-archer 1 'unit-ballista 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:upgrade-to 'unit-keep)
    (ai:wait 'unit-keep)

    (ai:force 1 'unit-footman 3 'unit-archer 1 'unit-ballista 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:need 'unit-town-hall)
    (ai:need 'unit-stables)
    (ai:force 0 'unit-footman 1 'unit-archer 2 'unit-knight 6 'unit-ballista 1)
    (ai:force 1 'unit-footman 1 'unit-archer 2 'unit-knight 2 'unit-ballista 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:need 'unit-alliance-barracks)
    (ai:upgrade-to 'unit-castle)
    (ai:set  'unit-peasant 19)
    (ai:wait 'unit-castle)

    (ai:force 0 'unit-footman 1 'unit-archer 2 'unit-knight 6 'unit-ballista 1)
    (ai:force 1 'unit-footman 1 'unit-archer 2 'unit-knight 2 'unit-ballista 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:need 'unit-church)
    (ai:research 'upgrade-paladin)
    (ai:research 'upgrade-healing)
    (ai:research 'upgrade-exorcism)

    (ai:force 0 'unit-footman 1 'unit-archer 2 'unit-knight 0 'unit-paladin 5
	'unit-ballista 1)
    (ai:force 1 'unit-footman 1 'unit-archer 2 'unit-knight 0 'unit-paladin 3
	'unit-ballista 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:need 'unit-mage-tower)
    (ai:research 'upgrade-polymorph)
    (ai:research 'upgrade-blizzard)

    (ai:force 0 'unit-footman 1 'unit-archer 2 'unit-paladin 6 'unit-ballista 1
	'unit-mage 2)
    (ai:force 1 'unit-footman 1 'unit-archer 2 'unit-paladin 2 'unit-ballista 1
	'unit-mage 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:research 'upgrade-slow)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:research 'upgrade-invisibility)

    (ai:force 0 'unit-footman 1 'unit-archer 2 'unit-paladin 6 'unit-ballista 1
	'unit-mage 5)
    (ai:force 1 'unit-footman 1 'unit-archer 2 'unit-paladin 2 'unit-ballista 1
	'unit-mage 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:need 'unit-gryphon-aviary)

    (ai:force 0 'unit-footman 1 'unit-archer 2 'unit-paladin 6 'unit-ballista 1
	'unit-mage 5)
    (ai:force 1 'unit-footman 1 'unit-archer 2 'unit-paladin 2 'unit-ballista 1
	'unit-mage 1)
    (ai:force 2 'unit-gryphon-rider 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:sleep	500)
    (ai:research 'upgrade-ranger)
    (ai:research 'upgrade-ranger-scouting)
    (ai:research 'upgrade-flame-shield)
    (ai:force 0 'unit-footman 1 'unit-archer 0 'unit-ranger 2 'unit-paladin 6
	'unit-ballista 1 'unit-mage 5)
    (ai:force 1 'unit-footman 1 'unit-archer 0 'unit-ranger 2 'unit-paladin 2
	'unit-ballista 1 'unit-mage 1)
    (ai:force 2 'unit-gryphon-rider 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:sleep	500)
    (ai:need 'unit-town-hall)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:need 'unit-inventor)
    (ai:research 'upgrade-longbow)

    (ai:force 0 'unit-footman 1 'unit-archer 0 'unit-ranger 2 'unit-paladin 6
	'unit-ballista 1 'unit-mage 5)
    (ai:force 1 'unit-footman 1 'unit-archer 0 'unit-ranger 2 'unit-paladin 2
	'unit-ballista 1 'unit-mage 1)
    (ai:force 2 'unit-gryphon-rider 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:sleep	500)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-cannon-tower)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:research 'upgrade-ballista1)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-cannon-tower)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:research 'upgrade-ballista2)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-cannon-tower)
    (ai:need 'unit-alliance-watch-tower)
    (ai:upgrade-to 'unit-alliance-guard-tower)
    (ai:set  'unit-peasant 25)

    ;; Everything researched...

    (ai:script ai:alliance-land-attack-endloop) ))

;;=============================================================================
;;
;;	Define an AI engine.
;;
;;	(define-ai name race class script)
;;
;;	name	name of the AI for selection.
;;	class	class of the AI for map editor.
;;	script	Main AI script.
;;
(define ai:mythical-land-attack-endloop
  '((writes nil "Looping !\n")
    (ai:force 0 'unit-grunt 1 'unit-berserker 2 'unit-ogre-mage 4
	'unit-catapult 1 'unit-death-knight 4)
    (ai:force 1 'unit-grunt 1 'unit-berserker 2 'unit-ogre-mage 4
	'unit-catapult 1 'unit-death-knight 2)
    (ai:force 2 'unit-dragon 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:sleep 500)
    (ai:script ai:mythical-land-attack-endloop) ) )

(define-ai 'my-ai2 race2 "land-attack"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:need (unit-type 'unit-great-hall))
    (ai:set  'unit-peon 1)
    (ai:wait 'unit-great-hall)
    (ai:wait 'unit-peon)	;; start hangs if nothing available

    (ai:set  'unit-peon 4)
    (ai:need 'unit-troll-lumber-mill)
    (ai:need 'unit-mythical-barracks)
    (ai:force 0 'unit-grunt 2)
    (ai:force 1 'unit-grunt 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:set  'unit-peon 9)
    (ai:sleep	500)
    (ai:need 'unit-mythical-blacksmith)
    (ai:force 0 'unit-grunt 2 'unit-axethrower 1)
    (ai:force 1 'unit-grunt 2 'unit-axethrower 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:research 'upgrade-battle-axe1)
    (ai:research 'upgrade-mythical-shield1)
    (ai:research 'upgrade-throwing-axe1)
    (ai:research 'upgrade-battle-axe2)
    (ai:research 'upgrade-mythical-shield2)
    (ai:research 'upgrade-throwing-axe2)
    (ai:need 'unit-mythical-barracks)

    (ai:force 0 'unit-grunt 3 'unit-axethrower 2)
    (ai:force 1 'unit-grunt 3 'unit-axethrower 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:set  'unit-peon 15)
    (ai:force 0 'unit-grunt 3 'unit-axethrower 2)
    (ai:force 1 'unit-grunt 3 'unit-axethrower 1 'unit-catapult 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:upgrade-to 'unit-stronghold)
    (ai:wait 'unit-stronghold)

    (ai:force 1 'unit-grunt 3 'unit-axethrower 1 'unit-catapult 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:need 'unit-great-hall)
    (ai:need 'unit-ogre-mound)
    (ai:force 0 'unit-grunt 1 'unit-axethrower 2 'unit-ogre 6 'unit-catapult 1)
    (ai:force 1 'unit-grunt 1 'unit-axethrower 2 'unit-ogre 2 'unit-catapult 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:need 'unit-mythical-barracks)
    (ai:upgrade-to 'unit-fortress)
    (ai:set  'unit-peon 19)
    (ai:wait 'unit-fortress)

    (ai:force 0 'unit-grunt 1 'unit-axethrower 2 'unit-ogre 6 'unit-catapult 1)
    (ai:force 1 'unit-grunt 1 'unit-axethrower 2 'unit-ogre 2 'unit-catapult 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:need 'unit-altar-of-storms)
    (ai:research 'upgrade-ogre-mage)
    (ai:research 'upgrade-bloodlust)
    (ai:research 'upgrade-runes)

    (ai:force 0 'unit-grunt 1 'unit-axethrower 2 'unit-ogre 0 'unit-ogre-mage 5
	'unit-catapult 1)
    (ai:force 1 'unit-grunt 1 'unit-axethrower 2 'unit-ogre 0 'unit-ogre-mage 3
	'unit-catapult 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:need 'unit-temple-of-the-damned)
    (ai:research 'upgrade-unholy-armor)
    (ai:research 'upgrade-death-and-decay)

    (ai:force 0 'unit-grunt 1 'unit-axethrower 2 'unit-ogre-mage 6
	'unit-catapult 1 'unit-death-knight 2)
    (ai:force 1 'unit-grunt 1 'unit-axethrower 2 'unit-ogre-mage 2
	'unit-catapult 1 'unit-death-knight 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:research 'upgrade-haste)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:research 'upgrade-whirlwind)

    (ai:force 0 'unit-grunt 1 'unit-axethrower 2 'unit-ogre-mage 6
	'unit-catapult 1 'unit-death-knight 5)
    (ai:force 1 'unit-grunt 1 'unit-axethrower 2 'unit-ogre-mage 2
	'unit-catapult 1 'unit-death-knight 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	500)
    (ai:need 'unit-dragon-roost)

    (ai:force 0 'unit-grunt 1 'unit-axethrower 2 'unit-ogre-mage 6
	'unit-catapult 1 'unit-death-knight 5)
    (ai:force 1 'unit-grunt 1 'unit-axethrower 2 'unit-ogre-mage 2
	'unit-catapult 1 'unit-death-knight 1)
    (ai:force 2 'unit-dragon 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:sleep	500)
    (ai:research 'upgrade-berserker)
    (ai:research 'upgrade-berserker-scouting)
    (ai:research 'upgrade-raise-dead)
    (ai:force 0 'unit-grunt 1 'unit-axethrower 0 'unit-ranger 2
	'unit-ogre-mage 6 'unit-catapult 1 'unit-death-knight 5)
    (ai:force 1 'unit-grunt 1 'unit-axethrower 0 'unit-ranger 2
	'unit-ogre-mage 2 'unit-catapult 1 'unit-death-knight 1)
    (ai:force 2 'unit-dragon 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:sleep	500)
    (ai:need 'unit-great-hall)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:need 'unit-alchemist)
    (ai:research 'upgrade-light-axes)

    (ai:force 0 'unit-grunt 1 'unit-axethrower 0 'unit-ranger 2
	'unit-ogre-mage 6 'unit-catapult 1 'unit-death-knight 5)
    (ai:force 1 'unit-grunt 1 'unit-axethrower 0 'unit-ranger 2
	'unit-ogre-mage 2 'unit-catapult 1 'unit-death-knight 1)
    (ai:force 2 'unit-dragon 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:attack-with-force 2)

    (ai:sleep	500)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-cannon-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:research 'upgrade-catapult1)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-cannon-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:research 'upgrade-catapult2)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-cannon-tower)
    (ai:need 'unit-mythical-watch-tower)
    (ai:upgrade-to 'unit-mythical-guard-tower)
    (ai:set  'unit-peon 25)

    ;; Everything researched...

    (ai:script ai:mythical-land-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only workers and tankers and oil platform.
;;		Also if needed a farm.
;;
(define ai:mythical-03-attack-endloop
  '((writes nil "Looping !\n")
    (ai:sleep 65535)
    (ai:script ai:mythical-03-attack-endloop) ) )

(define-ai 'mythical-03 "*" "mythical-03"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:set  (ai:worker) 2)
    (ai:set  (ai:tanker) 1)
    (ai:wait (ai:worker))	;; start hangs if nothing available

    (ai:need (ai:platform))

    (ai:script ai:mythical-03-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only workers and tankers and oil platform.
;;		Also if needed a farm.
;;		Attacks with soldier and shooter and destroyer.
;;
(define ai:hum-04-attack-endloop
  '((writes nil "Looping !\n")
    (ai:sleep 25000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 22000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:script ai:hum-04-attack-endloop) ) )

(define-ai 'hum-04 "*" "hum-04"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:set  (ai:worker) 4)
    (ai:set  (ai:tanker) 1)
    (ai:wait (ai:worker))	;; start hangs if nothing available

    (ai:need (ai:platform))

    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 3 (ai:shooter) 4)
    (ai:force 1 (ai:soldier) 2 (ai:shooter) 1 (ai:transporter) 1)
    (ai:sleep 27000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:set  (ai:transporter) 2)
    (ai:sleep 22000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 22000)
    (ai:force 0 (ai:destroyer) 0 (ai:soldier) 3 (ai:shooter) 3)
    (ai:force 2 (ai:destroyer) 2)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:sleep 22000)
    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 3 (ai:shooter) 3)
    (ai:force 1 (ai:soldier) 2 (ai:shooter) 2 (ai:transporter) 1)
    (ai:force 2 (ai:destroyer) 0)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 18000)
    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 3 (ai:shooter) 4)
    (ai:force 1 (ai:soldier) 2 (ai:shooter) 1 (ai:transporter) 1)
    (ai:wait-force 1)		;; wait until attack party is completed

    (ai:sleep 27000)
    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 2 (ai:shooter) 3)
    (ai:force 1 (ai:soldier) 3 (ai:shooter) 2 (ai:transporter) 1)
    (ai:wait-force 1)		;; wait until attack party is completed

    (ai:sleep 24000)
    (ai:force 0 (ai:destroyer) 0 (ai:soldier) 2 (ai:shooter) 3)
    (ai:force 1 (ai:soldier) 3 (ai:shooter) 2 (ai:transporter) 1)
    (ai:force 2 (ai:destroyer) 2)
    (ai:wait-force 2)		;; wait until attack party is completed

    (ai:script ai:hum-04-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only workers and tankers and oil platform.
;;		Also if needed a farm.
;;		Attacks with soldier and shooter and destroyer.
;;
(define ai:mythical-04-attack-endloop
  '((writes nil "Looping !\n")
    (ai:sleep 10500)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 10500)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:script ai:mythical-04-attack-endloop) ) )

(define-ai 'mythical-04 "*" "mythical-04"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:set  (ai:worker) 4)
    (ai:set  (ai:tanker) 1)
    (ai:wait (ai:worker))	;; start hangs if nothing available

    (ai:set  (ai:transporter) 1)
    (ai:force 0 (ai:soldier) 3 (ai:shooter) 4 (ai:destroyer) 2)
    (ai:need (ai:platform))

    (ai:force 1 (ai:soldier) 2 (ai:shooter) 1)
    (ai:sleep 27000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:set  (ai:transporter) 2)
    (ai:sleep 15000)
    (ai:force 0 (ai:soldier) 3 (ai:shooter) 3 (ai:destroyer) 2)
    (ai:force 1 (ai:soldier) 2 (ai:shooter) 2)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 15000)
    (ai:force 0 (ai:soldier) 3 (ai:shooter) 3 (ai:destroyer) 0)
    (ai:force 2 (ai:destroyer) 2)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:sleep 19500)
    (ai:force 0 (ai:soldier) 4 (ai:shooter) 4 (ai:destroyer) 0)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 12000)
    (ai:force 0 (ai:soldier) 4 (ai:shooter) 4 (ai:destroyer) 1)
    (ai:force 2 (ai:destroyer) 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:sleep 13500)
    (ai:force 0 (ai:soldier) 2 (ai:shooter) 3 (ai:destroyer) 1)
    (ai:force 1 (ai:soldier) 3 (ai:shooter) 2)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 30500)

    (ai:script ai:mythical-04-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only workers and tankers and oil platform.
;;		Also if needed a farm.
;;		Attacks with soldier, shooter and destroyer.
;;
(define ai:hum-05-attack-endloop
  '((writes nil "Looping !\n")
    (ai:sleep 18000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 12000)
    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 1 (ai:shooter) 2)
    (ai:force 1 (ai:soldier) 2 (ai:shooter) 1 (ai:transporter) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 24000)
    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 0 (ai:shooter) 1)
    (ai:force 1 (ai:soldier) 3 (ai:shooter) 2 (ai:transporter) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 14000)
    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 0 (ai:shooter) 1)
    (ai:force 2 (ai:destroyer) 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:script ai:hum-05-attack-endloop) ) )

(define-ai 'hum-05 "*" "hum-05"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:set  (ai:worker) 4)
    (ai:set  (ai:tanker) 1)
    (ai:set  (ai:transporter) 1)
    (ai:wait (ai:worker))	;; start hangs if nothing available

    (ai:need (ai:platform))

    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 2 (ai:shooter) 2)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:transporter) 1)
    (ai:force 2 (ai:destroyer) 1)
    (ai:sleep 6000)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:sleep 3000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 4000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 4000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 12000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 1 (ai:shooter) 2)
    (ai:force 1 (ai:soldier) 2 (ai:shooter) 1 (ai:transporter) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 14000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 12000)
    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 2 (ai:shooter) 2)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:transporter) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:script ai:hum-05-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only workers, blacksmith.
;;		Also if needed a farm.
;;		Upgrades weapon and missile.
;;		Attacks with soldier, shooter and cavalrie.
;;
(define ai:hum-06-attack-endloop
  '((writes nil "Looping !\n")
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 1 (ai:cavalrie) 1 )
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 3 (ai:cavalrie) 2 )
    (ai:sleep 14000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:soldier) 1 (ai:shooter) 3 (ai:cavalrie) 2 )
    (ai:force 1 (ai:soldier) 0 (ai:shooter) 1 (ai:cavalrie) 1 )
    (ai:sleep 11000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:soldier) 0 (ai:shooter) 3 (ai:cavalrie) 2 )
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 )
    (ai:sleep 8000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:soldier) 0 (ai:shooter) 2 (ai:cavalrie) 2 )
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 2 (ai:cavalrie) 1 )
    (ai:sleep 11000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:soldier) 1 (ai:shooter) 4 (ai:cavalrie) 1 )
    (ai:force 1 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 2 )
    (ai:sleep 9000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:script ai:hum-06-attack-endloop) ) )

(define-ai 'hum-06 "*" "hum-06"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:set  (ai:worker) 4)
    (ai:wait (ai:worker))	;; start hangs if nothing available

    (ai:force 0 (ai:soldier) 3 (ai:shooter) 3)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1)
    (ai:sleep 4000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 3000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 4000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:need (ai:blacksmith))
    (ai:research (ai:upgrade-missile-1))
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:soldier) 2 (ai:shooter) 2)
    (ai:force 1 (ai:soldier) 2 (ai:shooter) 2)
    (ai:sleep 9000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:research (ai:upgrade-weapon-1))

    (ai:force 0 (ai:soldier) 1 (ai:shooter) 2)
    (ai:force 1 (ai:soldier) 3 (ai:shooter) 2)
    (ai:sleep 13000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:soldier) 1 (ai:shooter) 3 (ai:cavalrie) 1 )
    (ai:force 1 (ai:soldier) 0 (ai:shooter) 1 (ai:cavalrie) 2 )
    (ai:sleep 14000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:research (ai:upgrade-armor-1))

    (ai:script ai:hum-06-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only worker and tanker.
;;
(define-ai 'hum-07 "*" "hum-07"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:set  (ai:worker) 2)
    (ai:set  (ai:tanker) 1)
    (ai:sleep	10000)
    (ai:restart)))

;;=============================================================================
;;	This AI script builds only workers, blacksmith.
;;		Also if needed a farm.
;;		Upgrades weapon and missile.
;;		Attacks with soldier, shooter and cavalrie.
;;
(define ai:hum-08-attack-endloop
  '((writes nil "Looping !\n")
    (ai:sleep 16000)
    (ai:force 0 (ai:soldier) 1 (ai:shooter) 4 (ai:cavalrie) 2)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 14000)
    (ai:force 0 (ai:soldier) 2 (ai:shooter) 4 (ai:cavalrie) 1 (ai:catapult) 1)
    (ai:force 1 (ai:soldier) 0 (ai:shooter) 1 (ai:cavalrie) 2 (ai:catapult) 0)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 12000)
    (ai:force 0 (ai:soldier) 2 (ai:shooter) 4 (ai:cavalrie) 0 (ai:catapult) 0)
    (ai:force 1 (ai:soldier) 0 (ai:shooter) 1 (ai:cavalrie) 3 (ai:catapult) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:script ai:hum-08-attack-endloop) ) )

(define-ai 'hum-08 "*" "hum-08"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))

    (ai:set  (ai:worker) 3)
    (ai:wait (ai:worker))	;; start hangs if nothing available

    (ai:force 0 (ai:soldier) 3 (ai:shooter) 3)
    (ai:force 1 (ai:soldier) 2 (ai:shooter) 1)
    (ai:sleep 14000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:soldier) 5 (ai:shooter) 5 (ai:cavalrie) 0)
    (ai:force 1 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 2)
    (ai:sleep 10000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:soldier) 2 (ai:shooter) 4 (ai:cavalrie) 1)
    (ai:force 1 (ai:soldier) 0 (ai:shooter) 1 (ai:cavalrie) 2)
    (ai:sleep 15000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:research (ai:upgrade-cavalrie-mage))
    (ai:research (ai:cavalrie-mage-spell-1))
    (ai:research (ai:upgrade-missile-1))
    (ai:force 0 (ai:soldier) 2 (ai:shooter) 5 (ai:cavalrie) 1)
    (ai:force 1 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 2 (ai:catapult) 1)
    (ai:sleep 15000)
    (ai:research (ai:upgrade-weapon-1))
    (ai:research (ai:upgrade-armor-1))
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep 21000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:research (ai:upgrade-elite-shooter))
    (ai:sleep 12000)
    (ai:force 0 (ai:soldier) 2 (ai:shooter) 5 (ai:cavalrie) 2)
    (ai:force 1 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 1 (ai:catapult) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:script ai:hum-08-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only worker and tanker.
;;
(define-ai 'hum-09 "*" "hum-09"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f) (ai:sleep (ai:get-sleep-cycles)))
    (ai:set  (ai:worker) 2)
    (ai:set  (ai:tanker) 1)
    (ai:sleep	10000)
    (ai:restart)))

;;=============================================================================
;;	This AI script builds only worker and tanker.
;;		Upgrades very much.
;;		Attacks with land units and water units.
;;
(define ai:hum-10-attack-endloop
  '((writes nil "Looping !\n")
    (ai:sleep	5000)
    (ai:force 0 (ai:soldier) 3 (ai:shooter) 3 (ai:cavalrie) 2 (ai:catapult) 1)
    (ai:force 2 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 2 (ai:catapult) 1
	(ai:transporter) 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:sleep	6000)
    (ai:force 1 (ai:destroyer) 1 (ai:battleship) 0)
    (ai:force 3 (ai:destroyer) 2 (ai:battleship) 1)
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 3)

    (ai:sleep	5000)
    (ai:force 1 (ai:destroyer) 3 (ai:battleship) 1)
    (ai:force 3 (ai:destroyer) 0 (ai:battleship) 0)
    (ai:force 0 (ai:soldier) 4 (ai:shooter) 2 (ai:cavalrie) 2 (ai:catapult) 2)
    (ai:force 2 (ai:soldier) 0 (ai:shooter) 2 (ai:cavalrie) 2 (ai:catapult) 0)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:force 1 (ai:destroyer) 1 (ai:battleship) 1)
    (ai:force 3 (ai:destroyer) 2 (ai:battleship) 0)
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 3)

    (ai:script ai:hum-10-attack-endloop) ) )

(define-ai 'hum-10 "*" "hum-10"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f)
      (ai:force-role 0 'defend) (ai:force-role 1 'defend)
      (ai:sleep (ai:get-sleep-cycles)))

    (ai:set  (ai:worker) 7)
    (ai:set  (ai:tanker) 3)
    (ai:wait (ai:worker))	;; Wait for the workers

    (ai:set  (ai:transporter) 1)
    (ai:force 0 (ai:destroyer) 2)
    (ai:force 2 (ai:transporter) 1)
    (ai:sleep	6000)
    (ai:force 2 (ai:transporter) 0)
    (ai:force 0 (ai:soldier) 4 (ai:shooter) 4
      (ai:destroyer) 0 (ai:transporter) 1)
    (ai:force 1 (ai:destroyer) 2)

    (ai:research (ai:upgrade-cavalrie-mage))
    (ai:research (ai:cavalrie-mage-spell-1))
    (ai:research (ai:mage-spell-1))
    (ai:research (ai:mage-spell-2))
    (ai:research (ai:upgrade-missile-1))

    (ai:force 0 (ai:soldier) 2 (ai:shooter) 2 (ai:transporter) 0)
    (ai:force 2 (ai:soldier) 2 (ai:shooter) 2 (ai:transporter) 1)
    (ai:force 1 (ai:destroyer) 2)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:research (ai:upgrade-weapon-1))
    (ai:sleep	4000)
    (ai:research (ai:upgrade-armor-1))
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:sleep	5000)
    (ai:force 1 (ai:destroyer) 3 (ai:battleship) 1)
    (ai:research (ai:upgrade-missile-2))
    (ai:research (ai:upgrade-weapon-2))
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:research (ai:upgrade-ship-cannon-1))
    (ai:sleep	3000)
    (ai:research (ai:upgrade-armor-2))
    (ai:research (ai:upgrade-ship-armor-1))
    (ai:research (ai:upgrade-elite-shooter))
    (ai:force 0 (ai:soldier) 2 (ai:shooter) 3)
    (ai:force 2 (ai:soldier) 2 (ai:shooter) 1 (ai:transporter) 1)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:research (ai:upgrade-catapult-1))
    (ai:research (ai:upgrade-ship-cannon-2))
    (ai:research (ai:upgrade-ship-armor-2))
    (ai:research (ai:upgrade-elite-shooter-1))
    (ai:force 0 (ai:soldier) 1 (ai:shooter) 2 (ai:mage) 1)
    (ai:sleep	5000)
    (ai:research (ai:upgrade-elite-shooter-2))
    (ai:research (ai:upgrade-elite-shooter-3))
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:force 0 (ai:soldier) 4 (ai:shooter) 3 (ai:cavalrie) 2 (ai:catapult) 1)
    (ai:force 2 (ai:soldier) 0 (ai:shooter) 1 (ai:cavalrie) 2 (ai:catapult) 1
	(ai:transporter) 1)
    (ai:sleep	5000)

    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)

    (ai:script ai:hum-10-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only workers.
;;		Upgrades very much.
;;		Attacks with land units.
;;
(define ai:hum-11-attack-endloop
  '((writes nil "Looping !\n")
    (ai:sleep	12000)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1
	(ai:mage) 0)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0 (ai:catapult) 0
	(ai:mage) 3)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	8000)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1
	(ai:mage) 1)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0 (ai:catapult) 0
	(ai:mage) 2)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	13000)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1
	(ai:mage) 0)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0 (ai:catapult) 0
	(ai:mage) 3)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:script ai:hum-11-attack-endloop) ) )

(define-ai 'hum-11 "*" "hum-11"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f)
      (ai:force-role 0 'defend) (ai:force-role 1 'attack)
      (ai:force-role 2 'attack)
      (ai:sleep (ai:get-sleep-cycles)))
    (ai:set  (ai:worker) 8)
    (ai:wait (ai:worker))	;; Wait for the workers

    (ai:sleep	6000)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 2 (ai:cavalrie) 2)
    (ai:force 1 (ai:soldier) 2 (ai:shooter) 0 (ai:cavalrie) 0)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	6000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	7000)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 1 (ai:cavalrie) 2)
    (ai:force 1 (ai:soldier) 2 (ai:shooter) 1 (ai:cavalrie) 0)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	5000)
    (ai:force 1 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0)
    (ai:force 0 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 2 (ai:catapult) 1)
    (ai:research (ai:upgrade-missile-1))
    (ai:research (ai:upgrade-weapon-1))
    (ai:research (ai:upgrade-armor-1))

    (ai:sleep	6000)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0 (ai:catapult) 0
	(ai:mage) 3)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	9000)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1
	(ai:mage) 1)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0 (ai:catapult) 0
	(ai:mage) 2)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	7000)
    (ai:research (ai:upgrade-elite-shooter))
    (ai:research (ai:upgrade-elite-shooter-1))
    (ai:sleep	13000)

    (ai:force 2 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1
	(ai:mage) 1)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1
	(ai:mage) 1)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0 (ai:catapult) 0
	(ai:mage) 2)
    (ai:wait-force 2)		;; wait until attack party is completed
    (ai:attack-with-force 2)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:research (ai:upgrade-elite-shooter-2))
    (ai:research (ai:mage-spell-1))

    (ai:research (ai:upgrade-cavalrie-mage))
    (ai:sleep	7000)
    (ai:research (ai:cavalrie-mage-spell-1))
    (ai:research (ai:mage-spell-2))
    (ai:research (ai:upgrade-weapon-2))
    (ai:sleep	12000)
    (ai:force 2 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0 (ai:catapult) 0
	(ai:mage) 0)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1
	(ai:mage) 2)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0 (ai:catapult) 0
	(ai:mage) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)
    (ai:research (ai:upgrade-armor-2))
    (ai:research (ai:mage-spell-3))
    (ai:research (ai:mage-spell-4))
    (ai:research (ai:upgrade-catapult-1))

    (ai:sleep	8000)
    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1
	(ai:mage) 1)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0 (ai:catapult) 0
	(ai:mage) 2)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:research (ai:cavalrie-mage-spell-1))
    (ai:research (ai:mage-spell-5))
    (ai:sleep	13000)

    (ai:force 1 (ai:soldier) 1 (ai:shooter) 1 (ai:cavalrie) 1 (ai:catapult) 1
	(ai:mage) 0)
    (ai:force 0 (ai:soldier) 0 (ai:shooter) 0 (ai:cavalrie) 0 (ai:catapult) 0
	(ai:mage) 3)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:script ai:hum-11-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only workers and tankers.
;;		Upgrades very much.
;;		Attacks with land and water units.
;;
(define ai:hum-12-attack-endloop
  '((writes nil "Looping !\n")
    (ai:sleep	10000)
    (ai:force 0 (ai:soldier) 1 (ai:cavalrie) 7 (ai:mage) 1)
    (ai:force 1 (ai:soldier) 1 (ai:cavalrie) 3 (ai:mage) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	5000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	7000)
    (ai:force 2 (ai:destroyer) 1 (ai:battleship) 1 (ai:submarine) 4
	(ai:scout) 1) 
    (ai:force 3 (ai:destroyer) 1 (ai:battleship) 1 (ai:submarine) 1
	(ai:scout) 1) 
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 3)

    (ai:script ai:hum-12-attack-endloop) ) )

(define-ai 'hum-12 "*" "hum-12"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f)
      (ai:force-role 0 'defend) (ai:force-role 1 'attack)
      (ai:force-role 2 'defend) (ai:force-role 3 'attack)
      (ai:sleep (ai:get-sleep-cycles)))

    (ai:set  (ai:tanker) 3)
    (ai:set  (ai:worker) 7)
    (ai:wait (ai:worker))	;; Wait for the workers

    (ai:need (ai:platform))
    (ai:set  (ai:transporter) 2)

    (ai:force 1 (ai:soldier) 2)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:soldier) 2)
    (ai:sleep	2000)

    (ai:force 2 (ai:destroyer) 2 (ai:battleship) 1 (ai:submarine) 3) 
    (ai:force 3 (ai:destroyer) 0 (ai:battleship) 1 (ai:submarine) 1) 

    (ai:sleep	3000)
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 3)

    (ai:force 0 (ai:soldier) 1 (ai:cavalrie) 10 (ai:mage) 2)
    (ai:force 1 (ai:soldier) 1 )

    (ai:research (ai:mage-spell-1))
    (ai:research (ai:upgrade-cavalrie-mage))
    (ai:research (ai:cavalrie-mage-spell-1))
    (ai:research (ai:mage-spell-2))
    (ai:research (ai:mage-spell-3))
    (ai:research (ai:mage-spell-4))
    (ai:research (ai:cavalrie-mage-spell-2))
    (ai:research (ai:mage-spell-5))
    (ai:research (ai:upgrade-ship-cannon-1))
    (ai:research (ai:upgrade-ship-armor-1))
    (ai:sleep	4000)

    (ai:force 2 (ai:destroyer) 1 (ai:battleship) 1 (ai:submarine) 3) 
    (ai:force 3 (ai:destroyer) 1 (ai:battleship) 1 (ai:submarine) 1) 
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 3)

    (ai:research (ai:upgrade-ship-cannon-2))
    (ai:research (ai:upgrade-ship-armor-2))
    (ai:research (ai:upgrade-catapult-1))
    (ai:research (ai:upgrade-catapult-2))
    (ai:sleep	6000)

    (ai:force 2 (ai:destroyer) 1 (ai:battleship) 1 (ai:submarine) 3) 
    (ai:force 3 (ai:destroyer) 1 (ai:battleship) 1 (ai:submarine) 2) 
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 3)

    (ai:sleep	7000)
    (ai:force 2 (ai:destroyer) 1 (ai:battleship) 1 (ai:submarine) 2) 
    (ai:force 3 (ai:destroyer) 1 (ai:battleship) 1 (ai:submarine) 3) 
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 3)

    (ai:sleep	5000)
    (ai:force 2 (ai:destroyer) 1 (ai:battleship) 0 (ai:submarine) 2) 
    (ai:force 3 (ai:destroyer) 1 (ai:battleship) 2 (ai:submarine) 3) 
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 3)

    (ai:force 0 (ai:soldier) 1 (ai:cavalrie) 10 (ai:mage) 2 (ai:catapult) 1)
    (ai:force 1 (ai:soldier) 1 (ai:catapult) 1)

    (ai:force 2 (ai:destroyer) 1 (ai:battleship) 0 (ai:submarine) 2
	(ai:scout) 1) 
    (ai:force 3 (ai:destroyer) 1 (ai:battleship) 2 (ai:submarine) 3
	(ai:scout) 1) 

    (ai:research (ai:upgrade-missile-1))
    (ai:research (ai:upgrade-weapon-1))
    (ai:research (ai:upgrade-armor-1))
    (ai:research (ai:upgrade-missile-2))

    (ai:research (ai:upgrade-elite-shooter))
    (ai:research (ai:upgrade-elite-shooter-1))
    (ai:research (ai:upgrade-elite-shooter-2))
    (ai:research (ai:upgrade-elite-shooter-3))
    (ai:research (ai:upgrade-weapon-2))
    (ai:research (ai:upgrade-armor-2))

    (ai:script ai:hum-12-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only workers and tankers.
;;		Upgrades very much.
;;		Attacks with land and air units.
;;
(define ai:hum-13-attack-endloop
  '((writes nil "Looping !\n")

    (ai:sleep	12000)
    (ai:force 0 (ai:cavalrie) 1 (ai:mage) 1 (ai:catapult) 2)
    (ai:force 1 (ai:cavalrie) 2 (ai:shooter) 1 (ai:mage) 1 (ai:catapult) 0)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	14000)
    (ai:force 2 (ai:flyer) 1)
    (ai:force 3 (ai:flyer) 3)
    (ai:sleep	14000)

    (ai:force 0 (ai:cavalrie) 1 (ai:mage) 2 (ai:catapult) 1)
    (ai:force 1 (ai:cavalrie) 2 (ai:shooter) 1 (ai:mage) 0 (ai:catapult) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:script ai:hum-13-attack-endloop) ) )

(define-ai 'hum-13 "*" "hum-13"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f)
      (ai:force-role 0 'defend) (ai:force-role 1 'attack)
      (ai:force-role 2 'defend) (ai:force-role 3 'attack)
      (ai:sleep (ai:get-sleep-cycles)))

    (ai:set  (ai:tanker) 2)
    (ai:set  (ai:worker) 5)
    (ai:wait (ai:worker))	;; Wait for the workers

    (ai:need (ai:platform))
    (ai:set  (ai:transporter) 2)

    (ai:force 0 (ai:cavalrie) 3 (ai:mage) 2)

    (ai:research (ai:mage-spell-1))
    (ai:research (ai:upgrade-cavalrie-mage))
    (ai:research (ai:cavalrie-mage-spell-1))
    (ai:research (ai:mage-spell-2))
    (ai:research (ai:mage-spell-3))
    (ai:research (ai:mage-spell-4))
    (ai:research (ai:cavalrie-mage-spell-2))

    (ai:sleep	4000)

    (ai:force 0 (ai:cavalrie) 1 (ai:mage) 1)
    (ai:force 1 (ai:cavalrie) 2 (ai:mage) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:cavalrie) 1 (ai:mage) 1)
    (ai:force 1 (ai:cavalrie) 2 (ai:shooter) 1 (ai:mage) 1)
    (ai:sleep	12000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	15000)
    (ai:force 0 (ai:cavalrie) 0 (ai:mage) 1)
    (ai:force 1 (ai:cavalrie) 3 (ai:shooter) 1 (ai:mage) 1)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:research (ai:mage-spell-5))
    (ai:research (ai:upgrade-ship-cannon-1))
    (ai:research (ai:upgrade-ship-armor-1))
    (ai:research (ai:upgrade-ship-cannon-2))
    (ai:research (ai:upgrade-ship-armor-2))
    (ai:force 0 (ai:cavalrie) 2 (ai:mage) 2 (ai:catapult) 1)
    (ai:force 1 (ai:cavalrie) 1 (ai:shooter) 1 (ai:mage) 0 (ai:catapult) 1)
    (ai:sleep	15000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 2 (ai:flyer) 1)
    (ai:force 3 (ai:flyer) 3)
    (ai:sleep	20000)
    (ai:wait-force 3)		;; wait until attack party is completed
    (ai:attack-with-force 3)

    (ai:sleep	14000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	18000)
    (ai:force 0 (ai:cavalrie) 2 (ai:mage) 2 (ai:catapult) 2)
    (ai:force 1 (ai:cavalrie) 1 (ai:shooter) 1 (ai:mage) 0 (ai:catapult) 0)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:research (ai:upgrade-catapult-1))
    (ai:research (ai:upgrade-catapult-2))
    (ai:research (ai:upgrade-missile-1))
    (ai:research (ai:upgrade-weapon-1))
    (ai:research (ai:upgrade-armor-1))
    (ai:research (ai:upgrade-missile-2))
    (ai:research (ai:upgrade-elite-shooter))

    (ai:script ai:hum-13-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only workers and ogres.
;;
(define ai:hum-14-orange-attack-endloop
  '((writes nil "Looping !\n")
    (ai:script ai:hum-14-orange-attack-endloop) ) )

(define-ai 'hum-14-orange "*" "hum-14-orange"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f)
      (ai:force-role 0 'defend) (ai:force-role 1 'attack)
      (ai:sleep (ai:get-sleep-cycles)))

    (ai:set  (ai:worker) 5)
    (ai:wait (ai:worker))	;; Wait for the workers

    (ai:force 0 (ai:cavalrie) 8)
    (ai:force 1 (ai:cavalrie) 7)

    (ai:script ai:hum-14-orange-attack-endloop) ))

;;=============================================================================
;;	This AI script builds nothing.
;;		Does only upgrades.
;;
(define ai:hum-14-red-attack-endloop
  '((writes nil "Looping !\n")
    (ai:sleep	30000)
    (ai:sleep	30000)
    (ai:script ai:hum-14-red-attack-endloop) ) )

(define-ai 'hum-14-red "*" "hum-14-red"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f)
      (ai:force-role 0 'defend) (ai:force-role 1 'attack)
      (ai:sleep (ai:get-sleep-cycles)))

    (ai:research (ai:mage-spell-1))
    (ai:research (ai:mage-spell-2))
    (ai:research (ai:mage-spell-3))
    (ai:research (ai:mage-spell-4))
    (ai:research (ai:mage-spell-5))

    (ai:script ai:hum-14-red-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only workers and dragons.
;;		Does only air attacks.
;;
;;	FIXME: This AI should only collect GOLD.
;;
(define ai:hum-14-white-attack-endloop
  '((writes nil "Looping !\n")
    (ai:force 0 (ai:flyer) 8)
    (ai:force 1 (ai:flyer) 2)
    (ai:sleep	19000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:flyer) 5)
    (ai:force 1 (ai:flyer) 4)
    (ai:sleep	20000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:flyer) 6)
    (ai:force 1 (ai:flyer) 3)
    (ai:sleep	21000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:force 0 (ai:flyer) 3)
    (ai:force 1 (ai:flyer) 6)
    (ai:sleep	20000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:script ai:hum-14-white-attack-endloop) ) )

(define-ai 'hum-14-white "*" "hum-14-white"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f)
      (ai:force-role 0 'defend) (ai:force-role 1 'attack)
      (ai:sleep (ai:get-sleep-cycles)))

    (ai:set  (ai:worker) 9)
    (ai:wait (ai:worker))	;; Wait for the workers

    (ai:force 0 (ai:flyer) 9)
    (ai:force 1 (ai:flyer) 1)

    (ai:sleep	64000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	12000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:sleep	18000)
    (ai:wait-force 1)		;; wait until attack party is completed
    (ai:attack-with-force 1)

    (ai:script ai:hum-14-white-attack-endloop) ))

;;=============================================================================
;;	This AI script builds only tanker.
;;		Does only upgrades.
;;
;;	FIXME: This AI should only collect GOLD.
;;
(define ai:hum-14-black-attack-endloop
  '((writes nil "Looping !\n")
    (ai:sleep	30000)
    (ai:script ai:hum-14-black-attack-endloop) ) )

(define-ai 'hum-14-black "*" "hum-14-black"
  '(
    ;;	Define the main AI script.
    (begin (ai:debug #f)
      (ai:force-role 0 'defend) (ai:force-role 1 'attack)
      (ai:sleep (ai:get-sleep-cycles)))

    (ai:set  (ai:tanker) 1)
    (ai:research (ai:upgrade-cavalrie-mage))
    (ai:research (ai:cavalrie-mage-spell-1))
    (ai:research (ai:cavalrie-mage-spell-2))
    (ai:research (ai:mage-spell-1))
    (ai:research (ai:mage-spell-2))
    (ai:research (ai:mage-spell-3))
    (ai:research (ai:mage-spell-4))
    (ai:research (ai:mage-spell-5))
    (ai:research (ai:upgrade-weapon-1))
    (ai:research (ai:upgrade-armor-1))
    (ai:research (ai:upgrade-weapon-2))
    (ai:research (ai:upgrade-armor-2))
    (ai:research (ai:upgrade-elite-shooter))
    (ai:research (ai:upgrade-elite-shooter-1))
    (ai:research (ai:upgrade-elite-shooter-2))
    (ai:research (ai:upgrade-elite-shooter-3))
    (ai:research (ai:upgrade-ship-cannon-1))
    (ai:research (ai:upgrade-ship-armor-1))
    (ai:research (ai:upgrade-ship-cannon-2))
    (ai:research (ai:upgrade-ship-armor-2))

    (ai:script ai:hum-14-black-attack-endloop) ))
(load "ccl/ai-fcmp.ccl" #f #t)
