From 950b5096432d5c7c78d06ba8f868cc8973020121 Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Thu, 26 Sep 2013 12:29:05 +0200
Subject: [PATCH] Alchemists can now unlock a golem replacement: the Drolem !

---
 game/modules/tome/data/birth/classes/mage.lua |  5 ++++
 game/modules/tome/data/quests/east-portal.lua |  4 +++
 .../tome/data/talents/spells/golem.lua        | 30 +++++++++++++++++++
 .../tome/data/talents/spells/golemancy.lua    |  7 +++++
 .../tome/data/talents/spells/spells.lua       |  1 +
 ...unlock-cosmetic_class_alchemist_drolem.lua | 28 +++++++++++++++++
 6 files changed, 75 insertions(+)
 create mode 100644 game/modules/tome/data/texts/unlock-cosmetic_class_alchemist_drolem.lua

diff --git a/game/modules/tome/data/birth/classes/mage.lua b/game/modules/tome/data/birth/classes/mage.lua
index 98c265451c..61d26cb01a 100644
--- a/game/modules/tome/data/birth/classes/mage.lua
+++ b/game/modules/tome/data/birth/classes/mage.lua
@@ -105,6 +105,11 @@ newBirthDescriptor{
 	copy_add = {
 		life_rating = -1,
 	},
+	cosmetic_unlock = {
+		cosmetic_class_alchemist_drolem = {
+			{name="Golem becomes a Drolem [donator only]", on_actor=function(actor) actor.alchemist_golem_is_drolem = true end},
+		},
+	},
 }
 
 newBirthDescriptor{
diff --git a/game/modules/tome/data/quests/east-portal.lua b/game/modules/tome/data/quests/east-portal.lua
index 2cf731c195..95402848fb 100644
--- a/game/modules/tome/data/quests/east-portal.lua
+++ b/game/modules/tome/data/quests/east-portal.lua
@@ -60,6 +60,10 @@ on_status_change = function(self, who, status, sub)
 	if sub then
 		if self:isCompleted("orb-back") and self:isCompleted("diamon-back") and self:isCompleted("athame-back") then
 			self:tannen_exit(who)
+
+			if game:getPlayer(true).alchemist_golem then
+				game:setAllowedBuild("cosmetic_class_alchemist_drolem", true)
+			end
 		end
 	end
 end
diff --git a/game/modules/tome/data/talents/spells/golem.lua b/game/modules/tome/data/talents/spells/golem.lua
index dd3934b5d9..ebaae66b61 100644
--- a/game/modules/tome/data/talents/spells/golem.lua
+++ b/game/modules/tome/data/talents/spells/golem.lua
@@ -525,3 +525,33 @@ newTalent{
 		format(dir, armor, hardiness, critreduce)
 	end,
 }
+
+newTalent{
+	name = "Poison Breath", short_name = "DROLEM_POISON_BREATH", image = "talents/poison_breath.png",
+	type = {"golem/drolem",1},
+	require = spells_req_high1,
+	points = 5,
+	mana = 25,
+	cooldown = 8,
+	message = "@Source@ breathes poison!",
+	tactical = { ATTACKAREA = { NATURE = 1, poison = 1 } },
+	range = 0,
+	radius = 5,
+	requires_target = true,
+	target = function(self, t)
+		return {type="cone", range=self:getTalentRange(t), radius=self:getTalentRadius(t), talent=t}
+	end,
+	action = function(self, t)
+		local tg = self:getTalentTarget(t)
+		local x, y = self:getTarget(tg)
+		if not x or not y then return nil end
+		self:project(tg, x, y, DamageType.POISON, {dam=self:mindCrit(self:combatTalentStatDamage(t, "mag", 30, 460)), apply_power=self:combatMindpower()})
+		game.level.map:particleEmitter(self.x, self.y, tg.radius, "breath_slime", {radius=tg.radius, tx=x-self.x, ty=y-self.y})
+		game:playSoundNear(self, "talents/breath")
+		return true
+	end,
+	info = function(self, t)
+		return ([[Breathe poison on your foes, doing %d damage over a few turns.
+		The damage will increase with your Magic.]]):format(damDesc(self, DamageType.NATURE, self:combatTalentStatDamage(t, "mag", 30, 460)))
+	end,
+}
diff --git a/game/modules/tome/data/talents/spells/golemancy.lua b/game/modules/tome/data/talents/spells/golemancy.lua
index 099ff415f8..9a6b02f935 100644
--- a/game/modules/tome/data/talents/spells/golemancy.lua
+++ b/game/modules/tome/data/talents/spells/golemancy.lua
@@ -135,6 +135,13 @@ local function makeGolem(self)
 		can_change_level = true,
 	}
 
+	if self.alchemist_golem_is_drolem then
+		g.image="invis.png"
+		g.add_mos = {{image="npc/construct_golem_drolem.png", display_h=2, display_y=-1}}
+		g.moddable_tile = nil
+		g:learnTalentType("golem/drolem", true)
+	end
+
 	if self.no_points_on_levelup then
 		g.max_level = nil
 		g.no_points_on_levelup = self.no_points_on_levelup
diff --git a/game/modules/tome/data/talents/spells/spells.lua b/game/modules/tome/data/talents/spells/spells.lua
index bcda495d84..3d66bc7ac0 100644
--- a/game/modules/tome/data/talents/spells/spells.lua
+++ b/game/modules/tome/data/talents/spells/spells.lua
@@ -53,6 +53,7 @@ newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/st
 newTalentType{ type="golem/fighting", name = "fighting", description = "Golem melee capacity." }
 newTalentType{ type="golem/arcane", no_silence=true, is_spell=true, name = "arcane", description = "Golem arcane capacity." }
 newTalentType{ type="golem/golem", name = "golem", description = "Golem basic capacity." }
+newTalentType{ type="golem/drolem", name = "drolem", description = "Drolem basic capacity." }
 
 -- Necromancer spells
 newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/necrotic-minions", name = "necrotic minions", description = "Create and empower dumb undead minions." }
diff --git a/game/modules/tome/data/texts/unlock-cosmetic_class_alchemist_drolem.lua b/game/modules/tome/data/texts/unlock-cosmetic_class_alchemist_drolem.lua
new file mode 100644
index 0000000000..be7c508ab3
--- /dev/null
+++ b/game/modules/tome/data/texts/unlock-cosmetic_class_alchemist_drolem.lua
@@ -0,0 +1,28 @@
+-- ToME - Tales of Maj'Eyal
+-- Copyright (C) 2009, 2010, 2011, 2012, 2013 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
+
+return "New Class Option: #LIGHT_GREEN#Drolem",
+[[You have defeated Tannen with your Alchemist and took soem time to figure how he built a mighty Drolem.
+Drolems are dragon-shaped golems able to breath powerful poison at their foes.
+
+You may now create alchemist characters with a drolem instead of a golem.
+Drolems look awesome and can eventualy learn to breath poison.
+
+#LIGHT_GREEN#This is only available to donators. Thanks for your support!
+]]
-- 
GitLab