Last Chance Hit Point and/or Endure Status Effect?

Hello friends, I'm looking for answers for one or both of these questions I have. It's to sate my curiosity and have knowledge at the ready in case I want to implement them in this new project I'm working on.

1. I already know how to make the most basic HP to 1 skill (b.hp - 1; 0% variance), but what if I want targets to survive a certain would-be-lethal skill with 1 HP unless their HP was already at one?

2. The inverse scenario, how would I go about making a state that allows the affected unit to survive one would-be-lethal hit with 1 HP? The state would expire when used up or when the battle ends, whichever comes first. Closest candidates include using VisuStella's life state effects plugin to make an Auto Life state (Automatically revives a character on death, removes after use), though that requires percentages rather than a flat one, and using the same plugin for classic Guts skill that has the intended flat 1 HP survival, but then I need a secondary conditional skill removal on top of removing it on battle end... Hmm...

I have VisuMZ plugin waves 1-8 and a couple other bundles at my disposal if needed.

Thank you in advance and have a good day!
The question is whether this should be for all skills, or if it's an ability the target has.

If it's for all skills, you would insert a conditional into the damage formula. For example:
Code:
b.hp > 1 ? Math.min(damage formula, b.hp-1) : 1

Will do your damage formula, but won't kill them unless they're already at 1 hp.

If it's an ability the target has, then you'd use a VisuStella notetag to affect the incoming damage. You could put it on the actor if that specific actor always has it, or on a passive state to be applied when a skill is learned.
The question is whether this should be for all skills, or if it's an ability the target has.

If it's for all skills, you would insert a conditional into the damage formula. For example:
Code:
b.hp > 1 ? Math.min(damage formula, b.hp-1) : 1

Will do your damage formula, but won't kill them unless they're already at 1 hp.

If it's an ability the target has, then you'd use a VisuStella notetag to affect the incoming damage. You could put it on the actor if that specific actor always has it, or on a passive state to be applied when a skill is learned.

Hm, I see. Had to do some extra tinkering to get damage variance on a skill without making it possible to accidentally kill a target above 1 HP, but I learned something new regarding damage formulas!

For the time being regarding the other question I had, I've settled on using the Life State Effects plugin to get an Auto Life state that lets the user auto-revive once and having a skill that adds that state to the user.

Thanks for the help!
VS did make another plugin that handles those cases but its one of the paid ones. Its LifestatesEffects if curious.

Original thread: https://forums.rpgmakerweb.com/threads/last-chance-hit-point-and-or-endure-status-effect.164348/