Quantcast

- frost DK: updated from SC

Sidoine De Wispelaere [02-05-12 - 21:20]
- frost DK: updated from SC
- elemental shaman: updated from SC + fix
- retribution paladin: updated from SC
- balance druid: added mushrooms
- added rune() function
- added otherAura() function
- added OtherAuraExpires() et OtherAuraPresent(): works with buffs too (for healers)
- now +, -, *, and / have a higher priority than < and >

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@461 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
Ovale.lua
Ovale.toc
OvaleCompile.lua
defaut/Chaman.lua
defaut/Chevalier.lua
defaut/Druide.lua
defaut/Paladin.lua
diff --git a/Condition.lua b/Condition.lua
index f37fafd..64efe21 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -176,6 +176,105 @@ local function nilstring(text)
 	end
 end

+-- Get the expiration time of a debuff
+-- that can be on any unit except the target
+-- Returns the first to expires, the last to expires
+-- Returns nil if the debuff is not present
+local function getOtherAura(spellId, suppTime)
+	Ovale:EnableOtherAuras()
+	local otherAura = Ovale.otherAura[spellId]
+	if otherAura then
+	--	print("otherAura")
+		local maxTime = 0
+		local minTime = nil
+		suppTime = suppTime or 10
+		for target,expireTime in pairs(otherAura) do
+	--		print("target "..target.. " "..expireTime)
+			if target~=UnitGUID("target") then
+				if Ovale.maintenant - suppTime > expireTime then
+					otherAura[target] = nil
+				else
+					if expireTime > maxTime then
+						maxTime = expireTime
+					end
+					if not minTime or diff<minTime then
+						minTime = diff
+					end
+				end
+			end
+		end
+	--	print("maxTime final "..maxTime)
+		return minTime, maxTime
+	end
+	return nil
+end
+
+local function GetRune(condition)
+	local nombre = 0
+	local nombreCD = 0
+	local maxCD = nil
+
+	for i=1,4 do
+		runes[i] = 0
+		runesCD[i] = 0
+	end
+
+	local k=1
+	while true do
+		local type = runeType[condition[k*2-1]]
+		if not type then
+			break
+		end
+		local howMany = condition[k*2]
+		runes[type] = runes[type] + howMany
+		k = k + 1
+	end
+
+	for i=1,6 do
+		local rune = Ovale.state.rune[i]
+		if rune then
+			if runes[rune.type] > 0 then
+				runes[rune.type] = runes[rune.type] - 1
+				if rune.cd > runesCD[rune.type] then
+					runesCD[rune.type] = rune.cd
+				end
+			elseif rune.cd < runesCD[rune.type] then
+				runesCD[rune.type] = rune.cd
+			end
+		end
+	end
+
+	if not condition.nodeath then
+		for i=1,6 do
+			local rune = Ovale.state.rune[i]
+			if rune and rune.type == 4 then
+				for j=1,3 do
+					if runes[j]>0 then
+						runes[j] = runes[j] - 1
+						if rune.cd > runesCD[j] then
+							runesCD[j] = rune.cd
+						end
+						break
+					elseif rune.cd < runesCD[j] then
+						runesCD[j] = rune.cd
+						break
+					end
+				end
+			end
+		end
+	end
+
+	for i=1,4 do
+		if runes[i]> 0 then
+			return nil
+		end
+		if not maxCD or runesCD[i]>maxCD then
+			maxCD = runesCD[i]
+		end
+	end
+	return maxCD
+end
+
 local lastEnergyValue = nil
 local lastEnergyTime

@@ -295,8 +394,12 @@ local function getTargetDead(target)
 		savedHealth[target] = {}
 	end
 	local newHealth = UnitHealth(target)
+	if newHealth then
+		Ovale:Log("newHealth = " .. newHealth)
+	end
 	if UnitHealthMax(target)==1 then
-		return Ovale.maintenant + 10000
+		Ovale:Log("Dummy, return in the future")
+		return nil
 	end
 	if second~=lastSaved[target] and targetGUID[target] then
 		lastSaved[target] = second
@@ -305,14 +408,21 @@ local function getTargetDead(target)
 		savedHealth[target][mod10] = newHealth
 		if prevHealth and prevHealth>newHealth then
 			lastSPD[target] = 10/(prevHealth-newHealth)
---			print("dps = " .. (1/lastSPD))
+			if lastSPD[target] > 0 then
+				Ovale:Log("dps = " .. (1/lastSPD[target]))
+			end
 		end
 	end
-	if not lastSPD[target] then
-		lastSPD[target] = 0.001
+	if not lastSPD[target] or lastSPD[target]<1 then
+		return nil
 	end
 	-- Rough estimation
-	return Ovale.maintenant + newHealth * lastSPD[target]
+	local duration = newHealth * lastSPD[target]
+	if duration < 10000 then
+		return Ovale.maintenant + duration
+	else
+		return nil
+	end
 end

 Ovale.conditions=
@@ -886,56 +996,27 @@ Ovale.conditions=
 		return OvaleSwing:GetNext(condition[1]) - Ovale.currentTime, 0, -1
 	end,
 	OtherDebuffExpires = function(condition)
