From 388cfb7e6eaea0b384ec15e01a2c5ba2fe504882 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Tue, 29 Nov 2011 11:39:55 +0000
Subject: [PATCH] plop

git-svn-id: http://svn.net-core.org/repos/t-engine4@4703 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/engines/default/engine/Birther.lua       |  4 +-
 game/modules/tome/class/Actor.lua             |  6 +-
 .../tome/data/birth/classes/adventurer.lua    | 94 +++++++++++++++++++
 game/modules/tome/data/birth/descriptors.lua  |  1 +
 game/modules/tome/data/birth/worlds.lua       |  1 +
 .../tome/data/talents/spells/golemancy.lua    |  2 +
 .../tome/data/talents/spells/spells.lua       | 50 +++++-----
 game/modules/tome/dialogs/Birther.lua         |  4 +-
 8 files changed, 133 insertions(+), 29 deletions(-)
 create mode 100644 game/modules/tome/data/birth/classes/adventurer.lua

diff --git a/game/engines/default/engine/Birther.lua b/game/engines/default/engine/Birther.lua
index ef4aa993ae..9797371729 100644
--- a/game/engines/default/engine/Birther.lua
+++ b/game/engines/default/engine/Birther.lua
@@ -350,7 +350,9 @@ function _M:apply()
 			end
 		end
 		if d.talents_types then
-			for t, v in pairs(d.talents_types) do
+			local tt = d.talents_types
+			if type(tt) == "function" then tt = tt(self) end
+			for t, v in pairs(tt) do
 				local mastery
 				if type(v) == "table" then
 					v, mastery = v[1], v[2]
diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua
index 14a9083f66..7d528860b3 100644
--- a/game/modules/tome/class/Actor.lua
+++ b/game/modules/tome/class/Actor.lua
@@ -1288,7 +1288,7 @@ function _M:onTakeHit(value, src)
 		eff.hp = eff.hp - value * 0.4
 		value = value * 0.6
 		if eff.hp < 0 and not eff.begone then game:onTickEnd(function() self:removeEffect(self.EFF_FROZEN) end) end
-		eff.begone = true
+		eff.begone = game.turn
 	end
 
 	-- Adds hate
@@ -2185,6 +2185,10 @@ end
 --- Actor learns a resource pool
 -- @param talent a talent definition table
 function _M:learnPool(t)
+	local tt = self:getTalentTypeFrom(t.type[1])
+
+	if tt.mana_regen and self.mana_regen == 0 then self.mana_regen = 0.5 end
+
 	if t.type[1]:find("^spell/") and not self:knowTalent(self.T_MANA_POOL) and t.mana or t.sustain_mana then
 		self:learnTalent(self.T_MANA_POOL, true)
 		self.resource_pool_refs[self.T_MANA_POOL] = (self.resource_pool_refs[self.T_MANA_POOL] or 0) + 1
