-- 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 = "Bloodbath",
	display_name= "浴血",
	type = {"technique/bloodthirst", 1},
	require = techs_req_high1,
	points = 5,
	mode = "passive",
	do_bloodbath = function(self, t)
		self:setEffect(self.EFF_BLOODBATH, 5 + self:getTalentLevelRaw(t), {regen=math.floor(self:getTalentLevel(t) * 40), hp=math.floor(self:getTalentLevel(t) * 2)})
	end,
	info = function(self, t)
		return ([[沐浴着敌人的鲜血令你感到兴奋。在成功打出一次暴击后，会增加你 %d%% 的生命和活力回复速度，并增加你 %d%% 生命最大值，持续5回合，不可叠加。]]):
		format(math.floor(self:getTalentLevel(t) * 40), math.floor(self:getTalentLevel(t) * 2))
	end,
}

newTalent{
	name = "Mortal Terror",
	display_name = "致命恐惧",
	type = {"technique/bloodthirst", 2},
	require = techs_req_high2,
	points = 5,
	mode = "passive",
	do_terror = function(self, t, target, dam)
		if dam < target.max_life * (20 + (30 - self:getTalentLevelRaw(t) * 5)) / 100 then return end

		local weapon = target:getInven("MAINHAND")
		if type(weapon) == "boolean" then weapon = nil end
		if weapon then weapon = weapon[1] and weapon[1].combat end
		if not weapon or type(weapon) ~= "table" then weapon = nil end
		weapon = weapon or target.combat

		if target:canBe("stun") then
			target:setEffect(target.EFF_DAZED, 5, {apply_power=self:combatPhysicalpower()})
		else
			game.logSeen(target, "%s resists the terror!", target.name:capitalize())
		end
	end,
	on_learn = function(self, t)
		self.combat_physcrit = self.combat_physcrit + 2.8
	end,
	on_unlearn = function(self, t)
		self.combat_physcrit = self.combat_physcrit - 2.8
	end,
	info = function(self, t)
		return ([[你强力的攻击引发敌人深深的恐惧。任何你对目标造成的超过其 %d%% 总生命值的近身打击会使目标陷入深深的恐惧中，眩晕目标5回合。
		你的暴击率同时增加 %d%%。
		受你力量影响，眩晕概率有额外加成。]]):
		format(20 + (30 - self:getTalentLevelRaw(t) * 5), self:getTalentLevelRaw(t) * 2.8)
	end,
}

newTalent{
	name = "Bloodrage",
	display_name = "血怒",
	type = {"technique/bloodthirst", 3},
	require = techs_req_high3,
	points = 5,
	mode = "passive",
	on_kill = function(self, t)
		self:setEffect(self.EFF_BLOODRAGE, 5, {max=math.floor(self:getTalentLevel(t) * 6), inc=2})
	end,
	info = function(self, t)
		return ([[每当你击倒一个敌人，你会感受到一股汹涌的能量，增加你2点力量，上限 %d。]]):
		format(math.floor(self:getTalentLevel(t) * 6))
	end,
}

newTalent{
	name = "Unstoppable",
	display_name = "天下无双",
	type = {"technique/bloodthirst", 4},
	require = techs_req_high4,
	points = 5,
	cooldown = 45,
	stamina = 120,
	tactical = { DEFEND = 5, CLOSEIN = 2 },
	action = function(self, t)
		self:setEffect(self.EFF_UNSTOPPABLE, 2 + self:getTalentLevelRaw(t), {hp_per_kill=math.floor(self:getTalentLevel(t) * 3.5)})
		return true
	end,
	info = function(self, t)
		return ([[你进入疯狂战斗状态 %d 回合。在这段时间内你不能使用物品，并且治疗无效，此时你的生命值无法低于1点。
		状态结束你没杀死的一个敌人可以给你回复 %d%% 最大生命值。]]):
		format(2 + self:getTalentLevelRaw(t), math.floor(self:getTalentLevel(t) * 3.5))
	end,
}