-		Ovale:EnableOtherDebuffs()
-		local otherDebuff = Ovale.otherDebuffs[condition[1]]
-		if otherDebuff then
+		local minTime, maxTime = getOtherAura(condition[1], condition[3])
+		if minTime then
 			local timeBefore = condition[2] or 0
-			local maxTime = condition[3] or 10
-			local minTime
-			for k,v in pairs(otherDebuff) do
-				local diff = v
-				if Ovale.maintenant-maxTime>diff then
-					-- Ovale:Print("enlève obsolète sur "..k)
-					otherDebuff[k] = nil
-				elseif k~=UnitGUID("target") and (not minTime or diff<minTime) then
-					minTime = diff
-				end
-			end
-			if not minTime then
-				return nil
-			end
-			minTime = minTime - timeBefore
-			return minTime
+			return minTime - timeBefore
 		end
 		return nil
 	end,
 	OtherDebuffPresent = function(condition)
-		Ovale:EnableOtherDebuffs()
-		local otherDebuff = Ovale.otherDebuffs[condition[1]]
-		if otherDebuff then
-		--	print("otherDebuff")
-			local maxTime = 0
-			local suppTime = condition[3] or 10
-			for target,expireTime in pairs(otherDebuff) do
-		--		print("target "..target.. " "..expireTime)
-				if target~=UnitGUID("target") then
-					if Ovale.maintenant - suppTime > expireTime then
-						otherDebuff[target] = nil
-					elseif expireTime > maxTime then
-						maxTime = expireTime
-					end
-				end
-			end
-		--	print("maxTime final "..maxTime)
-			if maxTime>0 then
-				local timeBefore = condition[2] or 0
-				return 0, addTime(maxTime, -timeBefore)
-			else
-				return nil
-			end
+		local minTime, maxTime = getOtherAura(condition[1], condition[3])
+		if maxTime and maxTime>0 then
+			local timeBefore = condition[2] or 0
+			return 0, addTime(maxTime, -timeBefore)
 		end
 		return nil
 	end,
+	OtherAuraExpires = OtherDebuffExpires,
+	OtherAuraPresent = OtherDebuffPresent,
+	otherAura = function(condition)
+		local minTime, maxTime = getOtherAura(condition[1])
+		return 0, maxTime, -1
+	end,
 	Present = function(condition)
 		local present = UnitExists(getTarget(condition.target)) and not UnitIsDead(getTarget(condition.target))
 		return testbool(present, condition[1])
@@ -946,71 +1027,6 @@ Ovale.conditions=
 		local present = UnitExists("pet") and not UnitIsDead("pet")
 		return testbool(present, condition[1])
 	end,
-	Runes = function(condition)
-		local nombre = 0
-		local nombreCD = 0
-		local maxCD = nil
-
-		for i=1,4 do
-			runes[i] = 0
-			runesCD[i] = 0
-		end
-
-		local k=1
-		while true do
-			local type = runeType[condition[k*2-1]]
-			if not type then
-				break
-			end
-			local howMany = condition[k*2]
-			runes[type] = runes[type] + howMany
-			k = k + 1
-		end
-
-		for i=1,6 do
-			local rune = Ovale.state.rune[i]
-			if rune then
-				if runes[rune.type] > 0 then
-					runes[rune.type] = runes[rune.type] - 1
-					if rune.cd > runesCD[rune.type] then
-						runesCD[rune.type] = rune.cd
-					end
-				elseif rune.cd < runesCD[rune.type] then
-					runesCD[rune.type] = rune.cd
-				end
-			end
-		end
-
-		if not condition.nodeath then
-			for i=1,6 do
-				local rune = Ovale.state.rune[i]
-				if rune and rune.type == 4 then
-					for j=1,3 do
-						if runes[j]>0 then
-							runes[j] = runes[j] - 1
-							if rune.cd > runesCD[j] then
-								runesCD[j] = rune.cd
-							end
-							break
-						elseif rune.cd < runesCD[j] then
-							runesCD[j] = rune.cd
-							break
-						end
-					end
-				end
-			end
-		end
-
-		for i=1,4 do
-			if runes[i]> 0 then
-				return nil
-			end
-			if not maxCD or runesCD[i]>maxCD then
-				maxCD = runesCD[i]
-			end
-		end
-		return maxCD
-	end,
 	-- Test the target level difference with the player
 	-- 1 : "less" or "more"
 	-- 2 : [target level]-[player level] limit
@@ -1032,6 +1048,19 @@ Ovale.conditions=
 		end
 		return 0, endTime/1000, -1
 	end,
+	Runes = function(condition)
+		return GetRune(condition)
+	end,
+	runes = function(condition)
+		local ret = GetRune(condition)
+		if not ret then
+			return nil
+		end
+		if ret < Ovale.maintenant then
+			ret = Ovale.maintenant
+		end
+		return 0, ret, -1
+	end,
 	SoulShards = function(condition)
 		return compare(Ovale.state.shard, condition[1], condition[2])
 	end,
@@ -1113,7 +1142,11 @@ Ovale.conditions=
 		return avecHate(condition[1], "spell"),0,0
 	end,
 	TotemExpires = function(condition)
