Attaching a level parameter to a monster.

Alright, is there a clean way to add a level parameter to monsters? I wanted PC base stats to remain relatively static during level up (outside of HP and resources), but I was going to tie level into the damage formulas. As such, I don't necessarily want the enemies to scale with the party or gain stats on this parameter.

Something like the following for basic attacks: (a.atk * (1 + a.level / 5)) / (1 + b.def / 100)

This would allow relatively small increases to base stats through accessories or perks to have the same level of impact throughout the game. That's just an example and I'm not married to it without testing stuff. I could just make monster attacks and skills separate from party attacks and skills, but that's less convenient.
Paste the below into a text editor, save as a *.js file, include as a plugin.

Code:
Game_BattlerBase.prototype.level = function()
{
    return this.isActor() ? this.level : Number(this.enemy().meta.level);
};

All of your enemies will need a level notetag, such as <level:5>

Then in your damage formula you'd put parentheses after level. So
Code:
1 + a.level() / 5

That will return the actor's level or the enemy's level notetag.
Turan's suggestion can be rewritten to match how actor levels are referenced:
JavaScript:
/*:
 * @target MV MZ
 * @url https://forums.rpgmakerweb.com/threads/162205/
 * @help Free to use and/or modify for any project, no credit required.
 */
Object.defineProperty(Game_Enemy.prototype, "level", {
  get: function() {
    return parseInt(this.enemy().meta.level, 10) || 0;
  },
  configurable: true
});
So then you can just use a.level and it'll work as usual for an actor, or via notetag for an enemy.
Fine, @caethyril, you just gotta be fancier 😛
I appreciate it, thanks.

Original thread: https://forums.rpgmakerweb.com/threads/attaching-a-level-parameter-to-a-monster.162205/