-- 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 = "Curse of Defenselessness",
	display_name = "衰竭诅咒",
	type = {"corruption/curses", 1},
	require = corrs_req1,
	points = 5,
	cooldown = 20,
	vim = 20,
	range = 10,
	tactical = { DISABLE = 2 },
	direct_hit = true,
	requires_target = true,
	action = function(self, t)
		local tg = {type="hit", range=self:getTalentRange(t), talent=t}
		local x, y = self:getTarget(tg)
		if not x or not y then return nil end
		self:project(tg, x, y, function(tx, ty)
			local target = game.level.map(tx, ty, Map.ACTOR)
			if not target then return end
			target:setEffect(target.EFF_CURSE_DEFENSELESSNESS, 10, {power=self:combatTalentSpellDamage(t, 30, 60), apply_power=self:combatSpellpower()})
		end)
		game:playSoundNear(self, "talents/slime")
		return true
	end,
	info = function(self, t)
		return ([[诅咒目标，减少它 %d 点闪避和抵抗，持续10回合。
		受魔法影响，闪避和抵抗值有额外减少。]]):format(self:combatTalentSpellDamage(t, 30, 60))
	end,
}

newTalent{
	name = "Curse of Impotence",
	display_name = "虚弱诅咒",
	type = {"corruption/curses", 2},
	require = corrs_req2,
	points = 5,
	cooldown = 20,
	vim = 20,
	range = 10,
	tactical = { DISABLE = 2 },
	direct_hit = true,
	requires_target = true,
	action = function(self, t)
		local tg = {type="hit", range=self:getTalentRange(t), talent=t}
		local x, y = self:getTarget(tg)
		if not x or not y then return nil end
		self:project(tg, x, y, function(tx, ty)
			local target = game.level.map(tx, ty, Map.ACTOR)
			if not target then return end
			target:setEffect(target.EFF_CURSE_IMPOTENCE, 10, {power=self:combatTalentSpellDamage(t, 10, 30), apply_power=self:combatSpellpower()})
		end)
		game:playSoundNear(self, "talents/slime")
		return true
	end,
	info = function(self, t)
		return ([[诅咒目标，减少它 %d%%所有伤害，持续10回合。
		受魔法影响，伤害值有额外减少。]]):format(self:combatTalentSpellDamage(t, 10, 30))
	end,
}

newTalent{
	name = "Curse of Death",
	display_name = "死亡诅咒",
	type = {"corruption/curses", 3},
	require = corrs_req3,
	points = 5,
	cooldown = 20,
	vim = 20,
	range = 10,
	tactical = { ATTACK = {DARKNESS = 2}, DISABLE = 1 },
	direct_hit = true,
	requires_target = true,
	action = function(self, t)
		local tg = {type="hit", range=self:getTalentRange(t), talent=t}
		local x, y = self:getTarget(tg)
		if not x or not y then return nil end
		self:project(tg, x, y, function(tx, ty)
			local target = game.level.map(tx, ty, Map.ACTOR)
			if not target then return end
			target:setEffect(target.EFF_CURSE_DEATH, 10, {src=self, dam=self:combatTalentSpellDamage(t, 10, 70), apply_power=self:combatSpellpower()})
		end)
		game:playSoundNear(self, "talents/slime")
		return true
	end,
	info = function(self, t)
		return ([[诅咒目标，中断任何自然治疗。每回合造成 %0.2f 暗影伤害，持续10回合。
		受魔法影响，伤害有额外加成。]]):format(damDesc(self, DamageType.BLIGHT, self:combatTalentSpellDamage(t, 10, 70)))
	end,
}

newTalent{
	name = "Curse of Vulnerability",
	display_name = "弱点诅咒",
	type = {"corruption/curses", 4},
	require = corrs_req4,
	points = 5,
	cooldown = 20,
	vim = 20,
	range = 10,
	tactical = { DISABLE = 2 },
	requires_target = true,
	direct_hit = true,
	action = function(self, t)
		local tg = {type="hit", range=self:getTalentRange(t), talent=t}
		local x, y = self:getTarget(tg)
		if not x or not y then return nil end
		self:project(tg, x, y, function(tx, ty)
			local target = game.level.map(tx, ty, Map.ACTOR)
			if not target then return end
			target:setEffect(target.EFF_CURSE_VULNERABILITY, 7, {power=self:combatTalentSpellDamage(t, 10, 40), apply_power=self:combatSpellpower()})
		end)
		game:playSoundNear(self, "talents/slime")
		return true
	end,
	info = function(self, t)
		return ([[诅咒目标，减少其 %d%% 所有抵抗，持续7回合。
		受魔法影响，抵抗值有额外减少。]]):format(self:combatTalentSpellDamage(t, 10, 40))
	end,
}