-		local haveTotem, totemName, startTime, duration = GetTotemInfo(totemType[condition[1]])
+		if type(condition[1]) ~= "number" then
+			condition[1] = totemType[condition[1]]
+		end
+
+		local haveTotem, totemName, startTime, duration = GetTotemInfo(condition[1])
 		if not startTime then
 			return 0
 		end
@@ -1123,7 +1156,11 @@ Ovale.conditions=
 		return addTime(startTime + duration, -(condition[2] or 0))
 	end,
 	TotemPresent = function(condition)
-		local haveTotem, totemName, startTime, duration = GetTotemInfo(totemType[condition[1]])
+		if type(condition[1]) ~= "number" then
+			condition[1] = totemType[condition[1]]
+		end
+
+		local haveTotem, totemName, startTime, duration = GetTotemInfo(condition[1])
 		if not startTime then
 			return nil
 		end
diff --git a/Ovale.lua b/Ovale.lua
index 88a1cc0..1f6e3ce 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -55,7 +55,7 @@ Ovale.state = {rune={}, cd = {}, counter={}}
 --spells that count for scoring
 Ovale.scoreSpell = {}
 --tracks debuffs on the units that are not the current target
-Ovale.otherDebuffs = {}
+Ovale.otherAura = {}
 --score in current combat
 Ovale.score = 0
 --maximal theoric score in current combat
@@ -665,11 +665,11 @@ function Ovale:OnInitialize()
 	self.AceConfigDialog = LibStub("AceConfigDialog-3.0");
 end

-function Ovale:GetOtherDebuffs(spellId)
-	if not self.otherDebuffs[spellId] then
-		self.otherDebuffs[spellId] = {}
+function Ovale:GetOtherAura(spellId)
+	if not self.otherAura[spellId] then
+		self.otherAura[spellId] = {}
 	end
-	return self.otherDebuffs[spellId]
+	return self.otherAura[spellId]
 end

 function Ovale:WithHaste(temps, hate)
@@ -879,12 +879,13 @@ function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
 				end
 			end
 		end
-		if self.otherDebuffsEnabled then
+		if self.otherAurasEnabled then
 			--Track debuffs on units that are not the current target
 			if string.find(event, "SPELL_AURA_") == 1 then
 				local spellId, spellName, spellSchool, auraType = select(12, ...)
-				if auraType == "DEBUFF" and self.spellInfo[spellId] and self.spellInfo[spellId].duration then
-					local otherDebuff = self:GetOtherDebuffs(spellId)
+				-- auraType == "DEBUFF" and
+				if self.spellInfo[spellId] and self.spellInfo[spellId].duration then
+					local otherDebuff = self:GetOtherAura(spellId)
 					if event == "SPELL_AURA_APPLIED" or event == "SPELL_AURA_REFRESH" then
 						otherDebuff[destGUID] = Ovale.maintenant + self:WithHaste(self.spellInfo[spellId].duration, self.spellInfo[spellId].durationhaste)
 						self.refreshNeeded = true
@@ -929,10 +930,10 @@ function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
 		end
 	end

-	if self.otherDebuffsEnabled then
+	if self.otherAurasEnabled then
 		if event == "UNIT_DIED" then
-			--Remove any dead unit from otherDebuffs
-			for k,v in pairs(self.otherDebuffs) do
+			--Remove any dead unit from otherAura
+			for k,v in pairs(self.otherAura) do
 				for j,w in pairs(v) do
 					if j==destGUID then
 						v[j] = nil
@@ -2214,7 +2215,7 @@ function Ovale:CalculerMeilleureAction(element)
 		local startA, endA, prioA, elementA = self:CalculerMeilleureAction(element.a)
 		local startB, endB, prioB, elementB = self:CalculerMeilleureAction(element.b)
 		if not elementA or not elementB then
-			self:Log("operator: a or x is nil")
+			self:Log("operator " .. element.operator .. ": elementA or elementB is nil")
 			return nil
 		end
 		local a = elementA.value
@@ -2225,7 +2226,7 @@ function Ovale:CalculerMeilleureAction(element)
 		local z = elementB.rate

 		if not a or not x then
-			self:Log("operator: a or x is nil")
+			self:Log("operator " .. element.operator .. ": a or x is nil")
 			return nil
 		end

@@ -2308,6 +2309,7 @@ function Ovale:CalculerMeilleureAction(element)
 		result.value = l
 		result.origin = m
 		result.rate = n
+		self:Log("result = " .. l .." + "..m.."*"..n)
 		return startA, endA, 3, result
 	elseif element.type == "lua" then
 		local ret = loadstring(element.lua)()
@@ -2542,11 +2544,11 @@ function Ovale:ResetSpellInfo()
 	self.spellInfo = {}
 end

-function Ovale:EnableOtherDebuffs()
-	if self.otherDebuffsEnabled then
+function Ovale:EnableOtherAuras()
+	if self.otherAurasEnabled then
 		return
 	end
-	self.otherDebuffsEnabled = true
+	self.otherAurasEnabled = true
 end

 function Ovale:SetCheckBox(v,on)
