Skip to content

Commit 63a4005

Browse files
PeecheyLocalIdentity
andauthored
Fix Sacred Wisps applying to non-Wand Attacks (#9272)
* update CalcTools to handle differing weaponTypes * update for Varunastra * update for supports having more weaponTypes than Active Skill * better var name * 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 --------- Co-authored-by: LocalIdentity <[email protected]>
1 parent dc96827 commit 63a4005

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/Modules/CalcTools.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,41 @@ 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+
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
118+
end
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
137+
end
138+
end
139+
-- No match, does not support the active skill
140+
if not typeMatch then
141+
return false
142+
end
143+
end
109144
return not grantedEffect.requireSkillTypes[1] or calcLib.doesTypeExpressionMatch(grantedEffect.requireSkillTypes, effectiveSkillTypes, effectiveMinionTypes)
110145
end
111146

0 commit comments

Comments
 (0)