From b41f53cf526cbd09564e415e2c0c55d371e07053 Mon Sep 17 00:00:00 2001 From: Taracque Date: Tue, 9 Dec 2014 18:59:06 +0100 Subject: [PATCH] Unholy priority list finished, still needs some code optimizations --- DKCrutch.lua | 114 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 96 insertions(+), 18 deletions(-) diff --git a/DKCrutch.lua b/DKCrutch.lua index d01a9bc..2662199 100755 --- a/DKCrutch.lua +++ b/DKCrutch.lua @@ -48,6 +48,7 @@ DKCrutch.SpellList = { ["Blood Charge"] = GetSpellInfo(114851), ["Unholy Blight"] = GetSpellInfo(115989), ["Breath of Sindragosa"] = GetSpellInfo(152279), + ["Mark of Sindragosa"] = GetSpellInfo(155166), -- draenor perks -- -- unholy -- @@ -1122,18 +1123,99 @@ function DKCrutch:AdviseUnholyAbility() -- Breath of Sindragosa, if runic power > 75 if (DKCrutch.tier7talent == 21209) and (DKCrutch.SpellList["Breath of Sindragosa"]) then - local dccd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Breath of Sindragosa"]); - if (dccd) and (dccd <= 1) and (UnitPower("player", 6) > 75) then + local bscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Breath of Sindragosa"]); + if (bscd) and (bscd <= 1) and (UnitPower("player", 6) > 75) then return "Breath of Sindragosa"; end - -- If Breath of Sindragosa active focus on RP generation + local msName, _, _, _, _, _, msExpiration, msUnitCaster = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Mark of Sindragosa"], "player"); + if (msName) and (msExpiration - GetTime() > 0) then + if (UnitPower("player", 6) < 88) then + local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"]) + if (ddcd) and (ddcd <= 1) then + return "Death and Decay"; + end + end + if (UnitPower("player", 6) < 77) then + local fscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Festering Strike"]) + if (fscd) and (fscd <= 1) then + return "Festering Strike"; + end + end + if (UnitPower("player", 6) < 88) then + local sscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Scourge Strike"]) + if (sscd) and (sscd <= 1) then + return "Scourge Strike"; + end + end + if (DKCrutch.SpellList["Blood Tap"]) then + local name,_,_,count = DKCrutch:hasBuff("player", DKCrutch.SpellList["Blood Charge"]) + if (count) and (count>=5) and (DKCrutch.depletedCount>0) then + return "Blood Tap" + end + end + if (DKCrutch.tier1talent == 19166) and (DKCrutch.SpellList["Plague Leech"]) then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then + return "Plague Leech"; + end + end + cd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Empower Rune Weapon"]) + if (cd) and (cd <= 1) then + return "Empower Rune Weapon" + end + if (DKCrutch:hasBuff("player", DKCrutch.SpellList["Sudden Doom"])) then + return "Death Coil"; + end + end + -- start generate runic power for Breath of Sindragosa + if (bscd < 7) and (UnitPower("player", 6) < 88) then + local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"]) + if (ddcd) and (ddcd <= 1) then + return "Death and Decay" + end + local sscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Scourge Strike"]) + if (sscd) and (sscd <= 1) then + return "Scourge Strike"; + end + local fscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Festering Strike"]) + if (fscd) and (fscd <= 1) then + return "Festering Strike"; + end + end + end + + -- Death and Decay if 2 unholy runes are up + if (DKCrutch.SpellList["Death and Decay"]) and (DKCrutch.runesUp[2] >= 2) then + local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"]) + if (ddcd) and (ddcd <= 1) then + return "Death and Decay"; + end end - -- Blood Tap if have at least 10 charges, and have >=32 runic power + -- Scourge Strike if 2 unholy runes are up + if (DKCrutch.SpellList["Scourge Strike"]) and (DKCrutch.runesUp[2] >= 2) then + local sscd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Scourge Strike"]) + if (sscd) and (sscd <= 1) then + return "Scourge Strike"; + end + end + + -- Death coil if Sudden Doom proc, or runic power > 90 + local dccd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death Coil"]) + if (dccd) and (dccd <= 1) and ( + ( + (DKCrutch:hasBuff("player", DKCrutch.SpellList["Sudden Doom"])) and + (UnitPower("player", 6) >= 30) + ) + or (UnitPower("player", 6) > 90) + ) then + return "Death Coil" + end + + -- Blood Tap if have at least 10 charges, and have >=30 runic power if (DKCrutch.SpellList["Blood Tap"]) then local name,_,_,count = DKCrutch:hasBuff("player", DKCrutch.SpellList["Blood Charge"]) - if (count) and (count>10) and (DKCrutch.depletedCount>0) and (UnitPower("player", 6) >= 32) then + if (count) and (count>10) and (DKCrutch.depletedCount>0) and (UnitPower("player", 6) >= 30) then return "Blood Tap" end end @@ -1172,17 +1254,6 @@ function DKCrutch:AdviseUnholyAbility() end end - -- Death coil if Sudden Doom proc, or runic power > 90 - local dccd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death Coil"]) - if (dccd) and (dccd <= 1) and ( - ( - (DKCrutch:hasBuff("player", DKCrutch.SpellList["Sudden Doom"])) and - (UnitPower("player", 6) >= 30) - ) - or (UnitPower("player", 6) > 90) - ) then - return "Death Coil" - end -- Scourge Strike if (sscd) and (sscd <= 1) then @@ -1195,12 +1266,19 @@ function DKCrutch:AdviseUnholyAbility() end -- Death Coil - if (dscd) and (dccd <= 1) and (IsUsableSpell(DKCrutch.SpellList["Death Coil"])) then + if (dccd) and (dccd <= 1) and (IsUsableSpell(DKCrutch.SpellList["Death Coil"])) then if (UnitPower("player", 6) >= 30) then return "Death Coil" end end - + + -- Plague Leech + if (DKCrutch.tier1talent == 19166) and (DKCrutch.SpellList["Plague Leech"]) then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then + return "Plague Leech"; + end + end + -- Empower Rune Weapon cd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Empower Rune Weapon"]) if (cd) and (cd <= 1) and (DKCrutch.runesUp[2] == 0) then -- 1.7.9.5