diff --git a/Ovale.toc b/Ovale.toc
index 350079b..f127fd8 100644
--- a/Ovale.toc
+++ b/Ovale.toc
@@ -3,7 +3,7 @@
 ## Notes: Show the icon of the next spell to cast
 ## Notes-frFR: Affiche l'icône du prochain sort à lancer
 ## Author: Sidoine
-## Version: 4.3.4
+## Version: 4.3.5
 ## OptionalDeps: Ace3, Masque, Recount, Skada, LibBabble-CreatureType-3.0, LibRangeCheck-2.0
 ## SavedVariables: OvaleDB
 ## SavedVariablesPerCharacter: OvaleDBPC
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index ca3848f..3124e54 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -339,6 +339,16 @@ local function ParseCommands(text)
 		local was = text
 		text = string.gsub(text, "(%w+)%.?(%w*)%s*%((.-)%)", ParseFunction)
 		text = string.gsub(text, "(%d+%.?%d*)s", ParseTime)
+		text = string.gsub(text, "([^%w])(%d+%.?%d*)", ParseNumber)
+		text = string.gsub(text, "node(%d+)%s*([%*%+%-%/])%s*node(%d+)", ParseOp)
+		if was == text then
+			break
+		end
+	end
+
+	while (1==1) do
+		local was = text
+		text = string.gsub(text, "node(%d+)%s*([%>%<])%s*node(%d+)", ParseOp)
 		text = string.gsub(text, "between%s+node(%d+)%s+and%s+node(%d+)", ParseBetween)
 		text = string.gsub(text, "from%s+node(%d+)%s+until%s+node(%d+)", ParseFromUntil)
 		text = string.gsub(text, "(more)%s+than%s+node(%d+)%s+node(%d+)", ParseCompare)
@@ -347,8 +357,6 @@ local function ParseCommands(text)
 		text = string.gsub(text, "(at most)%s+node(%d+)%s+node(%d+)", ParseCompare)
 		text = string.gsub(text, "node(%d+)%s+before%s+node(%d+)", ParseBefore)
 		text = string.gsub(text, "node(%d+)%s+after%s+node(%d+)", ParseAfter)
-		text = string.gsub(text, "([^%w])(%d+%.?%d*)", ParseNumber)
-		text = string.gsub(text, "node(%d+)%s*([%*%+%-%/%>%<])%s*node(%d+)", ParseOp)
 		if (was == text) then
 			break
 		end
diff --git a/defaut/Chaman.lua b/defaut/Chaman.lua
index 4678546..548c410 100644
--- a/defaut/Chaman.lua
+++ b/defaut/Chaman.lua
@@ -111,17 +111,18 @@ AddIcon help=main mastery=1
 	#/unleash_elements,moving=1
 	if Speed(more 0) and Glyph(GLYPHOFUNLEASHEDLIGHTNING no) Spell(UNLEASHELEMENTS)

-	#/flame_shock,if=!ticking|ticks_remain<3
-	if TargetDebuffExpires(FLAMESHOCK 3 mine=1) Spell(FLAMESHOCK)
+	#/flame_shock,if=!ticking|ticks_remain<2|((buff.bloodlust.react|buff.elemental_mastery.up)&ticks_remain<3)
+	if TargetDebuffExpires(FLAMESHOCK 3 haste=spell mine=1) or {{BuffPresent(heroism) or BuffPresent(ELEMENTALMASTERY)} and TargetDebuffExpires(FLAMESHOCK 6 haste=spell mine=1)}
+		Spell(FLAMESHOCK)

-	#/lava_burst,if=dot.flame_shock.remains>(cast_time+travel_time)
-	if target.debuffExpires(FLAMESHOCK mine=1) > {castTime(LAVABURST) + 1 } Spell(LAVABURST)
+	#/lava_burst,if=dot.flame_shock.remains>cast_time
+	if target.debuffExpires(FLAMESHOCK mine=1) > castTime(LAVABURST) Spell(LAVABURST)

 	#/earth_shock,if=buff.lightning_shield.stack=9
 	if BuffPresent(LIGHTNINGSHIELD stacks=9) Spell(EARTHSHOCK)
 	#/earth_shock,if=buff.lightning_shield.stack>6&dot.flame_shock.remains>cooldown&dot.flame_shock.remains<cooldown+action.flame_shock.tick_time
-	if BuffPresent(LIGHTNINGSHIELD stacks=7) and { target.debuffExpires(FLAMESHOCK mine=1) > spell(LAVABURST) }
-			and { target.debuffExpires(FLAMESHOCK mine=1) < spell(LAVABURST) + timeWithHaste(3) } Spell(EARTHSHOCK)
+	if BuffPresent(LIGHTNINGSHIELD stacks=7) and { target.debuffExpires(FLAMESHOCK mine=1) > spell(EARTHSHOCK) }
+			and { target.debuffExpires(FLAMESHOCK mine=1) < spell(EARTHSHOCK) + timeWithHaste(3) } Spell(EARTHSHOCK)

 	if TotemExpires(fire) Spell(SEARINGTOTEM)
 	#/spiritwalkers_grace,moving=1
