Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4264 - Unholy: Primary - Death Coil Auto Pop (Align Runes + RP with Frost #4283

Open
wants to merge 2 commits into
base: thewarwithin
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 17 additions & 32 deletions TheWarWithin/DeathKnightUnholy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@ local spec = Hekili:NewSpecialization( 252 )
spec:RegisterResource( Enum.PowerType.Runes, {
rune_regen = {
last = function () return state.query_time end,
stop = function( x ) return x == 6 end,

interval = function( time, val )
local r = state.runes
val = math.floor( val )

val = floor( val )
if val == 6 then return -1 end
return r.expiry[ val + 1 ] - time
return state.runes.expiry[ val + 1 ] - time
end,

stop = function( x ) return x == 6 end,
value = 1,
},
}
}, setmetatable( {
expiry = { 0, 0, 0, 0, 0, 0 },
cooldown = 10,
Expand All @@ -42,52 +39,40 @@ spec:RegisterResource( Enum.PowerType.Runes, {

reset = function()
local t = state.runes

for i = 1, 6 do
local start, duration, ready = GetRuneCooldown( i )
start = start or 0
duration = duration or ( 10 * state.haste )
start = roundUp( start, 3 )

t.expiry[ i ] = ready and 0 or start + duration
t.expiry[ i ] = ready and 0 or ( start + duration )
t.cooldown = duration
end

table.sort( t.expiry )
t.actual = nil -- Reset actual to force recalculation
end,

gain = function( amount )
local t = state.runes

for i = 1, amount do
t.expiry[ 7 - i ] = 0
table.insert( t.expiry, 0 )
t.expiry[ 7 ] = nil
end
table.sort( t.expiry )
t.actual = nil -- Reset actual to force recalculation
end,

spend = function( amount )
local t = state.runes

for i = 1, amount do
if t.expiry[ 4 ] > state.query_time then
t.expiry[ 1 ] = t.expiry[ 4 ] + t.cooldown
else
t.expiry[ 1 ] = state.query_time + t.cooldown
end
table.sort( t.expiry )
local nextReady = ( t.expiry[ 4 ] > 0 and t.expiry[ 4 ] or state.query_time ) + t.cooldown
table.remove( t.expiry, 1 )
table.insert( t.expiry, nextReady )
end

if amount > 0 then
-- Handle Runic Power gain
state.gain( amount * 10, "runic_power" )
-- Handle Runic Power gain
state.gain( amount * 10, "runic_power" )

-- Handle Tier 20 4-piece set bonus
if state.set_bonus.tier20_4pc == 1 then
state.cooldown.army_of_the_dead.expires = max( 0, state.cooldown.army_of_the_dead.expires - 1 )
end
end
-- Handle Tier 20 4-piece set bonus
if state.set_bonus.tier20_4pc == 1 then
state.cooldown.army_of_the_dead.expires = max( 0, state.cooldown.army_of_the_dead.expires - 1 )
end

t.actual = nil -- Reset actual to force recalculation
end,
Expand Down Expand Up @@ -146,7 +131,7 @@ spec:RegisterResource( Enum.PowerType.Runes, {
else
local amount = k:match( "time_to_(%d+)" )
amount = amount and tonumber( amount )
if amount then return state:TimeToResource( t, amount ) end
if amount then return t.timeTo( amount ) end
end
end
}))
Expand Down