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

--====================================================================================
---icons.lua
DefineIcon({
  Name = "icon-medic-house",
  Tileset = "tileset-summer",
  Size = {46, 38},
  Index = 41,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-medic-house",
  Tileset = "tileset-winter",
  Size = {46, 38},
  Index = 41,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-medic-house",
  Tileset = "tileset-wasteland",
  Size = {46, 38},
  Index = 41,
  File = "tilesets/summer/icons.png"})
DefineIcon({
  Name = "icon-medic-house",
  Tileset = "tileset-swamp",
  Size = {46, 38},
  Index = 41,
  File = "tilesets/summer/icons.png"})
----------------------------------------------------------------------
DefineIcon({
  Name = "icon-spell-healing",
  Tileset = "tileset-summer",
  Size = {46, 38},
  Index = 0,
  File = "tilesets/summer/unit-medic-spell-healing-icon.png"})
DefineIcon({
  Name = "icon-spell-healing",
  Tileset = "tileset-winter",
  Size = {46, 38},
  Index = 0,
  File = "tilesets/summer/unit-medic-spell-healing-icon.png"})
DefineIcon({
  Name = "icon-spell-healing",
  Tileset = "tileset-wasteland",
  Size = {46, 38},
  Index = 0,
  File = "tilesets/summer/unit-medic-spell-healing-icon.png"})
DefineIcon({
  Name = "icon-spell-healing",
  Tileset = "tileset-swamp",
  Size = {46, 38},
  Index = 0,
  File = "tilesets/summer/unit-medic-spell-healing-icon.png"})

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

--====================================================================================
---missiles.lua
--====================================================================================
---constructions.lua -If necessary
--====================================================================================
---spells.lua -- FOR BUILDING? USE AUTOCAST
------------------------------------------------------
---- Healing spell for medic ant (should be different for medic house). Uses the missile-normal-spell atm.
------------------------------------------------------

DefineSpell("spell-healing-building",
	"showname", "Healing",
	"manacost", 10,
	"range",  10,
	"target", "unit",
	"action", {{"adjust-vitals", "hit-points", 10},
	{"spawn-missile", "missile", "missile-normal-spell", "start-point", {"base", "target"} }, 
},
	"condition", {
		"organic", "only",
		"building", "false",
		"self", "false",
		"max-hp-percent", 100},
	"sound-when-cast", "polymorph",
	"autocast", {
		"range", 10,
		"condition", {"alliance", "only", "max-hp-percent", 90 }}
)

--====================================================================================
---anim.lua

--====================================================================================
---units.lua
DefineUnitType("unit-medic-house", { Name = "Medic House",
 Files = {"tileset-summer",  "tilesets/summer/red-ants/buildings/unit-medic-house.png"},
  Size = {96, 96},
  Shadow = {"file", "tilesets/summer/red-ants/buildings/shadow_unit-medic-house.png", "size", {96, 96}, "offset", {0, 0}},
  Animations = "animations-building", Icon = "icon-medic-house",
  Costs = {"time", 75, "sugar", 900, "wood", 500},
  Construction = "construction-land",
  Speed = 0,
  HitPoints = 500,
  MaxMana = 255,
  TileSize = {3, 3}, BoxSize = {95, 95},
  DrawLevel = 40, SightRange = 1,
  Armor = 20, BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
  Priority = 15, AnnoyComputerFactor = 20,
  Points = 230,
  Corpse = {"unit-destroyed-3x3-place", 0},
  ExplodeWhenKilled = "missile-explosion",
  Type = "land",
  Building = true, VisibleUnderFog = true, 
  BurnPercent = 25, BurnDamageRate = 1,
  BuilderOutside = true,
  RepairHp = 4,
  RepairCosts = {"sugar", 1, "wood", 1},
  CanCastSpell = {"spell-healing-building"},
  AutoCastActive = {"spell-healing-building"},
  Sounds = {
    "selected", "medic-house-selected",
    "acknowledge", "inventor-acknowledge",
    "ready", "inventor-ready",
    "help", "basic alliance voices help 2",
    "dead", "building destroyed",
    "attack", "inventor-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-medic-house",              "FFFFFFFFFFFFFFFF")
DefineDependency("unit-medic-house",                 {"unit-queen-fortress"})

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

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

DefineButton( { Pos = 2, Level = 3, Icon = "icon-medic-house",
  Action = "build", Value = "unit-medic-house",
  Key = "e", Hint = "BUILD M~!EDIC HOUSE",
  ForUnit = {"unit-worker", "unit-worker1"} } )

DefineButton( { Pos = 8, Level = 0, Icon = "icon-spell-healing",
  Action = "cast-spell", Value = "spell-healing-building",
  Allowed = "check-true", 
  Key = "h", Hint = "~!HEAL",
  ForUnit = {"unit-medic-house"} } )
---ui.lua
-- Nothing to add


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


unit = { 
UnitName = "unit-medic-house",
UnitPriority = 110,
UnitAIType = "AiHealingBuilding",
UnitType = "building",
Level = 3,
Dependency = {"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
