Quantcast

Warlock: Update Affliction script to 5.4.7.

Johnny C. Lam [05-08-14 - 17:27]
Warlock: Update Affliction script to 5.4.7.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1405 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleSimulationCraft.lua
scripts/ovale_warlock.lua
scripts/ovale_warlock_spells.lua
diff --git a/OvaleSimulationCraft.lua b/OvaleSimulationCraft.lua
index c801ec2..2f950a5 100644
--- a/OvaleSimulationCraft.lua
+++ b/OvaleSimulationCraft.lua
@@ -308,7 +308,18 @@ do
 			restoration = {
 				["ascendance"] = "ascendance_heal",
 			},
-		}
+		},
+		warlock = {
+			affliction = {
+				["dark_soul"] = "dark_soul_misery",
+			},
+			demonology = {
+				["dark_soul"] = "dark_soul_knowledge",
+			},
+			destruction = {
+				["dark_soul"] = "dark_soul_instability",
+			},
+		},
 	}

 	function OvaleSimulationCraft:Name(name)
@@ -390,6 +401,8 @@ do
 		-- Shaman
 		["^bloodlust$"] = "Bloodlust()",
 		["^wind_shear$"] = "Interrupt()",
+		-- Warlock
+		["^service_pet$"] = "ServicePet()",
 	}

 	local scriptLine = {}
@@ -400,7 +413,7 @@ do
 			self:Append(script, "#%s", actionLine.line)
 		end

-		local action = self:Name(actionLine.action)
+		local action = self:Name(gsub(actionLine.action, ":", "_"))
 		local matchedAction = false
 		for pattern, result in pairs(SIMC_ACTION) do
 			if strmatch(action, pattern) then
@@ -724,6 +737,9 @@ do
 			end,
 		["^pet%.greater_fire_elemental%.active$"] = "TotemPresent(fire totem=fire_elemental_totem)",
 		["^pet%.primal_fire_elemental%.active$"] = "TotemPresent(fire totem=fire_elemental_totem)",
+		-- Warlock
+		["^debuff%.magic_vulnerability%.down$"] = "target.DebuffExpires(magic_vulnerability any=1)",
+		["^debuff%.magic_vulnerability%.up$"] = "target.DebuffPresent(magic_vulnerability any=1)",
 	}

 	-- totem.<totem_name>.<totem_property>
@@ -858,7 +874,8 @@ do
 				tinsert(simc.symbols, symbol)
 				return format("target.TicksRemain(%s)", symbol)
 			end,
