--__________         __    __  .__           ___________
--\______   \_____ _/  |__/  |_|  |   ____   \_   _____/__________
-- |    |  _/\__  \\   __\   __\  | _/ __ \   |    __)/  _ \_  __ \
-- |    |   \ / __ \|  |  |  | |  |_\  ___/   |     \(  <_> )  | \/
-- |______  /(____  /__|  |__| |____/\___  >  \___  / \____/|__|
--        \/      \/                     \/       \/
--   _____                     .___.__
--  /     \ _____    ____    __| _/|__| ____  ___________
-- /  \ /  \\__  \  /    \  / __ | |  |/ ___\/  _ \_  __ \
--/    Y    \/ __ \|   |  \/ /_/ | |  \  \__(  <_> )  | \/
--\____|__  (____  /___|  /\____ | |__|\___  >____/|__|
--        \/     \/     \/      \/         \/

--      units.lua - Units
--
--      (c) Copyright 2005 by Kimmo Merikivi
--
--      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

---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------

-- Load the animations for the units.
Load("scripts/anim.lua")

--=============================================================================
--	Define unit-types.
--
--	NOTE: Save can generate this table.
--


DefineUnitType("unit-titanium-dwarf", { Name = "Titanium armored dwarf",
  Files = {"tileset-summer", "neutral/units/titanium-dwarf.png"},
  Size = {72, 72},
  Animations = "animations-advanced-warrior", Icon = "icon-titanium-dwarf",
  Costs = {"time", 5000, "gold", 100000, "iron", 5000, "titanium", 5000},
  HitPoints = 25000,
  DrawLevel = 40,
  Speed = 10,
  TileSize = {1, 1}, BoxSize = {31, 31},
  SightRange = 10, ComputerReactionRange = 5, PersonReactionRange = 5,
  Armor = 1500, BasicDamage = 200, PiercingDamage = 50, Missile = "missile-none",
  MaxAttackRange = 1,
  Priority = 5000,
  Points = 500000,
  Demand = 0,
  Corpse = {"unit-dead-body", 1},
  Type = "land",
  RightMouseAction = "attack",
  CanAttack = true,
  CanTargetLand = true,
  LandUnit = true,
  organic = true,
  SelectableByRectangle = true,
  Sounds = {
    "selected", "dwarves-advanced-warrior selected",
    "acknowledge", "dwarves-advanced-warrior acknowledge",
    "ready", "dwarves-advanced-warrior-ready",
    "help", "basic dwarves voices help 1",
    "dead", "dwarves die",
    "attack", "sword attack"} } )

DefineUnitType("unit-trap", { Name = "Trap",
  Files = {"tileset-summer", "neutral/trap.png"},
  Size = {32, 32},
  Animations = "animations-trap", Icon = "icon-dwarves-town-hall",
  RepairCosts = {"gold", 0},
  RepairHp = 0,
  Costs = {"time", 100, "gold", 100},
  Construction = "construction-land",
  HitPoints = 30,
  DrawLevel = 50,
  TileSize = {1, 1}, BoxSize = {32, 32},
  SightRange = 1, ComputerReactionRange = 5, PersonReactionRange = 5,
  Armor = -2, BasicDamage = 3, PiercingDamage = 10, Missile = "missile-none",
  MaxAttackRange = 2,
  Priority = 5, AnnoyComputerFactor = 1,
  Points = 20,
  Transporter = false,
  MaxOnBoard = 0,
  AttackFromTransporter = false,
  Corpse = {"unit-destroyed-1x1-place", 0},
  ExplodeWhenKilled = "missile-explosion",
  Type = "land",
  LandUnit = true,
  PermanentCloak = boolean,
  CanAttack = true,
  RightMouseAction = "attack",
  CanTargetLand = true, CanTargetSea = false, CanTargetAir = false,
  Building = true, VisibleUnderFog = true} )

DefineUnitType("unit-fortress", { Name = "Fortress",
  Files = {"tileset-summer", "neutral/buildings/fortress.png"},
  Size = {512, 512},
  Animations = "animations-fortress", Icon = "icon-dwarves-town-hall",
  RepairCosts = {"gold", 500, "stone", 500},
  RepairHp = 10,
  Costs = {"time", 10000, "gold", 100000, "wood", 5000, "stone", 50000, "iron", 5000},
  Construction = "construction-land",
  HitPoints = 50000,
  DrawLevel = 50,
  TileSize = {16, 16}, BoxSize = {510, 510},
  SightRange = 20, ComputerReactionRange = 15, PersonReactionRange = 15,
  Armor = 100, BasicDamage = 100, PiercingDamage = 50, Missile = "missile-catapult-rock",
  MaxAttackRange = 15,
  Priority = 150, AnnoyComputerFactor = 50,
  Points = 20000,
  Transporter = true,
  MaxOnBoard = 18,
  AttackFromTransporter = true,
  Corpse = {"unit-destroyed-16x16-place", 0},
  ExplodeWhenKilled = "missile-explosion",
  Type = "land",
  LandUnit = true,
  CanAttack = true,
  RightMouseAction = "attack",
  CanTargetLand = true, CanTargetSea = true, CanTargetAir = true,
  Building = true, VisibleUnderFog = true} )

DefineUnitType("unit-sardor", { Name = "Sardor",
  Files = {"tileset-summer", "neutral/buildings/sardor.png"},
  Size = {512, 1024},
  Animations = "animations-building", Icon = "icon-sardor",
  RepairCosts = {"gold", 500000, "stone", 500000},
  RepairHp = 1000,
  Costs = {"time", 100000, "gold", 1000000, "wood", 500000, "stone", 500000, "iron", 500000, "titanium", 500000},
  Construction = "construction-land",
  HitPoints = 500000,
  DrawLevel = 50,
  TileSize = {16, 32}, BoxSize = {510, 1020},
  SightRange = 50, ComputerReactionRange = 15, PersonReactionRange = 15,
  Armor = 500, BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 150, AnnoyComputerFactor = 50,
  Points = 2000000,
  Transporter = true,
  MaxOnBoard = 18,
  AttackFromTransporter = true,
  Corpse = {"unit-destroyed-4x4-place", 0},
  ExplodeWhenKilled = "missile-explosion",
  Type = "land",
  LandUnit = true,
  CanAttack = true,
  RightMouseAction = "attack",
  CanTargetLand = true, CanTargetSea = true, CanTargetAir = true,
  Building = true, VisibleUnderFog = true} )

DefineUnitType("unit-grumbuduts", { Name = "Grumbuduts",
  Files = {"tileset-summer", "neutral/buildings/grumbuduts.png"},
  Size = {512, 1024},
  Animations = "animations-building", Icon = "icon-grumbuduts",
  RepairCosts = {"gold", 500000, "stone", 500000},
  RepairHp = 1000,
  Costs = {"time", 100000, "gold", 1000000, "wood", 500000, "stone", 500000, "iron", 500000, "titanium", 500000},
  Construction = "construction-land",
  HitPoints = 500000,
  DrawLevel = 50,
  TileSize = {16, 32}, BoxSize = {510, 1020},
  SightRange = 50, ComputerReactionRange = 15, PersonReactionRange = 15,
  Armor = 500, BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 150, AnnoyComputerFactor = 50,
  Points = 2000000,
  Corpse = {"unit-destroyed-4x4-place", 0},
  ExplodeWhenKilled = "missile-explosion",
  Type = "land",
  Transporter = true,
  MaxOnBoard = 18,
  AttackFromTransporter = true,
  Transporter = true,
  LandUnit = true,
  CanAttack = true,
  RightMouseAction = "attack",
  CanTargetLand = true, CanTargetSea = true, CanTargetAir = true,
  Building = true, VisibleUnderFog = true} )

DefineUnitType("unit-gold-mine", { Name = "Gold Mine",
  Files = {"tileset-summer", "neutral/buildings/gold_mine.png"},
  Size = {96, 96},
  Animations = "animations-building", Icon = "icon-gold-mine",
  NeutralMinimapColor = {255, 255, 0},
  Costs = {"time", 150},
  Construction = "construction-land2",
  HitPoints = 25500,
  DrawLevel = 40,
  TileSize = {3, 3}, BoxSize = {95, 95},
  SightRange = 1,
  Armor = 20, BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Corpse = {"unit-destroyed-3x3-place", 0},
  ExplodeWhenKilled = "missile-explosion",
  Type = "land",
  Building = true, VisibleUnderFog = true,
  GivesResource = "gold", CanHarvest = true,
  Sounds = {
    "selected", "gold-mine-selected",
    "dead", "building destroyed"} } )
    
DefineUnitType("unit-iron-mine", { Name = "Iron Mine",
  Files = {"tileset-summer", "neutral/buildings/iron_mine.png"},
  Size = {96, 96},
  Animations = "animations-building", Icon = "icon-iron-mine",
  NeutralMinimapColor = {255, 255, 0},
  Costs = {"time", 150},
  Construction = "construction-land2",
  HitPoints = 25500,
  DrawLevel = 40,
  TileSize = {3, 3}, BoxSize = {95, 95},
  SightRange = 1,
  Armor = 20, BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Corpse = {"unit-destroyed-3x3-place", 0},
  ExplodeWhenKilled = "missile-explosion",
  Type = "land",
  Building = true, VisibleUnderFog = true,
  GivesResource = "iron", CanHarvest = true,
  Sounds = {
    "selected", "iron-mine-selected",
    "dead", "building destroyed"} } )

 DefineUnitType("unit-stone-mine", { Name = "Stone Mine",
  Files = {"tileset-summer", "neutral/buildings/stone_mine.png"},
  Size = {128, 128},
  Animations = "animations-building", Icon = "icon-stone-mine",
  NeutralMinimapColor = {255, 255, 0},
  Costs = {"time", 150},
  Construction = "construction-land2",
  HitPoints = 25500,
  DrawLevel = 40,
  TileSize = {4, 4}, BoxSize = {126, 126},
  SightRange = 1,
  Armor = 20, BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Corpse = {"unit-destroyed-4x4-place", 0},
  ExplodeWhenKilled = "missile-explosion",
  Type = "land",
  Building = true, VisibleUnderFog = true,
  GivesResource = "stone", CanHarvest = true,
  Sounds = {
    "selected", "stone-mine-selected",
    "dead", "building destroyed"} } )
      
 DefineUnitType("unit-titanium-mine", { Name = "Titanium Mine",
  Files = {"tileset-summer", "neutral/buildings/titanium_mine.png"},
  Size = {128, 128},
  Animations = "animations-building", Icon = "icon-titanium-mine",
  NeutralMinimapColor = {255, 255, 0},
  Costs = {"time", 150},
  Construction = "construction-land2",
  HitPoints = 25500,
  DrawLevel = 40,
  TileSize = {4, 4}, BoxSize = {126, 126},
  SightRange = 1,
  Armor = 20, BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Corpse = {"unit-destroyed-3x3-place", 0},
  ExplodeWhenKilled = "missile-explosion",
  Type = "land",
  Building = true, VisibleUnderFog = true,
  GivesResource = "titanium", CanHarvest = true,
  Sounds = {
    "selected", "stone-mine-selected",
    "dead", "building destroyed"} } )


DefineUnitType("unit-oil-patch", { Name = "Oil Patch",
  Files = {"tileset-summer", "neutral/buildings/oil_patch.png"},
  Size = {96, 96},
  Animations = "animations-building", Icon = "icon-oil-patch",
  NeutralMinimapColor = {0, 0, 0},
  HitPoints = 0,
  DrawLevel = 5,
  TileSize = {3, 3}, BoxSize = {95, 95},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "naval",
  Building = true, VisibleUnderFog = true,
  GivesResource = "oil",
  Sounds = {
    "selected", "oil-patch-selected",
    "acknowledge", "oil-patch-acknowledge",
    "ready", "oil-patch-ready",
    "help", "oil-patch-help",
    "dead", "building destroyed",
    "attack", "oil-patch-attack"} } )


DefineUnitType("unit-destroyed-1x1-place", { Name = "Destroyed 1x1 Place",
  Files = {
    "tileset-summer", "neutral/buildings/small_destroyed_site.png"},
  Size = {32, 32},
  Animations = "animations-destroyed-place", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 10,
  TileSize = {1, 1}, BoxSize = {31, 31},
  SightRange = 2,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-destroyed-2x2-place", { Name = "Destroyed 2x2 Place",
  Files = {"tileset-summer", "neutral/buildings/destroyed_site.png"},
  Size = {64, 64},
  Animations = "animations-destroyed-place", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 10,
  TileSize = {2, 2}, BoxSize = {63, 63},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-destroyed-3x3-place", { Name = "Destroyed 3x3 Place",
  Files = {"tileset-summer", "neutral/buildings/destroyed_site96.png"},
  Size = {96, 96},
  Animations = "animations-destroyed-place", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 10,
  TileSize = {3, 3}, BoxSize = {95, 95},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-destroyed-4x4-place", { Name = "Destroyed 4x4 Place",
  Files = {"tileset-summer", "neutral/buildings/destroyed_site128.png"},
  Size = {128, 128},
  Animations = "animations-destroyed-place", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 10,
  TileSize = {4, 4}, BoxSize = {127, 127},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-destroyed-5x5-place", { Name = "Destroyed 5x5 Place",
  Files = {"tileset-summer", "neutral/buildings/destroyed_site160.png"},
  Size = {160, 160},
  Animations = "animations-destroyed-place", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 10,
  TileSize = {5, 5}, BoxSize = {159, 159},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-destroyed-6x6-place", { Name = "Destroyed 6x6 Place",
  Files = {"tileset-summer", "neutral/buildings/destroyed_site192.png"},
  Size = {192, 192},
  Animations = "animations-destroyed-place", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 10,
  TileSize = {6, 6}, BoxSize = {191, 191},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-destroyed-7x7-place", { Name = "Destroyed 7x7 Place",
  Files = {"tileset-summer", "neutral/buildings/destroyed_site224.png"},
  Size = {224, 224},
  Animations = "animations-destroyed-place", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 10,
  TileSize = {7, 7}, BoxSize = {223, 223},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-destroyed-8x8-place", { Name = "Destroyed 8x8 Place",
  Files = {"tileset-summer", "neutral/buildings/destroyed_site256.png"},
  Size = {256, 256},
  Animations = "animations-destroyed-place", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 10,
  TileSize = {8, 8}, BoxSize = {255, 255},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-destroyed-16x16-place", { Name = "Destroyed 16x16 Place",
  Files = {"tileset-summer", "neutral/buildings/destroyed_site512.png"},
  Size = {512, 512},
  Animations = "animations-destroyed-place", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 10,
  TileSize = {16, 16}, BoxSize = {511, 511},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-dead-body", { Name = "Dead Body",
  Files = {"tileset-summer", "neutral/units/corpses.png"},
  Size = {72, 72},
  Animations = "animations-dead-body", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 5,
  TileSize = {1, 1}, BoxSize = {31, 31},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-null", { Name = "Null",
  Files = {"tileset-summer", "neutral/buildings/destroyed_site.png"},
  Size = {64, 64},
  Animations = "animations-destroyed-place", Icon = "icon-cancel",
  HitPoints = 255,
  DrawLevel = 10,
  TileSize = {2, 2}, BoxSize = {63, 63},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Vanishes = true,
  Sounds = {} } )

DefineUnitType("unit-whirl", { Name = "Whirl",
  Files = {"tileset-summer", "neutral/buildings/whirl.png"},
  Size = {64, 64},
  NeutralMinimapColor = {255, 255, 255},
  Animations = "animations-whirl", Icon = "icon-whirl",
  HitPoints = 0,
  DrawLevel = 10,
  TileSize = {2, 2}, BoxSize = {63, 63},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "naval",
  Building = true, VisibleUnderFog = true,
  Sounds = {} } )

DefineUnitType("unit-1xstone", { Name = "Stone",
  Files = {"tileset-summer", "neutral/buildings/1xstone.png"},
  Size = {32, 32},
  NeutralMinimapColor = {100, 100, 100},
  Animations = "animations-building", Icon = "icon-stone",
  HitPoints = 1000,
  DrawLevel = 10,
  TileSize = {1, 1}, BoxSize = {31, 31},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Sounds = {} } )


DefineUnitType("unit-2xstone", { Name = "Stone",
  Files = {"tileset-summer", "neutral/buildings/2xstone.png"},
  Size = {64, 64},
  NeutralMinimapColor = {100, 100, 100},
  Animations = "animations-building", Icon = "icon-stone",
  HitPoints = 2000,
  DrawLevel = 10,
  TileSize = {2, 2}, BoxSize = {63, 63},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Sounds = {} } )

DefineUnitType("unit-tree1", { Name = "Tree",
  Files = {"tileset-summer", "neutral/buildings/tree1.png"},
  Size = {64, 96},
  NeutralMinimapColor = {60, 255, 60},
  Animations = "animations-building", Icon = "icon-tree",
  HitPoints = 500,
  DrawLevel = 10,
  TileSize = {2, 3}, BoxSize = {63, 95},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Sounds = {} } )

DefineUnitType("unit-tree2", { Name = "Tree",
  Files = {"tileset-summer", "neutral/buildings/tree2.png"},
  Size = {96, 128},
  NeutralMinimapColor = {60, 255, 60},
  Animations = "animations-building", Icon = "icon-tree",
  HitPoints = 500,
  DrawLevel = 10,
  TileSize = {3, 4}, BoxSize = {94, 126},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Sounds = {} } )

DefineUnitType("unit-tree3", { Name = "Tree",
  Files = {"tileset-summer", "neutral/buildings/tree3.png"},
  Size = {96, 128},
  NeutralMinimapColor = {60, 255, 60},
  Animations = "animations-building", Icon = "icon-tree",
  HitPoints = 500,
  DrawLevel = 10,
  TileSize = {3, 4}, BoxSize = {94, 126},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Sounds = {} } )

DefineUnitType("unit-mountain1", { Name = "Mountain",
  Files = {"tileset-summer", "neutral/buildings/mountain1.png"},
  Size = {448, 512},
  Animations = "animations-building", Icon = "icon-mountain",
  HitPoints = 100000,
  DrawLevel = 10,
  TileSize = {14, 16}, BoxSize = {446, 510},
  SightRange = 1,
  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 0,
  Type = "land",
  Building = true, VisibleUnderFog = true,
  Sounds = {} } )

-- Load the different races
print("Loaded neutral units and animations\n")
Load("scripts/dwarves/units.lua")
print("Loaded dwarves units\n")
Load("scripts/darkness/units.lua")
print("Loaded darkness units\n")