@@ -137,6 +138,14 @@ AddIcon help=aoe mastery=1 checkboxon=aoe
 	Spell(CHAINLIGHTNING)
 }

+AddIcon help=cd mastery=1
+{
+	Spell(ELEMENTALMASTERY)
+	Item(Trinket0Slot usable=1)
+	Item(Trinket1Slot usable=1)
+	Spell(FIREELEMENTALTOTEM)
+}
+
 AddIcon help=main mastery=2
 {
 	unless InCombat()
@@ -189,27 +198,12 @@ AddIcon help=aoe mastery=2 checkboxon=aoe
 	Spell(LAVABURST)
 }

-AddIcon help=cd
+AddIcon help=cd mastery=2
 {
-	Spell(ELEMENTALMASTERY)
 	Spell(FERALSPIRIT)
 	Item(Trinket0Slot usable=1)
 	Item(Trinket1Slot usable=1)
 	Spell(FIREELEMENTALTOTEM)
 }

-AddIcon size=small help=mana
-{
-	if ManaPercent(less 25)
-		Spell(SHAMANISTICRAGE)
-	if ManaPercent(less 50)
-		Spell(THUNDERSTORM)
-}
-
-AddIcon size=small
-{
-	Spell(HEROISM)
-	Spell(BLOODLUST)
-}
-
 ]]
\ No newline at end of file
diff --git a/defaut/Chevalier.lua b/defaut/Chevalier.lua
index 9be7d5d..a971546 100644
--- a/defaut/Chevalier.lua
+++ b/defaut/Chevalier.lua
@@ -83,10 +83,8 @@ Define(VAMPIRICBLOOD 55233) #blood
 	SpellAddBuff(VAMPIRICBLOOD VAMPIRICBLOOD=10)

 #Talents
-#Define(TALENTDEATSTRIKE 2259)
-#Define(TALENTFROSTSTRIKE 1975)
-#Define(TALENTHEARTSTRIKE 1957)
-#Define(TALENTBLOODYSTRIKES 2015)
+Define(TALENTIMPROVEDBLOODTAP 12223)
+Define(TALENTEPIDEMIC 1963)

 #Glyphs
 Define(GLYPHHOWLINGBLAST 63335)
