--       _________ __                 __                               
--      /   _____//  |_____________ _/  |______     ____  __ __  ______
--      \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
--      /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \ 
--     /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
--             \/                  \/          \//_____/            \/ 
--  ______________________                           ______________________
--            T H E   W A R   B E G I N S
--     Stratagus - A free fantasy real time strategy game engine
--
--  upgrade.ccl -   Define the human dependencies and upgrades.
--
--  (c) Copyright 2000,2004 by Jimmy Salmon and Mohydine
--
--      This program 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; either version 2 of the License, or
--      (at your option) any later version.
--  
--      This program 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.
--  
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
--
--  $Id: upgrade.lua,v 1.12 2004/05/04 23:48:53 mohydine Exp $

--  NOTE: Save can generate this table.

-- upgrader worker1
DefineUpgrade("upgrade-worker1", "icon", "icon-harvest",
  "costs", {   200,   1000,   500,     0,     0,     0,     0})


DefineUpgrade("upgrade-sword1", "icon", "icon-sword2",
  "costs", {   200,   800,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-sword2", "icon", "icon-sword3",
  "costs", {   250,  2400,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-arrow1", "icon", "icon-arrow2",
  "costs", {   200,   300,   300,     0,     0,     0,     0})
DefineUpgrade("upgrade-arrow2", "icon", "icon-arrow3",
  "costs", {   250,   900,   500,     0,     0,     0,     0})

DefineUpgrade("upgrade-human-shield1", "icon", "icon-shield2",
  "costs", {   200,   300,   300,     0,     0,     0,     0})
DefineUpgrade("upgrade-human-shield2", "icon", "icon-shield3",
  "costs", {   250,   900,   500,     0,     0,     0,     0})

DefineUpgrade("upgrade-human-ship-cannon1", "icon", "icon-boat-cannon2",
  "costs", {   200,   700,   100,  1000,     0,     0,     0})
DefineUpgrade("upgrade-human-ship-cannon2", "icon", "icon-boat-cannon3",
  "costs", {   250,  2000,   250,  3000,     0,     0,     0})
DefineUpgrade("upgrade-human-ship-armor1", "icon", "icon-boat-armor2",
  "costs", {   200,   500,   500,     0,     0,     0,     0})
DefineUpgrade("upgrade-human-ship-armor2", "icon", "icon-boat-armor3",
  "costs", {   250,  1500,   900,     0,     0,     0,     0})

DefineUpgrade("upgrade-ballista1", "icon", "icon-tank1",
  "costs", {   250,  1500,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-ballista2", "icon", "icon-tank2",
  "costs", {   250,  4000,     0,     0,     0,     0,     0})

DefineUpgrade("upgrade-ranger", "icon", "icon-advanced-archer",
  "costs", {   250,  1500,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-longbow", "icon", "icon-longbow",
  "costs", {   250,  2000,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-ranger-scouting", "icon", "icon-advanced-archer-scouting",
  "costs", {   250,  1500,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-ranger-marksmanship", "icon", "icon-advanced-archer-marksmanship",
  "costs", {   250,  2500,     0,     0,     0,     0,     0})

DefineUpgrade("upgrade-paladin", "icon", "icon-advanced-knight",
  "costs", {   250,  1000,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-holy-vision", "icon", "icon-vision",
  "costs", {     0,     0,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-healing", "icon", "icon-heal",
  "costs", {   200,  1000,     0,     0,     0,     0,     0})
if (extensions) then
DefineUpgrade("upgrade-area-healing", "icon", "icon-heal",
  "costs", {   400,  2000,     0,     0,     0,     0,     0})
end
DefineUpgrade("upgrade-exorcism", "icon", "icon-blank46",
  "costs", {   200,  2000,     0,     0,     0,     0,     0})

DefineUpgrade("upgrade-flame-shield", "icon", "icon-claw-shield",
  "costs", {   100,  1000,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-fireball", "icon", "icon-fireball",
  "costs", {     0,     0,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-slow", "icon", "icon-slow",
  "costs", {   100,   500,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-invisibility", "icon", "icon-invisibility",
  "costs", {   200,  2500,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-polymorph", "icon", "icon-ladybug",
  "costs", {   200,  2000,     0,     0,     0,     0,     0})
DefineUpgrade("upgrade-blizzard", "icon", "icon-rain",
  "costs", {   200,  2000,     0,     0,     0,     0,     0})

--  NOTE: Save can generate this table.
-- Replace workers by worker1.
DefineModifier("upgrade-worker1",
  {"apply-to", "unit-worker"}, {"convert-to", "unit-worker1"})


DefineModifier("upgrade-sword1",
  {"piercing-damage", 2},
  {"apply-to", "unit-warrior"}, {"apply-to", "unit-knight"}, {"apply-to", "unit-advanced-knight"},
  {"apply-to", "unit-dynamite-ant"},
  {"apply-to", "unit-knight-rider"}, {"apply-to", "unit-advwarrior"})

DefineModifier("upgrade-sword2",
  {"piercing-damage", 2},
  {"apply-to", "unit-warrior"}, {"apply-to", "unit-knight"}, {"apply-to", "unit-advanced-knight"},
  {"apply-to", "unit-dynamite-ant"},
  {"apply-to", "unit-knight-rider"}, {"apply-to", "unit-advwarrior"})

DefineModifier("upgrade-arrow1",
  {"piercing-damage", 1},
  {"apply-to", "unit-archer"}, {"apply-to", "unit-advanced-archer"})

DefineModifier("upgrade-arrow2",
  {"piercing-damage", 1},
  {"apply-to", "unit-archer"}, {"apply-to", "unit-advanced-archer"})

DefineModifier("upgrade-human-shield1",
  {"armor", 2},
  {"apply-to", "unit-warrior"},{"apply-to", "unit-archer"}, {"apply-to", "unit-knight"}, {"apply-to", "unit-advanced-knight"},
  {"apply-to", "unit-dynamite-ant"},
  {"apply-to", "unit-grenadier"}, {"apply-to", "unit-advwarrior"})

DefineModifier("upgrade-human-shield2",
  {"armor", 2},
  {"apply-to", "unit-warrior"},{"apply-to", "unit-archer"}, {"apply-to", "unit-knight"}, {"apply-to", "unit-advanced-knight"},
  {"apply-to", "unit-dynamite-ant"},
  {"apply-to", "unit-grenadier"}, {"apply-to", "unit-advwarrior"})

DefineModifier("upgrade-human-ship-cannon1",
  {"piercing-damage", 5},
  {"apply-to", "unit-gunboat"}, {"apply-to", "unit-gallion"},
  {"apply-to", "unit-submarine"})

DefineModifier("upgrade-human-ship-cannon2",
  {"piercing-damage", 5},
  {"apply-to", "unit-gunboat"}, {"apply-to", "unit-gallion"},
  {"apply-to", "unit-submarine"})

DefineModifier("upgrade-human-ship-armor1",
  {"armor", 5},
  {"apply-to", "unit-gunboat"}, {"apply-to", "unit-gallion"},
  {"apply-to", "unit-shuttle"})

DefineModifier("upgrade-human-ship-armor2",
  {"armor", 5},
  {"apply-to", "unit-gunboat"}, {"apply-to", "unit-gallion"},
  {"apply-to", "unit-shuttle"})

DefineModifier("upgrade-ballista1",
  {"piercing-damage", 15},
  {"apply-to", "unit-tank"})

DefineModifier("upgrade-ballista2",
  {"piercing-damage", 15},
  {"apply-to", "unit-tank"})

DefineModifier("upgrade-ranger",
  {"apply-to", "unit-archer"}, {"convert-to", "unit-advanced-archer"})

DefineModifier("upgrade-longbow",
  {"sight-range", 1},
  {"attack-range", 1},
  {"apply-to", "unit-archer"}, {"apply-to", "unit-advanced-archer"})

DefineModifier("upgrade-ranger-scouting",
  {"sight-range", 3},
  {"apply-to", "unit-archer"}, {"apply-to", "unit-advanced-archer"})

DefineModifier("upgrade-ranger-marksmanship",
  {"piercing-damage", 3},
  {"apply-to", "unit-archer"}, {"apply-to", "unit-advanced-archer"})

DefineModifier("upgrade-paladin",
  {"apply-to", "unit-knight"}, {"convert-to", "unit-advanced-knight"})

DefineModifier("upgrade-holy-vision",
  {"apply-to", "unit-advanced-knight"})

DefineModifier("upgrade-healing",
  {"apply-to", "unit-advanced-knight"})

if (extensions) then
DefineModifier("upgrade-area-healing",
  {"apply-to", "unit-advanced-knight"})
end

DefineModifier("upgrade-exorcism",
  {"apply-to", "unit-advanced-knight"})

DefineModifier("upgrade-flame-shield",
  {"apply-to", "unit-witch"})

DefineModifier("upgrade-fireball",
  {"apply-to", "unit-witch"})

DefineModifier("upgrade-slow",
  {"apply-to", "unit-witch"})

DefineModifier("upgrade-invisibility",
  {"apply-to", "unit-witch"})

DefineModifier("upgrade-polymorph",
  {"apply-to", "unit-witch"})

DefineModifier("upgrade-blizzard",
  {"apply-to", "unit-witch"})

--  NOTE: Save can generate this table.

--- units

DefineAllow("unit-warrior",             "AAAAAAAAAAAAAAAA")
DefineAllow("unit-worker",              "AAAAAAAAAAAAAAAA")
DefineAllow("unit-worker1",             "AAAAAAAAAAAAAAAA")
DefineAllow("unit-tank",                "AAAAAAAAAAAAAAAA")
DefineAllow("unit-knight",              "AAAAAAAAAAAAAAAA")
DefineAllow("unit-archer",              "AAAAAAAAAAAAAAAA")
DefineAllow("unit-witch",               "AAAAAAAAAAAAAAAA")
DefineAllow("unit-advanced-knight",     "AAAAAAAAAAAAAAAA")
DefineAllow("unit-dynamite-ant",        "AAAAAAAAAAAAAAAA")
DefineAllow("unit-advanced-archer",     "AAAAAAAAAAAAAAAA")
DefineAllow("unit-flying-angle",        "AAAAAAAAAAAAAAAA")
DefineAllow("unit-plancton-collector",  "AAAAAAAAAAAAAAAA")
DefineAllow("unit-shuttle",             "AAAAAAAAAAAAAAAA")
DefineAllow("unit-gunboat",             "AAAAAAAAAAAAAAAA")
DefineAllow("unit-gallion",             "AAAAAAAAAAAAAAAA")
DefineAllow("unit-submarine",           "AAAAAAAAAAAAAAAA")
DefineAllow("unit-flying-ant",          "AAAAAAAAAAAAAAAA")
DefineAllow("unit-dragonfly",           "FFFFFFFFFFFFFFFF")
DefineAllow("unit-knight-rider",        "FFFFFFFFFFFFFFFF")
DefineAllow("unit-egg-collector",       "AAAAAAAAAAAAAAAA")
DefineAllow("unit-barracks",            "AAAAAAAAAAAAAAAA")

DefineAllow("unit-watch-tower",         "AAAAAAAAAAAAAAAA")
DefineAllow("unit-insect-house",        "AAAAAAAAAAAAAAAA")
DefineAllow("unit-alchemist",           "AAAAAAAAAAAAAAAA")
DefineAllow("unit-flying-house",        "AAAAAAAAAAAAAAAA")
DefineAllow("unit-dock",                "AAAAAAAAAAAAAAAA")
DefineAllow("unit-queen",               "AAAAAAAAAAAAAAAA")
DefineAllow("unit-wood-house",          "AAAAAAAAAAAAAAAA")
DefineAllow("unit-foundry",             "AAAAAAAAAAAAAAAA")
DefineAllow("unit-witch-tower",         "AAAAAAAAAAAAAAAA")
DefineAllow("unit-blacksmith",          "AAAAAAAAAAAAAAAA")
DefineAllow("unit-plancton-house",      "AAAAAAAAAAAAAAAA")
DefineAllow("unit-plancton-platform",   "AAAAAAAAAAAAAAAA")
DefineAllow("unit-queen-castle",        "AAAAAAAAAAAAAAAA")
DefineAllow("unit-queen-fortress",      "AAAAAAAAAAAAAAAA")
DefineAllow("unit-red-ants-start-location", "AAAAAAAAAAAAAAAA")
DefineAllow("unit-arrow-tower",         "AAAAAAAAAAAAAAAA")
DefineAllow("unit-cannon-tower",        "AAAAAAAAAAAAAAAA")
DefineAllow("unit-human-wall",          "AAAAAAAAAAAAAAAA")

--- upgrades
DefineAllow("upgrade-worker1",          "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-sword1",           "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-sword2",           "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-arrow1",           "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-arrow2",           "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-human-shield1",    "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-human-shield2",    "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-human-ship-cannon1", "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-human-ship-cannon2", "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-human-ship-armor1","AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-human-ship-armor2","AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-ballista1",        "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-ballista2",        "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-ranger",           "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-longbow",          "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-ranger-scouting",  "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-ranger-marksmanship", "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-paladin",          "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-holy-vision",      "RRRRRRRRRRRRRRRR")
DefineAllow("upgrade-healing",          "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-area-healing",     "FFFFFFFFFFFFFFFF")
DefineAllow("upgrade-exorcism",         "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-flame-shield",     "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-fireball",         "RRRRRRRRRRRRRRRR")
DefineAllow("upgrade-slow",             "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-invisibility",     "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-polymorph",        "AAAAAAAAAAAAAAAA")
DefineAllow("upgrade-blizzard",         "FFFFFFFFFFFFFFFF")
DefineAllow("unit-acid-tower",         "AAAAAAAAAAAAAAAA")

--  NOTE: Save can generate this table.

--- red-ants land forces

-- worker1 upgrade
DefineDependency("unit-worker1",
  {"upgrade-worker1"})


--DefineDependency("unit-archer",
--  {"unit-wood-house"})
DefineDependency("unit-tank",
  {"unit-insect-house"})


DefineDependency("unit-knight",
  {"unit-insect-house"})
DefineDependency("unit-advanced-archer",
  {"upgrade-ranger", "unit-wood-house"})
DefineDependency("unit-advanced-knight",
  {"upgrade-paladin", "unit-insect-house", "unit-blacksmith"})

--- human naval forces
DefineDependency("unit-submarine",
  {"unit-foundry"})
DefineDependency("unit-shuttle",
  {"unit-foundry"})
DefineDependency("unit-gallion",
  {"unit-foundry"})

--  - human air forces
--DefineDependency("unit-flying-ant",
--  {"unit-wood-house"})

--  - human buildings
--DefineDependency("unit-arrow-tower",
--  {"unit-blacksmith"})
--DefineDependency("unit-cannon-tower",
--  {"unit-blacksmith"})

DefineDependency("unit-acid-tower",
  {"unit-queen-fortress"},
  "or", {"unit-queen-castle"})


DefineDependency("unit-dock",
  {"unit-queen-fortress"},
  "or", {"unit-queen-castle"})
DefineDependency("unit-foundry",
  {"unit-dock", "unit-queen-fortress"},
  "or", {"unit-dock", "unit-queen-castle"})
DefineDependency("unit-plancton-house",
  {"unit-dock", "unit-queen-fortress"},
  "or", {"unit-dock", "unit-queen-castle"})
DefineDependency("unit-queen-castle",
  {"unit-barracks"})
DefineDependency("unit-alchemist",
  {"unit-queen-fortress"},
  "or", {"unit-queen-castle"})
DefineDependency("unit-insect-house",
  {"unit-queen-fortress"},
  "or", {"unit-queen-castle"})
DefineDependency("unit-witch-tower",
  {"unit-queen-fortress"},
  "or", {"unit-queen-castle"})
--DefineDependency("unit-temple",
--  {"unit-queen-fortress"})

DefineDependency("unit-queen-fortress",
  {"unit-insect-house", "unit-blacksmith"},
  "or", {"unit-insect-house", "unit-blacksmith"},
  "or", {"unit-insect-house", "unit-blacksmith"},
  "or", {"unit-witch-tower", "unit-blacksmith"},
  "or", {"unit-flying-house", "unit-blacksmith"})

DefineDependency("unit-flying-house",
  {"unit-queen-fortress"},
  "or", {"unit-queen-castle"})

--  - human upgrades/research
DefineDependency("upgrade-sword2",
  {"upgrade-sword1"})
DefineDependency("upgrade-arrow2",
  {"upgrade-arrow1"})
DefineDependency("upgrade-human-shield2",
  {"upgrade-human-shield1"})
DefineDependency("upgrade-ballista2",
  {"upgrade-ballista1"})
DefineDependency("upgrade-human-ship-cannon2",
  {"upgrade-human-ship-cannon1"})
DefineDependency("upgrade-human-ship-armor2",
  {"upgrade-human-ship-armor1"})
DefineDependency("upgrade-ranger",
  {"unit-queen-castle"},
  "or", {"unit-queen-fortress"})
DefineDependency("upgrade-longbow",
  {"unit-queen-fortress", "upgrade-ranger"})
DefineDependency("upgrade-ranger-scouting",
  {"unit-queen-fortress", "upgrade-ranger"})
DefineDependency("upgrade-ranger-marksmanship",
  {"unit-queen-fortress", "upgrade-ranger"})

--  - human spells
DefineDependency("upgrade-holy-vision",
  {"upgrade-paladin"})
DefineDependency("upgrade-healing",
  {"upgrade-paladin"})
if (extensions) then
DefineDependency("upgrade-area-healing",
  {"upgrade-paladin", "upgrade-healing"})
end
DefineDependency("upgrade-exorcism",
  {"upgrade-paladin"})

DefineDependency("upgrade-blizzard",
  {"unit-temple"})
