Quantcast

- fix with Macro command

Sidoine De Wispelaere [01-08-11 - 16:40]
- fix with Macro command
- fix with pet abilities
- new priest script
- new unholy dk script
- added target magical crit chance debuff
- added LastSpellDamage function

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@342 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
Ovale.lua
Ovale.toc
defaut/Chevalier.lua
defaut/Demoniste.lua
defaut/Pretre.lua
diff --git a/Condition.lua b/Condition.lua
index 9dd4b3d..5b7a7af 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -503,6 +503,13 @@ Ovale.conditions=
 		buildStunSpellList()
 		return testbool(not HasFullControl() and isDebuffInList(stunSpellList), condition[1])
 	end,
+	LastSpellDamage = function(condition)
+		local spellId = condition[1]
+		if not Ovale.spellDamage[spellId] then
+			return nil
+		end
+		return compare(Ovale.spellDamage[spellId], condition[2], condition[3])
+	end,
 	-- Compare with the player level
 	-- 1 : "less" or "more"
 	-- 2 : the limit
diff --git a/Ovale.lua b/Ovale.lua
index ab5826b..ed13f52 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -69,6 +69,8 @@ Ovale.counter = {}
 --the spells that the player has casted but that did not reach their target
 --the result is computed by the simulator, allowing to ignore lag or missile travel time
 Ovale.lastSpell = {}
+--the damage of the last spell or dot (by id)
+Ovale.spellDamage = {}

 Ovale.buffSpellList =
 {
@@ -133,6 +135,11 @@ Ovale.buffSpellList =
 		34889, --Fire Breath (Dragonhawk)
 		24844 --Lightning Breath (Wind serpent)
 	},
+	magicalcrittaken=
+    {
+        17800, -- Shadow and Flame
+        22959 -- Critical Mass
+    },
 	-- physicaldamagetaken
 	lowerphysicaldamage=
 	{
@@ -502,15 +509,23 @@ local options =
 					name = "List player spells",
 					type = "execute",
 					func = function()
-						local i=1
+						local book=BOOKTYPE_SPELL
 						while true do
-							local skillType, spellId = GetSpellBookItemInfo(i, BOOKTYPE_SPELL)
-							if not spellId then
+							local i=1
+							while true do
+								local skillType, spellId = GetSpellBookItemInfo(i, book)
+								if not spellId then
+									break
+								end
+								local spellName = GetSpellBookItemName(i, book)
+								Ovale:Print(spellName..": "..spellId)
+								i = i + 1
+							end
+							if book == BOOKTYPE_SPELL then
+								book = BOOKTYPE_PET
+							else
 								break
 							end
-							local spellName = GetSpellBookItemName(i, BOOKTYPE_SPELL)
-							Ovale:Print(spellName..": "..spellId)
-							i = i + 1
 						end
 					end
 				}
@@ -727,9 +742,16 @@ function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
 	local time, event, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = select(1, ...)
 	if sourceName == UnitName("player") then
 		--self:Print("event="..event.." source="..nilstring(sourceName).." destName="..nilstring(destName).." " ..GetTime())
+
+		if string.find(event, "SPELL_PERIODIC_DAMAGE")==1 or string.find(event, "SPELL_DAMAGE")==1 then
+			local spellId, spellName, spellSchool, amount = select(9, ...)
+			self.spellDamage[spellId] = amount
+		end
+
 		--Called when a missile reached or missed its target
 		--Update lastSpell accordingly
 		--Do not use SPELL_CAST_SUCCESS because it is sent when the missile has not reached the target
+
 		if
 				string.find(event, "SPELL_AURA_APPLIED")==1
 				or string.find(event, "SPELL_DAMAGE")==1
@@ -1057,8 +1079,8 @@ end

 function Ovale:RemplirActionIndex(i)
 	self.shortCut[i] = self:ChercherShortcut(i)
