From ad26b0842e10119883d6e96d64a35a4d4a2d5b62 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Wed, 13 Oct 2010 11:04:31 +0000
Subject: [PATCH] Added a new world artifact, the axe of Durin, grants more
 power in the hands of a dwarf

git-svn-id: http://svn.net-core.org/repos/t-engine4@1515 51575b47-30f0-44d4-a5cc-537603b46e54
---
 .../engine/interface/ActorInventory.lua       |  4 +-
 game/modules/tome/data/damage_types.lua       | 12 +++++
 .../data/general/encounters/arda-west.lua     |  2 +-
 .../tome/data/general/objects/objects.lua     |  1 +
 .../general/objects/special-artifacts.lua     | 44 +++++++++++++++++++
 .../data/general/objects/world-artifacts.lua  | 31 +++++++++++++
 game/modules/tome/data/timed_effects.lua      |  8 ++--
 .../data/zones/ancient-elven-ruins/npcs.lua   | 26 +++++------
 .../zones/ancient-elven-ruins/objects.lua     |  8 ++--
 .../data/zones/ancient-elven-ruins/zone.lua   |  2 +-
 10 files changed, 113 insertions(+), 25 deletions(-)
 create mode 100644 game/modules/tome/data/general/objects/special-artifacts.lua

diff --git a/game/engines/default/engine/interface/ActorInventory.lua b/game/engines/default/engine/interface/ActorInventory.lua
index 07697a82f4..a7c4c11953 100644
--- a/game/engines/default/engine/interface/ActorInventory.lua
+++ b/game/engines/default/engine/interface/ActorInventory.lua
@@ -97,8 +97,8 @@ function _M:addObject(inven_id, o)
 
 	-- Do whatever is needed when wearing this object
 	if inven.worn then
-		o:check("on_wear", self)
 		self:onWear(o)
+		o:check("on_wear", self)
 	end
 
 	self:onAddObject(o)
@@ -164,8 +164,8 @@ function _M:removeObject(inven, item, no_unstack)
 
 	-- Do whatever is needed when takingoff this object
 	if inven.worn then
-		o:check("on_takeoff", self)
 		self:onTakeoff(o)
+		o:check("on_takeoff", self)
 	end
 
 	self:onRemoveObject(o)
diff --git a/game/modules/tome/data/damage_types.lua b/game/modules/tome/data/damage_types.lua
index 6f03443379..29505b3fdb 100644
--- a/game/modules/tome/data/damage_types.lua
+++ b/game/modules/tome/data/damage_types.lua
@@ -567,6 +567,18 @@ newDamageType{
 	end,
 }
 
