--====================================================================================
---tilesets.lua
--- Nothing to add except maybe "tileset-summer", winter, definitions if not previously defined

--====================================================================================
---icons.lua
DefineIcon({
  Name = "icon-unit-sniper",
  Tileset = "tileset-summer",
  Size = {46, 38},
  Index = 1,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-unit-sniper",
  Tileset = "tileset-winter",
  Size = {46, 38},
  Index = 1,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-unit-sniper",
  Tileset = "tileset-wasteland",
  Size = {46, 38},
  Index = 1,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-unit-sniper",
  Tileset = "tileset-swamp",
  Size = {46, 38},
  Index = 1,
  File = "tilesets/summer/icons.png"})

--====================================================================================
---sound.lua
MakeSound("sound-unit-sniper", "misc/sound-unit-sniper.wav")

--====================================================================================
---missiles.lua
--DefineMissileType("missile-test",
--  { File = "missiles/lightning.png", Size = {32, 32}, Frames = 30, NumDirections = 5,
--  Class = "missile-class-point-to-point-with-hit", Sleep = 1, Speed = 16, Range = 1,
--  DrawLevel = 50 } )

--====================================================================================
---constructions.lua -If necessary
--[[
DefineConstruction("construction-alliance-foundry", {
  Files = {
   {Tileset = "summer",
    File = "red-ants/buildings/foundry_construction_site.png",
    Size = {96, 96}}},
  Constructions = {
   {Percent = 0,
    File = "construction",
    Frame = 0},
   {Percent = 25,
    File = "construction",
    Frame = 1},
   {Percent = 50,
    File = "main",
    Frame = 1}}
})
]]

--====================================================================================
---spells.lua
--[[
DefineUnitType("unit-hole", {})
DefineSpell("spell-spawn-tunnel-exit",
    "showname", "Spawn tunnel exit.",
    "manacost", 0,
    "range", "infinite",
    "target", "position",
    "action", {{"spawn-portal", "portal-type", "unit-hole"}},
    "condition", {}
--  "sound-when-cast", "circle of power",
--  "missile-when-cast", "missile-normal-spell"
)
]]

--====================================================================================
---anim.lua
DefineAnimations("animations-sniper",
  "still", {    -- #5
    { 0, 0,   4,   0}, { 3, 0,   1,   0}},
  "move", { -- #16, P32
    { 0, 3,   2,   0}, { 0, 3,   1,   5}, { 0, 3,   2,   5}, { 0, 2,   1,  10},
    { 0, 3,   1,  10}, { 0, 2,   1,   0}, { 0, 3,   2,   0}, { 0, 3,   1,  15},
    { 0, 3,   2,  15}, { 0, 2,   1,  20}, { 0, 3,   1,  20}, { 3, 2,   1,   0}},
  "attack", {   -- #25
    { 0, 0,   75,  25}, {12, 0,   3,  40},
    { 0, 0,  50,   0}, { 3, 0,   1,   0}},
  "die", {  -- #107
    { 0, 0,   3,  45}, { 0, 0,   3,  50}, { 0, 0, 100,  55}, { 3, 0,   1,  55}})

--====================================================================================
---units.lua
DefineUnitType("unit-sniper", { Name = "SNIPER ANT",
  Files = {"tileset-summer", "red-ants/units/sniper.png"},
  Size = {72, 72},
  Animations = "animations-sniper", Icon = "icon-sniper",
  Costs = {"time", 60, "sugar", 1000},
  Speed = 50,
  HitPoints = 30,
  DrawLevel = 40,
  TileSize = {1, 1}, BoxSize = {31, 31},
  SightRange = 9, ComputerReactionRange = 9, PersonReactionRange = 9,
  Armor = 2, BasicDamage = 100, PiercingDamage = 0, Missile = "missile-none",
  MaxAttackRange = 10,
  Priority = 60,
  Points = 50,
  Demand = 1,
  Corpse = {"unit-dead-body", 6},
  Type = "land",
  RightMouseAction = "attack",
  CanAttack = true,
  CanTargetLand = true,
  LandUnit = true,
  organic = true,
  CanTargetFlag = {"organic", "only"},
  SelectableByRectangle = true,
  AttackFromTransporter = true, --- Does not seem to work
  Sounds = {
    "selected", "red-ant-worker-selected",
    "acknowledge", "red-ant-worker-acknowledge",
    "ready", "red-ant-worker-ready",
    "help", "basic alliance voices help 1",
    "dead", "basic alliance voices dead",
    "attack", "sound-unit-sniper"} } )

--====================================================================================
---upgrade.lua
---DefineUpgrade("upgrade-worker1", "icon", "icon-harvest",
--  "costs", {   200,   1000,   500,     0,     0,     0,     0})
---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"})
DefineAllow("unit-sniper",              "FFFFFFFFFFFFFFFF")
--DefineDependency("unit-sniper",                 {"unit-missile-house"})

--====================================================================================
---fonts.lua
-- Nothing to add

--====================================================================================
---buttons.lua

DefineButton( { Pos = 1, Level = 0, Icon = "icon-sniper",
  Action = "train-unit", Value = "unit-sniper",
 -- Allowed = "check-defined", AllowArg = {"unit-sniper"},
  Key = "s", Hint = "TRAIN UNIT ~!SNIPER",
  ForUnit = {"unit-missile-house"} } )


DefineButton( {Pos = 1, Level = 0, Icon = "icon-move-red-ant-worker",
  Action = "move",
  Key = "m", Hint = "~!MOVE",
  ForUnit = {"unit-sniper"} } )

DefineButton( { Pos = 2, Level = 0, Icon = "icon-shield1",
  Action = "stop",
  Key = "s", Hint = "~!STOP",
  ForUnit = {"unit-sniper"} } )
  
DefineButton( { Pos = 3, Level = 0, Icon = "icon-sword1",
  Action = "attack",
  Key = "a", Hint = "~!ATTACK",
  ForUnit = {"unit-sniper"} } )

DefineButton( { Pos = 4, Level = 0, Icon = "icon-patrol-land",
  Action = "patrol",
  Key = "p", Hint = "~!PATROL",
  ForUnit = {"unit-sniper"} } )

DefineButton( { Pos = 5, Level = 0, Icon = "icon-stand-ground",
  Action = "stand-ground",
  Key = "t", Hint = "S~!TAND GROUND",
  ForUnit = {"unit-sniper"} } )



---ui.lua
-- Nothing to add


if GetUnitTypeIdent("unit-missile-house") ~= "unit not defined" then 

---ai.lua
DefineAiHelper(
--{"build", "unit-worker",
{"train", "unit-missile-house", "unit-sniper"}
--{"upgrade", "unit-queen", "unit-queen-castle"},
--{"research", "unit-blacksmith",  "upgrade-sword1",
--{"repair", "unit-worker",
--{"unit-equiv", "unit-knight",  "unit-advanced-knight"},
)


unit = { 
UnitName = "unit-sniper",
UnitPriority = 110,
UnitAIType = "AiEliteShooter",
UnitType = "unit",
Level = 3,
Dependency = {"unit-missile-house"},
ShouldRushToThisUnit= "false"
}
table.insert(UnitsAI,unit)

end


---campaigns.lua
-- Complex to add

---credits.lua
-- Nothing to add

---tips.lua
-- Nothing to add

---ranks.lua
-- Nothing to add

---menus.lua
-- Nothing to add

---cheats.lua
-- Nothing to add
