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 <localidentity2@gmail.com>
This commit is contained in:
Peechey
2025-11-17 02:17:03 -06:00
committed by GitHub
parent dc96827aec
commit 63a400542a

View File

@@ -106,6 +106,41 @@ function calcLib.canGrantedEffectSupportActiveSkill(grantedEffect, activeSkill)
if grantedEffect.isTrigger and activeSkill.actor.enemy.player ~= activeSkill.actor then
return false
end
-- 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.
-- Super special case for Varunastra, e.g. allow Nightblade to support Smite.
local actorHasAllOneHand = (activeSkill.actor.weaponData1 and activeSkill.actor.weaponData1.countsAsAll1H) or (activeSkill.actor.weaponData2 and activeSkill.actor.weaponData2.countsAsAll1H)
if grantedEffect.weaponTypes then
-- Build a lookup of the active skill's weapon types
local activeTypeLookup = { }
if activeSkill.activeEffect.grantedEffect.weaponTypes then
for activeType in pairs(activeSkill.activeEffect.grantedEffect.weaponTypes) do
activeTypeLookup[activeType] = true
end
end
-- If the support expects a weapon type but the active skill doesn't have any (e.g. shield skills), it's not a match.
if not next(activeTypeLookup) then
return false
end
-- Varunastra counts as every one-handed melee weapon type, but notably not Wand or Shield.
if actorHasAllOneHand then
activeTypeLookup["Claw"] = true
activeTypeLookup["Dagger"] = true
activeTypeLookup["One Handed Axe"] = true
activeTypeLookup["One Handed Mace"] = true
activeTypeLookup["One Handed Sword"] = true
end
local typeMatch = false
for grantedType in pairs(grantedEffect.weaponTypes) do
if activeTypeLookup[grantedType] then
typeMatch = true
break
end
end
-- No match, does not support the active skill
if not typeMatch then
return false
end
end
return not grantedEffect.requireSkillTypes[1] or calcLib.doesTypeExpressionMatch(grantedEffect.requireSkillTypes, effectiveSkillTypes, effectiveMinionTypes)
end