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

--      spells.lua - Spells
--
--      (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

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



do
	
	DefineSpell("spell-haste",
		"showname", "Haste",
		"manacost", 50,
		"range", 6,
		"target", "unit",
		"action", {{"adjust-buffs", "haste-ticks", 1000, "slow-ticks", 0}},
		"condition", {
			"building", "false",
			"max-haste-ticks", 100
		},
		"missile-when-cast", "missile-normal-spell",
		"autocast", {"range", 6, "condition", {"coward", "false", "alliance", "only"}},
		"ai-cast", {"range", 6, "combat", "only", "condition", {"coward", "false", "alliance", "only"}}
	)

	DefineSpell("spell-haste-self",
		"showname", "Haste self",
		"manacost", 100,
		"target", "self",
		"range", 30,
		"action", {{"adjust-buffs", "haste-ticks", 300, "slow-ticks", 0}},
		"condition", {
			"max-haste-ticks", 50
		},
		"autocast", {"range", 30},
		"ai-cast", {"range", 6, "combat", "only", "condition", {"coward", "false", "alliance", "only"}},
		"missile-when-cast", "missile-normal-spell"
	)

	DefineSpell("spell-fod",
		"showname", "Finger of death",
		"manacost", 100,
		"range", 8,
		"target", "unit",
		"action", {{"spawn-missile", "damage", 2000}},
		"condition", {
			"building", "false",
			"undead", "false",
			"demon", "false",
		},
		"autocast", {"range", 6},
		"ai-cast", {"range", 6, "combat", "only", "condition", {"coward", "false", "alliance", "only"}},
		"missile-when-cast", "missile-death-ray"
	)
		
	DefineSpell("spell-kick-away",
		"showname", "Kick away",
		"manacost", 5,
		"range", 200,
		"target", "unit",
		"action", {{"adjust-vitals", "hit-points", -20000000}},
		"condition", {
			"building", "false",
		},
		"sound-when-cast", "dwarves die",
		"missile-when-cast", "missile-normal-spell"
	)

	DefineSpell("spell-healing",
		"showname", "Healing",
		"manacost", 1,
		"range", 6,
		"target", "unit",
		"action", {{"adjust-vitals", "hit-points", 1}},
		"condition", {
			"building", "false",
		},
		"missile-when-cast", "missile-healing-effect",
		"autocast", {"range", 6, "condition", {"alliance", "only", "max-hp-percent", 90}}
	)

	DefineSpell("spell-healing2",
		"showname", "Healing",
		"manacost", 1,
		"range", 8,
		"target", "unit",
		"action", {{"adjust-vitals", "hit-points", 2}},
		"condition", {
			"building", "false",
		},
		"missile-when-cast", "missile-healing-effect",
		"autocast", {"range", 8, "condition", {"alliance", "only", "max-hp-percent", 90}}
	)

	DefineSpell("spell-healing3",
		"showname", "Healing",
		"manacost", 1,
		"range", 20,
		"target", "unit",
		"action", {{"adjust-vitals", "hit-points", 4}},
		"condition", {
			"building", "false",
		},
		"missile-when-cast", "missile-healing-effect",
		"autocast", {"range", 20, "condition", {"alliance", "only", "max-hp-percent", 90}}
	)

	DefineSpell("spell-fury",
		"showname", "fury",
		"manacost", 50,
		"range", 6,
		"target", "unit",
		"action", {{"adjust-buffs", "haste-ticks", 1000, "slow-ticks", 0}},
		"condition", {
			"building", "false",
			"max-haste-ticks", 10
		},
		"missile-when-cast", "missile-normal-spell",
		"autocast", {"range", 6, "condition", {"coward", "false", "alliance", "only"}},
		"ai-cast", {"range", 6, "combat", "only", "condition", {"coward", "false", "alliance", "only"}}
	)

	DefineSpell("spell-fury2",
		"showname", "fury",
		"manacost", 50,
		"range", 100,
		"target", "unit",
		"action", {{"adjust-buffs", "haste-ticks", 5000, "slow-ticks", 0}},
		"condition", {
			"building", "false",
			"max-haste-ticks", 10
		},
		"missile-when-cast", "missile-normal-spell",
		"autocast", {"range", 50, "condition", {"coward", "false", "alliance", "only"}},
		"ai-cast", {"range", 50, "combat", "only", "condition", {"coward", "false", "alliance", "only"}}
	)

	DefineSpell("spell-hard-strike",
	"showname", "hard strike",
	"manacost", 100,
	"target", "position",
	"range", 1,
	"missile-when-cast", "missile-impact",
	"action", {{"demolish", "range", 0, "damage", 50}}
	)

end

