Quantcast

Death Knight: Update Frost and Unholy scripts to MoP 5.4.7.

Johnny C. Lam [05-15-14 - 23:19]
Death Knight: Update Frost and Unholy scripts to MoP 5.4.7.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1454 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleSimulationCraft.lua
scripts/ovale_deathknight.lua
scripts/ovale_deathknight_spells.lua
diff --git a/OvaleSimulationCraft.lua b/OvaleSimulationCraft.lua
index 5ef3ca9..c632fee 100644
--- a/OvaleSimulationCraft.lua
+++ b/OvaleSimulationCraft.lua
@@ -196,7 +196,6 @@ do
 		self:Append(script, "Include(ovale_items)")
 		self:Append(script, "Include(ovale_racials)")
 		self:Append(script, format("Include(ovale_%s_spells)", profile.class))
-		self:Append(script, "")

 		if profile.actionList then
 			for listName, actionList in pairs(profile.actionList) do
@@ -273,6 +272,17 @@ end

 do
 	local TO_NAME = {
+		deathknight = {
+			blood = {
+				["soul_reaper"] = "soul_reaper_blood",
+			},
+			frost = {
+				["soul_reaper"] = "soul_reaper_frost",
+			},
+			unholy = {
+				["soul_reaper"] = "soul_reaper_unholy",
+			},
+		},
 		druid = {
 			balance = {
 				["dream_of_cenarius"] = "dream_of_cenarius_caster",
@@ -369,6 +379,8 @@ do
 		["^blood_presence$"] = "if not Stance(deathknight_blood_presence) Spell(blood_presence)",
 		["^frost_presence$"] = "if not Stance(deathknight_frost_presence) Spell(frost_presence)",
 		["^unholy_presence$"] = "if not Stance(deathknight_unholy_presence) Spell(unholy_presence)",
+		["^blood_tap$"] = "BloodTap()",
+		["^plague_leech$"] = "PlagueLeech()",
 		-- Druid
 		["^cat_form$"] = "if not Stance(druid_cat_form) Spell(cat_form)",
 		["^moonkin_form$"] = "if not Stance(druid_moonkin_form) Spell(moonkin_form)",
diff --git a/scripts/ovale_deathknight.lua b/scripts/ovale_deathknight.lua
index 75a43d8..5e2c717 100644
--- a/scripts/ovale_deathknight.lua
+++ b/scripts/ovale_deathknight.lua
@@ -3,9 +3,9 @@ local OvaleScripts = Ovale.OvaleScripts

 do
 	local name = "Ovale"
-	local desc = "[5.2] Ovale: Frost, Unholy"
+	local desc = "[5.4] Ovale: Frost, Unholy"
 	local code = [[
-# Ovale death knight script by Sidoine for WoW 5.2.
+# Ovale death knight script based on SimulationCraft.

 Include(ovale_items)
 Include(ovale_racials)
@@ -15,134 +15,541 @@ AddCheckBox(opt_aoe L(AOE) default)
 AddCheckBox(opt_icons_left "Left icons")
 AddCheckBox(opt_icons_right "Right icons")

-### Frost icons.
+###
+### Frost
+###
+# Based on SimulationCraft profile "Death_Knight_Frost_1h_T16H".
+#	class=deathknight
+#	spec=frost
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#dZ!1...0.
+#	glyphs=loud_horn

-AddIcon mastery=frost size=small checkboxon=opt_icons_left {}
-AddIcon mastery=frost size=small checkboxon=opt_icons_left {}
+AddFunction FrostDefaultActions
+{
+	#auto_attack
+	#run_action_list,name=aoe,if=active_enemies>=3
+	#if Enemies() >= 3 FrostAoeActions()
+	#run_action_list,name=single_target,if=active_enemies<3
+	#if Enemies() < 3 FrostSingleTargetActions()
+}
+
+AddFunction FrostDefaultShortCdActions
+{
+	#pillar_of_frost
+	Spell(pillar_of_frost)
+}
+
+AddFunction FrostDefaultCdActions
+{
+	#mogu_power_potion,if=target.time_to_die<=30|(target.time_to_die<=60&buff.pillar_of_frost.up)
+	if target.TimeToDie() <= 30 or { target.TimeToDie() <= 60 and BuffPresent(pillar_of_frost_buff) } UsePotionStrength()
+	#empower_rune_weapon,if=target.time_to_die<=60&(buff.mogu_power_potion.up|buff.golemblood_potion.up)
+	if target.TimeToDie() <= 60 and { BuffPresent(mogu_power_potion_buff) or BuffPresent(golemblood_potion_buff) } Spell(empower_rune_weapon)
+	#blood_fury
+	Spell(blood_fury)
+	#berserking
+	Spell(berserking)
+	#arcane_torrent
+	Spell(arcane_torrent)
+	#use_item,slot=hands
+	UseItemActions()
+	#raise_dead
+	Spell(raise_dead)
+}
+
+AddFunction FrostPrecombatActions
+{
+	#flask,type=winters_bite
+	#food,type=black_pepper_ribs_and_shrimp
+	#horn_of_winter
+	Spell(horn_of_winter)
+	#frost_presence
+	if not Stance(deathknight_frost_presence) Spell(frost_presence)
+	#snapshot_stats
+}

-AddIcon mastery=frost help=offgcd
+AddFunction FrostPrecombatShortCdActions
 {
-	if not InCombat()
+	if Stance(deathknight_frost_presence)
 	{
+		#pillar_of_frost
 		Spell(pillar_of_frost)
 	}
-	Spell(pillar_of_frost)
-	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge) >10 and {RunicPower() >76 or {RunicPower() >=20 and BuffStacks(killing_machine) } } Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and {target.HealthPercent() -{3 *target.HealthPercent() /target.DeadIn() } <=35 and SpellCooldown(soul_reaper_frost) ==0 } Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and {target.HealthPercent() -{3 *target.HealthPercent() /target.DeadIn() } >35 or BuffStacks(blood_charge) >=8 } Spell(blood_tap)
 }

-AddIcon mastery=frost help=main
+AddFunction FrostPrecombatCdActions
 {
-	if not InCombat()
+	if Stance(deathknight_frost_presence)
 	{
-		unless Stance(2) Spell(frost_presence)
-		Spell(horn_of_winter)
+		#army_of_the_dead
+		Spell(army_of_the_dead)
+		#mogu_power_potion
+		UsePotionStrength()
+		#raise_dead
+		Spell(raise_dead)
 	}
-	if BuffStacks(killing_machine) or RunicPower() >88 Spell(frost_strike)
-	if TalentPoints(plague_leech_talent) and {target.DebuffRemains(blood_plague) <3 or target.DebuffRemains(frost_fever) <3 or SpellCooldown(outbreak) <1 } Spell(plague_leech)
-	if target.DebuffRemains(frost_fever) <3 or target.DebuffRemains(blood_plague) <3 Spell(outbreak)
-	if target.HealthPercent() -{3 *target.HealthPercent() /target.DeadIn() } <=35 Spell(soul_reaper_frost)
-	if not target.DebuffPresent(frost_fever) Spell(howling_blast)
-	if not target.DebuffPresent(blood_plague) Spell(plague_strike)
-	if BuffStacks(rime) Spell(howling_blast)
-	if RunicPower() >76 Spell(frost_strike)
-	if RuneCount(unholy) >1 Spell(obliterate)
-	if RuneCount(death) >1 or RuneCount(frost) >1 Spell(howling_blast)
+}
+
+AddFunction FrostOneHandAoeActions
+{
+	#unholy_blight,if=talent.unholy_blight.enabled
+	if TalentPoints(unholy_blight_talent) Spell(unholy_blight)
+	#pestilence,if=dot.blood_plague.ticking&talent.plague_leech.enabled,line_cd=28
+	if target.DebuffPresent(blood_plague_debuff) and TalentPoints(plague_leech_talent) and DebuffRemainsOnAny(blood_plague_debuff excludeTarget=1) < 2 Spell(pestilence)
+	#pestilence,if=dot.blood_plague.ticking&talent.unholy_blight.enabled&cooldown.unholy_blight.remains<49,line_cd=28
+	if target.DebuffPresent(blood_plague_debuff) and TalentPoints(unholy_blight_talent) and SpellCooldown(unholy_blight) < 49 and DebuffRemainsOnAny(blood_plague_debuff excludeTarget=1) < 2 Spell(pestilence)
+	#howling_blast
+	Spell(howling_blast)
+	#blood_tap,if=talent.blood_tap.enabled&buff.blood_charge.stack>10
+	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge_buff) > 10 BloodTap()
+	#frost_strike,if=runic_power>76
+	if RunicPower() > 76 Spell(frost_strike)
+	#death_and_decay,if=unholy=1
+	if { Rune(unholy) >= 1 and Rune(unholy) < 2 } Spell(death_and_decay)
+	#plague_strike,if=unholy=2
+	if Rune(unholy) >= 2 Spell(plague_strike)
+	#blood_tap,if=talent.blood_tap.enabled
+	if TalentPoints(blood_tap_talent) BloodTap()
+	#frost_strike
+	Spell(frost_strike)
+	#horn_of_winter
 	Spell(horn_of_winter)
-	if RuneCount(unholy) >0 Spell(obliterate)
+	#plague_leech,if=talent.plague_leech.enabled&unholy=1
+	if TalentPoints(plague_leech_talent) and { Rune(unholy) >= 1 and Rune(unholy) < 2 } PlagueLeech()
+	#plague_strike,if=unholy=1
+	if { Rune(unholy) >= 1 and Rune(unholy) < 2 } Spell(plague_strike)
+}
+
+AddFunction FrostOneHandSingleTargetActions
+{
+	#blood_tap,if=talent.blood_tap.enabled&(buff.blood_charge.stack>10&(runic_power>76|(runic_power>=20&buff.killing_machine.react)))
+	if TalentPoints(blood_tap_talent) and { BuffStacks(blood_charge_buff) > 10 and { RunicPower() > 76 or { RunicPower() >= 20 and BuffPresent(killing_machine_buff) } } } BloodTap()
+	#frost_strike,if=buff.killing_machine.react|runic_power>88
+	if BuffPresent(killing_machine_buff) or RunicPower() > 88 Spell(frost_strike)
+	#howling_blast,if=death>1|frost>1
+	if Rune(death) >= 2 or Rune(frost) >= 2 Spell(howling_blast)
+	#soul_reaper,if=target.health.pct-3*(target.health.pct%target.time_to_die)<=35
+	if target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } <= 35 Spell(soul_reaper_frost)
+	#blood_tap,if=talent.blood_tap.enabled&((target.health.pct-3*(target.health.pct%target.time_to_die)<=35&cooldown.soul_reaper.remains=0))
+	if TalentPoints(blood_tap_talent) and { { target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } <= 35 and not SpellCooldown(soul_reaper_frost) > 0 } } BloodTap()
+	#howling_blast,if=!dot.frost_fever.ticking
+	if not target.DebuffPresent(frost_fever_debuff) Spell(howling_blast)
+	#plague_strike,if=!dot.blood_plague.ticking&unholy>0
+	if not target.DebuffPresent(blood_plague_debuff) and Rune(unholy) >= 1 Spell(plague_strike)
+	#howling_blast,if=buff.rime.react
+	if BuffPresent(rime_buff) Spell(howling_blast)
+	#frost_strike,if=runic_power>76
+	if RunicPower() > 76 Spell(frost_strike)
+	#obliterate,if=unholy>0&!buff.killing_machine.react
+	if Rune(unholy) >= 1 and not BuffPresent(killing_machine_buff) Spell(obliterate)
+	#howling_blast
 	Spell(howling_blast)
-	if TalentPoints(runic_empowerment_talent) and {RuneCount(frost) ==0 or RuneCount(blood) ==0 } Spell(frost_strike)
-	if TalentPoints(runic_corruption_talent) and BuffExpires(runic_corruption) Spell(frost_strike)
-	Spell(death_and_decay)
-	if RunicPower() >=40 Spell(frost_strike)
+	#frost_strike,if=talent.runic_empowerment.enabled&unholy=1
+	if TalentPoints(runic_empowerment_talent) and { Rune(unholy) >= 1 and Rune(unholy) < 2 } Spell(frost_strike)
+	#blood_tap,if=talent.blood_tap.enabled&(target.health.pct-3*(target.health.pct%target.time_to_die)>35|buff.blood_charge.stack>=8)
+	if TalentPoints(blood_tap_talent) and { target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } > 35 or BuffStacks(blood_charge_buff) >= 8 } BloodTap()
+	#frost_strike,if=runic_power>=40
+	if RunicPower() >= 40 Spell(frost_strike)
+	#horn_of_winter
+	Spell(horn_of_winter)
+	#blood_tap,if=talent.blood_tap.enabled
+	if TalentPoints(blood_tap_talent) BloodTap()
+	#plague_leech,if=talent.plague_leech.enabled
+	if TalentPoints(plague_leech_talent) PlagueLeech()
 }

