Page 1 of 1

Negative Energy Damage

Posted: Thu Jan 06, 2022 6:35 pm
by arctic_cold
When using Death Ward Spell and Shadow Shield Spell (Darkness Domain), my toon is not immune to negative energy damage. Is immune to negative energy damage if only one of those spells (Death Ward or Shadow Shield) is active. Is this a feature or bug?

Re: Negative Energy Damage

Posted: Thu Jan 06, 2022 6:50 pm
by EasternCheesE
Thanks for reporting. This looks like a bug and we will test it to confirm and mark it for fixing! :)

Re: Negative Energy Damage

Posted: Thu Jan 06, 2022 9:32 pm
by Kitunenotsume
For reference, regarding the cause here

The NWN2 base engine has an overflow error where values over 100% immunity are translated into negative values by subtracting 250. Thus 2 sources of 100% immunity result in a 50% vulnerability (50% extra damage taken), and any immunity items (even 5%) plus deathward (100%) will result in massive extra damage (105 - 250 = 145% vulnerability, resulting in 245% damage taken from negative energy.)

If theoretically 3 sources of energy immunity were acquired (like an Undead using Deathward and Shadow Shield), you'll have 50% immunity (half damage)

Re: Negative Energy Damage

Posted: Fri Jan 07, 2022 7:32 am
by EasternCheesE
Kitunenotsume wrote: Thu Jan 06, 2022 9:32 pm For reference, regarding the cause here

The NWN2 base engine has an overflow error where values over 100% immunity are translated into negative values by subtracting 250. Thus 2 sources of 100% immunity result in a 50% vulnerability (50% extra damage taken), and any immunity items (even 5%) plus deathward (100%) will result in massive extra damage (105 - 250 = 145% vulnerability, resulting in 245% damage taken from negative energy.)

If theoretically 3 sources of energy immunity were acquired (like an Undead using Deathward and Shadow Shield), you'll have 50% immunity (half damage)
I don't believe this is correct since i did apply 250% of fire immunity to myself on local test server that replicates bgtscc environment and it worked just fine.
There was a granted 100% fire immunity feat + special trigger zone which grants 100% fire immunity + 50% fire immunity item.
There could be edge cases in where it overflows, but i basically had 250 immunity and it worked just correct.

Re: Negative Energy Damage

Posted: Fri Jan 07, 2022 11:10 pm
by Kitunenotsume
I suspect there is a difference between the two forms of application: Arbitrarily Large Damage Resistance vs true percentage immunity

the Energy Immunity spells for example do not use percentage immunity, instead they grant "EffectDamageResistance(DAMAGE_TYPE_ACID, 9999, 0)"

Deathward, instead, uses "EffectDamageImmunityIncrease(DAMAGE_TYPE_NEGATIVE, 100)"

If you had both (one granting "immunity" via Damage Resistance, and the maximum -149% Damage Immunity), you would still take no damage.

in either regards, the issue here stems from EffectDamageImmunityIncrease(), which is the code in concern.
Simplest solution is to change Deathward/Shadowshield to use the same effect as the Energy Immunity spells.

Re: Negative Energy Damage

Posted: Sat Jan 08, 2022 5:43 am
by EasternCheesE
Kitunenotsume wrote: Fri Jan 07, 2022 11:10 pm I suspect there is a difference between the two forms of application: Arbitrarily Large Damage Resistance vs true percentage immunity

the Energy Immunity spells for example do not use percentage immunity, instead they grant "EffectDamageResistance(DAMAGE_TYPE_ACID, 9999, 0)"

Deathward, instead, uses "EffectDamageImmunityIncrease(DAMAGE_TYPE_NEGATIVE, 100)"

If you had both (one granting "immunity" via Damage Resistance, and the maximum -149% Damage Immunity), you would still take no damage.

in either regards, the issue here stems from EffectDamageImmunityIncrease(), which is the code in concern.
Simplest solution is to change Deathward/Shadowshield to use the same effect as the Energy Immunity spells.
I had a script that summed up all effect_damage_immunity on my PC, so i'm pretty sure they all were immunity effects, not resistance ones.
Yeah, it feels weird that energy immunity spell grants damage resistance instead of damage immunity in first place, along with other spells which do the same.

But, in my test, it was fire immunity and it worked just fine without overflowing values. Could be that death immunity is different, since i didn't test it exactly.

Re: Negative Energy Damage

Posted: Sat Feb 19, 2022 6:13 am
by Valefort
Should be fixed for next update.