Skip to content

Commit 006ab39

Browse files
committed
Fix: Count Feral Spirit related buff stacks
1 parent 87a9976 commit 006ab39

File tree

1 file changed

+152
-6
lines changed

1 file changed

+152
-6
lines changed

TheWarWithin/ShamanEnhancement.lua

Lines changed: 152 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,10 @@ spec:RegisterAuras( {
257257
crackling_surge = {
258258
id = 224127,
259259
duration = 15,
260-
max_stack = 1
260+
max_stack = 20,
261+
meta = {
262+
active = function( t ) return active_crackling_surges end,
263+
},
261264
},
262265
crash_lightning = {
263266
id = 187878,
@@ -337,7 +340,10 @@ spec:RegisterAuras( {
337340
id = 392375,
338341
duration = 15,
339342
type = "Magic",
340-
max_stack = 1
343+
max_stack = 20,
344+
meta = {
345+
active = function( t ) return active_earthen_weapons end,
346+
},
341347
},
342348
-- Rooted.
343349
-- https://wowhead.com/ptr-2/spell=64695
@@ -398,7 +404,7 @@ spec:RegisterAuras( {
398404
id = 333957,
399405
duration = 15,
400406
tick_time = 3,
401-
max_stack = 1,
407+
max_stack = 20,
402408
meta = {
403409
active = function( t ) return active_feral_spirits end,
404410
},
@@ -514,7 +520,10 @@ spec:RegisterAuras( {
514520
icy_edge = {
515521
id = 224126,
516522
duration = 15,
517-
max_stack = 1
523+
max_stack = 20,
524+
meta = {
525+
active = function( t ) return active_icy_edges end,
526+
},
518527
},
519528
-- Fire damage inflicted every $t2 sec.
520529
-- https://wowhead.com/ptr-2/spell=118297
@@ -581,7 +590,10 @@ spec:RegisterAuras( {
581590
id = 224125,
582591
duration = 15,
583592
type = "Magic",
584-
max_stack = 1
593+
max_stack = 20,
594+
meta = {
595+
active = function( t ) return active_molten_weapons end,
596+
},
585597
},
586598
-- Talent: Your next healing or damaging Nature spell is instant cast and costs no mana.
587599
-- https://wowhead.com/ptr-2/spell=378081
@@ -876,6 +888,10 @@ local recallTotem1
876888
local recallTotem2
877889

878890
local actual_spirits = {}
891+
local molten_weapons = {}
892+
local icy_edges = {}
893+
local crackling_surges = {}
894+
local earthen_weapons = {}
879895

880896
spec:RegisterCombatLogEvent( function( _, subtype, _, sourceGUID, sourceName, _, _, destGUID, destName, destFlags, _, spellID, spellName )
881897
-- Deaths/despawns.
@@ -962,6 +978,30 @@ spec:RegisterCombatLogEvent( function( _, subtype, _, sourceGUID, sourceName, _
962978
end
963979
end
964980
end
981+
982+
if destGUID == state.GUID and ( subtype == "SPELL_AURA_APPLIED" or subtype == "SPELL_AURA_REFRESH" ) then
983+
if spellID == 224125 then
984+
insert( molten_weapons, {
985+
expires = GetTime() + state.talent.flowing_spirits.enabled and 8 or 15
986+
} )
987+
988+
elseif spellID == 224126 then
989+
insert( icy_edges, {
990+
expires = GetTime() + ( state.talent.flowing_spirits.enabled and 8 or 15 )
991+
} )
992+
993+
elseif spellID == 224127 then
994+
insert( crackling_surges, {
995+
expires = GetTime() + ( state.talent.flowing_spirits.enabled and 8 or 15 )
996+
} )
997+
998+
elseif spellID == 392375 then
999+
insert( earthen_weapons, {
1000+
expires = GetTime() + ( state.talent.flowing_spirits.enabled and 8 or 15 )
1001+
} )
1002+
1003+
end
1004+
end
9651005
end )
9661006

9671007
spec:RegisterStateExpr( "vesper_totem_heal_charges", function()
@@ -1019,6 +1059,56 @@ spec:RegisterStateExpr( "alpha_wolf_min_remains", function()
10191059
end )
10201060

10211061

1062+
local virtual_molten_weapons = {}
1063+
1064+
spec:RegisterStateExpr( "active_molten_weapons", function()
1065+
local count = 0
1066+
1067+
for _, v in pairs( virtual_molten_weapons ) do
1068+
if v > query_time then count = count + 1 end
1069+
end
1070+
1071+
return count
1072+
end )
1073+
1074+
local virtual_icy_edges = {}
1075+
1076+
spec:RegisterStateExpr( "active_icy_edges", function()
1077+
local count = 0
1078+
1079+
for _, v in pairs( virtual_icy_edges ) do
1080+
if v > query_time then count = count + 1 end
1081+
end
1082+
1083+
return count
1084+
end )
1085+
1086+
local virtual_crackling_surges = {}
1087+
1088+
spec:RegisterStateExpr( "active_crackling_surges", function()
1089+
local count = 0
1090+
1091+
for _, v in pairs( virtual_crackling_surges ) do
1092+
if v > query_time then count = count + 1 end
1093+
end
1094+
1095+
return count
1096+
end )
1097+
1098+
local virtual_earthen_weapons = {}
1099+
1100+
spec:RegisterStateExpr( "active_earthen_weapons", function()
1101+
local count = 0
1102+
1103+
for _, v in pairs( virtual_earthen_weapons ) do
1104+
if v > query_time then count = count + 1 end
1105+
end
1106+
1107+
return count
1108+
end )
1109+
1110+
1111+
10221112
local TriggerFeralMaelstrom = setfenv( function()
10231113
gain_maelstrom( 1 )
10241114
end, state )
@@ -1109,9 +1199,55 @@ spec:RegisterHook( "reset_precast", function ()
11091199
expires = v.expires,
11101200
alpha_expires = v.alpha_expires
11111201
}
1202+
else
1203+
virtual_spirits[ k ] = nil
11121204
end
11131205
end
11141206

1207+
wipe( virtual_molten_weapons )
1208+
for k, v in pairs( molten_weapons ) do
1209+
if v.expires > now then
1210+
virtual_molten_weapons[ k ] = v.expires
1211+
else
1212+
molten_weapons[ k ] = nil
1213+
end
1214+
end
1215+
1216+
wipe( virtual_icy_edges )
1217+
for k, v in pairs( icy_edges ) do
1218+
if v.expires > now then
1219+
virtual_icy_edges[ k ] = v.expires
1220+
else
1221+
icy_edges[ k ] = nil
1222+
end
1223+
end
1224+
1225+
wipe( virtual_crackling_surges )
1226+
for k, v in pairs( crackling_surges ) do
1227+
if v.expires > now then
1228+
virtual_crackling_surges[ k ] = v.expires
1229+
else
1230+
crackling_surges[ k ] = nil
1231+
end
1232+
end
1233+
1234+
wipe( virtual_earthen_weapons )
1235+
for k, v in pairs( earthen_weapons ) do
1236+
if v.expires > now then
1237+
virtual_earthen_weapons[ k ] = v.expires
1238+
else
1239+
earthen_weapons[ k ] = nil
1240+
end
1241+
end
1242+
1243+
if Hekili.ActiveDebug then
1244+
if active_feral_spirits > 0 then Hekili:Debug( "Feral Spirits: " .. active_feral_spirits ) end
1245+
if active_molten_weapons > 0 then Hekili:Debug( "Molten Weapons: " .. active_molten_weapons ) end
1246+
if active_icy_edges > 0 then Hekili:Debug( "Icy Edges: " .. active_icy_edges ) end
1247+
if active_crackling_surges > 0 then Hekili:Debug( "Crackling Surges: " .. active_crackling_surges ) end
1248+
if active_earthen_weapons > 0 then Hekili:Debug( "Earthen Weapons: " .. active_earthen_weapons ) end
1249+
end
1250+
11151251
if buff.ascendance.up and talent.static_accumulation.enabled then
11161252
local next_mw = query_time + 1 - ( ( query_time - buff.ascendance.applied ) % 1 )
11171253

@@ -1692,11 +1828,19 @@ spec:RegisterAbilities( {
16921828
alpha_expires = 0
16931829
} )
16941830

1831+
if not talent.elemental_spirits.enabled then
1832+
insert( virtual_earthen_weapons, query_time + 15 )
1833+
insert( virtual_earthen_weapons, query_time + 15 )
1834+
end
1835+
16951836
if set_bonus.tww1_4pc > 0 then
16961837
insert( virtual_spirits, {
16971838
expires = query_time + 15,
16981839
alpha_expires = 0
16991840
} )
1841+
if not talent.elemental_spirits.enabled then
1842+
insert( virtual_earthen_weapons, query_time + 15 )
1843+
end
17001844
end
17011845

17021846
if set_bonus.tier31_4pc > 0 then
@@ -2290,7 +2434,9 @@ spec:RegisterAbilities( {
22902434
expires = query_time + 15,
22912435
alpha_expires = 0
22922436
} )
2293-
applyBuff( "crackling_surge" )
2437+
if not talent.elemental_spirits.enabled then
2438+
insert( virtual_earthen_weapons, query_time + 15 )
2439+
end
22942440
end
22952441
end,
22962442

0 commit comments

Comments
 (0)