From 4cbc9f297b5b0a734bc6b8ec6b3b13feb5360e0a Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Fri, 15 Oct 2010 00:02:17 +0000
Subject: [PATCH] New artifact: Silent Blade

git-svn-id: http://svn.net-core.org/repos/t-engine4@1521 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/interface/Combat.lua  |  6 ++++-
 game/modules/tome/data/damage_types.lua       | 15 ++++++++++++
 .../data/general/objects/world-artifacts.lua  | 23 +++++++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/game/modules/tome/class/interface/Combat.lua b/game/modules/tome/class/interface/Combat.lua
index 9401a98442..2d4fc375ee 100644
--- a/game/modules/tome/class/interface/Combat.lua
+++ b/game/modules/tome/class/interface/Combat.lua
@@ -88,6 +88,7 @@ function _M:attackTarget(target, damtype, mult, noenergy)
 		mult = (mult or 1) * (target.dominatedDamMult or 1)
 	end
 
+	local dont_break_stealth = false
 	if not self:attr("disarmed") then
 		-- All weapons in main hands
 		if self:getInven(self.INVEN_MAINHAND) then
@@ -99,6 +100,7 @@ function _M:attackTarget(target, damtype, mult, noenergy)
 					hit = hit or h
 					if hit and not sound then sound = o.combat.sound
 					elseif not hit and not sound_miss then sound_miss = o.combat.sound_miss end
+					if o.combat.no_stealth_break then dont_break_stealth = true end
 				end
 			end
 		end
@@ -119,6 +121,7 @@ function _M:attackTarget(target, damtype, mult, noenergy)
 					hit = hit or h
 					if hit and not sound then sound = o.combat.sound
 					elseif not hit and not sound_miss then sound_miss = o.combat.sound_miss end
+					if o.combat.no_stealth_break then dont_break_stealth = true end
 				end
 			end
 		end
@@ -132,6 +135,7 @@ function _M:attackTarget(target, damtype, mult, noenergy)
 		hit = hit or h
 		if hit and not sound then sound = self.combat.sound
 		elseif not hit and not sound_miss then sound_miss = self.combat.sound_miss end
+		if self.combat.no_stealth_break then dont_break_stealth = true end
 	end
 
 	-- Mount attack ?
@@ -156,7 +160,7 @@ function _M:attackTarget(target, damtype, mult, noenergy)
 	end
 
 	-- Cancel stealth!
-	self:breakStealth()
+	if not dont_break_stealth then self:breakStealth() end
 	return hit
 end
 
diff --git a/game/modules/tome/data/damage_types.lua b/game/modules/tome/data/damage_types.lua
index 29505b3fdb..3a6bc1fa50 100644
--- a/game/modules/tome/data/damage_types.lua
+++ b/game/modules/tome/data/damage_types.lua
@@ -245,6 +245,21 @@ newDamageType{
 	end,
 }
 
+-- Silence
+newDamageType{
+	name = "% chance to silence target", type = "RANDOM_SILENCE",
+	projector = function(src, x, y, type, dam)
+		local target = game.level.map(x, y, Map.ACTOR)
+		if target and rng.percent(dam) then
+			if target:checkHit(src:combatAttackDex() * 0.7, target:combatPhysicalResist(), 0, 95, 15) then
+				target:setEffect(target.EFF_SILENCED, 4, {})
+			else
+				game.logSeen(target, "%s resists!", target.name:capitalize())
+			end
+		end
+	end,
+}
+
 -- Blinds
 newDamageType{
 	name = "blindness", type = "BLIND",
diff --git a/game/modules/tome/data/general/objects/world-artifacts.lua b/game/modules/tome/data/general/objects/world-artifacts.lua
index b1f22d3fc6..79f7fe04c3 100644
--- a/game/modules/tome/data/general/objects/world-artifacts.lua
+++ b/game/modules/tome/data/general/objects/world-artifacts.lua
@@ -535,6 +535,29 @@ The perfect size for Bilbo, and stamped forever by the courage he found in Mirkw
 	},
 }
 
+newEntity{ base = "BASE_KNIFE",
+	unique = true,
+	name = "Slient Blade",
+	unided_name = "shining dagger",
+	desc = [[A thin dark dagger that seems to meld seamlessly into the shadows.]],
+	level_range = {40, 50},
+	rarity = 200,
+	require = { stat = { cun=25 }, },
+	cost = 250,
+	material_level = 3,
+	combat = {
+		dam = 25,
+		apr = 10,
+		atk = 15,
+		physcrit = 8,
+		dammod = {dex=0.55,cun=0.35},
+		no_stealth_break = true,
+	},
+	wielder = {
+		melee_project={[DamageType.RANDOM_SILENCE] = 10},
+	},
+}
+
 newEntity{ base = "BASE_RING",
 	unique = true,
 	name = "Ring of the War Master", color = colors.DARK_GREY,
-- 
GitLab