Skip to content

Commit 19b4426

Browse files
author
LocalIdentity
committed
Fix handling of player actor
1 parent 19d2548 commit 19b4426

3 files changed

Lines changed: 35 additions & 22 deletions

File tree

src/Classes/ModStore.lua

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ local ModStoreClass = newClass("ModStore", function(self, parent)
3434
self.conditions = { }
3535
end)
3636

37+
local function getActor(self, actorType)
38+
if actorType == "player" then
39+
return self.actor.player or (self.actor.parent and self.actor.parent.player) or (self.actor.enemy and self.actor.enemy.player)
40+
else
41+
return self.actor[actorType]
42+
end
43+
end
44+
3745
function ModStoreClass:ScaleAddMod(mod, scale)
3846
local unscalable = false
3947
for _, effects in ipairs(mod) do
@@ -315,15 +323,17 @@ function ModStoreClass:EvalMod(mod, cfg, globalLimits)
315323
-- This explicit target is necessary because even though the GetMultiplier method does call self.parent.GetMultiplier, it does so with noMod = true,
316324
-- disabling the summation (3rd part): (not noMod and self:Sum("BASE", cfg, multiplierName[var]) or 0)
317325
if tag.limitActor then
318-
if self.actor[tag.limitActor] then
319-
limitTarget = self.actor[tag.limitActor].modDB
326+
local limitActor = getActor(self, tag.limitActor)
327+
if limitActor then
328+
limitTarget = limitActor.modDB
320329
else
321330
return
322331
end
323332
end
324333
if tag.actor then
325-
if self.actor[tag.actor] then
326-
target = self.actor[tag.actor].modDB
334+
local actor = getActor(self, tag.actor)
335+
if actor then
336+
target = actor.modDB
327337
else
328338
return
329339
end
@@ -387,15 +397,17 @@ function ModStoreClass:EvalMod(mod, cfg, globalLimits)
387397
local target = self
388398
local thresholdTarget = self
389399
if tag.thresholdActor then
390-
if self.actor[tag.thresholdActor] then
391-
thresholdTarget = self.actor[tag.thresholdActor].modDB
400+
local thresholdActor = getActor(self, tag.thresholdActor)
401+
if thresholdActor then
402+
thresholdTarget = thresholdActor.modDB
392403
else
393404
return
394405
end
395406
end
396407
if tag.actor then
397-
if self.actor[tag.actor] then
398-
target = self.actor[tag.actor].modDB
408+
local actor = getActor(self, tag.actor)
409+
if actor then
410+
target = actor.modDB
399411
else
400412
return
401413
end
@@ -417,8 +429,9 @@ function ModStoreClass:EvalMod(mod, cfg, globalLimits)
417429
local target = self
418430
-- This functions similar to the above tagTypes in regard to which actor to use, but for PerStat
419431
-- if the actor is 'parent', we don't want to return if we're already using 'parent', just keep using 'self'
420-
if tag.actor and self.actor[tag.actor] then
421-
target = self.actor[tag.actor].modDB
432+
local actor = getActor(self, tag.actor)
433+
if actor then
434+
target = actor.modDB
422435
end
423436
if tag.statList then
424437
base = 0
@@ -465,8 +478,9 @@ function ModStoreClass:EvalMod(mod, cfg, globalLimits)
465478
local target = self
466479
-- This functions similar to the above tagTypes in regard to which actor to use, but for PercentStat
467480
-- if the actor is 'parent', we don't want to return if we're already using 'parent', just keep using 'self'
468-
if tag.actor and self.actor[tag.actor] then
469-
target = self.actor[tag.actor].modDB
481+
local actor = getActor(self, tag.actor)
482+
if actor then
483+
target = actor.modDB
470484
end
471485
if tag.statList then
472486
base = 0
@@ -581,7 +595,8 @@ function ModStoreClass:EvalMod(mod, cfg, globalLimits)
581595
local match = false
582596
local target = self
583597
if tag.actor then
584-
target = self.actor[tag.actor] and self.actor[tag.actor].modDB
598+
local actor = getActor(self, tag.actor)
599+
target = actor and actor.modDB
585600
end
586601
if target and (tag.var or tag.varList) then
587602
if tag.varList then
@@ -876,4 +891,4 @@ function ModStoreClass:EvalMod(mod, cfg, globalLimits)
876891
end
877892
end
878893
return value
879-
end
894+
end