-AddIcon mastery=frost help=aoe checkboxon=opt_aoe {}
+AddFunction FrostOneHandSingleTargetShortCdActions
+{
+	unless { TalentPoints(blood_tap_talent) and { BuffStacks(blood_charge_buff) > 10 and { RunicPower() > 76 or { RunicPower() >= 20 and BuffPresent(killing_machine_buff) } } } }
+		or { { BuffPresent(killing_machine_buff) or RunicPower() > 88 } and Spell(frost_strike) }
+		or { Rune(death) >= 2 or Rune(frost) >= 2 }
+	{
+		#unholy_blight,if=talent.unholy_blight.enabled&((dot.frost_fever.remains<3|dot.blood_plague.remains<3))
+		if TalentPoints(unholy_blight_talent) and { { target.DebuffRemains(frost_fever_debuff) < 3 or target.DebuffRemains(blood_plague_debuff) < 3 } } Spell(unholy_blight)
+	}
+}

-AddIcon mastery=frost help=cd
+# Based on SimulationCraft profile "Death_Knight_Frost_2h_T16H".
+#	class=deathknight
+#	spec=frost
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#dZ!1...0.
+#	glyphs=loud_horn
+
+AddFunction FrostTwoHandAoeActions
+{
+	#unholy_blight,if=talent.unholy_blight.enabled
+	if TalentPoints(unholy_blight_talent) Spell(unholy_blight)
+	#pestilence,if=dot.blood_plague.ticking&talent.plague_leech.enabled,line_cd=28
+	if target.DebuffPresent(blood_plague_debuff) and TalentPoints(plague_leech_talent) and DebuffRemainsOnAny(blood_plague_debuff excludeTarget=1) < 2 Spell(pestilence)
+	#pestilence,if=dot.blood_plague.ticking&talent.unholy_blight.enabled&cooldown.unholy_blight.remains<49,line_cd=28
+	if target.DebuffPresent(blood_plague_debuff) and TalentPoints(unholy_blight_talent) and SpellCooldown(unholy_blight) < 49 and DebuffRemainsOnAny(blood_plague_debuff excludeTarget=1) < 2 Spell(pestilence)
+	#howling_blast
+	Spell(howling_blast)
+	#blood_tap,if=talent.blood_tap.enabled&buff.blood_charge.stack>10
+	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge_buff) > 10 BloodTap()
+	#frost_strike,if=runic_power>76
+	if RunicPower() > 76 Spell(frost_strike)
+	#death_and_decay,if=unholy=1
+	if { Rune(unholy) >= 1 and Rune(unholy) < 2 } Spell(death_and_decay)
+	#plague_strike,if=unholy=2
+	if Rune(unholy) >= 2 Spell(plague_strike)
+	#blood_tap,if=talent.blood_tap.enabled
+	if TalentPoints(blood_tap_talent) BloodTap()
+	#frost_strike
+	Spell(frost_strike)
+	#horn_of_winter
+	Spell(horn_of_winter)
+	#plague_leech,if=talent.plague_leech.enabled&unholy=1
+	if TalentPoints(plague_leech_talent) and { Rune(unholy) >= 1 and Rune(unholy) < 2 } PlagueLeech()
+	#plague_strike,if=unholy=1
+	if { Rune(unholy) >= 1 and Rune(unholy) < 2 } Spell(plague_strike)
+}
+
+AddFunction FrostTwoHandSingleTargetActions
 {
-	if not InCombat()
+	#plague_leech,if=talent.plague_leech.enabled&((dot.blood_plague.remains<1|dot.frost_fever.remains<1))
+	if TalentPoints(plague_leech_talent) and { { target.DebuffRemains(blood_plague_debuff) < 1 or target.DebuffRemains(frost_fever_debuff) < 1 } } PlagueLeech()
+	#outbreak,if=!dot.frost_fever.ticking|!dot.blood_plague.ticking
+	if not target.DebuffPresent(frost_fever_debuff) or not target.DebuffPresent(blood_plague_debuff) Spell(outbreak)
+	#soul_reaper,if=target.health.pct-3*(target.health.pct%target.time_to_die)<=35
+	if target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } <= 35 Spell(soul_reaper_frost)
+	#blood_tap,if=talent.blood_tap.enabled&((target.health.pct-3*(target.health.pct%target.time_to_die)<=35&cooldown.soul_reaper.remains=0))
+	if TalentPoints(blood_tap_talent) and { { target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } <= 35 and not SpellCooldown(soul_reaper_frost) > 0 } } BloodTap()
+	#howling_blast,if=!dot.frost_fever.ticking
+	if not target.DebuffPresent(frost_fever_debuff) Spell(howling_blast)
+	#plague_strike,if=!dot.blood_plague.ticking
+	if not target.DebuffPresent(blood_plague_debuff) Spell(plague_strike)
+	#howling_blast,if=buff.rime.react
+	if BuffPresent(rime_buff) Spell(howling_blast)
+	#obliterate,if=buff.killing_machine.react
+	if BuffPresent(killing_machine_buff) Spell(obliterate)
+	#blood_tap,if=talent.blood_tap.enabled&buff.killing_machine.react
+	if TalentPoints(blood_tap_talent) and BuffPresent(killing_machine_buff) BloodTap()
+	#blood_tap,if=talent.blood_tap.enabled&(buff.blood_charge.stack>10&runic_power>76)
+	if TalentPoints(blood_tap_talent) and { BuffStacks(blood_charge_buff) > 10 and RunicPower() > 76 } BloodTap()
+	#frost_strike,if=runic_power>76
+	if RunicPower() > 76 Spell(frost_strike)
+	#obliterate,if=blood=2|frost=2|unholy=2
+	if Rune(blood) >= 2 or Rune(frost) >= 2 or Rune(unholy) >= 2 Spell(obliterate)
+	#plague_leech,if=talent.plague_leech.enabled&((dot.blood_plague.remains<3|dot.frost_fever.remains<3))
+	if TalentPoints(plague_leech_talent) and { { target.DebuffRemains(blood_plague_debuff) < 3 or target.DebuffRemains(frost_fever_debuff) < 3 } } PlagueLeech()
+	#outbreak,if=dot.frost_fever.remains<3|dot.blood_plague.remains<3
+	if target.DebuffRemains(frost_fever_debuff) < 3 or target.DebuffRemains(blood_plague_debuff) < 3 Spell(outbreak)
+	#unholy_blight,if=talent.unholy_blight.enabled&((dot.frost_fever.remains<3|dot.blood_plague.remains<3))
+	if TalentPoints(unholy_blight_talent) and { { target.DebuffRemains(frost_fever_debuff) < 3 or target.DebuffRemains(blood_plague_debuff) < 3 } } Spell(unholy_blight)
+	#frost_strike,if=talent.runic_empowerment.enabled&(frost=0|unholy=0|blood=0)
+	if TalentPoints(runic_empowerment_talent) and { Rune(frost) < 1 or Rune(unholy) < 1 or Rune(blood) < 1 } Spell(frost_strike)
+	#frost_strike,if=talent.blood_tap.enabled&buff.blood_charge.stack<=10
+	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge_buff) <= 10 Spell(frost_strike)
+	#horn_of_winter
+	Spell(horn_of_winter)
+	#obliterate
+	Spell(obliterate)
+	#blood_tap,if=talent.blood_tap.enabled&(buff.blood_charge.stack>10&runic_power>=20)
+	if TalentPoints(blood_tap_talent) and { BuffStacks(blood_charge_buff) > 10 and RunicPower() >= 20 } BloodTap()
+	#frost_strike
+	Spell(frost_strike)
+	#plague_leech,if=talent.plague_leech.enabled
+	if TalentPoints(plague_leech_talent) PlagueLeech()
+}
+
+AddFunction FrostTwoHandSingleTargetShortCdActions
+{
+	unless { TalentPoints(plague_leech_talent) and { { target.DebuffRemains(blood_plague_debuff) < 1 or target.DebuffRemains(frost_fever_debuff) < 1 } } and PlagueLeech() }
+		or { { not target.DebuffPresent(frost_fever_debuff) or not target.DebuffPresent(blood_plague_debuff) } and Spell(outbreak) }
 	{
-		Spell(army_of_the_dead)
-		Spell(blood_fury)
-		Spell(raise_dead)
+		#unholy_blight,if=talent.unholy_blight.enabled&((!dot.frost_fever.ticking|!dot.blood_plague.ticking))
+		if TalentPoints(unholy_blight_talent) and { { not target.DebuffPresent(frost_fever_debuff) or not target.DebuffPresent(blood_plague_debuff) } } Spell(unholy_blight)
 	}
-	if target.DeadIn() <=60 and {BuffPresent(mogu_power_potion_aura) or BuffPresent(golems_strength) } Spell(empower_rune_weapon)
-	if BuffPresent(pillar_of_frost) UseItemActions()
-	Spell(blood_fury)
-	Spell(raise_dead)
-	if TalentPoints(unholy_blight_talent) and {target.DebuffRemains(frost_fever) <3 or target.DebuffRemains(blood_plague) <3 } Spell(unholy_blight)
-	Spell(empower_rune_weapon)
 }