-		["^travel_time$"] = function(simc, actionName) return format("TravelTime(%s)", actionName) end,
+		-- TODO: Assume travel time of a spell is always 0.5s.
+		["^travel_time$"] = function(simc, actionName) return "0.5" end,
 	}

 	local CHARACTER_PROPERTY = {
diff --git a/scripts/ovale_warlock.lua b/scripts/ovale_warlock.lua
index 221eca8..3c698dc 100644
--- a/scripts/ovale_warlock.lua
+++ b/scripts/ovale_warlock.lua
@@ -15,72 +15,174 @@ AddCheckBox(opt_aoe L(AOE) default)
 AddCheckBox(opt_icons_left "Left icons")
 AddCheckBox(opt_icons_right "Right icons")

-### Affliction icons.
+###
+### Affliction
+###
+# Based on SimulationCraft profile "Warlock_Affliction_T16H".
+#	class=warlock
+#	spec=affliction
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#Va!....00
+#	glyphs=siphon_life
+#	pet=felhunter
+
+AddFunction AfflictionAoeActions
+{
+	#soulburn,cycle_targets=1,if=buff.soulburn.down&!dot.soulburn_seed_of_corruption.ticking&!action.soulburn_seed_of_corruption.in_flight_to_target&shard_react
+	if BuffExpires(soulburn_buff) and not target.DebuffPresent(soulburn_seed_of_corruption_debuff) and not InFlightToTarget(soulburn_seed_of_corruption) and SoulShards() >= 1 Spell(soulburn)
+	#soul_swap,if=buff.soulburn.up&!dot.agony.ticking&!dot.corruption.ticking
+	if BuffPresent(soulburn_buff) and not target.DebuffPresent(agony_debuff) and not target.DebuffPresent(corruption_debuff) Spell(soul_swap)
+	#soul_swap,cycle_targets=1,if=buff.soulburn.up&dot.corruption.ticking&!dot.agony.ticking
+	if BuffPresent(soulburn_buff) and target.DebuffPresent(corruption_debuff) and not target.DebuffPresent(agony_debuff) Spell(soul_swap_exhale)
+	#seed_of_corruption,cycle_targets=1,if=(buff.soulburn.down&!in_flight_to_target&!ticking)|(buff.soulburn.up&!dot.soulburn_seed_of_corruption.ticking&!action.soulburn_seed_of_corruption.in_flight_to_target)
+	if { BuffExpires(soulburn_buff) and not InFlightToTarget(seed_of_corruption) and not target.DebuffPresent(seed_of_corruption_debuff) } or { BuffPresent(soulburn_buff) and not target.DebuffPresent(soulburn_seed_of_corruption_debuff) and not InFlightToTarget(soulburn_seed_of_corruption) } Spell(seed_of_corruption)
+	#haunt,cycle_targets=1,if=!in_flight_to_target&debuff.haunt.remains<cast_time+travel_time&shard_react
+	if not InFlightToTarget(haunt) and target.DebuffRemains(haunt_debuff) < CastTime(haunt) + 0.5 and SoulShards() >= 1 Spell(haunt)
+	#life_tap,if=mana.pct<70
+	if ManaPercent() < 70 Spell(life_tap)
+	#fel_flame,cycle_targets=1,if=!in_flight_to_target
+	if not InFlightToTarget(fel_flame) Spell(fel_flame)
+}

-AddIcon mastery=affliction size=small checkboxon=opt_icons_left {}
-AddIcon mastery=affliction size=small checkboxon=opt_icons_left {}
+AddFunction AfflictionAoeCdActions
+{
+	#summon_infernal
+	Spell(summon_infernal)
+}

-AddIcon mastery=affliction help=offgcd
+AddFunction AfflictionSingleTargetActions
 {
-	if not InCombat()
+	#soul_swap,if=buff.soulburn.up
+	if BuffPresent(soulburn_buff) Spell(soul_swap)
+	#soulburn,if=(buff.dark_soul.up|trinket.proc.intellect.react|trinket.stacking_proc.intellect.react>6)&(dot.agony.ticks_remain<=action.agony.add_ticks%2|dot.corruption.ticks_remain<=action.corruption.add_ticks%2|dot.unstable_affliction.ticks_remain<=action.unstable_affliction.add_ticks%2)&shard_react
+	if { BuffPresent(dark_soul_misery_buff) or BuffPresent(trinket_proc_intellect_buff) or BuffStacks(trinket_stacking_proc_intellect_buff) > 6 } and { target.TicksRemain(agony_debuff) <= TicksAdded(agony_debuff) / 2 or target.TicksRemain(corruption_debuff) <= TicksAdded(corruption_debuff) / 2 or target.TicksRemain(unstable_affliction_debuff) <= TicksAdded(unstable_affliction_debuff) / 2 } and SoulShards() >= 1 Spell(soulburn)
+	#soulburn,if=(dot.unstable_affliction.ticks_remain<=1|dot.corruption.ticks_remain<=1|dot.agony.ticks_remain<=1)&shard_react&target.health.pct<=20
+	if { target.TicksRemain(unstable_affliction_debuff) <= 1 or target.TicksRemain(corruption_debuff) <= 1 or target.TicksRemain(agony_debuff) <= 1 } and SoulShards() >= 1 and target.HealthPercent() <= 20 Spell(soulburn)
+	#haunt,if=!in_flight_to_target&remains<cast_time+travel_time+tick_time&shard_react&target.health.pct<=20
+	if not InFlightToTarget(haunt) and target.DebuffRemains(haunt_debuff) < CastTime(haunt) + 0.5 + target.TickTime(haunt_debuff) and SoulShards() >= 1 and target.HealthPercent() <= 20 Spell(haunt)
+	#drain_soul,interrupt=1,chain=1,if=target.health.pct<=20
+	if target.HealthPercent() <= 20 Spell(drain_soul)
+	#haunt,if=!in_flight_to_target&remains<cast_time+travel_time+tick_time&shard_react
+	if not InFlightToTarget(haunt) and target.DebuffRemains(haunt_debuff) < CastTime(haunt) + 0.5 + target.TickTime(haunt_debuff) and SoulShards() >= 1 Spell(haunt)
+	#agony,if=(tick_damage*n_ticks*(100+crit_pct_current)>4*dot.agony.tick_dmg*dot.agony.ticks_remain*(100+dot.agony.crit_pct))&miss_react
+	if { target.Damage(agony_debuff) * target.Ticks(agony_debuff) * { 100 + SpellCritChance() } > 4 * target.LastEstimatedDamage(agony_debuff) * target.TicksRemain(agony_debuff) * { 100 + target.DebuffSpellCritChance(agony_debuff) } } and True(miss_react) Spell(agony)
+	#corruption,if=((stat.spell_power>spell_power&ticks_remain<add_ticks%2)|(stat.spell_power>spell_power*1.5)|remains<gcd)&miss_react
+	if { { Spellpower() > target.DebuffSpellpower(corruption_debuff) and target.TicksRemain(corruption_debuff) < TicksAdded(corruption_debuff) / 2 } or { Spellpower() > target.DebuffSpellpower(corruption_debuff) * 1.5 } or target.DebuffRemains(corruption_debuff) < GCD() } and True(miss_react) Spell(corruption)
+	#unstable_affliction,if=((stat.spell_power>spell_power&ticks_remain<add_ticks%2)|(stat.spell_power>spell_power*1.5)|remains<cast_time+gcd)&miss_react
+	if { { Spellpower() > target.DebuffSpellpower(unstable_affliction_debuff) and target.TicksRemain(unstable_affliction_debuff) < TicksAdded(unstable_affliction_debuff) / 2 } or { Spellpower() > target.DebuffSpellpower(unstable_affliction_debuff) * 1.5 } or target.DebuffRemains(unstable_affliction_debuff) < CastTime(unstable_affliction) + GCD() } and True(miss_react) Spell(unstable_affliction)
+	#life_tap,if=buff.dark_soul.down&buff.bloodlust.down&mana.pct<50
+	if BuffExpires(dark_soul_misery_buff) and BuffExpires(burst_haste any=1) and ManaPercent() < 50 Spell(life_tap)
+	#malefic_grasp,chain=1,interrupt_if=target.health.pct<=20
+	Spell(malefic_grasp)
+	#life_tap,moving=1,if=mana.pct<80&mana.pct<target.health.pct
+	if Speed() > 0 and ManaPercent() < 80 and ManaPercent() < target.HealthPercent() Spell(life_tap)
+	#fel_flame,moving=1
+	if Speed() > 0 Spell(fel_flame)
+	#life_tap
+	Spell(life_tap)
+}
+
+AddFunction AfflictionSingleTargetCdActions
+{
+	#summon_doomguard
+	Spell(summon_doomguard)
+}
+
+AddFunction AfflictionDefaultActions
+{
+	#curse_of_the_elements,if=debuff.magic_vulnerability.down
+	if target.DebuffExpires(magic_vulnerability any=1) Spell(curse_of_the_elements)
+}
+
+AddFunction AfflictionDefaultShortCdActions
+{
+	unless target.DebuffExpires(magic_vulnerability any=1)
 	{
-		if TalentPoints(grimoire_of_sacrifice_talent) Spell(grimoire_of_sacrifice)
+		#dark_soul,if=!talent.archimondes_darkness.enabled|(talent.archimondes_darkness.enabled&(charges=2|trinket.proc.intellect.react|trinket.stacking_proc.intellect.react|target.health.pct<=10))
+		if not TalentPoints(archimondes_darkness_talent) or { TalentPoints(archimondes_darkness_talent) and { Charges(dark_soul_misery) == 2 or BuffPresent(trinket_proc_intellect_buff) or BuffStacks(trinket_stacking_proc_intellect_buff) or target.HealthPercent() <= 10 } } Spell(dark_soul_misery)
+		#service_pet,if=talent.grimoire_of_service.enabled
+		if TalentPoints(grimoire_of_service_talent) ServicePet()
 	}
-	if BuffPresent(dark_soul_misery) and {target.TicksRemain(agony) <=Ticks(agony) /2 or target.TicksRemain(corruption_debuff) <=Ticks(corruption_debuff) /2 or target.TicksRemain(unstable_affliction) <=Ticks(unstable_affliction) /2 } and SoulShards() Spell(soulburn)
-	if {target.TicksRemain(unstable_affliction) <=1 or target.TicksRemain(corruption_debuff) <=1 or target.TicksRemain(agony) <=1 } and SoulShards() and target.HealthPercent() <=20 Spell(soulburn)
-	if SpellPower() >LastSpellSpellPower(unstable_affliction) and target.TicksRemain(unstable_affliction) <=Ticks(unstable_affliction) /2 and SoulShards() and target.HealthPercent() <=20 Spell(soulburn)
 }

-AddIcon mastery=affliction help=main
+AddFunction AfflictionDefaultCdActions
 {
-	if not InCombat()
+	unless target.DebuffExpires(magic_vulnerability any=1)
 	{
-		if not BuffPresent(spell_power_multiplier any=1) Spell(dark_intent)
-		if not TalentPoints(grimoire_of_sacrifice_talent) or BuffExpires(grimoire_of_sacrifice) unless pet.CreatureFamily(Felhunter) Spell(summon_felhunter)
-		if TalentPoints(grimoire_of_service_talent) Spell(service_felhunter)
+		#use_item,name=gloves_of_the_horned_nightmare
+		UseItemActions()
+		#jade_serpent_potion,if=buff.bloodlust.react|target.health.pct<=20
+		if BuffPresent(burst_haste any=1) or target.HealthPercent() <= 20 UsePotionIntellect()
+		#berserking
+		UseRacialActions()
 	}
-	if target.DebuffExpires(magic_vulnerability any=1) Spell(curse_of_the_elements)
-	if TalentPoints(grimoire_of_service_talent) Spell(service_felhunter)
-	if BuffPresent(soulburn) Spell(soul_swap)
-	if not InFlightToTarget(haunt) and target.DebuffRemains(haunt) <CastTime(haunt) +1 +TickTime(haunt) and SoulShards() and target.HealthPercent() <=20 Spell(haunt)
-	if BuffExpires(dark_soul_misery) and BuffExpires(bloodlust any=1) and ManaPercent() <10 and target.HealthPercent() <=20 Spell(life_tap)
-	if target.HealthPercent() <=20 Spell(drain_soul)
-	if target.HealthPercent() <=20 Spell(life_tap)
-	if target.DebuffRemains(agony) <GCD() and target.DebuffRemains(agony) +2 <SpellCooldown(dark_soul_misery) Spell(agony)
-	if not InFlightToTarget(haunt) and target.DebuffRemains(haunt) <CastTime(haunt) +1 +TickTime(haunt) and {SoulShards() >2 or SpellCooldown(dark_soul_misery) >35 or {SoulShards() >1 and SpellCooldown(dark_soul_misery) <CastTime(haunt) } } and SoulShards() Spell(haunt)
-	if target.DebuffRemains(corruption_debuff) <GCD() and target.DebuffRemains(corruption_debuff) <SpellCooldown(dark_soul_misery) Spell(corruption)
-	if target.DebuffRemains(unstable_affliction) <GCD() +CastTime(unstable_affliction) and target.DebuffRemains(unstable_affliction) <SpellCooldown(dark_soul_misery) Spell(unstable_affliction)
-	if target.TicksRemain(agony) <=2 and target.DebuffRemains(agony) +2 <SpellCooldown(dark_soul_misery) Spell(agony)
-	if target.TicksRemain(corruption_debuff) <=2 and target.DebuffRemains(corruption_debuff) <SpellCooldown(dark_soul_misery) Spell(corruption)
-	if {target.DebuffRemains(unstable_affliction) -CastTime(unstable_affliction) } /{BuffDuration(unstable_affliction) /Ticks(unstable_affliction) } <=2 and target.DebuffRemains(unstable_affliction) <SpellCooldown(dark_soul_misery) Spell(unstable_affliction)
-	if SpellPower() >LastSpellSpellPower(agony) and target.TicksRemain(agony) <Ticks(agony) /2 and target.DebuffRemains(agony) +2 <SpellCooldown(dark_soul_misery) Spell(agony)
-	if SpellPower() >LastSpellSpellPower(corruption_debuff) and target.TicksRemain(corruption_debuff) <Ticks(corruption_debuff) /2 and target.DebuffRemains(corruption_debuff) <SpellCooldown(dark_soul_misery) Spell(corruption)
-	if SpellPower() >LastSpellSpellPower(unstable_affliction) and target.TicksRemain(unstable_affliction) <Ticks(unstable_affliction) /2 and target.DebuffRemains(unstable_affliction) <SpellCooldown(dark_soul_misery) Spell(unstable_affliction)
-	if BuffExpires(dark_soul_misery) and BuffExpires(bloodlust any=1) and ManaPercent() <50 Spell(life_tap)
-	Spell(malefic_grasp)
-	Spell(life_tap)
+}
+
+AddFunction AfflictionPrecombatActions
+{
+	#flask,type=warm_sun
+	#food,type=mogu_fish_stew
+	#dark_intent,if=!aura.spell_power_multiplier.up
+	if not BuffPresent(spell_power_multiplier any=1) Spell(dark_intent)
+	#snapshot_stats
+}
+
+AddFunction AfflictionPrecombatShortCdActions
+{
+	#summon_pet,if=!talent.grimoire_of_sacrifice.enabled|buff.grimoire_of_sacrifice.down
+	if not TalentPoints(grimoire_of_sacrifice_talent) or BuffExpires(grimoire_of_sacrifice_buff) SummonPet()
+	#grimoire_of_sacrifice,if=talent.grimoire_of_sacrifice.enabled
+	if TalentPoints(grimoire_of_sacrifice_talent) Spell(grimoire_of_sacrifice)
+	#service_pet,if=talent.grimoire_of_service.enabled
+	if TalentPoints(grimoire_of_service_talent) ServicePet()
+}
+
+AddFunction AfflictionPrecombatCdActions
+{
+	#jade_serpent_potion
+	UsePotionIntellect()
+}
+
+### Affliction icons.
+
+AddIcon mastery=affliction size=small checkboxon=opt_icons_left
+{
+}
+
+AddIcon mastery=affliction size=small checkboxon=opt_icons_left
+{
+}
+
+AddIcon mastery=affliction help=shortcd
+{
+	if InCombat(no) AfflictionPrecombatShortCdActions()
+	AfflictionDefaultShortCdActions()
+}
+
+AddIcon mastery=affliction help=main
+{
+	if InCombat(no) AfflictionPrecombatActions()
+	AfflictionDefaultActions()
+	AfflictionSingleTargetActions()
 }

 AddIcon mastery=affliction help=aoe checkboxon=opt_aoe
 {
-	if BuffExpires(soulburn) and not target.DebuffPresent(soulburn_seed_of_corruption) and not InFlightToTarget(soulburn_seed_of_corruption) and SoulShards() Spell(soulburn)
-	if BuffPresent(soulburn) and not target.DebuffPresent(agony) and not target.DebuffPresent(corruption_debuff) Spell(soul_swap)
-	if BuffPresent(soulburn) and target.DebuffPresent(corruption_debuff) and not target.DebuffPresent(agony) Spell(soul_swap)
-	if {BuffExpires(soulburn) and not InFlightToTarget(seed_of_corruption) and not target.DebuffPresent(seed_of_corruption) } or {BuffPresent(soulburn) and not target.DebuffPresent(soulburn_seed_of_corruption) and not InFlightToTarget(soulburn_seed_of_corruption) } Spell(seed_of_corruption)
-	if not InFlightToTarget(haunt) and target.DebuffRemains(haunt) <CastTime(haunt) +1 and SoulShards() Spell(haunt)
-	if ManaPercent() <70 Spell(life_tap)
-	if not InFlightToTarget(fel_flame) Spell(fel_flame)
+	if InCombat(no) AfflictionPrecombatActions()
+	AfflictionDefaultActions()
+	AfflictionAoeActions()
 }

 AddIcon mastery=affliction help=cd
 {
-	UseItemActions()
-	Spell(blood_fury)
-	Spell(dark_soul_misery)
-	Spell(summon_doomguard)
+	if InCombat(no) AfflictionPrecombatCdActions()
+	AfflictionDefaultCdActions()
+	if Enemies() > 6 AfflictionAoeCdActions()
+	if Enemies() <= 6 AfflictionSingleTargetCdActions()
 }

-AddIcon mastery=affliction size=small checkboxon=opt_icons_right {}
+AddIcon mastery=affliction size=small checkboxon=opt_icons_right
+{
+}

 AddIcon mastery=affliction size=small checkboxon=opt_icons_right
 {
@@ -99,8 +201,8 @@ AddIcon mastery=demonology help=offgcd
 		if TalentPoints(grimoire_of_sacrifice_talent) Spell(grimoire_of_sacrifice)
 	}
 	Spell(melee)
-	Spell(felstorm)
-	Spell(wrathstorm)
+	Spell(felguard_felstorm)
+	Spell(wrathguard_wrathstorm)
 	if {BuffPresent(dark_soul_knowledge) and DemonicFury() /32 >BuffRemains(dark_soul_knowledge) } or target.DebuffRemains(corruption_debuff) <5 or not target.DebuffPresent(doom) or DemonicFury() >=950 or DemonicFury() /32 >target.DeadIn() unless Stance(1) Spell(metamorphosis)
 }

