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

--====================================================================================
---icons.lua
DefineIcon({
  Name = "icon-unit-butterfly",
  Tileset = "tileset-summer",
  Size = {46, 38},
  Index = 29,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-unit-butterfly",
  Tileset = "tileset-winter",
  Size = {46, 38},
  Index = 29,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-unit-butterfly",
  Tileset = "tileset-wasteland",
  Size = {46, 38},
  Index = 29,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-unit-butterfly",
  Tileset = "tileset-swamp",
  Size = {46, 38},
  Index = 29,
  File = "tilesets/summer/icons.png"})
--Unload button
DefineIcon({
  Name = "icon-butterfly-unload",
  Tileset = "tileset-summer",
  Size = {46, 38},
  Index = 163,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-butterfly-unload",
  Tileset = "tileset-winter",
  Size = {46, 38},
  Index = 163,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-butterfly-unload",
  Tileset = "tileset-wasteland",
  Size = {46, 38},
  Index = 163,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-butterfly-unload",
  Tileset = "tileset-swamp",
  Size = {46, 38},
  Index = 163,
  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

DefineSpell("spell-fireball",
    "showname", "fireball",
    "manacost", 100,
    "range", 8,
    "target", "position",
    "action", {{"spawn-missile", "missile", "missile-fireball", "damage", 20}},
    "sound-when-cast", "fireball throw"
--  "autocast", {range 8)
)

--====================================================================================
---anim.lua
DefineAnimations("animations-butterfly",
  "still", {    -- #24
    { 2, 0,   1,   10}, { 2, 0,   1,   15}, { 2, 0,   1,   10},{ 2, 0,   1,   20},  { 3, 0,   1,  10}},
  "move", { -- #12, P32
    { 0, 0,   1,   10}, { 0, 3,   1,   15}, { 0, 3,   1,  10}, { 0, 3,   1,   20},
    { 0, 2,   1,   10}, { 0, 3,   1,   15}, { 0, 3,   1,  10}, { 0, 3,   1,  20},
    { 0, 3,   1,  10}, { 0, 3,   1,  15}, { 0, 3,   1,  10}, { 0, 3,   1,  20},
    { 3, 3,   1,   10}},
  "attack", {   -- #1
    { 0, 0,   1,   10}, { 0, 0,   1,   15}, { 0, 0,   1,  10}, { 0, 0,   1,  20},
    { 2, 0,   1,  10}, { 0, 0,   1,  15}, { 0, 0,   1,  10}, {0, 0,   1,  20},
    { 0, 0,   1,   10}, { 0, 0,   1,   15}, { 0, 0,   1,  10}, { 0, 0,   1,  20},
    { 0, 0,   1,   10}, { 0, 0,   1,   15}, { 0, 0,   1,  10}, { 0, 0,   1,  20},
    { 0, 0,   1,   10}, { 0, 0,   1,   15}, { 0, 0,   1,  10}, { 0, 0,   1,  20},
    { 0, 0,   1,   10}, { 0, 0,   1,   15}, { 0, 0,   1,  10}, { 0, 0,   1,  20},
    { 0, 0,   1,  10}, { 2, 0,   1,  5}, {12, 0,  20,  0}, { 0, 0,   1,   5},
    { 0, 0, 1, 10}, { 0, 0, 1, 15}, { 0, 0, 1, 10}, { 0, 0, 1, 20},
    { 0, 0, 1, 10}, { 0, 0, 1, 15}, { 0, 0, 1, 10}, { 0, 0, 1, 20},
    { 0, 0, 1, 10}, { 0, 0, 1, 15}, { 0, 0, 1, 10}, { 0, 0, 1, 20},
    { 0, 0, 1, 10}, { 0, 0, 1, 15}, { 0, 0, 1, 10}, { 0, 0, 1, 20},
    { 0, 0, 1, 10}, { 0, 0, 1, 15}, { 0, 0, 1, 10}, { 1, 0, 1, 20},
    { 3, 0, 1, 10}},
  "die", {  -- #31
    { 0, 0,   1,  25}, { 0, 0,   1,  30}, { 3, 0,   1,  35}})
--====================================================================================
---units.lua
DefineUnitType("unit-butterfly", { Name = "Butterfly",
  Files = {"tileset-summer", "red-ants/units/butterfly.png"},
  Size = {128, 128},
   Shadow = {"file", "red-ants/units/butterfly.png", "size", {128, 128}, "offset", {0, 40}},
  Animations = "animations-butterfly", Icon = "icon-unit-butterfly",
  Costs = {"time", 100, "sugar", 850, "wood", 300},
  Speed = 14,
  HitPoints = 250,
  ---MaxMana = 255,
  TileSize = {1, 1}, BoxSize = {63, 63},
  DrawLevel = 60, SightRange = 9, ComputerReactionRange = 8, PersonReactionRange = 6,
  Armor = 6, BasicDamage = 0, PiercingDamage = 25, Missile = "missile-ballista-bolt",
  MaxAttackRange = 5,
  ---CanCastSpell = {
  ---    "spell-fireball"},
  Priority = 65,
  Points = 150,
  Demand = 2,
  Type = "fly",
  RightMouseAction = "attack",
  CanAttack = true,
  CanTargetLand = true, CanTargetSea = true, CanTargetAir = true,
  AirUnit = true,
  DetectCloak = true,
  organic = true,
  Transporter = true,
  MaxOnBoard = 6,
  SelectableByRectangle = true,
  Sounds = {
    "selected", "flying-angle-selected",
    "acknowledge", "flying-angle-acknowledge",
    "ready", "flying-angle-ready",
    "help", "basic alliance voices help 1",
    "dead", "basic alliance voices dead",
    "attack", "flying-angle-attack"} } )

--====================================================================================
---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-butterfly",              "FFFFFFFFFFFFFFFF")
DefineDependency("unit-butterfly",                 {"unit-queen-fortress"})

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

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


DefineButton( { Pos = 2, Level = 0, Icon = "icon-unit-butterfly",
  Action = "train-unit", Value = "unit-butterfly",
  Key = "b", Hint = "TRAIN ~!BUTTERFLY (needs Queen Fortress)",
  ForUnit = {"unit-flying-house"} } )

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

DefineButton( { Pos = 2, Level = 0, Icon = "icon-shield1",
  Action = "stop",
  Key = "s", Hint = "~!STOP",
  ForUnit = {"unit-butterfly"} } )


DefineButton( { Pos = 3, Level = 0, Icon = "icon-attack-ground",
  Action = "attack",
  Key = "g", Hint = "ATTACK ~!GROUND",
  ForUnit = {"unit-butterfly"} } )

DefineButton( { Pos = 7, Level = 0, Icon = "icon-butterfly-unload",
  Action = "unload",
  Key = "u", Hint = "~!UNLOAD",
  ForUnit = {"unit-butterfly"} } )

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

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


--[[  DefineButton( { Pos = 4, Level = 0, Icon = "icon-fireball",
  Action = "cast-spell", Value = "spell-fireball",
  Allowed = "check-true", 
  Key = "f", Hint = "~!FIREBALL",
  ForUnit = {"unit-butterfly" } } )
]]
---ui.lua
-- Nothing to add


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


unit = { 
UnitName = "unit-butterfly",
UnitPriority = 120,
UnitAIType = "AiFlyer",
UnitType = "unit",
Level = 3,
Dependency = {"unit-flying-house","unit-queen-fortress"},
ShouldRushToThisUnit= "false"
}
table.insert(UnitsAI,unit)

---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
