Skip to content

Commit

Permalink
Fix cast history/handling of channeled spells (fix Windwalker bug rep…
Browse files Browse the repository at this point in the history
…ort).
  • Loading branch information
Hekili committed Feb 6, 2020
1 parent 41dc571 commit 49eda8a
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 41 deletions.
4 changes: 2 additions & 2 deletions Classes/DeathKnightBlood.lua
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ if UnitClassBase( 'player' ) == 'DEATHKNIGHT' then

talent = "blooddrinker",

handler = function ()
start = function ()
applyDebuff( "target", "blooddrinker" )
end,
},
Expand Down Expand Up @@ -1204,7 +1204,7 @@ if UnitClassBase( 'player' ) == 'DEATHKNIGHT' then
startsCombat = true,
texture = 1100041,

handler = function ()
start = function ()
applyBuff( "wraith_walk" )
end,
},
Expand Down
2 changes: 1 addition & 1 deletion Classes/DemonHunterHavoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ if UnitClassBase( 'player' ) == 'DEMONHUNTER' then

talent = "fel_barrage",

handler = function ()
start = function ()
applyBuff( "fel_barrage", 2 )
end,
},
Expand Down
4 changes: 2 additions & 2 deletions Classes/DemonHunterVengeance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ if UnitClassBase( 'player' ) == 'DEMONHUNTER' then

talent = "fel_devastation",

handler = function ()
start = function ()
applyBuff( "fel_devastation" )
end,
},
Expand Down Expand Up @@ -602,7 +602,7 @@ if UnitClassBase( 'player' ) == 'DEMONHUNTER' then
startsCombat = true,
texture = function () return buff.illidans_grasp.up and 252175 or 1380367 end,

handler = function ()
start = function ()
if buff.illidans_grasp.up then removeBuff( "illidans_grasp" )
else applyBuff( "illidans_grasp" ) end
end,
Expand Down
4 changes: 2 additions & 2 deletions Classes/HunterBeastMastery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ if UnitClassBase( 'player' ) == 'HUNTER' then
startsCombat = false,
texture = 132199,

handler = function ()
start = function ()
applyBuff( 'aspect_of_the_turtle' )
end,
},
Expand Down Expand Up @@ -602,7 +602,7 @@ if UnitClassBase( 'player' ) == 'HUNTER' then
startsCombat = true,
texture = 236201,

handler = function ()
start = function ()
end,
},

Expand Down
2 changes: 1 addition & 1 deletion Classes/HunterMarksmanship.lua
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ if UnitClassBase( 'player' ) == 'HUNTER' then

talent = "barrage",

handler = function ()
start = function ()
end,
},

Expand Down
2 changes: 1 addition & 1 deletion Classes/MageArcane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ if UnitClassBase( 'player' ) == 'MAGE' then
startsCombat = false,
texture = 136075,

handler = function ()
start = function ()
stop_burn_phase()
applyBuff( "evocation" )
if azerite.brain_storm.enabled then
Expand Down
2 changes: 1 addition & 1 deletion Classes/MageFrost.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ if UnitClassBase( 'player' ) == 'MAGE' then

talent = "ray_of_frost",

handler = function ()
start = function ()
applyDebuff( "target", "ray_of_frost" )
end,
},
Expand Down
4 changes: 2 additions & 2 deletions Classes/MonkBrewmaster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ if UnitClassBase( 'player' ) == 'MONK' then
startsCombat = true,
texture = 606542,

handler = function ()
start = function ()
removeBuff( "the_emperors_capacitor" )
applyDebuff( "target", "crackling_jade_lightning" )
-- applies crackling_jade_lightning (117952)
Expand Down Expand Up @@ -1160,7 +1160,7 @@ if UnitClassBase( 'player' ) == 'MONK' then
startsCombat = false,
texture = 642417,

handler = function ()
start = function ()
applyBuff( "zen_meditation" )
end,
},
Expand Down
6 changes: 3 additions & 3 deletions Classes/MonkWindwalker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ if UnitClassBase( 'player' ) == 'MONK' then
startsCombat = true,
texture = 606542,

handler = function ()
start = function ()
applyDebuff( "target", "crackling_jade_lightning" )
removeBuff( "the_emperors_capacitor" )
end,
Expand Down Expand Up @@ -725,7 +725,7 @@ if UnitClassBase( 'player' ) == 'MONK' then
startsCombat = true,
texture = 627606,

handler = function ()
start = function ()
if level < 116 and set_bonus.tier20_4pc == 1 then applyBuff( "pressure_point", 5 + action.fists_of_fury.cast ) end
if buff.fury_of_xuen.stack >= 50 then
applyBuff( "fury_of_xuen_haste" )
Expand Down Expand Up @@ -1105,7 +1105,7 @@ if UnitClassBase( 'player' ) == 'MONK' then
startsCombat = true,
texture = 606543,

handler = function ()
start = function ()
removeBuff( "dance_of_chiji" )
end,
},
Expand Down
2 changes: 1 addition & 1 deletion Classes/PaladinProtection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ if UnitClassBase( 'player' ) == 'PALADIN' then
startsCombat = false,
texture = 135909,

