-- 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 = "Trap Detection",
	display_name = "陷阱侦测",
	type = {"cunning/survival", 1},
	require = cuns_req1,
	mode = "passive",
	points = 5,
	info = function(self, t)
		return ([[你对细节的注意使你能侦测到你周围的陷阱。（提高 %d 点侦测能力）。]]):
		format(self:getTalentLevel(t) * self:getCun(25, true))
	end,
}

newTalent{
	name = "Heightened Senses",
	display_name = "强化感知",
	type = {"cunning/survival", 2},
	require = cuns_req2,
	mode = "passive",
	points = 5,
	on_learn = function(self, t)
		self.heightened_senses = 4 + math.ceil(self:getTalentLevel(t))
	end,
	on_unlearn = function(self, t)
		if self:knowTalent(t) then
			self.heightened_senses = 4 + math.ceil(self:getTalentLevel(t))
		else
			self.heightened_senses = nil
		end
	end,
	info = function(self, t)
		return ([[你注意到他人注意不到的细节，甚至能在阴影区域“看到”怪物， %d 格半径范围。
		注意此能力不属于心灵感应，仍然受到光照的限制。]]):
		format(4 + math.ceil(self:getTalentLevel(t)))
	end,
}

newTalent{
	name = "Trap Disarm",
	display_name = "陷阱拆除",
	type = {"cunning/survival", 3},
	require = cuns_req3,
	mode = "passive",
	points = 5,
	info = function(self, t)
		return ([[你已经学会解除陷阱。（提高 %d 点拆除能力）。]]):
		format(self:getTalentLevel(t) * self:getCun(25, true))
	end,
}

newTalent{
	name = "Evasion",
	display_name = "强化闪避",
	type = {"cunning/survival", 4},
	points = 5,
	require = cuns_req4,
	random_ego = "defensive",
	tactical = { ESCAPE = 2, DEFEND = 2 },
	cooldown = 30,
	action = function(self, t)
		local dur = 5 + self:getWil(10)
		local chance = 5 * self:getTalentLevel(t) + self:getCun(25, true) + self:getDex(25, true)
		self:setEffect(self.EFF_EVASION, dur, {chance=chance})
		return true
	end,
	info = function(self, t)
		return ([[你敏捷的身手允许你预判即将到来的攻击，允许你有 %d%% 的概率完全躲避它们，持续 %d 回合。
		受意志影响，持续时间有额外加成；受灵巧和敏捷影响，闪避率有额外加成。]]):format(5 * self:getTalentLevel(t) + self:getCun(25, true) + self:getDex(25, true), 5 + self:getWil(10))
	end,
}
