When the player or an enemy NPC goes below 2 in any attribute, they die instantly. Now at least for the player, this is intended behavior, but this is only supposed to happen when an attribute goes to 0 or lower, not 1 or lower. By consequence this causes another "bug" with the Drainstat effect, which can be seen in the code, that a drain stat effect is not supposed to be able to bring an entity below 1 in any attribute, as to prevent them from being killed by cumulative drain effects, but since they die at 1, this preventative code does not function. So any enemy can be instantly killed with a few applications of a drain effect, luck being generally the most effective since most enemies have an average luck overall.
To Reproduce
Steps to reproduce the behavior:
Example 1:
- Create a "Drain Attribute" spell, whichever you prefer, I like Target at Area.
- Start spamming casting at your feet with or without god mode active (you won't be killed while in god mode)
- If god mode is disabled, you will eventually die after hitting 1 in the drain attribute.
- If god mode enabled, once you exit god mode after your attribute hits 1, you will instantly die.
Example 2:
- The same can be reproduced for enemies. Cast this spell while in god-mode at any enemy, rat is good since they have generally low stats.
- Once you have cast the spell a few times and they don't resist, they will eventually die, no damage done, just drain effect.
Example 3:
- Another way to test, take any save-game, edit the character attributes to as low as 2, save the changes, load said file and notice your character is alive and will stay alive.
- Do the same process again, but instead change the attributes to as low as 1, save changes, load said file and notice your character instantly keels over and dies after the scene loads in.
Expected behavior
The player and enemies (I think) should only die if one of their attributes hits 0 or below, not 1 or below. Also, the drain spell effect should not be able to kill the player or enemies as it does.
Screenshots
No screenshots as it this can be fairly easily reproduced with console commands. If needed I can add some.
Desktop (please complete the following information):
OS: Windows
Version: Alpha 0.10.24
Additional context
Here is the code in the "DrainEffect.cs" that can be optionally altered to show that 1 attribute point is the limit for death, you can change the two "1's" in the if-statement to 2's and you nor enemies will die from the drain effect anymore, but this is not the root cause of the death, there is some other part of the process that is mistakenly having entities die from the wrong minimum attribute amount, and I still have not been able to pin-point where that is checked.
DrainEffects.cs
Code: Select all
public void IncreaseMagnitude(int amount)
{
DaggerfallEntityBehaviour host = GetPeeredEntityBehaviour(manager);
// Do not allow magnitude to reduce stat below 1 relative to permanent value
// Stats are clamped 1-100 and this prevents drain magnitude from going into invisible "healing debt"
int permanentValue = host.Entity.Stats.GetPermanentStatValue(drainStat);
if (permanentValue - (magnitude + amount) < 2)
magnitude = permanentValue - 2;
else
magnitude += amount;
SetStatMod(drainStat, -magnitude);
}