Quantcast

Handle absorption enchants

Kevin Lyles [06-04-11 - 01:41]
Handle absorption enchants
Filename
Locales/enUS/patterns-enchants.lua
Locales/enUS/patterns.lua
Locales/enUS/stats.lua
defaults.lua
diff --git a/Locales/enUS/patterns-enchants.lua b/Locales/enUS/patterns-enchants.lua
index 424be26..d011aec 100644
--- a/Locales/enUS/patterns-enchants.lua
+++ b/Locales/enUS/patterns-enchants.lua
@@ -12,11 +12,11 @@ local EnchantMatchLines = {

 local EnchantUnweightedLines = {
 	" sometimes ",
-	" chance ",
 	" often ",
 	" damage to ",
 	" occasionally ",
 	" against ",
+	" lasts for ",
 }

 local EnchantPreprocessLines = {
diff --git a/Locales/enUS/patterns.lua b/Locales/enUS/patterns.lua
index c6f60c8..2391f82 100644
--- a/Locales/enUS/patterns.lua
+++ b/Locales/enUS/patterns.lua
@@ -632,6 +632,15 @@ ww_SingleStatLines = {
 		end,
 		{"enchant", "generic"},
 	},
+	{"^has a (%d+%% chance) per hit of giving you (%d+) damage absorption$",
+		function(text, pattern)
+			local start, _, chance, damage = text:find(pattern)
+			if start then
+				return WeightsWatcher.newStatTable({["damage absorption (" .. chance .. ")"] = tonumber(damage)})
+			end
+		end,
+		{"enchant"},
+	},
 }

 ww_ItemInfoLines = {
diff --git a/Locales/enUS/stats.lua b/Locales/enUS/stats.lua
index 52e84b7..d0b7b37 100644
--- a/Locales/enUS/stats.lua
+++ b/Locales/enUS/stats.lua
@@ -34,6 +34,8 @@ ww_localizedStats = {
 	["critical healing (percent)"] = "critical healing (percent)",
 	["critical strike rating"] = "critical strike rating",
 	["crusader"] = "crusader",
+	["damage absorption (2% chance)"] = "damage absorption (2% chance)",
+	["damage absorption (5% chance)"] = "damage absorption (5% chance)",
 	["deathfrost"] = "deathfrost",
 -- 	["defense rating"] = "defense rating",
 	["demonslaying"] = "demonslaying",
@@ -162,6 +164,8 @@ ww_statDisplayNames = {
 	[ww_localizedStats["critical healing (percent)"]] = "Critical Healing (Percent)",
 	[ww_localizedStats["critical strike rating"]] = "Critical Strike Rating",
 	[ww_localizedStats["crusader"]] = "Crusader",
+	[ww_localizedStats["damage absorption (2% chance)"]] = "Damage Absorption (2% Chance)",
+	[ww_localizedStats["damage absorption (5% chance)"]] = "Damage Absorption (5% Chance)",
 	[ww_localizedStats["deathfrost"]] = "Deathfrost",
 -- 	[ww_localizedStats["defense rating"]] = "Defense Rating",
 	[ww_localizedStats["demonslaying"]] = "Demonslaying",
diff --git a/defaults.lua b/defaults.lua
index 01433e1..66bb380 100644
--- a/defaults.lua
+++ b/defaults.lua
@@ -70,6 +70,8 @@ ww_trackedStats = {
 			"average damage dealt on block",
 			"block value (percent)",
 			"chance to restore health on hit",
+			"damage absorption (2% chance)",
+			"damage absorption (5% chance)",
 			"spell damage taken reduction (percent)",
 			"threat (percent)",
 		},