MV Looking for a plugin that gives enemies dice roll HP ranges.

Is there a plugin for RPG maker MV that replicates how HP is handled in games like Wizardry where all enemies have HP ranges based on a dice roll.

The way it works is that every enemy has a dice roll assigned to them, for example, an enemy that has 20-110 HP will have the dice roll formula: (10d10+10).

this formula represents: Ten ten sided dice + 10

I imagine that you could put this formula into an enemy's notes area if there is no plugin like this exists.
This might work (untested):
Spoiler: plugin code
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc Dice roll formula support for enemy max HP.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/posts/1524409/
 * @help Tag enemies like this:
 *         <HP dice: formula>
 *    e.g. <HP dice: 10d10 + 10>
 *    e.g. <HP dice: 1d12 + 5d8 - 2>
 *
 * Free to use and/or modify for any project, no credit required.
 */
;void (function() {
"use strict";
  const TAG_NAME = "HP dice";

  const P = "_maxHpCache";

  const RX = /(\d+)d(\d+)/gi;

  const xdy = function(m, a, b) {
    a |= 0;
    b |= 0;
    let r = 0;
    for (let n = a; n--;)
      r += 1 + Math.randomInt(b);
    return r;
  };

  const parse = function(formula) {
    if (formula && typeof formula === "string")
      return eval(formula.replace(RX, xdy)) | 0;
    return 0;
  };

  void (function(alias) {
    Game_Enemy.prototype.setup = function() {
      alias.apply(this, arguments);
      const mhp = parse(this.enemy()[TAG_NAME]);
      if (mhp > 0)
        this[P] = mhp;
      else
        delete this[P];
    };
  })(Game_Enemy.prototype.setup);

  void (function(alias) {
    Game_Enemy.prototype.paramBase = function(paramId) {
      if (paramId === 0 && this[P])
        return this[P];
      return alias.apply(this, arguments);
    };
  })(Game_Enemy.prototype.paramBase);

})();

[Edit: description changed from ...support for enemies. -> ...support for enemy max HP.. Code unchanged.]

Original thread: https://forums.rpgmakerweb.com/threads/looking-for-a-plugin-that-gives-enemies-dice-roll-hp-ranges.179228/