From 31610c263431a587ec4cfc4f1e7d0b5329c852d1 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 25 Nov 2012 02:35:49 +0000
Subject: [PATCH] flexible comabt shows comabt stats on gloves

Death diablog now shows the new achievements you gained and unlocks you made


git-svn-id: http://svn.net-core.org/repos/t-engine4@5820 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Game.lua              | 75 ++++++++++---------
 game/modules/tome/class/Object.lua            |  2 +-
 game/modules/tome/class/Party.lua             |  1 +
 game/modules/tome/class/World.lua             |  3 +
 .../data/general/objects/world-artifacts.lua  |  4 +-
 game/modules/tome/data/talents/uber/str.lua   |  2 +
 game/modules/tome/dialogs/DeathDialog.lua     | 10 ++-
 7 files changed, 56 insertions(+), 41 deletions(-)

diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua
index 5a02966ecf..290156ef4e 100644
--- a/game/modules/tome/class/Game.lua
+++ b/game/modules/tome/class/Game.lua
@@ -1880,6 +1880,8 @@ function _M:setAllowedBuild(what, notify)
 	if notify then
 		self.state:checkDonation() -- They gained someting nice, they could be more receptive
 		self:registerDialog(require("mod.dialogs.UnlockDialog").new(what))
+
+		if type(unlocks_list[what]) == "string" then self.party.on_death_show_achieved[#self.party.on_death_show_achieved+1] = "Unlocked: "..unlocks_list[what] end
 	end
 
 	return true
@@ -1926,55 +1928,56 @@ function _M:placeRandomLoreObject(define, zone)
 	end
 end
 
---- Returns the current number of birth unlocks and the max
-function _M:countBirthUnlocks()
-	local nb = 0
-	local max = 0
-	local list = {
-		birth_transmo_chest = true,
-		birth_zigur_sacrifice = true,
+unlocks_list = {
+	birth_transmo_chest = "Birth option: Transmogrification Chest",
+	birth_zigur_sacrifice = "Birth option: Zigur sacrifice",
 
-		campaign_infinite_dungeon = true,
-		campaign_arena = true,
+	campaign_infinite_dungeon = "Campaign: Infinite Dungeon",
+	campaign_arena = "Campaign: The Arena",
 
-		undead_ghoul = true,
-		undead_skeleton = true,
-		yeek = true,
+	undead_ghoul = "Race: Ghoul",
+	undead_skeleton = "Race: Skeleton",
+	yeek = "Race: Yeek",
 
-		mage = true,
-		mage_tempest = true,
-		mage_geomancer = true,
-		mage_pyromancer = true,
-		mage_cryomancer = true,
-		mage_necromancer = true,
+	mage = "Class: Archmage",
+	mage_tempest = "Class tree: Storm",
+	mage_geomancer = "Class tree: Stone",
+	mage_pyromancer = "Class tree: Wildfire",
+	mage_cryomancer = "Class tree: uttercold",
+	mage_necromancer = "Class: Necromancer",
 
-		rogue_marauder = true,
-		rogue_poisons = true,
+	rogue_marauder = "Class: Marauder",
+	rogue_poisons = "Class tree: Poisons",
 
-		divine_anorithil = true,
-		divine_sun_paladin = true,
+	divine_anorithil = "Class: Anorithil",
+	divine_sun_paladin = "Class: Sun Paladin",
 
-		wilder_wyrmic = true,
-		wilder_summoner = true,
+	wilder_wyrmic = "Class: Wyrmic",
+	wilder_summoner = "Class: Summoner",
 
-		corrupter_reaver = true,
-		corrupter_corruptor = true,
+	corrupter_reaver = "Class: Reaver",
+	corrupter_corruptor = "Class: Corruptor",
 
-		afflicted_cursed = true,
-		afflicted_doomed = true,
+	afflicted_cursed = "Class: Cursed",
+	afflicted_doomed = "Class: Doomed",
 
-		chronomancer_temporal_warden = true,
-		chronomancer_paradox_mage = true,
+	chronomancer_temporal_warden = "Class: Temporal Warden",
+	chronomancer_paradox_mage = "Class: Paradox Mage",
 
-		psionic_mindslayer = true,
-		psionic_solipsist = true,
+	psionic_mindslayer = "Class: Mindslayer",
+	psionic_solipsist = "Class: Solipsist",
 
-		warrior_brawler = true,
+	warrior_brawler = "Class: Brawler",
 
-		adventurer = true,
-	}
+	adventurer = "Class: Adventurer",
+}
+
+--- Returns the current number of birth unlocks and the max
+function _M:countBirthUnlocks()
+	local nb = 0
+	local max = 0
 
-	for name, _ in pairs(list) do
+	for name, _ in pairs(self.unlocks_list) do
 		max = max + 1
 		if profile.mod.allow_build[name] then nb = nb + 1 end
 	end
diff --git a/game/modules/tome/class/Object.lua b/game/modules/tome/class/Object.lua
index 6be99c1a11..ac97cdfb99 100644
--- a/game/modules/tome/class/Object.lua
+++ b/game/modules/tome/class/Object.lua
@@ -1044,7 +1044,7 @@ function _M:getTextualDesc(compare_with)
 			compare_unarmed[i] = compare_with[i].wielder or {}
 		end
 
-		if (w and w.combat or can_combat_unarmed) and game.player:knowTalent(game.player.T_EMPTY_HAND) then
+		if (w and w.combat or can_combat_unarmed) and (game.player:knowTalent(game.player.T_EMPTY_HAND) or game.player:attr("show_gloves_combat")) then
 			desc:add({"color","YELLOW"}, "When used to modify unarmed attacks:", {"color", "LAST"}, true)
 			compare_tab = { dam=1, atk=1, apr=0, physcrit=0, physspeed =0.6, dammod={str=1}, damrange=1.1 }
 			desc_combat(w, compare_unarmed, "combat", compare_tab)
diff --git a/game/modules/tome/class/Party.lua b/game/modules/tome/class/Party.lua
index 14fc503946..1aab983223 100644
--- a/game/modules/tome/class/Party.lua
+++ b/game/modules/tome/class/Party.lua
@@ -38,6 +38,7 @@ function _M:init(t, no_default)
 	self.members = {}
 	self.m_list = {}
 	self.energy = {value = 0, mod=100000} -- "Act" every tick
+	self.on_death_show_achieved = {}
 end
 
 function _M:addMember(actor, def)
diff --git a/game/modules/tome/class/World.lua b/game/modules/tome/class/World.lua
index 5261f0aabc..e1b52c6c60 100644
--- a/game/modules/tome/class/World.lua
+++ b/game/modules/tome/class/World.lua
@@ -57,5 +57,8 @@ function _M:gainAchievement(id, src, ...)
 	if game.permadeath == game.PERMADEATH_INFINITE then id = "EXPLORATION_"..id end
 	if game.difficulty == game.DIFFICULTY_INSANE and game.permadeath == game.PERMADEATH_ONE then id = "INSANE_"..id end
 
+	local knew = self.achieved[id]
+
 	mod.class.interface.WorldAchievements.gainAchievement(self, id, src, ...)
+	if not knew and self.achieved[id] then game.party.on_death_show_achieved[#game.party.on_death_show_achieved+1] = "Gained new achievement: "..a.name end
 end
diff --git a/game/modules/tome/data/general/objects/world-artifacts.lua b/game/modules/tome/data/general/objects/world-artifacts.lua
index b05a88ecde..c30e76e426 100644
--- a/game/modules/tome/data/general/objects/world-artifacts.lua
+++ b/game/modules/tome/data/general/objects/world-artifacts.lua
@@ -4782,8 +4782,8 @@ newEntity{ base = "BASE_SHIELD", --Thanks SageAcrin!
 			local burst = {type="cone", range=0, radius=4, force_target=target, selffire=false,}
 		
 			who:project(burst, target.x, target.y, engine.DamageType.COLD, 30)
-			game.level.map:particleEmitter(target.x, target.y, burst.radius, "breath_ice", {radius=burst.radius, tx=target.x-who.x, ty=target.y-who.y})
-			game.logSeen(who, "A burst of chilling water launches from your shield to %s!", who.name:capitalize())
+			game.level.map:particleEmitter(target.x, target.y, burst.radius, "breath_cold", {radius=burst.radius, tx=target.x-who.x, ty=target.y-who.y})
+			game.logSeen(who, "A burst of chilling water launches from %s's shield to %s!", who.name:capitalize(), target.name:capitalize())
 		end
 	end,
 }
diff --git a/game/modules/tome/data/talents/uber/str.lua b/game/modules/tome/data/talents/uber/str.lua
index 8c47d7e5d4..97a13ef07d 100644
--- a/game/modules/tome/data/talents/uber/str.lua
+++ b/game/modules/tome/data/talents/uber/str.lua
@@ -22,9 +22,11 @@ uberTalent{
 	mode = "passive",
 	on_learn = function(self, t)
 		self:attr("unharmed_attack_on_hit", 1)
+		self:attr("show_gloves_combat", 1)
 	end,
 	on_unlearn = function(self, t)
 		self:attr("unharmed_attack_on_hit", -1)
+		self:attr("show_gloves_combat", -1)
 	end,
 	info = function(self, t)
 		return ([[Each time you make a melee attack you have 100%% chances to do an additional unarmed strike, if using weapons and 60%% chances if already fighting unarmed.]])
diff --git a/game/modules/tome/dialogs/DeathDialog.lua b/game/modules/tome/dialogs/DeathDialog.lua
index 318d12fbb5..2b1dcf71c5 100644
--- a/game/modules/tome/dialogs/DeathDialog.lua
+++ b/game/modules/tome/dialogs/DeathDialog.lua
@@ -37,10 +37,16 @@ function _M:init(actor)
 	if self.dont_show then return end
 	if not config.settings.cheat then game:saveGame() end
 
-	self.c_desc = Textzone.new{width=self.iw, auto_height=true, text=[[You have #LIGHT_RED#died#LAST#!
+	local text = [[You have #LIGHT_RED#died#LAST#!
 Death in ToME is usually permanent, but if you have a means of resurrection it will be proposed in the menu below.
 You can dump your character data to a file to remember her/him forever, or you can exit and try once again to survive in the wilds!
-]]}
+]]
+
+	if #game.party.on_death_show_achieved > 0 then
+		text = text.."#LIGHT_GREEN#During your game you#WHITE#:\n* "..table.concat(game.party.on_death_show_achieved, "\n* ")
+	end
+
+	self.c_desc = Textzone.new{width=self.iw, auto_height=true, text=text}
 	self.c_list = List.new{width=self.iw, nb_items=#self.list, list=self.list, fct=function(item) self:use(item) end}
 
 	self:loadUI{
-- 
GitLab