Death is being removed on heal at the end of battle

So, i'm using a passive state on my actos that makes them to heal 8% of their HP when battle ends.
The problem is that when they die and the battle ends the death state is removed cuz of this heal.


I wanted to keep them dead since the state was not supposed to be removed cuz of healing, at least from my POV it doesn't mean that the actor is ready for some more action.


Here is the passive state

Code:
<Custom Victory Effect>
// Set the HP recovery rate to 8%.
var rate = 0.08;
// Determine the HP value to recover.
var value = Math.ceil(user.mhp * rate);
// Gain HP.
user.gainHp(value);
// Set the MP recovery rate to 8%.
var rate = 0.08;
// Determine the MP value to recover.
var value = Math.ceil(user.mmp * rate);
// Gain MP
user.gainMp(value);
</Custom Victory Effect>
So, i'm using a passive state on my actos that makes them to heal 8% of their HP when battle ends.
The problem is that when they die and the battle ends the death state is removed cuz of this heal.


I wanted to keep them dead since the state was not supposed to be removed cuz of healing, at least from my POV it doesn't mean that the actor is ready for some more action.


Here is the passive state



<Custom Victory Effect>
// Set the HP recovery rate to 8%.
var rate = 0.08;
// Determine the HP value to recover.
var value = Math.ceil(user.mhp * rate);
// Gain HP.
user.gainHp(value);
// Set the MP recovery rate to 8%.
var rate = 0.08;
// Determine the MP value to recover.
var value = Math.ceil(user.mmp * rate);
// Gain MP
user.gainMp(value);
</Custom Victory Effect>



I guess you would just do a check to make sure the user is alive, right?

Code:
<Custom Victory Effect> 
//If the death state is not affecting the user...
if(!user.isDeathStateAffected()) {
  // Set the HP recovery rate to 8%.
  var rate = 0.08; 
  // Determine the HP value to recover. 
  var value = Math.ceil(user.mhp * rate); 
  // Gain HP. user.gainHp(value); 
  // Set the MP recovery rate to 8%. 
  var rate = 0.08; 
  // Determine the MP value to recover. 
  var value = Math.ceil(user.mmp * rate); 
  // Gain MP user.gainMp(value); 
}
</Custom Victory Effect>
Thx, this was made by Yanfly and i know nothing about JS.

Original thread: https://forums.rpgmakerweb.com/threads/death-is-being-removed-on-heal-at-the-end-of-battle.62847/