-- 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 = "Juggernaut",
	display_name = "战场主宰",
	type = {"technique/superiority", 1},
	require = techs_req_high1,
	points = 5,
	random_ego = "attack",
	cooldown = 40,
	stamina = 60,
	tactical = { DEFEND = 2 },
	action = function(self, t)
		self:setEffect(self.EFF_EARTHEN_BARRIER, 20, {power=self:getTalentLevelRaw(t) * 5})
		return true
	end,
	info = function(self, t)
		return ([[专注于战斗并忽略你所承受的攻击。减少 %d%% 回合。]]):format(self:getTalentLevelRaw(t) * 5)
	end,
}

newTalent{
	name = "Onslaught",
	display_name = "猛攻",
	type = {"technique/superiority", 2},
	require = techs_req_high2,
	points = 5,
	mode = "sustained",
	cooldown = 60,
	sustain_stamina = 80,
	tactical = { BUFF = 2 },
	activate = function(self, t)
		return {
			onslaught = self:addTemporaryValue("onslaught", math.floor(self:getTalentLevel(t))),
			stamina = self:addTemporaryValue("stamina_regen", -15),
		}
	end,

	deactivate = function(self, t, p)
		self:removeTemporaryValue("onslaught", p.onslaught)
		self:removeTemporaryValue("stamina_regen", p.stamina)
		return true
	end,
	info = function(self, t)
		return ([[采取一个猛攻姿态，当你经过你的敌人时，你会将前方弧形范围内的敌人都敲回去。(上限 %d 格)。
		这个姿态会快速减少体力值(-15 体力/回合)。]]):
		format(math.floor(self:getTalentLevel(t)))
	end,
}

newTalent{
	name = "Battle Call",
	display_name = "挑衅",
	type = {"technique/superiority", 3},
	require = techs_req_high3,
	points = 5,
	random_ego = "attack",
	cooldown = 10,
	stamina = 30,
	tactical = { CLOSEIN = 2 },
	range = 0,
	radius = function(self, t)
		return 2 + self:getTalentLevel(t)
	end,
	target = function(self, t)
		return {type="ball", range=self:getTalentRange(t), friendlyfire=false, radius=self:getTalentRadius(t), talent=t}
	end,
	action = function(self, t)
		local tg = self:getTalentTarget(t)
		self:project(tg, self.x, self.y, function(px, py)
			local target = game.level.map(px, py, Map.ACTOR)
			if not target then return end
			local tx, ty = util.findFreeGrid(self.x, self.y, 5, true, {[Map.ACTOR]=true})
			if tx and ty and target:canBe("teleport") then
				target:move(tx, ty, true)
				game.logSeen(target, "%s is called to battle!", target.name:capitalize())
			end
		end)
		return true
	end,
	info = function(self, t)
		return ([[挑衅你周围 %d 格半径范围内的敌人进入战斗，使他们立刻进入近战。]]):format(2+self:getTalentLevel(t))
	end,
}

newTalent{
	name = "Shattering Impact",
	display_name = "震荡攻击",
	type = {"technique/superiority", 4},
	require = techs_req_high4,
	points = 5,
	mode = "sustained",
	cooldown = 30,
	sustain_stamina = 40,
	tactical = { BUFF = 2 },
	activate = function(self, t)
		return {
			dam = self:addTemporaryValue("shattering_impact", self:combatTalentWeaponDamage(t, 0.2, 0.6)),
		}
	end,
	deactivate = function(self, t, p)
		self:removeTemporaryValue("shattering_impact", p.dam)
		return true
	end,
	info = function(self, t)
		return ([[用尽全身的力量挥舞武器，攻击你周围的所有敌人，对每个敌人造成 %d%% 基础武器伤害。
		每次打击消耗15点体力。]]):
		format(100 * self:combatTalentWeaponDamage(t, 0.2, 0.6))
	end,
}