+-- Physical damage + bleeding % of it
+newDamageType{
+	name = "physical + bleeding", type = "PHYSICALBLEED",
+	projector = function(src, x, y, type, dam)
+		local realdam = DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam)
+		local target = game.level.map(x, y, Map.ACTOR)
+		if realdam > 0 and target and target:canBe("cut") then
+			target:setEffect(target.EFF_CUT, 5, {src=src, power=dam * 0.1})
+		end
+	end,
+}
+
 -- Slime damage
 newDamageType{
 	name = "slime", type = "SLIME",
diff --git a/game/modules/tome/data/general/encounters/arda-west.lua b/game/modules/tome/data/general/encounters/arda-west.lua
index 8ead0fc8cb..4c06c238aa 100644
--- a/game/modules/tome/data/general/encounters/arda-west.lua
+++ b/game/modules/tome/data/general/encounters/arda-west.lua
@@ -127,7 +127,7 @@ newEntity{
 newEntity{
 	name = "Ancient Elven Ruins",
 	type = "harmless", subtype = "special", unique = true,
-	level_range = {20, 30},
+	level_range = {30, 40},
 	rarity = 8,
 	coords = {{ x=0, y=0, w=100, h=100}},
 	on_encounter = function(self, who)
diff --git a/game/modules/tome/data/general/objects/objects.lua b/game/modules/tome/data/general/objects/objects.lua
index 7dde15d822..690551e291 100644
--- a/game/modules/tome/data/general/objects/objects.lua
+++ b/game/modules/tome/data/general/objects/objects.lua
@@ -82,3 +82,4 @@ loadIfNot("/data/general/objects/mounts.lua")
 -- Artifacts
 loadIfNot("/data/general/objects/world-artifacts.lua")
 loadIfNot("/data/general/objects/quest-artifacts.lua")
+loadIfNot("/data/general/objects/special-artifacts.lua")
diff --git a/game/modules/tome/data/general/objects/special-artifacts.lua b/game/modules/tome/data/general/objects/special-artifacts.lua
new file mode 100644
index 0000000000..3463e11443
--- /dev/null
+++ b/game/modules/tome/data/general/objects/special-artifacts.lua
@@ -0,0 +1,44 @@
+-- ToME - Tales of Middle-Earth
+-- Copyright (C) 2009, 2010 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
+
+local Stats = require "engine.interface.ActorStats"
+local Talents = require "engine.interface.ActorTalents"
+
+-- This file describes artifacts not bound to a special location or quest, but still special(they do not get randomly generated)
+newEntity{ base = "BASE_WARAXE",
+	unique = true,
+	define_as = "WARAXE_DRAMBORLEG", rarity = false, unided_name = "razor sharp war axe",
+	name = "Dramborleg, the waraxe of Tuor", color = colors.LIGHT_BLUE,
+	desc = [[The mighty axe of Tuor can cleave through armor like the sharpest swords, yet hit with all the impact of a heavy club. its name means 'Thudder Sharp'.]],
+	require = { stat = { str=42 }, },
+	material_level = 5,
+	combat = {
+		dam = 58,
+		apr = 16,
+		physcrit = 7,
+		dammod = {str=1},
+		damrange = 1.4,
+		damtype = DamageType.PHYSICALBLEED,
+	},
+	wielder = {
+		inc_stats = { [Stats.STAT_STR] = 4, [Stats.STAT_DEX] = 4, },
+		see_invisible = 5,
+		inc_damage = { [DamageType.PHYSICAL]=10 },
+	},
+}
diff --git a/game/modules/tome/data/general/objects/world-artifacts.lua b/game/modules/tome/data/general/objects/world-artifacts.lua
index aa1197a428..b1f22d3fc6 100644
--- a/game/modules/tome/data/general/objects/world-artifacts.lua
+++ b/game/modules/tome/data/general/objects/world-artifacts.lua
@@ -783,6 +783,37 @@ newEntity{ base = "BASE_WAND",
 	},
 }
 
+newEntity{ base = "BASE_BATTLEAXE",
+	unique = true,
+	unided_name = "crude iron battle axe",
+	name = "Crude Iron Battle Axe of Durin the Deathless", color = colors.GREY,
+	desc = [[Made in times before the dwarves learned beautiful craftsmanship from the noldor, the rough appearance of this axe belies its great power. Only dwarves may harness its true strength, however.]],
+	require = { stat = { str=50 }, },
+	rarity = 300,
+	material_level = 1,
+	combat = {
+		dam = 68,
+		apr = 7,
+		physcrit = 10,
+		dammod = {str=1.3},
+	},
+	wielder = {
+		inc_stats = { [Stats.STAT_CON] = 2, [Stats.STAT_DEX] = 2, },
+		combat_def = 6, combat_armor = 6,
+		inc_damage = { [DamageType.PHYSICAL]=10 },
+		stun_immune = 0.5,
+		knockback_immune = 0.5,
+	},
+	on_wear = function(self, who)
+		if who.descriptor and who.descriptor.race == "Dwarf" then
+			self.wielded._special1 = who:addTemporaryValue("inc_stats", { [Stats.STAT_CON] = 4, [Stats.STAT_DEX] = 4, })
+			self.wielded._special2 = who:addTemporaryValue("stun_immune", 0.5)
+			self.wielded._special2 = who:addTemporaryValue("knockback_immune", 0.5)
+			game.logPlayer(who, "#LIGHT_BLUE#You feel as surge of power as you wield the axe of your ancestors!")
+		end
+	end,
+}
+
 --[=[
 newEntity{
 	unique = true,
diff --git a/game/modules/tome/data/timed_effects.lua b/game/modules/tome/data/timed_effects.lua
index 6f5f79ab38..888e72e442 100644
--- a/game/modules/tome/data/timed_effects.lua
+++ b/game/modules/tome/data/timed_effects.lua
@@ -903,7 +903,7 @@ newEffect{
 newEffect{
 	name = "ROTTING_DISEASE",
 	desc = "Rotting Disease",
-	long_desc = function(self, eff) return ("The target is infected by a disease, reducing its constitution by %d and doing %0.2f blight damage per turn."):format(eff.power) end,
+	long_desc = function(self, eff) return ("The target is infected by a disease, reducing its constitution by %d and doing %0.2f blight damage per turn."):format(eff.con, eff.dam) end,
 	type = "disease",
 	status = "detrimental",
 	parameters = {},
@@ -925,7 +925,7 @@ newEffect{
 newEffect{
 	name = "DECREPITUDE_DISEASE",
 	desc = "Decrepitude Disease",
-	long_desc = function(self, eff) return ("The target is infected by a disease, reducing its dexterity by %d and doing %0.2f blight damage per turn."):format(eff.power) end,
+	long_desc = function(self, eff) return ("The target is infected by a disease, reducing its dexterity by %d and doing %0.2f blight damage per turn."):format(eff.dex, eff.dam) end,
 	type = "disease",
 	status = "detrimental",
 	parameters = {},
@@ -947,7 +947,7 @@ newEffect{
 newEffect{
 	name = "WEAKNESS_DISEASE",
 	desc = "Weakness Disease",
-	long_desc = function(self, eff) return ("The target is infected by a disease, reducing its strength by %d and doing %0.2f blight damage per turn."):format(eff.power) end,
+	long_desc = function(self, eff) return ("The target is infected by a disease, reducing its strength by %d and doing %0.2f blight damage per turn."):format(eff.str, eff.dam) end,
 	type = "disease",
 	status = "detrimental",
 	parameters = {},
@@ -969,7 +969,7 @@ newEffect{
 newEffect{
 	name = "EPIDEMIC",
 	desc = "Epidemic",
-	long_desc = function(self, eff) return ("The target is infected by a disease, doing %0.2f blight damage per turn.\nEach non-disease blight damage done to it will spread the disease."):format(eff.power) end,
+	long_desc = function(self, eff) return ("The target is infected by a disease, doing %0.2f blight damage per turn.\nEach non-disease blight damage done to it will spread the disease."):format(eff.dam) end,
 	type = "disease",
 	status = "detrimental",
 	parameters = {},
diff --git a/game/modules/tome/data/zones/ancient-elven-ruins/npcs.lua b/game/modules/tome/data/zones/ancient-elven-ruins/npcs.lua
index 55a7652901..c50be614e4 100644
--- a/game/modules/tome/data/zones/ancient-elven-ruins/npcs.lua
+++ b/game/modules/tome/data/zones/ancient-elven-ruins/npcs.lua
@@ -33,7 +33,7 @@ newEntity{ define_as = "GREATER_MUMMY_LORD",
 	name = "Greater Mummy Lord",
 	display = "Z", color=colors.VIOLET,
 	desc = [[The wrappings of this mummy radiates with so much power it feels like wind is blowing from it.]],
-	level_range = {20, 35}, exp_worth = 2,
+	level_range = {30, 45}, exp_worth = 2,
 	max_life = 250, life_rating = 21, fixed_rating = true,
 	max_stamina = 200,
 	max_mana = 200,
@@ -53,18 +53,18 @@ newEntity{ define_as = "GREATER_MUMMY_LORD",
 	drops = resolvers.drops{chance=100, nb=4, {ego_chance=100} },
 
 	resolvers.talents{
-		[Talents.T_SHIELD_PUMMEL]=3,
-		[Talents.T_ASSAULT]=3,
-		[Talents.T_OVERPOWER]=3,
-		[Talents.T_BLINDING_SPEED]=3,
-		[Talents.T_SWORD_MASTERY]=4,
-		[Talents.T_WEAPON_COMBAT]=5,
-
-		[Talents.T_FREEZE]=3,
-		[Talents.T_ICE_STORM]=3,
-		[Talents.T_INVISIBILITY]=3,
-
-		[Talents.T_ROTTING_DISEASE]=3,
+		[Talents.T_SHIELD_PUMMEL]=5,
+		[Talents.T_ASSAULT]=4,
+		[Talents.T_OVERPOWER]=5,
+		[Talents.T_BLINDING_SPEED]=4,
+		[Talents.T_SWORD_MASTERY]=6,
+		[Talents.T_WEAPON_COMBAT]=8,
+
+		[Talents.T_FREEZE]=4,
+		[Talents.T_ICE_STORM]=4,
+		[Talents.T_INVISIBILITY]=4,
+
+		[Talents.T_ROTTING_DISEASE]=5,
 	},
 
 	instakill_immune = 1,
diff --git a/game/modules/tome/data/zones/ancient-elven-ruins/objects.lua b/game/modules/tome/data/zones/ancient-elven-ruins/objects.lua
index f87b0fab8b..c2ca78ef14 100644
--- a/game/modules/tome/data/zones/ancient-elven-ruins/objects.lua
+++ b/game/modules/tome/data/zones/ancient-elven-ruins/objects.lua
@@ -20,15 +20,15 @@
 load("/data/general/objects/objects.lua")
 load("/data/general/objects/mummy-wrappings.lua")
 
--- Artifact, droped (and used!) by the Shade of Angmar
 newEntity{ base = "BASE_LONGSWORD",
 	define_as = "LONGSWORD_RINGIL", rarity=false, unided_name = "glittering longsword",
 	name = "Ringil, the glittering sword of Fingolfin", unique=true,
 	desc = [[The sword of Fingolfin, said to have glittered like ice. With it he wounded Morgoth in single combat after the Dagor Bragollach.]],
-	require = { stat = { str=25 }, },
+	require = { stat = { str=35 }, },
 	cost = 2000,
+	material_level = 5,
 	combat = {
-		dam = 38,
+		dam = 45,
 		apr = 10,
 		physcrit = 10,
 		dammod = {str=1},
@@ -47,7 +47,7 @@ newEntity{ base = "BASE_LONGSWORD",
 			local tg = {type="ball", range=0, radius=4, friendlyfire=false}
 			who:project(tg, who.x, who.y, engine.DamageType.ICE, 10 + (who:getMag() + who:getWil()) / 2, {type="freeze"})
 			game:playSoundNear(who, "talents/ice")
-			game.logSeen(who, "%s invokes the power of his icy sword!", who.name:capitalize())
+			game.logSeen(who, "%s invokes the power of Ringil!", who.name:capitalize())
 			return true
 		end
 	},
diff --git a/game/modules/tome/data/zones/ancient-elven-ruins/zone.lua b/game/modules/tome/data/zones/ancient-elven-ruins/zone.lua
index 4ffd767655..f51c6392c7 100644
--- a/game/modules/tome/data/zones/ancient-elven-ruins/zone.lua
+++ b/game/modules/tome/data/zones/ancient-elven-ruins/zone.lua
@@ -19,7 +19,7 @@
 
 return {
 	name = "Elven Ruins",
-	level_range = {18, 25},
+	level_range = {33, 38},
 	level_scheme = "player",
 	max_level = 3,
 	decay = {300, 800},
-- 
GitLab