-AddIcon mastery=frost size=small checkboxon=opt_icons_right {}
+### Frost icons.
+
+AddIcon mastery=frost size=small checkboxon=opt_icons_left
+{
+	Spell(antimagic_shell)
+	Spell(icebound_fortitude)
+}
+
+AddIcon mastery=frost size=small checkboxon=opt_icons_left
+{
+	if TalentPoints(death_pact_talent) Spell(death_pact)
+	if TalentPoints(death_siphon_talent) Spell(death_siphon)
+}
+
+AddIcon mastery=frost help=shortcd
+{
+	if InCombat(no) FrostPrecombatShortCdActions()
+	FrostDefaultShortCdActions()
+	if HasWeapon(offhand) FrostOneHandSingleTargetShortCdActions()
+	if HasWeapon(offhand no) FrostTwoHandSingleTargetShortCdActions()
+}
+
+AddIcon mastery=frost help=main
+{
+	if InCombat(no) FrostPrecombatActions()
+	FrostDefaultActions()
+	if HasWeapon(offhand) FrostOneHandSingleTargetActions()
+	if HasWeapon(offhand no) FrostTwoHandSingleTargetActions()
+}
+
+AddIcon mastery=frost help=aoe checkboxon=opt_aoe
+{
+	if InCombat(no) FrostPrecombatActions()
+	FrostDefaultActions()
+	if HasWeapon(offhand) FrostOneHandAoeActions()
+	if HasWeapon(offhand no) FrostTwoHandAoeActions()
+}
+
+AddIcon mastery=frost help=cd
+{
+	if InCombat(no) FrostPrecombatCdActions()
+	Interrupt()
+	UseRacialInterruptActions()
+	FrostDefaultCdActions()
+}

 AddIcon mastery=frost size=small checkboxon=opt_icons_right
 {
-	UseItemActions()
+	#pestilence,if=dot.blood_plague.ticking&talent.plague_leech.enabled,line_cd=28
+	if target.DebuffPresent(blood_plague_debuff) and TalentPoints(plague_leech_talent) Spell(pestilence)
+	#pestilence,if=dot.blood_plague.ticking&talent.unholy_blight.enabled&cooldown.unholy_blight.remains<49,line_cd=28
+	if target.DebuffPresent(blood_plague_debuff) and TalentPoints(unholy_blight_talent) and SpellCooldown(unholy_blight) < 49 Spell(pestilence)
 }