@@ -184,7 +286,7 @@ AddIcon mastery=destruction help=main
 	if {target.TicksRemain(immolate_debuff) <Ticks(immolate_debuff) /2 or target.DebuffExpires(immolate_debuff) } and target.DeadIn() >=5 Spell(immolate)
 	if Charges(conflagrate) ==2 Spell(conflagrate)
 	if not target.DebuffPresent(rain_of_fire_aftermath) and not InFlightToTarget(rain_of_fire_aftermath) Spell(rain_of_fire_aftermath)
-	if BurningEmbers() and {BuffStacks(backdraft) <3 or Level() <86 } and {{BurningEmbers() / 10} >3.5 or BuffRemains(dark_soul_instability) >CastTime(chaos_bolt) or BuffRemains(skull_banner) >CastTime(chaos_bolt) } Spell(chaos_bolt)
+	if BurningEmbers() and {BuffStacks(backdraft) <3 or Level() <86 } and {{BurningEmbers() / 10} >3.5 or BuffRemains(dark_soul_instability) >CastTime(chaos_bolt) or BuffRemains(skull_banner_buff) >CastTime(chaos_bolt) } Spell(chaos_bolt)
 	Spell(conflagrate)
 	Spell(incinerate)
 }
diff --git a/scripts/ovale_warlock_spells.lua b/scripts/ovale_warlock_spells.lua
index 9649027..3d5d469 100644
--- a/scripts/ovale_warlock_spells.lua
+++ b/scripts/ovale_warlock_spells.lua
@@ -3,137 +3,201 @@ local OvaleScripts = Ovale.OvaleScripts

 do
 	local name = "ovale_warlock_spells"