@@ -118,11 +116,11 @@ ScoreSpells(HOWLINGBLAST HEARTSTRIKE BLOODSTRIKE DEATHSTRIKE SCOURGESTRIKE OBLIT

 AddIcon help=main mastery=1
 {
-
 	if BuffExpires(strengthagility 2) and CheckBoxOn(horn) Spell(HORNOFWINTER)
+
 	if TargetDebuffExpires(BLOODPLAGUE 0 mine=1) and TargetDebuffExpires(FROSTFEVER 0 mine=1) Spell(OUTBREAK)
-	if TargetDebuffExpires(lowerphysicaldamage) and CheckBoxOn(scarlet) and TargetClassification(worldboss)
-		if Runes(unholy 1) Spell(PLAGUESTRIKE)
+	if TargetDebuffExpires(FROSTFEVER 0 mine=1) and Runes(frost 1) Spell(ICYTOUCH)
+	if TargetDebuffExpires(BLOODPLAGUE 0 mine=1) and Runes(unholy 1) Spell(PLAGUESTRIKE)
 	unless Spell(DANCINGRUNEWEAPON) if CheckBoxOff(mindfreeze) or Mana(more 49) Spell(RUNESTRIKE usable=1)
 	if Spell(DANCINGRUNEWEAPON) and Mana(more 59) Spell(RUNESTRIKE usable=1)

@@ -166,7 +164,9 @@ AddIcon help=aoe mastery=1

 AddIcon help=cd mastery=1
 {
+	#bone_shield,if=!buff.bone_shield.up
 	unless BuffPresent(BONESHIELD) Spell(BONESHIELD)
+	#raise_dead,time>=10
 	unless TotemPresent(ghoul) Spell(RAISEDEAD)
 	if TotemPresent(ghoul) and LifePercent(less 61) and Mana(more 39) Spell(DEATHPACT)
 	Spell(DANCINGRUNEWEAPON usable=1)
@@ -175,57 +175,57 @@ AddIcon help=cd mastery=1
 	Spell(ICEBOUNDFORTITUDE usable=1)
 }

+AddFunction diseasesRefresh
+{
+	0
+	if TalentPoints(IMPROVEDBLOODTAP more 0) 2
+	if TalentPoints(EPIDEMIC equal 3) 1
+	if TalentPoints(EPIDEMIC equal 2) 0
+}
+
 AddIcon help=main mastery=2
 {
 	if BuffExpires(strengthagility 2) and CheckBoxOn(horn) Spell(HORNOFWINTER)

 	#/outbreak,if=dot.frost_fever.remains<=2|dot.blood_plague.remains<=2
-	if TargetDebuffExpires(BLOODPLAGUE 2 mine=1) and TargetDebuffExpires(FROSTFEVER 2 mine=1) Spell(OUTBREAK)
+	if target.debuffExpires(BLOODPLAGUE mine=1) < diseasesRefresh()
+		or target.debuffExpires(FROSTFEVER mine=1) < diseasesRefresh()
+		Spell(OUTBREAK)
 	#/howling_blast,if=dot.frost_fever.remains<=2
-	if TargetDebuffExpires(FROSTFEVER 2 mine=1) and Runes(frost 1)
-	{
-		#/howling_blast,if=dot.frost_fever.remains<=2
-		if Glyph(GLYPHHOWLINGBLAST) Spell(HOWLINGBLAST)
-		unless Glyph(GLYPHHOWLINGBLAST) Spell(ICYTOUCH)
-	}
-
+	if target.debuffExpires(FROSTFEVER mine=1) < diseasesRefresh() and Runes(frost 1) Spell(HOWLINGBLAST)
 	#/plague_strike,if=dot.blood_plague.remains<=2
-	if TargetDebuffExpires(BLOODPLAGUE 2 mine=1) and Runes(unholy 1) Spell(PLAGUESTRIKE)
-	#/obliterate,if=frost=2&unholy=2
-	#/obliterate,if=death=2
-	if Runes(unholy 2 frost 2 nodeath=1) or Runes(death 2) Spell(OBLITERATE)
-	#/obliterate,if=buff.killing_machine.react
-	if BuffPresent(KILLINGMACHINE) and Runes(unholy 1 frost 1) Spell(OBLITERATE)
-    #/frost_strike,if=runic_power>=90&!buff.bloodlust.react
-	if Mana(more 89) and BuffExpires(heroism) Spell(FROSTSTRIKE)
-    #/frost_strike,if=runic_power>=95
-	if Mana(more 94) Spell(FORSTSTRIKE)
+	if target.debuffExpires(BLOODPLAGUE mine=1) < diseasesRefresh() and Runes(unholy 1) Spell(PLAGUESTRIKE)
+	#obliterate,if=death>=1&frost>=1&unholy>=1
+	if Runes(death 1 frost 1 unholy 1 nodeath=1) Spell(OBLITERATE)
+	#obliterate,if=(death=2&frost=2)|(death=2&unholy=2)|(frost=2&unholy=2)
+	if Runes(death 2 frost 2 nodeath=1) or Runes(death 2 unholy 2 nodeath=1) or
+		Runes(frost 2 unholy 2 nodeath=1) Spell(OBLITERATE)
+	#frost_strike,if=runic_power>=110
+	if Mana(more 109) Spell(FROSTSTRIKE)
     #/howling_blast,if=buff.rime.react
 	if BuffPresent(FREEZINGFOG) Spell(HOWLINGBLAST)
-    #/howling_blast,if=(death+unholy)=0&!buff.bloodlust.react
-	unless Runes(unholy 1 nodeath=1) or Runes(death 1) or BuffPresent(heroism)
-		if Runes(frost 1) Spell(HOWLINGBLAST)
-	#option to heal with deathstrike
-	if CheckBoxOn(deathstrike) and LifePercent(less 90) and Runes(unholy 1 frost 1) Spell(DEATHSTRIKE)
-	#/obliterate
+	#obliterate,if=(death=2|unholy=2|frost=2)
+	if {Runes(unholy 2) or Runes(frost 2)} and Runes(unholy 1 frost 1) Spell(OBLITERATE)
+	#frost_strike,if=runic_power>=100
+	if Mana(more 99) Spell(FROSTSTRIKE)
+    #obliterate
 	if Runes(unholy 1 frost 1) Spell(OBLITERATE)
-    #/empower_rune_weapon,if=target.time_to_die<=45
-	if TargetDeadIn(less 45) Spell(EMPOWERRUNEWEAPON priority=2)
-    #/frost_strike
+	#frost_strike
 	if CheckBoxOff(mindfreeze) or Mana(more 59) Spell(FROSTSTRIKE usable=1)
-    #/howling_blast
+	#howling_blast
 	if Runes(frost 1) Spell(HOWLINGBLAST)
-	#/horn_of_winter
-	if CheckBoxOn(horn) Spell(HORNOFWINTER priority=2)
 }

 AddIcon help=offgcd mastery=2
 {
 	if target.IsInterruptible() Spell(MINDFREEZE)
-    #/blood_tap
-	Spell(BLOODTAP)
-	#/empower_rune_weapon
-	Spell(EMPOWERRUNEWEAPON)
+    #blood_tap,if=death.cooldown_remains>2.0
+	if runes(death 1) > 2 Spell(BLOODTAP)
+	#empower_rune_weapon,if=target.time_to_die<=45
+	if TargetDeadIn(less 45) Spell(EMPOWERRUNEWEAPON)
+	#empower_rune_weapon,if=(blood.cooldown_remains+frost.cooldown_remains+unholy.cooldown_remains)>8
+	if runes(blood 1) + runes(frost 1) + runes(unholy 1) > 8
+		Spell(EMPOWERRUNEWEAPON)
 }

 AddIcon help=aoe mastery=2
@@ -249,12 +249,9 @@ AddIcon help=cd mastery=2
 	if Runes(frost 1) Spell(PILLAROFFROST)
 	#/blood_tap,if=death!=2
 	unless Runes(death 2) Spell(BLOODTAP)
-	#/raise_dead,if=buff.rune_of_the_fallen_crusader.react
 	#/raise_dead,time>=15
-	unless TotemPresent(ghoul) if TimeInCombat(more 15) or BuffPresent(UNHOLYSTRENGTHBUFF) Spell(RAISEDEAD priority=2)
-	#/empower_rune_weapon,if=target.time_to_die<=120&buff.killing_machine.react
-	if TargetDeadIn(less 120) and BuffPresent(KILLINGMACHINE) Spell(EMPOWERRUNEWEAPON)
-	Item(Trinket0Slot usable=1)
+	unless TotemPresent(ghoul) if TimeInCombat(more 15) Spell(RAISEDEAD)
+    Item(Trinket0Slot usable=1)
 	Item(Trinket1Slot usable=1)
 }

diff --git a/defaut/Druide.lua b/defaut/Druide.lua
index ce9e3ac..bf1e4f9 100644
--- a/defaut/Druide.lua
+++ b/defaut/Druide.lua
@@ -82,6 +82,8 @@ Define(TIGERSFURY 5217) #cat buff
 	SpellAddBuff(TIGERSFURY TIGERSFURY=6)
 Define(TYPHOON 50516)
 	SpellInfo(TYPHOON cd=20)
+Define(WILDMUSHROOM 88747)
+Define(WILDMUSHROOMDETONATE 88751)
 Define(WRATH 5176) #moonkin
 	SpellInfo(WRATH eclipse=-13)

@@ -181,6 +183,12 @@ AddIcon help=main mastery=1
 	Spell(STARFIRE)
 }