-### Unholy icons.
+AddIcon mastery=frost size=small checkboxon=opt_icons_right
+{
+	UseItemActions()
+}

-AddIcon mastery=frost size=small checkboxon=opt_icons_left {}
-AddIcon mastery=frost size=small checkboxon=opt_icons_left {}
+###
+### Unholy
+###
+# Based on SimulationCraft profile "Death_Knight_Unholy_T16H".
+#	class=deathknight
+#	spec=unholy
+#	talents=http://us.battle.net/wow/en/tool/talent-calculator#db!2...0.

-AddIcon mastery=unholy help=offgcd
+AddFunction UnholyAoeActions
 {
-	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge) >10 and RunicPower() >=32 Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and {target.HealthPercent() -{3 *target.HealthPercent() /target.DeadIn() } <=35 and SpellCooldown(soul_reaper_unholy) ==0 } Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and BuffStacks(shadow_infusion) ==5 Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and RuneCount(unholy) ==2 and SpellCooldown(death_and_decay) ==0 Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and SpellCooldown(death_and_decay) ==0 Spell(blood_tap)
-	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge) >=8 Spell(blood_tap)
+	#unholy_blight,if=talent.unholy_blight.enabled
+	if TalentPoints(unholy_blight_talent) Spell(unholy_blight)
+	#plague_strike,if=!dot.blood_plague.ticking|!dot.frost_fever.ticking
+	if not target.DebuffPresent(blood_plague_debuff) or not target.DebuffPresent(frost_fever_debuff) Spell(plague_strike)
+	#pestilence,if=dot.blood_plague.ticking&talent.plague_leech.enabled,line_cd=28
+	if target.DebuffPresent(blood_plague_debuff) and TalentPoints(plague_leech_talent) and DebuffRemainsOnAny(blood_plague_debuff excludeTarget=1) < 2 Spell(pestilence)
+	#pestilence,if=dot.blood_plague.ticking&talent.unholy_blight.enabled&cooldown.unholy_blight.remains<49,line_cd=28
+	if target.DebuffPresent(blood_plague_debuff) and TalentPoints(unholy_blight_talent) and SpellCooldown(unholy_blight) < 49 and DebuffRemainsOnAny(blood_plague_debuff excludeTarget=1) < 2 Spell(pestilence)
+	#dark_transformation
+	Spell(dark_transformation)
+	#blood_tap,if=talent.blood_tap.enabled&buff.shadow_infusion.stack=5
+	if TalentPoints(blood_tap_talent) and BuffStacks(shadow_infusion_buff) == 5 BloodTap()
+	#blood_boil,if=blood=2|death=2
+	if Rune(blood) >= 2 or { Rune(death) >= 2 and Rune(death) < 3 } Spell(blood_boil)
+	#death_and_decay,if=unholy=1
+	if { Rune(unholy) >= 1 and Rune(unholy) < 2 } Spell(death_and_decay)
+	#soul_reaper,if=unholy=2&target.health.pct-3*(target.health.pct%target.time_to_die)<=35
+	if Rune(unholy) >= 2 and target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } <= 35 Spell(soul_reaper_unholy)
+	#scourge_strike,if=unholy=2
+	if Rune(unholy) >= 2 Spell(scourge_strike)
+	#blood_tap,if=talent.blood_tap.enabled&buff.blood_charge.stack>10
+	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge_buff) > 10 BloodTap()
+	#death_coil,if=runic_power>90|buff.sudden_doom.react|(buff.dark_transformation.down&rune.unholy<=1)
+	if RunicPower() > 90 or BuffPresent(sudden_doom_buff) or { BuffExpires(dark_transformation_buff) and Rune(unholy) <= 1 } Spell(death_coil)
+	#blood_boil
+	Spell(blood_boil)
+	#icy_touch
+	Spell(icy_touch)
+	#soul_reaper,if=unholy=1&target.health.pct-3*(target.health.pct%target.time_to_die)<=35
+	if { Rune(unholy) >= 1 and Rune(unholy) < 2 } and target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } <= 35 Spell(soul_reaper_unholy)
+	#scourge_strike,if=unholy=1
+	if { Rune(unholy) >= 1 and Rune(unholy) < 2 } Spell(scourge_strike)
+	#death_coil
+	Spell(death_coil)
+	#blood_tap,if=talent.blood_tap.enabled
+	if TalentPoints(blood_tap_talent) BloodTap()
+	#plague_leech,if=talent.plague_leech.enabled&unholy=1
+	if TalentPoints(plague_leech_talent) and { Rune(unholy) >= 1 and Rune(unholy) < 2 } PlagueLeech()
+	#horn_of_winter
+	Spell(horn_of_winter)
 }