-	local actionText = GetActionText(i);
-	if (actionText) then
+	local actionText = GetActionText(i)
+	if actionText then
 		self.actionMacro[actionText] = i
 	else
 		local type, spellId = GetActionInfo(i);
@@ -1082,17 +1104,25 @@ end

 function Ovale:FillSpellList()
 	self.spellList = {}
-	local i=1
+	local book=BOOKTYPE_SPELL
 	while true do
-		local skillType, spellId = GetSpellBookItemInfo(i, BOOKTYPE_SPELL)
-		if not spellId then
-			break
+		local i=1
+		while true do
+			local skillType, spellId = GetSpellBookItemInfo(i, book)
+			if not spellId then
+				break
+			end
+			if skillType~="FUTURESPELL" then
+				local spellName = GetSpellBookItemName(i, book)
+				self.spellList[spellId] = spellName
+			end
+			i = i + 1
 		end
-		if skillType~="FUTURESPELL" then
-			local spellName = GetSpellBookItemName(i, BOOKTYPE_SPELL)
-			self.spellList[spellId] = spellName
+		if book==BOOKTYPE_SPELL then
+			book = BOOKTYPE_PET
+		else
+			break
 		end
-		i = i + 1
 	end
 end

@@ -1588,6 +1618,16 @@ function Ovale:GetActionInfo(element)
 		--end
 	elseif (element.func=="Macro") then
 		action = self.actionMacro[element.params[1]]
+		if action then
+			actionTexture = GetActionTexture(action)
+			actionInRange = IsActionInRange(action, target)
+			actionCooldownStart, actionCooldownDuration, actionEnable = GetActionCooldown(action)
+			actionUsable = IsUsableAction(action)
+			actionShortcut = self.shortCut[action]
+			actionIsCurrent = IsCurrentAction(action)
+		else
+			Ovale:Log("Unknown macro "..element.params[1])
+		end
 	elseif (element.func=="Item") then
 		local itemId
 		if (type(element.params[1]) == "number") then
@@ -1623,18 +1663,6 @@ function Ovale:GetActionInfo(element)
 		actionUsable = true
 	end

-	--[[if action and not actionTexture then
-		actionTexture = GetActionTexture(action)
-		actionInRange = IsActionInRange(action, target)
-		if not actionCooldownStart then
-			actionCooldownStart, actionCooldownDuration, actionEnable = GetActionCooldown(action)
-		end
-		if (actionUsable == nil) then
-			actionUsable = IsUsableAction(action)
-		end
-		actionShortcut = self.shortCut[action]
-		actionIsCurrent = IsCurrentAction(action)
-	end]]
 	if action then
 		if actionUsable == nil then
 			actionUsable = IsUsableAction(action)
@@ -1668,10 +1696,18 @@ local function addTime(time1, duration)
 	end
 end

+local function isBeforeEqual(time1, time2)
+	return time1 and (not time2 or time1<=time2)
+end
+
 local function isBefore(time1, time2)
 	return time1 and (not time2 or time1<time2)
 end

+local function isAfterEqual(time1, time2)
+	return not time1 or (time2 and time1>=time2)
+end
+
 local function isAfter(time1, time2)
 	return not time1 or (time2 and time1>time2)
 end
@@ -1692,13 +1728,13 @@ function Ovale:CalculerMeilleureAction(element)
 			local actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
 				actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellId = self:GetActionInfo(element)

-			if (not actionTexture) then
+			if not actionTexture then
 				if (Ovale.trace) then
 					self:Print("Action "..element.params[1].." not found")
 				end
 				return nil
 			end
-			if (element.params.usable==1 and not actionUsable) then
+			if element.params.usable==1 and not actionUsable then
 				if (Ovale.trace) then
 					self:Print("Action "..element.params[1].." not usable")
 				end
@@ -1723,7 +1759,7 @@ function Ovale:CalculerMeilleureAction(element)
 				end
 				return nil
 			end
