MV [YEP_SkillMasteryLevels] Scale Success Chance based on Mastery Level

Is it possible to scale the success chance of a skill based on the mastery level of the particular skill? I want the player to have to invest in learning a skill before it can be used reliably.
Hmmm, does something like this work? (For base function, I guess Yanfly modified it, so you'd need to modify that one):

Game_Action.prototype.itemHit = function(target) {
let modifier = 1;
if (this.item().isSkill() && this.subject().isActor()){
modifier = this.subject().skillMasteryLevel(this.item().id) * 0.2;
}
if (this.isPhysical()) {
return this.item().successRate * 0.01 * this.subject().hit * modifier;
} else {
return this.item().successRate * 0.01 * modifier;
}
};

EDIT: Oh yeah, maybe also put in conditional $gameParty.inBattle(), if that stuff is used outside battle too.
EDIT 2: Hmmm, just came to mind that I think you can just use this.subject() instead of that BattleManager stuff, so if you do that, you don't need to check any battle stuff.

Original thread: https://forums.rpgmakerweb.com/threads/yep_skillmasterylevels-scale-success-chance-based-on-mastery-level.177979/