-AddIcon mastery=unholy help=main
+AddFunction UnholySingleTargetActions
 {
-	if not InCombat()
-	{
-		unless Stance(3) Spell(unholy_presence)
-		Spell(horn_of_winter)
-	}
-	if AttackPower() >{LastSpellAttackPower(blood_plague) +5000 } and TimeInCombat() >15 and not {SpellCooldown(unholy_blight) >49 } Spell(outbreak)
-	if AttackPower() >{LastSpellAttackPower(blood_plague) +5000 } and TimeInCombat() >15 and not {SpellCooldown(unholy_blight) >49 } Spell(plague_strike)
-	if target.DebuffRemains(frost_fever) <3 or target.DebuffRemains(blood_plague) <3 Spell(outbreak)
-	if target.HealthPercent() -{3 *target.HealthPercent() /target.DeadIn() } <=35 Spell(soul_reaper_unholy)
-	if not target.DebuffPresent(blood_plague) or not target.DebuffPresent(frost_fever) Spell(plague_strike)
-	if BuffStacks(shadow_infusion) ==5 Spell(dark_transformation)
-	if RunicPower() >90 Spell(death_coil)
-	if RuneCount(unholy) ==2 Spell(death_and_decay)
-	if RuneCount(unholy) ==2 Spell(scourge_strike)
-	if RuneCount(blood) ==2 and RuneCount(frost) ==2 Spell(festering_strike)
+	#outbreak,if=stat.attack_power>(dot.blood_plague.attack_power*1.1)&time>15&!(cooldown.unholy_blight.remains>79)
+	if AttackPower() > { target.DebuffAttackPower(blood_plague_debuff) * 1.1 } and TimeInCombat() > 15 and not { SpellCooldown(unholy_blight) > 79 } Spell(outbreak)
+	#plague_strike,if=stat.attack_power>(dot.blood_plague.attack_power*1.1)&time>15&!(cooldown.unholy_blight.remains>79)
+	if AttackPower() > { target.DebuffAttackPower(blood_plague_debuff) * 1.1 } and TimeInCombat() > 15 and not { SpellCooldown(unholy_blight) > 79 } Spell(plague_strike)
+	#blood_tap,if=talent.blood_tap.enabled&(buff.blood_charge.stack>10&runic_power>=32)
+	if TalentPoints(blood_tap_talent) and { BuffStacks(blood_charge_buff) > 10 and RunicPower() >= 32 } BloodTap()
+	#outbreak,if=dot.frost_fever.remains<3|dot.blood_plague.remains<3
+	if target.DebuffRemains(frost_fever_debuff) < 3 or target.DebuffRemains(blood_plague_debuff) < 3 Spell(outbreak)
+	#soul_reaper,if=target.health.pct-3*(target.health.pct%target.time_to_die)<=35
+	if target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } <= 35 Spell(soul_reaper_unholy)
+	#blood_tap,if=talent.blood_tap.enabled&((target.health.pct-3*(target.health.pct%target.time_to_die)<=35&cooldown.soul_reaper.remains=0))
+	if TalentPoints(blood_tap_talent) and { { target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } <= 35 and not SpellCooldown(soul_reaper_unholy) > 0 } } BloodTap()
+	#plague_strike,if=!dot.blood_plague.ticking|!dot.frost_fever.ticking
+	if not target.DebuffPresent(blood_plague_debuff) or not target.DebuffPresent(frost_fever_debuff) Spell(plague_strike)
+	#dark_transformation
+	Spell(dark_transformation)
+	#death_coil,if=runic_power>90
+	if RunicPower() > 90 Spell(death_coil)
+	#death_and_decay,if=unholy=2
+	if Rune(unholy) >= 2 Spell(death_and_decay)
+	#blood_tap,if=talent.blood_tap.enabled&(unholy=2&cooldown.death_and_decay.remains=0)
+	if TalentPoints(blood_tap_talent) and { Rune(unholy) >= 2 and not SpellCooldown(death_and_decay) > 0 } BloodTap()
+	#scourge_strike,if=unholy=2
+	if Rune(unholy) >= 2 Spell(scourge_strike)
+	#festering_strike,if=blood=2&frost=2
+	if Rune(blood) >= 2 and Rune(frost) >= 2 Spell(festering_strike)
+	#death_and_decay
 	Spell(death_and_decay)
-	if BuffStacks(sudden_doom) or {BuffExpires(dark_transformation) and RuneCount(unholy) <=1 } Spell(death_coil)
+	#blood_tap,if=talent.blood_tap.enabled&cooldown.death_and_decay.remains=0
+	if TalentPoints(blood_tap_talent) and not SpellCooldown(death_and_decay) > 0 BloodTap()
+	#death_coil,if=buff.sudden_doom.react|(buff.dark_transformation.down&rune.unholy<=1)
+	if BuffPresent(sudden_doom_buff) or { BuffExpires(dark_transformation_buff) and Rune(unholy) <= 1 } Spell(death_coil)
+	#scourge_strike
 	Spell(scourge_strike)
-	if TalentPoints(plague_leech_talent) and SpellCooldown(outbreak) <1 Spell(plague_leech)
+	#plague_leech,if=talent.plague_leech.enabled&cooldown.outbreak.remains<1
+	if TalentPoints(plague_leech_talent) and SpellCooldown(outbreak) < 1 PlagueLeech()
+	#festering_strike
 	Spell(festering_strike)
+	#horn_of_winter
 	Spell(horn_of_winter)
-	if BuffExpires(dark_transformation) or {SpellCooldown(summon_gargoyle) >8 and BuffRemains(dark_transformation) >8 } Spell(death_coil)
+	#death_coil
+	Spell(death_coil)
+	#blood_tap,if=talent.blood_tap.enabled&buff.blood_charge.stack>=8
+	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge_buff) >= 8 BloodTap()
+	#empower_rune_weapon
+	Spell(empower_rune_weapon)
 }

-AddIcon mastery=unholy help=aoe checkboxon=opt_aoe {}
+AddFunction UnholySingleTargetShortCdActions
+{
+	unless { AttackPower() > { target.DebuffAttackPower(blood_plague_debuff) * 1.1 } and TimeInCombat() > 15 and not { SpellCooldown(unholy_blight) > 79 } and Spell(outbreak) }
+		or { AttackPower() > { target.DebuffAttackPower(blood_plague_debuff) * 1.1 } and TimeInCombat() > 15 and not { SpellCooldown(unholy_blight) > 79 } and Spell(plague_strike) }
+		or { TalentPoints(blood_tap_talent) and { BuffStacks(blood_charge_buff) > 10 and RunicPower() >= 32 } }
+	{
+		#unholy_blight,if=talent.unholy_blight.enabled&((dot.frost_fever.remains<3|dot.blood_plague.remains<3))
+		if TalentPoints(unholy_blight_talent) and { { target.DebuffRemains(frost_fever_debuff) < 3 or target.DebuffRemains(blood_plague_debuff) < 3 } } Spell(unholy_blight)
+	}
+}