diff --git a/game/modules/tome/data/birth/classes/adventurer.lua b/game/modules/tome/data/birth/classes/adventurer.lua
new file mode 100644
index 0000000000..a64bb5fbca
--- /dev/null
+++ b/game/modules/tome/data/birth/classes/adventurer.lua
@@ -0,0 +1,94 @@
+-- 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
+
+newBirthDescriptor{
+	type = "class",
+	name = "Adventurer",
+	desc = {
+		"Adventurer can learn to do a bit of everything, getting training in whatever they happen to find.",
+		"#{bold}#This is a bonus class for winning the game, it is by no means balanced.#{normal}#",
+	},
+	descriptor_choices =
+	{
+		subclass =
+		{
+			__ALL__ = "disallow",
+			Adventurer = "allow",
+		},
+	},
+	copy = {
+		max_life = 100,
+	},
+}
+
+newBirthDescriptor{
+	type = "subclass",
+	name = "Adventurer",
+	desc = {
+		"Adventurer can learn to do a bit of everything, getting training in whatever they happen to find.",
+		"#{bold}#This is a bonus class for winning the game, it is by no means balanced.#{normal}#",
+		"Their most important stats depends on what they wish to do.",
+		"#GOLD#Stat modifiers:",
+		"#LIGHT_BLUE# * +2 Strength, +2 Dexterity, +2 Constitution",
+		"#LIGHT_BLUE# * +2 Magic, +2 Willpower, +2 Cunning",
+	},
+	stats = { str=2, con=2, dex=2, mag=2, wil=2, cun=2 },
+	talents_types = function(birth)
+		local tts = {}
+		for _, class in ipairs(birth.all_classes) do
+			for _, sclass in ipairs(class.nodes) do if sclass.id ~= "Adventurer" then
+				if birth.birth_descriptor_def.subclass[sclass.id].talents_types then
+					local tt = birth.birth_descriptor_def.subclass[sclass.id].talents_types
+					if type(tt) == "function" then tt = tt(birth) end
+
+					for t, _ in pairs(tt) do
+						tts[t] = {false, 0}
+					end
+				end
+
+				if birth.birth_descriptor_def.subclass[sclass.id].unlockable_talents_types then
+					local tt = birth.birth_descriptor_def.subclass[sclass.id].unlockable_talents_types
+					if type(tt) == "function" then tt = tt(birth) end
+
+					for t, v in pairs(tt) do
+						if profile.mod.allow_build[v[3]] then
+							tts[t] = {false, 0}
+						end
+					end
+				end
+			end end
+		end
+		return tts
+	end,
+	copy_add = {
+		unused_generics = 2,
+		unused_talent_points = 3,
+		unused_talents_types = 7,
+	},
+	copy = {
+		resolvers.inventory{ id=true,
+			{type="weapon", subtype="dagger", name="iron dagger", autoreq=true, ego_chance=-1000},
+			{type="weapon", subtype="dagger", name="iron dagger", autoreq=true, ego_chance=-1000},
+			{type="weapon", subtype="longsword", name="iron longsword", ego_chance=-1000, ego_chance=-1000},
+			{type="weapon", subtype="staff", name="elm staff", autoreq=true, ego_chance=-1000},
+			{type="armor", subtype="light", name="rough leather armour", ego_chance=-1000, ego_chance=-1000},
+			{type="armor", subtype="cloth", name="linen robe", autoreq=true, ego_chance=-1000},
+		},
+	},
+}
diff --git a/game/modules/tome/data/birth/descriptors.lua b/game/modules/tome/data/birth/descriptors.lua
index b3f5268c04..25d2389137 100644
--- a/game/modules/tome/data/birth/descriptors.lua
+++ b/game/modules/tome/data/birth/descriptors.lua
@@ -269,4 +269,5 @@ load("/data/birth/classes/corrupted.lua")
 load("/data/birth/classes/afflicted.lua")
 load("/data/birth/classes/chronomancer.lua")
 load("/data/birth/classes/psionic.lua")
+--load("/data/birth/classes/adventurer.lua")
 load("/data/birth/classes/none.lua")
diff --git a/game/modules/tome/data/birth/worlds.lua b/game/modules/tome/data/birth/worlds.lua
index 6fec99f9b0..225e8a8829 100644
--- a/game/modules/tome/data/birth/worlds.lua
+++ b/game/modules/tome/data/birth/worlds.lua
@@ -46,6 +46,7 @@ local default_eyal_descriptors = function(add)
 		Afflicted = "allow",
 		Chronomancer = "allow",
 		Psionic = "allow",
