MV Help with decreasing the minimum hp below 0

Hello! This is my first post so please pardon me if this isn't the right spot to ask, but could I get some help with removing the minimum hp clamp? I'd like to allow for actors to go below 0 hp during battle.

In my battle system, I want to be able to save an actor from going down by healing them before the turn ends. This is done by making all actors immortal, but giving troops an event for when all actor falls below 0% health. Since the minimum hp is currently 0, however, an actor could use weak healing items or spells every turn to be effectively immortal.

For reference, the system I want to make is something similar to Deltarune's. In Deltarune, you enter a knockdown state below 0 health, but get back up when you can heal above the negative hp value that knocked you down.
Perhaps something like this? (Untested)

JavaScript:
Game_BattlerBase.prototype.refresh = function() {
    this.stateResistSet().forEach(function(stateId) {
        this.eraseState(stateId);
    }, this);
    this._hp = this._hp.clamp(-10, this.mhp);
    this._mp = this._mp.clamp(0, this.mmp);
    this._tp = this._tp.clamp(0, this.maxTp());
};

Paste it into a .js file, save it in your plugins folder, and add it at the top of your plugins list. Substitute -10 with the actual minimum you want.

There could be other places that try to enforce a minimum of 0 as well – I'm not sure. I didn't see any in a quick search, but I could've missed one.
It works perfectly! Thanks a bunch!

Original thread: https://forums.rpgmakerweb.com/threads/help-with-decreasing-the-minimum-hp-below-0.182411/