-AddIcon mastery=unholy help=cd
+AddFunction UnholySingleTargetCdActions
 {
-	if not InCombat()
+	unless { AttackPower() > { target.DebuffAttackPower(blood_plague_debuff) * 1.1 } and TimeInCombat() > 15 and not { SpellCooldown(unholy_blight) > 79 } and Spell(outbreak) }
+		or { AttackPower() > { target.DebuffAttackPower(blood_plague_debuff) * 1.1 } and TimeInCombat() > 15 and not { SpellCooldown(unholy_blight) > 79 } and Spell(plague_strike) }
+		or { TalentPoints(blood_tap_talent) and { BuffStacks(blood_charge_buff) > 10 and RunicPower() >= 32 } }
+		or { TalentPoints(unholy_blight_talent) and { { target.DebuffRemains(frost_fever_debuff) < 3 or target.DebuffRemains(blood_plague_debuff) < 3 } } and Spell(unholy_blight) }
+		or { target.DebuffRemains(frost_fever_debuff) < 3 or target.DebuffRemains(blood_plague_debuff) < 3 and Spell(outbreak) }
+		or { target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } <= 35 and Spell(soul_reaper_unholy) }
+		or { TalentPoints(blood_tap_talent) and { { target.HealthPercent() -3 * { target.HealthPercent() / target.TimeToDie() } <= 35 and not SpellCooldown(soul_reaper_unholy) > 0 } } and BloodTap() }
+		or { not target.DebuffPresent(blood_plague_debuff) or not target.DebuffPresent(frost_fever_debuff) and Spell(plague_strike) }
 	{
+		#summon_gargoyle
+		Spell(summon_gargoyle)
+	}
+}
+
+AddFunction UnholyDefaultActions
+{
+	#auto_attack
+	#run_action_list,name=aoe,if=active_enemies>=3
+	#if Enemies() >= 3 UnholyAoeActions()
+	#run_action_list,name=single_target,if=active_enemies<3
+	#if Enemies() < 3 UnholySingleTargetActions()
+}
+
+AddFunction UnholyDefaultCdActions
+{
+	#blood_fury
+	Spell(blood_fury)
+	#berserking
+	Spell(berserking)
+	#arcane_torrent
+	Spell(arcane_torrent)
+	#use_item,slot=hands
+	UseItemActions()
+	#mogu_power_potion,if=buff.dark_transformation.up&target.time_to_die<=60
+	if BuffPresent(dark_transformation_buff) and target.TimeToDie() <= 60 UsePotionStrength()
+	#unholy_frenzy,if=time>=4
+	if TimeInCombat() >= 4 Spell(unholy_frenzy)
+}
+
+AddFunction UnholyPrecombatActions
+{
+	#flask,type=winters_bite
+	#food,type=black_pepper_ribs_and_shrimp
+	#horn_of_winter
+	Spell(horn_of_winter)
+	#unholy_presence
+	if not Stance(deathknight_unholy_presence) Spell(unholy_presence)
+	#snapshot_stats
+}
+
+AddFunction UnholyPrecombatCdActions
+{
+	if Stance(deathknight_unholy_presence)
+	{
+		#army_of_the_dead
 		Spell(army_of_the_dead)
-		Spell(blood_fury)
+		#mogu_power_potion
+		UsePotionStrength()
+		#raise_dead
 		Spell(raise_dead)
 	}
-	if TimeInCombat() >=2 Spell(blood_fury)
-	if TimeInCombat() >=4 Spell(unholy_frenzy)
-	if TimeInCombat() >=4 UseItemActions()
-	if TalentPoints(unholy_blight_talent) and {target.DebuffRemains(frost_fever) <3 or target.DebuffRemains(blood_plague) <3 } Spell(unholy_blight)
-	Spell(summon_gargoyle)
-	Spell(empower_rune_weapon)
 }