+AddIcon help=aoe mastery=1
+{
+	if TotemPresent(1) and TotemPresent(2) and TotemPresent(3) Spell(WILDMUSHROOMDETONATE)
+	if TotemExpires(1) or TotemExpires(2) or TotemExpires(3) Spell(WILDMUSHROOM)
+}
+
 AddIcon help=cd mastery=1
 {
 	#/starfall,if=buff.lunar_eclipse.up&buff.t11_4pc_caster.down
diff --git a/defaut/Paladin.lua b/defaut/Paladin.lua
index 87a7855..9229bc6 100644
--- a/defaut/Paladin.lua
+++ b/defaut/Paladin.lua
@@ -72,6 +72,8 @@ Define(THEARTOFWAR 59578)
 Define(JUDGEMENTSOFTHEPURE 53655)
 Define(DIVINEPURPOSE 90174)
 Define(INFUSIONOFLIGHT 54149)
+Define(SACREDDUTY 85433)
+Define(GRANDCRUSADER 85416)

 ScoreSpells(SHIELDOFTHERIGHTEOUS JUDGEMENT AVENGERSSHIELD HAMMEROFTHERIGHTEOUS CONSECRATE HOLYWRATH
 	ZEALOTRY  INQUISITION TEMPLARSVERDICT DIVINESTORM EXORCISM HAMMEROFWRATH JUDGEMENT CRUSADERSTRIKE)
@@ -118,14 +120,32 @@ AddIcon help=main mastery=2
 	if BuffExpires(RIGHTEOUSFURY) Spell(RIGHTEOUSFURY)
 	unless InCombat() if BuffExpires(SEALRIGHTEOUSNESS 400) and BuffExpires(SEALOFTRUTH 400) Spell(SEALOFTRUTH)

-	if HolyPower(more 2) Spell(SHIELDOFTHERIGHTEOUS)
-	Spell(CRUSADERSTRIKE)
-
+	#shield_of_the_righteous,if=holy_power=3&(buff.sacred_duty.up|buff.inquisition.up)
+	if HolyPower(more 2) and {BuffPresent(SACREDDUTY) or BuffPresent(INQUISITION)} Spell(SHIELDOFTHERIGHTEOUS)
+	#judgement,if=holy_power=3
+	if HolyPower(more 2) Spell(JUDGEMENT)
+	#inquisition,if=holy_power=3&(buff.inquisition.down|buff.inquisition.remains<5)
+	if HolyPower(more 2) and BuffExpires(INQUISITION 5) Spell(INQUISITION)
+	#divine_plea,if=holy_power<2
+	if HolyPower(less 2) Spell(DIVINEPLEA)
+	#avengers_shield,if=buff.grand_crusader.up&holy_power<3
+	if BuffPresent(GRANDCRUSADER) and HolyPower(less 3) Spell(AVENGERSSHIELD)
+	#judgement,if=buff.judgements_of_the_pure.down
+	if BuffExpires(JUDGEMENTSOFTHEPURE) Spell(JUDGEMENT)
+	#crusader_strike,if=holy_power<3
+	if HolyPower(less 3) Spell(CRUSADERSTRIKE)
+	#hammer_of_wrath
+	if TargetLifePercent(less 20) or BuffPresent(AVENGINGWRATH) Spell(HAMMEROFWRATH)
+	#avengers_shield,if=cooldown.crusader_strike.remains>=0.2
+	if spell(CRUSADERSTRIKE)>0.2 Spell(AVENGERSSHIELD)
+	#judgement
 	Spell(JUDGEMENT)
-	Spell(AVENGERSSHIELD)
+	#consecration
+	Spell(CONSECRATE)
+	#holy_wrath
 	Spell(HOLYWRATH)
-	Spell(CONSECRATE priority=2)
-	Spell(DIVINEPLEA priority=2)
+	#divine_plea,if=holy_power<1
+	if HolyPower(less 1) Spell(DIVINEPLEA)
 }

 AddIcon help=offgcd mastery=2
