-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011 Nicolas Casalini
--
-- 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 3 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, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org

newTalent{
	name = "Master Summoner",
	display_name = "召唤精通",
	type = {"wild-gift/summon-advanced", 1},
	require = gifts_req_high1,
	mode = "sustained",
	points = 5,
	sustain_equilibrium = 20,
	cooldown = 10,
	range = 10,
	tactical = { BUFF = 2 },
	getCooldownReduction = function(self, t) return util.bound(self:getTalentLevelRaw(t) / 15, 0.05, 0.3) end,
	activate = function(self, t)
		game:playSoundNear(self, "talents/heal")
		return {
			cd = self:addTemporaryValue("summon_cooldown_reduction", t.getCooldownReduction(self, t)),
		}
	end,
	deactivate = function(self, t, p)
		self:removeTemporaryValue("summon_cooldown_reduction", p.cd)
		return true
	end,
	info = function(self, t)
		local cooldownred = t.getCooldownReduction(self, t)
		return ([[减少 %d%% 所有召唤兽技能冷却时间。]]):
		format(cooldownred * 100)
	end,
}

newTalent{
	name = "Grand Arrival",
	display_name = "野性降临",
	type = {"wild-gift/summon-advanced", 2},
	require = gifts_req_high2,
	points = 5,
	mode = "passive",
	radius = function(self, t)
		return 1 + math.floor(self:getTalentLevel(t) / 2)
	end,
	info = function(self, t)
		local radius = self:getTalentRadius(t)
		return ([[当召唤精通激活时，每个召唤兽出现在世界上时，它会触发1个野性效果：
		*里奇之焰：减少范围内所有敌人的火焰抵抗
		*三头蛇：生成一片蔓延的毒雾
		*雾凇：减少范围内所有敌人的冰冷抵抗
		*火龙：出现一只小火龙
		*战争猎犬：减少范围内所有敌人的物理抵抗
		*史莱姆：减少范围内所有敌人的自然抵抗
		*米诺陶斯：减少范围内所有敌人的移动速度
		*岩石傀儡：眩晕范围内所有敌人
		*乌龟：治疗范围内所有友军单位
		*蜘蛛：蜘蛛太可恶了以至于引起所有附近敌人的排斥。
		受意志影响，效果有额外加成。
		效果范围 %d 。]]):format(radius)
	end,
}

newTalent{
	name = "Nature's Cycle", 
	display_name = "自然之环",
	short_name = "NATURE_CYCLE",
	type = {"wild-gift/summon-advanced", 3},
	require = gifts_req_high3,
	mode = "passive",
	points = 5,
	getChance = function(self, t) return math.min(100, 30 + self:getTalentLevel(t) * 15) end,
	getReduction = function(self, t) return math.ceil(self:getTalentLevel(t) / 2) end,
	info = function(self, t)
		return ([[当召唤精通激活时，每出现新的召唤兽会减少狂怒、引爆和野性召唤的冷却时间。
	%d%% 概率减少它们 %d 回合冷却时间。]]):format(t.getChance(self, t), t.getReduction(self, t))
	end,
}

newTalent{
	name = "Wild Summon",
	display_name = "野性召唤",
	type = {"wild-gift/summon-advanced", 4},
	require = gifts_req_high4,
	points = 5,
	equilibrium = 9,
	cooldown = 25,
	range = 10,
	tactical = { BUFF = 5 },
	no_energy = true,
	on_pre_use = function(self, t, silent)
		return self:isTalentActive(self.T_MASTER_SUMMONER)
	end,
	action = function(self, t)
		self:setEffect(self.EFF_WILD_SUMMON, math.floor(self:getTalentLevel(t)), {chance=100})
		game:playSoundNear(self, "talents/teleport")
		return true
	end,
	info = function(self, t)
		return ([[你在 %d 回合内 100%% 召唤出一只野性模式的召唤兽。
		每回合概率递减。
		野生召唤兽增加1个新的天赋：
		*里奇之焰：使身上围绕一团火焰并击退敌人
		*三头蛇：可以从近战中脱离
		*雾凇：提高魔法抵抗
		*火龙：可以用怒吼来沉默敌人
		*战争猎犬：可以狂暴，增加它的暴击率和护甲穿透值
		*史莱姆：可以吞掉生命值较低的敌人，恢复你的自然失衡值
		*米诺陶斯：可以向目标冲锋
		*岩石傀儡：近战攻击有溅射效果
		*乌龟：可以强迫范围内敌人进入近战状态
		*蜘蛛：可以向目标吐出剧毒，减少它们的治疗量
		此技能只有在召唤精通激活时才能使用。]]):format(math.floor(self:getTalentLevel(t)))
	end,
}
