MV YEP_ClassChangeCore Edit: Auto-Adjust HP / MP upon Class Change

I have a request which would be really helpful.

I use YEP_ClassChangeCore but the downside to changing classes is that you aren't at full HP / MP if the class had more MHP / MMP.

I want to auto-adjust HP / MP upon class change. If I'm at full HP and I change class that has higher Mhp, adjust the HP to that Mhp.

However, even if I'm not at full HP / MP, I still want that auto-adjusted just so there won't be a bigger gap between the amount of HP I had and the Class's Mhp.

=================

Edit: To be clear, I really want to retain the HP percentage when changing class.

If I'm 80% HP and then change class, I'll still be 80% HP in the other class.
I'm not 100% sure from the way you've phrased your request, but it sounds like you want to maintain the actor's HP/MP percentage when changing classes? In other words, if the actor was at 50% HP prior to the class change, he remains at 50% HP after the class change regardless of how his actual HP totals have changed.

If my guess is incorrect, you should consider editing your post with some actual numerical examples of what currently happens versus what you want to happen. The more details that you provide, the more likely it is that someone will pick up your request.
That's what it was. Retain the HP percentage when changing class, this is what what I'm wanting to have done with Class Change Core.
Bump.
I haven't tested this, but it should work for what you need.

JavaScript:
var ccc_changeClass = Game_Actor.prototype.changeClass

Game_Actor.prototype.changeClass = function(classId, keepExp) {
    var currentHpRate = this.hpRate()
    var currentMpRate = this.mpRate()
    ccc_changeClass.call(this, classId, keepExp)
    this.hp = Math.round(this.mhp * currentHpRate)
    this.mp = Math.round(this.mmp * currentMpRate)
    this.refresh()
    $gamePlayer.refresh();
};

Copy the text into a blank .js file, and import it into your plugin manager below ClassChangeCore and Subclass if you're using that. Basically it caches the current hprate of the actor before changing class, and then sets their new hp to equal the rate they had before they changed.

No credit necessary.
Oh, this is much appreciated. They're maintaining the HP percentage now!
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/yep_classchangecore-edit-auto-adjust-hp-mp-upon-class-change.134066/