-AddIcon mastery=unholy size=small checkboxon=opt_icons_right {}
+### Unholy icons.
+
+AddIcon mastery=unholy size=small checkboxon=opt_icons_left
+{
+	Spell(antimagic_shell)
+	Spell(icebound_fortitude)
+}
+
+AddIcon mastery=unholy size=small checkboxon=opt_icons_left
+{
+	if TalentPoints(death_pact_talent) Spell(death_pact)
+	if TalentPoints(death_siphon_talent) Spell(death_siphon)
+}
+
+AddIcon mastery=unholy help=shortcd
+{
+	UnholyDefaultShortCdActions()
+	UnholySingleTargetShortCdActions()
+}
+
+AddIcon mastery=unholy help=main
+{
+	if InCombat(no) UnholyPrecombatActions()
+	UnholyDefaultActions()
+	UnholySingleTargetActions()
+}
+
+AddIcon mastery=unholy help=aoe checkboxon=opt_aoe
+{
+	if InCombat(no) UnholyPrecombatActions()
+	UnholyDefaultActions()
+	UnholyAoeActions()
+}
+
+AddIcon mastery=unholy help=cd
+{
+	if InCombat(no) UnholyPrecombatCdActions()
+	Interrupt()
+	UseRacialInterruptActions()
+	UnholyDefaultCdActions()
+	UnholySingleTargetCdActions()
+}
+
+AddIcon mastery=unholy size=small checkboxon=opt_icons_right
+{
+	#pestilence,if=dot.blood_plague.ticking&talent.plague_leech.enabled,line_cd=28
+	if target.DebuffPresent(blood_plague_debuff) and TalentPoints(plague_leech_talent) Spell(pestilence)
+	#pestilence,if=dot.blood_plague.ticking&talent.unholy_blight.enabled&cooldown.unholy_blight.remains<49,line_cd=28
+	if target.DebuffPresent(blood_plague_debuff) and TalentPoints(unholy_blight_talent) and SpellCooldown(unholy_blight) < 49 Spell(pestilence)
+}

 AddIcon mastery=unholy size=small checkboxon=opt_icons_right
 {
diff --git a/scripts/ovale_deathknight_spells.lua b/scripts/ovale_deathknight_spells.lua
index 5fb7d35..eb65945 100644
--- a/scripts/ovale_deathknight_spells.lua
+++ b/scripts/ovale_deathknight_spells.lua
@@ -3,95 +3,219 @@ local OvaleScripts = Ovale.OvaleScripts

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

+Define(antimagic_shell 48707)
+	SpellInfo(antimagic_shell cd=45)
 Define(army_of_the_dead 42650)
-	SpellInfo(army_of_the_dead duration=4 frost=1 blood=1 unholy=1 runicpower=-300 cd=600)
-	SpellAddBuff(army_of_the_dead army_of_the_dead=1)
-Define(blood_charge 114851)
-	SpellInfo(blood_charge duration=25)
-	SpellAddBuff(blood_charge blood_charge=1)
-Define(blood_plague 55078)
-	SpellInfo(blood_plague duration=30 tick=3)
-	SpellAddTargetDebuff(blood_plague blood_plague=1)
+	SpellInfo(army_of_the_dead blood=1 frost=1 unholy=1 cd=600)
+	SpellAddBuff(army_of_the_dead army_of_the_dead_buff=1)
+Define(army_of_the_dead_buff 42650)
+	SpellInfo(army_of_the_dead duration=40)
+Define(asphyxiate 108194)
+	SpellInfo(asphyxiate cd=30)
+Define(asphyxiate_talent 9)
+Define(blood_boil 48721)
+	SpellInfo(blood_boil blood=1)
+	SpellInfo(blood_boil buff_runes_none=crimson_scourge_buff if_spell=crimson_scourge)
+	SpellAddTargetDebuff(blood_boil blood_plague_debuff=refresh frost_fever_debuff=refresh if_spell=scarlet_fever)
+Define(blood_charge_buff 114851)
+	SpellInfo(blood_charge_buff duration=25 maxstacks=12)
+Define(blood_plague 59879)
+Define(blood_plague_debuff 55078)
+	SpellInfo(blood_plague_debuff duration=30 tick=3)
+Define(blood_presence 48263)
 Define(blood_tap 45529)
+	SpellAddBuff(blood_tap blood_charge_buff=-5)
 Define(blood_tap_talent 13)
+Define(bone_shield 49222)
+	SpellInfo(bone_shield cd=60)
+	SpellAddBuff(bone_shield bone_shield_buff=1)
+Define(bone_shield_buff 49222)
+	SpellInfo(bone_shield_buff duration=300)
+Define(crimson_scourge 81136)
+Define(crimson_scourge_buff 81141)
+	SpellInfo(crimson_scourge_buff duration=15)
+Define(dancing_rune_weapon 49028)
+	SpellInfo(dancing_rune_weapon cd=90)
+	SpellAddBuff(dancing_rune_weapon dancing_rune_weapon_buff=1)
+Define(dancing_rune_weapon_buff 81256)
+	SpellInfo(dancing_rune_weapon_buff duration=12)
+Define(dark_simulacrum 77606)
+	SpellInfo(dark_simulacrum cd=60)
+	SpellInfo(dark_simulacrum addcd=-30 glyph=glyph_of_dark_simulacrum)
+Define(dark_simulacrum_buff 77606)
+	SpellInfo(dark_simulacrum_buff duration=8)
+	SpellInfo(dark_simulacrum_buff addduration=4 glyph=glyph_of_dark_simulacrum)
 Define(dark_transformation 63560)
-	SpellInfo(dark_transformation duration=30 unholy=1 runicpower=-100)
-	SpellAddBuff(dark_transformation dark_transformation=1)
+	SpellInfo(dark_transformation unholy=1)
+	SpellAddBuff(dark_transformation dark_transformation_buff=1 shadow_infusion_buff=-5)
+Define(dark_transformation_buff 63560)
+	SpellInfo(dark_transformation_buff duration=30)
 Define(death_and_decay 43265)
-	SpellInfo(death_and_decay duration=10 unholy=1 runicpower=-100 cd=30)
-	SpellAddBuff(death_and_decay death_and_decay=1)
+	SpellInfo(death_and_decay unholy=1 cd=30)
+	SpellInfo(death_and_decay buff_runes_none=crimson_scourge_buff if_spell=crimson_scourge)
 Define(death_coil 47541)
-	SpellInfo(death_coil runicpower=400)
+	SpellInfo(death_coil runicpower=40)
+	SpellInfo(death_coil runicpower=32 if_spell=sudden_doom)
+	SpellInfo(death_coil buff_runicpower_none=sudden_doom_buff if_spell=sudden_doom)
+Define(death_grip 49576)
+	SpellInfo(death_grip cd=25)
+Define(death_pact 48743)
+	SpellInfo(death_pact cd=120)
+Define(death_pact_talent 10)
+Define(death_siphon 108196)
+	SpellInfo(death_siphon death=1)
+Define(death_siphon_talent 10)
+Define(death_strike 49998)
+	SpellInfo(death_strike frost=1 unholy=1)
+Define(ebon_plaguebringer 51160)
 Define(empower_rune_weapon 47568)
-	SpellInfo(empower_rune_weapon runicpower=-250 cd=300)
+	SpellInfo(empower_rune_weapon cd=300 runicpower=-25)
 Define(festering_strike 85948)
-	SpellInfo(festering_strike frost=1 blood=1 runicpower=-200)
-Define(frost_fever 55095)
-	SpellInfo(frost_fever duration=30 tick=3)
-	SpellAddTargetDebuff(frost_fever frost_fever=1)
+	SpellInfo(festering_strike blood=1 frost=1)
+Define(frost_fever_debuff 55095)
+	SpellInfo(frost_fever_debuff duration=30 tick=3)
 Define(frost_presence 48266)
-	SpellAddBuff(frost_presence frost_presence=1)
 Define(frost_strike 49143)
-	SpellInfo(frost_strike runicpower=350)
-Define(golems_strength 79634)
-	SpellInfo(golems_strength duration=25 cd=1)
-	SpellAddBuff(golems_strength golems_strength=1)
+	SpellInfo(frost_strike runicpower=35)
+	SpellAddBuff(frost_strike killing_machine_buff=0 if_spell=killing_machine)
+Define(glyph_of_dark_simulacrum 63331)
+Define(glyph_of_icebound_fortitude 58673)
+Define(glyph_of_mind_freeze 58686)
+Define(glyph_of_outbreak 59332)
+Define(glyph_of_the_loud_horn 146646)
+Define(heart_strike 55050)
+	SpellInfo(heart_strike blood=1)
 Define(horn_of_winter 57330)
-	SpellInfo(horn_of_winter duration=300 runicpower=-100 cd=20)
-	SpellAddBuff(horn_of_winter horn_of_winter=1)
+	SpellInfo(horn_of_winter cd=20 runicpower=-10)
+	SpellInfo(horn_of_winter cd=40 runicpower=-20 glyph=glyph_of_the_loud_horn)
 Define(howling_blast 49184)
-	SpellInfo(howling_blast frost=1 runicpower=-100)
+	SpellInfo(howling_blast frost=1)
+	SpellInfo(howling_blast buff_runes_none=rime_buff if_spell=rime)
+	SpellAddBuff(howling_blast rime_buff=0 if_spell=rime)
+	SpellAddTargetDebuff(howling_blast frost_fever_debuff=1)
+Define(icebound_fortitude 48792)
+	SpellInfo(icebound_fortitude cd=180)
+	SpellInfo(icebound_fortitude cd=90 glyph=glyph_of_icebound_fortitude)
+	SpellAddBuff(icebound_fortitude icebound_fortitude_buff=1)
+Define(icebound_fortitude_buff 48792)
+	SpellInfo(icebound_fortitude_buff duration=12)
+	SpellInfo(icebound_fortitude_buff duration=3 glyph=glyph_of_icebound_fortitude)
+Define(icy_touch 45477)
+	SpellInfo(icy_touch frost=1)
+	SpellInfo(icy_touch buff_runes_none=rime_buff if_spell=rime)
+	SpellAddBuff(icy_touch rime_buff=0 if_spell=rime)
+	SpellAddTargetDebuff(icy_touch frost_fever_debuff=1)
 Define(killing_machine 51128)
-Define(mogu_power_potion_aura 105706)
-	SpellInfo(mogu_power_potion_aura duration=25 cd=1)
-	SpellAddBuff(mogu_power_potion_aura mogu_power_potion_aura=1)
+Define(killing_machine_buff 51124)
+	SpellInfo(killing_machine_buff duration=10)
+Define(master_of_ghouls 52143)
+Define(mind_freeze 47528)
+	SpellInfo(mind_freeze cd=15)
+	SpellInfo(mind_freeze addcd=-1 runicpower=10 glyph=glyph_of_mind_freeze)
 Define(obliterate 49020)
-	SpellInfo(obliterate frost=1 unholy=1 runicpower=-200)
+	SpellInfo(obliterate frost=1 unholy=1)
+	SpellAddBuff(obliterate killing_machine_buff=0 if_spell=killing_machine)
 Define(outbreak 77575)
-	SpellInfo(outbreak runicpower=0 cd=60)
+	SpellInfo(outbreak cd=60 glyph=!glyph_of_outbreak)
+	SpellInfo(outbreak runicpower=30 glyph=glyph_of_outbreak)
+	SpellAddTargetDebuff(outbreak blood_plague_debuff=1 frost_fever_debuff=1)
+Define(pestilence 50842)
+	SpellInfo(pestilence blood=1)
 Define(pillar_of_frost 51271)
-	SpellInfo(pillar_of_frost duration=20 frost=1 runicpower=-100 cd=60)
-	SpellAddBuff(pillar_of_frost pillar_of_frost=1)
+	SpellInfo(pillar_of_frost cd=60 frost=1)
+	SpellAddBuff(pillar_of_frost pillar_of_frost_buff=1)
+Define(pillar_of_frost_buff 51271)
+	SpellInfo(pillar_of_frost duration=20)
 Define(plague_leech 123693)
 	SpellInfo(plague_leech cd=25)
+	SpellAddTargetDebuff(plague_leech blood_plague_debuff=0 frost_fever_debuff=0)
 Define(plague_leech_talent 2)
 Define(plague_strike 45462)
-	SpellInfo(plague_strike unholy=1 runicpower=-100)
+	SpellInfo(plague_strike unholy=1)
+	SpellAddTargetDebuff(plague_strike blood_plague_debuff=1)
+	SpellAddTargetDebuff(plague_strike frost_fever_debuff=1 if_spell=ebon_plaguebringer)
 Define(raise_dead 46584)
 	SpellInfo(raise_dead cd=120)
-	SpellAddBuff(raise_dead raise_dead=1)
+	SpellInfo(raise_dead addcd=-60 if_spell=master_of_ghouls)
 Define(rime 59057)
-Define(runic_corruption 51460)
-	SpellInfo(runic_corruption duration=3)
-	SpellAddBuff(runic_corruption runic_corruption=1)
+Define(rime_buff 59052)
+	SpellInfo(rime_buff duration=15)
+Define(rune_strike 56815)
+	SpellInfo(rune_strike runicpower=30)
+Define(rune_tap 48982)
+	SpellInfo(rune_tap blood=1 cd=30)
+	SpellInfo(rune_tap blood=0 addcd=-10 itemset=T15_tank itemcount=2)
+	SpellInfo(rune_tap buff_runes_none=will_of_the_necropolis_buff if_spell=will_of_the_necropolis)
+	SpellAddBuff(rune_tap will_of_the_necropolis_buff=0 if_spell=will_of_the_necropolis)
+Define(runic_corruption_buff 51460)
+	SpellInfo(runic_corruption_buff duration=3)
 Define(runic_corruption_talent 15)
 Define(runic_empowerment_talent 14)
+Define(scarlet_fever 81132)
 Define(scourge_strike 55090)
-	SpellInfo(scourge_strike unholy=1 runicpower=-100)
-Define(shadow_infusion 91342)
+	SpellInfo(scourge_strike unholy=1)
+Define(shadow_infusion_buff 91342)
+	SpellInfo(shadow_infusion_buff duration=30 maxstacks=5)
 Define(soul_reaper_blood 114866)
-	SpellInfo(soul_reaper_blood blood=1 runicpower=-200 cd=6)
+	SpellInfo(soul_reaper_blood blood=1 cd=6)
+	SpellAddBuff(soul_reaper_blood killing_machine_buff=0 if_spell=killing_machine itemset=T15_melee itemcount=4)
 Define(soul_reaper_frost 130735)
-	SpellInfo(soul_reaper_frost frost=1 runicpower=-200 cd=6)
+	SpellInfo(soul_reaper_frost frost=1 cd=6)
+	SpellAddBuff(soul_reaper_frost killing_machine_buff=0 if_spell=killing_machine itemset=T15_melee itemcount=4)
 Define(soul_reaper_unholy 130736)
-	SpellInfo(soul_reaper_unholy unholy=1 runicpower=-200 cd=6)
+	SpellInfo(soul_reaper_unholy unholy=1 cd=6)
+	SpellAddBuff(soul_reaper_unholy killing_machine_buff=0 if_spell=killing_machine itemset=T15_melee itemcount=4)
+Define(strangulate 47476)
+	SpellInfo(strangulate blood=1 cd=60)
 Define(sudden_doom 49530)
+Define(sudden_doom_buff 81340)
+	SpellInfo(sudden_doom_buff duration=10)
 Define(summon_gargoyle 49206)
-	SpellInfo(summon_gargoyle duration=40 cd=180)
-	SpellAddBuff(summon_gargoyle summon_gargoyle=1)
+	SpellInfo(summon_gargoyle cd=180)
 Define(unholy_blight 115989)
-	SpellInfo(unholy_blight duration=10 cd=90)
-	SpellAddBuff(unholy_blight unholy_blight=1)
+	SpellInfo(unholy_blight cd=90)
 Define(unholy_blight_talent 3)
 Define(unholy_frenzy 49016)
-	SpellInfo(unholy_frenzy duration=30 cd=180)
-	SpellAddBuff(unholy_frenzy unholy_frenzy=1)
+	SpellInfo(unholy_frenzy cd=180)
 Define(unholy_presence 48265)
-	SpellAddBuff(unholy_presence unholy_presence=1)
+Define(vampiric_blood 55233)
+	SpellInfo(vampiric_blood cd=60)
+	SpellInfo(vampiric_blood addcd=-10 itemset=T14_tank itemcount=2)
+	SpellAddBuff(vampiric_blood vampiric_blood_buff=1)
+Define(vampiric_blood_buff 55233)
+	SpellInfo(vampiric_blood_buff duration=10)
+Define(will_of_the_necropolis 81164)
+Define(will_of_the_necropolis_buff 96171)
+	SpellInfo(will_of_the_necropolis_buff duration=8)
+
+AddFunction Interrupt
+{
+	if target.IsFriend(no) and target.IsInterruptible()
+	{
+		if target.InRange(mind_freeze) Spell(mind_freeze)
+		if target.Classification(worldboss no)
+		{
+			if TalentPoints(asphyxiate_talent) and target.InRange(asphyxiate) Spell(asphyxiate)
+			if target.InRange(strangulate) Spell(strangulate)
+		}
+	}
+}
+
+AddFunction BloodTap
+{
+	# Blood Tap requires a minimum of five stacks of Blood Charge to be on the player.
+	if TalentPoints(blood_tap_talent) and BuffStacks(blood_charge_buff) >= 5 Spell(blood_tap)
+}
+
+AddFunction PlagueLeech
+{
+	# Plague Leech requires both Blood Plague and Frost Fever to exist on the target.
+	if TalentPoints(plague_leech_talent) and target.DebuffPresent(blood_plague_debuff) and target.DebuffPresent(frost_fever_debuff) Spell(plague_leech)
+}
 ]]
 	OvaleScripts:RegisterScript("DEATHKNIGHT", name, desc, code, "include")
 end