Skip to content

Commit 7c80030

Browse files
committed
update CalcTools to handle differing weaponTypes
1 parent 5a60660 commit 7c80030

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Modules/CalcTools.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,26 @@ function calcLib.canGrantedEffectSupportActiveSkill(grantedEffect, activeSkill)
106106
if grantedEffect.isTrigger and activeSkill.actor.enemy.player ~= activeSkill.actor then
107107
return false
108108
end
109+
--Special case for Sacred Wisps, i.e. Wisps Support has a weaponType of Wand so it should only match with Active Skills that at least have Wand as a weaponType
110+
if grantedEffect.weaponTypes and activeSkill.activeEffect.grantedEffect.weaponTypes then
111+
-- for every weapon type the support has, the active skill has to match
112+
local hasType = false
113+
for grantedType, _ in pairs(grantedEffect.weaponTypes) do
114+
hasType = false
115+
for activeType, _ in pairs(activeSkill.activeEffect.grantedEffect.weaponTypes) do
116+
if grantedType == activeType then
117+
hasType = true
118+
end
119+
end
120+
-- after looping all activeSkill types, if the nth support type was not found, we can kick out early
121+
if hasType == false then
122+
return false
123+
end
124+
end
125+
-- if the support has a specific weaponType and the activeSkill does not, it doesn't match
126+
elseif grantedEffect.weaponTypes and not activeSkill.activeEffect.grantedEffect.weaponTypes then
127+
return false
128+
end
109129
return not grantedEffect.requireSkillTypes[1] or calcLib.doesTypeExpressionMatch(grantedEffect.requireSkillTypes, effectiveSkillTypes, effectiveMinionTypes)
110130
end
111131

0 commit comments

Comments
 (0)