-			if (actionEnable and actionEnable>0) then
+			if actionEnable and actionEnable>0 then
 				local restant
 				if (not actionCooldownDuration or actionCooldownStart==0) then
 					restant = self.currentTime
@@ -1892,12 +1928,12 @@ function Ovale:CalculerMeilleureAction(element)
 		local startA, endA = Ovale:CalculerMeilleureAction(element.a)
 		local startB, endB, prioriteB, elementB = Ovale:CalculerMeilleureAction(element.b)

-		if isBefore(startA, startB) and isAfter(endA, endB) then
+		if isBeforeEqual(startA, startB) and isAfterEqual(endA, endB) then
 			if Ovale.trace then Ovale:Print(element.type.." return nil") end
 			return nil
 		end

-		if isAfter(startA, startB) and isBefore(endA, endB) then
+		if isAfterEqual(startA, startB) and isBefore(endA, endB) then
 			if Ovale.trace then Ovale:Print(element.type.." return "..nilstring(endA)..","..nilstring(endB)) end
 			return endA, endB, prioriteB, elementB
 		end
diff --git a/Ovale.toc b/Ovale.toc
index 8b677c7..094c3ea 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.0.19
+## Version: 4.0.20
 ## OptionalDeps: Ace3, ButtonFacade, Recount, Skada, LibBabble-CreatureType-3.0
 ## SavedVariables: OvaleDB
 ## SavedVariablesPerCharacter: OvaleDBPC
diff --git a/defaut/Chevalier.lua b/defaut/Chevalier.lua
index ae75e84..066216c 100644
--- a/defaut/Chevalier.lua
+++ b/defaut/Chevalier.lua
@@ -81,6 +81,7 @@ Define(FROSTFEVER 55095)
 Define(KILLINGMACHINE 51124)
 Define(SHADOWINFUSION 91342)
 Define(SUDDENDOOM 81340)
+Define(RUNICCORRUPTION 51459)

 AddCheckBox(horn SpellName(HORNOFWINTER))
 AddCheckBox(scarlet SpellName(SCARLETFEVER) mastery=1 default)
@@ -90,13 +91,13 @@ ScoreSpells(HOWLINGBLAST HEARTSTRIKE BLOODSTRIKE DEATHSTRIKE SCOURGESTRIKE OBLIT

 AddIcon help=main mastery=1
 {
-	Spell(DANCINGRUNEWEAPON usable=1)

 	if BuffExpires(strengthagility 2) and CheckBoxOn(horn) Spell(HORNOFWINTER)
 	if TargetDebuffExpires(lowerphysicaldamage) and CheckBoxOn(scarlet) and TargetClassification(worldboss)
 		if Runes(blood 1) or BuffPresent(BLOODSWARM) Spell(BLOODBOIL)
 	if TargetDebuffExpires(BLOODPLAGUE 0 mine=1) and TargetDebuffExpires(FROSTFEVER 0 mine=1) Spell(OUTBREAK)
 	Spell(RUNESTRIKE usable=1)
+	Spell(DANCINGRUNEWEAPON usable=1)

 	if Runes(unholy 1 frost 1) and {BuffExpires(BLOODSHIELD) or TargetTargetIsPlayer(no)} Spell(DEATHSTRIKE)
 	if Runes(blood 1) Spell(HEARTSTRIKE)
@@ -171,26 +172,26 @@ AddIcon help=aoe mastery=2
 	}
 }

