;;   ___________		     _________		      _____  __
;;   \_	  _____/______   ____   ____ \_   ___ \____________ _/ ____\/  |_
;;    |    __) \_  __ \_/ __ \_/ __ \/    \  \/\_  __ \__  \\   __\\   __|
;;    |     \   |  | \/\  ___/\  ___/\     \____|  | \// __ \|  |   |  |
;;    \___  /   |__|    \___  >\___  >\______  /|__|  (____  /__|   |__|
;;	  \/		    \/	   \/	     \/		   \/
;;  ______________________                           ______________________
;;			  T H E   W A R   B E G I N S
;;	   FreeCraft - A free fantasy real time strategy game engine
;;
;;	upgrade.ccl	-	Define the mythicalish dependencies and upgrades.
;;
;;	(c) Copyright 2001-2003 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: upgrade.ccl,v 1.10 2003/03/09 18:35:18 jsalmon3 Exp $

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;=============================================================================
;;	Define the upgrades
;;
;;	(define-upgrade upgrade-name 'icon icon 'costs #( costs ))
;;
;;	upgrade-name	is the identifier of the upgrade
;;	icon		is the icon shown for upgrading.
;;	costs		are the costs of the upgrade
;;			(time gold wood oil ore stone coal)
;;
;;	NOTE: Save can generate this table.

(define-upgrade 'upgrade-battle-axe1 'icon 'icon-battle-axe2
  'costs #(   200   500   100     0     0     0     0))
(define-upgrade 'upgrade-battle-axe2 'icon 'icon-battle-axe3
  'costs #(   250  1500   300     0     0     0     0))
(define-upgrade 'upgrade-throwing-axe1 'icon 'icon-throwing-axe2
  'costs #(   200   300   300     0     0     0     0))
(define-upgrade 'upgrade-throwing-axe2 'icon 'icon-throwing-axe3
  'costs #(   250   900   500     0     0     0     0))
(define-upgrade 'upgrade-mythical-shield1 'icon 'icon-mythical-shield2
  'costs #(   200   300   300     0     0     0     0))
(define-upgrade 'upgrade-mythical-shield2 'icon 'icon-mythical-shield3
  'costs #(   250   900   500     0     0     0     0))
(define-upgrade 'upgrade-mythical-ship-cannon1 'icon 'icon-mythical-ship-cannon2
  'costs #(   200   700   100  1000     0     0     0))
(define-upgrade 'upgrade-mythical-ship-cannon2 'icon 'icon-mythical-ship-cannon3
  'costs #(   250  2000   250  3000     0     0     0))
(define-upgrade 'upgrade-mythical-ship-armor1 'icon 'icon-mythical-ship-armor2
  'costs #(   200   500   500     0     0     0     0))
(define-upgrade 'upgrade-mythical-ship-armor2 'icon 'icon-mythical-ship-armor3
  'costs #(   250  1500   900     0     0     0     0))
(define-upgrade 'upgrade-ballista1 'icon 'icon-ballista1
  'costs #(   250  1500     0     0     0     0     0))
(define-upgrade 'upgrade-ballista2 'icon 'icon-ballista2
  'costs #(   250  4000     0     0     0     0     0))
(define-upgrade 'upgrade-berserker 'icon 'icon-berserker
  'costs #(   250  1500     0     0     0     0     0))
(define-upgrade 'upgrade-light-axes 'icon 'icon-light-axes
  'costs #(   250  2000     0     0     0     0     0))
(define-upgrade 'upgrade-berserker-scouting 'icon 'icon-berserker-scouting
  'costs #(   250  1500     0     0     0     0     0))
(define-upgrade 'upgrade-berserker-regeneration
  'icon 'icon-berserker-regeneration
  'costs #(   250  3000     0     0     0     0     0))
(define-upgrade 'upgrade-ogre-mage 'icon 'icon-ogre-mage
  'costs #(   250  1000     0     0     0     0     0))
(define-upgrade 'upgrade-eye-of-kilrogg 'icon 'icon-eye-of-kilrogg
  'costs #(     0     0     0     0     0     0     0))
(define-upgrade 'upgrade-bloodlust 'icon 'icon-bloodlust
  'costs #(   100  1000     0     0     0     0     0))
(define-upgrade 'upgrade-raise-dead 'icon 'icon-skeleton
  'costs #(   100  1500     0     0     0     0     0))
(define-upgrade 'upgrade-death-coil 'icon 'icon-death-coil
  'costs #(   100     0     0     0     0     0     0))
(define-upgrade 'upgrade-whirlwind 'icon 'icon-whirlwind
  'costs #(   150  1500     0     0     0     0     0))
(define-upgrade 'upgrade-haste 'icon 'icon-haste
  'costs #(   100   500     0     0     0     0     0))
(define-upgrade 'upgrade-unholy-armor 'icon 'icon-unholy-armor
  'costs #(   200  2500     0     0     0     0     0))
(define-upgrade 'upgrade-runes 'icon 'icon-runes
  'costs #(   150  1000     0     0     0     0     0))
(define-upgrade 'upgrade-death-and-decay 'icon 'icon-death-and-decay
  'costs #(   200  2000     0     0     0     0     0))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;=============================================================================
;;	Define the upgrade modifiers
;;
;;	(define-modifier upgrade-name '(modifiers) ... )
;;
;,	This does the real upgrades.
;;
;;	upgrade-name	is the identifier of the upgrade modifier
;;	modifiers	is a pair of the effect name and value.
;;
;;	NOTE: Save can generate this table.

(define-modifier 'upgrade-battle-axe1
  '(piercing-damage 2)
  '(apply-to unit-grunt) '(apply-to unit-ogre) '(apply-to unit-ogre-mage)
  '(apply-to unit-goblin-sappers) '(apply-to unit-quick-blade)
  '(apply-to unit-beast-cry) '(apply-to unit-fad-man)
  '(apply-to unit-double-head))

(define-modifier 'upgrade-battle-axe2
  '(piercing-damage 2)
  '(apply-to unit-grunt) '(apply-to unit-ogre) '(apply-to unit-ogre-mage)
  '(apply-to unit-goblin-sappers) '(apply-to unit-quick-blade)
  '(apply-to unit-beast-cry) '(apply-to unit-fad-man)
  '(apply-to unit-double-head))

(define-modifier 'upgrade-throwing-axe1
  '(piercing-damage 1)
  '(apply-to unit-axethrower) '(apply-to unit-berserker)
  '(apply-to unit-sharp-axe))

(define-modifier 'upgrade-throwing-axe2
  '(piercing-damage 1)
  '(apply-to unit-axethrower) '(apply-to unit-berserker)
  '(apply-to unit-sharp-axe))

(define-modifier 'upgrade-mythical-shield1
  '(armor 2)
  '(apply-to unit-grunt) '(apply-to unit-ogre) '(apply-to unit-ogre-mage)
  '(apply-to unit-goblin-sappers) '(apply-to unit-quick-blade)
  '(apply-to unit-beast-cry) '(apply-to unit-fad-man)
  '(apply-to unit-double-head))

(define-modifier 'upgrade-mythical-shield2
  '(armor 2)
  '(apply-to unit-grunt) '(apply-to unit-ogre) '(apply-to unit-ogre-mage)
  '(apply-to unit-goblin-sappers) '(apply-to unit-quick-blade)
  '(apply-to unit-beast-cry) '(apply-to unit-fad-man)
  '(apply-to unit-double-head))

(define-modifier 'upgrade-mythical-ship-cannon1
  '(piercing-damage 5)
  '(apply-to unit-mythical-destroyer) '(apply-to unit-ogre-juggernaught)
  '(apply-to unit-mythical-submarine))

(define-modifier 'upgrade-mythical-ship-cannon2
  '(piercing-damage 5)
  '(apply-to unit-mythical-destroyer) '(apply-to unit-ogre-juggernaught)
  '(apply-to unit-mythical-submarine))

(define-modifier 'upgrade-mythical-ship-armor1
  '(armor 5)
  '(apply-to unit-mythical-destroyer) '(apply-to unit-ogre-juggernaught)
  '(apply-to unit-mythical-transport))

(define-modifier 'upgrade-mythical-ship-armor2
  '(armor 5)
  '(apply-to unit-mythical-destroyer) '(apply-to unit-ogre-juggernaught)
  '(apply-to unit-mythical-transport))

(define-modifier 'upgrade-ballista1
  '(piercing-damage 15)
  '(apply-to unit-ballista))

(define-modifier 'upgrade-ballista2
  '(piercing-damage 15)
  '(apply-to unit-ballista))

(define-modifier 'upgrade-berserker
  '(apply-to unit-axethrower) '(convert-to unit-berserker))

(define-modifier 'upgrade-light-axes
  '(sight-range 1)
  '(attack-range 1)
  '(apply-to unit-axethrower) '(apply-to unit-berserker))

(define-modifier 'upgrade-berserker-scouting
  '(sight-range 3)
  '(apply-to unit-axethrower) '(apply-to unit-berserker))

(define-modifier 'upgrade-berserker-regeneration
  '(apply-to unit-axethrower) '(apply-to unit-berserker))

(define-modifier 'upgrade-ogre-mage
  '(apply-to unit-ogre) '(convert-to unit-ogre-mage))

(define-modifier 'upgrade-eye-of-kilrogg
  '(apply-to unit-ogre-mage))

(define-modifier 'upgrade-bloodlust
  '(apply-to unit-ogre-mage))

(define-modifier 'upgrade-runes
  '(apply-to unit-ogre-mage))

(define-modifier 'upgrade-raise-dead
  '(apply-to unit-death-knight) '(apply-to unit-ice-bringer)
  '(apply-to unit-evil-knight))

(define-modifier 'upgrade-death-coil
  '(apply-to unit-death-knight) '(apply-to unit-ice-bringer)
  '(apply-to unit-evil-knight))

(define-modifier 'upgrade-whirlwind
  '(apply-to unit-death-knight) '(apply-to unit-ice-bringer)
  '(apply-to unit-evil-knight))

(define-modifier 'upgrade-haste
  '(apply-to unit-death-knight) '(apply-to unit-ice-bringer)
  '(apply-to unit-evil-knight))

(define-modifier 'upgrade-unholy-armor
  '(apply-to unit-death-knight) '(apply-to unit-ice-bringer)
  '(apply-to unit-evil-knight))

(define-modifier 'upgrade-death-and-decay
  '(apply-to unit-death-knight) '(apply-to unit-ice-bringer)
  '(apply-to unit-evil-knight))

;;=============================================================================
;;
;;	Define which units/upgrades are allowed.
;;		A: allowed, E: enabled, F: forbidden, R: researched
;;
;;	(define-allow unit/upgrade "AAAAAAAAAAAAAAAA")
;;				    ^- player 0 ... 15
;;
;;	NOTE: Save can generate this table.
;;

;;	- units

(define-allow 'unit-grunt			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-peon			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-catapult			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-ogre			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-axethrower			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-death-knight		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-ogre-mage			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-goblin-sappers		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-attack-peon			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-berserker			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-evil-knight		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-fad-man			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-beast-cry		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-orc-oil-tanker		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-transport		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-destroyer		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-ogre-juggernaught		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-fire-breeze			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-submarine		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-zeppelin		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-dragon			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-eye-of-vision		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-quick-blade		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-double-head			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-ice-bringer			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-sharp-axe			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-pig-farm			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-barracks		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-altar-of-storms		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-watch-tower		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-ogre-mound			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-alchemist		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-dragon-roost		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-shipyard		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-great-hall			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-troll-lumber-mill		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-foundry			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-temple-of-the-damned	"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-blacksmith		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-orc-refinery		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-oil-platform		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-stronghold			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-fortress			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-start-location		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-guard-tower		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-mythical-cannon-tower		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-orc-wall			"AAAAAAAAAAAAAAAA")
(define-allow 'unit-peon-with-gold		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-peon-with-wood		"AAAAAAAAAAAAAAAA")
(define-allow 'unit-orc-oil-tanker-full		"AAAAAAAAAAAAAAAA")

;;	- upgrades

(define-allow 'upgrade-battle-axe1		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-battle-axe2		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-throwing-axe1		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-throwing-axe2		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-mythical-shield1		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-mythical-shield2		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-mythical-ship-cannon1		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-mythical-ship-cannon2		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-mythical-ship-armor1		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-mythical-ship-armor2		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-ballista1		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-ballista2		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-berserker		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-light-axes		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-berserker-scouting	"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-berserker-regeneration	"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-ogre-mage		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-eye-of-kilrogg		"RRRRRRRRRRRRRRRR")
(define-allow 'upgrade-bloodlust		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-raise-dead		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-death-coil		"RRRRRRRRRRRRRRRR")
(define-allow 'upgrade-whirlwind		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-haste			"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-unholy-armor		"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-runes			"AAAAAAAAAAAAAAAA")
(define-allow 'upgrade-death-and-decay		"AAAAAAAAAAAAAAAA")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;=============================================================================
;;	Define the dependencies
;;
;;	(define-dependency unit/upgrade
;;		'( required-unit/upgrade count ... ) ['or ...] )
;;
;;	Define the dependencies of an unit or upgrade.
;;
;;	unit/upgrade	Dependencies for this unit or upgrade.
;;	required-unit/upgrade	Units required to build or research.
;;	count		Number of units required.
;;	'or		Alternative set of units/upgrades required.
;;
;;	NOTE: Save can generate this table.

;;	- mythical land fmythicales
(define-dependency 'unit-axethrower
  '(unit-troll-lumber-mill))
(define-dependency 'unit-catapult
  '(unit-mythical-blacksmith unit-troll-lumber-mill))
(define-dependency 'unit-berserker
  '(upgrade-berserker unit-troll-lumber-mill))
(define-dependency 'unit-ogre
  '(unit-ogre-mound unit-mythical-blacksmith))
(define-dependency 'unit-ogre-mage
  '(upgrade-ogre-mage unit-ogre-mound unit-mythical-blacksmith))

;;	- mythical naval fmythicales
(define-dependency 'unit-mythical-submarine
  '(unit-alchemist))
(define-dependency 'unit-mythical-transport
  '(unit-mythical-foundry))
(define-dependency 'unit-ogre-juggernaught
  '(unit-mythical-foundry))

;;	- mythical air fmythicales
(define-dependency 'unit-zeppelin
  '(unit-troll-lumber-mill))

;;	- mythical buildings
(define-dependency 'unit-mythical-guard-tower
  '(unit-troll-lumber-mill))
(define-dependency 'unit-mythical-cannon-tower
  '(unit-mythical-blacksmith))
(define-dependency 'unit-mythical-shipyard
  '(unit-troll-lumber-mill))
(define-dependency 'unit-mythical-foundry
  '(unit-mythical-shipyard))
(define-dependency 'unit-orc-refinery
  '(unit-mythical-shipyard))
(define-dependency 'unit-stronghold
  '(unit-mythical-barracks))
(define-dependency 'unit-alchemist
  '(unit-stronghold)
  'or '(unit-fortress))
(define-dependency 'unit-ogre-mound
  '(unit-stronghold)
  'or '(unit-fortress))
(define-dependency 'unit-fortress
  '(unit-ogre-mound unit-mythical-blacksmith unit-troll-lumber-mill))
(define-dependency 'unit-altar-of-storms
  '(unit-fortress))
(define-dependency 'unit-temple-of-the-damned
  '(unit-fortress))
(define-dependency 'unit-dragon-roost
  '(unit-fortress))

;;	- mythical upgrades/research
(define-dependency 'upgrade-battle-axe2
  '(upgrade-battle-axe1))
(define-dependency 'upgrade-throwing-axe2
  '(upgrade-throwing-axe1))
(define-dependency 'upgrade-mythical-shield2
  '(upgrade-mythical-shield1))
(define-dependency 'upgrade-ballista2
  '(upgrade-ballista1))
(define-dependency 'upgrade-mythical-ship-cannon2
  '(upgrade-mythical-ship-cannon1))
(define-dependency 'upgrade-mythical-ship-armor2
  '(upgrade-mythical-ship-armor1))
(define-dependency 'upgrade-berserker
  '(unit-stronghold)
  'or '(unit-fortress))
(define-dependency 'upgrade-berserker-scouting
  '(unit-fortress upgrade-berserker))
(define-dependency 'upgrade-berserker-regeneration
  '(unit-fortress upgrade-berserker))
(define-dependency 'upgrade-light-axes
  '(unit-fortress upgrade-berserker))

;;	- mythical spells
(define-dependency 'upgrade-eye-of-kilrogg
  '(upgrade-ogre-mage))
(define-dependency 'upgrade-bloodlust
  '(upgrade-ogre-mage))
(define-dependency 'upgrade-runes
  '(upgrade-ogre-mage))