handler = function ()
start = function ()
applyBuff( "aegis_of_light" )
end,
},
Expand Down
2 changes: 1 addition & 1 deletion Classes/PriestShadow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ if UnitClassBase( 'player' ) == 'PRIEST' then
talent = "void_torrent",
buff = "voidform",

handler = function ()
start = function ()
applyDebuff( "target", "void_torrent" )
end,
},
Expand Down
2 changes: 1 addition & 1 deletion Classes/ShamanElemental.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ if UnitClassBase( 'player' ) == 'SHAMAN' then
return "lightning_lasso"
end,

handler = function ()
start = function ()
applyDebuff( "target", "lightning_lasso" )
end,
},
Expand Down
6 changes: 3 additions & 3 deletions Classes/WarlockAffliction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ if UnitClassBase( 'player' ) == 'WARLOCK' then

startsCombat = true,

handler = function ()
start = function ()
removeBuff( "inevitable_demise" )
end,
},
Expand All @@ -878,7 +878,7 @@ if UnitClassBase( 'player' ) == 'WARLOCK' then

talent = "drain_soul",

handler = function ()
start = function ()
applyDebuff( "target", "drain_soul" )
applyBuff( "casting", 5 * haste )
channelSpell( "drain_soul" )
Expand Down Expand Up @@ -979,7 +979,7 @@ if UnitClassBase( 'player' ) == 'WARLOCK' then

startsCombat = false,

handler = function ()
start = function ()
end,
},

Expand Down
4 changes: 2 additions & 2 deletions Classes/WarlockDemonology.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ if UnitClassBase( 'player' ) == 'WARLOCK' then

startsCombat = true,

handler = function ()
start = function ()
applyDebuff( 'drain_life' )
end,
},
Expand Down Expand Up @@ -1167,7 +1167,7 @@ if UnitClassBase( 'player' ) == 'WARLOCK' then
channeled = true,
startsCombat = false,

handler = function ()
start = function ()
applyBuff( 'health_funnel' )
end,
},
Expand Down
6 changes: 3 additions & 3 deletions Classes/WarlockDestruction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ if UnitClassBase( 'player' ) == 'WARLOCK' then
talent = "channel_demonfire",

usable = function () return active_dot.immolate > 0 end,
handler = function ()
start = function ()
-- applies channel_demonfire (196447)
end,
},
Expand Down Expand Up @@ -716,7 +716,7 @@ if UnitClassBase( 'player' ) == 'WARLOCK' then

startsCombat = true,

handler = function ()
start = function ()
applyDebuff( "target", "drain_life" )
end,
},
Expand Down Expand Up @@ -859,7 +859,7 @@ if UnitClassBase( 'player' ) == 'WARLOCK' then
startsCombat = true,

usable = function () return pet.active end,
handler = function ()
start = function ()
applyBuff( "health_funnel" )
end,
},
Expand Down
24 changes: 10 additions & 14 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1306,34 +1306,30 @@ function Hekili:ProcessHooks( dispName, packName )
end


if ability.channeled then
if ability.cast > 0 then
if debug then Hekili:Debug( "Queueing %s cast finish at %.2f.", action, state.query_time + cast ) end
state:QueueEvent( action, state.query_time, state.query_time + cast, "CAST_FINISH" )

else
ns.spendResources( action )
state.history.casts[ action ] = state.query_time

if ability.start then ability.start() end
state:RunHandler( action )

end

if ability.channeled then
if debug then Hekili:Debug( "Queueing %s channel finish at %.2f.", action, state.query_time + cast ) end
state:QueueEvent( action, state.query_time, state.query_time + cast, "CHANNEL_FINISH" )

if ability.tick and ability.tick_time then
local ticks = floor( cast / ability.tick_time )

for i = 1, ticks do
if debug then Hekili:Debug( "Queueing %s channel tick (%d of %d) at %.2f.", action, i, ticks, state.query_time + ( i * ability.tick_time ) ) end
state:QueueEvent( action, state.query_time, state.query_time + ( i * ability.tick_time ), "CHANNEL_TICK" )
end
end

elseif ability.cast > 0 then
if debug then Hekili:Debug( "Queueing %s cast finish at %.2f.", action, state.query_time + cast ) end
state:QueueEvent( action, state.query_time, state.query_time + cast, "CAST_FINISH" )

else
ns.spendResources( action )
state.history.casts[ action ] = state.query_time

state:RunHandler( action )

end

-- Projectile spells have two handlers, effectively. An onCast handler, and then an onImpact handler.
Expand Down
3 changes: 2 additions & 1 deletion State.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4742,7 +4742,8 @@ function state:RunHandler( key, noStart )

if state.channeling then state.stopChanneling() end

if ability.handler then ability.handler() end
if ability.channeled and ability.start then ability.start()
elseif ability.handler then ability.handler() end

state.hardcast = nil

Expand Down

0 comments on commit 49eda8a

Please sign in to comment.