+#Contributed by vitos
 AddIcon help=main mastery=3
 {
 	if BuffExpires(strengthagility 2) and CheckBoxOn(horn) Spell(HORNOFWINTER)
-	if PetPresent(no) Spell(RAISEDEAD)
-
-	if TargetDebuffPresent(FROSTFEVER mine=1) and TargetDebuffPresent(BLOODPLAGUE mine=1)
+	if TargetDebuffExpires(BLOODPLAGUE 0 mine=1) and TargetDebuffExpires(FROSTFEVER 0 mine=1) Spell(OUTBREAK)
+	if Runes(unholy 1) and TargetBuffPresent(SHADOWINFUSION stacks=5 target=pet) Spell(DARKTRANSFORMATION)
+	if Runes(blood 2 frost 2 nodeath=1) Spell(FESTERINGSTRIKE)
+	if Runes(death 4) or Runes(unholy 2) Spell(DEATHANDECAY)
+	if Runes(death 4) or Runes(unholy 2) Spell(SCOURGESTRIKE)
+	unless BuffPresent(RUNICCORRUPTION mine=1)
 	{
-		if Runes(unholy 1) and TargetBuffPresent(SHADOWINFUSION stacks=5 target=pet) Spell(DARKTRANSFORMATION)
 		if BuffPresent(SUDDENDOOM mine=1) Spell(DEATHCOIL usable=1)
-		if Mana(more 90) Spell(DEATHCOIL usable=1)
-		if Runes(unholy 1) Spell(SCOURGESTRIKE)
-        if Runes(blood 1 frost 1 nodeath=1) Spell(FESTERINGSTRIKE)
-	}
-	if TargetDebuffExpires(BLOODPLAGUE 0 mine=1) and TargetDebuffExpires(FROSTFEVER 0 mine=1) Spell(OUTBREAK)
-	if TargetDebuffExpires(FROSTFEVER 0 mine=1) and Runes(frost 1) Spell(ICYTOUCH)
-	if TargetDebuffExpires(BLOODPLAGUE 0 mine=1) and Runes(unholy 1) Spell(PLAGUESTRIKE)
-
-	if Mana(more 34) Spell(DEATHCOIL usable=1)
-
-	if CheckBoxOn(horn) Spell(HORNOFWINTER priority=2)
+		if Mana(more 80) Spell(DEATHCOIL usable=1)
+	}
+	if Runes(blood 1 frost 1 nodeath=1) Spell(FESTERINGSTRIKE)
+	if Runes(unholy 1) Spell(DEATHANDECAY)
+	if Runes(unholy 1) Spell(SCOURGESTRIKE)
+
+	if Mana(more 54) Spell(DEATHCOIL usable=1)
+	Spell(HORNOFWINTER)
 }

 AddIcon help=aoe mastery=3
diff --git a/defaut/Demoniste.lua b/defaut/Demoniste.lua
index 1957c23..fc574d8 100644
--- a/defaut/Demoniste.lua
+++ b/defaut/Demoniste.lua
@@ -42,6 +42,7 @@ Define(SEARINGPAIN 5676)
 Define(SEEDOFCORRUPTION 27243)
 Define(SHADOWBOLT 686)
 	SpellAddTargetDebuff(SHADOWBOLT SHADOWEMBRACE=12)
+	SpellAddTargetDebuff(SHADOWBOLT SHADOWANDFLAMEDEBUFF=30)
 Define(SHADOWBURN 17877)
 Define(SOULFIRE 6353)
 	SpellAddBuff(SOULFIRE IMPROVEDSOULFIREBUFF=15)
@@ -64,10 +65,12 @@ Define(MOLTENCORE 71165)
 Define(EMPOWEREDIMP 47283)
 Define(IMPROVEDSOULFIREBUFF 85383)
 Define(SHADOWTRANCE 17941)
+Define(SHADOWANDFLAMEDEBUFF 17800)

 #Talent
 Define(IMPROVEDSOULFIRE 11197)
-
+Define(SHADOWANDFLAMETALENT 10936)
+
 AddListItem(curse elements SpellName(CURSEELEMENTS))
 AddListItem(curse tongues SpellName(CURSETONGUES))
 AddListItem(curse weakness SpellName(CURSEWEAKNESS))
@@ -161,8 +164,9 @@ AddIcon help=main mastery=3
 	if TargetDebuffExpires(IMMOLATE 2 mine=1 haste=spell) and TargetDeadIn(more 3) Spell(IMMOLATE)
 	if 1s after TargetDebuffPresent(IMMOLATE mine=1) Spell(CONFLAGRATE)
 	if TargetDebuffExpires(CORRUPTION 2 mine=1) and TargetDebuffExpires(SEEDOFCORRUPTION 0 mine=1) and TargetDeadIn(more 9) Spell(CORRUPTION)
