-- 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
load("/data/general/objects/scrolls.lua")
load("/data/general/objects/gem.lua")

local Stats = require "engine.interface.ActorStats"
local Talents = require "engine.interface.ActorTalents"

-- This file describes the twelve elixirs and three artifacts obtainable through the Brotherhood of Alchemists quest

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_FOX",
	type = "potion", subtype="potion", image = "object/elixir_of_the_fox.png",
	name = "狡诈药剂", unique=true, unided_name="一瓶粉红色的液体",
	display = "!", color=colors.VIOLET,
	desc = [[一瓶粉红色的透明液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="永久提升3点敏捷和灵巧", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.inc_stats[who.STAT_DEX] = who.inc_stats[who.STAT_DEX] + 3
		who:onStatChange(who.STAT_DEX, 3)
		who.inc_stats[who.STAT_CUN] = who.inc_stats[who.STAT_CUN] + 3
		who:onStatChange(who.STAT_CUN, 3)
		game.logPlayer(who, "#00FF00#此药剂使你的手脚灵活、思维清晰！")
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_AVOIDANCE",
	type = "potion", subtype="potion", image = "object/elixir_of_avoidance.png",
	name = "闪避药剂", unique=true, unided_name="一瓶绿色的液体",
	display = "!", color=colors.GREEN,
	desc = [[一瓶浑浊的绿色液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="永久提升6点闪避和远程闪避", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.combat_def = who.combat_def + 6
		game.logPlayer(who, "#00FF00#此药剂提高了你的闪避本能！")
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_PRECISION",
	type = "potion", subtype="potion", image = "object/elixir_of_precision.png",
	name = "精准药剂", unique=true, unided_name="一瓶红色的液体",
	display = "!", color=colors.RED,
	desc = [[一瓶粘稠的红色液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="永久提升4%物理暴击率", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.combat_physcrit = who.combat_physcrit + 4
		game.logPlayer(who, "#00FF00#此药剂提高了你发现敌方弱点的几率！")
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_MYSTICISM",
	type = "potion", subtype="potion", image = "object/elixir_of_mysticism.png",
	name = "神秘药剂", unique=true, unided_name="一瓶青色的液体",
	display = "!", color=colors.AQUAMARINE,
	desc = [[一瓶炽热的青色液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="永久提升3点魔法和意志", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.inc_stats[who.STAT_MAG] = who.inc_stats[who.STAT_MAG] + 3
		who:onStatChange(who.STAT_MAG, 3)
		who.inc_stats[who.STAT_WIL] = who.inc_stats[who.STAT_WIL] + 3
		who:onStatChange(who.STAT_WIL, 3)
		game.logPlayer(who, "#00FF00#此药剂提高了你的魔法和意志！")
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_SAVIOR",
	type = "potion", subtype="potion", image = "object/elixir_of_the_saviour.png",
	name = "守护药剂", unique=true, unided_name="一瓶灰色的液体",
	display = "!", color=colors.GREY,
	desc = [[一瓶翻滚着泡沫的灰色液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="永久提升4点所有抵抗", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.combat_physresist = who.combat_physresist + 4
		who.combat_spellresist = who.combat_spellresist + 4
		who.combat_mentalresist = who.combat_mentalresist + 4
		game.logPlayer(who, "#00FF00#此药剂提高了你对负面状态的抵抗！")
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_MASTERY",
	type = "potion", subtype="potion", image = "object/elixir_of_mastery.png",
	name = "掌握药剂", unique=true, unided_name="一瓶栗色的液体",
	display = "!", color=colors.DARK_RED,
	desc = [[一瓶浓郁的栗色液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="增加额外4点属性点", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.unused_stats = who.unused_stats + 4
		game.logPlayer(who, "#00FF00#此药剂提高了你对身体的掌控！")
		game.logPlayer(who, "你还有 %d 属性点. 按G来使用它们。", who.unused_stats)
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_FORCE",
	type = "potion", subtype="potion", image = "object/elixir_of_explosive_force.png",
	name = "爆炸药剂", unique=true, unided_name="一瓶橙色的液体",
	display = "!", color=colors.ORANGE,
	desc = [[一瓶浑浊的橙色液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="永久提升4%法术暴击率", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.combat_spellcrit = who.combat_spellcrit + 4
		game.logPlayer(who, "#00FF00#此药剂提高了你发现敌方法术弱点的几率！")
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_SERENDIPITY",
	type = "potion", subtype="potion", image = "object/elixir_of_serendipity.png",
	name = "幸运药剂", unique=true, unided_name="一瓶黄色的液体",
	display = "!", color=colors.YELLOW,
	desc = [[一瓶流动的黄色液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="永久提升5点幸运", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.inc_stats[who.STAT_LCK] = who.inc_stats[who.STAT_LCK] + 5
		who:onStatChange(who.STAT_LCK, 5)
		game.logPlayer(who, "#00FF00#此药剂似乎微妙的改变了你的命运！")
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_FOCUS",
	type = "potion", subtype="potion", image = "object/elixir_of_focus.png",
	name = "专注药剂", unique=true, unided_name="一瓶透明的液体",
	display = "!", color=colors.WHITE,
	desc = [[一瓶透明的沸腾液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="增加额外2点职业天赋点", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.unused_talents = who.unused_talents + 2
		game.logPlayer(who, "#00FF00#此药剂扩展了你的职业天赋！")
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_BRAWN",
	type = "potion", subtype="potion", image = "object/elixir_of_brawn.png",
	name = "蛮牛药剂", unique=true, unided_name="一瓶棕褐色的液体",
	display = "!", color=colors.TAN,
	desc = [[一瓶粘稠的棕褐色液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="永久提升3点力量和体质", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.inc_stats[who.STAT_STR] = who.inc_stats[who.STAT_STR] + 3
		who:onStatChange(who.STAT_STR, 3)
		who.inc_stats[who.STAT_CON] = who.inc_stats[who.STAT_CON] + 3
		who:onStatChange(who.STAT_CON, 3)
		game.logPlayer(who, "#00FF00#此药剂提高了你的力量和恢复力！")
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_STONESKIN",
	type = "potion", subtype="potion", image = "object/elixir_of_stoneskin.png",
	name = "石肤药剂", unique=true, unided_name="一瓶有金属光泽的液体 ",
	display = "!", color=colors.SLATE,
	desc = [[一瓶带有特殊纹理、泛着金属光泽的液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="永久提升4点护甲", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.combat_armor = who.combat_armor + 4
		game.logPlayer(who, "#00FF00#此药剂硬化了你的身体！")
		return {used=true, id=true, destroy=true}
	end}
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_FOUNDATIONS",
	type = "potion", subtype="potion", image = "object/elixir_of_foundations.png",
	name = "领悟药剂", unique=true, unided_name="一瓶白色的液体",
	display = "!", color=colors.WHITE,
	desc = [[一瓶朦胧的白色液体。]],
	no_unique_lore = true,
	cost = 1000,

	use_simple = { name="增加额外2点通用天赋点", use = function(self, who)
		game.logPlayer(who, "#00FFFF#你喝下了药剂并感到了前所未有的变化！")
		who.unused_generics = who.unused_generics + 2
		game.logPlayer(who, "#00FF00#此药剂扩展了你的通用天赋！")
		return {used=true, id=true, destroy=true}
	end}
}

-- The four possible final rewards for the Brotherhood of Alchemists quest:

newEntity{ base = "BASE_TAINT",
	name = "纹身：堕落感应",
	define_as = "TAINT_TELEPATHY", image = "object/taint_of_telepathy.png",
	unique = true,
	identified = true,
	cost = 200,
	material_level = 3,

	inscription_kind = "utility",
	inscription_data = {
		cooldown = 30,
		dur = 5,
	},
	inscription_talent = "TAINT:_TELEPATHY",
}

newEntity{ base = "BASE_INFUSION",
	name = "纹身：根须缠绕",
	define_as = "INFUSION_WILD_GROWTH", image = "object/infusion_of_wild_growth.png",
	unique = true,
	identified = true,
	cost = 200,
	material_level = 3,

	inscription_kind = "utility",
	inscription_data = {
		cooldown = 30,
		dur = 5,
	},
	inscription_talent = "INFUSION:_WILD_GROWTH",
}

newEntity{ base = "BASE_GEM",
	define_as = "LIFEBINDING_EMERALD",
	power_source = {nature=true},
	unique = true,
	unided_name = "半透明的厚重翡翠",
	name = "生命之心", subtype = "green", image = "object/lifebinding_emerald.png",
	color = colors.GREEN,
	desc = [[一块不规则的厚重翡翠，表面有云纹浮动。]],
	cost = 200,
	material_level = 5,
	wielder = {
		inc_stats = {[Stats.STAT_CON] = 10, },
		healing_factor = 0.3,
		life_regen = 2,
		resists = {
			[DamageType.BLIGHT] = 10,
		},
	},
	imbue_powers = {
		inc_stats = {[Stats.STAT_CON] = 10, },
		healing_factor = 0.3,
		life_regen = 2,
		resists = {
			[DamageType.BLIGHT] = 10,
		},
	},
}

newEntity{
	power_source = {nature=true},
	define_as = "ELIXIR_INVULNERABILITY",
	encumber = 2,
	type = "potion", subtype="potion", image = "object/elixir_of_invulnerability.png",
	name = "无敌药剂", unique=true, unided_name="一瓶黑色的液体",
	display = "!", color=colors.SLATE,
	desc = [[一瓶粘稠的反射着金属光泽的液体。它有着难以置信的重量。]],
	cost = 200,

	use_simple = { name="你在5回合内处于无敌状态", use = function(self, who)
		who:setEffect(who.EFF_DAMAGE_SHIELD, 5, {power=1000000})
		game.logPlayer(who, "#00FF00#你刀枪不入！")
		return {used=true, id=true, destroy=true}
	end}
}