+--		Adventurer = "allow",
 	},
 	subclass =
 	{
diff --git a/game/modules/tome/data/talents/spells/golemancy.lua b/game/modules/tome/data/talents/spells/golemancy.lua
index bfb11f63cd..583c14d7c2 100644
--- a/game/modules/tome/data/talents/spells/golemancy.lua
+++ b/game/modules/tome/data/talents/spells/golemancy.lua
@@ -256,6 +256,7 @@ newTalent{
 		self.alchemy_golem:unlearnTalent(Talents.T_WEAPONS_MASTERY, true)
 	end,
 	info = function(self, t)
+		if not self.alchemy_golem then return "Improves your golem's proficiency with weapons, increasing its attack and damage." end
 		local rawlev = self:getTalentLevelRaw(t)
 		local olda, oldd = self.alchemy_golem.talents[Talents.T_WEAPON_COMBAT], self.alchemy_golem.talents[Talents.T_WEAPONS_MASTERY]
 		self.alchemy_golem.talents[Talents.T_WEAPON_COMBAT], self.alchemy_golem.talents[Talents.T_WEAPONS_MASTERY] = 2 + rawlev * 2, rawlev * 2
@@ -289,6 +290,7 @@ newTalent{
 		self.alchemy_golem.healing_factor = (self.alchemy_golem.healing_factor or 1) - 0.1
 	end,
 	info = function(self, t)
+		if not self.alchemy_golem then return "Improves your golem's armour training and damage resistance." end
 		local rawlev = self:getTalentLevelRaw(t)
 		local oldh, olda = self.alchemy_golem.talents[Talents.T_THICK_SKIN], self.alchemy_golem.talents[Talents.T_ARMOUR_TRAINING]
 		self.alchemy_golem.talents[Talents.T_THICK_SKIN], self.alchemy_golem.talents[Talents.T_ARMOUR_TRAINING] = rawlev * 2, 4 + rawlev * 2
diff --git a/game/modules/tome/data/talents/spells/spells.lua b/game/modules/tome/data/talents/spells/spells.lua
index c83ead7b00..9ddf1a81c0 100644
--- a/game/modules/tome/data/talents/spells/spells.lua
+++ b/game/modules/tome/data/talents/spells/spells.lua
@@ -18,34 +18,34 @@
 -- darkgod@te4.org
 
 -- Archmage spells
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/arcane", name = "arcane", description = "Arcane manipulates the raw magic energies to shape them into both offensive and defensive spells." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/arcane", name = "arcane", description = "Arcane manipulates the raw magic energies to shape them into both offensive and defensive spells." }
 
 -- Elemental spells
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/fire", name = "fire", description = "Harness the power of fire to burn your foes to ashes." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/wildfire", name = "wildfire", min_lev = 10, description = "Harness the power of wildfire to burn your foes to ashes." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/earth", name = "earth", description = "Harness the power of the earth to protect and destroy." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/stone", name = "stone", min_lev = 10, description = "Harness the power of the stone to protect and destroy." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/water", name = "water", description = "Harness the power of water to drown your foes." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/ice", name = "ice", min_lev = 10, description = "Harness the power of ice to freeze and shatter your foes." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/air", name = "air", description = "Harness the power of the air to fry your foes." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/storm", name = "storm", min_lev = 10, description = "Harness the power of the storm to incinerate your foes." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/fire", name = "fire", description = "Harness the power of fire to burn your foes to ashes." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/wildfire", name = "wildfire", min_lev = 10, description = "Harness the power of wildfire to burn your foes to ashes." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/earth", name = "earth", description = "Harness the power of the earth to protect and destroy." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/stone", name = "stone", min_lev = 10, description = "Harness the power of the stone to protect and destroy." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/water", name = "water", description = "Harness the power of water to drown your foes." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/ice", name = "ice", min_lev = 10, description = "Harness the power of ice to freeze and shatter your foes." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/air", name = "air", description = "Harness the power of the air to fry your foes." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/storm", name = "storm", min_lev = 10, description = "Harness the power of the storm to incinerate your foes." }
 
 -- Various other magic schools
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/meta", name = "meta", description = "Meta spells alter the working of magic itself." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/temporal", name = "temporal", description = "The school of time manipulation." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/phantasm", name = "phantasm", description = "Control the power of tricks and illusions." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/enhancement", name = "enhancement", description = "Magical enhancement of your body." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/meta", name = "meta", description = "Meta spells alter the working of magic itself." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/temporal", name = "temporal", description = "The school of time manipulation." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/phantasm", name = "phantasm", description = "Control the power of tricks and illusions." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/enhancement", name = "enhancement", description = "Magical enhancement of your body." }
 newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/conveyance", name = "conveyance", generic = true, description = "Conveyance is the school of travel. It allows you to travel faster and to track others." }
 newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/divination", name = "divination", generic = true, description = "Divination allows the caster to sense its surroundings, find hidden things." }
 newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/aegis", name = "aegis", generic = true, description = "Command the arcane forces into healing and protection." }
 
 -- Alchemist spells
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/explosives", name = "explosive admixtures", description = "Manipulate gems to turn them into explosive magical bombs." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/infusion", name = "infusion", description = "Infusion your gem bombs with the powers of the elements." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/golemancy-base", name = "golemancy", hide = true, description = "Learn to craft and upgrade your golem." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/golemancy", name = "golemancy", description = "Learn to craft and upgrade your golem." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/advanced-golemancy", name = "advanced-golemancy", min_lev = 10, description = "Advanced golem operations." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/fire-alchemy", name = "fire alchemy", description = "Alchemical control over fire." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/explosives", name = "explosive admixtures", description = "Manipulate gems to turn them into explosive magical bombs." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/infusion", name = "infusion", description = "Infusion your gem bombs with the powers of the elements." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/golemancy-base", name = "golemancy", hide = true, description = "Learn to craft and upgrade your golem." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/golemancy", name = "golemancy", description = "Learn to craft and upgrade your golem." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/advanced-golemancy", name = "advanced-golemancy", min_lev = 10, description = "Advanced golem operations." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/fire-alchemy", name = "fire alchemy", description = "Alchemical control over fire." }
 newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/stone-alchemy-base", name = "stone alchemy", hide = true, description = "Manipulate gems, imbue their powers into other objects." }
 newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/stone-alchemy", name = "stone alchemy", generic = true, description = "Alchemical control over stone and gems." }
 newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/staff-combat", name = "staff combat", generic = true, description = "Harness the power of magical staves." }