-	Spell(CHAOSBOLT)
 	if BuffPresent(EMPOWEREDIMP) or BuffPresent(SOULBURN) Spell(SOULFIRE)
+    if TalentPoints(SHADOWANDFLAMETALENT more 0) and TargetDebuffExpires(magicalcrittaken) Spell(SHADOWBOLT)
+	Spell(CHAOSBOLT)
 	Spell(INCINERATE)
 }

diff --git a/defaut/Pretre.lua b/defaut/Pretre.lua
index ea6e43f..865c32f 100644
--- a/defaut/Pretre.lua
+++ b/defaut/Pretre.lua
@@ -3,58 +3,63 @@ Ovale.defaut["PRIEST"] =
 ### defines ###

 #Buff
-Define(ORB 77487)
-Define(MSEFFECT 87178)
+Define(SHADOWORBS 77487)
+Define(MINDSPIKEEFFECT 87178)
 Define(EVANGELISM 87118)
-Define(DA 87153)
-Define(MM 81292)
+Define(DARKARCHANGEL 87153)
+Define(MINDMELT 81292)
+Define(EMPOWEREDSHADOW 95799)

 #Spells
-Define(DP 2944) # Devouring Plague
-	SpellInfo(DP duration=24 durationhaste=spell)
-	SpellAddTargetDebuff(DP DP=24)
+Define(DEVOURINGPLAGUE 2944) # Devouring Plague
+	SpellInfo(DEVOURINGPLAGUE duration=24 durationhaste=spell)
+	SpellAddTargetDebuff(DEVOURINGPLAGUE DEVOURINGPLAGUE=24)

 Define(DISPERSION 47585)
 	SpellInfo(DISPERSION cd=120)
 	SpellInfo(DISPERSION addcd=-45 glyph=63229)

-Define(INNERFIRE 48168) # Inner Fire
+Define(INNERFIRE 588) # Inner Fire
 	SpellAddBuff(INNERFIRE INNERFIRE=1800)

-Define(MB 8092) # Mind Blast
-	SpellInfo(MB cd=5.5)
-	SpellAddBuff(MB ORB=0)
+Define(INNERWILL 73413) # Inner Will
+	SpellAddBuff(INNERWILL INNERWILL=1800)

-Define(MF 15407) # Mind Flay
+Define(MINDBLAST 8092) # Mind Blast
+	SpellInfo(MINDBLAST cd=5.5)
+	SpellAddBuff(MINDBLAST SHADOW_ORBS=0)
+	SpellAddBuff(MINDBLAST EMPOWEREDSHADOW=15)

-Define(FIEND 34433)
-	SpellInfo(FIEND cd=300)
+Define(MINDFLAY 15407) # Mind Flay
+
+Define(SHADOWFIEND 34433)
+	SpellInfo(SHADOWFIEND cd=300)

 Define(SHADOWFORM 15473) # Shadowform

-Define(SWP 589) # Shadow Word: Pain
-	SpellInfo(SWP duration=18)
-	SpellAddTargetDebuff(SWP SWP=18)
+Define(SHADOWWORDPAIN 589) # Shadow Word: Pain
+	SpellInfo(SHADOWWORDPAIN duration=18)
+	SpellAddTargetDebuff(SHADOWWORDPAIN SHADOWWORDPAIN=18)

-Define(VE 15286) # Vampiric Embrace
+Define(VAMPIRICEMBRACE 15286) # Vampiric Embrace

-Define(VT 34914) # Vampiric Touch
-	SpellInfo(VT duration=15 durationhaste=spell)
-	SpellAddTargetDebuff(VT VT=15)
+Define(VAMPIRICTOUCH 34914) # Vampiric Touch
+	SpellInfo(VAMPIRICTOUCH duration=15 durationhaste=spell)
+	SpellAddTargetDebuff(VAMPIRICTOUCH VAMPIRICTOUCH=15)