@@ -161,27 +181,25 @@ AddIcon help=main mastery=3

 	#judgement,if=buff.judgements_of_the_pure.down
 	if BuffExpires(JUDGEMENTSOFTHEPURE 0) Spell(JUDGEMENT)
-	#inquisition,if=(buff.inquisition.down|buff.inquisition.remains<5)&(buff.holy_power.react==3|buff.hand_of_light.react)
-	if BuffExpires(INQUISITION 5) and {HolyPower(equal 3) or BuffPresent(DIVINEPURPOSE)} Spell(INQUISITION)
-	#templars_verdict,if=buff.holy_power.react==3
-	if HolyPower(more 2) Spell(TEMPLARSVERDICT)
-	#crusader_strike,if=buff.hand_of_light.react&(buff.hand_of_light.remains>2)&(buff.holy_power.react<3)
-	if BuffPresent(DIVINEPURPOSE 3) and HolyPower(less 3) Spell(CRUSADERSTRIKE)
-	#templars_verdict,if=buff.hand_of_light.react
+	#crusader_strike,if=holy_power<3
+	if HolyPower(less 3) Spell(CRUSADERSTRIKE)
+	#judgement,if=buff.zealotry.down&holy_power<3
+	if BuffExpires(ZEALOTRY) and HolyPower(less 3) Spell(JUDGEMENT)
+	#inquisition,if=(buff.inquisition.down|buff.inquisition.remains<=2)&(holy_power>=3|buff.divine_purpose.react)
+	if BuffExpires(INQUISITION 2) and {HolyPower(equal 3) or BuffPresent(DIVINEPURPOSE)} Spell(INQUISITION)
+	#templars_verdict,if=buff.divine_purpose.react
 	if BuffPresent(DIVINEPURPOSE) Spell(TEMPLARSVERDICT)
-	#crusader_strike
-	Spell(CRUSADERSTRIKE)
-	#hammer_of_wrath
-	if TargetLifePercent(less 20) or BuffPresent(AVENGINGWRATH) Spell(HAMMEROFWRATH)
+	#templars_verdict,if=holy_power=3
+	if HolyPower(more 2) Spell(TEMPLARSVERDICT)
 	#exorcism,if=buff.the_art_of_war.react
 	if BuffPresent(THEARTOFWAR) Spell(EXORCISM)
-	#judgement,if=buff.judgements_of_the_pure.remains<2
-	if BuffExpires(JUDGEMENTSOFTHEPURE 2) Spell(JUDGEMENT)
+	#hammer_of_wrath
+	if TargetLifePercent(less 20) or BuffPresent(AVENGINGWRATH) Spell(HAMMEROFWRATH)
+	#judgement,if=set_bonus.tier13_2pc_melee&buff.zealotry.up&holy_power<3
+	if ArmorSetParts(T13 more 1) and BuffPresent(ZEALOTRY) and HolyPower(less 3) Spell(JUDGEMENT)
 	#wait,sec=0.1,if=cooldown.crusader_strike.remains<0.5
-	unless 0.5 before Spell(CRUSADERSTRIKE)
+	if spell(CRUSADERSTRIKE) > 0.5
 	{
-		#judgement
-		Spell(JUDGEMENT)
 		#holy_wrath
 		Spell(HOLYWRATH)
 		#divine_plea
@@ -203,12 +221,12 @@ AddIcon help=aoe mastery=3 checkboxon=aoe

 AddIcon help=cd mastery=3
 {
-	#/zealotry
-	Spell(ZEALOTRY)
-    #/guardian_of_ancient_kings,if=buff.zealotry.remains<31|cooldown.zealotry.remains>60
-	if BuffExpires(ZEALOTRY 31) or {spell(ZEALOTRY)>60}	Spell(GUARDIANOFANCIENTKINGS)
-	#/avenging_wrath,if=buff.zealotry.remains<21
-	if BuffExpires(ZEALOTRY 21)
+    #/guardian_of_ancient_kings,if=cooldown.zealotry.remains<10
+	if spell(ZEALOTRY)<10 Spell(GUARDIANOFANCIENTKINGS)
+	#/zealotry,if=cooldown.guardian_of_ancient_kings.remains>0&cooldown.guardian_of_ancient_kings.remains<292
+	if {spell(GUARDIANOFANCIENTKINGS)>0} and {spell(GUARDIANOFANCIENTKINGS)<292} Spell(ZEALOTRY)
+	#/avenging_wrath,if=buff.zealotry.up
+	if BuffPresent(ZEALOTRY)
 		Spell(AVENGINGWRATH)
 	Item(Trinket0Slot usable=1)
     Item(Trinket1Slot usable=1)