Skip to content

Commit a81d924

Browse files
authored
Merge pull request #4221 from syrifgit/syrif-deathknight
Unholy DK Rework
2 parents 20bba46 + 2f35ecc commit a81d924

File tree

3 files changed

+407
-269
lines changed

3 files changed

+407
-269
lines changed

Classes.lua

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,6 @@ local HekiliSpecMixin = {
584584
end
585585
end,
586586

587-
588-
589587
RegisterPotion = function( self, potion, data )
590588
self.potions[ potion ] = data
591589

@@ -1017,31 +1015,88 @@ local HekiliSpecMixin = {
10171015

10181016
RegisterPet = function( self, token, id, spell, duration, ... )
10191017
CommitKey( token )
1020-
1018+
1019+
-- Register the main pet.
10211020
self.pets[ token ] = {
10221021
id = type( id ) == "function" and setfenv( id, state ) or id,
10231022
token = token,
10241023
spell = spell,
10251024
duration = type( duration ) == "function" and setfenv( duration, state ) or duration
10261025
}
1027-
1026+
1027+
-- Process copies.
10281028
local n = select( "#", ... )
1029-
10301029
if n and n > 0 then
10311030
for i = 1, n do
10321031
local copy = select( i, ... )
10331032
self.pets[ copy ] = self.pets[ token ]
10341033
end
10351034
end
10361035
end,
1036+
1037+
1038+
RegisterPets = function( self, pets )
1039+
for token, data in pairs( pets ) do
1040+
-- Extract fields from the pet definition.
1041+
local id = data.id
1042+
local spell = data.spell
1043+
local duration = data.duration
1044+
local copy = data.copy
1045+
1046+
-- Register the pet and handle the copy field if it exists.
1047+
if copy then
1048+
self:RegisterPet( token, id, spell, duration, copy )
1049+
else
1050+
self:RegisterPet( token, id, spell, duration )
1051+
end
1052+
end
1053+
end,
10371054

1038-
RegisterTotem = function( self, token, id )
1055+
1056+
RegisterTotem = function( self, token, id, ... )
1057+
-- Register the primary totem.
10391058
self.totems[ token ] = id
10401059
self.totems[ id ] = token
1041-
1060+
1061+
-- Handle copies if provided.
1062+
local n = select( "#", ... )
1063+
if n and n > 0 then
1064+
for i = 1, n do
1065+
local copy = select( i, ... )
1066+
self.totems[ copy ] = id
1067+
self.totems[ id ] = copy
1068+
end
1069+
end
1070+
1071+
-- Commit the primary token.
10421072
CommitKey( token )
10431073
end,
10441074

1075+
RegisterTotems = function( self, totems )
1076+
for token, data in pairs( totems ) do
1077+
local id = data.id
1078+
local copy = data.copy
1079+
1080+
-- Register the primary totem.
1081+
self.totems[ token ] = id
1082+
self.totems[ id ] = token
1083+
1084+
-- Register any copies (aliases).
1085+
if copy then
1086+
if type( copy ) == "string" then
1087+
self.totems[ copy ] = id
1088+
self.totems[ id ] = copy
1089+
elseif type( copy ) == "table" then
1090+
for _, alias in ipairs( copy ) do
1091+
self.totems[ alias ] = id
1092+
self.totems[ id ] = alias
1093+
end
1094+
end
1095+
end
1096+
1097+
CommitKey( token )
1098+
end
1099+
end,
10451100

10461101
GetSetting = function( self, info )
10471102
local setting = info[ #info ]

State.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,18 +1175,21 @@ state.removeDebuff = removeDebuff
11751175

11761176
local function removeDebuffStack( unit, aura, stacks )
11771177
stacks = stacks or 1
1178-
11791178
local d = state.debuff[ aura ]
1179+
if not d then return 0 end
11801180

1181-
if not d then return end
1181+
local removed = min( stacks, d.count )
11821182

11831183
if d.count > stacks then
11841184
d.lastCount = d.count
1185-
d.count = max( 1, d.count - stacks )
1185+
d.count = max( 0, d.count - stacks )
11861186
else
11871187
removeDebuff( unit, aura )
11881188
end
1189+
1190+
return removed
11891191
end
1192+
11901193
state.removeDebuffStack = removeDebuffStack
11911194

11921195

0 commit comments

Comments
 (0)