-Define(MS 73510) # Mind Spike
-	# TODO : add talent condition for MM
-	SpellAddBuff(MS MSEFFECT=12 MM=6)
+Define(MINDSPIKE 73510) # Mind Spike
+	# TODO : add talent condition for MIND_MELT
+	SpellAddBuff(MINDSPIKE MINDSPIKEEFFECT=12 MINDMELT=6)

-Define(SWD 32379) # Shadow Word : Death
+Define(SHADOWWORDDEATH 32379) # Shadow Word : Death

 Define(ARCHANGEL 87151) #Archangel
 	SpellInfo(ARCHANGEL cd=90)
-	SpellAddBuff(ARCHANGEL DA=18)
+	SpellAddBuff(ARCHANGEL DARKARCHANGEL=18)

 ### end defines ###

-ScoreSpells(MB SWP VT DP MF SWD MS)
+ScoreSpells(MINDBLAST SHADOWWORDPAIN VAMPIRICTOUCH DEVOURINGPLAGUE MINDFLAY SHADOWWORDDEATH MINDSPIKE)

 # Add main monitor
 AddIcon help=main mastery=3
@@ -64,64 +69,68 @@ AddIcon help=main mastery=3

 	unless InCombat()
 	{
-		# Refresh inner fire  and vampiric embrace 10 minutes before it drops when out of combat
-		if BuffExpires(INNERFIRE 600) Spell(INNERFIRE)
-		if BuffExpires(VE 600) Spell(VE)
+		# Refresh inner fire  and vampiric embrace 5 minutes before it drops when out of combat
+		if BuffExpires(INNERFIRE 300) unless BuffPresent(INNERWILL) Spell(INNERFIRE)
+		if BuffExpires(INNERWILL 300) unless BuffPresent(INNERFIRE) Spell(INNERWILL)
+		if BuffExpires(VAMPIRICEMBRACE 300) Spell(VAMPIRICEMBRACE)
 	}

 	# Refresh inner fire and vampiric embrace if they drop during the fight
-	if BuffExpires(INNERFIRE 0) Spell(INNERFIRE)
+	if BuffExpires(INNERFIRE 5) unless BuffPresent(INNERWILL) Spell(INNERFIRE)
+	if BuffExpires(INNERWILL 5) unless BuffPresent(INNERFIRE) Spell(INNERWILL)

-	if BuffExpires(VE 0) Spell(VE)
+	if BuffExpires(VAMPIRICEMBRACE 5) Spell(VAMPIRICEMBRACE)

-	#if your rotation isn't set up and the target has few seconds to live, use MS instead of normal rotation
-	#TODO : adapt the target life
-	if TargetDebuffExpires(SWP 0 mine=1) and TargetDeadIn(less 10)
+	#if your rotation isn't set up and the target has few seconds to live, use MIND_SPIKE instead of normal rotation
+	if TargetDebuffExpires(SHADOWWORDPAIN 0 mine=1) and TargetDeadIn(less 10)
 	{
-		if BuffPresent(MS stacks=3) or BuffPresent(MM stacks=2) Spell(MB)
-		Spell(MS)
+		if BuffPresent(MINDSPIKE stacks=3) or BuffPresent(MINDMELT stacks=2) Spell(MINDBLAST)
+		Spell(MINDSPIKE)
 	}

-	if BuffPresent(DA) #specific DD-based rotation when under Dark Archangel
+	if BuffPresent(DARKARCHANGEL) #specific DD-based rotation when under Dark Archangel
 	{
-		#Use SWD if we have enough life left
-		if TargetLifePercent(less 25) and LifePercent(more 20) Spell(SWD)
-
-		#Use MB on CD
-		if BuffPresent(ORB stacks=3) Spell(MB)
+		#Use SHADOWWORDDEATH if we have enough life left
+		if TargetLifePercent(less 25) and LifePercent(more 20) Spell(SHADOWWORDDEATH)

-		#Fill with MF
-		Spell(MF priority=2)
+		#Use MIND_BLAST on CD
+		if BuffPresent(SHADOWORBS stacks=1) Spell(MINDBLAST)

+		#Fill with MIND_FLAY
+		Spell(MINDFLAY priority=2)
 	}
