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

-- Empty Hand adds extra scaling to gauntlet and glove attacks based on character level.

newTalent{
	name = "Empty Hand",
	display_name = "空手道",
	type = {"technique/unarmed-other", 1},
	innate = true,
	hide = true,
	mode = "passive",
	points = 1,
	no_unlearn_last = true,
	getDamage = function(self, t) return self.level * 0.5 end,
	on_learn = function(self, t)
		self.combat.sound = "actions/melee"
		self.combat.sound_miss = "actions/melee_miss"
	end,
	on_unlearn = function(self, t)
	end,
	info = function(self, t)
		local damage = t.getDamage(self, t)
		return ([[当你仅装备普通手套和铁手套时提高 %d 物理强度。
		受你的等级提高影响。]]):
		format(damage)
	end,
}

-- generic unarmed training
newTalent{
	name = "Unarmed Mastery",
	display_name = "徒手大师",
	type = {"technique/unarmed-training", 1},
	points = 10,
	require = { stat = { cun=function(level) return 12 + level * 3 end }, },
	mode = "passive",
	getDamage = function(self, t) return self:getTalentLevel(t) * 5 end,
	getPercentInc = function(self, t) return math.sqrt(self:getTalentLevel(t) / 10) / 2 end,
	info = function(self, t)
		local damage = t.getDamage(self, t)
		local inc = t.getPercentInc(self, t)
		return ([[增加 %d%% 所有徒手伤害(包括抓取技和徒手技)，同时提高 %d 物理强度。
		注意：武僧随等级每级增加0.5物理强度。(当前提高 %0.1f 物理强度)]]):
		format(100*inc, damage, self.level * 0.5)
	end,
}

newTalent{
	name = "Steady Mind",
	display_name = "冷静思维",
	type = {"technique/unarmed-training", 2},
	mode = "passive",
	points = 5,
	require = techs_cun_req2,
	getDefense = function(self, t) return self:combatTalentStatDamage(t, "cun", 5, 35) end,
	getMental = function(self, t) return self:combatTalentStatDamage(t, "cun", 5, 35) end,
	info = function(self, t)
		local defense = t.getDefense(self, t)
		local saves = t.getMental(self, t)
		return ([[大量的训练使你能保持清醒的头脑，增加 %d 防御和 %d 精神抗性。
		受敏捷影响，防御按比例加成；受灵巧影响，精神抗性按比例加成。]]):
		format(defense, saves)
	end,
}

newTalent{
	name = "Heightened Reflexes",
	display_name = "高度反射",
	type = {"technique/unarmed-training", 3},
	require = techs_cun_req3,
	mode = "passive",
	points = 5,
	getPower = function(self, t) return self:getTalentLevel(t)/2 end,
	do_reflexes = function(self, t)
		self:setEffect(self.EFF_REFLEXIVE_DODGING, 1, {power=t.getPower(self, t)})
	end,
	info = function(self, t)
		local power = t.getPower(self, t)
		return ([[当你被抛射物锁定时，增加你 %d%% 整体速度1回合。任何动作如移动均会打破此效果。]]):
		format(power * 100)
	end,
}

newTalent{
	name = "Combo String",
	display_name = "强化连击",
	type = {"technique/unarmed-training", 4},
	require = techs_cun_req4,
	mode = "passive",
	points = 5,
	getDuration = function(self, t) return math.ceil(self:getTalentLevel(t)/2) end,
	getChance = function(self, t) return self:getTalentLevel(t) * (5 + self:getCun(5, true)) end,
	info = function(self, t)
		local duration = t.getDuration(self, t)
		local chance = t.getChance(self, t)
		return ([[当获得1个连击点时有 %d%% 概率额外获得1个连击点。此外你的连击点持续时间会延长 %d 回合。
		受你灵巧影响，额外连击点获得概率有加成。]]):
		format(chance, duration)
	end,
}
