Skip to content

Commit 25d23b8

Browse files
author
LocalIdentity
committed
Handle edge case of Varunustra with shield skills
Handles the edge case of using Varunustra with a shield skill and wisps Varunustra was not being restricted to the melee skills when checking for the active skill type
1 parent c587b91 commit 25d23b8

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

src/Modules/CalcTools.lua

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,38 @@ 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-
-- Super special case for Varunastra, e.g. allow Nightblade to support Smite
111-
if not (activeSkill.actor.weaponData1 and activeSkill.actor.weaponData1.countsAsAll1H or activeSkill.actor.weaponData2 and activeSkill.actor.weaponData2.countsAsAll1H) then
112-
if grantedEffect.weaponTypes and activeSkill.activeEffect.grantedEffect.weaponTypes then
113-
local typeMatch = false
114-
for grantedType, _ in pairs(grantedEffect.weaponTypes) do
115-
for activeType, _ in pairs(activeSkill.activeEffect.grantedEffect.weaponTypes) do
116-
if grantedType == activeType then
117-
typeMatch = true
118-
end
119-
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+
-- Super special case for Varunastra, e.g. allow Nightblade to support Smite.
111+
local actorHasAllOneHand = (activeSkill.actor.weaponData1 and activeSkill.actor.weaponData1.countsAsAll1H) or (activeSkill.actor.weaponData2 and activeSkill.actor.weaponData2.countsAsAll1H)
112+
if grantedEffect.weaponTypes then
113+
-- Build a lookup of the active skill's weapon types
114+
local activeTypeLookup = { }
115+
if activeSkill.activeEffect.grantedEffect.weaponTypes then
116+
for activeType in pairs(activeSkill.activeEffect.grantedEffect.weaponTypes) do
117+
activeTypeLookup[activeType] = true
120118
end
121-
-- no match, does not support
122-
if typeMatch == false then
123-
return false
119+
end
120+
-- If the support expects a weapon type but the active skill doesn't have any (e.g. shield skills), it's not a match.
121+
if not next(activeTypeLookup) then
122+
return false
123+
end
124+
-- Varunastra counts as every one-handed melee weapon type, but notably not Wand or Shield.
125+
if actorHasAllOneHand then
126+
activeTypeLookup["Claw"] = true
127+
activeTypeLookup["Dagger"] = true
128+
activeTypeLookup["One Handed Axe"] = true
129+
activeTypeLookup["One Handed Mace"] = true
130+
activeTypeLookup["One Handed Sword"] = true
131+
end
132+
local typeMatch = false
133+
for grantedType in pairs(grantedEffect.weaponTypes) do
134+
if activeTypeLookup[grantedType] then
135+
typeMatch = true
136+
break
124137
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
138+
end
139+
-- No match, does not support the active skill
140+
if not typeMatch then
127141
return false
128142
end
129143
end

0 commit comments

Comments
 (0)