-	local desc = "[5.2] Ovale: Warlock spells"
+	local desc = "[5.4.7] Ovale: Warlock spells"
 	local code = [[
 # Warlock spells and functions.

 Define(agony 980)
-	SpellInfo(agony duration=24 tick=2 haste=spell)
-	SpellAddTargetDebuff(agony agony=1)
+	SpellAddTargetDebuff(agony agony_debuff=1)
+Define(agony_debuff 980)
+	SpellInfo(agony_debuff duration=24 haste=spell maxstacks=10 tick=2)
+	SpellInfo(agony_debuff addduration=12 glyph=glyph_of_everlasting_affliction)
+	SpellInfo(agony_debuff damage=AfflictionAgonyTickDamage mastery=affliction)
+	SpellInfo(agony_debuff lastEstimatedDamage=AfflictionAgonyTickLastDamage mastery=affliction)
+Define(archimondes_darkness_talent 16)
 Define(backdraft 117896)
+Define(backdraft_buff 117828)
+	SpellInfo(backdraft_buff duration=15 maxstacks=3)
+Define(burning_embers 108647)
+# cancel_metamorphosis
 Define(chaos_bolt 116858)
-	SpellInfo(chaos_bolt burningembers=10 tick=1 haste=spell)
-	SpellAddTargetDebuff(chaos_bolt chaos_bolt=1)
+	SpellInfo(chaos_bolt burningembers=10)
+	SpellAddBuff(chaos_bolt backdraft_buff=-3 if_spell=backdraft if_spell=pyroclasm)
 Define(conflagrate 17962)
-	SpellInfo(conflagrate duration=5)
-	SpellAddBuff(conflagrate conflagrate=1)
+	SpellInfo(conflagrate burningembers=-1 if_spell=burning_embers)
+	SpellInfo(conflagrate buff_burningembers=fire_and_brimstone_buff buff_burningembers_amount=11 if_spell=fire_and_brimstone)
 Define(corruption 172)
 	SpellAddTargetDebuff(corruption corruption_debuff=1)
 Define(corruption_debuff 146739)
-	SpellInfo(corruption_debuff duration=18 tick=2 haste=spell)
+	SpellInfo(corruption_debuff duration=18 haste=spell tick=2)
+	SpellInfo(corruption_debuff addduration=9 glyph=glyph_of_everlasting_affliction)
 Define(curse_of_the_elements 1490)
-	SpellInfo(curse_of_the_elements duration=300)
-	SpellAddTargetDebuff(curse_of_the_elements aura_of_the_elements=1)
+	SpellInfo(curse_of_the_elements burningembers=0 if_spell=burning_embers)
+	SpellInfo(curse_of_the_elements buff_burningembers=fire_and_brimstone_buff buff_burningembers_amount=10 if_spell=fire_and_brimstone)
 Define(dark_intent 109773)
-	SpellInfo(dark_intent duration=3600)
-	SpellAddBuff(dark_intent dark_intent=1)
-Define(dark_soul_instability 113858)
-	SpellInfo(dark_soul_instability duration=20 cd=120)
-	SpellAddBuff(dark_soul_instability dark_soul_instability=1)
 Define(dark_soul_knowledge 113861)
-	SpellInfo(dark_soul_knowledge duration=20 cd=120)
-	SpellAddBuff(dark_soul_knowledge dark_soul_knowledge=1)
+	SpellInfo(dark_soul_knowledge cd=120)
+	SpellAddBuff(dark_soul_knowledge dark_soul_knowledge_buff=1)
+Define(dark_soul_knowledge_buff 113858)
+	SpellInfo(dark_soul_knowledge_buff duration=20)
+Define(dark_soul_instability 113858)
+	SpellInfo(dark_soul_instability cd=120)
+	SpellAddBuff(dark_soul_instability dark_soul_instability_buff=1)
+Define(dark_soul_instability_buff 113858)
+	SpellInfo(dark_soul_instability_buff duration=20)
 Define(dark_soul_misery 113860)
-	SpellInfo(dark_soul_misery duration=20 cd=120)
-	SpellAddBuff(dark_soul_misery dark_soul_misery=1)
+	SpellInfo(dark_soul_misery cd=120)
+	SpellAddBuff(dark_soul_misery dark_soul_misery_buff=1)
+Define(dark_soul_misery_buff 113858)
+	SpellInfo(dark_soul_misery_buff duration=20)
+Define(demonic_fury 104315)
 Define(doom 603)
-	SpellInfo(doom duration=60 demonicfury=60 tick=15 haste=spell stance=1)
-	SpellAddTargetDebuff(doom doom=1)
+	SpellInfo(doom demonicfury=60 stance=warlock_metamophosis)
+	SpellAddTargetDebuff(doom doom_debuff=1)
+Define(doom_debuff 603)
+	SpellInfo(doom_debuff duration=60 haste=spell tick=15)
 Define(drain_soul 1120)
 	SpellInfo(drain_soul channel=6 haste=spell)
-	SpellAddTargetDebuff(drain_soul drain_soul=1)
 Define(fel_flame 77799)
-Define(felstorm 89751)
-	SpellInfo(felstorm duration=6 energy=60 cd=45)
-	SpellAddBuff(felstorm felstorm=1)
+	SpellInfo(fel_flame burningembers=-1 if_spell=burning_embers)
+	SpellInfo(fel_flame demonicfury=-15 if_spell=demonic_fury)
+Define(felguard_felstorm 89751)
+	SpellInfo(felguard_felstorm cd=45)
+	SpellAddBuff(felguard_felstorm felguard_felstorm_buff=1)
+Define(felguard_felstorm_buff 89751)
+	SpellInfo(felguard_felstorm_buff duration=6)
 Define(fire_and_brimstone 108683)
-	SpellInfo(fire_and_brimstone burningembers=10 cd=1)
-	SpellAddBuff(fire_and_brimstone fire_and_brimstone=1)
+	SpellInfo(fire_and_brimstone cd=1)
+	SpellAddBuff(fire_and_brimstone fire_and_brimstone_buff=1)
+Define(fire_and_brimstone_buff 108683)
+Define(glyph_of_everlasting_affliction 118778)
+Define(glyph_of_havoc 146962)
 Define(grimoire_of_sacrifice 108503)
-	SpellInfo(grimoire_of_sacrifice duration=3600 cd=30)
-	SpellAddBuff(grimoire_of_sacrifice grimoire_of_sacrifice=1)
+	SpellInfo(grimoire_of_sacrifice cd=30)
+	SpellAddBuff(grimoire_of_sacrifice grimoire_of_sacrifice_buff=1)
+Define(grimoire_of_sacrifice_buff 108503)
+	SpellInfo(grimoire_of_sacrifice_buff duration=3600)
 Define(grimoire_of_sacrifice_talent 15)
 Define(grimoire_of_service_talent 14)
 Define(hand_of_guldan 105174)
-	SpellInfo(hand_of_guldan stance=0)
+	SpellAddTargetDebuff(hand_of_guldan shadowflame_debuff=1)
 Define(haunt 48181)
-	SpellInfo(haunt duration=8 tick=2 shards=1)
-	SpellAddBuff(haunt haunt=1)
+	SpellInfo(haunt shards=1)
+	SpellAddTargetDebuff(haunt haunt_debuff=1)
+Define(haunt_debuff 48181)
+	SpellInfo(haunt_debuff duration=8 haste=spell tick=2)
 Define(havoc 80240)
-	SpellInfo(havoc duration=15 cd=25)
-	SpellAddBuff(havoc havoc=1)
+	SpellInfo(havoc cd=25)
+	SpellInfo(havoc addcd=35 glyph=glyph_of_havoc)
+	SpellAddTargetDebuff(havoc havoc_debuff=3 glyph=!glyph_of_havoc)
+	SpellAddTargetDebuff(havoc havoc_debuff=6 glyph=glyph_of_havoc)
+Define(havoc_debuff 80240)
+	SpellInfo(havoc_debuff duration=15)
+	SpellInfo(havoc_debuff maxstacks=3 glyph=!glyph_of_havoc)
+	SpellInfo(havoc_debuff maxstacks=6 glyph=glyph_of_havoc)
 Define(hellfire 1949)
-	SpellInfo(hellfire channel=14 haste=spell)
-	SpellAddTargetDebuff(hellfire hellfire=1)
+	SpellInfo(hellfire channel=14 demonicfury=-10 haste=spell)
 Define(immolate 348)
-	SpellInfo(immolate duration=15 tick=3 haste=spell)
-	SpellAddTargetDebuff(immolate immolate=1)
-Define(immolate_aoe 108686)
-	SpellInfo(immolate_aoe duration=15 tick=3 haste=spell)
-SpellList(immolate_debuff immolate immolate_aoe)
+	SpellInfo(immolate buff_burningembers=fire_and_brimstone_buff buff_burningembers_amount=10 if_spell=fire_and_brimstone)
+	SpellAddTargetDebuff(immolate immolate_debuff=1)
+Define(immolate_debuff 348)
+	SpellInfo(immolate_debuff duration=15 haste=spell tick=3)
 Define(immolation_aura 104025)
-	SpellInfo(immolation_aura duration=10 demonicfury=0 stance=1)
-	SpellAddBuff(immolation_aura immolation_aura=1)
+	SpellInfo(immolation_aura demonicfury=0 stance=warlock_metamorphosis)
+	SpellAddBuff(immolation_aura immolation_aura_buff=1)
+Define(immolation_aura_buff 104025)
+	SpellInfo(immolation_aura duration=10 haste=spell tick=1)
 Define(incinerate 29722)
+	SpellInfo(incinerate burningembers=-1 if_spell=burning_embers)
+	SpellInfo(incinerate buff_burningembers=fire_and_brimstone_buff buff_burningembers_amount=11 if_spell=fire_and_brimstone)
+	SpellAddBuff(incinerate backdraft_buff=-1 if_spell=backdraft)
 Define(life_tap 1454)
-	SpellInfo(life_tap mana=-15)
-	SpellAddBuff(life_tap life_tap=1)
 Define(malefic_grasp 103103)
-	SpellInfo(malefic_grasp channel=4 haste=spell)
-	SpellAddTargetDebuff(malefic_grasp malefic_grasp=1)
-Define(melee 103988)
-	SpellInfo(melee stance=1)
+#	SpellInfo(malefic_grasp channel=4 haste=spell)	# XXX Don't interrupt channeling Malefic Grasp.
 Define(metamorphosis 103958)
 	SpellInfo(metamorphosis demonicfury=0 cd=10)
-	SpellAddBuff(metamorphosis metamorphosis=1)
-Define(molten_core 122355)
-	SpellInfo(molten_core duration=30)
-	SpellAddBuff(molten_core molten_core=1)
+	SpellAddBuff(metamorphosis metamorphosis_buff=1)
+Define(metamorphosis_buff 103958)
+Define(molten_core_buff 122355)
+	SpellInfo(molten_core_buff duration=30)
+Define(pandemic 131973)
+Define(pyroclasm 123686)
 Define(rain_of_fire 5740)
-	SpellInfo(rain_of_fire duration=6)
-	SpellAddBuff(rain_of_fire rain_of_fire=1)
-Define(rain_of_fire_aftermath 104232)
+	SpellInfo(rain_of_fire channel=6 haste=spell)
+Define(rain_of_fire_debuff 5740)
 Define(seed_of_corruption 27243)
-	SpellInfo(seed_of_corruption duration=18 tick=3 haste=spell)
-	SpellAddTargetDebuff(seed_of_corruption seed_of_corruption=1)
+	SpellAddTargetDebuff(seed_of_corruption seed_of_corruption_debuff=1)
+Define(seed_of_corruption_debuff 27243)
+	SpellInfo(seed_of_corruption_debuff duration=18 haste=spell tick=3)
 Define(service_felguard 111898)
 	SpellInfo(service_felguard cd=120)
 Define(service_felhunter 111897)
 	SpellInfo(service_felhunter cd=120)
+Define(service_pet 108501)
+	SpellInfo(service_pet cd=120)
 Define(shadow_bolt 686)
-	SpellInfo(shadow_bolt demonicfury=40 stance=0)
+	SpellInfo(shadow_bolt demonicfury=-25 if_spell=demonic_fury)
 Define(shadowburn 17877)
-	SpellInfo(shadowburn burningembers=10)
-Define(shadowflame 47960)
-	SpellInfo(shadowflame duration=6 tick=1 haste=spell)
-	SpellAddTargetDebuff(shadowflame shadowflame=1)
-Define(skull_banner 114207)
-	SpellInfo(skull_banner duration=10 cd=180)
+	SpellInfo(shadowburn burningembers=10 if_spell=burning_embers)
+Define(shadowflame_debuff 47960)
+	SpellInfo(shadowflame_debuff duration=6 haste=spell tick=1)
+Define(skull_banner_buff 114206)
+	SpellInfo(skull_banner_buff duration=10)
 Define(soul_fire 6353)
-	SpellAddBuff(soul_fire molten_core=-1)
+	SpellInfo(soul_fire demonicfury=30 if_spell=demonic_fury)
+	SpellAddBuff(soul_fire molten_core_debuff=0)
 Define(soul_swap 86121)
+	SpellAddBuff(soul_swap soul_swap_buff=1)
+Define(soul_swap_buff 86211)
+	SpellInfo(soul_swap_buff duration=3)
+Define(soul_swap_exhale 86213)
 Define(soulburn 74434)
-	SpellInfo(soulburn duration=30 shards=1 cd=1)
-	SpellAddBuff(soulburn soulburn=1)
-Define(soulburn_seed_of_corruption 86664)
+	SpellInfo(soulburn cd=1 shards=1)
+	SpellAddBuff(soulburn soulburn_buff=1)
+Define(soulburn_buff 74434)
+	SpellInfo(soulburn_buff duration=30)
+Define(soulburn_seed_of_corruption 114790)
+	SpellAddTargetDebuff(soulburn_seed_of_corruption soulburn_seed_of_corruption_debuff=1)
+Define(soulburn_seed_of_corruption_debuff 114790)
+	SpellInfo(soulburn_seed_of_corruption_debuff duration=18 haste=spell tick=3)
 Define(summon_doomguard 18540)
 	SpellInfo(summon_doomguard cd=600)
-Define(summon_felguard 30146)
-	SpellInfo(summon_felguard demonicfury=0)
-Define(summon_felhunter 691)
-	SpellInfo(summon_felhunter demonicfury=0)
 Define(summon_infernal 1122)
 	SpellInfo(summon_infernal cd=600)
 Define(touch_of_chaos 103964)
-	SpellInfo(touch_of_chaos demonicfury=40 stance=1)
+	SpellInfo(touch_of_chaos demonicfury=40 stance=warlock_metamophosis)
 Define(unstable_affliction 30108)
-	SpellInfo(unstable_affliction duration=14 tick=2 haste=spell)
-	SpellAddTargetDebuff(unstable_affliction unstable_affliction=1)
+	SpellAddTargetDebuff(unstable_affliction unstable_affliction_debuff=1)
+Define(unstable_affliction_debuff 30108)
+	SpellInfo(unstable_affliction_debuff duration=14 haste=spell tick=2)
+	SpellInfo(unstable_affliction_debuff addduration=7 glyph=glyph_of_everlasting_affliction)
 Define(void_ray 115422)
-	SpellInfo(void_ray demonicfury=40)
-Define(wrathstorm 115831)
-	SpellInfo(wrathstorm duration=6 energy=60 cd=45)
-	SpellAddBuff(wrathstorm wrathstorm=1)
+	SpellInfo(void_ray demonicfury=40 stance=warlock_metamophosis)
+Define(wrathguard_wrathstorm 115831)
+	SpellInfo(wrathguard_wrathstorm cd=45)
+	SpellAddBuff(wrathguard_wrathstorm wrathguard_wrathstorm_buff=1)
+Define(wrathguard_wrathstorm_buff 89751)
+	SpellInfo(wrathguard_wrathstorm_buff duration=6)
+
+AddFunction SummonPet
+{
+	if pet.Present(no) Texture(spell_nature_removecurse)
+}
+
+AddFunction ServicePet
+{
+	if TalentPoints(grimoire_of_service_talent) and Spell(grimoire_of_service) Texture(spell_nature_removecurse)
+}
+
+AddFunction AfflictionMasteryDamageMultiplier asValue=1 { 1 + MasteryEffect() / 100 }
+AddFunction AfflictionAgonyTickDamage asValue=1
+{
+	{ 27 + 0.0255 * Spellpower() } * target.DamageMultiplier(agony_debuff) * AfflictionMasteryDamageMultiplier()
+}
+AddFunction AfflictionAgonyTickLastDamage asValue=1
+{
+	{ 27 + 0.0255 * target.DebuffSpellpower(agony_debuff) } * target.DebuffDamageMultiplier(agony_debuff) * { 1 + target.DebuffMasteryEffect(agony_debuff) / 100 }
+}
 ]]

 	OvaleScripts:RegisterScript("WARLOCK", name, desc, code, "include")