@@ -54,12 +54,12 @@ newTalentType{ type="golem/arcane", name = "arcane", description = "Golem arcane
 newTalentType{ type="golem/golem", name = "golem", description = "Golem basic capacity." }
 
 -- Necromancer spells
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/necrotic-minions", name = "necrotic minions", description = "Create and empower dumb undead minions." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/advanced-necrotic-minions", name = "advanced necrotic minions", min_lev = 10, description = "Create and empower powerful undead minions." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/nightfall", name = "nightfall", description = "Manipulate darkness itself to slaughter your foes." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/shades", name = "shades", min_lev = 10, description = "Invoke and control shades." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/necrosis", name = "necrosis", description = "Gain control over death, eventually turning into a lich." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/grave", name = "grave", description = "Use the rotting cold doom of the tomb to fell your foes." }
+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." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/advanced-necrotic-minions", name = "advanced necrotic minions", min_lev = 10, description = "Create and empower powerful undead minions." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/nightfall", name = "nightfall", description = "Manipulate darkness itself to slaughter your foes." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/shades", name = "shades", min_lev = 10, description = "Invoke and control shades." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/necrosis", name = "necrosis", description = "Gain control over death, eventually turning into a lich." }
+newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/grave", name = "grave", description = "Use the rotting cold doom of the tomb to fell your foes." }
 
 -- Stone Warden spells
 newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/arcane-shield", name = "arcane shield", description = "Infuse arcane forces in your shield." }
diff --git a/game/modules/tome/dialogs/Birther.lua b/game/modules/tome/dialogs/Birther.lua
index 34e0ef94e3..67f5bc16d6 100644
--- a/game/modules/tome/dialogs/Birther.lua
+++ b/game/modules/tome/dialogs/Birther.lua
@@ -280,8 +280,8 @@ function _M:makeDefault()
 	self:setDescriptor("permadeath", "Adventure")
 	self:setDescriptor("race", "Human")
 	self:setDescriptor("subrace", "Higher")
-	self:setDescriptor("class", "Warrior")
-	self:setDescriptor("subclass", "Berserker")
+	self:setDescriptor("class", "Adventurer")
+	self:setDescriptor("subclass", "Adventurer")
 	__module_extra_info.no_birth_popup = true
 	self:atEnd("created")
 end
-- 
GitLab