PDA

View Full Version : EffectManager.hasTag bug (I think)...



TheoGeek
April 24th, 2026, 23:21
I have a target with the effect:

"IMMUNE: fire"

My Improved Critical extension checks for crit immunity by using:

"local bCritImmune = EffectManager.hasTag(rActor, "IMMUNE", { tFilter = { "critical" }, })"

... which results in "true".

If I change the effect to:

"IMMUNE: dkjflskfjs"

... the check results in a "false"

It's like tFilter is being ignored for recognized damage types?

I haven't dug into it tho...is there some other way to check an actor for specific immunity?

Thanks!

Moon Wizard
April 24th, 2026, 23:54
Damage types don't filter by design; as that would some use cases.

To check whether a creature is immune to the critical damage type, try:


local bImmuneCritical = false;
for _,tEffect in ipairs(EffectManager.getCompsDataByTag(rActor, "IMMUNE", { rTarget = rSource, })) do
for _,s in ipairs(tEffect.remainder) do
if s == "critical" then
bImmuneCritical = true;
break;
end
end
end


Regards,
JPG

TheoGeek
April 25th, 2026, 00:31
Thanks! I did a similar thing with matching for "IMMUNE" and "critical" in tEffect, but yours is more robust.

Moon Wizard
April 25th, 2026, 03:04
Another slightly simpler version:



local bImmuneCritical = false;
for _,tCompData in ipairs(EffectManager.getCompsDataByTag(rActor, "IMMUNE", { rTarget = rSource, })) do
if StringManager.contains(tCompData.remainder, "critical") then
bImmuneCritical = true;
break;
end
end


Regards,
JPG