HeroRotation

HeroRotation

5M Downloads

[DK] Sacrificial Pact is recommended without a Ghoul out

SulpherStaer opened this issue ยท 4 comments

commented

As title says, i've been getting Sacrificial Pact as suggested next ability, but without a ghoul out, that doesn't work.
Seemingly it doesn't check if I have a ghoul, or if even the Raise Dead is on cooldown (if its off cooldown, there is no ghoul anyway, as it has expired)
image

commented

is this a fix for UH dk?

commented

I'm not very familiar with WoW's Lua API, but below is an example of grabbing the ghouls GUID & the time when it's summoned. If I have time later today after work I'll see where this might fit into hero-rotation and make a pull request. If another contributor sees this first feel free to implement it.

local summonedGhoul, summonedTime
local frame = CreateFrame("Frame")
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")

frame:SetScript("OnEvent", function(self, event)
    self:OnEvent(event, CombatLogGetCurrentEventInfo())
end)

function frame:OnEvent(event, ...)
    local timestamp, subevent, _, sourceGUID, _, _, _, destGUID, _, _, _, spellId = ...
    if (subevent ~= "SPELL_SUMMON") then return end
    if (spellId ~= 46585) then return end
    if (sourceGUID ~= UnitGUID("player"))  then return end
    summonedGhoul = destGUID
    summonedTime = timestamp
end
commented

Sacrificial Pact suggestion fixed in 8703f1c

commented

Using the cooldown of raise dead will cause issues. There are times your ghoul will despawn, but HR will believe it's still alive. Torghast is bad for this since moving floors can cause the ghoul to despawn. Below is what I've been using to reliably track if the ghoul is still up. This also ensures that the ghoul has recently attacked which means it should be in the damage range for sacrificial pact.

HL:RegisterForSelfCombatEvent(function(_, _, _, _, _, _, _, destGUID, _, _, _, spellId)
  if spellId ~= 46585 then return end
  HL.GhoulTable.SummonedGhoul = destGUID
  -- Unsure if there's any items that could extend the ghouls time past 60 seconds
  HL.GhoulTable.SummonExpiration = time() + 60
end, "SPELL_SUMMON")

HL:RegisterForSelfCombatEvent(function(_, _, _, _, _, _, _, _, _, _, _, spellId)
  if spellId ~= 327574 then return end
  HL.GhoulTable:reset()
end, "SPELL_CAST_SUCCESS")

HL:RegisterForCombatEvent(function(_, _, _, _, _, _, _, destGUID)
  if destGUID ~= HL.GhoulTable.SummonedGhoul then return end
  HL.GhoulTable:reset()
end, "UNIT_DESTROYED")

HL:RegisterForCombatEvent(function(_, _, _, srcGUID, _, _, _, _)
  if srcGUID ~= HL.GhoulTable.SummonedGhoul then return end
  HL.GhoulTable.AttackTime = time()
end, "SWING_DAMAGE")
  HL.GhoulTable = {
    SummonedGhoul = nil,
    SummonExpiration = nil,
    AttackTime = nil
  }

  function HL.GhoulTable:reset()
    HL.GhoulTable.SummonedGhoul = nil
    HL.GhoulTable.SummonExpiration = nil
    HL.GhoulTable.AttackTime = nil
    end

  function HL.GhoulTable:remains()
    if HL.GhoulTable.SummonExpiration == nil then return 0 end
    return HL.GhoulTable.SummonExpiration - time()
  end

  function HL.GhoulTable:lastAttack()
    if HL.GhoulTable.AttackTime == nil then return 0 end
    return time() - HL.GhoulTable.AttackTime
  end

  function HL.GhoulTable:active()
    return HL.GhoulTable.SummonedGhoul ~= nil and HL.GhoulTable:remains() > 0 and HL.GhoulTable.AttackTime ~= nil and HL.GhoulTable:lastAttack() <= 3
  end