From 45097e1f1bd5b38099a75f91dd3e34ef1cc3a96e Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Sat, 21 Dec 2019 02:09:20 +0100
Subject: [PATCH] nevermind

---
 game/modules/tome/class/Actor.lua                |  6 ++++++
 game/modules/tome/data/birth/races/undead.lua    |  2 +-
 game/modules/tome/data/talents.lua               |  6 ++++++
 game/modules/tome/data/talents/spells/spells.lua | 14 +++++++-------
 game/modules/tome/dialogs/UberTalent.lua         | 14 ++++++++++++--
 5 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua
index 761e670c2c..cc2658648e 100644
--- a/game/modules/tome/class/Actor.lua
+++ b/game/modules/tome/class/Actor.lua
@@ -361,6 +361,12 @@ end
 function _M:runStop() end
 function _M:restStop() end
 
+function _M:hasDescriptor(kind, value)
+	if not self.descriptor then return false end
+	if self.descriptor[kind] ~= value then return false end
+	return true
+end
+
 function _M:getSpeed(speed_type)
 	if type(speed_type) == "number" then return speed_type end
 
diff --git a/game/modules/tome/data/birth/races/undead.lua b/game/modules/tome/data/birth/races/undead.lua
index 2c48153aaf..f3590d953b 100644
--- a/game/modules/tome/data/birth/races/undead.lua
+++ b/game/modules/tome/data/birth/races/undead.lua
@@ -59,7 +59,7 @@ newBirthDescriptor{
 		starting_zone = "blighted-ruins",
 		starting_level = 3, starting_level_force_down = true,
 		starting_quest = "start-undead",
-		undead = 1,
+		undead = 1, true_undead = 1,
 		forbid_nature = 1,
 		inscription_forbids = { ["inscriptions/infusions"] = true },
 		resolvers.inscription("RUNE:_SHIELDING", {cooldown=14, dur=5, power=130}, 1),
diff --git a/game/modules/tome/data/talents.lua b/game/modules/tome/data/talents.lua
index 70fdf5e6e4..f15d93c5cd 100644
--- a/game/modules/tome/data/talents.lua
+++ b/game/modules/tome/data/talents.lua
@@ -49,6 +49,7 @@ Talents.newTalent = function(self, t)
 	if tt.is_nature then t.is_nature = true end
 	if tt.is_antimagic then t.is_antimagic = true end
 	if tt.is_unarmed then t.is_unarmed = true end
+	if tt.is_necromancy then t.is_necromancy = true end
 	if tt.autolearn_mindslayer then t.autolearn_mindslayer = true end
 	if tt.speed and not t.speed then t.speed = tt.speed end
 	if t.tactical then t.tactical = Talents.aiLowerTacticals(t.tactical) end
@@ -65,6 +66,10 @@ Talents.newTalent = function(self, t)
 		t.short_name = (t.short_name or t.name):upper():gsub("[ ']", "_")
 		t.name = "#LIGHT_STEEL_BLUE#"..t.name.." (Class Evolution)"
 	end
+	if t.is_race_evolution then
+		t.short_name = (t.short_name or t.name):upper():gsub("[ ']", "_")
+		t.name = "#SANDY_BROWN#"..t.name.." (Race Evolution)"
+	end
 
 	return oldNewTalent(self, t)
 end
@@ -100,6 +105,7 @@ Talents.is_a_type = {
 	is_nature = "a nature gift",
 	is_antimagic = "an antimagic ability",
 	is_summon = "a summon power",
+	is_necromancy = "necromancy",
 	use_only_arcane = "usable during Aether Avatar",
 }
 
diff --git a/game/modules/tome/data/talents/spells/spells.lua b/game/modules/tome/data/talents/spells/spells.lua
index 7b45a7b885..1d1d678df1 100644
--- a/game/modules/tome/data/talents/spells/spells.lua
+++ b/game/modules/tome/data/talents/spells/spells.lua
@@ -60,13 +60,13 @@ newTalentType{ type="golem/golem", name = "golem", description = "Golem basic ca
 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." }
-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." }
-newTalentType{ allow_random=true, no_silence=true, is_spell=true, mana_regen=true, type="spell/animus", name = "animus", description = "Crush the souls of your foes to improve yourself." }
+newTalentType{ allow_random=true, no_silence=true, is_necromancy=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_necromancy=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_necromancy=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_necromancy=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_necromancy=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_necromancy=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." }
+newTalentType{ allow_random=true, no_silence=true, is_necromancy=true, is_spell=true, mana_regen=true, type="spell/animus", name = "animus", description = "Crush the souls of your foes to improve yourself." }
 
 newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/eldritch-shield", name = "eldritch shield", description = "Infuse arcane forces into your shield." }
 newTalentType{ allow_random=true, no_silence=true, is_spell=true, type="spell/eldritch-stone", name = "eldritch stone", description = "Summon stony spikes imbued with various powers." }
diff --git a/game/modules/tome/dialogs/UberTalent.lua b/game/modules/tome/dialogs/UberTalent.lua
index ffd99c96a4..389bf44e18 100644
--- a/game/modules/tome/dialogs/UberTalent.lua
+++ b/game/modules/tome/dialogs/UberTalent.lua
@@ -73,7 +73,6 @@ function _M:ignoreUnlocks()
 end
 
 function _M:generateList()
-
 	-- Makes up the list
 	local max = 0
 	local cols = {}
@@ -81,7 +80,16 @@ function _M:generateList()
 	for tid, t in pairs(self.actor.talents_def) do
 		if t.uber and not t.not_listed then
 			if 
-			    (not t.is_class_evolution or (self.actor.descriptor and self.actor.descriptor.subclass == t.is_class_evolution)) and
+			    (
+			    	not t.is_class_evolution or
+			    	((type(t.is_class_evolution) == "string" and self.actor:hasDescriptor("subclass", t.is_class_evolution))) or
+			    	((type(t.is_class_evolution) == "function" and t.is_class_evolution(self.actor, t)))
+			    ) and
+			    (
+			    	not t.is_race_evolution or
+			    	((type(t.is_race_evolution) == "string" and self.actor:hasDescriptor("subrace", t.is_race_evolution))) or
+			    	((type(t.is_race_evolution) == "function" and t.is_race_evolution(self.actor, t)))
+			    ) and
 			    (not t.requires_unlock or profile.mod.allow_build[t.requires_unlock] or self:ignoreUnlocks())
 			    then
 				cols[t.type[1]] = cols[t.type[1]] or {}
@@ -97,6 +105,8 @@ function _M:generateList()
 		table.sort(cols[s], function(a,b)
 			if a.is_class_evolution ~= b.is_class_evolution then
 				return b.is_class_evolution and true or false
+			elseif a.is_race_evolution ~= b.is_race_evolution then
+				return b.is_race_evolution and true or false
 			else
 				return a.name < b.name
 			end
-- 
GitLab