src/Data/ModCache.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4877,8 +4877,8 @@ c["Every Rage also grants 1% increased Fire Damage"]={{[1]={[1]={type="Multiplie
48774877
c["Every Rage also grants 1% increased Stun Threshold"]={{[1]={[1]={type="Multiplier",var="RageEffect"},flags=0,keywordFlags=0,name="StunThreshold",type="INC",value=1}},nil}
48784878
c["Every Rage also grants 2% increased Spell Damage"]={{[1]={[1]={type="Multiplier",var="RageEffect"},flags=2,keywordFlags=0,name="Damage",type="INC",value=2}},nil}
48794879
c["Every Rage also grants 2% increased Stun Threshold"]={{[1]={[1]={type="Multiplier",var="RageEffect"},flags=0,keywordFlags=0,name="StunThreshold",type="INC",value=2}},nil}
4880-
c["Every Rage also grants you 1% increased Minion Attack Speed"]={{[1]={flags=0,keywordFlags=0,name="MinionModifier",type="LIST",value={mod={[1]={actor="player",type="Multiplier",var="RageEffect"},flags=0,keywordFlags=0,name="Speed",type="INC",value=1}}},[2]={flags=0,keywordFlags=0,name="MinionModifier",type="LIST",value={mod={[1]={actor="parent",type="Multiplier",var="RageEffect"},flags=0,keywordFlags=0,name="Speed",type="INC",value=1}}}},nil}
4881-
c["Every Rage also grants you 1% increased Minion Damage"]={{[1]={flags=0,keywordFlags=0,name="MinionModifier",type="LIST",value={mod={[1]={actor="player",type="Multiplier",var="RageEffect"},flags=0,keywordFlags=0,name="Damage",type="INC",value=1}}},[2]={flags=0,keywordFlags=0,name="MinionModifier",type="LIST",value={mod={[1]={actor="parent",type="Multiplier",var="RageEffect"},flags=0,keywordFlags=0,name="Damage",type="INC",value=1}}}},nil}
4880+
c["Every Rage also grants you 1% increased Minion Attack Speed"]={{[1]={flags=0,keywordFlags=0,name="MinionModifier",type="LIST",value={mod={[1]={actor="player",type="Multiplier",var="RageEffect"},flags=1,keywordFlags=0,name="Speed",type="INC",value=1}}}},nil}
4881+
c["Every Rage also grants you 1% increased Minion Damage"]={{[1]={flags=0,keywordFlags=0,name="MinionModifier",type="LIST",value={mod={[1]={actor="player",type="Multiplier",var="RageEffect"},flags=0,keywordFlags=0,name="Damage",type="INC",value=1}}}},nil}
48824882
c["Every Third Slam skill that doesn't create Fissures which you use yourself causes 3 additional Aftershocks ahead and to each side of the initial area"]={nil,"Every Third Slam skill that doesn't create Fissures which you use yourself causes 3 additional Aftershocks ahead and to each side of the initial area "}
48834883
c["Every second Slam Skill you use yourself is Ancestrally Boosted"]={nil,"Every second Slam Skill you use yourself is Ancestrally Boosted "}
48844884
c["Every second, inflicts Critical Weakness on enemies in your Presence for 1 second"]={{[1]={flags=0,keywordFlags=0,name="ApplyCriticalWeakness",type="FLAG",value=true}},nil}

src/Modules/ModParser.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4656,13 +4656,11 @@ local specialModList = {
46564656
["summoned skeleton warriors are permanent and follow you"] = { flag("RaisedSkeletonPermanentDuration", { type = "SkillName", skillName = "Summon Skeletons" }) },
46574657
["minions recoup (%d+)%% of damage taken as life"] = function(num) return { mod("MinionModifier", "LIST", { mod = mod("LifeRecoup", "BASE", num) }) } end,
46584658
["temporary minion skills have %+(%d+) to limit of minions summoned"] = function(num) return { mod("ActiveMinionLimit", "BASE", num, { type = "BaseFlag", baseFlag = "duration", neg = true }) } end,
4659-
["every rage also grants you (%d+)%% increased minion attack speed"] = function(num) return {
4660-
mod("MinionModifier", "LIST", { mod = mod("Speed", "INC", num, { type = "Multiplier", var = "RageEffect", actor = "player" }) }),
4661-
mod("MinionModifier", "LIST", { mod = mod("Speed", "INC", num, { type = "Multiplier", var = "RageEffect", actor = "parent" }) }),
4662-
} end,
46634659
["every rage also grants you (%d+)%% increased minion damage"] = function(num) return {
4664-
mod("MinionModifier", "LIST", { mod = mod("Damage", "INC", num, { type = "Multiplier", var = "RageEffect", actor = "player" }) }),
4665-
mod("MinionModifier", "LIST", { mod = mod("Damage", "INC", num, { type = "Multiplier", var = "RageEffect", actor = "parent" }) }),
4660+
mod("MinionModifier", "LIST", { mod = mod("Damage", "INC", num, { type = "Multiplier", var = "RageEffect", actor = "player" }) }),
4661+
} end,
4662+
["every rage also grants you (%d+)%% increased minion attack speed"] = function(num) return {
4663+
mod("MinionModifier", "LIST", { mod = mod("Speed", "INC", num, nil, ModFlag.Attack, { type = "Multiplier", var = "RageEffect", actor = "player" }) }),
46664664
} end,
46674665
-- Projectiles
46684666
["skills chain %+(%d) times"] = function(num) return { mod("ChainCountMax", "BASE", num) } end,

0 commit comments

Comments
 (0)