+
+	#Refresh empowered shadows
+	if BuffPresent(SHADOWORBS stacks=1) and BuffExpires(EMPOWEREDSHADOW 2) Spell(MINDBLAST)

 	#Set up / refresh the dots
-	if TargetDebuffExpires(SWP 0 mine=1) and TargetDeadIn(more 6) Spell(SWP)
-	if TargetDebuffExpires(SWP 2 mine=1) and TargetDeadIn(more 6) Spell(MF)
-	if TargetDebuffExpires(VT 3 mine=1 haste=spell) and TargetDeadIn(more 8) Spell(VT)
+	if TargetDebuffExpires(SHADOWWORDPAIN 0 mine=1) and TargetDeadIn(more 10) Spell(SHADOWWORDPAIN)
+	if TargetDebuffExpires(SHADOWWORDPAIN 2 mine=1) and TargetDeadIn(more 6) Spell(MINDFLAY)
+	if TargetDebuffExpires(VAMPIRICTOUCH 3 mine=1 haste=spell) and TargetDeadIn(more 8) Spell(VAMPIRICTOUCH)

-	# refresh DP only if it is not ticking on another mob
-	unless OtherDebuffPresent(DP)
+	# refresh DEVOURING_PLAGUE only if it is not ticking on another mob
+	unless OtherDebuffPresent(DEVOURINGPLAGUE)
 	{
-		if TargetDebuffExpires(DP 2 mine=1) and TargetDeadIn(more 8) Spell(DP)
+		if TargetDebuffExpires(DEVOURINGPLAGUE 2 mine=1) and TargetDeadIn(more 8) Spell(DEVOURINGPLAGUE)
 	}
+
+	#Use SHADOW_WORD_DEATH if we have enough life left and it is more useful than MIND_BLAST
+	if TargetLifePercent(less 25) and LifePercent(more 20) Spell(SHADOWWORDDEATH)

 	# Launch the fiend
-	Spell(FIEND)
-
-	#Use SWD if we have enough life left and it is more useful than MB
-	if TargetLifePercent(less 25) and LifePercent(more 20) Spell(SWD)
+	if TargetDeadIn(more 15) and ManaPercent(less 75) Spell(SHADOWFIEND)

-        #Use MB when orbs are at 3 stacks
-	if BuffPresent(ORB stacks=3) Spell(MB)
+	#Use MIND_BLAST when orbs are at 1 or more stack
+	if BuffPresent(SHADOWORBS stacks=1) Spell(MINDBLAST)

-	#Fill with MF
-	Spell(MF priority=2)
+	#Fill with MIND_FLAY
+	Spell(MINDFLAY priority=2)
 }

 AddIcon help=cd
 {
-	if BuffPresent(EVANGELISM stacks=5) Spell(ARCHANGEL)
+        #Check that you won't have to reapply dots during DA
+	if BuffPresent(EVANGELISM stacks=5) and TargetDebuffPresent(DEVOURINGPLAGUE 18 mine=1) and TargetDebuffPresent(VAMPIRICTOUCH 18 mine=1) Spell(ARCHANGEL)
 	Item(Trinket0Slot usable=1)
 	Item(Trinket1Slot usable=1)
 }
@@ -138,6 +147,7 @@ AddIcon help=mana mastery=3
 		Item(33447) #Life potion (lvl 80)

 	}
+	if ManaPercent(less 80) Spell(SHADOWWORDDEATH)
 	if ManaPercent(less 5)
 	{
 		Spell(DISPERSION)