/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/

var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
  __markAsModule(target);
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
  if (module2 && typeof module2 === "object" || typeof module2 === "function") {
    for (let key of __getOwnPropNames(module2))
      if (!__hasOwnProp.call(target, key) && key !== "default")
        __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
  }
  return target;
};
var __toModule = (module2) => {
  return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};

// node_modules/tslib/tslib.js
var require_tslib = __commonJS({
  "node_modules/tslib/tslib.js"(exports, module2) {
    var __extends2;
    var __assign2;
    var __rest2;
    var __decorate2;
    var __param2;
    var __metadata2;
    var __awaiter2;
    var __generator2;
    var __exportStar2;
    var __values2;
    var __read2;
    var __spread2;
    var __spreadArrays2;
    var __spreadArray2;
    var __await2;
    var __asyncGenerator2;
    var __asyncDelegator2;
    var __asyncValues2;
    var __makeTemplateObject2;
    var __importStar2;
    var __importDefault2;
    var __classPrivateFieldGet2;
    var __classPrivateFieldSet2;
    var __createBinding2;
    (function(factory) {
      var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
      if (typeof define === "function" && define.amd) {
        define("tslib", ["exports"], function(exports2) {
          factory(createExporter(root, createExporter(exports2)));
        });
      } else if (typeof module2 === "object" && typeof module2.exports === "object") {
        factory(createExporter(root, createExporter(module2.exports)));
      } else {
        factory(createExporter(root));
      }
      function createExporter(exports2, previous) {
        if (exports2 !== root) {
          if (typeof Object.create === "function") {
            Object.defineProperty(exports2, "__esModule", { value: true });
          } else {
            exports2.__esModule = true;
          }
        }
        return function(id, v) {
          return exports2[id] = previous ? previous(id, v) : v;
        };
      }
    })(function(exporter) {
      var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
        d.__proto__ = b;
      } || function(d, b) {
        for (var p in b)
          if (Object.prototype.hasOwnProperty.call(b, p))
            d[p] = b[p];
      };
      __extends2 = function(d, b) {
        if (typeof b !== "function" && b !== null)
          throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() {
          this.constructor = d;
        }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
      __assign2 = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
          s = arguments[i];
          for (var p in s)
            if (Object.prototype.hasOwnProperty.call(s, p))
              t[p] = s[p];
        }
        return t;
      };
      __rest2 = function(s, e) {
        var t = {};
        for (var p in s)
          if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
            t[p] = s[p];
        if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
              t[p[i]] = s[p[i]];
          }
        return t;
      };
      __decorate2 = function(decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
          r = Reflect.decorate(decorators, target, key, desc);
        else
          for (var i = decorators.length - 1; i >= 0; i--)
            if (d = decorators[i])
              r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
      };
      __param2 = function(paramIndex, decorator) {
        return function(target, key) {
          decorator(target, key, paramIndex);
        };
      };
      __metadata2 = function(metadataKey, metadataValue) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
          return Reflect.metadata(metadataKey, metadataValue);
      };
      __awaiter2 = function(thisArg, _arguments, P, generator) {
        function adopt(value) {
          return value instanceof P ? value : new P(function(resolve) {
            resolve(value);
          });
        }
        return new (P || (P = Promise))(function(resolve, reject) {
          function fulfilled(value) {
            try {
              step(generator.next(value));
            } catch (e) {
              reject(e);
            }
          }
          function rejected(value) {
            try {
              step(generator["throw"](value));
            } catch (e) {
              reject(e);
            }
          }
          function step(result) {
            result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
          }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
        });
      };
      __generator2 = function(thisArg, body) {
        var _ = { label: 0, sent: function() {
          if (t[0] & 1)
            throw t[1];
          return t[1];
        }, trys: [], ops: [] }, f, y, t, g;
        return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
          return this;
        }), g;
        function verb(n) {
          return function(v) {
            return step([n, v]);
          };
        }
        function step(op) {
          if (f)
            throw new TypeError("Generator is already executing.");
          while (_)
            try {
              if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
                return t;
              if (y = 0, t)
                op = [op[0] & 2, t.value];
              switch (op[0]) {
                case 0:
                case 1:
                  t = op;
                  break;
                case 4:
                  _.label++;
                  return { value: op[1], done: false };
                case 5:
                  _.label++;
                  y = op[1];
                  op = [0];
                  continue;
                case 7:
                  op = _.ops.pop();
                  _.trys.pop();
                  continue;
                default:
                  if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                    _ = 0;
                    continue;
                  }
                  if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                    _.label = op[1];
                    break;
                  }
                  if (op[0] === 6 && _.label < t[1]) {
                    _.label = t[1];
                    t = op;
                    break;
                  }
                  if (t && _.label < t[2]) {
                    _.label = t[2];
                    _.ops.push(op);
                    break;
                  }
                  if (t[2])
                    _.ops.pop();
                  _.trys.pop();
                  continue;
              }
              op = body.call(thisArg, _);
            } catch (e) {
              op = [6, e];
              y = 0;
            } finally {
              f = t = 0;
            }
          if (op[0] & 5)
            throw op[1];
          return { value: op[0] ? op[1] : void 0, done: true };
        }
      };
      __exportStar2 = function(m, o) {
        for (var p in m)
          if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
            __createBinding2(o, m, p);
      };
      __createBinding2 = Object.create ? function(o, m, k, k2) {
        if (k2 === void 0)
          k2 = k;
        Object.defineProperty(o, k2, { enumerable: true, get: function() {
          return m[k];
        } });
      } : function(o, m, k, k2) {
        if (k2 === void 0)
          k2 = k;
        o[k2] = m[k];
      };
      __values2 = function(o) {
        var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
        if (m)
          return m.call(o);
        if (o && typeof o.length === "number")
          return {
            next: function() {
              if (o && i >= o.length)
                o = void 0;
              return { value: o && o[i++], done: !o };
            }
          };
        throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
      };
      __read2 = function(o, n) {
        var m = typeof Symbol === "function" && o[Symbol.iterator];
        if (!m)
          return o;
        var i = m.call(o), r, ar = [], e;
        try {
          while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
            ar.push(r.value);
        } catch (error) {
          e = { error };
        } finally {
          try {
            if (r && !r.done && (m = i["return"]))
              m.call(i);
          } finally {
            if (e)
              throw e.error;
          }
        }
        return ar;
      };
      __spread2 = function() {
        for (var ar = [], i = 0; i < arguments.length; i++)
          ar = ar.concat(__read2(arguments[i]));
        return ar;
      };
      __spreadArrays2 = function() {
        for (var s = 0, i = 0, il = arguments.length; i < il; i++)
          s += arguments[i].length;
        for (var r = Array(s), k = 0, i = 0; i < il; i++)
          for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
            r[k] = a[j];
        return r;
      };
      __spreadArray2 = function(to, from, pack) {
        if (pack || arguments.length === 2)
          for (var i = 0, l = from.length, ar; i < l; i++) {
            if (ar || !(i in from)) {
              if (!ar)
                ar = Array.prototype.slice.call(from, 0, i);
              ar[i] = from[i];
            }
          }
        return to.concat(ar || Array.prototype.slice.call(from));
      };
      __await2 = function(v) {
        return this instanceof __await2 ? (this.v = v, this) : new __await2(v);
      };
      __asyncGenerator2 = function(thisArg, _arguments, generator) {
        if (!Symbol.asyncIterator)
          throw new TypeError("Symbol.asyncIterator is not defined.");
        var g = generator.apply(thisArg, _arguments || []), i, q = [];
        return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
          return this;
        }, i;
        function verb(n) {
          if (g[n])
            i[n] = function(v) {
              return new Promise(function(a, b) {
                q.push([n, v, a, b]) > 1 || resume(n, v);
              });
            };
        }
        function resume(n, v) {
          try {
            step(g[n](v));
          } catch (e) {
            settle(q[0][3], e);
          }
        }
        function step(r) {
          r.value instanceof __await2 ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
        }
        function fulfill(value) {
          resume("next", value);
        }
        function reject(value) {
          resume("throw", value);
        }
        function settle(f, v) {
          if (f(v), q.shift(), q.length)
            resume(q[0][0], q[0][1]);
        }
      };
      __asyncDelegator2 = function(o) {
        var i, p;
        return i = {}, verb("next"), verb("throw", function(e) {
          throw e;
        }), verb("return"), i[Symbol.iterator] = function() {
          return this;
        }, i;
        function verb(n, f) {
          i[n] = o[n] ? function(v) {
            return (p = !p) ? { value: __await2(o[n](v)), done: n === "return" } : f ? f(v) : v;
          } : f;
        }
      };
      __asyncValues2 = function(o) {
        if (!Symbol.asyncIterator)
          throw new TypeError("Symbol.asyncIterator is not defined.");
        var m = o[Symbol.asyncIterator], i;
        return m ? m.call(o) : (o = typeof __values2 === "function" ? __values2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
          return this;
        }, i);
        function verb(n) {
          i[n] = o[n] && function(v) {
            return new Promise(function(resolve, reject) {
              v = o[n](v), settle(resolve, reject, v.done, v.value);
            });
          };
        }
        function settle(resolve, reject, d, v) {
          Promise.resolve(v).then(function(v2) {
            resolve({ value: v2, done: d });
          }, reject);
        }
      };
      __makeTemplateObject2 = function(cooked, raw) {
        if (Object.defineProperty) {
          Object.defineProperty(cooked, "raw", { value: raw });
        } else {
          cooked.raw = raw;
        }
        return cooked;
      };
      var __setModuleDefault = Object.create ? function(o, v) {
        Object.defineProperty(o, "default", { enumerable: true, value: v });
      } : function(o, v) {
        o["default"] = v;
      };
      __importStar2 = function(mod) {
        if (mod && mod.__esModule)
          return mod;
        var result = {};
        if (mod != null) {
          for (var k in mod)
            if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
              __createBinding2(result, mod, k);
        }
        __setModuleDefault(result, mod);
        return result;
      };
      __importDefault2 = function(mod) {
        return mod && mod.__esModule ? mod : { "default": mod };
      };
      __classPrivateFieldGet2 = function(receiver, state, kind, f) {
        if (kind === "a" && !f)
          throw new TypeError("Private accessor was defined without a getter");
        if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
          throw new TypeError("Cannot read private member from an object whose class did not declare it");
        return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
      };
      __classPrivateFieldSet2 = function(receiver, state, value, kind, f) {
        if (kind === "m")
          throw new TypeError("Private method is not writable");
        if (kind === "a" && !f)
          throw new TypeError("Private accessor was defined without a setter");
        if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
          throw new TypeError("Cannot write private member to an object whose class did not declare it");
        return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
      };
      exporter("__extends", __extends2);
      exporter("__assign", __assign2);
      exporter("__rest", __rest2);
      exporter("__decorate", __decorate2);
      exporter("__param", __param2);
      exporter("__metadata", __metadata2);
      exporter("__awaiter", __awaiter2);
      exporter("__generator", __generator2);
      exporter("__exportStar", __exportStar2);
      exporter("__createBinding", __createBinding2);
      exporter("__values", __values2);
      exporter("__read", __read2);
      exporter("__spread", __spread2);
      exporter("__spreadArrays", __spreadArrays2);
      exporter("__spreadArray", __spreadArray2);
      exporter("__await", __await2);
      exporter("__asyncGenerator", __asyncGenerator2);
      exporter("__asyncDelegator", __asyncDelegator2);
      exporter("__asyncValues", __asyncValues2);
      exporter("__makeTemplateObject", __makeTemplateObject2);
      exporter("__importStar", __importStar2);
      exporter("__importDefault", __importDefault2);
      exporter("__classPrivateFieldGet", __classPrivateFieldGet2);
      exporter("__classPrivateFieldSet", __classPrivateFieldSet2);
    });
  }
});

// src/main.ts
__export(exports, {
  default: () => InitiativeTracker
});
var import_obsidian20 = __toModule(require("obsidian"));

// src/utils/conditions.ts
var Conditions = [
  {
    name: "Blinded",
    description: "A blinded creature can\u2019t see and automatically fails any ability check that requires sight.\nAttack rolls against the creature have advantage, and the creature\u2019s Attack rolls have disadvantage."
  },
  {
    name: "Charmed",
    description: "A charmed creature can\u2019t Attack the charmer or target the charmer with harmful Abilities or magical Effects.\nThe charmer has advantage on any ability check to interact socially with the creature."
  },
  {
    name: "Concentrating",
    description: "Some spells require you to maintain concentration in order to keep their magic active. If you lose concentration, such a spell ends.\nA creature loses concentration when: it casts another spell that requires concentration, is incapacitated, or dies.\nWhen a creature takes damage, it must make a constitution saving throw with a DC of 10 or half the damage it took, whichever is higher. On a failure, concentration is lost."
  },
  {
    name: "Deafened",
    description: "A deafened creature can\u2019t hear and automatically fails any ability check that requires hearing."
  },
  {
    name: "Frightened",
    description: "A frightened creature has disadvantage on Ability Checks and Attack rolls while the source of its fear is within Line of Sight.\nThe creature can\u2019t willingly move closer to the source of its fear."
  },
  {
    name: "Grappled",
    description: "A grappled creature\u2019s speed becomes 0, and it can\u2019t benefit from any bonus to its speed.\nThe condition ends if the Grappler is incapacitated.\nThe condition also ends if an Effect removes the grappled creature from the reach of the Grappler or Grappling Effect, such as when a creature is hurled away by the Thunderwave spell."
  },
  {
    name: "Incapacitated",
    description: "An incapacitated creature can\u2019t take Actions or Reactions."
  },
  {
    name: "Invisible",
    description: "An invisible creature is impossible to see without the aid of magic or a Special sense. For the Purpose of Hiding, the creature is heavily obscured. The creature\u2019s Location can be detected by any noise it makes or any tracks it leaves.\nAttack rolls against the creature have disadvantage, and the creature\u2019s Attack rolls have advantage."
  },
  {
    name: "Paralyzed",
    description: "A paralyzed creature is incapacitated and can\u2019t move or speak.\nThe creature automatically fails Strength and Dexterity Saving Throws.\nAttack rolls against the creature have advantage.\nAny Attack that hits the creature is a critical hit if the attacker is within 5 feet of the creature."
  },
  {
    name: "Petrified",
    description: "A petrified creature is transformed, along with any nonmagical object it is wearing or carrying, into a solid inanimate substance (usually stone). Its weight increases by a factor of ten, and it ceases aging.\nThe creature is incapacitated, can\u2019t move or speak, and is unaware of its surroundings.\nAttack rolls against the creature have advantage.\nThe creature automatically fails Strength and Dexterity Saving Throws.\nThe creature has Resistance to all damage.\nThe creature is immune to poison and disease, although a poison or disease already in its system is suspended, not neutralized."
  },
  {
    name: "Poisoned",
    description: "A poisoned creature has disadvantage on Attack rolls and Ability Checks."
  },
  {
    name: "Prone",
    description: "A prone creature\u2019s only Movement option is to crawl, unless it stands up and thereby ends the condition.\nThe creature has disadvantage on Attack rolls.\nAn Attack roll against the creature has advantage if the attacker is within 5 feet of the creature. Otherwise, the Attack roll has disadvantage."
  },
  {
    name: "Reacted",
    description: "A creature, unless otherwise specified, gets one reaction per round of combat.\nA reaction is an instant response to a trigger of some kind, which can occur on your turn or on someone else\u2019s.\nA reaction can be spent to make an opportunity attack, do a readied action, or use an ability that requires a reaction.\nA creature that has already reacted cannot use a reaction until the start of its turn."
  },
  {
    name: "Restrained",
    description: "A restrained creature\u2019s speed becomes 0, and it can\u2019t benefit from any bonus to its speed.\nAttack rolls against the creature have advantage, and the creature\u2019s Attack rolls have disadvantage.\nThe creature has disadvantage on Dexterity Saving Throws."
  },
  {
    name: "Stunned",
    description: "A stunned creature is incapacitated, can\u2019t move, and can speak only falteringly.\nThe creature automatically fails Strength and Dexterity Saving Throws.\nAttack rolls against the creature have advantage."
  },
  {
    name: "Unconscious",
    description: "An unconscious creature is incapacitated, can\u2019t move or speak, and is unaware of its surroundings.\nThe creature drops whatever it\u2019s holding and falls prone.\nThe creature automatically fails Strength and Dexterity Saving Throws.\nAttack rolls against the creature have advantage.\nAny Attack that hits the creature is a critical hit if the attacker is within 5 feet of the creature."
  }
];

// src/utils/constants.ts
var INTIATIVE_TRACKER_VIEW = "initiative-tracker-view";
var CREATURE_TRACKER_VIEW = "initiative-tracker-creature-view";
var DEFAULT_UNDEFINED = "\u2013";
var DEFAULT_SETTINGS = {
  players: [],
  parties: [],
  defaultParty: null,
  homebrew: [],
  statuses: [...Conditions],
  version: null,
  canUseDiceRoll: false,
  initiative: "1d20 + %mod%",
  modifier: null,
  sync: false,
  leafletIntegration: false,
  playerMarker: "default",
  monsterMarker: "default",
  state: {
    creatures: [],
    state: false,
    name: null,
    round: null
  },
  condense: false,
  clamp: false,
  autoStatus: false,
  displayDifficulty: true,
  encounters: {},
  warnedAboutImports: false,
  openState: {
    party: true,
    status: true,
    plugin: true,
    player: true
  }
};
var XP_PER_CR = {
  "0": 0,
  "1/8": 25,
  "1/4": 50,
  "1/2": 100,
  "1": 200,
  "2": 450,
  "3": 700,
  "4": 1100,
  "5": 1800,
  "6": 2300,
  "7": 2900,
  "8": 3900,
  "9": 5e3,
  "10": 5900,
  "11": 7200,
  "12": 8400,
  "13": 1e4,
  "14": 11500,
  "15": 13e3,
  "16": 15e3,
  "17": 18e3,
  "18": 2e4,
  "19": 22e3,
  "20": 25e3,
  "21": 33e3,
  "22": 41e3,
  "23": 5e4,
  "24": 62e3,
  "25": 75e3,
  "26": 9e4,
  "27": 105e3,
  "28": 12e4,
  "29": 135e3,
  "30": 155e3
};

// src/utils/icons.ts
var import_obsidian = __toModule(require("obsidian"));
function registerIcons() {
  (0, import_obsidian.addIcon)(BASE, ICON);
  (0, import_obsidian.addIcon)(SAVE, SAVE_ICON);
  (0, import_obsidian.addIcon)(ADD, ADD_ICON);
  (0, import_obsidian.addIcon)(RESTART, RESTART_ICON);
  (0, import_obsidian.addIcon)(PLAY, PLAY_ICON);
  (0, import_obsidian.addIcon)(FORWARD, FORWARD_ICON);
  (0, import_obsidian.addIcon)(BACKWARD, BACKWARD_ICON);
  (0, import_obsidian.addIcon)(STOP, STOP_ICON);
  (0, import_obsidian.addIcon)(GRIP, GRIP_ICON);
  (0, import_obsidian.addIcon)(HP, HP_ICON);
  (0, import_obsidian.addIcon)(AC, AC_ICON);
  (0, import_obsidian.addIcon)(HAMBURGER, HAMBURGER_ICON);
  (0, import_obsidian.addIcon)(ENABLE, ENABLE_ICON);
  (0, import_obsidian.addIcon)(DISABLE, DISABLE_ICON);
  (0, import_obsidian.addIcon)(TAG, TAG_ICON);
  (0, import_obsidian.addIcon)(EDIT, EDIT_ICON);
  (0, import_obsidian.addIcon)(INITIATIVE, INITIATIVE_ICON);
  (0, import_obsidian.addIcon)(REDO, REDO_ICON);
  (0, import_obsidian.addIcon)(NEW, NEW_ICON);
  (0, import_obsidian.addIcon)(DICE, DICE_ICON);
  (0, import_obsidian.addIcon)(START_ENCOUNTER, START_ENCOUNTER_ICON);
  (0, import_obsidian.addIcon)(MAP, MAP_ICON);
  (0, import_obsidian.addIcon)(COPY, COPY_ICON);
  (0, import_obsidian.addIcon)(GROUP, `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="users" class="svg-inline--fa fa-users fa-w-20" role="img" viewBox="0 0 640 512"><path fill="currentColor" d="M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"/></svg>`);
  (0, import_obsidian.addIcon)(EXPAND, `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="users-slash" class="svg-inline--fa fa-users-slash fa-w-20" role="img" viewBox="0 0 640 512"><path fill="currentColor" d="M132.65,212.32,36.21,137.78A63.4,63.4,0,0,0,32,160a63.84,63.84,0,0,0,100.65,52.32Zm40.44,62.28A63.79,63.79,0,0,0,128,256H64A64.06,64.06,0,0,0,0,320v32a32,32,0,0,0,32,32H97.91A146.62,146.62,0,0,1,173.09,274.6ZM544,224a64,64,0,1,0-64-64A64.06,64.06,0,0,0,544,224ZM500.56,355.11a114.24,114.24,0,0,0-84.47-65.28L361,247.23c41.46-16.3,71-55.92,71-103.23A111.93,111.93,0,0,0,320,32c-57.14,0-103.69,42.83-110.6,98.08L45.46,3.38A16,16,0,0,0,23,6.19L3.37,31.46A16,16,0,0,0,6.18,53.91L594.53,508.63A16,16,0,0,0,617,505.82l19.64-25.27a16,16,0,0,0-2.81-22.45ZM128,403.21V432a48,48,0,0,0,48,48H464a47.45,47.45,0,0,0,12.57-1.87L232,289.13C173.74,294.83,128,343.42,128,403.21ZM576,256H512a63.79,63.79,0,0,0-45.09,18.6A146.29,146.29,0,0,1,542,384h66a32,32,0,0,0,32-32V320A64.06,64.06,0,0,0,576,256Z"/></svg>`);
  (0, import_obsidian.addIcon)(ACTIVE, `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="angle-right" class="svg-inline--fa fa-angle-right fa-w-8" role="img" viewBox="0 0 256 512"><path fill="currentColor" d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"/></svg>`);
  (0, import_obsidian.addIcon)(MAPMARKER, `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="map-marker-alt" class="svg-inline--fa fa-map-marker-alt fa-w-12" role="img" viewBox="0 0 384 512"><path fill="currentColor" d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"/></svg>`);
  (0, import_obsidian.addIcon)(CREATURE, `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="dragon" class="svg-inline--fa fa-dragon fa-w-20" role="img" viewBox="0 0 640 512"><path fill="currentColor" d="M18.32 255.78L192 223.96l-91.28 68.69c-10.08 10.08-2.94 27.31 11.31 27.31h222.7c-9.44-26.4-14.73-54.47-14.73-83.38v-42.27l-119.73-87.6c-23.82-15.88-55.29-14.01-77.06 4.59L5.81 227.64c-12.38 10.33-3.45 30.42 12.51 28.14zm556.87 34.1l-100.66-50.31A47.992 47.992 0 0 1 448 196.65v-36.69h64l28.09 22.63c6 6 14.14 9.37 22.63 9.37h30.97a32 32 0 0 0 28.62-17.69l14.31-28.62a32.005 32.005 0 0 0-3.02-33.51l-74.53-99.38C553.02 4.7 543.54 0 533.47 0H296.02c-7.13 0-10.7 8.57-5.66 13.61L352 63.96 292.42 88.8c-5.9 2.95-5.9 11.36 0 14.31L352 127.96v108.62c0 72.08 36.03 139.39 96 179.38-195.59 6.81-344.56 41.01-434.1 60.91C5.78 478.67 0 485.88 0 494.2 0 504 7.95 512 17.76 512h499.08c63.29.01 119.61-47.56 122.99-110.76 2.52-47.28-22.73-90.4-64.64-111.36zM489.18 66.25l45.65 11.41c-2.75 10.91-12.47 18.89-24.13 18.26-12.96-.71-25.85-12.53-21.52-29.67z"/></svg>`);
}
var MAPMARKER = "tracker-map-marker";
var EXPAND = "expand-creatures";
var GROUP = "group-creatures";
var ACTIVE = "initiative-tracker-active";
var CREATURE = "initiative-tracker-creature-view";
var BASE = "initiative-tracker";
var ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="dice-d20" class="svg-inline--fa fa-dice-d20 fa-w-15" role="img" viewBox="0 0 480 512"><path fill="currentColor" d="M106.75 215.06L1.2 370.95c-3.08 5 .1 11.5 5.93 12.14l208.26 22.07-108.64-190.1zM7.41 315.43L82.7 193.08 6.06 147.1c-2.67-1.6-6.06.32-6.06 3.43v162.81c0 4.03 5.29 5.53 7.41 2.09zM18.25 423.6l194.4 87.66c5.3 2.45 11.35-1.43 11.35-7.26v-65.67l-203.55-22.3c-4.45-.5-6.23 5.59-2.2 7.57zm81.22-257.78L179.4 22.88c4.34-7.06-3.59-15.25-10.78-11.14L17.81 110.35c-2.47 1.62-2.39 5.26.13 6.78l81.53 48.69zM240 176h109.21L253.63 7.62C250.5 2.54 245.25 0 240 0s-10.5 2.54-13.63 7.62L130.79 176H240zm233.94-28.9l-76.64 45.99 75.29 122.35c2.11 3.44 7.41 1.94 7.41-2.1V150.53c0-3.11-3.39-5.03-6.06-3.43zm-93.41 18.72l81.53-48.7c2.53-1.52 2.6-5.16.13-6.78l-150.81-98.6c-7.19-4.11-15.12 4.08-10.78 11.14l79.93 142.94zm79.02 250.21L256 438.32v65.67c0 5.84 6.05 9.71 11.35 7.26l194.4-87.66c4.03-1.97 2.25-8.06-2.2-7.56zm-86.3-200.97l-108.63 190.1 208.26-22.07c5.83-.65 9.01-7.14 5.93-12.14L373.25 215.06zM240 208H139.57L240 383.75 340.43 208H240z"/></svg>`;
var MAP = "initiative-tracker-map";
var MAP_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="map-marked-alt" class="svg-inline--fa fa-map-marked-alt fa-w-18" role="img" viewBox="0 0 576 512"><path fill="currentColor" d="M288 0c-69.59 0-126 56.41-126 126 0 56.26 82.35 158.8 113.9 196.02 6.39 7.54 17.82 7.54 24.2 0C331.65 284.8 414 182.26 414 126 414 56.41 357.59 0 288 0zm0 168c-23.2 0-42-18.8-42-42s18.8-42 42-42 42 18.8 42 42-18.8 42-42 42zM20.12 215.95A32.006 32.006 0 0 0 0 245.66v250.32c0 11.32 11.43 19.06 21.94 14.86L160 448V214.92c-8.84-15.98-16.07-31.54-21.25-46.42L20.12 215.95zM288 359.67c-14.07 0-27.38-6.18-36.51-16.96-19.66-23.2-40.57-49.62-59.49-76.72v182l192 64V266c-18.92 27.09-39.82 53.52-59.49 76.72-9.13 10.77-22.44 16.95-36.51 16.95zm266.06-198.51L416 224v288l139.88-55.95A31.996 31.996 0 0 0 576 426.34V176.02c0-11.32-11.43-19.06-21.94-14.86z"/></svg>`;
var START_ENCOUNTER = "crossed-swords";
var START_ENCOUNTER_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M27.43 918.8l30.374-30.374 80.793 80.793-30.374 30.374L27.43 918.8zm422.393-253.815c0-48.521-39.36-87.882-87.882-87.882s-87.88 39.36-87.88 87.88c0 48.521 39.338 87.859 87.882 87.882s87.902-39.338 87.88-87.88zm-175.351 8.401l-.807-.807-166.337 166.336 80.794 80.794 166.337-166.337-.92-.92c-41.832-3.986-75.099-37.253-79.067-79.065zm-.411-8.402c0-45.507 34.621-82.952 78.95-87.431-46.731-53.121-88.214-110.883-123.852-172.613L117.593 516.506 274.47 673.383a88.927 88.927 0 0 1-.409-8.399zm175.315 8.962c-4.472 44.334-41.914 78.942-87.433 78.92a89.137 89.137 0 0 1-8.406-.413l157.058 157.058 111.566-111.566c-62.063-35.842-119.841-77.405-172.785-123.999zM815.497 74.632L392.493 497.636c6.535 9.622 10.729 21.41 10.729 33.817 0 19.234-9.188 36.441-23.375 47.483 34.711 7.191 61.918 34.869 68.453 69.814 11.013-14.625 28.5-24.14 48.078-24.14 12.407 0 23.51 3.51 32.978 9.891l423.002-423.002 29.691-166.555-166.553 29.688zM41.964 872.58l112.539 112.539 49.514-49.514L91.478 823.066 41.964 872.58z"/></svg>';
var SAVE = "initiative-tracker-save";
var SAVE_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="save" class="svg-inline--fa fa-save fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"/></svg>`;
var ADD = "initiative-tracker-add";
var ADD_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-plus" class="svg-inline--fa fa-user-plus fa-w-20" role="img" viewBox="0 0 640 512"><path fill="currentColor" d="M624 208h-64v-64c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v64h-64c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h64v64c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-64h64c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm-400 48c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"/></svg>`;
var REMOVE = "trash";
var RESTART = "initiative-tracker-restart";
var RESTART_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="redo" class="svg-inline--fa fa-redo fa-w-16" role="img" viewBox="0 0 512 512"><path fill="currentColor" d="M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"/></svg>`;
var PLAY = "initiative-tracker-play";
var PLAY_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="play" class="svg-inline--fa fa-play fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"/></svg>`;
var FORWARD = "initiative-tracker-forward";
var FORWARD_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="step-forward" class="svg-inline--fa fa-step-forward fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M384 44v424c0 6.6-5.4 12-12 12h-48c-6.6 0-12-5.4-12-12V291.6l-195.5 181C95.9 489.7 64 475.4 64 448V64c0-27.4 31.9-41.7 52.5-24.6L312 219.3V44c0-6.6 5.4-12 12-12h48c6.6 0 12 5.4 12 12z"/></svg>`;
var BACKWARD = "initiative-tracker-backward";
var BACKWARD_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="step-backward" class="svg-inline--fa fa-step-backward fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M64 468V44c0-6.6 5.4-12 12-12h48c6.6 0 12 5.4 12 12v176.4l195.5-181C352.1 22.3 384 36.6 384 64v384c0 27.4-31.9 41.7-52.5 24.6L136 292.7V468c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12z"/></svg>`;
var STOP = "initiative-tracker-stop";
var STOP_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="stop" class="svg-inline--fa fa-stop fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"/></svg>`;
var GRIP = "initiative-tracker-grip";
var GRIP_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="grip-vertical" class="svg-inline--fa fa-grip-vertical fa-w-10" role="img" viewBox="0 0 320 512"><path fill="currentColor" d="M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z"/></svg>`;
var HP = "initiative-tracker-hp";
var HP_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="far" data-icon="heart" class="svg-inline--fa fa-heart fa-w-16" role="img" viewBox="0 0 512 512"><path fill="currentColor" d="M458.4 64.3C400.6 15.7 311.3 23 256 79.3 200.7 23 111.4 15.6 53.6 64.3-21.6 127.6-10.6 230.8 43 285.5l175.4 178.7c10 10.2 23.4 15.9 37.6 15.9 14.3 0 27.6-5.6 37.6-15.8L469 285.6c53.5-54.7 64.7-157.9-10.6-221.3zm-23.6 187.5L259.4 430.5c-2.4 2.4-4.4 2.4-6.8 0L77.2 251.8c-36.5-37.2-43.9-107.6 7.3-150.7 38.9-32.7 98.9-27.8 136.5 10.5l35 35.7 35-35.7c37.8-38.5 97.8-43.2 136.5-10.6 51.1 43.1 43.5 113.9 7.3 150.8z"/></svg>`;
var AC = "initiative-tracker-ac";
var AC_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="shield-alt" class="svg-inline--fa fa-shield-alt fa-w-16" role="img" viewBox="0 0 512 512"><path fill="currentColor" d="M466.5 83.7l-192-80a48.15 48.15 0 0 0-36.9 0l-192 80C27.7 91.1 16 108.6 16 128c0 198.5 114.5 335.7 221.5 380.3 11.8 4.9 25.1 4.9 36.9 0C360.1 472.6 496 349.3 496 128c0-19.4-11.7-36.9-29.5-44.3zM256.1 446.3l-.1-381 175.9 73.3c-3.3 151.4-82.1 261.1-175.8 307.7z"/></svg>`;
var HAMBURGER = "initiative-tracker-hamburger";
var HAMBURGER_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="bars" class="svg-inline--fa fa-bars fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg>`;
var DISABLE = "initiative-tracker-disable";
var DISABLE_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-slash" class="svg-inline--fa fa-user-slash fa-w-20" role="img" viewBox="0 0 640 512"><path fill="currentColor" d="M633.8 458.1L362.3 248.3C412.1 230.7 448 183.8 448 128 448 57.3 390.7 0 320 0c-67.1 0-121.5 51.8-126.9 117.4L45.5 3.4C38.5-2 28.5-.8 23 6.2L3.4 31.4c-5.4 7-4.2 17 2.8 22.4l588.4 454.7c7 5.4 17 4.2 22.5-2.8l19.6-25.3c5.4-6.8 4.1-16.9-2.9-22.3zM96 422.4V464c0 26.5 21.5 48 48 48h350.2L207.4 290.3C144.2 301.3 96 356 96 422.4z"/></svg>`;
var ENABLE = "initiative-tracker-enable";
var ENABLE_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-check" class="svg-inline--fa fa-user-check fa-w-20" role="img" viewBox="0 0 640 512"><path fill="currentColor" d="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4zm323-128.4l-27.8-28.1c-4.6-4.7-12.1-4.7-16.8-.1l-104.8 104-45.5-45.8c-4.6-4.7-12.1-4.7-16.8-.1l-28.1 27.9c-4.7 4.6-4.7 12.1-.1 16.8l81.7 82.3c4.6 4.7 12.1 4.7 16.8.1l141.3-140.2c4.6-4.7 4.7-12.2.1-16.8z"/></svg>`;
var EDIT = "initiative-tracker-edit";
var EDIT_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="far" data-icon="edit" class="svg-inline--fa fa-edit fa-w-18" role="img" viewBox="0 0 576 512"><path fill="currentColor" d="M402.3 344.9l32-32c5-5 13.7-1.5 13.7 5.7V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h273.5c7.1 0 10.7 8.6 5.7 13.7l-32 32c-1.5 1.5-3.5 2.3-5.7 2.3H48v352h352V350.5c0-2.1.8-4.1 2.3-5.6zm156.6-201.8L296.3 405.7l-90.4 10c-26.2 2.9-48.5-19.2-45.6-45.6l10-90.4L432.9 17.1c22.9-22.9 59.9-22.9 82.7 0l43.2 43.2c22.9 22.9 22.9 60 .1 82.8zM460.1 174L402 115.9 216.2 301.8l-7.3 65.3 65.3-7.3L460.1 174zm64.8-79.7l-43.2-43.2c-4.1-4.1-10.8-4.1-14.8 0L436 82l58.1 58.1 30.9-30.9c4-4.2 4-10.8-.1-14.9z"/></svg>`;
var TAG = "initiative-tracker-tags";
var TAG_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="tag" class="svg-inline--fa fa-tag fa-w-16" role="img" viewBox="0 0 512 512"><path fill="currentColor" d="M0 252.118V48C0 21.49 21.49 0 48 0h204.118a48 48 0 0 1 33.941 14.059l211.882 211.882c18.745 18.745 18.745 49.137 0 67.882L293.823 497.941c-18.745 18.745-49.137 18.745-67.882 0L14.059 286.059A48 48 0 0 1 0 252.118zM112 64c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z"/></svg>`;
var INITIATIVE = "initiative-tracker-initiative";
var INITIATIVE_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="running" class="svg-inline--fa fa-running fa-w-13" role="img" viewBox="0 0 416 512"><path fill="currentColor" d="M272 96c26.51 0 48-21.49 48-48S298.51 0 272 0s-48 21.49-48 48 21.49 48 48 48zM113.69 317.47l-14.8 34.52H32c-17.67 0-32 14.33-32 32s14.33 32 32 32h77.45c19.25 0 36.58-11.44 44.11-29.09l8.79-20.52-10.67-6.3c-17.32-10.23-30.06-25.37-37.99-42.61zM384 223.99h-44.03l-26.06-53.25c-12.5-25.55-35.45-44.23-61.78-50.94l-71.08-21.14c-28.3-6.8-57.77-.55-80.84 17.14l-39.67 30.41c-14.03 10.75-16.69 30.83-5.92 44.86s30.84 16.66 44.86 5.92l39.69-30.41c7.67-5.89 17.44-8 25.27-6.14l14.7 4.37-37.46 87.39c-12.62 29.48-1.31 64.01 26.3 80.31l84.98 50.17-27.47 87.73c-5.28 16.86 4.11 34.81 20.97 40.09 3.19 1 6.41 1.48 9.58 1.48 13.61 0 26.23-8.77 30.52-22.45l31.64-101.06c5.91-20.77-2.89-43.08-21.64-54.39l-61.24-36.14 31.31-78.28 20.27 41.43c8 16.34 24.92 26.89 43.11 26.89H384c17.67 0 32-14.33 32-32s-14.33-31.99-32-31.99z"/></svg>`;
var REDO = "initiative-tracker-redo";
var REDO_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="redo" class="svg-inline--fa fa-redo fa-w-16" role="img" viewBox="0 0 512 512"><path fill="currentColor" d="M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"/></svg>`;
var NEW = "initiative-tracker-new";
var NEW_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="far" data-icon="plus-square" class="svg-inline--fa fa-plus-square fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M352 240v32c0 6.6-5.4 12-12 12h-88v88c0 6.6-5.4 12-12 12h-32c-6.6 0-12-5.4-12-12v-88h-88c-6.6 0-12-5.4-12-12v-32c0-6.6 5.4-12 12-12h88v-88c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v88h88c6.6 0 12 5.4 12 12zm96-160v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-48 346V86c0-3.3-2.7-6-6-6H54c-3.3 0-6 2.7-6 6v340c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"/></svg>`;
var DICE = "initiative-tracker-dice";
var DICE_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="dice" class="svg-inline--fa fa-dice fa-w-20" role="img" viewBox="0 0 640 512"><path fill="currentColor" d="M592 192H473.26c12.69 29.59 7.12 65.2-17 89.32L320 417.58V464c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48V240c0-26.51-21.49-48-48-48zM480 376c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm-46.37-186.7L258.7 14.37c-19.16-19.16-50.23-19.16-69.39 0L14.37 189.3c-19.16 19.16-19.16 50.23 0 69.39L189.3 433.63c19.16 19.16 50.23 19.16 69.39 0L433.63 258.7c19.16-19.17 19.16-50.24 0-69.4zM96 248c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm128 128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm0-128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm0-128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm128 128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"/></svg>`;
var COPY = "initiative-tracker-copy";
var COPY_ICON = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="far" data-icon="copy" class="svg-inline--fa fa-copy fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg>`;

// src/settings.ts
var import_obsidian3 = __toModule(require("obsidian"));

// src/utils/suggester.ts
var import_obsidian2 = __toModule(require("obsidian"));

// node_modules/@popperjs/core/lib/enums.js
var top = "top";
var bottom = "bottom";
var right = "right";
var left = "left";
var auto = "auto";
var basePlacements = [top, bottom, right, left];
var start = "start";
var end = "end";
var clippingParents = "clippingParents";
var viewport = "viewport";
var popper = "popper";
var reference = "reference";
var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  return acc.concat([placement + "-" + start, placement + "-" + end]);
}, []);
var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
}, []);
var beforeRead = "beforeRead";
var read = "read";
var afterRead = "afterRead";
var beforeMain = "beforeMain";
var main = "main";
var afterMain = "afterMain";
var beforeWrite = "beforeWrite";
var write = "write";
var afterWrite = "afterWrite";
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];

// node_modules/@popperjs/core/lib/dom-utils/getNodeName.js
function getNodeName(element2) {
  return element2 ? (element2.nodeName || "").toLowerCase() : null;
}

// node_modules/@popperjs/core/lib/dom-utils/getWindow.js
function getWindow(node) {
  if (node == null) {
    return window;
  }
  if (node.toString() !== "[object Window]") {
    var ownerDocument = node.ownerDocument;
    return ownerDocument ? ownerDocument.defaultView || window : window;
  }
  return node;
}

// node_modules/@popperjs/core/lib/dom-utils/instanceOf.js
function isElement(node) {
  var OwnElement = getWindow(node).Element;
  return node instanceof OwnElement || node instanceof Element;
}
function isHTMLElement(node) {
  var OwnElement = getWindow(node).HTMLElement;
  return node instanceof OwnElement || node instanceof HTMLElement;
}
function isShadowRoot(node) {
  if (typeof ShadowRoot === "undefined") {
    return false;
  }
  var OwnElement = getWindow(node).ShadowRoot;
  return node instanceof OwnElement || node instanceof ShadowRoot;
}

// node_modules/@popperjs/core/lib/modifiers/applyStyles.js
function applyStyles(_ref) {
  var state = _ref.state;
  Object.keys(state.elements).forEach(function(name) {
    var style = state.styles[name] || {};
    var attributes = state.attributes[name] || {};
    var element2 = state.elements[name];
    if (!isHTMLElement(element2) || !getNodeName(element2)) {
      return;
    }
    Object.assign(element2.style, style);
    Object.keys(attributes).forEach(function(name2) {
      var value = attributes[name2];
      if (value === false) {
        element2.removeAttribute(name2);
      } else {
        element2.setAttribute(name2, value === true ? "" : value);
      }
    });
  });
}
function effect(_ref2) {
  var state = _ref2.state;
  var initialStyles = {
    popper: {
      position: state.options.strategy,
      left: "0",
      top: "0",
      margin: "0"
    },
    arrow: {
      position: "absolute"
    },
    reference: {}
  };
  Object.assign(state.elements.popper.style, initialStyles.popper);
  state.styles = initialStyles;
  if (state.elements.arrow) {
    Object.assign(state.elements.arrow.style, initialStyles.arrow);
  }
  return function() {
    Object.keys(state.elements).forEach(function(name) {
      var element2 = state.elements[name];
      var attributes = state.attributes[name] || {};
      var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
      var style = styleProperties.reduce(function(style2, property) {
        style2[property] = "";
        return style2;
      }, {});
      if (!isHTMLElement(element2) || !getNodeName(element2)) {
        return;
      }
      Object.assign(element2.style, style);
      Object.keys(attributes).forEach(function(attribute) {
        element2.removeAttribute(attribute);
      });
    });
  };
}
var applyStyles_default = {
  name: "applyStyles",
  enabled: true,
  phase: "write",
  fn: applyStyles,
  effect,
  requires: ["computeStyles"]
};

// node_modules/@popperjs/core/lib/utils/getBasePlacement.js
function getBasePlacement(placement) {
  return placement.split("-")[0];
}

// node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js
var round = Math.round;
function getBoundingClientRect(element2, includeScale) {
  if (includeScale === void 0) {
    includeScale = false;
  }
  var rect = element2.getBoundingClientRect();
  var scaleX = 1;
  var scaleY = 1;
  if (isHTMLElement(element2) && includeScale) {
    var offsetHeight = element2.offsetHeight;
    var offsetWidth = element2.offsetWidth;
    if (offsetWidth > 0) {
      scaleX = rect.width / offsetWidth || 1;
    }
    if (offsetHeight > 0) {
      scaleY = rect.height / offsetHeight || 1;
    }
  }
  return {
    width: round(rect.width / scaleX),
    height: round(rect.height / scaleY),
    top: round(rect.top / scaleY),
    right: round(rect.right / scaleX),
    bottom: round(rect.bottom / scaleY),
    left: round(rect.left / scaleX),
    x: round(rect.left / scaleX),
    y: round(rect.top / scaleY)
  };
}

// node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js
function getLayoutRect(element2) {
  var clientRect = getBoundingClientRect(element2);
  var width = element2.offsetWidth;
  var height = element2.offsetHeight;
  if (Math.abs(clientRect.width - width) <= 1) {
    width = clientRect.width;
  }
  if (Math.abs(clientRect.height - height) <= 1) {
    height = clientRect.height;
  }
  return {
    x: element2.offsetLeft,
    y: element2.offsetTop,
    width,
    height
  };
}

// node_modules/@popperjs/core/lib/dom-utils/contains.js
function contains(parent, child) {
  var rootNode = child.getRootNode && child.getRootNode();
  if (parent.contains(child)) {
    return true;
  } else if (rootNode && isShadowRoot(rootNode)) {
    var next2 = child;
    do {
      if (next2 && parent.isSameNode(next2)) {
        return true;
      }
      next2 = next2.parentNode || next2.host;
    } while (next2);
  }
  return false;
}

// node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
function getComputedStyle2(element2) {
  return getWindow(element2).getComputedStyle(element2);
}

// node_modules/@popperjs/core/lib/dom-utils/isTableElement.js
function isTableElement(element2) {
  return ["table", "td", "th"].indexOf(getNodeName(element2)) >= 0;
}

// node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
function getDocumentElement(element2) {
  return ((isElement(element2) ? element2.ownerDocument : element2.document) || window.document).documentElement;
}

// node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
function getParentNode(element2) {
  if (getNodeName(element2) === "html") {
    return element2;
  }
  return element2.assignedSlot || element2.parentNode || (isShadowRoot(element2) ? element2.host : null) || getDocumentElement(element2);
}

// node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
function getTrueOffsetParent(element2) {
  if (!isHTMLElement(element2) || getComputedStyle2(element2).position === "fixed") {
    return null;
  }
  return element2.offsetParent;
}
function getContainingBlock(element2) {
  var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
  var isIE = navigator.userAgent.indexOf("Trident") !== -1;
  if (isIE && isHTMLElement(element2)) {
    var elementCss = getComputedStyle2(element2);
    if (elementCss.position === "fixed") {
      return null;
    }
  }
  var currentNode = getParentNode(element2);
  while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
    var css = getComputedStyle2(currentNode);
    if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
      return currentNode;
    } else {
      currentNode = currentNode.parentNode;
    }
  }
  return null;
}
function getOffsetParent(element2) {
  var window2 = getWindow(element2);
  var offsetParent = getTrueOffsetParent(element2);
  while (offsetParent && isTableElement(offsetParent) && getComputedStyle2(offsetParent).position === "static") {
    offsetParent = getTrueOffsetParent(offsetParent);
  }
  if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle2(offsetParent).position === "static")) {
    return window2;
  }
  return offsetParent || getContainingBlock(element2) || window2;
}

// node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js
function getMainAxisFromPlacement(placement) {
  return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
}

// node_modules/@popperjs/core/lib/utils/math.js
var max = Math.max;
var min = Math.min;
var round2 = Math.round;

// node_modules/@popperjs/core/lib/utils/within.js
function within(min2, value, max2) {
  return max(min2, min(value, max2));
}

// node_modules/@popperjs/core/lib/utils/getFreshSideObject.js
function getFreshSideObject() {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0
  };
}

// node_modules/@popperjs/core/lib/utils/mergePaddingObject.js
function mergePaddingObject(paddingObject) {
  return Object.assign({}, getFreshSideObject(), paddingObject);
}

// node_modules/@popperjs/core/lib/utils/expandToHashMap.js
function expandToHashMap(value, keys) {
  return keys.reduce(function(hashMap, key) {
    hashMap[key] = value;
    return hashMap;
  }, {});
}

// node_modules/@popperjs/core/lib/modifiers/arrow.js
var toPaddingObject = function toPaddingObject2(padding, state) {
  padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
    placement: state.placement
  })) : padding;
  return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
};
function arrow(_ref) {
  var _state$modifiersData$;
  var state = _ref.state, name = _ref.name, options = _ref.options;
  var arrowElement = state.elements.arrow;
  var popperOffsets2 = state.modifiersData.popperOffsets;
  var basePlacement = getBasePlacement(state.placement);
  var axis = getMainAxisFromPlacement(basePlacement);
  var isVertical = [left, right].indexOf(basePlacement) >= 0;
  var len = isVertical ? "height" : "width";
  if (!arrowElement || !popperOffsets2) {
    return;
  }
  var paddingObject = toPaddingObject(options.padding, state);
  var arrowRect = getLayoutRect(arrowElement);
  var minProp = axis === "y" ? top : left;
  var maxProp = axis === "y" ? bottom : right;
  var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  var arrowOffsetParent = getOffsetParent(arrowElement);
  var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  var centerToReference = endDiff / 2 - startDiff / 2;
  var min2 = paddingObject[minProp];
  var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  var offset2 = within(min2, center, max2);
  var axisProp = axis;
  state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
}
function effect2(_ref2) {
  var state = _ref2.state, options = _ref2.options;
  var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  if (arrowElement == null) {
    return;
  }
  if (typeof arrowElement === "string") {
    arrowElement = state.elements.popper.querySelector(arrowElement);
    if (!arrowElement) {
      return;
    }
  }
  if (true) {
    if (!isHTMLElement(arrowElement)) {
      console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', "To use an SVG arrow, wrap it in an HTMLElement that will be used as", "the arrow."].join(" "));
    }
  }
  if (!contains(state.elements.popper, arrowElement)) {
    if (true) {
      console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', "element."].join(" "));
    }
    return;
  }
  state.elements.arrow = arrowElement;
}
var arrow_default = {
  name: "arrow",
  enabled: true,
  phase: "main",
  fn: arrow,
  effect: effect2,
  requires: ["popperOffsets"],
  requiresIfExists: ["preventOverflow"]
};

// node_modules/@popperjs/core/lib/utils/getVariation.js
function getVariation(placement) {
  return placement.split("-")[1];
}

// node_modules/@popperjs/core/lib/modifiers/computeStyles.js
var unsetSides = {
  top: "auto",
  right: "auto",
  bottom: "auto",
  left: "auto"
};
function roundOffsetsByDPR(_ref) {
  var x = _ref.x, y = _ref.y;
  var win = window;
  var dpr = win.devicePixelRatio || 1;
  return {
    x: round2(round2(x * dpr) / dpr) || 0,
    y: round2(round2(y * dpr) / dpr) || 0
  };
}
function mapToStyles(_ref2) {
  var _Object$assign2;
  var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets;
  var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === "function" ? roundOffsets(offsets) : offsets, _ref3$x = _ref3.x, x = _ref3$x === void 0 ? 0 : _ref3$x, _ref3$y = _ref3.y, y = _ref3$y === void 0 ? 0 : _ref3$y;
  var hasX = offsets.hasOwnProperty("x");
  var hasY = offsets.hasOwnProperty("y");
  var sideX = left;
  var sideY = top;
  var win = window;
  if (adaptive) {
    var offsetParent = getOffsetParent(popper2);
    var heightProp = "clientHeight";
    var widthProp = "clientWidth";
    if (offsetParent === getWindow(popper2)) {
      offsetParent = getDocumentElement(popper2);
      if (getComputedStyle2(offsetParent).position !== "static" && position === "absolute") {
        heightProp = "scrollHeight";
        widthProp = "scrollWidth";
      }
    }
    offsetParent = offsetParent;
    if (placement === top || (placement === left || placement === right) && variation === end) {
      sideY = bottom;
      y -= offsetParent[heightProp] - popperRect.height;
      y *= gpuAcceleration ? 1 : -1;
    }
    if (placement === left || (placement === top || placement === bottom) && variation === end) {
      sideX = right;
      x -= offsetParent[widthProp] - popperRect.width;
      x *= gpuAcceleration ? 1 : -1;
    }
  }
  var commonStyles = Object.assign({
    position
  }, adaptive && unsetSides);
  if (gpuAcceleration) {
    var _Object$assign;
    return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  }
  return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
}
function computeStyles(_ref4) {
  var state = _ref4.state, options = _ref4.options;
  var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  if (true) {
    var transitionProperty = getComputedStyle2(state.elements.popper).transitionProperty || "";
    if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
      return transitionProperty.indexOf(property) >= 0;
    })) {
      console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
    }
  }
  var commonStyles = {
    placement: getBasePlacement(state.placement),
    variation: getVariation(state.placement),
    popper: state.elements.popper,
    popperRect: state.rects.popper,
    gpuAcceleration
  };
  if (state.modifiersData.popperOffsets != null) {
    state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
      offsets: state.modifiersData.popperOffsets,
      position: state.options.strategy,
      adaptive,
      roundOffsets
    })));
  }
  if (state.modifiersData.arrow != null) {
    state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
      offsets: state.modifiersData.arrow,
      position: "absolute",
      adaptive: false,
      roundOffsets
    })));
  }
  state.attributes.popper = Object.assign({}, state.attributes.popper, {
    "data-popper-placement": state.placement
  });
}
var computeStyles_default = {
  name: "computeStyles",
  enabled: true,
  phase: "beforeWrite",
  fn: computeStyles,
  data: {}
};

// node_modules/@popperjs/core/lib/modifiers/eventListeners.js
var passive = {
  passive: true
};
function effect3(_ref) {
  var state = _ref.state, instance16 = _ref.instance, options = _ref.options;
  var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
  var window2 = getWindow(state.elements.popper);
  var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  if (scroll) {
    scrollParents.forEach(function(scrollParent) {
      scrollParent.addEventListener("scroll", instance16.update, passive);
    });
  }
  if (resize) {
    window2.addEventListener("resize", instance16.update, passive);
  }
  return function() {
    if (scroll) {
      scrollParents.forEach(function(scrollParent) {
        scrollParent.removeEventListener("scroll", instance16.update, passive);
      });
    }
    if (resize) {
      window2.removeEventListener("resize", instance16.update, passive);
    }
  };
}
var eventListeners_default = {
  name: "eventListeners",
  enabled: true,
  phase: "write",
  fn: function fn() {
  },
  effect: effect3,
  data: {}
};

// node_modules/@popperjs/core/lib/utils/getOppositePlacement.js
var hash = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
};
function getOppositePlacement(placement) {
  return placement.replace(/left|right|bottom|top/g, function(matched) {
    return hash[matched];
  });
}

// node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js
var hash2 = {
  start: "end",
  end: "start"
};
function getOppositeVariationPlacement(placement) {
  return placement.replace(/start|end/g, function(matched) {
    return hash2[matched];
  });
}

// node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js
function getWindowScroll(node) {
  var win = getWindow(node);
  var scrollLeft = win.pageXOffset;
  var scrollTop = win.pageYOffset;
  return {
    scrollLeft,
    scrollTop
  };
}

// node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js
function getWindowScrollBarX(element2) {
  return getBoundingClientRect(getDocumentElement(element2)).left + getWindowScroll(element2).scrollLeft;
}

// node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js
function getViewportRect(element2) {
  var win = getWindow(element2);
  var html = getDocumentElement(element2);
  var visualViewport = win.visualViewport;
  var width = html.clientWidth;
  var height = html.clientHeight;
  var x = 0;
  var y = 0;
  if (visualViewport) {
    width = visualViewport.width;
    height = visualViewport.height;
    if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
      x = visualViewport.offsetLeft;
      y = visualViewport.offsetTop;
    }
  }
  return {
    width,
    height,
    x: x + getWindowScrollBarX(element2),
    y
  };
}

// node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js
function getDocumentRect(element2) {
  var _element$ownerDocumen;
  var html = getDocumentElement(element2);
  var winScroll = getWindowScroll(element2);
  var body = (_element$ownerDocumen = element2.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  var x = -winScroll.scrollLeft + getWindowScrollBarX(element2);
  var y = -winScroll.scrollTop;
  if (getComputedStyle2(body || html).direction === "rtl") {
    x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  }
  return {
    width,
    height,
    x,
    y
  };
}

// node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js
function isScrollParent(element2) {
  var _getComputedStyle = getComputedStyle2(element2), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
}

// node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js
function getScrollParent(node) {
  if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
    return node.ownerDocument.body;
  }
  if (isHTMLElement(node) && isScrollParent(node)) {
    return node;
  }
  return getScrollParent(getParentNode(node));
}

// node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js
function listScrollParents(element2, list) {
  var _element$ownerDocumen;
  if (list === void 0) {
    list = [];
  }
  var scrollParent = getScrollParent(element2);
  var isBody = scrollParent === ((_element$ownerDocumen = element2.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  var win = getWindow(scrollParent);
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  var updatedList = list.concat(target);
  return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
}

// node_modules/@popperjs/core/lib/utils/rectToClientRect.js
function rectToClientRect(rect) {
  return Object.assign({}, rect, {
    left: rect.x,
    top: rect.y,
    right: rect.x + rect.width,
    bottom: rect.y + rect.height
  });
}

// node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js
function getInnerBoundingClientRect(element2) {
  var rect = getBoundingClientRect(element2);
  rect.top = rect.top + element2.clientTop;
  rect.left = rect.left + element2.clientLeft;
  rect.bottom = rect.top + element2.clientHeight;
  rect.right = rect.left + element2.clientWidth;
  rect.width = element2.clientWidth;
  rect.height = element2.clientHeight;
  rect.x = rect.left;
  rect.y = rect.top;
  return rect;
}
function getClientRectFromMixedType(element2, clippingParent) {
  return clippingParent === viewport ? rectToClientRect(getViewportRect(element2)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element2)));
}
function getClippingParents(element2) {
  var clippingParents2 = listScrollParents(getParentNode(element2));
  var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle2(element2).position) >= 0;
  var clipperElement = canEscapeClipping && isHTMLElement(element2) ? getOffsetParent(element2) : element2;
  if (!isElement(clipperElement)) {
    return [];
  }
  return clippingParents2.filter(function(clippingParent) {
    return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  });
}
function getClippingRect(element2, boundary, rootBoundary) {
  var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element2) : [].concat(boundary);
  var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  var firstClippingParent = clippingParents2[0];
  var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
    var rect = getClientRectFromMixedType(element2, clippingParent);
    accRect.top = max(rect.top, accRect.top);
    accRect.right = min(rect.right, accRect.right);
    accRect.bottom = min(rect.bottom, accRect.bottom);
    accRect.left = max(rect.left, accRect.left);
    return accRect;
  }, getClientRectFromMixedType(element2, firstClippingParent));
  clippingRect.width = clippingRect.right - clippingRect.left;
  clippingRect.height = clippingRect.bottom - clippingRect.top;
  clippingRect.x = clippingRect.left;
  clippingRect.y = clippingRect.top;
  return clippingRect;
}

// node_modules/@popperjs/core/lib/utils/computeOffsets.js
function computeOffsets(_ref) {
  var reference2 = _ref.reference, element2 = _ref.element, placement = _ref.placement;
  var basePlacement = placement ? getBasePlacement(placement) : null;
  var variation = placement ? getVariation(placement) : null;
  var commonX = reference2.x + reference2.width / 2 - element2.width / 2;
  var commonY = reference2.y + reference2.height / 2 - element2.height / 2;
  var offsets;
  switch (basePlacement) {
    case top:
      offsets = {
        x: commonX,
        y: reference2.y - element2.height
      };
      break;
    case bottom:
      offsets = {
        x: commonX,
        y: reference2.y + reference2.height
      };
      break;
    case right:
      offsets = {
        x: reference2.x + reference2.width,
        y: commonY
      };
      break;
    case left:
      offsets = {
        x: reference2.x - element2.width,
        y: commonY
      };
      break;
    default:
      offsets = {
        x: reference2.x,
        y: reference2.y
      };
  }
  var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  if (mainAxis != null) {
    var len = mainAxis === "y" ? "height" : "width";
    switch (variation) {
      case start:
        offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element2[len] / 2);
        break;
      case end:
        offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element2[len] / 2);
        break;
      default:
    }
  }
  return offsets;
}

// node_modules/@popperjs/core/lib/utils/detectOverflow.js
function detectOverflow(state, options) {
  if (options === void 0) {
    options = {};
  }
  var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
  var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  var altContext = elementContext === popper ? reference : popper;
  var popperRect = state.rects.popper;
  var element2 = state.elements[altBoundary ? altContext : elementContext];
  var clippingClientRect = getClippingRect(isElement(element2) ? element2 : element2.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
  var referenceClientRect = getBoundingClientRect(state.elements.reference);
  var popperOffsets2 = computeOffsets({
    reference: referenceClientRect,
    element: popperRect,
    strategy: "absolute",
    placement
  });
  var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  var overflowOffsets = {
    top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
    bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
    left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
    right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  };
  var offsetData = state.modifiersData.offset;
  if (elementContext === popper && offsetData) {
    var offset2 = offsetData[placement];
    Object.keys(overflowOffsets).forEach(function(key) {
      var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
      var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
      overflowOffsets[key] += offset2[axis] * multiply;
    });
  }
  return overflowOffsets;
}

// node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js
function computeAutoPlacement(state, options) {
  if (options === void 0) {
    options = {};
  }
  var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
  var variation = getVariation(placement);
  var placements2 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
    return getVariation(placement2) === variation;
  }) : basePlacements;
  var allowedPlacements = placements2.filter(function(placement2) {
    return allowedAutoPlacements.indexOf(placement2) >= 0;
  });
  if (allowedPlacements.length === 0) {
    allowedPlacements = placements2;
    if (true) {
      console.error(["Popper: The `allowedAutoPlacements` option did not allow any", "placements. Ensure the `placement` option matches the variation", "of the allowed placements.", 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(" "));
    }
  }
  var overflows = allowedPlacements.reduce(function(acc, placement2) {
    acc[placement2] = detectOverflow(state, {
      placement: placement2,
      boundary,
      rootBoundary,
      padding
    })[getBasePlacement(placement2)];
    return acc;
  }, {});
  return Object.keys(overflows).sort(function(a, b) {
    return overflows[a] - overflows[b];
  });
}

// node_modules/@popperjs/core/lib/modifiers/flip.js
function getExpandedFallbackPlacements(placement) {
  if (getBasePlacement(placement) === auto) {
    return [];
  }
  var oppositePlacement = getOppositePlacement(placement);
  return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
}
function flip(_ref) {
  var state = _ref.state, options = _ref.options, name = _ref.name;
  if (state.modifiersData[name]._skip) {
    return;
  }
  var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
  var preferredPlacement = state.options.placement;
  var basePlacement = getBasePlacement(preferredPlacement);
  var isBasePlacement = basePlacement === preferredPlacement;
  var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
    return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
      placement: placement2,
      boundary,
      rootBoundary,
      padding,
      flipVariations,
      allowedAutoPlacements
    }) : placement2);
  }, []);
  var referenceRect = state.rects.reference;
  var popperRect = state.rects.popper;
  var checksMap = /* @__PURE__ */ new Map();
  var makeFallbackChecks = true;
  var firstFittingPlacement = placements2[0];
  for (var i = 0; i < placements2.length; i++) {
    var placement = placements2[i];
    var _basePlacement = getBasePlacement(placement);
    var isStartVariation = getVariation(placement) === start;
    var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
    var len = isVertical ? "width" : "height";
    var overflow = detectOverflow(state, {
      placement,
      boundary,
      rootBoundary,
      altBoundary,
      padding
    });
    var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
    if (referenceRect[len] > popperRect[len]) {
      mainVariationSide = getOppositePlacement(mainVariationSide);
    }
    var altVariationSide = getOppositePlacement(mainVariationSide);
    var checks = [];
    if (checkMainAxis) {
      checks.push(overflow[_basePlacement] <= 0);
    }
    if (checkAltAxis) {
      checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
    }
    if (checks.every(function(check) {
      return check;
    })) {
      firstFittingPlacement = placement;
      makeFallbackChecks = false;
      break;
    }
    checksMap.set(placement, checks);
  }
  if (makeFallbackChecks) {
    var numberOfChecks = flipVariations ? 3 : 1;
    var _loop = function _loop2(_i2) {
      var fittingPlacement = placements2.find(function(placement2) {
        var checks2 = checksMap.get(placement2);
        if (checks2) {
          return checks2.slice(0, _i2).every(function(check) {
            return check;
          });
        }
      });
      if (fittingPlacement) {
        firstFittingPlacement = fittingPlacement;
        return "break";
      }
    };
    for (var _i = numberOfChecks; _i > 0; _i--) {
      var _ret = _loop(_i);
      if (_ret === "break")
        break;
    }
  }
  if (state.placement !== firstFittingPlacement) {
    state.modifiersData[name]._skip = true;
    state.placement = firstFittingPlacement;
    state.reset = true;
  }
}
var flip_default = {
  name: "flip",
  enabled: true,
  phase: "main",
  fn: flip,
  requiresIfExists: ["offset"],
  data: {
    _skip: false
  }
};

// node_modules/@popperjs/core/lib/modifiers/hide.js
function getSideOffsets(overflow, rect, preventedOffsets) {
  if (preventedOffsets === void 0) {
    preventedOffsets = {
      x: 0,
      y: 0
    };
  }
  return {
    top: overflow.top - rect.height - preventedOffsets.y,
    right: overflow.right - rect.width + preventedOffsets.x,
    bottom: overflow.bottom - rect.height + preventedOffsets.y,
    left: overflow.left - rect.width - preventedOffsets.x
  };
}
function isAnySideFullyClipped(overflow) {
  return [top, right, bottom, left].some(function(side) {
    return overflow[side] >= 0;
  });
}
function hide(_ref) {
  var state = _ref.state, name = _ref.name;
  var referenceRect = state.rects.reference;
  var popperRect = state.rects.popper;
  var preventedOffsets = state.modifiersData.preventOverflow;
  var referenceOverflow = detectOverflow(state, {
    elementContext: "reference"
  });
  var popperAltOverflow = detectOverflow(state, {
    altBoundary: true
  });
  var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  state.modifiersData[name] = {
    referenceClippingOffsets,
    popperEscapeOffsets,
    isReferenceHidden,
    hasPopperEscaped
  };
  state.attributes.popper = Object.assign({}, state.attributes.popper, {
    "data-popper-reference-hidden": isReferenceHidden,
    "data-popper-escaped": hasPopperEscaped
  });
}
var hide_default = {
  name: "hide",
  enabled: true,
  phase: "main",
  requiresIfExists: ["preventOverflow"],
  fn: hide
};

// node_modules/@popperjs/core/lib/modifiers/offset.js
function distanceAndSkiddingToXY(placement, rects, offset2) {
  var basePlacement = getBasePlacement(placement);
  var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
    placement
  })) : offset2, skidding = _ref[0], distance = _ref[1];
  skidding = skidding || 0;
  distance = (distance || 0) * invertDistance;
  return [left, right].indexOf(basePlacement) >= 0 ? {
    x: distance,
    y: skidding
  } : {
    x: skidding,
    y: distance
  };
}
function offset(_ref2) {
  var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  var data = placements.reduce(function(acc, placement) {
    acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
    return acc;
  }, {});
  var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  if (state.modifiersData.popperOffsets != null) {
    state.modifiersData.popperOffsets.x += x;
    state.modifiersData.popperOffsets.y += y;
  }
  state.modifiersData[name] = data;
}
var offset_default = {
  name: "offset",
  enabled: true,
  phase: "main",
  requires: ["popperOffsets"],
  fn: offset
};

// node_modules/@popperjs/core/lib/modifiers/popperOffsets.js
function popperOffsets(_ref) {
  var state = _ref.state, name = _ref.name;
  state.modifiersData[name] = computeOffsets({
    reference: state.rects.reference,
    element: state.rects.popper,
    strategy: "absolute",
    placement: state.placement
  });
}
var popperOffsets_default = {
  name: "popperOffsets",
  enabled: true,
  phase: "read",
  fn: popperOffsets,
  data: {}
};

// node_modules/@popperjs/core/lib/utils/getAltAxis.js
function getAltAxis(axis) {
  return axis === "x" ? "y" : "x";
}

// node_modules/@popperjs/core/lib/modifiers/preventOverflow.js
function preventOverflow(_ref) {
  var state = _ref.state, options = _ref.options, name = _ref.name;
  var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  var overflow = detectOverflow(state, {
    boundary,
    rootBoundary,
    padding,
    altBoundary
  });
  var basePlacement = getBasePlacement(state.placement);
  var variation = getVariation(state.placement);
  var isBasePlacement = !variation;
  var mainAxis = getMainAxisFromPlacement(basePlacement);
  var altAxis = getAltAxis(mainAxis);
  var popperOffsets2 = state.modifiersData.popperOffsets;
  var referenceRect = state.rects.reference;
  var popperRect = state.rects.popper;
  var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
    placement: state.placement
  })) : tetherOffset;
  var data = {
    x: 0,
    y: 0
  };
  if (!popperOffsets2) {
    return;
  }
  if (checkMainAxis || checkAltAxis) {
    var mainSide = mainAxis === "y" ? top : left;
    var altSide = mainAxis === "y" ? bottom : right;
    var len = mainAxis === "y" ? "height" : "width";
    var offset2 = popperOffsets2[mainAxis];
    var min2 = popperOffsets2[mainAxis] + overflow[mainSide];
    var max2 = popperOffsets2[mainAxis] - overflow[altSide];
    var additive = tether ? -popperRect[len] / 2 : 0;
    var minLen = variation === start ? referenceRect[len] : popperRect[len];
    var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
    var arrowElement = state.elements.arrow;
    var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
      width: 0,
      height: 0
    };
    var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
    var arrowPaddingMin = arrowPaddingObject[mainSide];
    var arrowPaddingMax = arrowPaddingObject[altSide];
    var arrowLen = within(0, referenceRect[len], arrowRect[len]);
    var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
    var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
    var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
    var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
    var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
    var tetherMin = popperOffsets2[mainAxis] + minOffset - offsetModifierValue - clientOffset;
    var tetherMax = popperOffsets2[mainAxis] + maxOffset - offsetModifierValue;
    if (checkMainAxis) {
      var preventedOffset = within(tether ? min(min2, tetherMin) : min2, offset2, tether ? max(max2, tetherMax) : max2);
      popperOffsets2[mainAxis] = preventedOffset;
      data[mainAxis] = preventedOffset - offset2;
    }
    if (checkAltAxis) {
      var _mainSide = mainAxis === "x" ? top : left;
      var _altSide = mainAxis === "x" ? bottom : right;
      var _offset = popperOffsets2[altAxis];
      var _min = _offset + overflow[_mainSide];
      var _max = _offset - overflow[_altSide];
      var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max);
      popperOffsets2[altAxis] = _preventedOffset;
      data[altAxis] = _preventedOffset - _offset;
    }
  }
  state.modifiersData[name] = data;
}
var preventOverflow_default = {
  name: "preventOverflow",
  enabled: true,
  phase: "main",
  fn: preventOverflow,
  requiresIfExists: ["offset"]
};

// node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js
function getHTMLElementScroll(element2) {
  return {
    scrollLeft: element2.scrollLeft,
    scrollTop: element2.scrollTop
  };
}

// node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js
function getNodeScroll(node) {
  if (node === getWindow(node) || !isHTMLElement(node)) {
    return getWindowScroll(node);
  } else {
    return getHTMLElementScroll(node);
  }
}

// node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js
function isElementScaled(element2) {
  var rect = element2.getBoundingClientRect();
  var scaleX = rect.width / element2.offsetWidth || 1;
  var scaleY = rect.height / element2.offsetHeight || 1;
  return scaleX !== 1 || scaleY !== 1;
}
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  if (isFixed === void 0) {
    isFixed = false;
  }
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
  var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  var documentElement = getDocumentElement(offsetParent);
  var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
  var scroll = {
    scrollLeft: 0,
    scrollTop: 0
  };
  var offsets = {
    x: 0,
    y: 0
  };
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
    if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
      scroll = getNodeScroll(offsetParent);
    }
    if (isHTMLElement(offsetParent)) {
      offsets = getBoundingClientRect(offsetParent, true);
      offsets.x += offsetParent.clientLeft;
      offsets.y += offsetParent.clientTop;
    } else if (documentElement) {
      offsets.x = getWindowScrollBarX(documentElement);
    }
  }
  return {
    x: rect.left + scroll.scrollLeft - offsets.x,
    y: rect.top + scroll.scrollTop - offsets.y,
    width: rect.width,
    height: rect.height
  };
}

// node_modules/@popperjs/core/lib/utils/orderModifiers.js
function order(modifiers) {
  var map = /* @__PURE__ */ new Map();
  var visited = /* @__PURE__ */ new Set();
  var result = [];
  modifiers.forEach(function(modifier) {
    map.set(modifier.name, modifier);
  });
  function sort(modifier) {
    visited.add(modifier.name);
    var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
    requires.forEach(function(dep) {
      if (!visited.has(dep)) {
        var depModifier = map.get(dep);
        if (depModifier) {
          sort(depModifier);
        }
      }
    });
    result.push(modifier);
  }
  modifiers.forEach(function(modifier) {
    if (!visited.has(modifier.name)) {
      sort(modifier);
    }
  });
  return result;
}
function orderModifiers(modifiers) {
  var orderedModifiers = order(modifiers);
  return modifierPhases.reduce(function(acc, phase) {
    return acc.concat(orderedModifiers.filter(function(modifier) {
      return modifier.phase === phase;
    }));
  }, []);
}

// node_modules/@popperjs/core/lib/utils/debounce.js
function debounce(fn2) {
  var pending;
  return function() {
    if (!pending) {
      pending = new Promise(function(resolve) {
        Promise.resolve().then(function() {
          pending = void 0;
          resolve(fn2());
        });
      });
    }
    return pending;
  };
}

// node_modules/@popperjs/core/lib/utils/format.js
function format(str) {
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    args[_key - 1] = arguments[_key];
  }
  return [].concat(args).reduce(function(p, c) {
    return p.replace(/%s/, c);
  }, str);
}

// node_modules/@popperjs/core/lib/utils/validateModifiers.js
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
function validateModifiers(modifiers) {
  modifiers.forEach(function(modifier) {
    [].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self2) {
      return self2.indexOf(value) === index;
    }).forEach(function(key) {
      switch (key) {
        case "name":
          if (typeof modifier.name !== "string") {
            console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
          }
          break;
        case "enabled":
          if (typeof modifier.enabled !== "boolean") {
            console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
          }
          break;
        case "phase":
          if (modifierPhases.indexOf(modifier.phase) < 0) {
            console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(", "), '"' + String(modifier.phase) + '"'));
          }
          break;
        case "fn":
          if (typeof modifier.fn !== "function") {
            console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
          }
          break;
        case "effect":
          if (modifier.effect != null && typeof modifier.effect !== "function") {
            console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
          }
          break;
        case "requires":
          if (modifier.requires != null && !Array.isArray(modifier.requires)) {
            console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
          }
          break;
        case "requiresIfExists":
          if (!Array.isArray(modifier.requiresIfExists)) {
            console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
          }
          break;
        case "options":
        case "data":
          break;
        default:
          console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function(s) {
            return '"' + s + '"';
          }).join(", ") + '; but "' + key + '" was provided.');
      }
      modifier.requires && modifier.requires.forEach(function(requirement) {
        if (modifiers.find(function(mod) {
          return mod.name === requirement;
        }) == null) {
          console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
        }
      });
    });
  });
}

// node_modules/@popperjs/core/lib/utils/uniqueBy.js
function uniqueBy(arr, fn2) {
  var identifiers = /* @__PURE__ */ new Set();
  return arr.filter(function(item) {
    var identifier = fn2(item);
    if (!identifiers.has(identifier)) {
      identifiers.add(identifier);
      return true;
    }
  });
}

// node_modules/@popperjs/core/lib/utils/mergeByName.js
function mergeByName(modifiers) {
  var merged = modifiers.reduce(function(merged2, current) {
    var existing = merged2[current.name];
    merged2[current.name] = existing ? Object.assign({}, existing, current, {
      options: Object.assign({}, existing.options, current.options),
      data: Object.assign({}, existing.data, current.data)
    }) : current;
    return merged2;
  }, {});
  return Object.keys(merged).map(function(key) {
    return merged[key];
  });
}

// node_modules/@popperjs/core/lib/createPopper.js
var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
var INFINITE_LOOP_ERROR = "Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.";
var DEFAULT_OPTIONS = {
  placement: "bottom",
  modifiers: [],
  strategy: "absolute"
};
function areValidElements() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }
  return !args.some(function(element2) {
    return !(element2 && typeof element2.getBoundingClientRect === "function");
  });
}
function popperGenerator(generatorOptions) {
  if (generatorOptions === void 0) {
    generatorOptions = {};
  }
  var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  return function createPopper2(reference2, popper2, options) {
    if (options === void 0) {
      options = defaultOptions;
    }
    var state = {
      placement: "bottom",
      orderedModifiers: [],
      options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
      modifiersData: {},
      elements: {
        reference: reference2,
        popper: popper2
      },
      attributes: {},
      styles: {}
    };
    var effectCleanupFns = [];
    var isDestroyed = false;
    var instance16 = {
      state,
      setOptions: function setOptions(setOptionsAction) {
        var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
        cleanupModifierEffects();
        state.options = Object.assign({}, defaultOptions, state.options, options2);
        state.scrollParents = {
          reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
          popper: listScrollParents(popper2)
        };
        var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
        state.orderedModifiers = orderedModifiers.filter(function(m) {
          return m.enabled;
        });
        if (true) {
          var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
            var name = _ref.name;
            return name;
          });
          validateModifiers(modifiers);
          if (getBasePlacement(state.options.placement) === auto) {
            var flipModifier = state.orderedModifiers.find(function(_ref2) {
              var name = _ref2.name;
              return name === "flip";
            });
            if (!flipModifier) {
              console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
            }
          }
          var _getComputedStyle = getComputedStyle2(popper2), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
          if ([marginTop, marginRight, marginBottom, marginLeft].some(function(margin) {
            return parseFloat(margin);
          })) {
            console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', "between the popper and its reference element or boundary.", "To replicate margin, use the `offset` modifier, as well as", "the `padding` option in the `preventOverflow` and `flip`", "modifiers."].join(" "));
          }
        }
        runModifierEffects();
        return instance16.update();
      },
      forceUpdate: function forceUpdate() {
        if (isDestroyed) {
          return;
        }
        var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
        if (!areValidElements(reference3, popper3)) {
          if (true) {
            console.error(INVALID_ELEMENT_ERROR);
          }
          return;
        }
        state.rects = {
          reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
          popper: getLayoutRect(popper3)
        };
        state.reset = false;
        state.placement = state.options.placement;
        state.orderedModifiers.forEach(function(modifier) {
          return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
        });
        var __debug_loops__ = 0;
        for (var index = 0; index < state.orderedModifiers.length; index++) {
          if (true) {
            __debug_loops__ += 1;
            if (__debug_loops__ > 100) {
              console.error(INFINITE_LOOP_ERROR);
              break;
            }
          }
          if (state.reset === true) {
            state.reset = false;
            index = -1;
            continue;
          }
          var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
          if (typeof fn2 === "function") {
            state = fn2({
              state,
              options: _options,
              name,
              instance: instance16
            }) || state;
          }
        }
      },
      update: debounce(function() {
        return new Promise(function(resolve) {
          instance16.forceUpdate();
          resolve(state);
        });
      }),
      destroy: function destroy() {
        cleanupModifierEffects();
        isDestroyed = true;
      }
    };
    if (!areValidElements(reference2, popper2)) {
      if (true) {
        console.error(INVALID_ELEMENT_ERROR);
      }
      return instance16;
    }
    instance16.setOptions(options).then(function(state2) {
      if (!isDestroyed && options.onFirstUpdate) {
        options.onFirstUpdate(state2);
      }
    });
    function runModifierEffects() {
      state.orderedModifiers.forEach(function(_ref3) {
        var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect4 = _ref3.effect;
        if (typeof effect4 === "function") {
          var cleanupFn = effect4({
            state,
            name,
            instance: instance16,
            options: options2
          });
          var noopFn = function noopFn2() {
          };
          effectCleanupFns.push(cleanupFn || noopFn);
        }
      });
    }
    function cleanupModifierEffects() {
      effectCleanupFns.forEach(function(fn2) {
        return fn2();
      });
      effectCleanupFns = [];
    }
    return instance16;
  };
}

// node_modules/@popperjs/core/lib/popper.js
var defaultModifiers = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default, offset_default, flip_default, preventOverflow_default, arrow_default, hide_default];
var createPopper = /* @__PURE__ */ popperGenerator({
  defaultModifiers
});

// src/utils/suggester.ts
var Suggester = class {
  constructor(owner, containerEl, scope) {
    this.containerEl = containerEl;
    this.owner = owner;
    containerEl.on("click", ".suggestion-item", this.onSuggestionClick.bind(this));
    containerEl.on("mousemove", ".suggestion-item", this.onSuggestionMouseover.bind(this));
    scope.register([], "ArrowUp", () => {
      this.setSelectedItem(this.selectedItem - 1, true);
      return false;
    });
    scope.register([], "ArrowDown", () => {
      this.setSelectedItem(this.selectedItem + 1, true);
      return false;
    });
    scope.register([], "Enter", (evt) => {
      this.useSelectedItem(evt);
      return false;
    });
    scope.register([], "Tab", (evt) => {
      this.useSelectedItem(evt);
      return false;
    });
  }
  chooseSuggestion(evt) {
    if (!this.items || !this.items.length)
      return;
    const currentValue = this.items[this.selectedItem];
    if (currentValue) {
      this.owner.selectSuggestion(currentValue, evt);
    }
  }
  onSuggestionClick(event, el) {
    event.preventDefault();
    if (!this.suggestions || !this.suggestions.length)
      return;
    const item = this.suggestions.indexOf(el);
    this.setSelectedItem(item, false);
    this.useSelectedItem(event);
  }
  onSuggestionMouseover(event, el) {
    if (!this.suggestions || !this.suggestions.length)
      return;
    const item = this.suggestions.indexOf(el);
    this.setSelectedItem(item, false);
  }
  empty() {
    this.containerEl.empty();
  }
  setSuggestions(items) {
    this.containerEl.empty();
    const els = [];
    items.forEach((item) => {
      const suggestionEl = this.containerEl.createDiv("suggestion-item");
      this.owner.renderSuggestion(item, suggestionEl);
      els.push(suggestionEl);
    });
    this.items = items;
    this.suggestions = els;
    this.setSelectedItem(0, false);
  }
  useSelectedItem(event) {
    if (!this.items || !this.items.length)
      return;
    const currentValue = this.items[this.selectedItem];
    if (currentValue) {
      this.owner.selectSuggestion(currentValue, event);
    }
  }
  wrap(value, size) {
    return (value % size + size) % size;
  }
  setSelectedItem(index, scroll) {
    const nIndex = this.wrap(index, this.suggestions.length);
    const prev = this.suggestions[this.selectedItem];
    const next2 = this.suggestions[nIndex];
    if (prev)
      prev.removeClass("is-selected");
    if (next2)
      next2.addClass("is-selected");
    this.selectedItem = nIndex;
    if (scroll) {
      next2.scrollIntoView(false);
    }
  }
};
var SuggestionModal = class extends import_obsidian2.FuzzySuggestModal {
  constructor(app, inputEl) {
    super(app);
    this.items = [];
    this.scope = new import_obsidian2.Scope();
    this.emptyStateText = "No match found";
    this.limit = 25;
    this.inputEl = inputEl;
    this.suggestEl = createDiv({
      attr: { style: "min-width: 475px;" },
      cls: "suggestion-container"
    });
    this.contentEl = this.suggestEl.createDiv("suggestion");
    this.suggester = new Suggester(this, this.contentEl, this.scope);
    this.scope.register([], "Escape", this.close.bind(this));
    this.inputEl.addEventListener("input", this.onInputChanged.bind(this));
    this.inputEl.addEventListener("blur", this.close.bind(this));
    this.suggestEl.on("mousedown", ".suggestion-container", (event) => {
      event.preventDefault();
    });
  }
  empty() {
    this.suggester.empty();
  }
  onInputChanged() {
    const inputStr = this.modifyInput(this.inputEl.value);
    const suggestions = this.getSuggestions(inputStr);
    if (suggestions.length > 0) {
      this.suggester.setSuggestions(suggestions.slice(0, this.limit));
    } else {
      this.onNoSuggestion();
    }
    this.open();
  }
  modifyInput(input) {
    return input;
  }
  onNoSuggestion() {
    this.empty();
    this.renderSuggestion(null, this.contentEl.createDiv("suggestion-item"));
  }
  open() {
    this.app.keymap.pushScope(this.scope);
    document.body.appendChild(this.suggestEl);
    this.popper = createPopper(this.inputEl, this.suggestEl, {
      placement: "auto-start",
      modifiers: [
        {
          name: "offset",
          options: {
            offset: [0, 10]
          }
        },
        {
          name: "flip",
          options: {
            allowedAutoPlacements: ["top-start", "bottom-start"]
          }
        }
      ]
    });
  }
  close() {
    this.app.keymap.popScope(this.scope);
    this.suggester.setSuggestions([]);
    if (this.popper) {
      this.popper.destroy();
    }
    this.suggestEl.detach();
  }
  createPrompt(prompts) {
    if (!this.promptEl)
      this.promptEl = this.suggestEl.createDiv("prompt-instructions");
    let prompt = this.promptEl.createDiv("prompt-instruction");
    for (let p of prompts) {
      prompt.appendChild(p);
    }
  }
};
var FileSuggestionModal = class extends SuggestionModal {
  constructor(app, input) {
    super(app, input.inputEl);
    this.files = this.app.vault.getMarkdownFiles();
    this.text = input;
    this.createPrompts();
    this.inputEl.addEventListener("input", this.getItem.bind(this));
  }
  createPrompts() {
  }
  getItem() {
    const v = this.inputEl.value, file = this.items.find((file2) => file2.name === v.trim());
    if (file == this.file)
      return;
    this.file = file;
    if (this.items)
      this.onInputChanged();
  }
  getItemText(item) {
    return item.name;
  }
  onChooseItem(item) {
    this.text.setValue(item.name);
    this.file = item;
  }
  selectSuggestion({ item }) {
    this.text.setValue(item.basename);
    this.file = item;
    this.onClose();
    this.close();
  }
  renderSuggestion(result, el) {
    let { item, match: matches } = result || {};
    let content = el.createDiv({
      cls: "suggestion-content icon"
    });
    if (!item) {
      this.suggester.selectedItem = null;
      content.setText(this.emptyStateText);
      content.parentElement.addClass("is-selected");
      return;
    }
    const matchElements = matches.matches.map((m) => {
      return createSpan("suggestion-highlight");
    });
    for (let i = 0; i < item.basename.length; i++) {
      let match = matches.matches.find((m) => m[0] === i);
      if (match) {
        let element2 = matchElements[matches.matches.indexOf(match)];
        content.appendChild(element2);
        element2.appendText(item.basename.substring(match[0], match[1]));
        i += match[1] - match[0] - 1;
        continue;
      }
      content.appendText(item.basename[i]);
    }
    let path = item.path.split("/").slice(0, -1).join("/");
    if (path.length) {
      path += "/";
    }
    el.createDiv({
      cls: "suggestion-note",
      text: path
    });
  }
  getItems() {
    return this.files;
  }
};
var SRDMonsterSuggestionModal = class extends SuggestionModal {
  constructor(plugin, inputEl) {
    super(plugin.app, inputEl);
    this.plugin = plugin;
    this.creatures = [...this.plugin.data.players, ...this.plugin.bestiary];
    this.onInputChanged();
  }
  getItems() {
    return this.creatures;
  }
  getItemText(item) {
    return item.name;
  }
  onChooseItem(item) {
    this.inputEl.value = item.name;
    this.creature = item;
  }
  selectSuggestion({ item }) {
    this.inputEl.value = item.name;
    this.creature = item;
    this.onClose();
    this.close();
  }
  renderSuggestion(result, el) {
    let { item, match: matches } = result || {};
    let content = el.createDiv({
      cls: "suggestion-content icon"
    });
    if (!item) {
      this.suggester.selectedItem = null;
      content.setText(this.emptyStateText);
      content.parentElement.addClass("is-selected");
      return;
    }
    const matchElements = matches.matches.map((m) => {
      return createSpan("suggestion-highlight");
    });
    for (let i = 0; i < item.name.length; i++) {
      let match = matches.matches.find((m) => m[0] === i);
      if (match) {
        let element2 = matchElements[matches.matches.indexOf(match)];
        content.appendChild(element2);
        element2.appendText(item.name.substring(match[0], match[1]));
        i += match[1] - match[0] - 1;
        continue;
      }
      content.appendText(item.name[i]);
    }
    el.createDiv({
      cls: "suggestion-note",
      text: item.source
    });
  }
};
var ConditionSuggestionModal = class extends SuggestionModal {
  constructor(plugin, inputEl) {
    super(plugin.app, inputEl);
    this.plugin = plugin;
    this.items = [];
    this.items = this.plugin.data.statuses;
    this.suggestEl.style.removeProperty("min-width");
    this.onInputChanged();
  }
  getItemText(item) {
    return item.name;
  }
  getItems() {
    return this.items;
  }
  onChooseItem(item) {
    this.inputEl.value = item.name;
    this.condition = item;
  }
  onNoSuggestion() {
    this.empty();
    this.renderSuggestion(null, this.contentEl.createDiv("suggestion-item"));
    this.condition = null;
  }
  selectSuggestion({ item }) {
    if (this.condition !== null) {
      this.inputEl.value = item.name;
      this.condition = item;
    } else {
      this.condition = {
        name: this.inputEl.value,
        description: ""
      };
    }
    this.onClose();
    this.close();
  }
  renderSuggestion(result, el) {
    let { item, match: matches } = result || {};
    let content = new import_obsidian2.Setting(el);
    if (!item) {
      content.nameEl.setText(this.emptyStateText);
      this.condition = null;
      return;
    }
    const matchElements = matches.matches.map((m) => {
      return createSpan("suggestion-highlight");
    });
    for (let i = 0; i < item.name.length; i++) {
      let match = matches.matches.find((m) => m[0] === i);
      if (match) {
        let element2 = matchElements[matches.matches.indexOf(match)];
        content.nameEl.appendChild(element2);
        element2.appendText(item.name.substring(match[0], match[1]));
        i += match[1] - match[0] - 1;
        continue;
      }
      content.nameEl.appendText(item.name[i]);
    }
  }
};
var PlayerSuggestionModal = class extends SuggestionModal {
  constructor(plugin, input, party) {
    super(plugin.app, input.inputEl);
    this.plugin = plugin;
    this.party = party;
    this.items = this.plugin.data.players;
    this.text = input;
    this.createPrompts();
    this.inputEl.addEventListener("input", this.getItem.bind(this));
    this.inputEl.addEventListener("focus", this.onInputChanged.bind(this));
  }
  createPrompts() {
  }
  getItem() {
    const v = this.inputEl.value, file = this.items.find((file2) => file2.name === v.trim());
    if (file == this.player)
      return;
    this.player = file;
    if (this.items)
      this.onInputChanged();
  }
  getItemText(item) {
    return item.name;
  }
  onChooseItem(item) {
    this.text.setValue(item.name);
    this.player = item;
  }
  selectSuggestion({ item }) {
    this.text.setValue(item.name);
    this.player = item;
    this.onClose();
    this.close();
  }
  renderSuggestion(result, el) {
    let { item, match: matches } = result || {};
    let content = el.createDiv({
      cls: "suggestion-content icon"
    });
    if (!item) {
      this.suggester.selectedItem = null;
      content.setText(this.emptyStateText);
      content.parentElement.addClass("is-selected");
      return;
    }
    const matchElements = matches.matches.map((m) => {
      return createSpan("suggestion-highlight");
    });
    for (let i = 0; i < item.name.length; i++) {
      let match = matches.matches.find((m) => m[0] === i);
      if (match) {
        let element2 = matchElements[matches.matches.indexOf(match)];
        content.appendChild(element2);
        element2.appendText(item.name.substring(match[0], match[1]));
        i += match[1] - match[0] - 1;
        continue;
      }
      content.appendText(item.name[i]);
    }
  }
  getItems() {
    return this.items.filter((p) => !this.party.players.includes(p.name));
  }
};

// src/settings.ts
var import_obsidian4 = __toModule(require("obsidian"));
var InitiativeTrackerSettings = class extends import_obsidian3.PluginSettingTab {
  constructor(plugin) {
    super(plugin.app, plugin);
    this.plugin = plugin;
  }
  async display() {
    try {
      let { containerEl } = this;
      containerEl.empty();
      containerEl.addClass("initiative-tracker-settings");
      containerEl.createEl("h2", { text: "Initiative Tracker Settings" });
      this._displayBase(containerEl.createDiv());
      if (!this.plugin.data.openState) {
        this.plugin.data.openState = {
          player: true,
          party: true,
          plugin: true,
          status: true
        };
      }
      this._displayPlayers(containerEl.createEl("details", {
        cls: "initiative-tracker-additional-container",
        attr: {
          ...this.plugin.data.openState.player ? { open: true } : {}
        }
      }));
      this._displayParties(containerEl.createEl("details", {
        cls: "initiative-tracker-additional-container",
        attr: {
          ...this.plugin.data.openState.party ? { open: true } : {}
        }
      }));
      this._displayStatuses(containerEl.createEl("details", {
        cls: "initiative-tracker-additional-container",
        attr: {
          ...this.plugin.data.openState.status ? { open: true } : {}
        }
      }));
      this._displayIntegrations(containerEl.createEl("details", {
        cls: "initiative-tracker-additional-container",
        attr: {
          ...this.plugin.data.openState.plugin ? { open: true } : {}
        }
      }));
      this._displayHomebrew(containerEl.createDiv("initiative-tracker-additional-container"));
      const div = containerEl.createDiv("coffee");
      div.createEl("a", {
        href: "https://www.buymeacoffee.com/valentine195"
      }).createEl("img", {
        attr: {
          src: "https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=\u2615&slug=valentine195&button_colour=e3e7ef&font_colour=262626&font_family=Inter&outline_colour=262626&coffee_colour=ff0000"
        }
      });
    } catch (e) {
      console.error(e);
      new import_obsidian3.Notice("There was an error displaying the settings tab for Obsidian Initiative Tracker.");
    }
  }
  _displayBase(containerEl) {
    containerEl.empty();
    new import_obsidian3.Setting(containerEl).setHeading().setName("Basic Settings");
    new import_obsidian3.Setting(containerEl).setName("Display Encounter Difficulty").setDesc("Display encounter difficulty based on creature CR and player level. Creatures without CR or level will not be considered in the calculation.").addToggle((t) => {
      t.setValue(this.plugin.data.displayDifficulty).onChange(async (v) => {
        this.plugin.data.displayDifficulty = v;
        await this.plugin.saveSettings();
      });
    });
    new import_obsidian3.Setting(containerEl).setName("Roll Equivalent Creatures Together").setDesc("Equivalent creatures (same HP, AC and Name) will roll the same initiative by default.").addToggle((t) => {
      t.setValue(this.plugin.data.condense).onChange(async (v) => {
        this.plugin.data.condense = v;
        const view = this.plugin.view;
        if (view) {
          view.setCondensed(this.plugin.data.condense);
        }
        await this.plugin.saveSettings();
      });
    });
    new import_obsidian3.Setting(containerEl).setName("Clamp Minimum HP").setDesc("When a creature takes damage that would reduce its HP below 0, its HP is set to 0 instead.").addToggle((t) => {
      t.setValue(this.plugin.data.clamp).onChange(async (v) => {
        this.plugin.data.clamp = v;
        await this.plugin.saveSettings();
      });
    });
    new import_obsidian3.Setting(containerEl).setName("Automatic Unconscious Status Application").setDesc('When a creature takes damage that would reduce its HP below 0, it gains the "Unconscious" status effect.').addToggle((t) => {
      t.setValue(this.plugin.data.autoStatus).onChange(async (v) => {
        this.plugin.data.autoStatus = v;
        await this.plugin.saveSettings();
      });
    });
  }
  _displayPlayers(additionalContainer) {
    additionalContainer.empty();
    additionalContainer.ontoggle = () => {
      this.plugin.data.openState.player = additionalContainer.open;
    };
    const summary = additionalContainer.createEl("summary");
    new import_obsidian3.Setting(summary).setHeading().setName("Players");
    summary.createDiv("collapser").createDiv("handle");
    new import_obsidian3.Setting(additionalContainer).setName("Add New Player").setDesc("Players added here will be available to add to a party. If you do not have a party created, all players will be added to a new encounter.").addButton((button) => {
      let b = button.setTooltip("Add Player").setButtonText("+").onClick(async () => {
        const modal = new NewPlayerModal(this.plugin);
        modal.open();
        modal.onClose = async () => {
          if (!modal.saved)
            return;
          await this.plugin.savePlayer({
            ...modal.player,
            player: true
          });
          this._displayPlayers(additionalContainer);
        };
      });
      return b;
    });
    const additional = additionalContainer.createDiv("additional");
    const playerView = additional.createDiv("initiative-tracker-players");
    if (!this.plugin.data.players.length) {
      additional.createDiv({
        attr: {
          style: "display: flex; justify-content: center; padding-bottom: 18px;"
        }
      }).createSpan({
        text: "No saved players! Create one to see it here."
      });
    } else {
      const headers = playerView.createDiv("initiative-tracker-player headers");
      headers.createDiv({ text: "Name" });
      new import_obsidian3.ExtraButtonComponent(headers.createDiv()).setIcon(HP).setTooltip("Max HP");
      new import_obsidian3.ExtraButtonComponent(headers.createDiv()).setIcon(AC).setTooltip("Armor Class");
      new import_obsidian3.ExtraButtonComponent(headers.createDiv()).setIcon(INITIATIVE).setTooltip("Initiative Modifier");
      headers.createDiv();
      for (let player of this.plugin.data.players) {
        const playerDiv = playerView.createDiv("initiative-tracker-player");
        playerDiv.createDiv({ text: player.name });
        playerDiv.createDiv({
          text: `${player.hp ?? DEFAULT_UNDEFINED}`
        });
        playerDiv.createDiv({
          text: `${player.ac ?? DEFAULT_UNDEFINED}`
        });
        playerDiv.createDiv({
          text: `${player.modifier ?? DEFAULT_UNDEFINED}`
        });
        const icons = playerDiv.createDiv("initiative-tracker-player-icon");
        new import_obsidian3.ExtraButtonComponent(icons.createDiv()).setIcon("pencil").setTooltip("Edit").onClick(() => {
          const modal = new NewPlayerModal(this.plugin, player);
          modal.open();
          modal.onClose = async () => {
            if (!modal.saved)
              return;
            await this.plugin.updatePlayer(player, modal.player);
            this.plugin.app.workspace.trigger("initiative-tracker:creature-updated-in-settings", player);
            this._displayPlayers(additionalContainer);
          };
        });
        new import_obsidian3.ExtraButtonComponent(icons.createDiv()).setIcon("trash").setTooltip("Delete").onClick(async () => {
          this.plugin.data.players = this.plugin.data.players.filter((p) => p != player);
          await this.plugin.saveSettings();
          this._displayPlayers(additionalContainer);
        });
      }
    }
  }
  _displayParties(additionalContainer) {
    additionalContainer.empty();
    additionalContainer.ontoggle = () => {
      this.plugin.data.openState.party = additionalContainer.open;
    };
    const summary = additionalContainer.createEl("summary");
    new import_obsidian3.Setting(summary).setHeading().setName("Parties");
    summary.createDiv("collapser").createDiv("handle");
    const explanation = additionalContainer.createDiv("initiative-tracker-explanation");
    explanation.createEl("span", {
      text: "Parties allow you to create different groups of your players. Each player can be a member of multiple parties."
    });
    explanation.createEl("br");
    explanation.createEl("br");
    explanation.createEl("span", {
      text: "You can set a default party for encounters to use, or specify the party for the encounter in the encounter block. While running an encounter in the tracker, you can change the active party, allowing you to quickly switch which players are in combat."
    });
    new import_obsidian3.Setting(additionalContainer).setName("Default Party").setDesc("The tracker will load this party to encounters by default.").addDropdown((d) => {
      d.addOption("none", "None");
      for (const party of this.plugin.data.parties) {
        d.addOption(party.name, party.name);
      }
      d.setValue(this.plugin.data.defaultParty ?? "none");
      d.onChange(async (v) => {
        this.plugin.data.defaultParty = v == "none" ? null : v;
        this.plugin.saveSettings();
      });
    });
    new import_obsidian3.Setting(additionalContainer).setName("Add New Party").addButton((button) => {
      let b = button.setTooltip("Add Party").setButtonText("+").onClick(async () => {
        const modal = new PartyModal(this.plugin);
        modal.open();
        modal.onClose = async () => {
          if (modal.canceled)
            return;
          if (!modal.party.name || !modal.party.name.length)
            return;
          if (this.plugin.data.parties.filter((party) => party.name == modal.party.name)) {
            const map = new Map([...this.plugin.data.parties].map((c) => [
              c.name,
              c
            ]));
            map.set(modal.party.name, modal.party);
            this.plugin.data.parties = Array.from(map.values());
          } else {
            this.plugin.data.parties.push(modal.party);
          }
          await this.plugin.saveSettings();
          this._displayParties(additionalContainer);
        };
      });
      return b;
    });
    const additional = additionalContainer.createDiv("additional");
    if (!this.plugin.data.parties.length) {
      additional.createDiv({
        attr: {
          style: "display: flex; justify-content: center; padding-bottom: 18px;"
        }
      }).createSpan({
        text: "No saved parties! Create one to see it here."
      });
    } else {
      for (const party of this.plugin.data.parties) {
        new import_obsidian3.Setting(additional).setName(party.name).setDesc(party.players.join(", ")).addExtraButton((b) => {
          b.setIcon("pencil").onClick(() => {
            const modal = new PartyModal(this.plugin, party);
            modal.open();
            modal.onClose = async () => {
              if (modal.canceled)
                return;
              if (!modal.party.name || !modal.party.name.length)
                return;
              this.plugin.data.parties.splice(this.plugin.data.parties.indexOf(party), 1, modal.party);
              if (this.plugin.data.parties.filter((s) => s.name == modal.party.name).length > 1) {
                if (this.plugin.data.parties.filter((status) => status.name == modal.party.name)) {
                  const map = new Map(this.plugin.data.parties.map((c) => [c.name, c]));
                  map.set(modal.party.name, modal.party);
                  this.plugin.data.parties = Array.from(map.values());
                }
              }
              await this.plugin.saveSettings();
              this._displayParties(additionalContainer);
            };
          });
        }).addExtraButton((b) => {
          b.setIcon("trash").onClick(async () => {
            this.plugin.data.parties = this.plugin.data.parties.filter((p) => p.name != party.name);
            if (this.plugin.data.defaultParty == party.name) {
              this.plugin.data.defaultParty = this.plugin.data.parties[0]?.name ?? null;
            }
            await this.plugin.saveSettings();
            this._displayParties(additionalContainer);
          });
        });
      }
    }
  }
  _displayStatuses(additionalContainer) {
    additionalContainer.empty();
    additionalContainer.ontoggle = () => {
      this.plugin.data.openState.status = additionalContainer.open;
    };
    const summary = additionalContainer.createEl("summary");
    new import_obsidian3.Setting(summary).setHeading().setName("Statuses");
    summary.createDiv("collapser").createDiv("handle");
    const add = new import_obsidian3.Setting(additionalContainer).setName("Add New Status").setDesc("These statuses will be available to apply to creatures.").addButton((button) => {
      let b = button.setTooltip("Add Status").setButtonText("+").onClick(async () => {
        const modal = new StatusModal(this.plugin);
        modal.onClose = async () => {
          if (modal.canceled)
            return;
          if (!modal.status.name)
            return;
          if (this.plugin.data.statuses.filter((status) => status.name == modal.status.name)) {
            const map = new Map([...this.plugin.data.statuses].map((c) => [
              c.name,
              c
            ]));
            map.set(modal.status.name, modal.status);
            this.plugin.data.statuses = Array.from(map.values());
          } else {
            this.plugin.data.statuses.push(modal.status);
          }
          await this.plugin.saveSettings();
          this._displayStatuses(additionalContainer);
        };
        modal.open();
      });
      return b;
    });
    if (!Conditions.every((c) => this.plugin.data.statuses.includes(c))) {
      add.addExtraButton((b) => b.setIcon("reset").setTooltip("Re-add Default Statuses").onClick(async () => {
        this.plugin.data.statuses = Array.from(new Map([
          ...this.plugin.data.statuses,
          ...Conditions
        ].map((c) => [c.name, c])).values());
        await this.plugin.saveSettings();
        this._displayStatuses(additionalContainer);
      }));
    }
    const additional = additionalContainer.createDiv("additional");
    for (const status of this.plugin.data.statuses) {
      new import_obsidian3.Setting(additional).setName(status.name).setDesc(status.description).addExtraButton((b) => b.setIcon("pencil").onClick(() => {
        const modal = new StatusModal(this.plugin, status);
        modal.onClose = async () => {
          if (modal.canceled)
            return;
          if (!modal.status.name)
            return;
          this.plugin.data.statuses.splice(this.plugin.data.statuses.indexOf(status), 1, modal.status);
          if (this.plugin.data.statuses.filter((s) => s.name == modal.status.name).length > 1) {
            if (this.plugin.data.statuses.filter((status2) => status2.name == modal.status.name)) {
              const map = new Map(this.plugin.data.statuses.map((c) => [
                c.name,
                c
              ]));
              map.set(modal.status.name, modal.status);
              this.plugin.data.statuses = Array.from(map.values());
            }
          }
          await this.plugin.saveSettings();
          this._displayStatuses(additionalContainer);
        };
        modal.open();
      })).addExtraButton((b) => b.setIcon("trash").onClick(async () => {
        this.plugin.data.statuses = this.plugin.data.statuses.filter((s) => s.name != status.name);
        await this.plugin.saveSettings();
        this._displayStatuses(additionalContainer);
      })).setClass("initiative-status-item");
    }
  }
  async _displayIntegrations(containerEl) {
    containerEl.empty();
    containerEl.ontoggle = () => {
      this.plugin.data.openState.plugin = containerEl.open;
    };
    const summary = containerEl.createEl("summary");
    new import_obsidian3.Setting(summary).setHeading().setName("Plugin Integrations");
    summary.createDiv("collapser").createDiv("handle");
    if (!this.plugin.canUseStatBlocks) {
      this.plugin.data.sync = false;
      await this.plugin.saveSettings();
    }
    new import_obsidian3.Setting(containerEl).setName("Sync Monsters from TTRPG Statblocks").setDesc(createFragment((e) => {
      e.createSpan({
        text: "Homebrew creatures saved to the TTRPG Statblocks plugin will be available in the quick-add."
      });
      if (!this.plugin.canUseStatBlocks) {
        e.createEl("br");
        e.createEl("br");
        e.createSpan({
          text: "Install and enable the "
        });
        e.createEl("a", {
          text: "TTRPG Statblocks",
          href: "obsidian://show-plugin?id=obsidian-5e-statblocks"
        });
        e.createSpan({
          text: " plugin to use homebrew creatures."
        });
      }
    })).addToggle((t) => {
      t.setDisabled(!this.plugin.canUseStatBlocks).setValue(this.plugin.data.sync);
      t.onChange(async (v) => {
        this.plugin.data.sync = v;
        await this.plugin.saveSettings();
        this._displayIntegrations(containerEl);
      });
    });
    if (this.plugin.data.sync) {
      const synced = new import_obsidian3.Setting(containerEl).setDesc(`${this.plugin.statblock_creatures.length} creatures synced.`);
      synced.settingEl.addClass("initiative-synced");
      (0, import_obsidian3.setIcon)(synced.nameEl, "check-in-circle");
      synced.nameEl.appendChild(createSpan({ text: "Synced" }));
    }
    new import_obsidian3.Setting(containerEl).setName("Initiative Formula").setDesc(createFragment((e) => {
      e.createSpan({
        text: "Initiative formula to use when calculating initiative. Use "
      });
      e.createEl("code", { text: "%mod%" });
      e.createSpan({
        text: " for the modifier placeholder."
      });
      if (!this.plugin.canUseDiceRoller) {
        e.createEl("br");
        e.createEl("br");
        e.createSpan({
          attr: {
            style: `color: var(--text-error);`
          },
          text: "Requires the "
        });
        e.createEl("a", {
          text: "Dice Roller",
          href: "https://github.com/valentine195/obsidian-dice-roller",
          cls: "external-link"
        });
        e.createSpan({
          attr: {
            style: `color: var(--text-error);`
          },
          text: " plugin to modify."
        });
      }
    })).addText((t) => {
      if (!this.plugin.canUseDiceRoller) {
        t.setDisabled(true);
        this.plugin.data.initiative = "1d20 + %mod%";
      }
      t.setValue(this.plugin.data.initiative);
      t.onChange((v) => {
        this.plugin.data.initiative = v;
      });
      t.inputEl.onblur = async () => {
        const view = this.plugin.view;
        if (view)
          view.rollInitiatives();
        await this.plugin.saveSettings();
      };
    });
    new import_obsidian3.Setting(containerEl).setName("Integrate with Obsidian Leaflet").setDesc(createFragment((e) => {
      e.createSpan({
        text: "Integrate with the Obsidian Leaflet plugin and display combats on a map."
      });
      if (!this.plugin.canUseLeaflet) {
        e.createEl("br");
        e.createEl("br");
        e.createSpan({
          attr: {
            style: `color: var(--text-error);`
          },
          text: "Requires  "
        });
        e.createEl("a", {
          text: "Obsidian Leaflet",
          href: "https://github.com/valentine195/obsidian-leaflet-plugin",
          cls: "external-link"
        });
        e.createSpan({
          attr: {
            style: `color: var(--text-error);`
          },
          text: " version 4.0.0 to modify."
        });
      }
    })).addToggle((t) => {
      if (!this.plugin.canUseLeaflet) {
        t.setDisabled(true);
        this.plugin.data.leafletIntegration = false;
      }
      t.setValue(this.plugin.data.leafletIntegration);
      t.onChange(async (v) => {
        this.plugin.data.leafletIntegration = v;
        this.plugin.view.setMapState(v);
        await this.plugin.saveSettings();
        this._displayIntegrations(containerEl);
      });
    });
    if (this.plugin.canUseLeaflet && this.plugin.data.leafletIntegration) {
      new import_obsidian3.Setting(containerEl).setName("Default Player Marker Type").setDesc(createFragment((e) => {
        if (this.plugin.data.playerMarker) {
          const div = e.createDiv("marker-type-display");
          const inner = div.createDiv("marker-icon-display");
          const marker = this.plugin.leaflet.markerIcons.find((icon) => icon.type == this.plugin.data.playerMarker);
          if (marker) {
            inner.innerHTML = marker.html;
          }
        }
      })).addDropdown((drop) => {
        for (let marker of this.plugin.leaflet.markerIcons) {
          drop.addOption(marker.type, marker.type);
        }
        drop.setValue(this.plugin.data.playerMarker ?? "default");
        drop.onChange(async (v) => {
          this.plugin.data.playerMarker = v;
          await this.plugin.saveSettings();
          this._displayIntegrations(containerEl);
        });
      });
      new import_obsidian3.Setting(containerEl).setName("Default Monster Marker Type").setDesc(createFragment((e) => {
        if (this.plugin.data.monsterMarker) {
          const div = e.createDiv("marker-type-display");
          const inner = div.createDiv("marker-icon-display");
          const marker = this.plugin.leaflet.markerIcons.find((icon) => icon.type == this.plugin.data.monsterMarker);
          if (marker) {
            inner.innerHTML = marker.html;
          }
        }
      })).addDropdown((drop) => {
        for (let marker of this.plugin.leaflet.markerIcons) {
          drop.addOption(marker.type, marker.type);
        }
        drop.setValue(this.plugin.data.monsterMarker);
        drop.onChange(async (v) => {
          this.plugin.data.monsterMarker = v;
          await this.plugin.saveSettings();
          this._displayIntegrations(containerEl);
        });
      });
    }
  }
  _displayHomebrew(additionalContainer) {
    additionalContainer.empty();
    if (this.plugin.data.homebrew.length) {
      const additional = additionalContainer.createDiv("additional");
      new import_obsidian3.Setting(additional).setHeading().setName("Homebrew Creatures");
      const warning = additional.createDiv({
        attr: {
          style: "display: flex; justify-content: center; padding: 18px;"
        }
      }).createEl("strong");
      warning.createSpan({
        text: "Homebrew creatures have moved to the "
      });
      warning.createEl("a", {
        text: "5e Statblocks",
        href: "obsidian://show-plugin?id=obsidian-5e-statblocks"
      });
      warning.createSpan({
        text: " plugin."
      });
      if (this.plugin.canUseStatBlocks) {
        new import_obsidian3.Setting(additional).setName("Migrate Hombrew").setDesc("Move all created homebrew creatures to the 5e Statblocks plugin.").addButton((b) => {
          b.setIcon("install").setTooltip("Migrate").onClick(async () => {
            const statblocks = this.app.plugins.getPlugin("obsidian-5e-statblocks");
            const existing = statblocks.settings.monsters.length;
            await statblocks.saveMonsters(this.plugin.data.homebrew);
            new import_obsidian3.Notice(`${statblocks.settings.monsters.length - existing} of ${this.plugin.data.homebrew.length} Homebrew Monsters saved.`);
          });
        }).addExtraButton((b) => {
          b.setIcon("cross-in-box").setTooltip("Delete Homebrew").onClick(async () => {
            if (await confirmWithModal(this.app, "Are you sure you want to delete all homebrew creatures?")) {
              this.plugin.data.homebrew = [];
              await this.plugin.saveSettings();
              this._displayHomebrew(additionalContainer);
            }
          });
        });
      } else {
        additional.createDiv({
          attr: {
            style: "display: flex; justify-content: center; padding: 18px;"
          }
        }).createEl("strong");
        warning.createSpan({
          text: "Install the "
        });
        warning.createEl("a", {
          text: "5e Statblocks",
          href: "obsidian://show-plugin?id=obsidian-5e-statblocks"
        });
        warning.createSpan({
          text: " plugin to migrate."
        });
      }
    }
  }
};
var NewPlayerModal = class extends import_obsidian4.Modal {
  constructor(plugin, original) {
    super(plugin.app);
    this.plugin = plugin;
    this.original = original;
    this.player = { ...original ?? {} };
  }
  async display(load) {
    let { contentEl } = this;
    contentEl.addClass("initiative-tracker-add-player-modal");
    contentEl.empty();
    let error = false;
    contentEl.createEl("h2", {
      text: this.original ? "Edit Player" : "New Player"
    });
    new import_obsidian3.Setting(contentEl).setName("Link to Note").setDesc("Link player to a note in your vault.").addText((t) => {
      t.setValue(this.player.note ?? "");
      const modal = new FileSuggestionModal(this.app, t);
      modal.onClose = async () => {
        if (!modal.file)
          return;
        const metaData = this.app.metadataCache.getFileCache(modal.file);
        this.player.note = modal.file.basename;
        this.player.path = modal.file.path;
        this.player.name = modal.file.basename;
        if (!metaData || !metaData.frontmatter)
          return;
        const { ac, hp, modifier, level } = metaData.frontmatter;
        this.player = {
          ...this.player,
          ...{ ac, hp, modifier, level }
        };
        this.display();
      };
    });
    let nameInput, levelInput, hpInput, acInput, modInput;
    new import_obsidian3.Setting(contentEl).setName("Name").setDesc("Player name. Must be unique!").addText((t) => {
      nameInput = {
        input: t.inputEl,
        validate: (i) => {
          let error2 = false;
          if (!i.value.length && !load || this.plugin.data.players.find((p) => p.name === i.value) && this.player.name != this.original.name) {
            i.addClass("has-error");
            error2 = true;
          }
          return error2;
        }
      };
      t.setValue(this.player.name ?? "");
      t.onChange((v) => {
        t.inputEl.removeClass("has-error");
        this.player.name = v;
      });
    });
    new import_obsidian3.Setting(contentEl).setName("Level").setDesc("Player level.").addText((t) => {
      levelInput = {
        input: t.inputEl,
        validate: (i) => {
          let error2 = false;
          if (isNaN(Number(i.value)) || Number(i.value) <= 0) {
            i.addClass("has-error");
            error2 = true;
          }
          return error2;
        }
      };
      t.setValue(`${this.player.level ?? ""}`);
      t.onChange((v) => {
        t.inputEl.removeClass("has-error");
        this.player.level = Number(v);
      });
    });
    new import_obsidian3.Setting(contentEl).setName("Max Hit Points").addText((t) => {
      hpInput = {
        input: t.inputEl,
        validate: (i) => {
          let error2 = false;
          if (isNaN(Number(i.value))) {
            i.addClass("has-error");
            error2 = true;
          }
          return error2;
        }
      };
      t.setValue(`${this.player.hp ?? ""}`);
      t.onChange((v) => {
        t.inputEl.removeClass("has-error");
        this.player.hp = Number(v);
      });
    });
    new import_obsidian3.Setting(contentEl).setName("Armor Class").addText((t) => {
      acInput = {
        input: t.inputEl,
        validate: (i) => {
          let error2 = false;
          if (isNaN(Number(i.value))) {
            t.inputEl.addClass("has-error");
            error2 = true;
          }
          return error2;
        }
      };
      t.setValue(`${this.player.ac ?? ""}`);
      t.onChange((v) => {
        t.inputEl.removeClass("has-error");
        this.player.ac = Number(v);
      });
    });
    new import_obsidian3.Setting(contentEl).setName("Initiative Modifier").setDesc("This will be added to randomly-rolled initiatives.").addText((t) => {
      modInput = {
        input: t.inputEl,
        validate: (i) => {
          let error2 = false;
          if (isNaN(Number(i.value))) {
            t.inputEl.addClass("has-error");
            error2 = true;
          }
          return error2;
        }
      };
      t.setValue(`${this.player.modifier ?? ""}`);
      t.onChange((v) => {
        this.player.modifier = Number(v);
      });
    });
    if (this.plugin.canUseLeaflet) {
      const markerSetting = new import_obsidian3.Setting(contentEl).setName("Leaflet Marker").addDropdown((drop) => {
        for (let marker of this.plugin.leaflet.markerIcons) {
          drop.addOption(marker.type, marker.type);
        }
        drop.setValue(this.player.marker ?? this.plugin.data.playerMarker ?? "default");
        drop.onChange(async (v) => {
          this.player.marker = v;
          this.display();
        });
      });
      if (this.player.marker) {
        const div = createDiv("marker-type-display");
        const inner = div.createDiv("marker-icon-display");
        const marker = this.plugin.leaflet.markerIcons.find((icon) => icon.type == this.player.marker);
        if (marker) {
          inner.innerHTML = marker.html;
          markerSetting.descEl.appendChild(div);
        }
      }
    }
    let footerEl = contentEl.createDiv();
    let footerButtons = new import_obsidian3.Setting(footerEl);
    footerButtons.addButton((b) => {
      b.setTooltip("Save").setIcon("checkmark").onClick(async () => {
        let error2 = this.validateInputs(nameInput, acInput, hpInput, modInput);
        if (error2) {
          new import_obsidian3.Notice("Fix errors before saving.");
          return;
        }
        this.saved = true;
        this.close();
      });
      return b;
    });
    footerButtons.addExtraButton((b) => {
      b.setIcon("cross").setTooltip("Cancel").onClick(() => {
        this.saved = false;
        this.close();
      });
      return b;
    });
    this.validateInputs(nameInput, acInput, hpInput, modInput);
  }
  validateInputs(...inputs) {
    let error = false;
    for (let input of inputs) {
      if (input.validate(input.input)) {
        error = true;
      } else {
        input.input.removeClass("has-error");
      }
    }
    return error;
  }
  onOpen() {
    this.display(true);
  }
};
async function confirmWithModal(app, text2, buttons = {
  cta: "Yes",
  secondary: "No"
}) {
  return new Promise((resolve, reject) => {
    const modal = new ConfirmModal(app, text2, buttons);
    modal.onClose = () => {
      resolve(modal.confirmed);
    };
    modal.open();
  });
}
var ConfirmModal = class extends import_obsidian4.Modal {
  constructor(app, text2, buttons) {
    super(app);
    this.text = text2;
    this.buttons = buttons;
    this.confirmed = false;
  }
  async display() {
    new Promise((resolve) => {
      this.contentEl.empty();
      this.contentEl.addClass("confirm-modal");
      this.contentEl.createEl("p", {
        text: this.text
      });
      const buttonEl = this.contentEl.createDiv("fantasy-calendar-confirm-buttons");
      new import_obsidian4.ButtonComponent(buttonEl).setButtonText(this.buttons.cta).setCta().onClick(() => {
        this.confirmed = true;
        this.close();
      });
      new import_obsidian4.ButtonComponent(buttonEl).setButtonText(this.buttons.secondary).onClick(() => {
        this.close();
      });
    });
  }
  onOpen() {
    this.display();
  }
};
(0, import_obsidian3.addIcon)("initiative-tracker-warning", `<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="exclamation-triangle" class="svg-inline--fa fa-exclamation-triangle fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"></path></svg>`);
var StatusModal = class extends import_obsidian4.Modal {
  constructor(plugin, status) {
    super(plugin.app);
    this.plugin = plugin;
    this.status = { name: null, description: null };
    this.canceled = false;
    this.editing = false;
    this.warned = false;
    if (status) {
      this.editing = true;
      this.original = status.name;
      this.status = {
        name: status.name,
        description: status.description
      };
    }
  }
  onOpen() {
    this.titleEl.setText(this.editing ? "Edit Status" : "New Status");
    const name = new import_obsidian3.Setting(this.contentEl).setName("Name").addText((t) => {
      t.setValue(this.status.name).onChange((v) => {
        this.status.name = v;
        if (this.plugin.data.statuses.find((s) => s.name == this.status.name) && !this.warned && this.original != this.status.name) {
          this.warned = true;
          name.setDesc(createFragment((e) => {
            const container = e.createDiv("initiative-tracker-warning");
            (0, import_obsidian3.setIcon)(container, "initiative-tracker-warning");
            container.createSpan({
              text: "A status by this name already exists and will be overwritten."
            });
          }));
        } else if (this.warned) {
          this.warned = false;
          name.setDesc("");
        }
      });
    });
    new import_obsidian3.Setting(this.contentEl).setName("Description").addTextArea((t) => {
      t.setValue(this.status.description).onChange((v) => this.status.description = v);
    });
    new import_obsidian4.ButtonComponent(this.contentEl.createDiv("initiative-tracker-cancel")).setButtonText("Cancel").onClick(() => {
      this.canceled = true;
      this.close();
    });
  }
};
var PartyModal = class extends import_obsidian4.Modal {
  constructor(plugin, party) {
    super(plugin.app);
    this.plugin = plugin;
    this.party = { name: null, players: [] };
    this.canceled = false;
    this.editing = false;
    this.warned = false;
    if (party) {
      this.editing = true;
      this.original = party.name;
      this.party = {
        name: party.name,
        players: [...party.players ?? []]
      };
    }
  }
  onOpen() {
    this.titleEl.setText(this.editing ? `Edit ${this.party.name ?? "Party"}` : "New Party");
    const name = new import_obsidian3.Setting(this.contentEl).setName("Name").addText((t) => {
      t.setValue(this.party.name).onChange((v) => {
        this.party.name = v;
        if (this.plugin.data.parties.find((s) => s.name == this.party.name) && !this.warned && this.original != this.party.name) {
          this.warned = true;
          name.setDesc(createFragment((e) => {
            const container = e.createDiv("initiative-tracker-warning");
            (0, import_obsidian3.setIcon)(container, "initiative-tracker-warning");
            container.createSpan({
              text: "A party by this name already exists and will be overwritten."
            });
          }));
        } else if (this.warned) {
          this.warned = false;
          name.setDesc("");
        }
      });
    });
    const playersEl = this.contentEl.createDiv("initiative-tracker-additional-container");
    let playerText;
    new import_obsidian3.Setting(playersEl).setName("Add Player to Party").addText((t) => {
      playerText = t;
      new PlayerSuggestionModal(this.plugin, t, this.party);
    }).addExtraButton((b) => b.setIcon("plus-with-circle").onClick(() => {
      if (!playerText.getValue() || !playerText.getValue().length)
        return;
      if (this.party.players.includes(playerText.getValue())) {
        new import_obsidian3.Notice("That player is already in this party!");
        return;
      }
      if (!this.plugin.data.players.find((p) => p.name == playerText.getValue())) {
        new import_obsidian3.Notice("That player doesn't exist! You should make them first.");
        return;
      }
      this.party.players.push(playerText.getValue());
      this.displayPlayers(playersDisplayEl);
      playerText.setValue("");
    }));
    const playersDisplayEl = playersEl.createDiv("additional");
    this.displayPlayers(playersDisplayEl);
    new import_obsidian4.ButtonComponent(this.contentEl.createDiv("initiative-tracker-cancel")).setButtonText("Cancel").onClick(() => {
      this.canceled = true;
      this.close();
    });
  }
  displayPlayers(containerEl) {
    containerEl.empty();
    if (this.party.players.length) {
      for (const player of this.party.players) {
        new import_obsidian3.Setting(containerEl).setName(player).addExtraButton((b) => {
          b.setIcon("trash").onClick(() => {
            this.party.players.splice(this.party.players.indexOf(player), 1);
            this.displayPlayers(containerEl);
          });
        });
      }
    } else {
      containerEl.createDiv({
        attr: {
          style: "display: flex; justify-content: center; padding-bottom: 18px;"
        }
      }).createSpan({
        text: "Add a player to the party to see it here."
      });
    }
  }
};

// src/encounter/index.ts
var import_obsidian7 = __toModule(require("obsidian"));

// src/utils/creature.ts
function getId() {
  return "ID_xyxyxyxyxyxy".replace(/[xy]/g, function(c) {
    var r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
    return v.toString(16);
  });
}
var Creature = class {
  constructor(creature, initiative = 0) {
    this.creature = creature;
    this.enabled = true;
    this.status = /* @__PURE__ */ new Set();
    this.viewing = false;
    this.number = 0;
    this.name = creature.name;
    this.display = creature.display;
    this._initiative = "initiative" in creature ? creature.initiative : Number(initiative ?? 0);
    this.modifier = Number(creature.modifier ?? 0);
    this.max = creature.hp ? Number(creature.hp) : void 0;
    this.ac = creature.ac ? Number(creature.ac) : void 0;
    this.note = creature.note;
    this.level = creature.level;
    this.player = creature.player;
    this.marker = creature.marker;
    this.hp = this.max;
    this.source = creature.source;
    if ("xp" in creature) {
      this.xp = creature.xp;
    } else if ("cr" in creature) {
      this.xp = XP_PER_CR[`${creature.cr}`];
    }
    this.id = creature.id ?? getId();
  }
  get hpDisplay() {
    if (this.max) {
      return `${this.hp}/${this.max}`;
    }
    return DEFAULT_UNDEFINED;
  }
  get initiative() {
    return this._initiative + this.modifier;
  }
  set initiative(x) {
    this._initiative = Number(x) - this.modifier;
  }
  *[Symbol.iterator]() {
    yield this.name;
    yield this.initiative;
    yield this.modifier;
    yield this.max;
    yield this.ac;
    yield this.note;
    yield this.id;
    yield this.marker;
    yield this.xp;
  }
  static new(creature) {
    return new Creature({
      ...creature
    }, creature._initiative);
  }
  static from(creature) {
    const modifier = "modifier" in creature ? creature.modifier : Math.floor((("stats" in creature && creature.stats.length > 1 ? creature.stats[1] : 10) - 10) / 2);
    return new Creature({
      ...creature,
      modifier
    });
  }
  update(creature) {
    this.name = creature.name;
    this.modifier = Number(creature.modifier ?? 0);
    this.max = creature.hp ? Number(creature.hp) : void 0;
    if (this.hp > this.max)
      this.hp = this.max;
    this.ac = creature.ac ? Number(creature.ac) : void 0;
    this.note = creature.note;
    this.level = creature.level;
    this.player = creature.player;
    this.marker = creature.marker;
    this.source = creature.source;
  }
  toProperties() {
    return { ...this };
  }
  toJSON() {
    return {
      name: this.name,
      initiative: this.initiative - this.modifier,
      modifier: this.modifier,
      hp: this.max,
      ac: this.ac,
      note: this.note,
      id: this.id,
      marker: this.marker,
      currentHP: this.hp,
      status: Array.from(this.status).map((c) => c.name),
      enabled: this.enabled,
      level: this.level,
      player: this.player,
      xp: this.xp,
      active: this.active
    };
  }
  static fromJSON(state) {
    const creature = new Creature(state, state.initiative);
    creature.enabled = state.enabled;
    creature.hp = state.currentHP;
    let statuses = [];
    for (const status of state.status) {
      const existing = Conditions.find(({ name }) => status == name);
      if (existing) {
        statuses.push(existing);
      } else {
        statuses.push({
          name: status,
          description: null
        });
      }
    }
    creature.status = new Set(statuses);
    creature.active = state.active;
    return creature;
  }
};

// node_modules/svelte/internal/index.mjs
function noop() {
}
var identity = (x) => x;
function assign(tar, src) {
  for (const k in src)
    tar[k] = src[k];
  return tar;
}
function run(fn2) {
  return fn2();
}
function blank_object() {
  return Object.create(null);
}
function run_all(fns) {
  fns.forEach(run);
}
function is_function(thing) {
  return typeof thing === "function";
}
function safe_not_equal(a, b) {
  return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function");
}
function is_empty(obj) {
  return Object.keys(obj).length === 0;
}
function subscribe(store, ...callbacks) {
  if (store == null) {
    return noop;
  }
  const unsub = store.subscribe(...callbacks);
  return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
function component_subscribe(component, store, callback) {
  component.$$.on_destroy.push(subscribe(store, callback));
}
function null_to_empty(value) {
  return value == null ? "" : value;
}
function action_destroyer(action_result) {
  return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;
}
var is_client = typeof window !== "undefined";
var now = is_client ? () => window.performance.now() : () => Date.now();
var raf = is_client ? (cb) => requestAnimationFrame(cb) : noop;
var tasks = /* @__PURE__ */ new Set();
function run_tasks(now2) {
  tasks.forEach((task) => {
    if (!task.c(now2)) {
      tasks.delete(task);
      task.f();
    }
  });
  if (tasks.size !== 0)
    raf(run_tasks);
}
function loop(callback) {
  let task;
  if (tasks.size === 0)
    raf(run_tasks);
  return {
    promise: new Promise((fulfill) => {
      tasks.add(task = { c: callback, f: fulfill });
    }),
    abort() {
      tasks.delete(task);
    }
  };
}
var is_hydrating = false;
function start_hydrating() {
  is_hydrating = true;
}
function end_hydrating() {
  is_hydrating = false;
}
function append(target, node) {
  target.appendChild(node);
}
function append_styles(target, style_sheet_id, styles) {
  const append_styles_to = get_root_for_style(target);
  if (!append_styles_to.getElementById(style_sheet_id)) {
    const style = element("style");
    style.id = style_sheet_id;
    style.textContent = styles;
    append_stylesheet(append_styles_to, style);
  }
}
function get_root_for_style(node) {
  if (!node)
    return document;
  const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
  if (root && root.host) {
    return root;
  }
  return node.ownerDocument;
}
function append_empty_stylesheet(node) {
  const style_element = element("style");
  append_stylesheet(get_root_for_style(node), style_element);
  return style_element;
}
function append_stylesheet(node, style) {
  append(node.head || node, style);
}
function insert(target, node, anchor) {
  target.insertBefore(node, anchor || null);
}
function detach(node) {
  node.parentNode.removeChild(node);
}
function destroy_each(iterations, detaching) {
  for (let i = 0; i < iterations.length; i += 1) {
    if (iterations[i])
      iterations[i].d(detaching);
  }
}
function element(name) {
  return document.createElement(name);
}
function text(data) {
  return document.createTextNode(data);
}
function space() {
  return text(" ");
}
function empty() {
  return text("");
}
function listen(node, event, handler, options) {
  node.addEventListener(event, handler, options);
  return () => node.removeEventListener(event, handler, options);
}
function stop_propagation(fn2) {
  return function(event) {
    event.stopPropagation();
    return fn2.call(this, event);
  };
}
function attr(node, attribute, value) {
  if (value == null)
    node.removeAttribute(attribute);
  else if (node.getAttribute(attribute) !== value)
    node.setAttribute(attribute, value);
}
function to_number(value) {
  return value === "" ? null : +value;
}
function children(element2) {
  return Array.from(element2.childNodes);
}
function set_data(text2, data) {
  data = "" + data;
  if (text2.wholeText !== data)
    text2.data = data;
}
function set_input_value(input, value) {
  input.value = value == null ? "" : value;
}
function set_style(node, key, value, important) {
  node.style.setProperty(key, value, important ? "important" : "");
}
function toggle_class(element2, name, toggle) {
  element2.classList[toggle ? "add" : "remove"](name);
}
function custom_event(type, detail, bubbles = false) {
  const e = document.createEvent("CustomEvent");
  e.initCustomEvent(type, bubbles, false, detail);
  return e;
}
var active_docs = /* @__PURE__ */ new Set();
var active = 0;
function hash3(str) {
  let hash4 = 5381;
  let i = str.length;
  while (i--)
    hash4 = (hash4 << 5) - hash4 ^ str.charCodeAt(i);
  return hash4 >>> 0;
}
function create_rule(node, a, b, duration, delay, ease, fn2, uid = 0) {
  const step = 16.666 / duration;
  let keyframes = "{\n";
  for (let p = 0; p <= 1; p += step) {
    const t = a + (b - a) * ease(p);
    keyframes += p * 100 + `%{${fn2(t, 1 - t)}}
`;
  }
  const rule = keyframes + `100% {${fn2(b, 1 - b)}}
}`;
  const name = `__svelte_${hash3(rule)}_${uid}`;
  const doc = get_root_for_style(node);
  active_docs.add(doc);
  const stylesheet = doc.__svelte_stylesheet || (doc.__svelte_stylesheet = append_empty_stylesheet(node).sheet);
  const current_rules = doc.__svelte_rules || (doc.__svelte_rules = {});
  if (!current_rules[name]) {
    current_rules[name] = true;
    stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length);
  }
  const animation = node.style.animation || "";
  node.style.animation = `${animation ? `${animation}, ` : ""}${name} ${duration}ms linear ${delay}ms 1 both`;
  active += 1;
  return name;
}
function delete_rule(node, name) {
  const previous = (node.style.animation || "").split(", ");
  const next2 = previous.filter(name ? (anim) => anim.indexOf(name) < 0 : (anim) => anim.indexOf("__svelte") === -1);
  const deleted = previous.length - next2.length;
  if (deleted) {
    node.style.animation = next2.join(", ");
    active -= deleted;
    if (!active)
      clear_rules();
  }
}
function clear_rules() {
  raf(() => {
    if (active)
      return;
    active_docs.forEach((doc) => {
      const stylesheet = doc.__svelte_stylesheet;
      let i = stylesheet.cssRules.length;
      while (i--)
        stylesheet.deleteRule(i);
      doc.__svelte_rules = {};
    });
    active_docs.clear();
  });
}
function create_animation(node, from, fn2, params) {
  if (!from)
    return noop;
  const to = node.getBoundingClientRect();
  if (from.left === to.left && from.right === to.right && from.top === to.top && from.bottom === to.bottom)
    return noop;
  const {
    delay = 0,
    duration = 300,
    easing = identity,
    start: start_time = now() + delay,
    end: end2 = start_time + duration,
    tick: tick2 = noop,
    css
  } = fn2(node, { from, to }, params);
  let running = true;
  let started = false;
  let name;
  function start2() {
    if (css) {
      name = create_rule(node, 0, 1, duration, delay, easing, css);
    }
    if (!delay) {
      started = true;
    }
  }
  function stop() {
    if (css)
      delete_rule(node, name);
    running = false;
  }
  loop((now2) => {
    if (!started && now2 >= start_time) {
      started = true;
    }
    if (started && now2 >= end2) {
      tick2(1, 0);
      stop();
    }
    if (!running) {
      return false;
    }
    if (started) {
      const p = now2 - start_time;
      const t = 0 + 1 * easing(p / duration);
      tick2(t, 1 - t);
    }
    return true;
  });
  start2();
  tick2(0, 1);
  return stop;
}
function fix_position(node) {
  const style = getComputedStyle(node);
  if (style.position !== "absolute" && style.position !== "fixed") {
    const { width, height } = style;
    const a = node.getBoundingClientRect();
    node.style.position = "absolute";
    node.style.width = width;
    node.style.height = height;
    add_transform(node, a);
  }
}
function add_transform(node, a) {
  const b = node.getBoundingClientRect();
  if (a.left !== b.left || a.top !== b.top) {
    const style = getComputedStyle(node);
    const transform = style.transform === "none" ? "" : style.transform;
    node.style.transform = `${transform} translate(${a.left - b.left}px, ${a.top - b.top}px)`;
  }
}
var current_component;
function set_current_component(component) {
  current_component = component;
}
function get_current_component() {
  if (!current_component)
    throw new Error("Function called outside component initialization");
  return current_component;
}
function createEventDispatcher() {
  const component = get_current_component();
  return (type, detail) => {
    const callbacks = component.$$.callbacks[type];
    if (callbacks) {
      const event = custom_event(type, detail);
      callbacks.slice().forEach((fn2) => {
        fn2.call(component, event);
      });
    }
  };
}
function setContext(key, context) {
  get_current_component().$$.context.set(key, context);
}
function getContext(key) {
  return get_current_component().$$.context.get(key);
}
function bubble(component, event) {
  const callbacks = component.$$.callbacks[event.type];
  if (callbacks) {
    callbacks.slice().forEach((fn2) => fn2.call(this, event));
  }
}
var dirty_components = [];
var binding_callbacks = [];
var render_callbacks = [];
var flush_callbacks = [];
var resolved_promise = Promise.resolve();
var update_scheduled = false;
function schedule_update() {
  if (!update_scheduled) {
    update_scheduled = true;
    resolved_promise.then(flush);
  }
}
function add_render_callback(fn2) {
  render_callbacks.push(fn2);
}
var flushing = false;
var seen_callbacks = /* @__PURE__ */ new Set();
function flush() {
  if (flushing)
    return;
  flushing = true;
  do {
    for (let i = 0; i < dirty_components.length; i += 1) {
      const component = dirty_components[i];
      set_current_component(component);
      update(component.$$);
    }
    set_current_component(null);
    dirty_components.length = 0;
    while (binding_callbacks.length)
      binding_callbacks.pop()();
    for (let i = 0; i < render_callbacks.length; i += 1) {
      const callback = render_callbacks[i];
      if (!seen_callbacks.has(callback)) {
        seen_callbacks.add(callback);
        callback();
      }
    }
    render_callbacks.length = 0;
  } while (dirty_components.length);
  while (flush_callbacks.length) {
    flush_callbacks.pop()();
  }
  update_scheduled = false;
  flushing = false;
  seen_callbacks.clear();
}
function update($$) {
  if ($$.fragment !== null) {
    $$.update();
    run_all($$.before_update);
    const dirty = $$.dirty;
    $$.dirty = [-1];
    $$.fragment && $$.fragment.p($$.ctx, dirty);
    $$.after_update.forEach(add_render_callback);
  }
}
var outroing = /* @__PURE__ */ new Set();
var outros;
function group_outros() {
  outros = {
    r: 0,
    c: [],
    p: outros
  };
}
function check_outros() {
  if (!outros.r) {
    run_all(outros.c);
  }
  outros = outros.p;
}
function transition_in(block, local) {
  if (block && block.i) {
    outroing.delete(block);
    block.i(local);
  }
}
function transition_out(block, local, detach2, callback) {
  if (block && block.o) {
    if (outroing.has(block))
      return;
    outroing.add(block);
    outros.c.push(() => {
      outroing.delete(block);
      if (callback) {
        if (detach2)
          block.d(1);
        callback();
      }
    });
    block.o(local);
  }
}
var globals = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : global;
function outro_and_destroy_block(block, lookup) {
  transition_out(block, 1, 1, () => {
    lookup.delete(block.key);
  });
}
function fix_and_outro_and_destroy_block(block, lookup) {
  block.f();
  outro_and_destroy_block(block, lookup);
}
function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block8, next2, get_context) {
  let o = old_blocks.length;
  let n = list.length;
  let i = o;
  const old_indexes = {};
  while (i--)
    old_indexes[old_blocks[i].key] = i;
  const new_blocks = [];
  const new_lookup = /* @__PURE__ */ new Map();
  const deltas = /* @__PURE__ */ new Map();
  i = n;
  while (i--) {
    const child_ctx = get_context(ctx, list, i);
    const key = get_key(child_ctx);
    let block = lookup.get(key);
    if (!block) {
      block = create_each_block8(key, child_ctx);
      block.c();
    } else if (dynamic) {
      block.p(child_ctx, dirty);
    }
    new_lookup.set(key, new_blocks[i] = block);
    if (key in old_indexes)
      deltas.set(key, Math.abs(i - old_indexes[key]));
  }
  const will_move = /* @__PURE__ */ new Set();
  const did_move = /* @__PURE__ */ new Set();
  function insert2(block) {
    transition_in(block, 1);
    block.m(node, next2);
    lookup.set(block.key, block);
    next2 = block.first;
    n--;
  }
  while (o && n) {
    const new_block = new_blocks[n - 1];
    const old_block = old_blocks[o - 1];
    const new_key = new_block.key;
    const old_key = old_block.key;
    if (new_block === old_block) {
      next2 = new_block.first;
      o--;
      n--;
    } else if (!new_lookup.has(old_key)) {
      destroy(old_block, lookup);
      o--;
    } else if (!lookup.has(new_key) || will_move.has(new_key)) {
      insert2(new_block);
    } else if (did_move.has(old_key)) {
      o--;
    } else if (deltas.get(new_key) > deltas.get(old_key)) {
      did_move.add(new_key);
      insert2(new_block);
    } else {
      will_move.add(old_key);
      o--;
    }
  }
  while (o--) {
    const old_block = old_blocks[o];
    if (!new_lookup.has(old_block.key))
      destroy(old_block, lookup);
  }
  while (n)
    insert2(new_blocks[n - 1]);
  return new_blocks;
}
function get_spread_update(levels, updates) {
  const update2 = {};
  const to_null_out = {};
  const accounted_for = { $$scope: 1 };
  let i = levels.length;
  while (i--) {
    const o = levels[i];
    const n = updates[i];
    if (n) {
      for (const key in o) {
        if (!(key in n))
          to_null_out[key] = 1;
      }
      for (const key in n) {
        if (!accounted_for[key]) {
          update2[key] = n[key];
          accounted_for[key] = 1;
        }
      }
      levels[i] = n;
    } else {
      for (const key in o) {
        accounted_for[key] = 1;
      }
    }
  }
  for (const key in to_null_out) {
    if (!(key in update2))
      update2[key] = void 0;
  }
  return update2;
}
function get_spread_object(spread_props) {
  return typeof spread_props === "object" && spread_props !== null ? spread_props : {};
}
function create_component(block) {
  block && block.c();
}
function mount_component(component, target, anchor, customElement) {
  const { fragment, on_mount, on_destroy, after_update } = component.$$;
  fragment && fragment.m(target, anchor);
  if (!customElement) {
    add_render_callback(() => {
      const new_on_destroy = on_mount.map(run).filter(is_function);
      if (on_destroy) {
        on_destroy.push(...new_on_destroy);
      } else {
        run_all(new_on_destroy);
      }
      component.$$.on_mount = [];
    });
  }
  after_update.forEach(add_render_callback);
}
function destroy_component(component, detaching) {
  const $$ = component.$$;
  if ($$.fragment !== null) {
    run_all($$.on_destroy);
    $$.fragment && $$.fragment.d(detaching);
    $$.on_destroy = $$.fragment = null;
    $$.ctx = [];
  }
}
function make_dirty(component, i) {
  if (component.$$.dirty[0] === -1) {
    dirty_components.push(component);
    schedule_update();
    component.$$.dirty.fill(0);
  }
  component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
}
function init(component, options, instance16, create_fragment16, not_equal, props, append_styles2, dirty = [-1]) {
  const parent_component = current_component;
  set_current_component(component);
  const $$ = component.$$ = {
    fragment: null,
    ctx: null,
    props,
    update: noop,
    not_equal,
    bound: blank_object(),
    on_mount: [],
    on_destroy: [],
    on_disconnect: [],
    before_update: [],
    after_update: [],
    context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
    callbacks: blank_object(),
    dirty,
    skip_bound: false,
    root: options.target || parent_component.$$.root
  };
  append_styles2 && append_styles2($$.root);
  let ready = false;
  $$.ctx = instance16 ? instance16(component, options.props || {}, (i, ret, ...rest) => {
    const value = rest.length ? rest[0] : ret;
    if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
      if (!$$.skip_bound && $$.bound[i])
        $$.bound[i](value);
      if (ready)
        make_dirty(component, i);
    }
    return ret;
  }) : [];
  $$.update();
  ready = true;
  run_all($$.before_update);
  $$.fragment = create_fragment16 ? create_fragment16($$.ctx) : false;
  if (options.target) {
    if (options.hydrate) {
      start_hydrating();
      const nodes = children(options.target);
      $$.fragment && $$.fragment.l(nodes);
      nodes.forEach(detach);
    } else {
      $$.fragment && $$.fragment.c();
    }
    if (options.intro)
      transition_in(component.$$.fragment);
    mount_component(component, options.target, options.anchor, options.customElement);
    end_hydrating();
    flush();
  }
  set_current_component(parent_component);
}
var SvelteElement;
if (typeof HTMLElement === "function") {
  SvelteElement = class extends HTMLElement {
    constructor() {
      super();
      this.attachShadow({ mode: "open" });
    }
    connectedCallback() {
      const { on_mount } = this.$$;
      this.$$.on_disconnect = on_mount.map(run).filter(is_function);
      for (const key in this.$$.slotted) {
        this.appendChild(this.$$.slotted[key]);
      }
    }
    attributeChangedCallback(attr2, _oldValue, newValue) {
      this[attr2] = newValue;
    }
    disconnectedCallback() {
      run_all(this.$$.on_disconnect);
    }
    $destroy() {
      destroy_component(this, 1);
      this.$destroy = noop;
    }
    $on(type, callback) {
      const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
      callbacks.push(callback);
      return () => {
        const index = callbacks.indexOf(callback);
        if (index !== -1)
          callbacks.splice(index, 1);
      };
    }
    $set($$props) {
      if (this.$$set && !is_empty($$props)) {
        this.$$.skip_bound = true;
        this.$$set($$props);
        this.$$.skip_bound = false;
      }
    }
  };
}
var SvelteComponent = class {
  $destroy() {
    destroy_component(this, 1);
    this.$destroy = noop;
  }
  $on(type, callback) {
    const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
    callbacks.push(callback);
    return () => {
      const index = callbacks.indexOf(callback);
      if (index !== -1)
        callbacks.splice(index, 1);
    };
  }
  $set($$props) {
    if (this.$$set && !is_empty($$props)) {
      this.$$.skip_bound = true;
      this.$$set($$props);
      this.$$.skip_bound = false;
    }
  }
};

// node_modules/tslib/modules/index.js
var import_tslib = __toModule(require_tslib());
var {
  __extends,
  __assign,
  __rest,
  __decorate,
  __param,
  __metadata,
  __awaiter,
  __generator,
  __exportStar,
  __createBinding,
  __values,
  __read,
  __spread,
  __spreadArrays,
  __spreadArray,
  __await,
  __asyncGenerator,
  __asyncDelegator,
  __asyncValues,
  __makeTemplateObject,
  __importStar,
  __importDefault,
  __classPrivateFieldGet,
  __classPrivateFieldSet
} = import_tslib.default;

// src/encounter/ui/Encounter.svelte
var import_obsidian5 = __toModule(require("obsidian"));

// src/utils/encounter-difficulty.ts
var tresholds = {
  1: { easy: 25, medium: 50, hard: 75, deadly: 100 },
  2: { easy: 50, medium: 100, hard: 150, deadly: 200 },
  3: { easy: 75, medium: 150, hard: 225, deadly: 400 },
  4: { easy: 125, medium: 250, hard: 375, deadly: 500 },
  5: { easy: 250, medium: 500, hard: 750, deadly: 1100 },
  6: { easy: 300, medium: 600, hard: 900, deadly: 1400 },
  7: { easy: 350, medium: 750, hard: 1100, deadly: 1700 },
  8: { easy: 450, medium: 900, hard: 1400, deadly: 2100 },
  9: { easy: 550, medium: 1100, hard: 1600, deadly: 2400 },
  10: { easy: 600, medium: 1200, hard: 1900, deadly: 2800 },
  11: { easy: 800, medium: 1600, hard: 2400, deadly: 3600 },
  12: { easy: 1e3, medium: 2e3, hard: 3e3, deadly: 4500 },
  13: { easy: 1100, medium: 2200, hard: 3400, deadly: 5100 },
  14: { easy: 1250, medium: 2500, hard: 3800, deadly: 5700 },
  15: { easy: 1400, medium: 2800, hard: 4300, deadly: 6400 },
  16: { easy: 1600, medium: 3200, hard: 4800, deadly: 7200 },
  17: { easy: 2e3, medium: 3900, hard: 5900, deadly: 8800 },
  18: { easy: 2100, medium: 4200, hard: 6300, deadly: 9500 },
  19: { easy: 2400, medium: 4900, hard: 7300, deadly: 10900 },
  20: { easy: 2800, medium: 5700, hard: 8500, deadly: 12700 }
};
function xpBudget(characterLevels) {
  const easy = characterLevels.reduce((acc, lvl) => acc + tresholds[lvl].easy, 0);
  const medium = characterLevels.reduce((acc, lvl) => acc + tresholds[lvl].medium, 0);
  const hard = characterLevels.reduce((acc, lvl) => acc + tresholds[lvl].hard, 0);
  const deadly = characterLevels.reduce((acc, lvl) => acc + tresholds[lvl].deadly, 0);
  return { easy, medium, hard, deadly };
}
function formatDifficultyReport(report) {
  return `${[
    `Encounter is ${report.difficulty}`,
    `Total XP: ${report.totalXp}`,
    `Adjusted XP: ${report.adjustedXp} (x${report.multiplier})`,
    ` `,
    `Threshold`,
    `Easy: ${report.budget.easy}`,
    `Medium: ${report.budget.medium}`,
    `Hard: ${report.budget.hard}`,
    `Deadly: ${report.budget.deadly}`
  ].join("\n")}`;
}
function encounterDifficulty(characterLevels, monsterXp) {
  if (!characterLevels?.length || !monsterXp?.length)
    return;
  const xp = monsterXp.reduce((acc, xp2) => acc + xp2, 0);
  const numberOfMonsters = monsterXp.length;
  let numberMultiplier;
  if (numberOfMonsters === 1) {
    numberMultiplier = 1;
  } else if (numberOfMonsters === 2) {
    numberMultiplier = 1.5;
  } else if (numberOfMonsters < 7) {
    numberMultiplier = 2;
  } else if (numberOfMonsters < 11) {
    numberMultiplier = 2.5;
  } else if (numberOfMonsters < 15) {
    numberMultiplier = 3;
  } else {
    numberMultiplier = 4;
  }
  const adjustedXp = numberMultiplier * xp;
  const budget = xpBudget(characterLevels);
  let difficulty = "Easy";
  if (adjustedXp >= budget.deadly) {
    difficulty = "Deadly";
  } else if (adjustedXp >= budget.hard) {
    difficulty = "Hard";
  } else if (adjustedXp >= budget.medium) {
    difficulty = "Medium";
  }
  let result = {
    difficulty,
    totalXp: xp,
    adjustedXp,
    multiplier: numberMultiplier,
    budget
  };
  return result;
}

// src/encounter/ui/Encounter.svelte
function add_css(target) {
  append_styles(target, "svelte-2rbje", ".encounter-name.svelte-2rbje.svelte-2rbje{display:flex;justify-content:flex-start;align-items:center}.encounter-name.svelte-2rbje .initiative-tracker-name.svelte-2rbje{margin:0}.encounter-instance.svelte-2rbje>.creatures-container>.encounter-creatures:first-of-type h4.svelte-2rbje,.encounter-creatures.svelte-2rbje>ul.svelte-2rbje{margin-top:0}.creature-li.svelte-2rbje.svelte-2rbje{width:fit-content}.xp-parent.svelte-2rbje.svelte-2rbje{display:inline-flex}.difficulty.svelte-2rbje.svelte-2rbje{width:fit-content}.deadly.svelte-2rbje .difficulty-label.svelte-2rbje{color:red}.hard.svelte-2rbje .difficulty-label.svelte-2rbje{color:orange}.medium.svelte-2rbje .difficulty-label.svelte-2rbje{color:yellow}.easy.svelte-2rbje .difficulty-label.svelte-2rbje{color:green}.icons.svelte-2rbje.svelte-2rbje{display:flex}.icons.svelte-2rbje>div.svelte-2rbje:first-child .clickable-icon{margin-right:0}");
}
function get_each_context(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[18] = list[i][0];
  child_ctx[19] = list[i][1];
  return child_ctx;
}
function get_each_context_1(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[22] = list[i];
  return child_ctx;
}
function create_if_block_6(ctx) {
  let if_block_anchor;
  function select_block_type(ctx2, dirty) {
    if (ctx2[3] instanceof Array && ctx2[3].length)
      return create_if_block_7;
    if (!ctx2[3])
      return create_if_block_8;
  }
  let current_block_type = select_block_type(ctx, -1);
  let if_block = current_block_type && current_block_type(ctx);
  return {
    c() {
      if (if_block)
        if_block.c();
      if_block_anchor = empty();
    },
    m(target, anchor) {
      if (if_block)
        if_block.m(target, anchor);
      insert(target, if_block_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (current_block_type === (current_block_type = select_block_type(ctx2, dirty)) && if_block) {
        if_block.p(ctx2, dirty);
      } else {
        if (if_block)
          if_block.d(1);
        if_block = current_block_type && current_block_type(ctx2);
        if (if_block) {
          if_block.c();
          if_block.m(if_block_anchor.parentNode, if_block_anchor);
        }
      }
    },
    d(detaching) {
      if (if_block) {
        if_block.d(detaching);
      }
      if (detaching)
        detach(if_block_anchor);
    }
  };
}
function create_if_block_8(ctx) {
  let div;
  return {
    c() {
      div = element("div");
      div.innerHTML = `<h4 class="svelte-2rbje">No Players</h4>`;
      attr(div, "class", "encounter-creatures encounter-players");
    },
    m(target, anchor) {
      insert(target, div, anchor);
    },
    p: noop,
    d(detaching) {
      if (detaching)
        detach(div);
    }
  };
}
function create_if_block_7(ctx) {
  let div;
  let h4;
  let t0_value = (ctx[4] ? ctx[4] : "Players") + "";
  let t0;
  let t1;
  let ul;
  let each_value_1 = ctx[3];
  let each_blocks = [];
  for (let i = 0; i < each_value_1.length; i += 1) {
    each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
  }
  return {
    c() {
      div = element("div");
      h4 = element("h4");
      t0 = text(t0_value);
      t1 = space();
      ul = element("ul");
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].c();
      }
      attr(h4, "class", "svelte-2rbje");
      attr(ul, "class", "svelte-2rbje");
      attr(div, "class", "encounter-creatures encounter-players svelte-2rbje");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, h4);
      append(h4, t0);
      append(div, t1);
      append(div, ul);
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].m(ul, null);
      }
    },
    p(ctx2, dirty) {
      if (dirty & 16 && t0_value !== (t0_value = (ctx2[4] ? ctx2[4] : "Players") + ""))
        set_data(t0, t0_value);
      if (dirty & 8) {
        each_value_1 = ctx2[3];
        let i;
        for (i = 0; i < each_value_1.length; i += 1) {
          const child_ctx = get_each_context_1(ctx2, each_value_1, i);
          if (each_blocks[i]) {
            each_blocks[i].p(child_ctx, dirty);
          } else {
            each_blocks[i] = create_each_block_1(child_ctx);
            each_blocks[i].c();
            each_blocks[i].m(ul, null);
          }
        }
        for (; i < each_blocks.length; i += 1) {
          each_blocks[i].d(1);
        }
        each_blocks.length = each_value_1.length;
      }
    },
    d(detaching) {
      if (detaching)
        detach(div);
      destroy_each(each_blocks, detaching);
    }
  };
}
function create_each_block_1(ctx) {
  let li;
  let span;
  let t0_value = ctx[22] + "";
  let t0;
  let t1;
  return {
    c() {
      li = element("li");
      span = element("span");
      t0 = text(t0_value);
      t1 = space();
    },
    m(target, anchor) {
      insert(target, li, anchor);
      append(li, span);
      append(span, t0);
      append(li, t1);
    },
    p(ctx2, dirty) {
      if (dirty & 8 && t0_value !== (t0_value = ctx2[22] + ""))
        set_data(t0, t0_value);
    },
    d(detaching) {
      if (detaching)
        detach(li);
    }
  };
}
function create_if_block_2(ctx) {
  let h4;
  let t1;
  let if_block_anchor;
  function select_block_type_1(ctx2, dirty) {
    if (ctx2[2].size)
      return create_if_block_3;
    return create_else_block_1;
  }
  let current_block_type = select_block_type_1(ctx, -1);
  let if_block = current_block_type(ctx);
  return {
    c() {
      h4 = element("h4");
      h4.textContent = "Creatures";
      t1 = space();
      if_block.c();
      if_block_anchor = empty();
      attr(h4, "class", "svelte-2rbje");
    },
    m(target, anchor) {
      insert(target, h4, anchor);
      insert(target, t1, anchor);
      if_block.m(target, anchor);
      insert(target, if_block_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (current_block_type === (current_block_type = select_block_type_1(ctx2, dirty)) && if_block) {
        if_block.p(ctx2, dirty);
      } else {
        if_block.d(1);
        if_block = current_block_type(ctx2);
        if (if_block) {
          if_block.c();
          if_block.m(if_block_anchor.parentNode, if_block_anchor);
        }
      }
    },
    d(detaching) {
      if (detaching)
        detach(h4);
      if (detaching)
        detach(t1);
      if_block.d(detaching);
      if (detaching)
        detach(if_block_anchor);
    }
  };
}
function create_else_block_1(ctx) {
  let strong;
  return {
    c() {
      strong = element("strong");
      strong.textContent = "No creatures";
    },
    m(target, anchor) {
      insert(target, strong, anchor);
    },
    p: noop,
    d(detaching) {
      if (detaching)
        detach(strong);
    }
  };
}
function create_if_block_3(ctx) {
  let ul;
  let each_value = [...ctx[2]];
  let each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1) {
    each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
  }
  return {
    c() {
      ul = element("ul");
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].c();
      }
      attr(ul, "class", "svelte-2rbje");
    },
    m(target, anchor) {
      insert(target, ul, anchor);
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].m(ul, null);
      }
    },
    p(ctx2, dirty) {
      if (dirty & 16516) {
        each_value = [...ctx2[2]];
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context(ctx2, each_value, i);
          if (each_blocks[i]) {
            each_blocks[i].p(child_ctx, dirty);
          } else {
            each_blocks[i] = create_each_block(child_ctx);
            each_blocks[i].c();
            each_blocks[i].m(ul, null);
          }
        }
        for (; i < each_blocks.length; i += 1) {
          each_blocks[i].d(1);
        }
        each_blocks.length = each_value.length;
      }
    },
    d(detaching) {
      if (detaching)
        detach(ul);
      destroy_each(each_blocks, detaching);
    }
  };
}
function create_else_block(ctx) {
  let t0;
  let t1_value = ctx[18].name + "";
  let t1;
  let t2_value = (ctx[19] == 1 ? "" : "s") + "";
  let t2;
  return {
    c() {
      t0 = text("\xA0");
      t1 = text(t1_value);
      t2 = text(t2_value);
    },
    m(target, anchor) {
      insert(target, t0, anchor);
      insert(target, t1, anchor);
      insert(target, t2, anchor);
    },
    p(ctx2, dirty) {
      if (dirty & 4 && t1_value !== (t1_value = ctx2[18].name + ""))
        set_data(t1, t1_value);
      if (dirty & 4 && t2_value !== (t2_value = (ctx2[19] == 1 ? "" : "s") + ""))
        set_data(t2, t2_value);
    },
    d(detaching) {
      if (detaching)
        detach(t0);
      if (detaching)
        detach(t1);
      if (detaching)
        detach(t2);
    }
  };
}
function create_if_block_5(ctx) {
  let t0;
  let t1_value = ctx[18].display + "";
  let t1;
  let t2_value = (ctx[19] == 1 ? "" : "s") + "";
  let t2;
  let t3;
  let t4_value = ctx[18].name + "";
  let t4;
  let t5;
  return {
    c() {
      t0 = text("\xA0");
      t1 = text(t1_value);
      t2 = text(t2_value);
      t3 = text(" (");
      t4 = text(t4_value);
      t5 = text(")");
    },
    m(target, anchor) {
      insert(target, t0, anchor);
      insert(target, t1, anchor);
      insert(target, t2, anchor);
      insert(target, t3, anchor);
      insert(target, t4, anchor);
      insert(target, t5, anchor);
    },
    p(ctx2, dirty) {
      if (dirty & 4 && t1_value !== (t1_value = ctx2[18].display + ""))
        set_data(t1, t1_value);
      if (dirty & 4 && t2_value !== (t2_value = (ctx2[19] == 1 ? "" : "s") + ""))
        set_data(t2, t2_value);
      if (dirty & 4 && t4_value !== (t4_value = ctx2[18].name + ""))
        set_data(t4, t4_value);
    },
    d(detaching) {
      if (detaching)
        detach(t0);
      if (detaching)
        detach(t1);
      if (detaching)
        detach(t2);
      if (detaching)
        detach(t3);
      if (detaching)
        detach(t4);
      if (detaching)
        detach(t5);
    }
  };
}
function create_if_block_4(ctx) {
  let span5;
  let span0;
  let t1;
  let span3;
  let span1;
  let t2_value = ctx[18].xp * ctx[7].get(ctx[18]) + "";
  let t2;
  let t3;
  let span2;
  let t5;
  let span4;
  return {
    c() {
      span5 = element("span");
      span0 = element("span");
      span0.textContent = "(";
      t1 = space();
      span3 = element("span");
      span1 = element("span");
      t2 = text(t2_value);
      t3 = space();
      span2 = element("span");
      span2.textContent = "XP";
      t5 = space();
      span4 = element("span");
      span4.textContent = ")";
      attr(span0, "class", "paren left");
      attr(span1, "class", "xp number");
      attr(span2, "class", "xp text");
      attr(span3, "class", "xp-container");
      attr(span4, "class", "paren right");
      attr(span5, "class", "xp-parent svelte-2rbje");
    },
    m(target, anchor) {
      insert(target, span5, anchor);
      append(span5, span0);
      append(span5, t1);
      append(span5, span3);
      append(span3, span1);
      append(span1, t2);
      append(span3, t3);
      append(span3, span2);
      append(span5, t5);
      append(span5, span4);
    },
    p(ctx2, dirty) {
      if (dirty & 132 && t2_value !== (t2_value = ctx2[18].xp * ctx2[7].get(ctx2[18]) + ""))
        set_data(t2, t2_value);
    },
    d(detaching) {
      if (detaching)
        detach(span5);
    }
  };
}
function create_each_block(ctx) {
  let li;
  let strong;
  let rollerEl_action;
  let t0;
  let span;
  let t1;
  let show_if = ctx[18].xp && ctx[7].has(ctx[18]);
  let t2;
  let li_aria_label_value;
  let mounted;
  let dispose;
  function select_block_type_2(ctx2, dirty) {
    if (ctx2[18].display && ctx2[18].display != ctx2[18].name)
      return create_if_block_5;
    return create_else_block;
  }
  let current_block_type = select_block_type_2(ctx, -1);
  let if_block0 = current_block_type(ctx);
  let if_block1 = show_if && create_if_block_4(ctx);
  return {
    c() {
      li = element("li");
      strong = element("strong");
      t0 = space();
      span = element("span");
      if_block0.c();
      t1 = space();
      if (if_block1)
        if_block1.c();
      t2 = space();
      attr(li, "aria-label", li_aria_label_value = ctx[14](ctx[18]));
      attr(li, "class", "creature-li svelte-2rbje");
    },
    m(target, anchor) {
      insert(target, li, anchor);
      append(li, strong);
      append(li, t0);
      append(li, span);
      if_block0.m(span, null);
      append(li, t1);
      if (if_block1)
        if_block1.m(li, null);
      append(li, t2);
      if (!mounted) {
        dispose = action_destroyer(rollerEl_action = ctx[13].call(null, strong, ctx[18]));
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      if (rollerEl_action && is_function(rollerEl_action.update) && dirty & 4)
        rollerEl_action.update.call(null, ctx[18]);
      if (current_block_type === (current_block_type = select_block_type_2(ctx, dirty)) && if_block0) {
        if_block0.p(ctx, dirty);
      } else {
        if_block0.d(1);
        if_block0 = current_block_type(ctx);
        if (if_block0) {
          if_block0.c();
          if_block0.m(span, null);
        }
      }
      if (dirty & 132)
        show_if = ctx[18].xp && ctx[7].has(ctx[18]);
      if (show_if) {
        if (if_block1) {
          if_block1.p(ctx, dirty);
        } else {
          if_block1 = create_if_block_4(ctx);
          if_block1.c();
          if_block1.m(li, t2);
        }
      } else if (if_block1) {
        if_block1.d(1);
        if_block1 = null;
      }
      if (dirty & 4 && li_aria_label_value !== (li_aria_label_value = ctx[14](ctx[18]))) {
        attr(li, "aria-label", li_aria_label_value);
      }
    },
    d(detaching) {
      if (detaching)
        detach(li);
      if_block0.d();
      if (if_block1)
        if_block1.d();
      mounted = false;
      dispose();
    }
  };
}
function create_if_block(ctx) {
  let div;
  let if_block = ctx[6] > 0 && ctx[8] && create_if_block_1(ctx);
  return {
    c() {
      div = element("div");
      if (if_block)
        if_block.c();
      attr(div, "class", "encounter-xp difficulty svelte-2rbje");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      if (if_block)
        if_block.m(div, null);
    },
    p(ctx2, dirty) {
      if (ctx2[6] > 0 && ctx2[8]) {
        if (if_block) {
          if_block.p(ctx2, dirty);
        } else {
          if_block = create_if_block_1(ctx2);
          if_block.c();
          if_block.m(div, null);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    d(detaching) {
      if (detaching)
        detach(div);
      if (if_block)
        if_block.d();
    }
  };
}
function create_if_block_1(ctx) {
  let span6;
  let strong;
  let t0_value = ctx[8].difficulty + "";
  let t0;
  let t1;
  let span5;
  let span0;
  let t3;
  let span3;
  let span1;
  let t4;
  let t5;
  let span2;
  let t7;
  let span4;
  let span6_aria_label_value;
  let span6_class_value;
  return {
    c() {
      span6 = element("span");
      strong = element("strong");
      t0 = text(t0_value);
      t1 = space();
      span5 = element("span");
      span0 = element("span");
      span0.textContent = "(";
      t3 = space();
      span3 = element("span");
      span1 = element("span");
      t4 = text(ctx[6]);
      t5 = space();
      span2 = element("span");
      span2.textContent = "XP";
      t7 = space();
      span4 = element("span");
      span4.textContent = ")";
      attr(strong, "class", "difficulty-label svelte-2rbje");
      attr(span0, "class", "paren left");
      attr(span1, "class", "xp number");
      attr(span2, "class", "xp text");
      attr(span3, "class", "xp-container");
      attr(span4, "class", "paren right");
      attr(span5, "class", "xp-parent difficulty svelte-2rbje");
      attr(span6, "aria-label", span6_aria_label_value = formatDifficultyReport(ctx[8]));
      attr(span6, "class", span6_class_value = "" + (null_to_empty(ctx[8].difficulty.toLowerCase()) + " svelte-2rbje"));
    },
    m(target, anchor) {
      insert(target, span6, anchor);
      append(span6, strong);
      append(strong, t0);
      append(span6, t1);
      append(span6, span5);
      append(span5, span0);
      append(span5, t3);
      append(span5, span3);
      append(span3, span1);
      append(span1, t4);
      append(span3, t5);
      append(span3, span2);
      append(span5, t7);
      append(span5, span4);
    },
    p(ctx2, dirty) {
      if (dirty & 256 && t0_value !== (t0_value = ctx2[8].difficulty + ""))
        set_data(t0, t0_value);
      if (dirty & 64)
        set_data(t4, ctx2[6]);
      if (dirty & 256 && span6_aria_label_value !== (span6_aria_label_value = formatDifficultyReport(ctx2[8]))) {
        attr(span6, "aria-label", span6_aria_label_value);
      }
      if (dirty & 256 && span6_class_value !== (span6_class_value = "" + (null_to_empty(ctx2[8].difficulty.toLowerCase()) + " svelte-2rbje"))) {
        attr(span6, "class", span6_class_value);
      }
    },
    d(detaching) {
      if (detaching)
        detach(span6);
    }
  };
}
function create_fragment(ctx) {
  let div6;
  let div3;
  let h3;
  let t0;
  let t1;
  let div2;
  let div0;
  let openButton_action;
  let t2;
  let div1;
  let addButton_action;
  let t3;
  let div5;
  let show_if_1 = !ctx[5].includes("players");
  let t4;
  let div4;
  let show_if = !ctx[5].includes("creatures");
  let t5;
  let mounted;
  let dispose;
  let if_block0 = show_if_1 && create_if_block_6(ctx);
  let if_block1 = show_if && create_if_block_2(ctx);
  let if_block2 = ctx[0].data.displayDifficulty && create_if_block(ctx);
  return {
    c() {
      div6 = element("div");
      div3 = element("div");
      h3 = element("h3");
      t0 = text(ctx[1]);
      t1 = space();
      div2 = element("div");
      div0 = element("div");
      t2 = space();
      div1 = element("div");
      t3 = space();
      div5 = element("div");
      if (if_block0)
        if_block0.c();
      t4 = space();
      div4 = element("div");
      if (if_block1)
        if_block1.c();
      t5 = space();
      if (if_block2)
        if_block2.c();
      attr(h3, "data-heading", ctx[1]);
      attr(h3, "class", "initiative-tracker-name svelte-2rbje");
      attr(div0, "aria-label", "Start Encounter");
      attr(div0, "class", "svelte-2rbje");
      attr(div1, "aria-label", "Add to Encounter");
      attr(div1, "class", "svelte-2rbje");
      attr(div2, "class", "icons svelte-2rbje");
      attr(div3, "class", "encounter-name svelte-2rbje");
      attr(div4, "class", "encounter-creatures svelte-2rbje");
      attr(div5, "class", "creatures-container");
      attr(div6, "class", "encounter-instance svelte-2rbje");
    },
    m(target, anchor) {
      insert(target, div6, anchor);
      append(div6, div3);
      append(div3, h3);
      append(h3, t0);
      append(div3, t1);
      append(div3, div2);
      append(div2, div0);
      append(div2, t2);
      append(div2, div1);
      append(div6, t3);
      append(div6, div5);
      if (if_block0)
        if_block0.m(div5, null);
      append(div5, t4);
      append(div5, div4);
      if (if_block1)
        if_block1.m(div4, null);
      append(div5, t5);
      if (if_block2)
        if_block2.m(div5, null);
      if (!mounted) {
        dispose = [
          action_destroyer(openButton_action = ctx[9].call(null, div0)),
          listen(div0, "click", ctx[10]),
          action_destroyer(addButton_action = ctx[11].call(null, div1)),
          listen(div1, "click", ctx[12])
        ];
        mounted = true;
      }
    },
    p(ctx2, [dirty]) {
      if (dirty & 2)
        set_data(t0, ctx2[1]);
      if (dirty & 2) {
        attr(h3, "data-heading", ctx2[1]);
      }
      if (dirty & 32)
        show_if_1 = !ctx2[5].includes("players");
      if (show_if_1) {
        if (if_block0) {
          if_block0.p(ctx2, dirty);
        } else {
          if_block0 = create_if_block_6(ctx2);
          if_block0.c();
          if_block0.m(div5, t4);
        }
      } else if (if_block0) {
        if_block0.d(1);
        if_block0 = null;
      }
      if (dirty & 32)
        show_if = !ctx2[5].includes("creatures");
      if (show_if) {
        if (if_block1) {
          if_block1.p(ctx2, dirty);
        } else {
          if_block1 = create_if_block_2(ctx2);
          if_block1.c();
          if_block1.m(div4, null);
        }
      } else if (if_block1) {
        if_block1.d(1);
        if_block1 = null;
      }
      if (ctx2[0].data.displayDifficulty) {
        if (if_block2) {
          if_block2.p(ctx2, dirty);
        } else {
          if_block2 = create_if_block(ctx2);
          if_block2.c();
          if_block2.m(div5, null);
        }
      } else if (if_block2) {
        if_block2.d(1);
        if_block2 = null;
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div6);
      if (if_block0)
        if_block0.d();
      if (if_block1)
        if_block1.d();
      if (if_block2)
        if_block2.d();
      mounted = false;
      run_all(dispose);
    }
  };
}
function instance($$self, $$props, $$invalidate) {
  let { plugin } = $$props;
  let { name = "Encounter" } = $$props;
  let { creatures } = $$props;
  let { players } = $$props;
  let { party = null } = $$props;
  let { hide: hide2 = [] } = $$props;
  let { xp } = $$props;
  let { playerLevels } = $$props;
  let totalXP;
  let creatureMap = /* @__PURE__ */ new Map();
  const rollerMap = /* @__PURE__ */ new Map();
  for (let [creature, count] of creatures) {
    let number = Number(count);
    if (plugin.canUseDiceRoller) {
      let roller = plugin.getRoller(`${count}`);
      roller.on("new-result", () => {
        creatureMap.set(creature, roller.result);
        $$invalidate(7, creatureMap);
        $$invalidate(6, totalXP = [...creatureMap].reduce((a, c) => a + c[0].xp * c[1], 0));
      });
      rollerMap.set(creature, roller);
      roller.roll();
    } else {
      creatureMap.set(creature, number);
    }
  }
  totalXP = [...creatureMap].reduce((a, c) => a + c[0].xp * c[1], 0);
  let difficulty;
  const openButton = (node) => {
    new import_obsidian5.ExtraButtonComponent(node).setIcon(START_ENCOUNTER);
  };
  const open = () => __awaiter(void 0, void 0, void 0, function* () {
    if (!plugin.view) {
      yield plugin.addTrackerView();
    }
    const view = plugin.view;
    const creatures2 = [...creatureMap].map(([creature, number]) => {
      if (isNaN(Number(number)) || number < 1)
        return [creature];
      return [...Array(number).keys()].map((v) => Creature.from(creature));
    }).flat();
    view === null || view === void 0 ? void 0 : view.newEncounter({ party, name, players, creatures: creatures2, xp });
    plugin.app.workspace.revealLeaf(view.leaf);
  });
  const addButton = (node) => {
    new import_obsidian5.ExtraButtonComponent(node).setIcon("plus-with-circle");
  };
  const add = (evt) => __awaiter(void 0, void 0, void 0, function* () {
    if (!plugin.view) {
      yield plugin.addTrackerView();
    }
    const view = plugin.view;
    const creatures2 = [...creatureMap].map(([creature, number]) => {
      if (isNaN(Number(number)) || number < 1)
        return [creature];
      return [...Array(number).keys()].map((v) => Creature.from(creature));
    }).flat();
    view.addCreatures(creatures2, true);
  });
  const rollerEl = (node, creature) => {
    var _a, _b;
    if (plugin.canUseDiceRoller && rollerMap.has(creature) && !rollerMap.get(creature).isStatic) {
      node.appendChild((_b = (_a = rollerMap.get(creature)) === null || _a === void 0 ? void 0 : _a.containerEl) !== null && _b !== void 0 ? _b : createSpan({ text: `${creatureMap.get(creature)}` }));
    } else {
      node.setText(`${creatureMap.get(creature)}`);
    }
  };
  const label = (creature) => {
    if (!creature)
      return;
    let label2 = [];
    if (creature.hp) {
      label2.push(`HP: ${creature.hp}`);
    }
    if (creature.ac) {
      label2.push(`AC: ${creature.ac}`);
    }
    if (creature.modifier) {
      label2.push(`MOD: ${creature.modifier}`);
    }
    return `${label2.join(", ")}`;
  };
  $$self.$$set = ($$props2) => {
    if ("plugin" in $$props2)
      $$invalidate(0, plugin = $$props2.plugin);
    if ("name" in $$props2)
      $$invalidate(1, name = $$props2.name);
    if ("creatures" in $$props2)
      $$invalidate(2, creatures = $$props2.creatures);
    if ("players" in $$props2)
      $$invalidate(3, players = $$props2.players);
    if ("party" in $$props2)
      $$invalidate(4, party = $$props2.party);
    if ("hide" in $$props2)
      $$invalidate(5, hide2 = $$props2.hide);
    if ("xp" in $$props2)
      $$invalidate(15, xp = $$props2.xp);
    if ("playerLevels" in $$props2)
      $$invalidate(16, playerLevels = $$props2.playerLevels);
  };
  $$self.$$.update = () => {
    if ($$self.$$.dirty & 65728) {
      $: {
        if (!isNaN(totalXP)) {
          $$invalidate(8, difficulty = encounterDifficulty(playerLevels, [...creatureMap].map((creature) => Array(creature[1]).fill(creature[0].xp)).flat()));
        }
      }
    }
  };
  return [
    plugin,
    name,
    creatures,
    players,
    party,
    hide2,
    totalXP,
    creatureMap,
    difficulty,
    openButton,
    open,
    addButton,
    add,
    rollerEl,
    label,
    xp,
    playerLevels
  ];
}
var Encounter = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance, create_fragment, safe_not_equal, {
      plugin: 0,
      name: 1,
      creatures: 2,
      players: 3,
      party: 4,
      hide: 5,
      xp: 15,
      playerLevels: 16
    }, add_css);
  }
};
var Encounter_default = Encounter;

// src/encounter/ui/EncounterRow.svelte
var import_obsidian6 = __toModule(require("obsidian"));
function add_css2(target) {
  append_styles(target, "svelte-bf6d6a", ".deadly.svelte-bf6d6a .difficulty-label.svelte-bf6d6a{color:red}.hard.svelte-bf6d6a .difficulty-label.svelte-bf6d6a{color:orange}.medium.svelte-bf6d6a .difficulty-label.svelte-bf6d6a{color:yellow}.easy.svelte-bf6d6a .difficulty-label.svelte-bf6d6a{color:green}.icons.svelte-bf6d6a.svelte-bf6d6a{display:flex}.icons.svelte-bf6d6a>div.svelte-bf6d6a:first-child .clickable-icon{margin-right:0}ul.svelte-bf6d6a.svelte-bf6d6a{margin:0}");
}
function get_each_context2(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[18] = list[i];
  return child_ctx;
}
function get_each_context_12(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[21] = list[i][0];
  child_ctx[22] = list[i][1];
  return child_ctx;
}
function create_if_block_42(ctx) {
  let td;
  let ul;
  let show_if;
  function select_block_type(ctx2, dirty) {
    if (show_if == null || dirty & 10)
      show_if = !!(!ctx2[3].includes("creatures") && ctx2[1].size);
    if (show_if)
      return create_if_block_52;
    return create_else_block_2;
  }
  let current_block_type = select_block_type(ctx, -1);
  let if_block = current_block_type(ctx);
  return {
    c() {
      td = element("td");
      ul = element("ul");
      if_block.c();
      attr(ul, "class", "encounter-creatures encounter-list svelte-bf6d6a");
    },
    m(target, anchor) {
      insert(target, td, anchor);
      append(td, ul);
      if_block.m(ul, null);
    },
    p(ctx2, dirty) {
      if (current_block_type === (current_block_type = select_block_type(ctx2, dirty)) && if_block) {
        if_block.p(ctx2, dirty);
      } else {
        if_block.d(1);
        if_block = current_block_type(ctx2);
        if (if_block) {
          if_block.c();
          if_block.m(ul, null);
        }
      }
    },
    d(detaching) {
      if (detaching)
        detach(td);
      if_block.d();
    }
  };
}
function create_else_block_2(ctx) {
  let t;
  return {
    c() {
      t = text("-");
    },
    m(target, anchor) {
      insert(target, t, anchor);
    },
    p: noop,
    d(detaching) {
      if (detaching)
        detach(t);
    }
  };
}
function create_if_block_52(ctx) {
  let each_1_anchor;
  let each_value_1 = [...ctx[1]];
  let each_blocks = [];
  for (let i = 0; i < each_value_1.length; i += 1) {
    each_blocks[i] = create_each_block_12(get_each_context_12(ctx, each_value_1, i));
  }
  return {
    c() {
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].c();
      }
      each_1_anchor = empty();
    },
    m(target, anchor) {
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].m(target, anchor);
      }
      insert(target, each_1_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (dirty & 4098) {
        each_value_1 = [...ctx2[1]];
        let i;
        for (i = 0; i < each_value_1.length; i += 1) {
          const child_ctx = get_each_context_12(ctx2, each_value_1, i);
          if (each_blocks[i]) {
            each_blocks[i].p(child_ctx, dirty);
          } else {
            each_blocks[i] = create_each_block_12(child_ctx);
            each_blocks[i].c();
            each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
          }
        }
        for (; i < each_blocks.length; i += 1) {
          each_blocks[i].d(1);
        }
        each_blocks.length = each_value_1.length;
      }
    },
    d(detaching) {
      destroy_each(each_blocks, detaching);
      if (detaching)
        detach(each_1_anchor);
    }
  };
}
function create_each_block_12(ctx) {
  let li;
  let strong;
  let rollerEl_action;
  let t0;
  let t1_value = ctx[21].name + "";
  let t1;
  let t2_value = (ctx[22] == 1 ? "" : "s") + "";
  let t2;
  let t3;
  let li_aria_label_value;
  let mounted;
  let dispose;
  return {
    c() {
      li = element("li");
      strong = element("strong");
      t0 = text("\xA0");
      t1 = text(t1_value);
      t2 = text(t2_value);
      t3 = space();
      attr(li, "aria-label", li_aria_label_value = ctx[12](ctx[21]));
    },
    m(target, anchor) {
      insert(target, li, anchor);
      append(li, strong);
      append(li, t0);
      append(li, t1);
      append(li, t2);
      append(li, t3);
      if (!mounted) {
        dispose = action_destroyer(rollerEl_action = ctx[11].call(null, strong, ctx[21]));
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      if (rollerEl_action && is_function(rollerEl_action.update) && dirty & 2)
        rollerEl_action.update.call(null, ctx[21]);
      if (dirty & 2 && t1_value !== (t1_value = ctx[21].name + ""))
        set_data(t1, t1_value);
      if (dirty & 2 && t2_value !== (t2_value = (ctx[22] == 1 ? "" : "s") + ""))
        set_data(t2, t2_value);
      if (dirty & 2 && li_aria_label_value !== (li_aria_label_value = ctx[12](ctx[21]))) {
        attr(li, "aria-label", li_aria_label_value);
      }
    },
    d(detaching) {
      if (detaching)
        detach(li);
      mounted = false;
      dispose();
    }
  };
}
function create_if_block_22(ctx) {
  let td;
  let ul;
  let show_if;
  function select_block_type_1(ctx2, dirty) {
    if (show_if == null || dirty & 12)
      show_if = !!(!ctx2[3].includes("players") && ctx2[2] instanceof Array && ctx2[2].length);
    if (show_if)
      return create_if_block_32;
    return create_else_block_12;
  }
  let current_block_type = select_block_type_1(ctx, -1);
  let if_block = current_block_type(ctx);
  return {
    c() {
      td = element("td");
      ul = element("ul");
      if_block.c();
      attr(ul, "class", "encounter-players encounter-list svelte-bf6d6a");
    },
    m(target, anchor) {
      insert(target, td, anchor);
      append(td, ul);
      if_block.m(ul, null);
    },
    p(ctx2, dirty) {
      if (current_block_type === (current_block_type = select_block_type_1(ctx2, dirty)) && if_block) {
        if_block.p(ctx2, dirty);
      } else {
        if_block.d(1);
        if_block = current_block_type(ctx2);
        if (if_block) {
          if_block.c();
          if_block.m(ul, null);
        }
      }
    },
    d(detaching) {
      if (detaching)
        detach(td);
      if_block.d();
    }
  };
}
function create_else_block_12(ctx) {
  let t;
  return {
    c() {
      t = text("-");
    },
    m(target, anchor) {
      insert(target, t, anchor);
    },
    p: noop,
    d(detaching) {
      if (detaching)
        detach(t);
    }
  };
}
function create_if_block_32(ctx) {
  let each_1_anchor;
  let each_value = ctx[2];
  let each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1) {
    each_blocks[i] = create_each_block2(get_each_context2(ctx, each_value, i));
  }
  return {
    c() {
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].c();
      }
      each_1_anchor = empty();
    },
    m(target, anchor) {
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].m(target, anchor);
      }
      insert(target, each_1_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (dirty & 4) {
        each_value = ctx2[2];
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context2(ctx2, each_value, i);
          if (each_blocks[i]) {
            each_blocks[i].p(child_ctx, dirty);
          } else {
            each_blocks[i] = create_each_block2(child_ctx);
            each_blocks[i].c();
            each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
          }
        }
        for (; i < each_blocks.length; i += 1) {
          each_blocks[i].d(1);
        }
        each_blocks.length = each_value.length;
      }
    },
    d(detaching) {
      destroy_each(each_blocks, detaching);
      if (detaching)
        detach(each_1_anchor);
    }
  };
}
function create_each_block2(ctx) {
  let li;
  let t0_value = ctx[18] + "";
  let t0;
  let t1;
  return {
    c() {
      li = element("li");
      t0 = text(t0_value);
      t1 = space();
    },
    m(target, anchor) {
      insert(target, li, anchor);
      append(li, t0);
      append(li, t1);
    },
    p(ctx2, dirty) {
      if (dirty & 4 && t0_value !== (t0_value = ctx2[18] + ""))
        set_data(t0, t0_value);
    },
    d(detaching) {
      if (detaching)
        detach(li);
    }
  };
}
function create_if_block2(ctx) {
  let td;
  let div;
  function select_block_type_2(ctx2, dirty) {
    if (ctx2[6] > 0 && ctx2[7])
      return create_if_block_12;
    return create_else_block2;
  }
  let current_block_type = select_block_type_2(ctx, -1);
  let if_block = current_block_type(ctx);
  return {
    c() {
      td = element("td");
      div = element("div");
      if_block.c();
      attr(div, "class", "encounter-xp difficulty");
    },
    m(target, anchor) {
      insert(target, td, anchor);
      append(td, div);
      if_block.m(div, null);
    },
    p(ctx2, dirty) {
      if (current_block_type === (current_block_type = select_block_type_2(ctx2, dirty)) && if_block) {
        if_block.p(ctx2, dirty);
      } else {
        if_block.d(1);
        if_block = current_block_type(ctx2);
        if (if_block) {
          if_block.c();
          if_block.m(div, null);
        }
      }
    },
    d(detaching) {
      if (detaching)
        detach(td);
      if_block.d();
    }
  };
}
function create_else_block2(ctx) {
  let t;
  return {
    c() {
      t = text("-");
    },
    m(target, anchor) {
      insert(target, t, anchor);
    },
    p: noop,
    d(detaching) {
      if (detaching)
        detach(t);
    }
  };
}
function create_if_block_12(ctx) {
  let span;
  let strong;
  let t_value = ctx[7].difficulty + "";
  let t;
  let span_aria_label_value;
  let span_class_value;
  return {
    c() {
      span = element("span");
      strong = element("strong");
      t = text(t_value);
      attr(strong, "class", "difficulty-label svelte-bf6d6a");
      attr(span, "aria-label", span_aria_label_value = formatDifficultyReport(ctx[7]));
      attr(span, "class", span_class_value = "" + (null_to_empty(ctx[7].difficulty.toLowerCase()) + " svelte-bf6d6a"));
    },
    m(target, anchor) {
      insert(target, span, anchor);
      append(span, strong);
      append(strong, t);
    },
    p(ctx2, dirty) {
      if (dirty & 128 && t_value !== (t_value = ctx2[7].difficulty + ""))
        set_data(t, t_value);
      if (dirty & 128 && span_aria_label_value !== (span_aria_label_value = formatDifficultyReport(ctx2[7]))) {
        attr(span, "aria-label", span_aria_label_value);
      }
      if (dirty & 128 && span_class_value !== (span_class_value = "" + (null_to_empty(ctx2[7].difficulty.toLowerCase()) + " svelte-bf6d6a"))) {
        attr(span, "class", span_class_value);
      }
    },
    d(detaching) {
      if (detaching)
        detach(span);
    }
  };
}
function create_fragment2(ctx) {
  let tr;
  let td0;
  let t0;
  let t1;
  let show_if_1 = ctx[5].includes("creatures");
  let t2;
  let show_if = ctx[5].includes("players");
  let t3;
  let t4;
  let td1;
  let div2;
  let div0;
  let open_action;
  let t5;
  let div1;
  let addButton_action;
  let mounted;
  let dispose;
  let if_block0 = show_if_1 && create_if_block_42(ctx);
  let if_block1 = show_if && create_if_block_22(ctx);
  let if_block2 = ctx[4].data.displayDifficulty && create_if_block2(ctx);
  return {
    c() {
      tr = element("tr");
      td0 = element("td");
      t0 = text(ctx[0]);
      t1 = space();
      if (if_block0)
        if_block0.c();
      t2 = space();
      if (if_block1)
        if_block1.c();
      t3 = space();
      if (if_block2)
        if_block2.c();
      t4 = space();
      td1 = element("td");
      div2 = element("div");
      div0 = element("div");
      t5 = space();
      div1 = element("div");
      attr(div0, "class", "svelte-bf6d6a");
      attr(div1, "aria-label", "Add to Encounter");
      attr(div1, "class", "svelte-bf6d6a");
      attr(div2, "class", "icons svelte-bf6d6a");
      attr(tr, "class", "encounter-row");
    },
    m(target, anchor) {
      insert(target, tr, anchor);
      append(tr, td0);
      append(td0, t0);
      append(tr, t1);
      if (if_block0)
        if_block0.m(tr, null);
      append(tr, t2);
      if (if_block1)
        if_block1.m(tr, null);
      append(tr, t3);
      if (if_block2)
        if_block2.m(tr, null);
      append(tr, t4);
      append(tr, td1);
      append(td1, div2);
      append(div2, div0);
      append(div2, t5);
      append(div2, div1);
      if (!mounted) {
        dispose = [
          action_destroyer(open_action = ctx[8].call(null, div0)),
          action_destroyer(addButton_action = ctx[9].call(null, div1)),
          listen(div1, "click", ctx[10])
        ];
        mounted = true;
      }
    },
    p(ctx2, [dirty]) {
      if (dirty & 1)
        set_data(t0, ctx2[0]);
      if (dirty & 32)
        show_if_1 = ctx2[5].includes("creatures");
      if (show_if_1) {
        if (if_block0) {
          if_block0.p(ctx2, dirty);
        } else {
          if_block0 = create_if_block_42(ctx2);
          if_block0.c();
          if_block0.m(tr, t2);
        }
      } else if (if_block0) {
        if_block0.d(1);
        if_block0 = null;
      }
      if (dirty & 32)
        show_if = ctx2[5].includes("players");
      if (show_if) {
        if (if_block1) {
          if_block1.p(ctx2, dirty);
        } else {
          if_block1 = create_if_block_22(ctx2);
          if_block1.c();
          if_block1.m(tr, t3);
        }
      } else if (if_block1) {
        if_block1.d(1);
        if_block1 = null;
      }
      if (ctx2[4].data.displayDifficulty) {
        if (if_block2) {
          if_block2.p(ctx2, dirty);
        } else {
          if_block2 = create_if_block2(ctx2);
          if_block2.c();
          if_block2.m(tr, t4);
        }
      } else if (if_block2) {
        if_block2.d(1);
        if_block2 = null;
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(tr);
      if (if_block0)
        if_block0.d();
      if (if_block1)
        if_block1.d();
      if (if_block2)
        if_block2.d();
      mounted = false;
      run_all(dispose);
    }
  };
}
function instance2($$self, $$props, $$invalidate) {
  let { name = "Encounter" } = $$props;
  let { creatures } = $$props;
  let { players } = $$props;
  let { hide: hide2 = [] } = $$props;
  let { xp } = $$props;
  let { playerLevels } = $$props;
  let { plugin } = $$props;
  let { headers } = $$props;
  const creatureMap = /* @__PURE__ */ new Map();
  const rollerMap = /* @__PURE__ */ new Map();
  let totalXP = [...creatureMap].reduce((a, c) => a + c[0].xp * c[1], 0);
  for (let [creature, count] of creatures) {
    let number = Number(count);
    if (plugin.canUseDiceRoller) {
      let roller = plugin.getRoller(`${count}`);
      roller.on("new-result", () => {
        creatureMap.set(creature, roller.result);
        $$invalidate(6, totalXP = [...creatureMap].reduce((a, c) => a + c[0].xp * c[1], 0));
      });
      rollerMap.set(creature, roller);
      roller.roll();
    } else {
      creatureMap.set(creature, number);
    }
  }
  let difficulty;
  const open = (node) => {
    new import_obsidian6.ExtraButtonComponent(node).setIcon(START_ENCOUNTER).setTooltip("Begin Encounter").onClick(() => __awaiter(void 0, void 0, void 0, function* () {
      if (!plugin.view) {
        yield plugin.addTrackerView();
      }
      const view = plugin.view;
      const creatures2 = [...creatureMap].map(([creature, number]) => {
        if (isNaN(Number(number)) || number < 1)
          return [creature];
        return [...Array(number).keys()].map((v) => Creature.from(creature));
      }).flat();
      view === null || view === void 0 ? void 0 : view.newEncounter({ name, players, creatures: creatures2, xp });
      plugin.app.workspace.revealLeaf(view.leaf);
    }));
  };
  const addButton = (node) => {
    new import_obsidian6.ExtraButtonComponent(node).setIcon("plus-with-circle");
  };
  const add = (evt) => __awaiter(void 0, void 0, void 0, function* () {
    if (!plugin.view) {
      yield plugin.addTrackerView();
    }
    const view = plugin.view;
    const creatures2 = [...creatureMap].map(([creature, number]) => {
      if (isNaN(Number(number)) || number < 1)
        return [creature];
      return [...Array(number).keys()].map((v) => Creature.from(creature));
    }).flat();
    view.addCreatures(creatures2, true);
  });
  const rollerEl = (node, creature) => {
    var _a, _b;
    if (plugin.canUseDiceRoller && rollerMap.has(creature) && !rollerMap.get(creature).isStatic) {
      node.appendChild((_b = (_a = rollerMap.get(creature)) === null || _a === void 0 ? void 0 : _a.containerEl) !== null && _b !== void 0 ? _b : createSpan({ text: `${creatureMap.get(creature)}` }));
    } else {
      node.setText(`${creatureMap.get(creature)}`);
    }
  };
  const joiner = (index, length) => {
    if (length == 1 || index == 0)
      return "";
    const delim = length > 2 ? "," : "";
    if (index == length - 1)
      return `${delim} and `;
    return `${delim} `;
  };
  const label = (creature) => {
    if (!creature)
      return;
    let label2 = [];
    if (creature.hp) {
      label2.push(`HP: ${creature.hp}`);
    }
    if (creature.ac) {
      label2.push(`AC: ${creature.ac}`);
    }
    if (creature.modifier) {
      label2.push(`MOD: ${creature.modifier}`);
    }
    return `${label2.join(", ")}`;
  };
  $$self.$$set = ($$props2) => {
    if ("name" in $$props2)
      $$invalidate(0, name = $$props2.name);
    if ("creatures" in $$props2)
      $$invalidate(1, creatures = $$props2.creatures);
    if ("players" in $$props2)
      $$invalidate(2, players = $$props2.players);
    if ("hide" in $$props2)
      $$invalidate(3, hide2 = $$props2.hide);
    if ("xp" in $$props2)
      $$invalidate(13, xp = $$props2.xp);
    if ("playerLevels" in $$props2)
      $$invalidate(14, playerLevels = $$props2.playerLevels);
    if ("plugin" in $$props2)
      $$invalidate(4, plugin = $$props2.plugin);
    if ("headers" in $$props2)
      $$invalidate(5, headers = $$props2.headers);
  };
  $$self.$$.update = () => {
    if ($$self.$$.dirty & 16450) {
      $: {
        if (!isNaN(totalXP)) {
          $$invalidate(7, difficulty = encounterDifficulty(playerLevels, [...creatures].map((creature) => creature[0].xp)));
        }
      }
    }
  };
  return [
    name,
    creatures,
    players,
    hide2,
    plugin,
    headers,
    totalXP,
    difficulty,
    open,
    addButton,
    add,
    rollerEl,
    label,
    xp,
    playerLevels
  ];
}
var EncounterRow = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance2, create_fragment2, safe_not_equal, {
      name: 0,
      creatures: 1,
      players: 2,
      hide: 3,
      xp: 13,
      playerLevels: 14,
      plugin: 4,
      headers: 5
    }, add_css2);
  }
};
var EncounterRow_default = EncounterRow;

// src/encounter/ui/EncounterTable.svelte
function get_each_context3(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[3] = list[i];
  return child_ctx;
}
function create_if_block_23(ctx) {
  let th;
  return {
    c() {
      th = element("th");
      th.textContent = "Creatures";
    },
    m(target, anchor) {
      insert(target, th, anchor);
    },
    d(detaching) {
      if (detaching)
        detach(th);
    }
  };
}
function create_if_block_13(ctx) {
  let th;
  return {
    c() {
      th = element("th");
      th.textContent = "Players";
    },
    m(target, anchor) {
      insert(target, th, anchor);
    },
    d(detaching) {
      if (detaching)
        detach(th);
    }
  };
}
function create_if_block3(ctx) {
  let th;
  return {
    c() {
      th = element("th");
      th.textContent = "Difficulty";
    },
    m(target, anchor) {
      insert(target, th, anchor);
    },
    d(detaching) {
      if (detaching)
        detach(th);
    }
  };
}
function create_each_block3(ctx) {
  let encounterrow;
  let current;
  const encounterrow_spread_levels = [
    ctx[3],
    { headers: ctx[2] },
    { plugin: ctx[1] }
  ];
  let encounterrow_props = {};
  for (let i = 0; i < encounterrow_spread_levels.length; i += 1) {
    encounterrow_props = assign(encounterrow_props, encounterrow_spread_levels[i]);
  }
  encounterrow = new EncounterRow_default({ props: encounterrow_props });
  return {
    c() {
      create_component(encounterrow.$$.fragment);
    },
    m(target, anchor) {
      mount_component(encounterrow, target, anchor);
      current = true;
    },
    p(ctx2, dirty) {
      const encounterrow_changes = dirty & 7 ? get_spread_update(encounterrow_spread_levels, [
        dirty & 1 && get_spread_object(ctx2[3]),
        dirty & 4 && { headers: ctx2[2] },
        dirty & 2 && { plugin: ctx2[1] }
      ]) : {};
      encounterrow.$set(encounterrow_changes);
    },
    i(local) {
      if (current)
        return;
      transition_in(encounterrow.$$.fragment, local);
      current = true;
    },
    o(local) {
      transition_out(encounterrow.$$.fragment, local);
      current = false;
    },
    d(detaching) {
      destroy_component(encounterrow, detaching);
    }
  };
}
function create_fragment3(ctx) {
  let table;
  let thead;
  let tr;
  let th0;
  let t1;
  let show_if_1 = ctx[2].includes("creatures");
  let t2;
  let show_if = ctx[2].includes("players");
  let t3;
  let t4;
  let th1;
  let t6;
  let tbody;
  let current;
  let if_block0 = show_if_1 && create_if_block_23(ctx);
  let if_block1 = show_if && create_if_block_13(ctx);
  let if_block2 = ctx[1].data.displayDifficulty && create_if_block3(ctx);
  let each_value = ctx[0];
  let each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1) {
    each_blocks[i] = create_each_block3(get_each_context3(ctx, each_value, i));
  }
  const out = (i) => transition_out(each_blocks[i], 1, 1, () => {
    each_blocks[i] = null;
  });
  return {
    c() {
      table = element("table");
      thead = element("thead");
      tr = element("tr");
      th0 = element("th");
      th0.textContent = "Name";
      t1 = space();
      if (if_block0)
        if_block0.c();
      t2 = space();
      if (if_block1)
        if_block1.c();
      t3 = space();
      if (if_block2)
        if_block2.c();
      t4 = space();
      th1 = element("th");
      th1.textContent = "Launch";
      t6 = space();
      tbody = element("tbody");
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].c();
      }
      attr(table, "class", "initiative-tracker encounter-table");
    },
    m(target, anchor) {
      insert(target, table, anchor);
      append(table, thead);
      append(thead, tr);
      append(tr, th0);
      append(tr, t1);
      if (if_block0)
        if_block0.m(tr, null);
      append(tr, t2);
      if (if_block1)
        if_block1.m(tr, null);
      append(tr, t3);
      if (if_block2)
        if_block2.m(tr, null);
      append(tr, t4);
      append(tr, th1);
      append(table, t6);
      append(table, tbody);
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].m(tbody, null);
      }
      current = true;
    },
    p(ctx2, [dirty]) {
      if (ctx2[1].data.displayDifficulty) {
        if (if_block2) {
        } else {
          if_block2 = create_if_block3(ctx2);
          if_block2.c();
          if_block2.m(tr, t4);
        }
      } else if (if_block2) {
        if_block2.d(1);
        if_block2 = null;
      }
      if (dirty & 7) {
        each_value = ctx2[0];
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context3(ctx2, each_value, i);
          if (each_blocks[i]) {
            each_blocks[i].p(child_ctx, dirty);
            transition_in(each_blocks[i], 1);
          } else {
            each_blocks[i] = create_each_block3(child_ctx);
            each_blocks[i].c();
            transition_in(each_blocks[i], 1);
            each_blocks[i].m(tbody, null);
          }
        }
        group_outros();
        for (i = each_value.length; i < each_blocks.length; i += 1) {
          out(i);
        }
        check_outros();
      }
    },
    i(local) {
      if (current)
        return;
      for (let i = 0; i < each_value.length; i += 1) {
        transition_in(each_blocks[i]);
      }
      current = true;
    },
    o(local) {
      each_blocks = each_blocks.filter(Boolean);
      for (let i = 0; i < each_blocks.length; i += 1) {
        transition_out(each_blocks[i]);
      }
      current = false;
    },
    d(detaching) {
      if (detaching)
        detach(table);
      if (if_block0)
        if_block0.d();
      if (if_block1)
        if_block1.d();
      if (if_block2)
        if_block2.d();
      destroy_each(each_blocks, detaching);
    }
  };
}
function instance3($$self, $$props, $$invalidate) {
  let { encounters } = $$props;
  let { plugin } = $$props;
  const headers = [];
  if (encounters.some((encounter) => !encounter.hide.includes("players") && (typeof encounter.players == "boolean" && encounter.players || encounter.players instanceof Array && encounter.players.length)))
    headers.push("players");
  if (encounters.some((encounter) => !encounter.hide.includes("creatures") && encounter.creatures.size))
    headers.push("creatures");
  $$self.$$set = ($$props2) => {
    if ("encounters" in $$props2)
      $$invalidate(0, encounters = $$props2.encounters);
    if ("plugin" in $$props2)
      $$invalidate(1, plugin = $$props2.plugin);
  };
  return [encounters, plugin, headers];
}
var EncounterTable = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance3, create_fragment3, safe_not_equal, { encounters: 0, plugin: 1 });
  }
};
var EncounterTable_default = EncounterTable;

// src/encounter/index.ts
var equivalent = (creature, existing) => {
  return creature.name == existing.name && creature.display == existing.display && creature.ac == existing.ac && creature.hp == existing.hp && creature.modifier == existing.modifier && creature.xp == existing.xp;
};
var EncounterParser = class {
  constructor(plugin) {
    this.plugin = plugin;
  }
  async parse(params) {
    const name = params.name;
    const party = params.party ?? this.plugin.data.defaultParty;
    const players = this.parsePlayers(params);
    const hide2 = this.parseHide(params);
    const rawMonsters = params.creatures ?? [];
    let creatures = await this.parseRawCreatures(rawMonsters);
    const xp = params.xp ?? null;
    const playerLevels = this.plugin.data.players.map((p) => p.level).filter((p) => p);
    return {
      name,
      players,
      party,
      hide: hide2,
      creatures,
      xp,
      playerLevels
    };
  }
  parseHide(params) {
    if (!("hide" in (params ?? {})))
      return [];
    if (typeof params.hide == "string")
      return ["creatures", "players"].filter((v) => params.hide == v);
    if (Array.isArray(params.hide))
      return ["creatures", "players"].filter((v) => params.hide.includes(v));
    return [];
  }
  parsePlayers(params) {
    const partyName = params.party ?? this.plugin.data.defaultParty;
    const playersToReturn = [];
    const players = params.players;
    if (partyName && this.plugin.data.parties.find((p) => p.name.toLowerCase() == partyName.toLowerCase())) {
      const party = this.plugin.data.parties.find((p) => p.name.toLowerCase() == partyName.toLowerCase());
      playersToReturn.push(...party.players);
    }
    if (players == "none" || players == false) {
      playersToReturn.splice(0, playersToReturn.length);
    } else if (players == true) {
      playersToReturn.push(...this.plugin.data.players.map((p) => p.name));
    } else if (!players && !params.party) {
    } else if (typeof players == "string") {
      playersToReturn.push(players);
    } else if (Array.isArray(players)) {
      playersToReturn.push(...(this.plugin.data.players ?? []).map((p) => p.name).filter((p) => players.map((n) => n.toLowerCase()).includes(p.toLowerCase())));
    }
    return Array.from(new Set(playersToReturn));
  }
  async parseRawCreatures(rawMonsters) {
    const creatureMap = /* @__PURE__ */ new Map();
    if (rawMonsters && Array.isArray(rawMonsters)) {
      for (const raw of rawMonsters) {
        const { creature, number = 1 } = this.parseRawCreature(raw) ?? {};
        if (!creature)
          continue;
        const stats = {
          name: creature.name,
          display: creature.display,
          ac: creature.ac,
          hp: creature.hp,
          modifier: creature.modifier,
          xp: creature.xp
        };
        const existing = [...creatureMap].find(([c]) => equivalent(c, stats));
        if (!existing) {
          creatureMap.set(creature, number);
        } else {
          let amount;
          if (!isNaN(Number(number)) && !isNaN(Number(existing[1]))) {
            amount = Number(number) + existing[1];
          } else {
            amount = `${number} + ${existing[1]}`;
          }
          creatureMap.set(existing[0], amount);
        }
      }
    }
    return creatureMap;
  }
  parseRawCreature(raw) {
    if (!raw)
      return {};
    let monster, number = 1;
    if (typeof raw == "string") {
      const match = raw.match(/(\d+)?:?\s?(.+)/) ?? [];
      number = isNaN(Number(match[1] ?? null)) ? number : Number(match[1]);
      monster = match[2];
    } else if (typeof raw == "object") {
      let entries = Object.entries(raw).flat();
      number = entries[0];
      monster = entries[1];
    }
    if (!monster)
      return {};
    if (typeof number == "string" && !this.plugin.canUseDiceRoller && /\d+d\d+/.test(number)) {
      number = 1;
    }
    if (!isNaN(Number(number)))
      number = Number(number);
    if (!number || typeof number == "number" && number < 1)
      number = 1;
    let name, display, hp, ac, mod, xp;
    if (typeof monster == "string") {
      name = monster.split(/,\s?/)[0];
      [hp, ac, mod, xp] = monster.split(/,\s?/).slice(1).map((v) => isNaN(Number(v)) ? null : Number(v));
    } else if (Array.isArray(monster)) {
      if (typeof monster[0] == "string") {
        name = monster[0];
        display = monster[1];
      } else if (Array.isArray(monster[0])) {
        name = monster[0][0];
        display = monster[0][1];
      }
      [hp, ac, mod, xp] = monster.slice(1).map((v) => isNaN(Number(v)) ? null : Number(v));
    } else if (typeof monster == "object") {
      ({ creature: name, name: display, hp, ac, mod, xp } = monster);
    }
    if (!name || typeof name != "string")
      return {};
    let existing = this.plugin.bestiary.find((c) => c.name == name);
    let creature = existing ? Creature.from(existing) : new Creature({ name });
    creature.display = display ?? creature.name;
    creature.hp = hp ?? creature.hp;
    creature.ac = ac ?? creature.ac;
    creature.modifier = mod ?? creature.modifier;
    creature.xp = xp ?? creature.xp;
    return { creature, number };
  }
};
var EncounterComponent = class {
  constructor(params, encounterEl, plugin) {
    this.params = params;
    this.encounterEl = encounterEl;
    this.plugin = plugin;
    this.display();
  }
  async display() {
    this.instance = new Encounter_default({
      target: this.encounterEl,
      props: {
        plugin: this.plugin,
        name: this.params.name,
        party: this.params.party,
        players: this.params.players,
        playerLevels: this.params.playerLevels,
        creatures: this.params.creatures,
        xp: this.params.xp,
        hide: this.params.hide
      }
    });
  }
};
var EncounterBlock = class extends import_obsidian7.MarkdownRenderChild {
  constructor(plugin, src, containerEl, table = false) {
    super(containerEl);
    this.plugin = plugin;
    this.src = src;
    this.containerEl = containerEl;
    this.table = table;
    this.parser = new EncounterParser(this.plugin);
  }
  onload() {
    if (this.table) {
      this.postprocessTable();
    } else {
      this.postprocess();
    }
  }
  async postprocess() {
    const encounters = this.src.split("---") ?? [];
    const containerEl = this.containerEl.createDiv("encounter-container");
    const empty2 = containerEl.createSpan({
      text: "No encounters created. Please check your syntax and try again."
    });
    for (let encounter of encounters) {
      if (!encounter?.trim().length)
        continue;
      try {
        const params = (0, import_obsidian7.parseYaml)(encounter);
        new EncounterComponent(await this.parser.parse(params), containerEl.createDiv("encounter-instance"), this.plugin);
        empty2.detach();
      } catch (e) {
        console.error(e);
        new import_obsidian7.Notice("Initiative Tracker: here was an issue parsing: \n\n" + encounter);
      }
    }
    this.registerEvent(this.plugin.app.workspace.on("initiative-tracker:unload", () => {
      this.containerEl.empty();
      this.containerEl.createEl("pre").createEl("code", {
        text: `\`\`\`encounter
${this.src}\`\`\``
      });
    }));
  }
  async postprocessTable() {
    const encounterSource = this.src.split("---") ?? [];
    const containerEl = this.containerEl.createDiv("encounter-container");
    const empty2 = containerEl.createSpan({
      text: "No encounters created. Please check your syntax and try again."
    });
    const encounters = [];
    for (let encounter of encounterSource) {
      if (!encounter?.trim().length)
        continue;
      try {
        const params = (0, import_obsidian7.parseYaml)(encounter);
        encounters.push(await this.parser.parse(params));
      } catch (e) {
        console.error(e);
        new import_obsidian7.Notice("Initiative Tracker: here was an issue parsing: \n\n" + encounter);
      }
    }
    if (encounters.length) {
      empty2.detach();
      new EncounterTable_default({
        target: this.containerEl,
        props: {
          encounters,
          plugin: this.plugin
        }
      });
    }
    this.registerEvent(this.plugin.app.workspace.on("initiative-tracker:unload", () => {
      this.containerEl.empty();
      this.containerEl.createEl("pre").createEl("code", {
        text: `\`\`\`encounter-table
${this.src}\`\`\``
      });
    }));
  }
};

// src/encounter/ui/EncounterLine.svelte
var import_obsidian8 = __toModule(require("obsidian"));
function add_css3(target) {
  append_styles(target, "svelte-kf2ut3", ".encounter-line.svelte-kf2ut3.svelte-kf2ut3{display:flex;gap:1rem}.icons.svelte-kf2ut3.svelte-kf2ut3{display:flex}.icons.svelte-kf2ut3>span.svelte-kf2ut3 .clickable-icon{margin-right:0}");
}
function get_each_context4(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[11] = list[i][0];
  child_ctx[12] = list[i][1];
  child_ctx[14] = i;
  return child_ctx;
}
function create_else_block3(ctx) {
  let t;
  return {
    c() {
      t = text("-");
    },
    m(target, anchor) {
      insert(target, t, anchor);
    },
    p: noop,
    d(detaching) {
      if (detaching)
        detach(t);
    }
  };
}
function create_if_block4(ctx) {
  let each_1_anchor;
  let each_value = [...ctx[0]];
  let each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1) {
    each_blocks[i] = create_each_block4(get_each_context4(ctx, each_value, i));
  }
  return {
    c() {
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].c();
      }
      each_1_anchor = empty();
    },
    m(target, anchor) {
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].m(target, anchor);
      }
      insert(target, each_1_anchor, anchor);
    },
    p(ctx2, dirty) {
      if (dirty & 193) {
        each_value = [...ctx2[0]];
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context4(ctx2, each_value, i);
          if (each_blocks[i]) {
            each_blocks[i].p(child_ctx, dirty);
          } else {
            each_blocks[i] = create_each_block4(child_ctx);
            each_blocks[i].c();
            each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
          }
        }
        for (; i < each_blocks.length; i += 1) {
          each_blocks[i].d(1);
        }
        each_blocks.length = each_value.length;
      }
    },
    d(detaching) {
      destroy_each(each_blocks, detaching);
      if (detaching)
        detach(each_1_anchor);
    }
  };
}
function create_each_block4(ctx) {
  let span;
  let t0_value = ctx[6](ctx[14], ctx[0].size) + "";
  let t0;
  let t1;
  let strong;
  let rollerEl_action;
  let t2;
  let t3_value = ctx[11].name + "";
  let t3;
  let t4_value = (ctx[12] == 1 ? "" : "s") + "";
  let t4;
  let t5;
  let span_aria_label_value;
  let mounted;
  let dispose;
  return {
    c() {
      span = element("span");
      t0 = text(t0_value);
      t1 = space();
      strong = element("strong");
      t2 = text("\xA0");
      t3 = text(t3_value);
      t4 = text(t4_value);
      t5 = space();
      attr(span, "aria-label", span_aria_label_value = ctx[7](ctx[11]));
    },
    m(target, anchor) {
      insert(target, span, anchor);
      append(span, t0);
      append(span, t1);
      append(span, strong);
      append(span, t2);
      append(span, t3);
      append(span, t4);
      append(span, t5);
      if (!mounted) {
        dispose = action_destroyer(rollerEl_action = ctx[5].call(null, strong, ctx[11]));
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      if (dirty & 1 && t0_value !== (t0_value = ctx[6](ctx[14], ctx[0].size) + ""))
        set_data(t0, t0_value);
      if (rollerEl_action && is_function(rollerEl_action.update) && dirty & 1)
        rollerEl_action.update.call(null, ctx[11]);
      if (dirty & 1 && t3_value !== (t3_value = ctx[11].name + ""))
        set_data(t3, t3_value);
      if (dirty & 1 && t4_value !== (t4_value = (ctx[12] == 1 ? "" : "s") + ""))
        set_data(t4, t4_value);
      if (dirty & 1 && span_aria_label_value !== (span_aria_label_value = ctx[7](ctx[11]))) {
        attr(span, "aria-label", span_aria_label_value);
      }
    },
    d(detaching) {
      if (detaching)
        detach(span);
      mounted = false;
      dispose();
    }
  };
}
function create_fragment4(ctx) {
  let span4;
  let span0;
  let t0;
  let span3;
  let span1;
  let openButton_action;
  let t1;
  let span2;
  let addButton_action;
  let mounted;
  let dispose;
  function select_block_type(ctx2, dirty) {
    if (ctx2[0].size)
      return create_if_block4;
    return create_else_block3;
  }
  let current_block_type = select_block_type(ctx, -1);
  let if_block = current_block_type(ctx);
  return {
    c() {
      span4 = element("span");
      span0 = element("span");
      if_block.c();
      t0 = space();
      span3 = element("span");
      span1 = element("span");
      t1 = space();
      span2 = element("span");
      attr(span1, "aria-label", "Begin Encounter");
      attr(span1, "class", "svelte-kf2ut3");
      attr(span2, "aria-label", "Add to Encounter");
      attr(span2, "class", "svelte-kf2ut3");
      attr(span3, "class", "icons svelte-kf2ut3");
      attr(span4, "class", "encounter-line encounter-row svelte-kf2ut3");
    },
    m(target, anchor) {
      insert(target, span4, anchor);
      append(span4, span0);
      if_block.m(span0, null);
      append(span4, t0);
      append(span4, span3);
      append(span3, span1);
      append(span3, t1);
      append(span3, span2);
      if (!mounted) {
        dispose = [
          action_destroyer(openButton_action = ctx[1].call(null, span1)),
          listen(span1, "click", stop_propagation(ctx[2])),
          action_destroyer(addButton_action = ctx[3].call(null, span2)),
          listen(span2, "click", stop_propagation(ctx[4]))
        ];
        mounted = true;
      }
    },
    p(ctx2, [dirty]) {
      if (current_block_type === (current_block_type = select_block_type(ctx2, dirty)) && if_block) {
        if_block.p(ctx2, dirty);
      } else {
        if_block.d(1);
        if_block = current_block_type(ctx2);
        if (if_block) {
          if_block.c();
          if_block.m(span0, null);
        }
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(span4);
      if_block.d();
      mounted = false;
      run_all(dispose);
    }
  };
}
function instance4($$self, $$props, $$invalidate) {
  let { creatures } = $$props;
  let { plugin } = $$props;
  const creatureMap = /* @__PURE__ */ new Map();
  const rollerMap = /* @__PURE__ */ new Map();
  for (let [creature, count] of creatures) {
    let number = Number(count);
    if (plugin.canUseDiceRoller) {
      let roller = plugin.getRoller(`${count}`);
      roller.on("new-result", () => {
        creatureMap.set(creature, roller.result);
      });
      rollerMap.set(creature, roller);
      roller.roll();
    } else {
      creatureMap.set(creature, number);
    }
  }
  const openButton = (node) => {
    new import_obsidian8.ExtraButtonComponent(node).setIcon(START_ENCOUNTER);
  };
  const open = () => __awaiter(void 0, void 0, void 0, function* () {
    if (!plugin.view) {
      yield plugin.addTrackerView();
    }
    const view = plugin.view;
    const creatures2 = [...creatureMap].map(([creature, number]) => {
      if (isNaN(Number(number)) || number < 1)
        return [creature];
      return [...Array(number).keys()].map((v) => Creature.from(creature));
    }).flat();
    view === null || view === void 0 ? void 0 : view.newEncounter({ creatures: creatures2 });
    plugin.app.workspace.revealLeaf(view.leaf);
  });
  const addButton = (node) => {
    new import_obsidian8.ExtraButtonComponent(node).setIcon("plus-with-circle");
  };
  const add = (evt) => __awaiter(void 0, void 0, void 0, function* () {
    if (!plugin.view) {
      yield plugin.addTrackerView();
    }
    const view = plugin.view;
    const creatures2 = [...creatureMap].map(([creature, number]) => {
      if (isNaN(Number(number)) || number < 1)
        return [creature];
      return [...Array(number).keys()].map((v) => Creature.from(creature));
    }).flat();
    view.addCreatures(creatures2, true);
  });
  const rollerEl = (node, creature) => {
    var _a, _b;
    if (plugin.canUseDiceRoller && rollerMap.has(creature) && !rollerMap.get(creature).isStatic) {
      node.appendChild((_b = (_a = rollerMap.get(creature)) === null || _a === void 0 ? void 0 : _a.containerEl) !== null && _b !== void 0 ? _b : createSpan({ text: `${creatureMap.get(creature)}` }));
    } else {
      node.setText(`${creatureMap.get(creature)}`);
    }
  };
  const joiner = (index, length) => {
    if (length == 1 || index == 0)
      return "";
    const delim = length > 2 ? "," : "";
    if (index == length - 1)
      return `${delim} and `;
    return `${delim} `;
  };
  const label = (creature) => {
    if (!creature)
      return;
    let label2 = [];
    if (creature.hp) {
      label2.push(`HP: ${creature.hp}`);
    }
    if (creature.ac) {
      label2.push(`AC: ${creature.ac}`);
    }
    if (creature.modifier) {
      label2.push(`MOD: ${creature.modifier}`);
    }
    return `${label2.join(", ")}`;
  };
  $$self.$$set = ($$props2) => {
    if ("creatures" in $$props2)
      $$invalidate(0, creatures = $$props2.creatures);
    if ("plugin" in $$props2)
      $$invalidate(8, plugin = $$props2.plugin);
  };
  return [creatures, openButton, open, addButton, add, rollerEl, joiner, label, plugin];
}
var EncounterLine = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance4, create_fragment4, safe_not_equal, { creatures: 0, plugin: 8 }, add_css3);
  }
};
var EncounterLine_default = EncounterLine;

// src/utils/srd-bestiary.ts
var BESTIARY = [
  {
    name: "Aboleth",
    size: "Large",
    source: "SRD",
    type: "aberration",
    subtype: "",
    alignment: "lawful evil",
    ac: 17,
    hp: 135,
    hit_dice: "18d10",
    speed: "10 ft., swim 40 ft.",
    stats: [21, 9, 15, 18, 15, 18],
    saves: [
      {
        constitution: 6
      },
      {
        intelligence: 8
      },
      {
        wisdom: 6
      }
    ],
    skillsaves: [
      {
        history: 12
      },
      {
        perception: 10
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 20",
    languages: "Deep Speech, telepathy 120 ft.",
    cr: "10",
    traits: [
      {
        name: "Amphibious",
        desc: "The aboleth can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Mucous Cloud",
        desc: "While underwater, the aboleth is surrounded by transformative mucus. A creature that touches the aboleth or that hits it with a melee attack while within 5 ft. of it must make a DC 14 Constitution saving throw. On a failure, the creature is diseased for 1d4 hours. The diseased creature can breathe only underwater.",
        attack_bonus: 0
      },
      {
        name: "Probing Telepathy",
        desc: "If a creature communicates telepathically with the aboleth, the aboleth learns the creature's greatest desires if the aboleth can see the creature.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The aboleth makes three tentacle attacks.",
        attack_bonus: 0
      },
      {
        name: "Tentacle",
        desc: "Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 12 (2d6 + 5) bludgeoning damage. If the target is a creature, it must succeed on a DC 14 Constitution saving throw or become diseased. The disease has no effect for 1 minute and can be removed by any magic that cures disease. After 1 minute, the diseased creature's skin becomes translucent and slimy, the creature can't regain hit points unless it is underwater, and the disease can be removed only by heal or another disease-curing spell of 6th level or higher. When the creature is outside a body of water, it takes 6 (1d12) acid damage every 10 minutes unless moisture is applied to the skin before 10 minutes have passed.",
        attack_bonus: 9,
        damage_dice: "2d6",
        damage_bonus: 5
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +9 to hit, reach 10 ft. one target. Hit: 15 (3d6 + 5) bludgeoning damage.",
        attack_bonus: 9,
        damage_dice: "3d6",
        damage_bonus: 5
      },
      {
        name: "Enslave (3/day)",
        desc: "The aboleth targets one creature it can see within 30 ft. of it. The target must succeed on a DC 14 Wisdom saving throw or be magically charmed by the aboleth until the aboleth dies or until it is on a different plane of existence from the target. The charmed target is under the aboleth's control and can't take reactions, and the aboleth and the target can communicate telepathically with each other over any distance.\nWhenever the charmed target takes damage, the target can repeat the saving throw. On a success, the effect ends. No more than once every 24 hours, the target can also repeat the saving throw when it is at least 1 mile away from the aboleth.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The aboleth makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Swipe",
        desc: "The aboleth makes one tail attack.",
        attack_bonus: 0
      },
      {
        name: "Psychic Drain (Costs 2 Actions)",
        desc: "One creature charmed by the aboleth takes 10 (3d6) psychic damage, and the aboleth regains hit points equal to the damage the creature takes.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Acolyte",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 10,
    hp: 9,
    hit_dice: "2d8",
    speed: "30 ft.",
    stats: [10, 10, 10, 10, 14, 11],
    skillsaves: [
      {
        medicine: 4
      },
      {
        religion: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 12",
    languages: "any one language (usually Common)",
    cr: "1/4",
    traits: [],
    actions: [
      {
        name: "Club",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage.",
        attack_bonus: 2,
        damage_dice: "1d4"
      }
    ],
    spells: [
      "The acolyte is a 1st-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 12, +4 to hit with spell attacks). The acolyte has following cleric spells prepared:",
      {
        "Cantrips (at will)": "light, sacred flame, thaumaturgy"
      },
      {
        "1st level (3 slots)": "bless, cure wounds, sanctuary"
      }
    ]
  },
  {
    name: "Adult Black Dragon",
    size: "Huge",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 19,
    hp: 195,
    hit_dice: "17d12",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [23, 14, 21, 14, 13, 17],
    saves: [
      {
        dexterity: 7
      },
      {
        constitution: 10
      },
      {
        wisdom: 6
      },
      {
        charisma: 8
      }
    ],
    skillsaves: [
      null,
      {
        perception: 11
      },
      {
        stealth: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 21",
    languages: "Common, Draconic",
    cr: "14",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 4 (1d8) acid damage.",
        attack_bonus: 11,
        damage_dice: "2d10 + 1d8",
        damage_bonus: 6
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",
        attack_bonus: 11,
        damage_dice: "2d6",
        damage_bonus: 6
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",
        attack_bonus: 11,
        damage_dice: "2d8",
        damage_bonus: 6
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Acid Breath (Recharge 5-6)",
        desc: "The dragon exhales acid in a 60-foot line that is 5 feet wide. Each creature in that line must make a DC 18 Dexterity saving throw, taking 54 (12d8) acid damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "12d8"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Adult Blue Dracolich",
    size: "Huge",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "lawful evil",
    ac: 19,
    hp: 225,
    hit_dice: "18d12",
    speed: "40 ft., burrow 30 ft., fly 80 ft.",
    stats: [25, 10, 23, 16, 15, 19],
    skillsaves: [
      {
        perception: 12
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "necrotic",
    damage_immunities: "lightning, poison",
    condition_immunities: "charmed, exhaustion, frightened, paralyzed, poisoned",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 22",
    languages: "Common, Draconic",
    cr: "17",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dracolich fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The dracolich has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dracolich can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 18 (2d10 + 7) piercing damage plus 5 (1d10) lightning damage.",
        attack_bonus: 12,
        damage_dice: "2d10 + 1d10",
        damage_bonus: 7
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 14 (2d6 + 7) slashing damage.",
        attack_bonus: 12,
        damage_dice: "2d6",
        damage_bonus: 7
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +12 to hit, reach 15 ft., one target. Hit: 16 (2d8 + 7) bludgeoning damage.",
        attack_bonus: 12,
        damage_dice: "2d8",
        damage_bonus: 7
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dracolich's choice that is within 120 feet of the dracolich and aware of it must succeed on a DC 18 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dracolich's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Lightning Breath (Recharge 5-6)",
        desc: "The dracolich exhales lightning in a 90-foot line that is 5 feet wide. Each creature in that line must make a DC 20 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "12d10"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dracolich makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dracolich makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dracolich beats its tattered wings. Each creature within 10 ft. of the dracolich must succeed on a DC 21 Dexterity saving throw or take 14 (2d6 + 7) bludgeoning damage and be knocked prone. After beating its wings this way, the dracolich can fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Adult Blue Dragon",
    size: "Huge",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful evil",
    ac: 19,
    hp: 225,
    hit_dice: "18d12",
    speed: "40 ft., burrow 30 ft., fly 80 ft.",
    stats: [25, 10, 23, 16, 15, 19],
    saves: [
      {
        dexterity: 5
      },
      {
        constitution: 11
      },
      {
        wisdom: 7
      },
      {
        charisma: 9
      }
    ],
    skillsaves: [
      null,
      {
        perception: 12
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 22",
    languages: "Common, Draconic",
    cr: "16",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 18 (2d10 + 7) piercing damage plus 5 (1d10) lightning damage.",
        attack_bonus: 12,
        damage_dice: "2d10 + 1d10",
        damage_bonus: 7
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 14 (2d6 + 7) slashing damage.",
        attack_bonus: 12,
        damage_dice: "2d6",
        damage_bonus: 7
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +12 to hit, reach 15 ft., one target. Hit: 16 (2d8 + 7) bludgeoning damage.",
        attack_bonus: 12,
        damage_dice: "2d8",
        damage_bonus: 7
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 ft. of the dragon and aware of it must succeed on a DC 17 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Lightning Breath (Recharge 5-6)",
        desc: "The dragon exhales lightning in a 90-foot line that is 5 ft. wide. Each creature in that line must make a DC 19 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "12d10"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 20 Dexterity saving throw or take 14 (2d6 + 7) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Adult Brass Dragon",
    size: "Huge",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic good",
    ac: 18,
    hp: 172,
    hit_dice: "15d12",
    speed: "40 ft., burrow 40 ft., fly 80 ft.",
    stats: [23, 10, 21, 14, 13, 17],
    saves: [
      {
        dexterity: 5
      },
      {
        constitution: 10
      },
      {
        wisdom: 6
      },
      {
        charisma: 8
      }
    ],
    skillsaves: [
      null,
      {
        history: 7
      },
      {
        persuasion: 8
      },
      {
        perception: 11
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 21",
    languages: "Common, Draconic",
    cr: "13",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +11 to hit, reach,.0 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",
        attack_bonus: 11,
        damage_dice: "2d10",
        damage_bonus: 6
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",
        attack_bonus: 11,
        damage_dice: "2d6",
        damage_bonus: 6
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",
        attack_bonus: 11,
        damage_dice: "2d8",
        damage_bonus: 6
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nFire Breath. The dragon exhales fire in an 60-foot line that is 5 feet wide. Each creature in that line must make a DC 18 Dexterity saving throw, taking 45 (13d6) fire damage on a failed save, or half as much damage on a successful one.\nSleep Breath. The dragon exhales sleep gas in a 60-foot cone. Each creature in that area must succeed on a DC 18 Constitution saving throw or fall unconscious for 10 minutes. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.",
        attack_bonus: 0,
        damage_dice: "13d6"
      }
    ]
  },
  {
    name: "Adult Bronze Dragon",
    size: "Huge",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 19,
    hp: 212,
    hit_dice: "17d12",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [25, 10, 23, 16, 15, 19],
    saves: [
      {
        dexterity: 5
      },
      {
        constitution: 11
      },
      {
        wisdom: 7
      },
      {
        charisma: 9
      }
    ],
    skillsaves: [
      {
        insight: 7
      },
      {
        perception: 12
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 22",
    languages: "Common, Draconic",
    cr: "15",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 18 (2d10 + 7) piercing damage.",
        attack_bonus: 12,
        damage_dice: "2d10",
        damage_bonus: 7
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 14 (2d6 + 7) slashing damage.",
        attack_bonus: 12,
        damage_dice: "2d6",
        damage_bonus: 7
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +12 to hit, reach 15 ft., one target. Hit: 16 (2d8 + 7) bludgeoning damage.",
        attack_bonus: 12,
        damage_dice: "2d8",
        damage_bonus: 7
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 17 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nLightning Breath. The dragon exhales lightning in a 90-foot line that is 5 feet wide. Each creature in that line must make a DC 19 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.\nRepulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 19 Strength saving throw. On a failed save, the creature is pushed 60 feet away from the dragon.",
        attack_bonus: 0,
        damage_dice: "12d10"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 20 Dexterity saving throw or take 14 (2d6 + 7) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Adult Copper Dragon",
    size: "Huge",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic good",
    ac: 18,
    hp: 184,
    hit_dice: "16d12",
    speed: "40 ft., climb 40 ft., fly 80 ft.",
    stats: [23, 12, 21, 18, 15, 17],
    saves: [
      {
        dexterity: 6
      },
      {
        constitution: 10
      },
      {
        wisdom: 7
      },
      {
        charisma: 8
      }
    ],
    skillsaves: [
      {
        deception: 8
      },
      {
        perception: 12
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 22",
    languages: "Common, Draconic",
    cr: "14",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",
        attack_bonus: 11,
        damage_dice: "2d10",
        damage_bonus: 6
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",
        attack_bonus: 11,
        damage_dice: "2d6",
        damage_bonus: 6
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",
        attack_bonus: 11,
        damage_dice: "2d8",
        damage_bonus: 6
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nAcid Breath. The dragon exhales acid in an 60-foot line that is 5 feet wide. Each creature in that line must make a DC 18 Dexterity saving throw, taking 54 (12d8) acid damage on a failed save, or half as much damage on a successful one.\nSlowing Breath. The dragon exhales gas in a 60-foot cone. Each creature in that area must succeed on a DC 18 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.",
        attack_bonus: 0,
        damage_dice: "12d8"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Adult Gold Dragon",
    size: "Huge",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 19,
    hp: 256,
    hit_dice: "19d12",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [27, 14, 25, 16, 15, 24],
    saves: [
      {
        dexterity: 8
      },
      {
        constitution: 13
      },
      {
        wisdom: 8
      },
      {
        charisma: 13
      }
    ],
    skillsaves: [
      {
        insight: 8
      },
      {
        persuasion: 13
      },
      {
        perception: 14
      },
      {
        stealth: 8
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 24",
    languages: "Common, Draconic",
    cr: "17",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",
        attack_bonus: 14,
        damage_dice: "2d10",
        damage_bonus: 8
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +14 to hit, reach 5 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",
        attack_bonus: 14,
        damage_dice: "2d6",
        damage_bonus: 8
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",
        attack_bonus: 14,
        damage_dice: "2d8",
        damage_bonus: 8
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 21 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nFire Breath. The dragon exhales fire in a 60-foot cone. Each creature in that area must make a DC 21 Dexterity saving throw, taking 66 (12d10) fire damage on a failed save, or half as much damage on a successful one.\nWeakening Breath. The dragon exhales gas in a 60-foot cone. Each creature in that area must succeed on a DC 21 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0,
        damage_dice: "12d10"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Adult Green Dragon",
    size: "Huge",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful evil",
    ac: 19,
    hp: 207,
    hit_dice: "18d12",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [23, 12, 21, 18, 15, 17],
    saves: [
      {
        dexterity: 6
      },
      {
        constitution: 10
      },
      {
        wisdom: 7
      },
      {
        charisma: 8
      }
    ],
    skillsaves: [
      {
        deception: 8
      },
      {
        insight: 7
      },
      {
        persuasion: 8
      },
      {
        perception: 12
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 22",
    languages: "Common, Draconic",
    cr: "15",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 7 (2d6) poison damage.",
        attack_bonus: 11,
        damage_dice: "2d10 + 2d6",
        damage_bonus: 6
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",
        attack_bonus: 11,
        damage_dice: "2d6",
        damage_bonus: 6
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",
        attack_bonus: 11,
        damage_dice: "2d8",
        damage_bonus: 6
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours .",
        attack_bonus: 0
      },
      {
        name: "Poison Breath (Recharge 5-6)",
        desc: "The dragon exhales poisonous gas in a 60-foot cone. Each creature in that area must make a DC 18 Constitution saving throw, taking 56 (16d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "16d6"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Adult Red Dragon",
    size: "Huge",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 19,
    hp: 256,
    hit_dice: "19d12",
    speed: "40 ft., climb 40 ft., fly 80 ft.",
    stats: [27, 10, 25, 16, 13, 21],
    saves: [
      {
        dexterity: 6
      },
      {
        constitution: 13
      },
      {
        wisdom: 7
      },
      {
        charisma: 11
      }
    ],
    skillsaves: [
      {
        perception: 13
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 23",
    languages: "Common, Draconic",
    cr: "17",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 7 (2d6) fire damage.",
        attack_bonus: 14,
        damage_dice: "2d10 + 2d6",
        damage_bonus: 8
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +14 to hit, reach 5 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",
        attack_bonus: 14,
        damage_dice: "2d6",
        damage_bonus: 8
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",
        attack_bonus: 14,
        damage_dice: "2d8",
        damage_bonus: 8
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 ft. of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Fire Breath (Recharge 5-6)",
        desc: "The dragon exhales fire in a 60-foot cone. Each creature in that area must make a DC 21 Dexterity saving throw, taking 63 (18d6) fire damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "18d6"
      },
      {
        name: "Lair Actions",
        desc: "On initiative count 20 (losing initiative ties), the dragon takes a lair action to cause one of the following effects: the dragon can't use the same effect two rounds in a row:\n\u2022 Magma erupts from a point on the ground the dragon can see within 120 feet of it, creating a 20-foot-high, 5-foot-radius geyser. Each creature in the geyser's area must make a DC 15 Dexterity saving throw, taking 21 (6d6) fire damage on a failed save, or half as much damage on a successful one.\n\u2022 A tremor shakes the lair in a 60-foot-radius around the dragon. Each creature other than the dragon on the ground in that area must succeed on a DC 15 Dexterity saving throw or be knocked prone.\n\u2022 Volcanic gases form a cloud in a 20-foot-radius sphere centered on a point the dragon can see within 120 feet of it. The sphere spreads around corners, and its area is lightly obscured. It lasts until initiative count 20 on the next round. Each creature that starts its turn in the cloud must succeed on a DC 13 Constitution saving throw or be poisoned until the end of its turn. While poisoned in this way, a creature is incapacitated.",
        attack_bonus: 0,
        damage_dice: "6d6"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Adult Silver Dragon",
    size: "Huge",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 19,
    hp: 243,
    hit_dice: "18d12",
    speed: "40 ft., fly 80 ft.",
    stats: [27, 10, 25, 16, 13, 21],
    saves: [
      {
        dexterity: 5
      },
      {
        constitution: 12
      },
      {
        wisdom: 6
      },
      {
        charisma: 10
      }
    ],
    skillsaves: [
      {
        arcana: 8
      },
      {
        history: 8
      },
      {
        perception: 11
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 21",
    languages: "Common, Draconic",
    cr: "16",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",
        attack_bonus: 13,
        damage_dice: "2d10",
        damage_bonus: 8
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +13 to hit, reach 5 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",
        attack_bonus: 13,
        damage_dice: "2d6",
        damage_bonus: 8
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +13 to hit, reach 15 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",
        attack_bonus: 13,
        damage_dice: "2d8",
        damage_bonus: 8
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 18 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nCold Breath. The dragon exhales an icy blast in a 60-foot cone. Each creature in that area must make a DC 20 Constitution saving throw, taking 58 (13d8) cold damage on a failed save, or half as much damage on a successful one.\nParalyzing Breath. The dragon exhales paralyzing gas in a 60-foot cone. Each creature in that area must succeed on a DC 20 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0,
        damage_dice: "13d8"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Adult White Dragon",
    size: "Huge",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 18,
    hp: 200,
    hit_dice: "16d12",
    speed: "40 ft., burrow 30 ft., fly 80 ft., swim 40 ft.",
    stats: [22, 10, 22, 8, 12, 12],
    saves: [
      {
        dexterity: 5
      },
      {
        constitution: 11
      },
      {
        wisdom: 6
      },
      {
        charisma: 6
      }
    ],
    skillsaves: [
      {
        perception: 11
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 21",
    languages: "Common, Draconic",
    cr: "13",
    traits: [
      {
        name: "Ice Walk",
        desc: "The dragon can move across and climb icy surfaces without needing to make an ability check. Additionally, difficult terrain composed of ice or snow doesn't cost it extra moment.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 4 (1d8) cold damage.",
        attack_bonus: 11,
        damage_dice: "2d10 + 1d8",
        damage_bonus: 6
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",
        attack_bonus: 11,
        damage_dice: "2d6",
        damage_bonus: 6
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",
        attack_bonus: 11,
        damage_dice: "2d8",
        damage_bonus: 6
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 ft. of the dragon and aware of it must succeed on a DC 14 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Cold Breath (Recharge 5-6)",
        desc: "The dragon exhales an icy blast in a 60-foot cone. Each creature in that area must make a DC 19 Constitution saving throw, taking 54 (12d8) cold damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "12d8"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Air Elemental",
    size: "Large",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral",
    ac: 15,
    hp: 90,
    hit_dice: "12d10",
    speed: "fly 90 ft. (hover)",
    stats: [14, 20, 14, 6, 10, 6],
    damage_vulnerabilities: "",
    damage_resistances: "lightning; thunder; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "poison",
    condition_immunities: "exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Auran",
    cr: "5",
    traits: [
      {
        name: "Air Form",
        desc: "The elemental can enter a hostile creature's space and stop there. It can move through a space as narrow as 1 inch wide without squeezing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The elemental makes two slam attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) bludgeoning damage.",
        attack_bonus: 8,
        damage_dice: "2d8",
        damage_bonus: 5
      },
      {
        name: "Whirlwind (Recharge 4-6)",
        desc: "Each creature in the elemental's space must make a DC 13 Strength saving throw. On a failure, a target takes 15 (3d8 + 2) bludgeoning damage and is flung up 20 feet away from the elemental in a random direction and knocked prone. If a thrown target strikes an object, such as a wall or floor, the target takes 3 (1d6) bludgeoning damage for every 10 feet it was thrown. If the target is thrown at another creature, that creature must succeed on a DC 13 Dexterity saving throw or take the same damage and be knocked prone.\nIf the saving throw is successful, the target takes half the bludgeoning damage and isn't flung away or knocked prone.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ancient Black Dragon",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 22,
    hp: 367,
    hit_dice: "21d20",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [27, 14, 25, 16, 15, 19],
    saves: [
      {
        dexterity: 9
      },
      {
        constitution: 14
      },
      {
        wisdom: 9
      },
      {
        charisma: 11
      }
    ],
    skillsaves: [
      {
        perception: 16
      },
      {
        stealth: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 26",
    languages: "Common, Draconic",
    cr: "21",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack:+ 15 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 9 (2d8) acid damage.",
        attack_bonus: 15,
        damage_dice: "2d10 + 2d8",
        damage_bonus: 8
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +15 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",
        attack_bonus: 15,
        damage_dice: "2d6",
        damage_bonus: 8
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +15 to hit, reach 20 ft ., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",
        attack_bonus: 15,
        damage_dice: "2d8",
        damage_bonus: 8
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Acid Breath (Recharge 5-6)",
        desc: "The dragon exhales acid in a 90-foot line that is 10 feet wide. Each creature in that line must make a DC 22 Dexterity saving throw, taking 67 (15d8) acid damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 23 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ancient Blue Dragon",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful evil",
    ac: 22,
    hp: 481,
    hit_dice: "26d20",
    speed: "40 ft., burrow 40 ft., fly 80 ft.",
    stats: [29, 10, 27, 18, 17, 21],
    saves: [
      {
        dexterity: 7
      },
      {
        constitution: 15
      },
      {
        wisdom: 10
      },
      {
        charisma: 12
      }
    ],
    skillsaves: [
      {
        perception: 17
      },
      {
        stealth: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 27",
    languages: "Common, Draconic",
    cr: "23",
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +16 to hit, reach 15 ft., one target. Hit: 20 (2d10 + 9) piercing damage plus 11 (2d10) lightning damage.",
        attack_bonus: 16,
        damage_dice: "2d10 + 2d10",
        damage_bonus: 9
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +16 to hit, reach 10 ft., one target. Hit: 16 (2d6 + 9) slashing damage.",
        attack_bonus: 16,
        damage_dice: "2d6",
        damage_bonus: 9
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +16 to hit, reach 20 ft., one target. Hit: 18 (2d8 + 9) bludgeoning damage.",
        attack_bonus: 16,
        damage_dice: "2d8",
        damage_bonus: 9
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 20 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Lightning Breath (Recharge 5-6)",
        desc: "The dragon exhales lightning in a 120-foot line that is 10 feet wide. Each creature in that line must make a DC 23 Dexterity saving throw, taking 88 (16d10) lightning damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "16d10"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 24 Dexterity saving throw or take 16 (2d6 + 9) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ancient Brass Dragon",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic good",
    ac: 20,
    hp: 297,
    hit_dice: "17d20",
    speed: "40 ft., burrow 40 ft., fly 80 ft.",
    stats: [27, 10, 25, 16, 15, 19],
    saves: [
      {
        dexterity: 6
      },
      {
        constitution: 13
      },
      {
        wisdom: 8
      },
      {
        charisma: 10
      }
    ],
    skillsaves: [
      {
        history: 9
      },
      {
        persuasion: 10
      },
      {
        perception: 14
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 24",
    languages: "Common, Draconic",
    cr: "20",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",
        attack_bonus: 14,
        damage_dice: "2d10",
        damage_bonus: 8
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",
        attack_bonus: 14,
        damage_dice: "2d6",
        damage_bonus: 8
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +14 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",
        attack_bonus: 14,
        damage_dice: "2d8",
        damage_bonus: 8
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 18 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons:\nFire Breath. The dragon exhales fire in an 90-foot line that is 10 feet wide. Each creature in that line must make a DC 21 Dexterity saving throw, taking 56 (16d6) fire damage on a failed save, or half as much damage on a successful one.\nSleep Breath. The dragon exhales sleep gas in a 90-foot cone. Each creature in that area must succeed on a DC 21 Constitution saving throw or fall unconscious for 10 minutes. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.",
        attack_bonus: 0,
        damage_dice: "16d6"
      },
      {
        name: "Change Shape",
        desc: "The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).\nIn a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ancient Bronze Dragon",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 22,
    hp: 444,
    hit_dice: "24d20",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [29, 10, 27, 18, 17, 21],
    saves: [
      {
        dexterity: 7
      },
      {
        constitution: 15
      },
      {
        wisdom: 10
      },
      {
        charisma: 12
      }
    ],
    skillsaves: [
      {
        insight: 10
      },
      {
        perception: 17
      },
      {
        stealth: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 27",
    languages: "Common, Draconic",
    cr: "22",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +16 to hit, reach 15 ft., one target. Hit: 20 (2d10 + 9) piercing damage.",
        attack_bonus: 16,
        damage_dice: "2d10",
        damage_bonus: 9
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +16 to hit, reach 10 ft., one target. Hit: 16 (2d6 + 9) slashing damage.",
        attack_bonus: 16,
        damage_dice: "1d6",
        damage_bonus: 9
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +16 to hit, reach 20 ft., one target. Hit: 18 (2d8 + 9) bludgeoning damage.",
        attack_bonus: 0,
        damage_dice: "2d8",
        damage_bonus: 9
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 20 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nLightning Breath. The dragon exhales lightning in a 120-foot line that is 10 feet wide. Each creature in that line must make a DC 23 Dexterity saving throw, taking 88 (16d10) lightning damage on a failed save, or half as much damage on a successful one.\nRepulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 23 Strength saving throw. On a failed save, the creature is pushed 60 feet away from the dragon.",
        attack_bonus: 0,
        damage_dice: "16d10"
      },
      {
        name: "Change Shape",
        desc: "The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).\nIn a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 24 Dexterity saving throw or take 16 (2d6 + 9) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ancient Copper Dragon",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic good",
    ac: 21,
    hp: 350,
    hit_dice: "20d20",
    speed: "40 ft., climb 40 ft., fly 80 ft.",
    stats: [27, 12, 25, 20, 17, 19],
    saves: [
      {
        dexterity: 8
      },
      {
        constitution: 14
      },
      {
        wisdom: 10
      },
      {
        charisma: 11
      }
    ],
    skillsaves: [
      {
        stealth: 8
      },
      {
        perception: 17
      },
      {
        deception: 11
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 27",
    languages: "Common, Draconic",
    cr: "21",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +15 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",
        attack_bonus: 15,
        damage_dice: "2d10",
        damage_bonus: 8
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +15 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",
        attack_bonus: 15,
        damage_dice: "2d6",
        damage_bonus: 8
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +15 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",
        attack_bonus: 15,
        damage_dice: "2d8",
        damage_bonus: 8
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nAcid Breath. The dragon exhales acid in an 90-foot line that is 10 feet wide. Each creature in that line must make a DC 22 Dexterity saving throw, taking 63 (14d8) acid damage on a failed save, or half as much damage on a successful one.\nSlowing Breath. The dragon exhales gas in a 90-foot cone. Each creature in that area must succeed on a DC 22 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.",
        attack_bonus: 0,
        damage_dice: "14d8"
      },
      {
        name: "Change Shape",
        desc: "The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).\nIn a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 23 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ancient Gold Dragon",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 22,
    hp: 546,
    hit_dice: "28d20",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [30, 14, 29, 18, 17, 28],
    saves: [
      {
        dexterity: 9
      },
      {
        constitution: 16
      },
      {
        wisdom: 10
      },
      {
        charisma: 16
      }
    ],
    skillsaves: [
      {
        persuasion: 16
      },
      {
        stealth: 9
      },
      {
        perception: 17
      },
      {
        insight: 10
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 27",
    languages: "Common, Draconic",
    cr: "24",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +17 to hit, reach 15 ft., one target. Hit: 21 (2d10 + 10) piercing damage.",
        attack_bonus: 17,
        damage_dice: "2d10",
        damage_bonus: 10
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +17 to hit, reach 10 ft., one target. Hit: 17 (2d6 + 10) slashing damage.",
        attack_bonus: 17,
        damage_dice: "2d6",
        damage_bonus: 10
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +17 to hit, reach 20 ft., one target. Hit: 19 (2d8 + 10) bludgeoning damage.",
        attack_bonus: 17,
        damage_dice: "2d8",
        damage_bonus: 10
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 24 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nFire Breath. The dragon exhales fire in a 90-foot cone. Each creature in that area must make a DC 24 Dexterity saving throw, taking 71 (13d10) fire damage on a failed save, or half as much damage on a successful one.\nWeakening Breath. The dragon exhales gas in a 90-foot cone. Each creature in that area must succeed on a DC 24 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0,
        damage_dice: "13d10"
      },
      {
        name: "Change Shape",
        desc: "The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).\nIn a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 25 Dexterity saving throw or take 17 (2d6 + 10) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ancient Green Dragon",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful evil",
    ac: 21,
    hp: 385,
    hit_dice: "22d20",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [27, 12, 25, 20, 17, 19],
    saves: [
      {
        dexterity: 8
      },
      {
        constitution: 14
      },
      {
        wisdom: 10
      },
      {
        charisma: 11
      }
    ],
    skillsaves: [
      {
        deception: 11
      },
      {
        insight: 10
      },
      {
        perception: 17
      },
      {
        persuasion: 11
      },
      {
        stealth: 8
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 27",
    languages: "Common, Draconic",
    cr: "22",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +15 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 10 (3d6) poison damage.",
        attack_bonus: 15,
        damage_dice: "2d10 + 3d6",
        damage_bonus: 9
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +15 to hit, reach 10 ft., one target. Hit: 22 (4d6 + 8) slashing damage.",
        attack_bonus: 15,
        damage_dice: "4d6",
        damage_bonus: 8
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +15 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",
        attack_bonus: 16,
        damage_dice: "2d8",
        damage_bonus: 8
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Poison Breath (Recharge 5-6)",
        desc: "The dragon exhales poisonous gas in a 90-foot cone. Each creature in that area must make a DC 22 Constitution saving throw, taking 77 (22d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "22d6"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 23 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ancient Red Dragon",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 22,
    hp: 546,
    hit_dice: "28d20",
    speed: "40 ft., climb 40 ft., fly 80 ft.",
    stats: [30, 10, 29, 18, 15, 23],
    saves: [
      {
        dexterity: 7
      },
      {
        constitution: 16
      },
      {
        wisdom: 9
      },
      {
        charisma: 13
      }
    ],
    skillsaves: [
      {
        perception: 16
      },
      {
        stealth: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 26",
    languages: "Common, Draconic",
    cr: "24",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +17 to hit, reach 15 ft., one target. Hit: 21 (2d10 + 10) piercing damage plus 14 (4d6) fire damage.",
        attack_bonus: 17,
        damage_dice: "2d10 + 4d6",
        damage_bonus: 10
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +17 to hit, reach 10 ft., one target. Hit: 17 (2d6 + 10) slashing damage.",
        attack_bonus: 17,
        damage_dice: "2d6",
        damage_bonus: 10
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +17 to hit, reach 20 ft., one target. Hit: 19 (2d8 + 10) bludgeoning damage.",
        attack_bonus: 17,
        damage_dice: "2d8",
        damage_bonus: 10
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 21 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Fire Breath (Recharge 5-6)",
        desc: "The dragon exhales fire in a 90-foot cone. Each creature in that area must make a DC 24 Dexterity saving throw, taking 91 (26d6) fire damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "26d6"
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 25 Dexterity saving throw or take 17 (2d6 + 10) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ancient Silver Dragon",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 22,
    hp: 487,
    hit_dice: "25d20",
    speed: "40 ft., fly 80 ft.",
    stats: [30, 10, 29, 18, 15, 23],
    saves: [
      {
        dexterity: 7
      },
      {
        constitution: 16
      },
      {
        wisdom: 9
      },
      {
        charisma: 13
      }
    ],
    skillsaves: [
      {
        arcana: 11
      },
      {
        perception: 16
      },
      {
        history: 11
      },
      {
        stealth: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 26",
    languages: "Common, Draconic",
    cr: "23",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +17 to hit, reach 15 ft., one target. Hit: 21 (2d10 + 10) piercing damage.",
        attack_bonus: 17,
        damage_dice: "2d10",
        damage_bonus: 10
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +17 to hit, reach 10 ft., one target. Hit: 17 (2d6 + 10) slashing damage.",
        attack_bonus: 17,
        damage_dice: "2d6",
        damage_bonus: 10
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +17 to hit, reach 20 ft., one target. Hit: 19 (2d8 + 10) bludgeoning damage.",
        attack_bonus: 17,
        damage_dice: "2d8",
        damage_bonus: 10
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 21 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nCold Breath. The dragon exhales an icy blast in a 90-foot cone. Each creature in that area must make a DC 24 Constitution saving throw, taking 67 (15d8) cold damage on a failed save, or half as much damage on a successful one.\nParalyzing Breath. The dragon exhales paralyzing gas in a 90- foot cone. Each creature in that area must succeed on a DC 24 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0,
        damage_dice: "15d8"
      },
      {
        name: "Change Shape",
        desc: "The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).\nIn a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Detect",
        desc: "The dragon makes a Wisdom (Perception) check.",
        attack_bonus: 0
      },
      {
        name: "Tail Attack",
        desc: "The dragon makes a tail attack.",
        attack_bonus: 0
      },
      {
        name: "Wing Attack (Costs 2 Actions)",
        desc: "The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 25 Dexterity saving throw or take 17 (2d6 + 10) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ancient White Dragon",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 20,
    hp: 333,
    hit_dice: "18d20",
    speed: "40 ft., burrow 40 ft., fly 80 ft., swim 40 ft.",
    stats: [26, 10, 26, 10, 13, 14],
    saves: [
      {
        dexterity: 6
      },
      {
        constitution: 14
      },
      {
        wisdom: 7
      },
      {
        charisma: 8
      }
    ],
    skillsaves: [
      {
        perception: 13
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold",
    condition_immunities: "",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 23",
    languages: "Common, Draconic",
    cr: "20",
    traits: [
      {
        name: "Ice Walk",
        desc: "The dragon can move across and climb icy surfaces without needing to make an ability check. Additionally, difficult terrain composed of ice or snow doesn't cost it extra moment.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the dragon fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 9 (2d8) cold damage.",
        attack_bonus: 14,
        damage_dice: "2d10 + 2d8",
        damage_bonus: 8
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",
        attack_bonus: 14,
        damage_dice: "2d6",
        damage_bonus: 8
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +14 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",
        attack_bonus: 14,
        damage_dice: "2d8",
        damage_bonus: 8
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours .",
        attack_bonus: 0
      },
      {
        name: "Cold Breath (Recharge 5-6)",
        desc: "The dragon exhales an icy blast in a 90-foot cone. Each creature in that area must make a DC 22 Constitution saving throw, taking 72 (l6d8) cold damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "16d8"
      }
    ]
  },
  {
    name: "Androsphinx",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "lawful neutral",
    ac: 17,
    hp: 199,
    hit_dice: "19d10",
    speed: "40 ft., fly 60 ft.",
    stats: [22, 10, 20, 16, 18, 23],
    saves: [
      {
        dexterity: 6
      },
      {
        constitution: 11
      },
      {
        intelligence: 9
      },
      {
        wisdom: 10
      }
    ],
    skillsaves: [
      {
        religion: 15
      },
      {
        perception: 10
      },
      {
        arcana: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "psychic; bludgeoning, piercing, and slashing from nonmagical weapons",
    condition_immunities: "charmed, frightened",
    senses: "truesight 120 ft., passive Perception 20",
    languages: "Common, Sphinx",
    cr: "17",
    traits: [
      {
        name: "Inscrutable",
        desc: "The sphinx is immune to any effect that would sense its emotions or read its thoughts, as well as any divination spell that it refuses. Wisdom (Insight) checks made to ascertain the sphinx's intentions or sincerity have disadvantage.",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The sphinx's weapon attacks are magical.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The sphinx makes two claw attacks.",
        attack_bonus: 0
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 17 (2d10 + 6) slashing damage.",
        attack_bonus: 12,
        damage_dice: "2d10",
        damage_bonus: 6
      },
      {
        name: "Roar (3/Day)",
        desc: "The sphinx emits a magical roar. Each time it roars before finishing a long rest, the roar is louder and the effect is different, as detailed below. Each creature within 500 feet of the sphinx and able to hear the roar must make a saving throw.\n\nFirst Roar. Each creature that fails a DC 18 Wisdom saving throw is frightened for 1 minute. A frightened creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.\n\nSecond Roar. Each creature that fails a DC 18 Wisdom saving throw is deafened and frightened for 1 minute. A frightened creature is paralyzed and can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.\n\nThird Roar. Each creature makes a DC 18 Constitution saving throw. On a failed save, a creature takes 44 (8d10) thunder damage and is knocked prone. On a successful save, the creature takes half as much damage and isn't knocked prone.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Claw Attack",
        desc: "The sphinx makes one claw attack.",
        attack_bonus: 0
      },
      {
        name: "Teleport (Costs 2 Actions)",
        desc: "The sphinx magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",
        attack_bonus: 0
      },
      {
        name: "Cast a Spell (Costs 3 Actions)",
        desc: "The sphinx casts a spell from its list of prepared spells, using a spell slot as normal.",
        attack_bonus: 0
      }
    ],
    spells: [
      "The sphinx is a 12th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 18, +10 to hit with spell attacks). It requires no material components to cast its spells. The sphinx has the following cleric spells prepared:",
      {
        "Cantrips (at will)": "sacred flame, spare the dying, thaumaturgy"
      },
      {
        "1st level (4 slots)": "command, detect evil and good, detect magic"
      },
      {
        "2nd level (3 slots)": "lesser restoration, zone of truth"
      },
      {
        "3rd level (3 slots)": "dispel magic, tongues"
      },
      {
        "4th level (3 slots)": "banishment, freedom of movement"
      },
      {
        "5th level (2 slots)": "flame strike, greater restoration"
      },
      {
        "6th level (1 slot)": "heroes' feast"
      }
    ]
  },
  {
    name: "Animated Armor",
    size: "Medium",
    source: "SRD",
    type: "construct",
    subtype: "",
    alignment: "unaligned",
    ac: 18,
    hp: 33,
    hit_dice: "6d8",
    speed: "25 ft.",
    stats: [14, 11, 13, 1, 3, 1],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison, psychic",
    condition_immunities: "blinded, charmed, deafened, exhaustion, frightened, paralyzed, petrified, poisoned",
    senses: "blindsight 60 ft. (blind beyond this radius), passive Perception 6",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Antimagic Susceptibility",
        desc: "The armor is incapacitated while in the area of an antimagic field. If targeted by dispel magic, the armor must succeed on a Constitution saving throw against the caster's spell save DC or fall unconscious for 1 minute.",
        attack_bonus: 0
      },
      {
        name: "False Appearance",
        desc: "While the armor remains motionless, it is indistinguishable from a normal suit of armor.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The armor makes two melee attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) bludgeoning damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Ankheg",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 14,
    hp: 39,
    hit_dice: "6d10",
    speed: "30 ft., burrow 10 ft.",
    stats: [17, 11, 13, 1, 13, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., tremorsense 60 ft., passive Perception 11",
    languages: "",
    cr: "2",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage plus 3 (1d6) acid damage. If the target is a Large or smaller creature, it is grappled (escape DC 13). Until this grapple ends, the ankheg can bite only the grappled creature and has advantage on attack rolls to do so.",
        attack_bonus: 5,
        damage_dice: "2d6 + 1d6",
        damage_bonus: 3
      },
      {
        name: "Acid Spray (Recharge 6)",
        desc: "The ankheg spits acid in a line that is 30 ft. long and 5 ft. wide, provided that it has no creature grappled. Each creature in that line must make a DC 13 Dexterity saving throw, taking 10 (3d6) acid damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "3d6"
      }
    ]
  },
  {
    name: "Ape",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 19,
    hit_dice: "3d8",
    speed: "30 ft., climb 30 ft.",
    stats: [16, 14, 14, 6, 12, 7],
    skillsaves: [
      {
        athletics: 5
      },
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "1/2",
    actions: [
      {
        name: "Multiattack",
        desc: "The ape makes two fist attacks.",
        attack_bonus: 0
      },
      {
        name: "Fist",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Rock",
        desc: "Ranged Weapon Attack: +5 to hit, range 25/50 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Archmage",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 12,
    hp: 99,
    hit_dice: "18d8 + 18",
    speed: "30 ft.",
    stats: [10, 14, 12, 20, 15, 16],
    saves: [
      {
        intelligence: 9
      },
      {
        wisdom: 6
      }
    ],
    skillsaves: [
      {
        arcana: 13
      },
      {
        history: 13
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "damage from spells; non magical bludgeoning, piercing, and slashing (from stoneskin)",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 12",
    languages: "any six languages",
    cr: "12",
    traits: [
      {
        name: "Magic Resistance",
        desc: "The archmage has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Dagger",
        desc: "Melee or Ranged Weapon Attack: +6 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",
        attack_bonus: 6,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ],
    spells: [
      "The archmage is an 18th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 17, +9 to hit with spell attacks). The archmage can cast disguise self and invisibility at will and has the following wizard spells prepared:",
      {
        "Cantrips (at will)": "fire bolt, light, mage hand, prestidigitation, shocking grasp"
      },
      {
        "1st level (4 slots)": "detect magic, identify, mage armor*, magic missile"
      },
      {
        "2nd level (3 slots)": "detect thoughts, mirror image, misty step"
      },
      {
        "3rd level (3 slots)": "counterspell,fly, lightning bolt"
      },
      {
        "4th level (3 slots)": "banishment, fire shield, stoneskin*"
      },
      {
        "5th level (3 slots)": "cone of cold, scrying, wall of force"
      },
      {
        "6th level (1 slot)": "globe of invulnerability"
      },
      {
        "7th level (1 slot)": "teleport"
      },
      {
        "8th level (1 slot)": "mind blank*"
      },
      {
        "9th level (1 slot)": "time stop"
      },
      "* The archmage casts these spells on itself before combat."
    ]
  },
  {
    name: "Assassin",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any non-good alignment",
    ac: 15,
    hp: 78,
    hit_dice: "12d8",
    speed: "30 ft.",
    stats: [11, 16, 14, 13, 11, 10],
    saves: [
      {
        dexterity: 6
      },
      {
        intelligence: 4
      }
    ],
    skillsaves: [
      {
        acrobatics: 6
      },
      {
        deception: 3
      },
      {
        perception: 3
      },
      {
        stealth: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "poison",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "Thieves' cant plus any two languages",
    cr: "8",
    traits: [
      {
        name: "Assassinate",
        desc: "During its first turn, the assassin has advantage on attack rolls against any creature that hasn't taken a turn. Any hit the assassin scores against a surprised creature is a critical hit.",
        attack_bonus: 0
      },
      {
        name: "Evasion",
        desc: "If the assassin is subjected to an effect that allows it to make a Dexterity saving throw to take only half damage, the assassin instead takes no damage if it succeeds on the saving throw, and only half damage if it fails.",
        attack_bonus: 0
      },
      {
        name: "Sneak Attack (1/Turn)",
        desc: "The assassin deals an extra 13 (4d6) damage when it hits a target with a weapon attack and has advantage on the attack roll, or when the target is within 5 ft. of an ally of the assassin that isn't incapacitated and the assassin doesn't have disadvantage on the attack roll.",
        attack_bonus: 0,
        damage_dice: "4d6"
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The assassin makes two shortsword attacks.",
        attack_bonus: 0
      },
      {
        name: "Shortsword",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage, and the target must make a DC 15 Constitution saving throw, taking 24 (7d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 6,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Light Crossbow",
        desc: "Ranged Weapon Attack: +6 to hit, range 80/320 ft., one target. Hit: 7 (1d8 + 3) piercing damage, and the target must make a DC 15 Constitution saving throw, taking 24 (7d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 6,
        damage_dice: "1d8",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Awakened Shrub",
    size: "Small",
    source: "SRD",
    type: "plant",
    subtype: "",
    alignment: "unaligned",
    ac: 9,
    hp: 10,
    hit_dice: "3d6",
    speed: "20 ft.",
    stats: [3, 8, 11, 10, 10, 6],
    damage_vulnerabilities: "fire",
    damage_resistances: "piercing",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "one language known by its creator",
    cr: "0",
    traits: [
      {
        name: "False Appearance",
        desc: "While the shrub remains motionless, it is indistinguishable from a normal shrub.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Rake",
        desc: "Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 1 (1d4 \u2014 1) slashing damage.",
        attack_bonus: 1,
        damage_dice: "1d4",
        damage_bonus: -1
      }
    ]
  },
  {
    name: "Awakened Tree",
    size: "Huge",
    source: "SRD",
    type: "plant",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 59,
    hit_dice: "7d12",
    speed: "20 ft.",
    stats: [19, 6, 15, 10, 10, 7],
    damage_vulnerabilities: "fire",
    damage_resistances: "bludgeoning, piercing",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "one language known by its creator",
    cr: "2",
    traits: [
      {
        name: "False Appearance",
        desc: "While the tree remains motionless, it is indistinguishable from a normal tree.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 14 (3d6 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "3d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Axe Beak",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 19,
    hit_dice: "3d10",
    speed: "50 ft.",
    stats: [14, 12, 12, 2, 10, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "1/4",
    actions: [
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) slashing damage.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Azer",
    size: "Medium",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "lawful neutral",
    ac: 17,
    hp: 39,
    hit_dice: "6d8",
    speed: "30 ft.",
    stats: [17, 12, 15, 12, 13, 10],
    saves: [
      {
        constitution: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "passive Perception 11",
    languages: "Ignan",
    cr: "2",
    traits: [
      {
        name: "Heated Body",
        desc: "A creature that touches the azer or hits it with a melee attack while within 5 ft. of it takes 5 (1d10) fire damage.",
        attack_bonus: 0,
        damage_dice: "1d10"
      },
      {
        name: "Heated Weapons",
        desc: "When the azer hits with a metal melee weapon, it deals an extra 3 (1d6) fire damage (included in the attack).",
        attack_bonus: 0
      },
      {
        name: "Illumination",
        desc: "The azer sheds bright light in a 10-foot radius and dim light for an additional 10 ft..",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Warhammer",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) bludgeoning damage, or 8 (1d10 + 3) bludgeoning damage if used with two hands to make a melee attack, plus 3 (1d6) fire damage.",
        attack_bonus: 5,
        damage_dice: "1d8 + 1d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Baboon",
    size: "Small",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 3,
    hit_dice: "1d6",
    speed: "30 ft., climb 30 ft.",
    stats: [8, 14, 11, 4, 12, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 11",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Pack Tactics",
        desc: "The baboon has advantage on an attack roll against a creature if at least one of the baboon's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 1 (1d4 \u2014 1) piercing damage.",
        attack_bonus: 1,
        damage_dice: "1d4",
        damage_bonus: -1
      }
    ]
  },
  {
    name: "Badger",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 3,
    hit_dice: "1d4",
    speed: "20 ft., burrow 5 ft.",
    stats: [4, 11, 12, 2, 12, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 11",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Keen Smell",
        desc: "The badger has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",
        attack_bonus: 2,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Balor",
    size: "Huge",
    source: "SRD",
    type: "fiend",
    subtype: "demon",
    alignment: "chaotic evil",
    ac: 19,
    hp: 262,
    hit_dice: "21d12",
    speed: "40 ft., fly 80 ft.",
    stats: [26, 15, 22, 20, 16, 22],
    saves: [
      {
        strength: 14
      },
      {
        constitution: 12
      },
      {
        wisdom: 9
      },
      {
        charisma: 12
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "truesight 120 ft., passive Perception 13",
    languages: "Abyssal, telepathy 120 ft.",
    cr: "19",
    traits: [
      {
        name: "Death Throes",
        desc: "When the balor dies, it explodes, and each creature within 30 feet of it must make a DC 20 Dexterity saving throw, taking 70 (20d6) fire damage on a failed save, or half as much damage on a successful one. The explosion ignites flammable objects in that area that aren't being worn or carried, and it destroys the balor's weapons.",
        attack_bonus: 0,
        damage_dice: "20d6"
      },
      {
        name: "Fire Aura",
        desc: "At the start of each of the balor's turns, each creature within 5 feet of it takes 10 (3d6) fire damage, and flammable objects in the aura that aren't being worn or carried ignite. A creature that touches the balor or hits it with a melee attack while within 5 feet of it takes 10 (3d6) fire damage.",
        attack_bonus: 0,
        damage_dice: "3d6"
      },
      {
        name: "Magic Resistance",
        desc: "The balor has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The balor's weapon attacks are magical.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The balor makes two attacks: one with its longsword and one with its whip.",
        attack_bonus: 0
      },
      {
        name: "Longsword",
        desc: "Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 21 (3d8 + 8) slashing damage plus 13 (3d8) lightning damage. If the balor scores a critical hit, it rolls damage dice three times, instead of twice.",
        attack_bonus: 14,
        damage_dice: "3d8 + 3d8",
        damage_bonus: 8
      },
      {
        name: "Whip",
        desc: "Melee Weapon Attack: +14 to hit, reach 30 ft., one target. Hit: 15 (2d6 + 8) slashing damage plus 10 (3d6) fire damage, and the target must succeed on a DC 20 Strength saving throw or be pulled up to 25 feet toward the balor.",
        attack_bonus: 14,
        damage_dice: "2d6 + 3d6",
        damage_bonus: 8
      },
      {
        name: "Teleport",
        desc: "The balor magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",
        attack_bonus: 0
      },
      {
        name: "Variant: Summon Demon (1/Day)",
        desc: "The demon chooses what to summon and attempts a magical summoning.\nA balor has a 50 percent chance of summoning 1d8 vrocks, 1d6 hezrous, 1d4 glabrezus, 1d3 nalfeshnees, 1d2 mariliths, or one goristro.\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Bandit",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any non-lawful alignment",
    ac: 12,
    hp: 11,
    hit_dice: "2d8",
    speed: "30 ft.",
    stats: [11, 12, 12, 10, 10, 10],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "any one language (usually Common)",
    cr: "1/8",
    actions: [
      {
        name: "Scimitar",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) slashing damage.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      },
      {
        name: "Light Crossbow",
        desc: "Ranged Weapon Attack: +3 to hit, range 80 ft./320 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d8",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Bandit Captain",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any non-lawful alignment",
    ac: 15,
    hp: 65,
    hit_dice: "10d8",
    speed: "30 ft.",
    stats: [15, 16, 14, 14, 11, 14],
    saves: [
      {
        strength: 4
      },
      {
        dexterity: 5
      },
      {
        wisdom: 2
      }
    ],
    skillsaves: [
      {
        athletics: 4
      },
      {
        deception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "any two languages",
    cr: "2",
    actions: [
      {
        name: "Multiattack",
        desc: "The captain makes three melee attacks: two with its scimitar and one with its dagger. Or the captain makes two ranged attacks with its daggers.",
        attack_bonus: 0
      },
      {
        name: "Scimitar",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Dagger",
        desc: "Melee or Ranged Weapon Attack: +5 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 5 (1d4 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d4",
        damage_bonus: 3
      }
    ],
    reactions: [
      {
        name: "Parry",
        desc: "The captain adds 2 to its AC against one melee attack that would hit it. To do so, the captain must see the attacker and be wielding a melee weapon.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Barbed Devil",
    size: "Medium",
    source: "SRD",
    type: "fiend",
    subtype: "devil",
    alignment: "lawful evil",
    ac: 15,
    hp: 110,
    hit_dice: "13d8",
    speed: "30 ft.",
    stats: [16, 17, 18, 12, 14, 14],
    saves: [
      {
        strength: 6
      },
      {
        constitution: 7
      },
      {
        wisdom: 5
      },
      {
        charisma: 5
      }
    ],
    skillsaves: [
      {
        deception: 5
      },
      {
        insight: 5
      },
      {
        perception: 8
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "darkvision 120 ft., passive Perception 18",
    languages: "Infernal, telepathy 120 ft.",
    cr: "5",
    traits: [
      {
        name: "Barbed Hide",
        desc: "At the start of each of its turns, the barbed devil deals 5 (1d10) piercing damage to any creature grappling it.",
        attack_bonus: 0,
        damage_dice: "1d10"
      },
      {
        name: "Devil's Sight",
        desc: "Magical darkness doesn't impede the devil's darkvision.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The devil has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The devil makes three melee attacks: one with its tail and two with its claws. Alternatively, it can use Hurl Flame twice.",
        attack_bonus: 0
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft ., one target. Hit: 6 (1d6 + 3) piercing damage.",
        attack_bonus: 6,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 3
      },
      {
        name: "Hurl Flame",
        desc: "Ranged Spell Attack: +5 to hit, range 150 ft., one target. Hit: 10 (3d6) fire damage. If the target is a flammable object that isn't being worn or carried, it also catches fire.",
        attack_bonus: 5,
        damage_dice: "3d6"
      }
    ]
  },
  {
    name: "Basilisk",
    size: "Medium",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 52,
    hit_dice: "8d8",
    speed: "20 ft.",
    stats: [16, 8, 15, 2, 8, 7],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 9",
    languages: "",
    cr: "3",
    traits: [
      {
        name: "Petrifying Gaze",
        desc: "If a creature starts its turn within 30 ft. of the basilisk and the two of them can see each other, the basilisk can force the creature to make a DC 12 Constitution saving throw if the basilisk isn't incapacitated. On a failed save, the creature magically begins to turn to stone and is restrained. It must repeat the saving throw at the end of its next turn. On a success, the effect ends. On a failure, the creature is petrified until freed by the greater restoration spell or other magic.\nA creature that isn't surprised can avert its eyes to avoid the saving throw at the start of its turn. If it does so, it can't see the basilisk until the start of its next turn, when it can avert its eyes again. If it looks at the basilisk in the meantime, it must immediately make the save.\nIf the basilisk sees its reflection within 30 ft. of it in bright light, it mistakes itself for a rival and targets itself with its gaze.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage plus 7 (2d6) poison damage.",
        attack_bonus: 5,
        damage_dice: "2d6 + 2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Bat",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 1,
    hit_dice: "1d4",
    speed: "5 ft., fly 30 ft.",
    stats: [2, 15, 8, 2, 12, 4],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 60 ft., passive Perception 11",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Echolocation",
        desc: "The bat can't use its blindsight while deafened.",
        attack_bonus: 0
      },
      {
        name: "Keen Hearing",
        desc: "The bat has advantage on Wisdom (Perception) checks that rely on hearing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +0 to hit, reach 5 ft., one creature. Hit: 1 piercing damage.",
        attack_bonus: 0,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Bearded Devil",
    size: "Medium",
    source: "SRD",
    type: "fiend",
    subtype: "devil",
    alignment: "lawful evil",
    ac: 13,
    hp: 52,
    hit_dice: "8d8",
    speed: "30 ft.",
    stats: [16, 15, 15, 9, 11, 11],
    saves: [
      {
        strength: 5
      },
      {
        constitution: 4
      },
      {
        wisdom: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "darkvision 120 ft., passive Perception 10",
    languages: "Infernal, telepathy 120 ft.",
    cr: "3",
    traits: [
      {
        name: "Devil's Sight",
        desc: "Magical darkness doesn't impede the devil's darkvision.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The devil has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Steadfast",
        desc: "The devil can't be frightened while it can see an allied creature within 30 feet of it.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The devil makes two attacks: one with its beard and one with its glaive.",
        attack_bonus: 0
      },
      {
        name: "Beard",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 6 (1d8 + 2) piercing damage, and the target must succeed on a DC 12 Constitution saving throw or be poisoned for 1 minute. While poisoned in this way, the target can't regain hit points. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 2
      },
      {
        name: "Glaive",
        desc: "Melee Weapon Attack: +5 to hit, reach 10 ft., one target. Hit: 8 (1d10 + 3) slashing damage. If the target is a creature other than an undead or a construct, it must succeed on a DC 12 Constitution saving throw or lose 5 (1d10) hit points at the start of each of its turns due to an infernal wound. Each time the devil hits the wounded target with this attack, the damage dealt by the wound increases by 5 (1d10). Any creature can take an action to stanch the wound with a successful DC 12 Wisdom (Medicine) check. The wound also closes if the target receives magical healing.",
        attack_bonus: 5,
        damage_dice: "1d10",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Behir",
    size: "Huge",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "neutral evil",
    ac: 17,
    hp: 168,
    hit_dice: "16d12",
    speed: "50 ft., climb 40 ft.",
    stats: [23, 16, 18, 7, 14, 12],
    skillsaves: [
      {
        perception: 6
      },
      {
        stealth: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning",
    condition_immunities: "",
    senses: "darkvision 90 ft., passive Perception 16",
    languages: "Draconic",
    cr: "11",
    actions: [
      {
        name: "Multiattack",
        desc: "The behir makes two attacks: one with its bite and one to constrict.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 22 (3d10 + 6) piercing damage.",
        attack_bonus: 10,
        damage_dice: "3d10",
        damage_bonus: 6
      },
      {
        name: "Constrict",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one Large or smaller creature. Hit: 17 (2d10 + 6) bludgeoning damage plus 17 (2d10 + 6) slashing damage. The target is grappled (escape DC 16) if the behir isn't already constricting a creature, and the target is restrained until this grapple ends.",
        attack_bonus: 10,
        damage_dice: "2d10 + 2d10",
        damage_bonus: 6
      },
      {
        name: "Lightning Breath (Recharge 5-6)",
        desc: "The behir exhales a line of lightning that is 20 ft. long and 5 ft. wide. Each creature in that line must make a DC 16 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "12d10"
      },
      {
        name: "Swallow",
        desc: "The behir makes one bite attack against a Medium or smaller target it is grappling. If the attack hits, the target is also swallowed, and the grapple ends. While swallowed, the target is blinded and restrained, it has total cover against attacks and other effects outside the behir, and it takes 21 (6d6) acid damage at the start of each of the behir's turns. A behir can have only one creature swallowed at a time.\nIf the behir takes 30 damage or more on a single turn from the swallowed creature, the behir must succeed on a DC 14 Constitution saving throw at the end of that turn or regurgitate the creature, which falls prone in a space within 10 ft. of the behir. If the behir dies, a swallowed creature is no longer restrained by it and can escape from the corpse by using 15 ft. of movement, exiting prone.",
        attack_bonus: 0,
        damage_dice: "6d6"
      }
    ]
  },
  {
    name: "Berserker",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any chaotic alignment",
    ac: 13,
    hp: 67,
    hit_dice: "9d8",
    speed: "30 ft.",
    stats: [16, 12, 17, 9, 11, 9],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "any one language (usually Common)",
    cr: "2",
    traits: [
      {
        name: "Reckless",
        desc: "At the start of its turn, the berserker can gain advantage on all melee weapon attack rolls during that turn, but attack rolls against it have advantage until the start of its next turn.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Greataxe",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 9 (1d12 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "1d12",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Black Bear",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 19,
    hit_dice: "3d8",
    speed: "40 ft., climb 30 ft.",
    stats: [15, 10, 14, 2, 12, 7],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Keen Smell",
        desc: "The bear has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The bear makes two attacks: one with its bite and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) slashing damage.",
        attack_bonus: 3,
        damage_dice: "2d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Black Dragon Wyrmling",
    size: "Medium",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 17,
    hp: 33,
    hit_dice: "6d8",
    speed: "30 ft., fly 60 ft., swim 30 ft.",
    stats: [15, 14, 13, 10, 11, 13],
    saves: [
      {
        dexterity: 4
      },
      {
        constitution: 3
      },
      {
        wisdom: 2
      },
      {
        charisma: 3
      }
    ],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 14",
    languages: "Draconic",
    cr: "2",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 2 (1d4) acid damage.",
        attack_bonus: 4,
        damage_dice: "1d10",
        damage_bonus: 2
      },
      {
        name: "Acid Breath (Recharge 5-6)",
        desc: "The dragon exhales acid in a 15-foot line that is 5 feet wide. Each creature in that line must make a DC 11 Dexterity saving throw, taking 22 (Sd8) acid damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "5d8"
      }
    ]
  },
  {
    name: "Black Pudding",
    size: "Large",
    source: "SRD",
    type: "ooze",
    subtype: "",
    alignment: "unaligned",
    ac: 7,
    hp: 85,
    hit_dice: "10d10",
    speed: "20 ft., climb 20 ft.",
    stats: [16, 5, 16, 1, 6, 1],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid, cold, lightning, slashing",
    condition_immunities: "blinded, charmed, deafened, exhaustion, frightened, prone",
    senses: "blindsight 60 ft. (blind beyond this radius), passive Perception 8",
    languages: "",
    cr: "4",
    traits: [
      {
        name: "Amorphous",
        desc: "The pudding can move through a space as narrow as 1 inch wide without squeezing.",
        attack_bonus: 0
      },
      {
        name: "Corrosive Form",
        desc: "A creature that touches the pudding or hits it with a melee attack while within 5 feet of it takes 4 (1d8) acid damage. Any nonmagical weapon made of metal or wood that hits the pudding corrodes. After dealing damage, the weapon takes a permanent and cumulative -1 penalty to damage rolls. If its penalty drops to -5, the weapon is destroyed. Nonmagical ammunition made of metal or wood that hits the pudding is destroyed after dealing damage. The pudding can eat through 2-inch-thick, nonmagical wood or metal in 1 round.",
        attack_bonus: 0,
        damage_dice: "1d8"
      },
      {
        name: "Spider Climb",
        desc: "The pudding can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Pseudopod",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage plus 18 (4d8) acid damage. In addition, nonmagical armor worn by the target is partly dissolved and takes a permanent and cumulative -1 penalty to the AC it offers. The armor is destroyed if the penalty reduces its AC to 10.",
        attack_bonus: 5,
        damage_dice: "1d6 + 4d8",
        damage_bonus: 3
      }
    ],
    reactions: [
      {
        name: "Split",
        desc: "When a pudding that is Medium or larger is subjected to lightning or slashing damage, it splits into two new puddings if it has at least 10 hit points. Each new pudding has hit points equal to half the original pudding's, rounded down. New puddings are one size smaller than the original pudding.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Blink Dog",
    size: "Medium",
    source: "SRD",
    type: "fey",
    subtype: "",
    alignment: "lawful good",
    ac: 13,
    hp: 22,
    hit_dice: "4d8",
    speed: "40 ft.",
    stats: [12, 17, 12, 10, 13, 11],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "Blink Dog, understands Sylvan but can't speak it",
    cr: "1/4",
    traits: [
      {
        name: "Keen Hearing and Smell",
        desc: "The dog has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      },
      {
        name: "Teleport (Recharge 4-6)",
        desc: "The dog magically teleports, along with any equipment it is wearing or carrying, up to 40 ft. to an unoccupied space it can see. Before or after teleporting, the dog can make one bite attack.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Blood Hawk",
    size: "Small",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 7,
    hit_dice: "2d6",
    speed: "10 ft., fly 60 ft.",
    stats: [6, 14, 10, 3, 14, 5],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "",
    cr: "1/8",
    traits: [
      {
        name: "Keen Sight",
        desc: "The hawk has advantage on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The hawk has advantage on an attack roll against a creature if at least one of the hawk's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Blue Dragon Wyrmling",
    size: "Medium",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful evil",
    ac: 17,
    hp: 52,
    hit_dice: "8d8",
    speed: "30 ft., burrow 15 ft., fly 60 ft.",
    stats: [17, 10, 15, 12, 11, 15],
    saves: [
      {
        dexterity: 2
      },
      {
        constitution: 4
      },
      {
        wisdom: 2
      },
      {
        charisma: 4
      }
    ],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 14",
    languages: "Draconic",
    cr: "3",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage plus 3 (1d6) lightning damage.",
        attack_bonus: 5,
        damage_dice: "1d10 + 1d6",
        damage_bonus: 3
      },
      {
        name: "Lightning Breath (Recharge 5-6)",
        desc: "The dragon exhales lightning in a 30-foot line that is 5 feet wide. Each creature in that line must make a DC 12 Dexterity saving throw, taking 22 (4d10) lightning damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "4d10"
      }
    ]
  },
  {
    name: "Boar",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 11,
    hit_dice: "2d8",
    speed: "40 ft.",
    stats: [13, 11, 12, 2, 9, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 9",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Charge",
        desc: "If the boar moves at least 20 ft. straight toward a target and then hits it with a tusk attack on the same turn, the target takes an extra 3 (1d6) slashing damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",
        attack_bonus: 0,
        damage_dice: "1d6"
      },
      {
        name: "Relentless (Recharges after a Short or Long Rest)",
        desc: "If the boar takes 7 damage or less that would reduce it to 0 hit points, it is reduced to 1 hit point instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Tusk",
        desc: "Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) slashing damage.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Bone Devil",
    size: "Large",
    source: "SRD",
    type: "fiend",
    subtype: "devil",
    alignment: "lawful evil",
    ac: 19,
    hp: 142,
    hit_dice: "15d10",
    speed: "40 ft., fly 40 ft.",
    stats: [18, 16, 18, 13, 14, 16],
    saves: [
      {
        intelligence: 5
      },
      {
        wisdom: 6
      },
      {
        charisma: 7
      }
    ],
    skillsaves: [
      {
        deception: 7
      },
      {
        insight: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "darkvision 120 ft., passive Perception 9",
    languages: "Infernal, telepathy 120 ft.",
    cr: "12",
    traits: [
      {
        name: "Devil's Sight",
        desc: "Magical darkness doesn't impede the devil's darkvision.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The devil has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The devil makes three attacks: two with its claws and one with its sting.",
        attack_bonus: 0
      },
      {
        name: "Multiattack",
        desc: "The devil makes three attacks: two with its claws and one with its sting.",
        attack_bonus: 0
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 8 (1d8 + 4) slashing damage.",
        attack_bonus: 8,
        damage_dice: "1d8",
        damage_bonus: 4
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 8 (1d8 + 4) slashing damage.",
        attack_bonus: 8,
        damage_dice: "1d8",
        damage_bonus: 4
      },
      {
        name: "Sting",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 13 (2d8 + 4) piercing damage plus 17 (5d6) poison damage, and the target must succeed on a DC 14 Constitution saving throw or become poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success .",
        attack_bonus: 8,
        damage_dice: "2d8",
        damage_bonus: 4
      },
      {
        name: "Sting",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 13 (2d8 + 4) piercing damage plus 17 (5d6) poison damage, and the target must succeed on a DC 14 Constitution saving throw or become poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success .",
        attack_bonus: 8,
        damage_dice: "2d8",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Brass Dragon Wyrmling",
    size: "Medium",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic good",
    ac: 16,
    hp: 16,
    hit_dice: "3d8",
    speed: "30 ft., burrow 15 ft., fly 60 ft.",
    stats: [15, 10, 13, 10, 11, 13],
    saves: [
      {
        dexterity: 2
      },
      {
        constitution: 3
      },
      {
        wisdom: 2
      },
      {
        charisma: 3
      }
    ],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 14",
    languages: "Draconic",
    cr: "1",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d10",
        damage_bonus: 2
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nFire Breath. The dragon exhales fire in an 20-foot line that is 5 feet wide. Each creature in that line must make a DC 11 Dexterity saving throw, taking 14 (4d6) fire damage on a failed save, or half as much damage on a successful one.\nSleep Breath. The dragon exhales sleep gas in a 15-foot cone. Each creature in that area must succeed on a DC 11 Constitution saving throw or fall unconscious for 1 minute. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.",
        attack_bonus: 0,
        damage_dice: "4d6"
      }
    ]
  },
  {
    name: "Bronze Dragon Wyrmling",
    size: "Medium",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 17,
    hp: 32,
    hit_dice: "5d8",
    speed: "30 ft., fly 60 ft., swim 30 ft.",
    stats: [17, 10, 15, 12, 11, 15],
    saves: [
      {
        dexterity: 2
      },
      {
        constitution: 4
      },
      {
        wisdom: 2
      },
      {
        charisma: 4
      }
    ],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 14",
    languages: "Draconic",
    cr: "2",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d10",
        damage_bonus: 3
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nLightning Breath. The dragon exhales lightning in a 40-foot line that is 5 feet wide. Each creature in that line must make a DC 12 Dexterity saving throw, taking 16 (3d10) lightning damage on a failed save, or half as much damage on a successful one.\nRepulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 12 Strength saving throw. On a failed save, the creature is pushed 30 feet away from the dragon.",
        attack_bonus: 0,
        damage_dice: "3d10"
      }
    ]
  },
  {
    name: "Brown Bear",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 34,
    hit_dice: "4d10",
    speed: "40 ft., climb 30 ft.",
    stats: [19, 10, 16, 2, 13, 7],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Keen Smell",
        desc: "The bear has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The bear makes two attacks: one with its bite and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 4
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Bugbear",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "goblinoid",
    alignment: "chaotic evil",
    ac: 16,
    hp: 27,
    hit_dice: "5d8",
    speed: "30 ft.",
    stats: [15, 14, 13, 8, 11, 9],
    skillsaves: [
      {
        stealth: 6
      },
      {
        survival: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Common, Goblin",
    cr: "1",
    traits: [
      {
        name: "Brute",
        desc: "A melee weapon deals one extra die of its damage when the bugbear hits with it (included in the attack).",
        attack_bonus: 0
      },
      {
        name: "Surprise Attack",
        desc: "If the bugbear surprises a creature and hits it with an attack during the first round of combat, the target takes an extra 7 (2d6) damage from the attack.",
        attack_bonus: 0,
        damage_dice: "2d6"
      }
    ],
    actions: [
      {
        name: "Morningstar",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 11 (2d8 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "2d8",
        damage_bonus: 2
      },
      {
        name: "Javelin",
        desc: "Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 9 (2d6 + 2) piercing damage in melee or 5 (1d6 + 2) piercing damage at range.",
        attack_bonus: 4,
        damage_dice: "2d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Bulette",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 17,
    hp: 94,
    hit_dice: "9d10",
    speed: "40 ft., burrow 40 ft.",
    stats: [19, 11, 21, 2, 10, 5],
    skillsaves: [
      {
        perception: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., tremorsense 60 ft., passive Perception 16",
    languages: "",
    cr: "5",
    traits: [
      {
        name: "Standing Leap",
        desc: "The bulette's long jump is up to 30 ft. and its high jump is up to 15 ft., with or without a running start.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 30 (4d12 + 4) piercing damage.",
        attack_bonus: 7,
        damage_dice: "4d12",
        damage_bonus: 4
      },
      {
        name: "Deadly Leap",
        desc: "If the bulette jumps at least 15 ft. as part of its movement, it can then use this action to land on its ft. in a space that contains one or more other creatures. Each of those creatures must succeed on a DC 16 Strength or Dexterity saving throw (target's choice) or be knocked prone and take 14 (3d6 + 4) bludgeoning damage plus 14 (3d6 + 4) slashing damage. On a successful save, the creature takes only half the damage, isn't knocked prone, and is pushed 5 ft. out of the bulette's space into an unoccupied space of the creature's choice. If no unoccupied space is within range, the creature instead falls prone in the bulette's space.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Camel",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 9,
    hp: 15,
    hit_dice: "2d10",
    speed: "50 ft.",
    stats: [16, 8, 14, 2, 8, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 9",
    languages: "",
    cr: "1/8",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage.",
        attack_bonus: 5,
        damage_dice: "1d4"
      }
    ]
  },
  {
    name: "Carrion Crawler",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 51,
    hit_dice: "6d10",
    speed: "30 ft., climb 30 ft.",
    stats: [14, 13, 16, 1, 12, 5],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 13",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Keen Smell",
        desc: "The carrion crawler has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      },
      {
        name: "Spider Climb",
        desc: "The carrion crawler can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The carrion crawler makes two attacks: one with its tentacles and one with its bite.",
        attack_bonus: 0
      },
      {
        name: "Tentacles",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one creature. Hit: 4 (1d4 + 2) poison damage, and the target must succeed on a DC 13 Constitution saving throw or be poisoned for 1 minute. Until this poison ends, the target is paralyzed. The target can repeat the saving throw at the end of each of its turns, ending the poison on itself on a success.",
        attack_bonus: 8,
        damage_dice: "1d4",
        damage_bonus: 2
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "2d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Cat",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 2,
    hit_dice: "1d4",
    speed: "40 ft., climb 30 ft.",
    stats: [3, 15, 10, 3, 12, 7],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Keen Smell",
        desc: "The cat has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",
        attack_bonus: 0,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Cave Bear",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 42,
    hit_dice: "5d10",
    speed: "40 ft., swim 30 ft.",
    stats: [20, 10, 16, 2, 13, 7],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 13",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Keen Smell",
        desc: "The bear has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The bear makes two attacks: one with its bite and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 9 (1d8 + 5) piercing damage.",
        attack_bonus: 7,
        damage_dice: "1d8",
        damage_bonus: 5
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Centaur",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "neutral good",
    ac: 12,
    hp: 45,
    hit_dice: "6d10",
    speed: "50 ft.",
    stats: [18, 14, 14, 9, 13, 11],
    skillsaves: [
      {
        athletics: 6
      },
      {
        perception: 3
      },
      {
        survival: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "Elvish, Sylvan",
    cr: "2",
    traits: [
      {
        name: "Charge",
        desc: "If the centaur moves at least 30 ft. straight toward a target and then hits it with a pike attack on the same turn, the target takes an extra 10 (3d6) piercing damage.",
        attack_bonus: 0,
        damage_dice: "3d6"
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow.",
        attack_bonus: 0
      },
      {
        name: "Pike",
        desc: "Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 9 (1d10 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "1d10",
        damage_bonus: 4
      },
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Longbow",
        desc: "Ranged Weapon Attack: +4 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Chain Devil",
    size: "Medium",
    source: "SRD",
    type: "fiend",
    subtype: "devil",
    alignment: "lawful evil",
    ac: 16,
    hp: 85,
    hit_dice: "10d8",
    speed: "30 ft.",
    stats: [18, 15, 18, 11, 12, 14],
    damage_vulnerabilities: "",
    damage_resistances: "cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "darkvision 120 ft., passive Perception 8",
    languages: "Infernal, telepathy 120 ft.",
    cr: "11",
    traits: [
      {
        name: "Devil's Sight",
        desc: "Magical darkness doesn't impede the devil's darkvision.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The devil has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The devil makes two attacks with its chains.",
        attack_bonus: 0
      },
      {
        name: "Chain",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) slashing damage. The target is grappled (escape DC 14) if the devil isn't already grappling a creature. Until this grapple ends, the target is restrained and takes 7 (2d6) piercing damage at the start of each of its turns.",
        attack_bonus: 8,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Animate Chains (Recharges after a Short or Long Rest)",
        desc: "Up to four chains the devil can see within 60 feet of it magically sprout razor-edged barbs and animate under the devil's control, provided that the chains aren't being worn or carried.\nEach animated chain is an object with AC 20, 20 hit points, resistance to piercing damage, and immunity to psychic and thunder damage. When the devil uses Multiattack on its turn, it can use each animated chain to make one additional chain attack. An animated chain can grapple one creature of its own but can't make attacks while grappling. An animated chain reverts to its inanimate state if reduced to 0 hit points or if the devil is incapacitated or dies.",
        attack_bonus: 0
      }
    ],
    reactions: [
      {
        name: "Unnerving Mask",
        desc: "When a creature the devil can see starts its turn within 30 feet of the devil, the devil can create the illusion that it looks like one of the creature's departed loved ones or bitter enemies. If the creature can see the devil, it must succeed on a DC 14 Wisdom saving throw or be frightened until the end of its turn.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Chimera",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "chaotic evil",
    ac: 14,
    hp: 114,
    hit_dice: "12d10",
    speed: "30 ft., fly 60 ft.",
    stats: [19, 11, 19, 3, 14, 10],
    skillsaves: [
      {
        perception: 8
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 18",
    languages: "understands Draconic but can't speak",
    cr: "6",
    actions: [
      {
        name: "Multiattack",
        desc: "The chimera makes three attacks: one with its bite, one with its horns, and one with its claws. When its fire breath is available, it can use the breath in place of its bite or horns.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) piercing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Horns",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 10 (1d12 + 4) bludgeoning damage.",
        attack_bonus: 7,
        damage_dice: "1d12",
        damage_bonus: 4
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Fire Breath (Recharge 5-6)",
        desc: "The dragon head exhales fire in a 15-foot cone. Each creature in that area must make a DC 15 Dexterity saving throw, taking 31 (7d8) fire damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "7d8"
      }
    ]
  },
  {
    name: "Chuul",
    size: "Large",
    source: "SRD",
    type: "aberration",
    subtype: "",
    alignment: "chaotic evil",
    ac: 16,
    hp: 93,
    hit_dice: "11d10",
    speed: "30 ft., swim 30 ft.",
    stats: [19, 10, 16, 5, 11, 5],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "understands Deep Speech but can't speak",
    cr: "4",
    traits: [
      {
        name: "Amphibious",
        desc: "The chuul can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Sense Magic",
        desc: "The chuul senses magic within 120 feet of it at will. This trait otherwise works like the detect magic spell but isn't itself magical.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The chuul makes two pincer attacks. If the chuul is grappling a creature, the chuul can also use its tentacles once.",
        attack_bonus: 0
      },
      {
        name: "Pincer",
        desc: "Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage. The target is grappled (escape DC 14) if it is a Large or smaller creature and the chuul doesn't have two other creatures grappled.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Tentacles",
        desc: "One creature grappled by the chuul must succeed on a DC 13 Constitution saving throw or be poisoned for 1 minute. Until this poison ends, the target is paralyzed. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Clay Golem",
    size: "Large",
    source: "SRD",
    type: "construct",
    subtype: "",
    alignment: "unaligned",
    ac: 14,
    hp: 133,
    hit_dice: "14d10",
    speed: "20 ft.",
    stats: [20, 9, 18, 3, 8, 1],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid, poison, psychic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",
    condition_immunities: "charmed, exhaustion, frightened, paralyzed, petrified, poisoned",
    senses: "darkvision 60 ft., passive Perception 9",
    languages: "understands the languages of its creator but can't speak",
    cr: "9",
    traits: [
      {
        name: "Acid Absorption",
        desc: "Whenever the golem is subjected to acid damage, it takes no damage and instead regains a number of hit points equal to the acid damage dealt.",
        attack_bonus: 0
      },
      {
        name: "Berserk",
        desc: "Whenever the golem starts its turn with 60 hit points or fewer, roll a d6. On a 6, the golem goes berserk. On each of its turns while berserk, the golem attacks the nearest creature it can see. If no creature is near enough to move to and attack, the golem attacks an object, with preference for an object smaller than itself. Once the golem goes berserk, it continues to do so until it is destroyed or regains all its hit points.",
        attack_bonus: 0
      },
      {
        name: "Immutable Form",
        desc: "The golem is immune to any spell or effect that would alter its form.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The golem has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The golem's weapon attacks are magical.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The golem makes two slam attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 16 (2d10 + 5) bludgeoning damage. If the target is a creature, it must succeed on a DC 15 Constitution saving throw or have its hit point maximum reduced by an amount equal to the damage taken. The target dies if this attack reduces its hit point maximum to 0. The reduction lasts until removed by the greater restoration spell or other magic.",
        attack_bonus: 8,
        damage_dice: "2d10",
        damage_bonus: 5
      },
      {
        name: "Haste (Recharge 5-6)",
        desc: "Until the end of its next turn, the golem magically gains a +2 bonus to its AC, has advantage on Dexterity saving throws, and can use its slam attack as a bonus action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Cloaker",
    size: "Large",
    source: "SRD",
    type: "aberration",
    subtype: "",
    alignment: "chaotic neutral",
    ac: 14,
    hp: 78,
    hit_dice: "12d10",
    speed: "10 ft., fly 40 ft.",
    stats: [17, 15, 12, 13, 12, 14],
    skillsaves: [
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 11",
    languages: "Deep Speech, Undercommon",
    cr: "8",
    traits: [
      {
        name: "Damage Transfer",
        desc: "While attached to a creature, the cloaker takes only half the damage dealt to it (rounded down). and that creature takes the other half.",
        attack_bonus: 0
      },
      {
        name: "False Appearance",
        desc: "While the cloaker remains motionless without its underside exposed, it is indistinguishable from a dark leather cloak.",
        attack_bonus: 0
      },
      {
        name: "Light Sensitivity",
        desc: "While in bright light, the cloaker has disadvantage on attack rolls and Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The cloaker makes two attacks: one with its bite and one with its tail.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 10 (2d6 + 3) piercing damage, and if the target is Large or smaller, the cloaker attaches to it. If the cloaker has advantage against the target, the cloaker attaches to the target's head, and the target is blinded and unable to breathe while the cloaker is attached. While attached, the cloaker can make this attack only against the target and has advantage on the attack roll. The cloaker can detach itself by spending 5 feet of its movement. A creature, including the target, can take its action to detach the cloaker by succeeding on a DC 16 Strength check.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 3
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +6 to hit, reach 10 ft., one creature. Hit: 7 (1d8 + 3) slashing damage.",
        attack_bonus: 6,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Moan",
        desc: "Each creature within 60 feet of the cloaker that can hear its moan and that isn't an aberration must succeed on a DC 13 Wisdom saving throw or become frightened until the end of the cloaker's next turn. If a creature's saving throw is successful, the creature is immune to the cloaker's moan for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Phantasms (Recharges after a Short or Long Rest)",
        desc: "The cloaker magically creates three illusory duplicates of itself if it isn't in bright light. The duplicates move with it and mimic its actions, shifting position so as to make it impossible to track which cloaker is the real one. If the cloaker is ever in an area of bright light, the duplicates disappear.\nWhenever any creature targets the cloaker with an attack or a harmful spell while a duplicate remains, that creature rolls randomly to determine whether it targets the cloaker or one of the duplicates. A creature is unaffected by this magical effect if it can't see or if it relies on senses other than sight.\nA duplicate has the cloaker's AC and uses its saving throws. If an attack hits a duplicate, or if a duplicate fails a saving throw against an effect that deals damage, the duplicate disappears.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Cloud Giant",
    size: "Huge",
    source: "SRD",
    type: "giant",
    subtype: "",
    alignment: "neutral good (50%) or neutral evil (50%)",
    ac: 14,
    hp: 200,
    hit_dice: "16d12",
    speed: "40 ft.",
    stats: [27, 10, 22, 12, 16, 16],
    saves: [
      {
        constitution: 10
      },
      {
        wisdom: 7
      },
      {
        charisma: 7
      }
    ],
    skillsaves: [
      {
        insight: 7
      },
      {
        perception: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 17",
    languages: "Common, Giant",
    cr: "9",
    traits: [
      {
        name: "Keen Smell",
        desc: "The giant has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The giant's innate spellcasting ability is Charisma. It can innately cast the following spells, requiring no material components:\n\nAt will: detect magic, fog cloud, light\n3/day each: feather fall, fly, misty step, telekinesis\n1/day each: control weather, gaseous form",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The giant makes two morningstar attacks.",
        attack_bonus: 0
      },
      {
        name: "Morningstar",
        desc: "Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 21 (3d8 + 8) piercing damage.",
        attack_bonus: 12,
        damage_dice: "3d8",
        damage_bonus: 8
      },
      {
        name: "Rock",
        desc: "Ranged Weapon Attack: +12 to hit, range 60/240 ft., one target. Hit: 30 (4d10 + 8) bludgeoning damage.",
        attack_bonus: 12,
        damage_dice: "4d10",
        damage_bonus: 8
      }
    ]
  },
  {
    name: "Cockatrice",
    size: "Small",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 27,
    hit_dice: "6d6",
    speed: "20 ft., fly 40 ft.",
    stats: [6, 12, 12, 2, 13, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 11",
    languages: "",
    cr: "1/2",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 3 (1d4 + 1) piercing damage, and the target must succeed on a DC 11 Constitution saving throw against being magically petrified. On a failed save, the creature begins to turn to stone and is restrained. It must repeat the saving throw at the end of its next turn. On a success, the effect ends. On a failure, the creature is petrified for 24 hours.",
        attack_bonus: 3,
        damage_dice: "1d4",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Commoner",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 10,
    hp: 4,
    hit_dice: "1d8",
    speed: "30 ft.",
    stats: [10, 10, 10, 10, 10, 10],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "any one language (usually Common)",
    cr: "0",
    actions: [
      {
        name: "Club",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage.",
        attack_bonus: 2,
        damage_dice: "1d4"
      }
    ]
  },
  {
    name: "Constrictor Snake",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 13,
    hit_dice: "2d10",
    speed: "30 ft., swim 30 ft.",
    stats: [15, 14, 12, 1, 10, 3],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 10 ft., passive Perception 10",
    languages: "",
    cr: "1/4",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Constrict",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 6 (1d8 + 2) bludgeoning damage, and the target is grappled (escape DC 14). Until this grapple ends, the creature is restrained, and the snake can't constrict another target.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Copper Dragon Wyrmling",
    size: "Medium",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic good",
    ac: 16,
    hp: 22,
    hit_dice: "4d8",
    speed: "30 ft., climb 30 ft., fly 60 ft.",
    stats: [15, 12, 13, 14, 11, 13],
    saves: [
      {
        dexterity: 3
      },
      {
        constitution: 3
      },
      {
        wisdom: 2
      },
      {
        charisma: 3
      }
    ],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 14",
    languages: "Draconic",
    cr: "1",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d10",
        damage_bonus: 2
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nAcid Breath. The dragon exhales acid in an 20-foot line that is 5 feet wide. Each creature in that line must make a DC 11 Dexterity saving throw, taking 18 (4d8) acid damage on a failed save, or half as much damage on a successful one.\nSlowing Breath. The dragon exhales gas in a 1 5-foot cone. Each creature in that area must succeed on a DC 11 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.",
        attack_bonus: 0,
        damage_dice: "4d8"
      }
    ]
  },
  {
    name: "Couatl",
    size: "Medium",
    source: "SRD",
    type: "celestial",
    subtype: "",
    alignment: "lawful good",
    ac: 19,
    hp: 97,
    hit_dice: "13d8",
    speed: "30 ft., fly 90 ft.",
    stats: [16, 20, 17, 18, 20, 18],
    saves: [
      {
        constitution: 5
      },
      {
        wisdom: 7
      },
      {
        charisma: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "radiant",
    damage_immunities: "psychic; bludgeoning, piercing, and slashing from nonmagical weapons",
    condition_immunities: "",
    senses: "truesight 120 ft., passive Perception 15",
    languages: "all, telepathy 120 ft.",
    cr: "4",
    traits: [
      {
        name: "Innate Spellcasting",
        desc: "The couatl's spellcasting ability is Charisma (spell save DC 14). It can innately cast the following spells, requiring only verbal components:\n\nAt will: detect evil and good, detect magic, detect thoughts\n3/day each: bless, create food and water, cure wounds, lesser restoration, protection from poison, sanctuary, shield\n1/day each: dream, greater restoration, scrying",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The couatl's weapon attacks are magical.",
        attack_bonus: 0
      },
      {
        name: "Shielded Mind",
        desc: "The couatl is immune to scrying and to any effect that would sense its emotions, read its thoughts, or detect its location.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one creature. Hit: 8 (1d6 + 5) piercing damage, and the target must succeed on a DC 13 Constitution saving throw or be poisoned for 24 hours. Until this poison ends, the target is unconscious. Another creature can use an action to shake the target awake.",
        attack_bonus: 8,
        damage_dice: "1d6",
        damage_bonus: 5
      },
      {
        name: "Constrict",
        desc: "Melee Weapon Attack: +6 to hit, reach 10 ft., one Medium or smaller creature. Hit: 10 (2d6 + 3) bludgeoning damage, and the target is grappled (escape DC 15). Until this grapple ends, the target is restrained, and the couatl can't constrict another target.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 3
      },
      {
        name: "Change Shape",
        desc: "The couatl magically polymorphs into a humanoid or beast that has a challenge rating equal to or less than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the couatl's choice).\nIn a new form, the couatl retains its game statistics and ability to speak, but its AC, movement modes, Strength, Dexterity, and other actions are replaced by those of the new form, and it gains any statistics and capabilities (except class features, legendary actions, and lair actions) that the new form has but that it lacks. If the new form has a bite attack, the couatl can use its bite in that form.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Crab",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 2,
    hit_dice: "1d4",
    speed: "20 ft., swim 20 ft.",
    stats: [2, 11, 10, 1, 8, 2],
    skillsaves: [
      {
        stealth: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 30 ft., passive Perception 9",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Amphibious",
        desc: "The crab can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 bludgeoning damage.",
        attack_bonus: 0,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Crocodile",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 19,
    hit_dice: "3d10",
    speed: "20 ft., swim 20 ft.",
    stats: [15, 10, 13, 2, 10, 5],
    skillsaves: [
      {
        stealth: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Hold Breath",
        desc: "The crocodile can hold its breath for 15 minutes.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (1d10 + 2) piercing damage, and the target is grappled (escape DC 12). Until this grapple ends, the target is restrained, and the crocodile can't bite another target",
        attack_bonus: 4,
        damage_dice: "1d10",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Cult Fanatic",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any non-good alignment",
    ac: 13,
    hp: 22,
    hit_dice: "6d8",
    speed: "30 ft.",
    stats: [11, 14, 12, 10, 13, 14],
    skillsaves: [
      {
        deception: 4
      },
      {
        persuasion: 4
      },
      {
        religion: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 11",
    languages: "any one language (usually Common)",
    cr: "2",
    traits: [
      {
        name: "Dark Devotion",
        desc: "The fanatic has advantage on saving throws against being charmed or frightened.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The fanatic makes two melee attacks.",
        attack_bonus: 0
      },
      {
        name: "Dagger",
        desc: "Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 20/60 ft., one creature. Hit: 4 (1d4 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ],
    spells: [
      "The fanatic is a 4th-level spellcaster. Its spell casting ability is Wisdom (spell save DC 11, +3 to hit with spell attacks). The fanatic has the following cleric spells prepared:",
      "Cantrips (at will): light, sacred flame, thaumaturgy",
      {
        "1st level (4 slots)": "command, inflict wounds, shield of faith"
      },
      {
        "2nd level (3 slots)": "hold person, spiritual weapon"
      }
    ]
  },
  {
    name: "Cultist",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any non-good alignment",
    ac: 12,
    hp: 9,
    hit_dice: "2d8",
    speed: "30 ft.",
    stats: [11, 12, 10, 10, 11, 10],
    skillsaves: [
      {
        deception: 2
      },
      {
        religion: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "any one language (usually Common)",
    cr: "1/8",
    traits: [
      {
        name: "Dark Devotion",
        desc: "The cultist has advantage on saving throws against being charmed or frightened.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Scimitar",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 4 (1d6 + 1) slashing damage.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Darkmantle",
    size: "Small",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 22,
    hit_dice: "5d6",
    speed: "10 ft., fly 30 ft.",
    stats: [16, 12, 13, 2, 10, 5],
    skillsaves: [
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 60 ft., passive Perception 10",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Echolocation",
        desc: "The darkmantle can't use its blindsight while deafened.",
        attack_bonus: 0
      },
      {
        name: "False Appearance",
        desc: "While the darkmantle remains motionless, it is indistinguishable from a cave formation such as a stalactite or stalagmite.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Crush",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 6 (1d6 + 3) bludgeoning damage, and the darkmantle attaches to the target. If the target is Medium or smaller and the darkmantle has advantage on the attack roll, it attaches by engulfing the target's head, and the target is also blinded and unable to breathe while the darkmantle is attached in this way.\nWhile attached to the target, the darkmantle can attack no other creature except the target but has advantage on its attack rolls. The darkmantle's speed also becomes 0, it can't benefit from any bonus to its speed, and it moves with the target.\nA creature can detach the darkmantle by making a successful DC 13 Strength check as an action. On its turn, the darkmantle can detach itself from the target by using 5 feet of movement.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Darkness Aura (1/day)",
        desc: "A 15-foot radius of magical darkness extends out from the darkmantle, moves with it, and spreads around corners. The darkness lasts as long as the darkmantle maintains concentration, up to 10 minutes (as if concentrating on a spell). Darkvision can't penetrate this darkness, and no natural light can illuminate it. If any of the darkness overlaps with an area of light created by a spell of 2nd level or lower, the spell creating the light is dispelled.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Death Dog",
    size: "Medium",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "neutral evil",
    ac: 12,
    hp: 39,
    hit_dice: "6d8",
    speed: "40 ft.",
    stats: [15, 14, 14, 3, 13, 6],
    skillsaves: [
      {
        perception: 5
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 15",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Two-Headed",
        desc: "The dog has advantage on Wisdom (Perception) checks and on saving throws against being blinded, charmed, deafened, frightened, stunned, or knocked unconscious.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dog makes two bite attacks.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage. If the target is a creature, it must succeed on a DC 12 Constitution saving throw against disease or become poisoned until the disease is cured. Every 24 hours that elapse, the creature must repeat the saving throw, reducing its hit point maximum by 5 (1d10) on a failure. This reduction lasts until the disease is cured. The creature dies if the disease reduces its hit point maximum to 0.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Deep Gnome (Svirfneblin)",
    size: "Small",
    source: "SRD",
    type: "humanoid",
    subtype: "gnome",
    alignment: "neutral good",
    ac: 15,
    hp: 16,
    hit_dice: "3d6",
    speed: "20 ft.",
    stats: [15, 14, 14, 12, 10, 9],
    skillsaves: [
      {
        perception: 2
      },
      {
        investigation: 3
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 12",
    languages: "Gnomish, Terran, Undercommon",
    cr: "1/2",
    traits: [
      {
        name: "Stone Camouflage",
        desc: "The gnome has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",
        attack_bonus: 0
      },
      {
        name: "Gnome Cunning",
        desc: "The gnome has advantage on Intelligence, Wisdom, and Charisma saving throws against magic.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The gnome's innate spellcasting ability is Intelligence (spell save DC 11). It can innately cast the following spells, requiring no material components:\nAt will: nondetection (self only)\n1/day each: blindness/deafness, blur, disguise self",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "War Pick",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      },
      {
        name: "Poisoned Dart",
        desc: "Ranged Weapon Attack: +4 to hit, range 30/120 ft., one creature. Hit: 4 (1d4 + 2) piercing damage, and the target must succeed on a DC 12 Constitution saving throw or be poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Deer",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 4,
    hit_dice: "1d8",
    speed: "50 ft.",
    stats: [11, 16, 11, 2, 14, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 12",
    languages: "",
    cr: "0",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) piercing damage.",
        attack_bonus: 2,
        damage_dice: "1d4"
      }
    ]
  },
  {
    name: "Deva",
    size: "Medium",
    source: "SRD",
    type: "celestial",
    subtype: "",
    alignment: "lawful good",
    ac: 17,
    hp: 136,
    hit_dice: "16d8",
    speed: "30 ft., fly 90 ft.",
    stats: [18, 18, 18, 17, 20, 20],
    saves: [
      {
        wisdom: 9
      },
      {
        charisma: 9
      }
    ],
    skillsaves: [
      {
        insight: 9
      },
      {
        perception: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "radiant; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "",
    condition_immunities: "charmed, exhaustion, frightened",
    senses: "darkvision 120 ft., passive Perception 19",
    languages: "all, telepathy 120 ft.",
    cr: "10",
    traits: [
      {
        name: "Angelic Weapons",
        desc: "The deva's weapon attacks are magical. When the deva hits with any weapon, the weapon deals an extra 4d8 radiant damage (included in the attack).",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The deva's spellcasting ability is Charisma (spell save DC 17). The deva can innately cast the following spells, requiring only verbal components:\nAt will: detect evil and good\n1/day each: commune, raise dead",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The deva has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The deva makes two melee attacks.",
        attack_bonus: 0
      },
      {
        name: "Mace",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 7 (1d6 + 4) bludgeoning damage plus 18 (4d8) radiant damage.",
        attack_bonus: 8,
        damage_dice: "1d6 + 4d8",
        damage_bonus: 4
      },
      {
        name: "Healing Touch (3/Day)",
        desc: "The deva touches another creature. The target magically regains 20 (4d8 + 2) hit points and is freed from any curse, disease, poison, blindness, or deafness.",
        attack_bonus: 0
      },
      {
        name: "Change Shape",
        desc: "The deva magically polymorphs into a humanoid or beast that has a challenge rating equal to or less than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the deva's choice).\nIn a new form, the deva retains its game statistics and ability to speak, but its AC, movement modes, Strength, Dexterity, and special senses are replaced by those of the new form, and it gains any statistics and capabilities (except class features, legendary actions, and lair actions) that the new form has but that it lacks.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Dire Wolf",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 14,
    hp: 37,
    hit_dice: "5d10",
    speed: "50 ft.",
    stats: [17, 15, 15, 3, 12, 7],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Keen Hearing and Smell",
        desc: "The wolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The wolf has advantage on an attack roll against a creature if at least one of the wolf's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Djinni",
    size: "Large",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "chaotic good",
    ac: 17,
    hp: 161,
    hit_dice: "14d10",
    speed: "30 ft., fly 90 ft.",
    stats: [21, 15, 22, 15, 16, 20],
    saves: [
      {
        dexterity: 6
      },
      {
        wisdom: 7
      },
      {
        charisma: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning, thunder",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 13",
    languages: "Auran",
    cr: "11",
    traits: [
      {
        name: "Elemental Demise",
        desc: "If the djinni dies, its body disintegrates into a warm breeze, leaving behind only equipment the djinni was wearing or carrying.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The djinni's innate spellcasting ability is Charisma (spell save DC 17, +9 to hit with spell attacks). It can innately cast the following spells, requiring no material components:\n\nAt will: detect evil and good, detect magic, thunderwave 3/day each: create food and water (can create wine instead of water), tongues, wind walk\n1/day each: conjure elemental (air elemental only), creation, gaseous form, invisibility, major image, plane shift",
        attack_bonus: 0
      },
      {
        name: "Variant: Genie Powers",
        desc: "Genies have a variety of magical capabilities, including spells. A few have even greater powers that allow them to alter their appearance or the nature of reality.\n\nDisguises.\nSome genies can veil themselves in illusion to pass as other similarly shaped creatures. Such genies can innately cast the disguise self spell at will, often with a longer duration than is normal for that spell. Mightier genies can cast the true polymorph spell one to three times per day, possibly with a longer duration than normal. Such genies can change only their own shape, but a rare few can use the spell on other creatures and objects as well.\nWishes.\nThe genie power to grant wishes is legendary among mortals. Only the most potent genies, such as those among the nobility, can do so. A particular genie that has this power can grant one to three wishes to a creature that isn't a genie. Once a genie has granted its limit of wishes, it can't grant wishes again for some amount of time (usually 1 year). and cosmic law dictates that the same genie can expend its limit of wishes on a specific creature only once in that creature's existence.\nTo be granted a wish, a creature within 60 feet of the genie states a desired effect to it. The genie can then cast the wish spell on the creature's behalf to bring about the effect. Depending on the genie's nature, the genie might try to pervert the intent of the wish by exploiting the wish's poor wording. The perversion of the wording is usually crafted to be to the genie's benefit.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The djinni makes three scimitar attacks.",
        attack_bonus: 0
      },
      {
        name: "Scimitar",
        desc: "Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage plus 3 (1d6) lightning or thunder damage (djinni's choice).",
        attack_bonus: 9,
        damage_dice: "2d6 + 1d6",
        damage_bonus: 5
      },
      {
        name: "Create Whirlwind",
        desc: "A 5-foot-radius, 30-foot-tall cylinder of swirling air magically forms on a point the djinni can see within 120 feet of it. The whirlwind lasts as long as the djinni maintains concentration (as if concentrating on a spell). Any creature but the djinni that enters the whirlwind must succeed on a DC 18 Strength saving throw or be restrained by it. The djinni can move the whirlwind up to 60 feet as an action, and creatures restrained by the whirlwind move with it. The whirlwind ends if the djinni loses sight of it.\nA creature can use its action to free a creature restrained by the whirlwind, including itself, by succeeding on a DC 18 Strength check. If the check succeeds, the creature is no longer restrained and moves to the nearest space outside the whirlwind.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Doppelganger",
    size: "Medium",
    source: "SRD",
    type: "monstrosity",
    subtype: "shapechanger",
    alignment: "unaligned",
    ac: 14,
    hp: 52,
    hit_dice: "8d8",
    speed: "30 ft.",
    stats: [11, 18, 14, 11, 12, 14],
    skillsaves: [
      {
        deception: 6
      },
      {
        insight: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "charmed",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 11",
    languages: "Common",
    cr: "3",
    traits: [
      {
        name: "Shapechanger",
        desc: "The doppelganger can use its action to polymorph into a Small or Medium humanoid it has seen, or back into its true form. Its statistics, other than its size, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",
        attack_bonus: 0
      },
      {
        name: "Ambusher",
        desc: "The doppelganger has advantage on attack rolls against any creature it has surprised.",
        attack_bonus: 0
      },
      {
        name: "Surprise Attack",
        desc: "If the doppelganger surprises a creature and hits it with an attack during the first round of combat, the target takes an extra 10 (3d6) damage from the attack.",
        attack_bonus: 0,
        damage_dice: "3d6"
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The doppelganger makes two melee attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 7 (1d6 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "1d6",
        damage_bonus: 4
      },
      {
        name: "Read Thoughts",
        desc: "The doppelganger magically reads the surface thoughts of one creature within 60 ft. of it. The effect can penetrate barriers, but 3 ft. of wood or dirt, 2 ft. of stone, 2 inches of metal, or a thin sheet of lead blocks it. While the target is in range, the doppelganger can continue reading its thoughts, as long as the doppelganger's concentration isn't broken (as if concentrating on a spell). While reading the target's mind, the doppelganger has advantage on Wisdom (Insight) and Charisma (Deception, Intimidation, and Persuasion) checks against the target.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Draft Horse",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 19,
    hit_dice: "3d10",
    speed: "40 ft.",
    stats: [18, 10, 12, 2, 11, 7],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "1/4",
    actions: [
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (2d4 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "2d4",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Dragon Turtle",
    size: "Gargantuan",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "neutral",
    ac: 20,
    hp: 341,
    hit_dice: "22d20",
    speed: "20 ft., swim 40 ft.",
    stats: [25, 10, 20, 10, 12, 12],
    saves: [
      {
        dexterity: 6
      },
      {
        constitution: 11
      },
      {
        wisdom: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "fire",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 11",
    languages: "Aquan, Draconic",
    cr: "17",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon turtle can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon turtle makes three attacks: one with its bite and two with its claws. It can make one tail attack in place of its two claw attacks.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +13 to hit, reach 15 ft., one target. Hit: 26 (3d12 + 7) piercing damage.",
        attack_bonus: 13,
        damage_dice: "3d12",
        damage_bonus: 7
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 16 (2d8 + 7) slashing damage.",
        attack_bonus: 13,
        damage_dice: "2d8",
        damage_bonus: 7
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +13 to hit, reach 15 ft., one target. Hit: 26 (3d12 + 7) bludgeoning damage. If the target is a creature, it must succeed on a DC 20 Strength saving throw or be pushed up to 10 feet away from the dragon turtle and knocked prone.",
        attack_bonus: 13,
        damage_dice: "3d12",
        damage_bonus: 7
      },
      {
        name: "Steam Breath (Recharge 5-6)",
        desc: "The dragon turtle exhales scalding steam in a 60-foot cone. Each creature in that area must make a DC 18 Constitution saving throw, taking 52 (15d6) fire damage on a failed save, or half as much damage on a successful one. Being underwater doesn't grant resistance against this damage.",
        attack_bonus: 0,
        damage_dice: "15d6"
      }
    ]
  },
  {
    name: "Dretch",
    size: "Small",
    source: "SRD",
    type: "fiend",
    subtype: "demon",
    alignment: "chaotic evil",
    ac: 11,
    hp: 18,
    hit_dice: "4d6",
    speed: "20 ft.",
    stats: [11, 11, 12, 5, 8, 3],
    damage_vulnerabilities: "",
    damage_resistances: "cold, fire, lightning",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 9",
    languages: "Abyssal, telepathy 60 ft. (works only with creatures that understand Abyssal)",
    cr: "1/4",
    actions: [
      {
        name: "Multiattack",
        desc: "The dretch makes two attacks: one with its bite and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 3 (1d6) piercing damage.",
        attack_bonus: 2,
        damage_dice: "1d6"
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 5 (2d4) slashing damage.",
        attack_bonus: 2,
        damage_dice: "2d4"
      },
      {
        name: "Fetid Cloud (1/Day)",
        desc: "A 10-foot radius of disgusting green gas extends out from the dretch. The gas spreads around corners, and its area is lightly obscured. It lasts for 1 minute or until a strong wind disperses it. Any creature that starts its turn in that area must succeed on a DC 11 Constitution saving throw or be poisoned until the start of its next turn. While poisoned in this way, the target can take either an action or a bonus action on its turn, not both, and can't take reactions.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Drider",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "chaotic evil",
    ac: 19,
    hp: 123,
    hit_dice: "13d10",
    speed: "30 ft., climb 30 ft.",
    stats: [16, 16, 18, 13, 14, 12],
    skillsaves: [
      {
        perception: 5
      },
      {
        stealth: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 15",
    languages: "Elvish, Undercommon",
    cr: "6",
    traits: [
      {
        name: "Fey Ancestry",
        desc: "The drider has advantage on saving throws against being charmed, and magic can't put the drider to sleep.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The drider's innate spellcasting ability is Wisdom (spell save DC 13). The drider can innately cast the following spells, requiring no material components:\nAt will: dancing lights\n1/day each: darkness, faerie fire",
        attack_bonus: 0
      },
      {
        name: "Spider Climb",
        desc: "The drider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      },
      {
        name: "Sunlight Sensitivity",
        desc: "While in sunlight, the drider has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      },
      {
        name: "Web Walker",
        desc: "The drider ignores movement restrictions caused by webbing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The drider makes three attacks, either with its longsword or its longbow. It can replace one of those attacks with a bite attack.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 2 (1d4) piercing damage plus 9 (2d8) poison damage.",
        attack_bonus: 6,
        damage_dice: "1d4",
        damage_bonus: 2
      },
      {
        name: "Longsword",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage, or 8 (1d10 + 3) slashing damage if used with two hands.",
        attack_bonus: 6,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Longbow",
        desc: "Ranged Weapon Attack: +6 to hit, range 150/600 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 4 (1d8) poison damage.",
        attack_bonus: 6,
        damage_dice: "1d8",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Drow",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "elf",
    alignment: "neutral evil",
    ac: 15,
    hp: 13,
    hit_dice: "3d8",
    speed: "30 ft.",
    stats: [10, 14, 10, 11, 11, 12],
    skillsaves: [
      {
        perception: 2
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 12",
    languages: "Elvish, Undercommon",
    cr: "1/4",
    traits: [
      {
        name: "Fey Ancestry",
        desc: "The drow has advantage on saving throws against being charmed, and magic can't put the drow to sleep.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The drow's spellcasting ability is Charisma (spell save DC 11). It can innately cast the following spells, requiring no material components:\nAt will: dancing lights\n1/day each: darkness, faerie fire",
        attack_bonus: 0
      },
      {
        name: "Sunlight Sensitivity",
        desc: "While in sunlight, the drow has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Shortsword",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Hand Crossbow",
        desc: "Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage, and the target must succeed on a DC 13 Constitution saving throw or be poisoned for 1 hour. If the saving throw fails by 5 or more, the target is also unconscious while poisoned in this way. The target wakes up if it takes damage or if another creature takes an action to shake it awake.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Druid",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 11,
    hp: 27,
    hit_dice: "5d8",
    speed: "30 ft.",
    stats: [10, 12, 13, 12, 15, 11],
    skillsaves: [
      {
        nature: 3
      },
      {
        medicine: 4
      },
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "Druidic plus any two languages",
    cr: "2",
    traits: [],
    actions: [
      {
        name: "Quarterstaff",
        desc: "Melee Weapon Attack: +2 to hit (+4 to hit with shillelagh), reach 5 ft., one target. Hit: 3 (1d6) bludgeoning damage, or 6 (1d8 + 2) bludgeoning damage with shillelagh or if wielded with two hands.",
        attack_bonus: 2,
        damage_dice: "1d6"
      }
    ],
    spells: [
      "The druid is a 4th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 12, +4 to hit with spell attacks). It has the following druid spells prepared:",
      {
        "Cantrips (at will)": "druidcraft, produce flame, shillelagh"
      },
      {
        "1st level (4 slots)": "entangle, longstrider, speak with animals, thunderwave"
      },
      {
        "2nd level (3 slots)": "animal messenger, barkskin"
      }
    ]
  },
  {
    name: "Dryad",
    size: "Medium",
    source: "SRD",
    type: "fey",
    subtype: "",
    alignment: "neutral",
    ac: 11,
    hp: 22,
    hit_dice: "5d8",
    speed: "30 ft.",
    stats: [10, 12, 11, 14, 15, 18],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "Elvish, Sylvan",
    cr: "1",
    traits: [
      {
        name: "Innate Spellcasting",
        desc: "The dryad's innate spellcasting ability is Charisma (spell save DC 14). The dryad can innately cast the following spells, requiring no material components:\n\nAt will: druidcraft\n3/day each: entangle, goodberry\n1/day each: barkskin, pass without trace, shillelagh",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The dryad has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Speak with Beasts and Plants",
        desc: "The dryad can communicate with beasts and plants as if they shared a language.",
        attack_bonus: 0
      },
      {
        name: "Tree Stride",
        desc: "Once on her turn, the dryad can use 10 ft. of her movement to step magically into one living tree within her reach and emerge from a second living tree within 60 ft. of the first tree, appearing in an unoccupied space within 5 ft. of the second tree. Both trees must be large or bigger.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Club",
        desc: "Melee Weapon Attack: +2 to hit (+6 to hit with shillelagh), reach 5 ft., one target. Hit: 2 (1 d4) bludgeoning damage, or 8 (1d8 + 4) bludgeoning damage with shillelagh.",
        attack_bonus: 2,
        damage_dice: "1d4"
      },
      {
        name: "Fey Charm",
        desc: "The dryad targets one humanoid or beast that she can see within 30 feet of her. If the target can see the dryad, it must succeed on a DC 14 Wisdom saving throw or be magically charmed. The charmed creature regards the dryad as a trusted friend to be heeded and protected. Although the target isn't under the dryad's control, it takes the dryad's requests or actions in the most favorable way it can.\nEach time the dryad or its allies do anything harmful to the target, it can repeat the saving throw, ending the effect on itself on a success. Otherwise, the effect lasts 24 hours or until the dryad dies, is on a different plane of existence from the target, or ends the effect as a bonus action. If a target's saving throw is successful, the target is immune to the dryad's Fey Charm for the next 24 hours.\nThe dryad can have no more than one humanoid and up to three beasts charmed at a time.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Duergar",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "dwarf",
    alignment: "lawful evil",
    ac: 16,
    hp: 26,
    hit_dice: "4d8",
    speed: "25 ft.",
    stats: [14, 11, 14, 11, 10, 9],
    damage_vulnerabilities: "",
    damage_resistances: "poison",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 10",
    languages: "Dwarvish, Undercommon",
    cr: "1",
    traits: [
      {
        name: "Duergar Resilience",
        desc: "The duergar has advantage on saving throws against poison, spells, and illusions, as well as to resist being charmed or paralyzed.",
        attack_bonus: 0
      },
      {
        name: "Sunlight Sensitivity",
        desc: "While in sunlight, the duergar has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Enlarge (Recharges after a Short or Long Rest)",
        desc: "For 1 minute, the duergar magically increases in size, along with anything it is wearing or carrying. While enlarged, the duergar is Large, doubles its damage dice on Strength-based weapon attacks (included in the attacks), and makes Strength checks and Strength saving throws with advantage. If the duergar lacks the room to become Large, it attains the maximum size possible in the space available.",
        attack_bonus: 0
      },
      {
        name: "War Pick",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage, or 11 (2d8 + 2) piercing damage while enlarged.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      },
      {
        name: "Javelin",
        desc: "Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage, or 9 (2d6 + 2) piercing damage while enlarged.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Invisibility (Recharges after a Short or Long Rest)",
        desc: "The duergar magically turns invisible until it attacks, casts a spell, or uses its Enlarge, or until its concentration is broken, up to 1 hour (as if concentrating on a spell). Any equipment the duergar wears or carries is invisible with it .",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Dust Mephit",
    size: "Small",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral evil",
    ac: 12,
    hp: 17,
    hit_dice: "5d6",
    speed: "30 ft., fly 30 ft.",
    stats: [5, 14, 10, 9, 11, 10],
    skillsaves: [
      {
        perception: 2
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "fire",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 12",
    languages: "Auran, Terran",
    cr: "1/2",
    traits: [
      {
        name: "Death Burst",
        desc: "When the mephit dies, it explodes in a burst of dust. Each creature within 5 ft. of it must then succeed on a DC 10 Constitution saving throw or be blinded for 1 minute. A blinded creature can repeat the saving throw on each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting (1/Day)",
        desc: "The mephit can innately cast sleep, requiring no material components. Its innate spellcasting ability is Charisma.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) slashing damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      },
      {
        name: "Blinding Breath (Recharge 6)",
        desc: "The mephit exhales a 15-foot cone of blinding dust. Each creature in that area must succeed on a DC 10 Dexterity saving throw or be blinded for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0
      },
      {
        name: "Variant: Summon Mephits (1/Day)",
        desc: "The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Eagle",
    size: "Small",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 3,
    hit_dice: "1d6",
    speed: "10 ft., fly 60 ft.",
    stats: [6, 15, 10, 2, 14, 7],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Keen Sight",
        desc: "The eagle has advantage on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Talons",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) slashing damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Earth Elemental",
    size: "Large",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral",
    ac: 17,
    hp: 126,
    hit_dice: "12d10",
    speed: "30 ft., burrow 30 ft.",
    stats: [20, 8, 20, 5, 10, 5],
    damage_vulnerabilities: "thunder",
    damage_resistances: "bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "poison",
    condition_immunities: "exhaustion, paralyzed, petrified, poisoned, unconscious",
    senses: "darkvision 60 ft., tremorsense 60 ft., passive Perception 10",
    languages: "Terran",
    cr: "5",
    traits: [
      {
        name: "Earth Glide",
        desc: "The elemental can burrow through nonmagical, unworked earth and stone. While doing so, the elemental doesn't disturb the material it moves through.",
        attack_bonus: 0
      },
      {
        name: "Siege Monster",
        desc: "The elemental deals double damage to objects and structures.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The elemental makes two slam attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 14 (2d8 + 5) bludgeoning damage.",
        attack_bonus: 8,
        damage_dice: "2d8",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Efreeti",
    size: "Large",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "lawful evil",
    ac: 17,
    hp: 200,
    hit_dice: "16d10",
    speed: "40 ft., fly 60 ft.",
    stats: [22, 12, 24, 16, 15, 16],
    saves: [
      {
        intelligence: 7
      },
      {
        wisdom: 6
      },
      {
        charisma: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 12",
    languages: "Ignan",
    cr: "11",
    traits: [
      {
        name: "Elemental Demise",
        desc: "If the efreeti dies, its body disintegrates in a flash of fire and puff of smoke, leaving behind only equipment the djinni was wearing or carrying.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The efreeti's innate spell casting ability is Charisma (spell save DC 15, +7 to hit with spell attacks). It can innately cast the following spells, requiring no material components:\n\nAt will: detect magic\n3/day: enlarge/reduce, tongues\n1/day each: conjure elemental (fire elemental only), gaseous form, invisibility, major image, plane shift, wall of fire",
        attack_bonus: 0
      },
      {
        name: "Variant: Genie Powers",
        desc: "Genies have a variety of magical capabilities, including spells. A few have even greater powers that allow them to alter their appearance or the nature of reality.\n\nDisguises.\nSome genies can veil themselves in illusion to pass as other similarly shaped creatures. Such genies can innately cast the disguise self spell at will, often with a longer duration than is normal for that spell. Mightier genies can cast the true polymorph spell one to three times per day, possibly with a longer duration than normal. Such genies can change only their own shape, but a rare few can use the spell on other creatures and objects as well.\nWishes.\nThe genie power to grant wishes is legendary among mortals. Only the most potent genies, such as those among the nobility, can do so. A particular genie that has this power can grant one to three wishes to a creature that isn't a genie. Once a genie has granted its limit of wishes, it can't grant wishes again for some amount of time (usually 1 year). and cosmic law dictates that the same genie can expend its limit of wishes on a specific creature only once in that creature's existence.\nTo be granted a wish, a creature within 60 feet of the genie states a desired effect to it. The genie can then cast the wish spell on the creature's behalf to bring about the effect. Depending on the genie's nature, the genie might try to pervert the intent of the wish by exploiting the wish's poor wording. The perversion of the wording is usually crafted to be to the genie's benefit.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The efreeti makes two scimitar attacks or uses its Hurl Flame twice.",
        attack_bonus: 0
      },
      {
        name: "Scimitar",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage plus 7 (2d6) fire damage.",
        attack_bonus: 10,
        damage_dice: "2d6 + 2d6",
        damage_bonus: 6
      },
      {
        name: "Hurl Flame",
        desc: "Ranged Spell Attack: +7 to hit, range 120 ft., one target. Hit: 17 (5d6) fire damage.",
        attack_bonus: 7,
        damage_dice: "5d6"
      }
    ]
  },
  {
    name: "Elephant",
    size: "Huge",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 76,
    hit_dice: "8d12",
    speed: "40 ft.",
    stats: [22, 9, 17, 3, 11, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "4",
    traits: [
      {
        name: "Trampling Charge",
        desc: "If the elephant moves at least 20 ft. straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 12 Strength saving throw or be knocked prone. If the target is prone, the elephant can make one stomp attack against it as a bonus action.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Gore",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 19 (3d8 + 6) piercing damage.",
        attack_bonus: 8,
        damage_dice: "3d8",
        damage_bonus: 6
      },
      {
        name: "Stomp",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one prone creature. Hit: 22 (3d10 + 6) bludgeoning damage.",
        attack_bonus: 8,
        damage_dice: "3d10",
        damage_bonus: 6
      }
    ]
  },
  {
    name: "Elk",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 13,
    hit_dice: "2d10",
    speed: "50 ft.",
    stats: [16, 10, 12, 2, 10, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Charge",
        desc: "If the elk moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 7 (2d6) damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",
        attack_bonus: 0,
        damage_dice: "2d6"
      }
    ],
    actions: [
      {
        name: "Ram",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage.",
        attack_bonus: 0
      },
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one prone creature. Hit: 8 (2d4 + 3) bludgeoning damage.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Erinyes",
    size: "Medium",
    source: "SRD",
    type: "fiend",
    subtype: "devil",
    alignment: "lawful evil",
    ac: 18,
    hp: 153,
    hit_dice: "18d8",
    speed: "30 ft., fly 60 ft.",
    stats: [18, 16, 18, 14, 14, 18],
    saves: [
      {
        dexterity: 7
      },
      {
        constitution: 8
      },
      {
        wisdom: 6
      },
      {
        charisma: 8
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "truesight 120 ft., passive Perception 12",
    languages: "Infernal, telepathy 120 ft.",
    cr: "12",
    traits: [
      {
        name: "Hellish Weapons",
        desc: "The erinyes's weapon attacks are magical and deal an extra 13 (3d8) poison damage on a hit (included in the attacks).",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The erinyes has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The erinyes makes three attacks",
        attack_bonus: 0
      },
      {
        name: "Longsword",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) slashing damage, or 9 (1d10 + 4) slashing damage if used with two hands, plus 13 (3d8) poison damage.",
        attack_bonus: 8,
        damage_dice: "1d8 + 3d8",
        damage_bonus: 4
      },
      {
        name: "Longbow",
        desc: "Ranged Weapon Attack: +7 to hit, range 150/600 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 13 (3d8) poison damage, and the target must succeed on a DC 14 Constitution saving throw or be poisoned. The poison lasts until it is removed by the lesser restoration spell or similar magic.",
        attack_bonus: 7,
        damage_dice: "1d8 + 3d8",
        damage_bonus: 3
      },
      {
        name: "Variant: Rope of Entanglement",
        desc: "Some erinyes carry a rope of entanglement (detailed in the Dungeon Master's Guide). When such an erinyes uses its Multiattack, the erinyes can use the rope in place of two of the attacks.",
        attack_bonus: 0
      }
    ],
    reactions: [
      {
        name: "Parry",
        desc: "The erinyes adds 4 to its AC against one melee attack that would hit it. To do so, the erinyes must see the attacker and be wielding a melee weapon.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ettercap",
    size: "Medium",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "neutral evil",
    ac: 13,
    hp: 44,
    hit_dice: "8d8",
    speed: "30 ft., climb 30 ft.",
    stats: [14, 15, 13, 7, 12, 8],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 4
      },
      {
        survival: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 13",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Spider Climb",
        desc: "The ettercap can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      },
      {
        name: "Web Sense",
        desc: "While in contact with a web, the ettercap knows the exact location of any other creature in contact with the same web.",
        attack_bonus: 0
      },
      {
        name: "Web Walker",
        desc: "The ettercap ignores movement restrictions caused by webbing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The ettercap makes two attacks: one with its bite and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 6 (1d8 + 2) piercing damage plus 4 (1d8) poison damage. The target must succeed on a DC 11 Constitution saving throw or be poisoned for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) slashing damage.",
        attack_bonus: 4,
        damage_dice: "2d4",
        damage_bonus: 2
      },
      {
        name: "Web (Recharge 5-6)",
        desc: "Ranged Weapon Attack: +4 to hit, range 30/60 ft., one Large or smaller creature. Hit: The creature is restrained by webbing. As an action, the restrained creature can make a DC 11 Strength check, escaping from the webbing on a success. The effect ends if the webbing is destroyed. The webbing has AC 10, 5 hit points, is vulnerable to fire damage and immune to bludgeoning damage.",
        attack_bonus: 0
      },
      {
        name: "Variant: Web Garrote",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one Medium or Small creature against which the ettercap has advantage on the attack roll. Hit: 4 (1d4 + 2) bludgeoning damage, and the target is grappled (escape DC 12). Until this grapple ends, the target can't breathe, and the ettercap has advantage on attack rolls against it.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Ettin",
    size: "Large",
    source: "SRD",
    type: "giant",
    subtype: "",
    alignment: "chaotic evil",
    ac: 12,
    hp: 85,
    hit_dice: "10d10",
    speed: "40 ft.",
    stats: [21, 8, 17, 6, 10, 8],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "Giant, Orc",
    cr: "4",
    traits: [
      {
        name: "Two Heads",
        desc: "The ettin has advantage on Wisdom (Perception) checks and on saving throws against being blinded, charmed, deafened, frightened, stunned, and knocked unconscious.",
        attack_bonus: 0
      },
      {
        name: "Wakeful",
        desc: "When one of the ettin's heads is asleep, its other head is awake.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The ettin makes two attacks: one with its battleaxe and one with its morningstar.",
        attack_bonus: 0
      },
      {
        name: "Battleaxe",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d8",
        damage_bonus: 5
      },
      {
        name: "Morningstar",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) piercing damage.",
        attack_bonus: 7,
        damage_dice: "2d8",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Fire Elemental",
    size: "Large",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral",
    ac: 13,
    hp: 102,
    hit_dice: "12d10",
    speed: "50 ft.",
    stats: [10, 17, 16, 6, 10, 7],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "fire, poison",
    condition_immunities: "exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Ignan",
    cr: "5",
    traits: [
      {
        name: "Fire Form",
        desc: "The elemental can move through a space as narrow as 1 inch wide without squeezing. A creature that touches the elemental or hits it with a melee attack while within 5 ft. of it takes 5 (1d10) fire damage. In addition, the elemental can enter a hostile creature's space and stop there. The first time it enters a creature's space on a turn, that creature takes 5 (1d10) fire damage and catches fire; until someone takes an action to douse the fire, the creature takes 5 (1d10) fire damage at the start of each of its turns.",
        attack_bonus: 0,
        damage_dice: "5d10"
      },
      {
        name: "Illumination",
        desc: "The elemental sheds bright light in a 30-foot radius and dim light in an additional 30 ft..",
        attack_bonus: 0
      },
      {
        name: "Water Susceptibility",
        desc: "For every 5 ft. the elemental moves in water, or for every gallon of water splashed on it, it takes 1 cold damage.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The elemental makes two touch attacks.",
        attack_bonus: 0
      },
      {
        name: "Touch",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) fire damage. If the target is a creature or a flammable object, it ignites. Until a creature takes an action to douse the fire, the target takes 5 (1d10) fire damage at the start of each of its turns.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Fire Giant",
    size: "Huge",
    source: "SRD",
    type: "giant",
    subtype: "",
    alignment: "lawful evil",
    ac: 18,
    hp: 162,
    hit_dice: "13d12",
    speed: "30 ft.",
    stats: [25, 9, 23, 10, 14, 13],
    saves: [
      {
        dexterity: 3
      },
      {
        constitution: 10
      },
      {
        charisma: 5
      }
    ],
    skillsaves: [
      {
        athletics: 11
      },
      {
        perception: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "passive Perception 16",
    languages: "Giant",
    cr: "9",
    actions: [
      {
        name: "Multiattack",
        desc: "The giant makes two greatsword attacks.",
        attack_bonus: 0
      },
      {
        name: "Greatsword",
        desc: "Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 28 (6d6 + 7) slashing damage.",
        attack_bonus: 11,
        damage_dice: "6d6",
        damage_bonus: 7
      },
      {
        name: "Rock",
        desc: "Ranged Weapon Attack: +11 to hit, range 60/240 ft., one target. Hit: 29 (4d10 + 7) bludgeoning damage.",
        attack_bonus: 11,
        damage_dice: "4d10",
        damage_bonus: 7
      }
    ]
  },
  {
    name: "Flesh Golem",
    size: "Medium",
    source: "SRD",
    type: "construct",
    subtype: "",
    alignment: "neutral",
    ac: 9,
    hp: 93,
    hit_dice: "11d8",
    speed: "30 ft.",
    stats: [19, 9, 18, 6, 10, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning, poison; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",
    condition_immunities: "charmed, exhaustion, frightened, paralyzed, petrified, poisoned",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "understands the languages of its creator but can't speak",
    cr: "5",
    traits: [
      {
        name: "Berserk",
        desc: "Whenever the golem starts its turn with 40 hit points or fewer, roll a d6. On a 6, the golem goes berserk. On each of its turns while berserk, the golem attacks the nearest creature it can see. If no creature is near enough to move to and attack, the golem attacks an object, with preference for an object smaller than itself. Once the golem goes berserk, it continues to do so until it is destroyed or regains all its hit points.\nThe golem's creator, if within 60 feet of the berserk golem, can try to calm it by speaking firmly and persuasively. The golem must be able to hear its creator, who must take an action to make a DC 15 Charisma (Persuasion) check. If the check succeeds, the golem ceases being berserk. If it takes damage while still at 40 hit points or fewer, the golem might go berserk again.",
        attack_bonus: 0
      },
      {
        name: "Aversion of Fire",
        desc: "If the golem takes fire damage, it has disadvantage on attack rolls and ability checks until the end of its next turn.",
        attack_bonus: 0
      },
      {
        name: "Immutable Form",
        desc: "The golem is immune to any spell or effect that would alter its form.",
        attack_bonus: 0
      },
      {
        name: "Lightning Absorption",
        desc: "Whenever the golem is subjected to lightning damage, it takes no damage and instead regains a number of hit points equal to the lightning damage dealt.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The golem has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The golem's weapon attacks are magical.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The golem makes two slam attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",
        attack_bonus: 7,
        damage_dice: "2d8",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Flying Snake",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 14,
    hp: 5,
    hit_dice: "2d4",
    speed: "30 ft., fly 60 ft., swim 30 ft.",
    stats: [4, 18, 11, 2, 12, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 10 ft., passive Perception 11",
    languages: "",
    cr: "1/8",
    traits: [
      {
        name: "Flyby",
        desc: "The snake doesn't provoke opportunity attacks when it flies out of an enemy's reach.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 1 piercing damage plus 7 (3d4) poison damage.",
        attack_bonus: 6,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Flying Sword",
    size: "Small",
    source: "SRD",
    type: "construct",
    subtype: "",
    alignment: "unaligned",
    ac: 17,
    hp: 17,
    hit_dice: "5d6",
    speed: "0 ft., fly 50 ft. It can hover.",
    stats: [12, 15, 11, 1, 5, 1],
    saves: [
      {
        dexterity: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison, psychic",
    condition_immunities: "blinded, charmed, deafened, frightened, paralyzed, petrified, poisoned",
    senses: "blindsight 60 ft. (blind beyond this radius), passive Perception 7",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Antimagic Susceptibility",
        desc: "The sword is incapacitated while in the area of an antimagic field. If targeted by dispel magic, the sword must succeed on a Constitution saving throw against the caster's spell save DC or fall unconscious for 1 minute.",
        attack_bonus: 0
      },
      {
        name: "False Appearance",
        desc: "While the sword remains motionless and isn't flying, it is indistinguishable from a normal sword.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Longsword",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) slashing damage.",
        attack_bonus: 3,
        damage_dice: "1d8",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Frog",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 1,
    hit_dice: "1d4",
    speed: "20 ft., swim 20 ft.",
    stats: [1, 13, 8, 1, 8, 3],
    skillsaves: [
      {
        perception: 1
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 11",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Amphibious",
        desc: "The frog can breathe air and water",
        attack_bonus: 0
      },
      {
        name: "Standing Leap",
        desc: "The frog's long jump is up to 10 ft. and its high jump is up to 5 ft., with or without a running start.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Frost Giant",
    size: "Huge",
    source: "SRD",
    type: "giant",
    subtype: "",
    alignment: "neutral evil",
    ac: 15,
    hp: 138,
    hit_dice: "12d12",
    speed: "40 ft.",
    stats: [23, 9, 21, 9, 10, 12],
    saves: [
      {
        constitution: 8
      },
      {
        wisdom: 3
      },
      {
        charisma: 4
      }
    ],
    skillsaves: [
      {
        athletics: 9
      },
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "Giant",
    cr: "8",
    actions: [
      {
        name: "Multiattack",
        desc: "The giant makes two greataxe attacks.",
        attack_bonus: 0
      },
      {
        name: "Greataxe",
        desc: "Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 25 (3d12 + 6) slashing damage.",
        attack_bonus: 9,
        damage_dice: "3d12",
        damage_bonus: 6
      },
      {
        name: "Rock",
        desc: "Ranged Weapon Attack: +9 to hit, range 60/240 ft., one target. Hit: 28 (4d10 + 6) bludgeoning damage.",
        attack_bonus: 9,
        damage_dice: "4d10",
        damage_bonus: 6
      }
    ]
  },
  {
    name: "Gargoyle",
    size: "Medium",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "chaotic evil",
    ac: 15,
    hp: 52,
    hit_dice: "7d8",
    speed: "30 ft., fly 60 ft.",
    stats: [15, 11, 16, 6, 11, 7],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",
    damage_immunities: "poison",
    condition_immunities: "exhaustion, petrified, poisoned",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Terran",
    cr: "2",
    traits: [
      {
        name: "False Appearance",
        desc: "While the gargoyle remains motion less, it is indistinguishable from an inanimate statue.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The gargoyle makes two attacks: one with its bite and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) slashing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Gelatinous Cube",
    size: "Large",
    source: "SRD",
    type: "ooze",
    subtype: "",
    alignment: "unaligned",
    ac: 6,
    hp: 84,
    hit_dice: "8d10",
    speed: "15 ft.",
    stats: [14, 3, 20, 1, 6, 1],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "blinded, charmed, deafened, exhaustion, frightened, prone",
    senses: "blindsight 60 ft. (blind beyond this radius), passive Perception 8",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Ooze Cube",
        desc: "The cube takes up its entire space. Other creatures can enter the space, but a creature that does so is subjected to the cube's Engulf and has disadvantage on the saving throw.\nCreatures inside the cube can be seen but have total cover.\nA creature within 5 feet of the cube can take an action to pull a creature or object out of the cube. Doing so requires a successful DC 12 Strength check, and the creature making the attempt takes 10 (3d6) acid damage.\nThe cube can hold only one Large creature or up to four Medium or smaller creatures inside it at a time.",
        attack_bonus: 0
      },
      {
        name: "Transparent",
        desc: "Even when the cube is in plain sight, it takes a successful DC 15 Wisdom (Perception) check to spot a cube that has neither moved nor attacked. A creature that tries to enter the cube's space while unaware of the cube is surprised by the cube.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Pseudopod",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 10 (3d6) acid damage.",
        attack_bonus: 4,
        damage_dice: "3d6"
      },
      {
        name: "Engulf",
        desc: "The cube moves up to its speed. While doing so, it can enter Large or smaller creatures' spaces. Whenever the cube enters a creature's space, the creature must make a DC 12 Dexterity saving throw.\nOn a successful save, the creature can choose to be pushed 5 feet back or to the side of the cube. A creature that chooses not to be pushed suffers the consequences of a failed saving throw.\nOn a failed save, the cube enters the creature's space, and the creature takes 10 (3d6) acid damage and is engulfed. The engulfed creature can't breathe, is restrained, and takes 21 (6d6) acid damage at the start of each of the cube's turns. When the cube moves, the engulfed creature moves with it.\nAn engulfed creature can try to escape by taking an action to make a DC 12 Strength check. On a success, the creature escapes and enters a space of its choice within 5 feet of the cube.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ghast",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "chaotic evil",
    ac: 13,
    hp: 36,
    hit_dice: "8d8",
    speed: "30 ft.",
    stats: [16, 17, 10, 11, 10, 8],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "necrotic",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Common",
    cr: "2",
    traits: [
      {
        name: "Stench",
        desc: "Any creature that starts its turn within 5 ft. of the ghast must succeed on a DC 10 Constitution saving throw or be poisoned until the start of its next turn. On a successful saving throw, the creature is immune to the ghast's Stench for 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Turn Defiance",
        desc: "The ghast and any ghouls within 30 ft. of it have advantage on saving throws against effects that turn undead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 12 (2d8 + 3) piercing damage.",
        attack_bonus: 3,
        damage_dice: "2d8",
        damage_bonus: 3
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage. If the target is a creature other than an undead, it must succeed on a DC 10 Constitution saving throw or be paralyzed for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Ghost",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "any alignment",
    ac: 11,
    hp: 45,
    hit_dice: "10d8",
    speed: "0 ft., fly 40 ft. It can hover.",
    stats: [7, 13, 10, 10, 12, 17],
    damage_vulnerabilities: "",
    damage_resistances: "acid, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "cold, necrotic, poison",
    condition_immunities: "charmed, exhaustion, frightened, grappled, paralyzed, petrified, poisoned, prone, restrained",
    senses: "darkvision 60 ft., passive Perception 11",
    languages: "any languages it knew in life",
    cr: "4",
    traits: [
      {
        name: "Ethereal Sight",
        desc: "The ghost can see 60 ft. into the Ethereal Plane when it is on the Material Plane, and vice versa.",
        attack_bonus: 0
      },
      {
        name: "Incorporeal Movement",
        desc: "The ghost can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Withering Touch",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 17 (4d6 + 3) necrotic damage.",
        attack_bonus: 5,
        damage_dice: "4d6",
        damage_bonus: 3
      },
      {
        name: "Etherealness",
        desc: "The ghost enters the Ethereal Plane from the Material Plane, or vice versa. It is visible on the Material Plane while it is in the Border Ethereal, and vice versa, yet it can't affect or be affected by anything on the other plane.",
        attack_bonus: 0
      },
      {
        name: "Horrifying Visage",
        desc: "Each non-undead creature within 60 ft. of the ghost that can see it must succeed on a DC 13 Wisdom saving throw or be frightened for 1 minute. If the save fails by 5 or more, the target also ages 1d4 _ 10 years. A frightened target can repeat the saving throw at the end of each of its turns, ending the frightened condition on itself on a success. If a target's saving throw is successful or the effect ends for it, the target is immune to this ghost's Horrifying Visage for the next 24 hours. The aging effect can be reversed with a greater restoration spell, but only within 24 hours of it occurring.",
        attack_bonus: 0
      },
      {
        name: "Possession (Recharge 6)",
        desc: "One humanoid that the ghost can see within 5 ft. of it must succeed on a DC 13 Charisma saving throw or be possessed by the ghost; the ghost then disappears, and the target is incapacitated and loses control of its body. The ghost now controls the body but doesn't deprive the target of awareness. The ghost can't be targeted by any attack, spell, or other effect, except ones that turn undead, and it retains its alignment, Intelligence, Wisdom, Charisma, and immunity to being charmed and frightened. It otherwise uses the possessed target's statistics, but doesn't gain access to the target's knowledge, class features, or proficiencies.\nThe possession lasts until the body drops to 0 hit points, the ghost ends it as a bonus action, or the ghost is turned or forced out by an effect like the dispel evil and good spell. When the possession ends, the ghost reappears in an unoccupied space within 5 ft. of the body. The target is immune to this ghost's Possession for 24 hours after succeeding on the saving throw or after the possession ends.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ghoul",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "chaotic evil",
    ac: 12,
    hp: 22,
    hit_dice: "5d8",
    speed: "30 ft.",
    stats: [13, 15, 10, 7, 10, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Common",
    cr: "1",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 9 (2d6 + 2) piercing damage.",
        attack_bonus: 2,
        damage_dice: "2d6",
        damage_bonus: 2
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) slashing damage. If the target is a creature other than an elf or undead, it must succeed on a DC 10 Constitution saving throw or be paralyzed for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Giant Ape",
    size: "Huge",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 157,
    hit_dice: "15d12",
    speed: "40 ft., climb 40 ft.",
    stats: [23, 14, 18, 7, 12, 7],
    skillsaves: [
      {
        athletics: 9
      },
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "",
    cr: "7",
    actions: [
      {
        name: "Multiattack",
        desc: "The ape makes two fist attacks.",
        attack_bonus: 0
      },
      {
        name: "Fist",
        desc: "Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 22 (3d10 + 6) bludgeoning damage.",
        attack_bonus: 9,
        damage_dice: "3d10",
        damage_bonus: 6
      },
      {
        name: "Rock",
        desc: "Ranged Weapon Attack: +9 to hit, range 50/100 ft., one target. Hit: 30 (7d6 + 6) bludgeoning damage.",
        attack_bonus: 9,
        damage_dice: "7d6",
        damage_bonus: 6
      }
    ]
  },
  {
    name: "Giant Badger",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 13,
    hit_dice: "2d8",
    speed: "30 ft., burrow 10 ft.",
    stats: [13, 10, 15, 2, 12, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 11",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Keen Smell",
        desc: "The badger has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The badger makes two attacks: one with its bite and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 6 (2d4 + 1) slashing damage.",
        attack_bonus: 3,
        damage_dice: "2d4",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Giant Bat",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 22,
    hit_dice: "4d10",
    speed: "10 ft., fly 60 ft.",
    stats: [15, 16, 11, 2, 12, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 60 ft., passive Perception 11",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Echolocation",
        desc: "The bat can't use its blindsight while deafened.",
        attack_bonus: 0
      },
      {
        name: "Keen Hearing",
        desc: "The bat has advantage on Wisdom (Perception) checks that rely on hearing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Giant Boar",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 42,
    hit_dice: "5d10",
    speed: "40 ft.",
    stats: [17, 10, 16, 2, 7, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 8",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Charge",
        desc: "If the boar moves at least 20 ft. straight toward a target and then hits it with a tusk attack on the same turn, the target takes an extra 7 (2d6) slashing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",
        attack_bonus: 0,
        damage_dice: "2d6"
      },
      {
        name: "Relentless (Recharges after a Short or Long Rest)",
        desc: "If the boar takes 10 damage or less that would reduce it to 0 hit points, it is reduced to 1 hit point instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Tusk",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Giant Centipede",
    size: "Small",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 4,
    hit_dice: "1d6",
    speed: "30 ft., climb 30 ft.",
    stats: [5, 14, 12, 1, 7, 3],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 30 ft., passive Perception 8",
    languages: "",
    cr: "1/4",
    actions: [
      {
        name: "Bite",
        desc: "Bite. Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage, and the target must succeed on a DC 11 Constitution saving throw or take 10 (3d6) poison damage. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Giant Constrictor Snake",
    size: "Huge",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 60,
    hit_dice: "8d12",
    speed: "30 ft., swim 30 ft.",
    stats: [19, 14, 12, 1, 10, 3],
    skillsaves: [
      {
        perception: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 10 ft., passive Perception 12",
    languages: "",
    cr: "2",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 10 ft., one creature. Hit: 11 (2d6 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Constrict",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 13 (2d8 + 4) bludgeoning damage, and the target is grappled (escape DC 16). Until this grapple ends, the creature is restrained, and the snake can't constrict another target.",
        attack_bonus: 6,
        damage_dice: "2d8",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Giant Crab",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 15,
    hp: 13,
    hit_dice: "3d8",
    speed: "30 ft., swim 30 ft.",
    stats: [13, 15, 11, 1, 9, 3],
    skillsaves: [
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 30 ft., passive Perception 9",
    languages: "",
    cr: "1/8",
    traits: [
      {
        name: "Amphibious",
        desc: "The crab can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage, and the target is grappled (escape DC 11). The crab has two claws, each of which can grapple only one target.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Giant Crocodile",
    size: "Huge",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 14,
    hp: 85,
    hit_dice: "9d12",
    speed: "30 ft., swim 50 ft.",
    stats: [21, 9, 17, 2, 10, 7],
    skillsaves: [
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "5",
    traits: [
      {
        name: "Hold Breath",
        desc: "The crocodile can hold its breath for 30 minutes.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The crocodile makes two attacks: one with its bite and one with its tail.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 21 (3d10 + 5) piercing damage, and the target is grappled (escape DC 16). Until this grapple ends, the target is restrained, and the crocodile can't bite another target.",
        attack_bonus: 8,
        damage_dice: "3d10",
        damage_bonus: 5
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one target not grappled by the crocodile. Hit: 14 (2d8 + 5) bludgeoning damage. If the target is a creature, it must succeed on a DC 16 Strength saving throw or be knocked prone.",
        attack_bonus: 8,
        damage_dice: "2d8",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Giant Eagle",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "neutral good",
    ac: 13,
    hp: 26,
    hit_dice: "4d10",
    speed: "10 ft., fly 80 ft.",
    stats: [16, 17, 13, 8, 14, 10],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "Giant Eagle, understands Common and Auran but can't speak",
    cr: "1",
    traits: [
      {
        name: "Keen Sight",
        desc: "The eagle has advantage on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The eagle makes two attacks: one with its beak and one with its talons.",
        attack_bonus: 0
      },
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Talons",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Giant Elk",
    size: "Huge",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 15,
    hp: 42,
    hit_dice: "5d12",
    speed: "60 ft.",
    stats: [19, 16, 14, 7, 14, 10],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "Giant Elk, understands Common, Elvish, and Sylvan but can't speak",
    cr: "2",
    traits: [
      {
        name: "Charge",
        desc: "If the elk moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 7 (2d6) damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be knocked prone.",
        attack_bonus: 0,
        damage_dice: "2d6"
      }
    ],
    actions: [
      {
        name: "Ram",
        desc: "Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one prone creature. Hit: 22 (4d8 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "4d8",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Giant Fire Beetle",
    size: "Small",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 4,
    hit_dice: "1d6",
    speed: "30 ft.",
    stats: [8, 10, 12, 1, 7, 3],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 30 ft., passive Perception 8",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Illumination",
        desc: "The beetle sheds bright light in a 10-foot radius and dim light for an additional 10 ft..",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 2 (1d6 \u2014 1) slashing damage.",
        attack_bonus: 1,
        damage_dice: "1d6",
        damage_bonus: -1
      }
    ]
  },
  {
    name: "Giant Frog",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 18,
    hit_dice: "4d8",
    speed: "30 ft., swim 30 ft.",
    stats: [12, 13, 11, 2, 10, 3],
    skillsaves: [
      {
        perception: 2
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 12",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Amphibious",
        desc: "The frog can breathe air and water",
        attack_bonus: 0
      },
      {
        name: "Standing Leap",
        desc: "The frog's long jump is up to 20 ft. and its high jump is up to 10 ft., with or without a running start.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage, and the target is grappled (escape DC 11). Until this grapple ends, the target is restrained, and the frog can't bite another target.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      },
      {
        name: "Swallow",
        desc: "The frog makes one bite attack against a Small or smaller target it is grappling. If the attack hits, the target is swallowed, and the grapple ends. The swallowed target is blinded and restrained, it has total cover against attacks and other effects outside the frog, and it takes 5 (2d4) acid damage at the start of each of the frog's turns. The frog can have only one target swallowed at a time. If the frog dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 5 ft. of movement, exiting prone.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Giant Goat",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 19,
    hit_dice: "3d10",
    speed: "40 ft.",
    stats: [17, 11, 12, 3, 12, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 11",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Charge",
        desc: "If the goat moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 5 (2d4) bludgeoning damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",
        attack_bonus: 0,
        damage_dice: "2d4"
      },
      {
        name: "Sure-Footed",
        desc: "The goat has advantage on Strength and Dexterity saving throws made against effects that would knock it prone.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Ram",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (2d4 + 3) bludgeoning damage.",
        attack_bonus: 5,
        damage_dice: "2d4",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Giant Hyena",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 45,
    hit_dice: "6d10",
    speed: "50 ft.",
    stats: [16, 14, 14, 2, 12, 7],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Rampage",
        desc: "When the hyena reduces a creature to 0 hit points with a melee attack on its turn, the hyena can take a bonus action to move up to half its speed and make a bite attack.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Giant Lizard",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 19,
    hit_dice: "3d10",
    speed: "30 ft., climb 30 ft.",
    stats: [15, 12, 13, 2, 10, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 10",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Variant: Hold Breath",
        desc: "The lizard can hold its breath for 15 minutes. (A lizard that has this trait also has a swimming speed of 30 feet.)",
        attack_bonus: 0
      },
      {
        name: "Variant: Spider Climb",
        desc: "The lizard can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Giant Octopus",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 52,
    hit_dice: "8d10",
    speed: "10 ft., swim 60 ft.",
    stats: [17, 13, 13, 4, 10, 4],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Hold Breath",
        desc: "While out of water, the octopus can hold its breath for 1 hour.",
        attack_bonus: 0
      },
      {
        name: "Underwater Camouflage",
        desc: "The octopus has advantage on Dexterity (Stealth) checks made while underwater.",
        attack_bonus: 0
      },
      {
        name: "Water Breathing",
        desc: "The octopus can breathe only underwater.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Tentacles",
        desc: "Melee Weapon Attack: +5 to hit, reach 15 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage. If the target is a creature, it is grappled (escape DC 16). Until this grapple ends, the target is restrained, and the octopus can't use its tentacles on another target.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      },
      {
        name: "Ink Cloud (Recharges after a Short or Long Rest)",
        desc: "A 20-foot-radius cloud of ink extends all around the octopus if it is underwater. The area is heavily obscured for 1 minute, although a significant current can disperse the ink. After releasing the ink, the octopus can use the Dash action as a bonus action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Giant Owl",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "neutral",
    ac: 12,
    hp: 19,
    hit_dice: "3d10",
    speed: "5 ft., fly 60 ft.",
    stats: [13, 15, 12, 8, 13, 10],
    skillsaves: [
      {
        perception: 5
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 15",
    languages: "Giant Owl, understands Common, Elvish, and Sylvan but can't speak",
    cr: "1/4",
    traits: [
      {
        name: "Flyby",
        desc: "The owl doesn't provoke opportunity attacks when it flies out of an enemy's reach.",
        attack_bonus: 0
      },
      {
        name: "Keen Hearing and Sight",
        desc: "The owl has advantage on Wisdom (Perception) checks that rely on hearing or sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Talons",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 8 (2d6 + 1) slashing damage.",
        attack_bonus: 3,
        damage_dice: "2d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Giant Poisonous Snake",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 14,
    hp: 11,
    hit_dice: "2d8",
    speed: "30 ft., swim 30 ft.",
    stats: [10, 18, 13, 2, 10, 3],
    skillsaves: [
      {
        perception: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 10 ft., passive Perception 12",
    languages: "",
    cr: "1/4",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 6 (1d4 + 4) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 10 (3d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 6,
        damage_dice: "1d4",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Giant Rat",
    size: "Small",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 7,
    hit_dice: "2d6",
    speed: "30 ft.",
    stats: [7, 15, 11, 2, 10, 4],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "",
    cr: "1/8",
    traits: [
      {
        name: "Keen Smell",
        desc: "The rat has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The rat has advantage on an attack roll against a creature if at least one of the rat's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Giant Rat (Diseased)",
    size: "Small",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 7,
    hit_dice: "2d6",
    speed: "30 ft.",
    stats: [7, 15, 11, 2, 10, 4],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "",
    cr: "1/8",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 2) piercing damage. If the target is a creature, it must succeed on a DC 10 Constitution saving throw or contract a disease. Until the disease is cured, the target can't regain hit points except by magical means, and the target's hit point maximum decreases by 3 (1d6) every 24 hours. If the target's hit point maximum drops to 0 as a result of this disease, the target dies.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Giant Scorpion",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 15,
    hp: 52,
    hit_dice: "7d10",
    speed: "40 ft.",
    stats: [15, 13, 15, 1, 9, 3],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 60 ft., passive Perception 9",
    languages: "",
    cr: "3",
    actions: [
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) bludgeoning damage, and the target is grappled (escape DC 12). The scorpion has two claws, each of which can grapple only one target.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      },
      {
        name: "Multiattack",
        desc: "The scorpion makes three attacks: two with its claws and one with its sting.",
        attack_bonus: 0
      },
      {
        name: "Sting",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (1d10 + 2) piercing damage, and the target must make a DC 12 Constitution saving throw, taking 22 (4d10) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 4,
        damage_dice: "1d10",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Giant Sea Horse",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 16,
    hit_dice: "3d10",
    speed: "0 ft., swim 40 ft.",
    stats: [12, 15, 11, 2, 12, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 11",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Charge",
        desc: "If the sea horse moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 7 (2d6) bludgeoning damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",
        attack_bonus: 0,
        damage_dice: "2d6"
      },
      {
        name: "Water Breathing",
        desc: "The sea horse can breathe only underwater.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Ram",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Giant Shark",
    size: "Huge",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 126,
    hit_dice: "11d12",
    speed: "swim 50 ft.",
    stats: [23, 11, 21, 1, 10, 5],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 60 ft., passive Perception 13",
    languages: "",
    cr: "5",
    traits: [
      {
        name: "Blood Frenzy",
        desc: "The shark has advantage on melee attack rolls against any creature that doesn't have all its hit points.",
        attack_bonus: 0
      },
      {
        name: "Water Breathing",
        desc: "The shark can breathe only underwater.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 22 (3d10 + 6) piercing damage.",
        attack_bonus: 9,
        damage_dice: "3d10",
        damage_bonus: 6
      }
    ]
  },
  {
    name: "Giant Spider",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 14,
    hp: 26,
    hit_dice: "4d10",
    speed: "30 ft., climb 30 ft.",
    stats: [14, 16, 12, 2, 11, 4],
    skillsaves: [
      {
        stealth: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 10",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Spider Climb",
        desc: "The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      },
      {
        name: "Web Sense",
        desc: "While in contact with a web, the spider knows the exact location of any other creature in contact with the same web.",
        attack_bonus: 0
      },
      {
        name: "Web Walker",
        desc: "The spider ignores movement restrictions caused by webbing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 7 (1d8 + 3) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 9 (2d8) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Web (Recharge 5-6)",
        desc: "Ranged Weapon Attack: +5 to hit, range 30/60 ft., one creature. Hit: The target is restrained by webbing. As an action, the restrained target can make a DC 12 Strength check, bursting the webbing on a success. The webbing can also be attacked and destroyed (AC 10; hp 5; vulnerability to fire damage; immunity to bludgeoning, poison, and psychic damage).",
        attack_bonus: 5
      }
    ]
  },
  {
    name: "Giant Toad",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 39,
    hit_dice: "6d10",
    speed: "20 ft., swim 40 ft.",
    stats: [15, 13, 13, 2, 10, 3],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 10",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Amphibious",
        desc: "The toad can breathe air and water",
        attack_bonus: 0
      },
      {
        name: "Standing Leap",
        desc: "The toad's long jump is up to 20 ft. and its high jump is up to 10 ft., with or without a running start.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 5 (1d10) poison damage, and the target is grappled (escape DC 13). Until this grapple ends, the target is restrained, and the toad can't bite another target.",
        attack_bonus: 4,
        damage_dice: "1d10",
        damage_bonus: 2
      },
      {
        name: "Swallow",
        desc: "The toad makes one bite attack against a Medium or smaller target it is grappling. If the attack hits, the target is swallowed, and the grapple ends. The swallowed target is blinded and restrained, it has total cover against attacks and other effects outside the toad, and it takes 10 (3d6) acid damage at the start of each of the toad's turns. The toad can have only one target swallowed at a time.\nIf the toad dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 5 feet of movement, exiting prone.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Giant Vulture",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "neutral evil",
    ac: 10,
    hp: 22,
    hit_dice: "3d10",
    speed: "10 ft., fly 60 ft.",
    stats: [15, 10, 15, 6, 12, 7],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "understands Common but can't speak",
    cr: "1",
    traits: [
      {
        name: "Keen Sight and Smell",
        desc: "The vulture has advantage on Wisdom (Perception) checks that rely on sight or smell.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The vulture has advantage on an attack roll against a creature if at least one of the vulture's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The vulture makes two attacks: one with its beak and one with its talons.",
        attack_bonus: 0
      },
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "2d4",
        damage_bonus: 2
      },
      {
        name: "Talons",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) slashing damage.",
        attack_bonus: 4,
        damage_dice: "2d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Giant Wasp",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 13,
    hit_dice: "3d8",
    speed: "10 ft., fly 50 ft., swim 50 ft.",
    stats: [10, 14, 10, 1, 10, 3],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "1/2",
    actions: [
      {
        name: "Sting",
        desc: "Sting. Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 10 (3d6) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Giant Weasel",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 9,
    hit_dice: "2d8",
    speed: "40 ft.",
    stats: [11, 16, 10, 4, 12, 5],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 13",
    languages: "",
    cr: "1/8",
    traits: [
      {
        name: "Keen Hearing and Smell",
        desc: "The weasel has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d4 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d4",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Giant Wolf Spider",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 11,
    hit_dice: "2d8",
    speed: "40 ft., climb 40 ft.",
    stats: [12, 16, 13, 3, 12, 4],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 13",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Spider Climb",
        desc: "The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      },
      {
        name: "Web Sense",
        desc: "While in contact with a web, the spider knows the exact location of any other creature in contact with the same web.",
        attack_bonus: 0
      },
      {
        name: "Web Walker",
        desc: "The spider ignores movement restrictions caused by webbing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 4 (1d6 + 1) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 7 (2d6) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Gibbering Mouther",
    size: "Medium",
    source: "SRD",
    type: "aberration",
    subtype: "",
    alignment: "neutral",
    ac: 9,
    hp: 67,
    hit_dice: "9d8",
    speed: "10 ft., swim 10 ft.",
    stats: [10, 8, 16, 3, 10, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "prone",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Aberrant Ground",
        desc: "The ground in a 10-foot radius around the mouther is doughlike difficult terrain. Each creature that starts its turn in that area must succeed on a DC 10 Strength saving throw or have its speed reduced to 0 until the start of its next turn.",
        attack_bonus: 0
      },
      {
        name: "Gibbering",
        desc: "The mouther babbles incoherently while it can see any creature and isn't incapacitated. Each creature that starts its turn within 20 feet of the mouther and can hear the gibbering must succeed on a DC 10 Wisdom saving throw. On a failure, the creature can't take reactions until the start of its next turn and rolls a d8 to determine what it does during its turn. On a 1 to 4, the creature does nothing. On a 5 or 6, the creature takes no action or bonus action and uses all its movement to move in a randomly determined direction. On a 7 or 8, the creature makes a melee attack against a randomly determined creature within its reach or does nothing if it can't make such an attack.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The gibbering mouther makes one bite attack and, if it can, uses its Blinding Spittle.",
        attack_bonus: 0
      },
      {
        name: "Bites",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 17 (5d6) piercing damage. If the target is Medium or smaller, it must succeed on a DC 10 Strength saving throw or be knocked prone. If the target is killed by this damage, it is absorbed into the mouther.",
        attack_bonus: 2,
        damage_dice: "5d6"
      },
      {
        name: "Blinding Spittle (Recharge 5-6)",
        desc: "The mouther spits a chemical glob at a point it can see within 15 feet of it. The glob explodes in a blinding flash of light on impact. Each creature within 5 feet of the flash must succeed on a DC 13 Dexterity saving throw or be blinded until the end of the mouther's next turn.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Glabrezu",
    size: "Large",
    source: "SRD",
    type: "fiend",
    subtype: "demon",
    alignment: "chaotic evil",
    ac: 17,
    hp: 157,
    hit_dice: "15d10",
    speed: "40 ft.",
    stats: [20, 15, 21, 19, 17, 16],
    saves: [
      {
        strength: 9
      },
      {
        constitution: 9
      },
      {
        wisdom: 7
      },
      {
        charisma: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "truesight 120 ft., passive Perception 13",
    languages: "Abyssal, telepathy 120 ft.",
    cr: "9",
    traits: [
      {
        name: "Innate Spellcasting",
        desc: "The glabrezu's spellcasting ability is Intelligence (spell save DC 16). The glabrezu can innately cast the following spells, requiring no material components:\nAt will: darkness, detect magic, dispel magic\n1/day each: confusion, fly, power word stun",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The glabrezu has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The glabrezu makes four attacks: two with its pincers and two with its fists. Alternatively, it makes two attacks with its pincers and casts one spell.",
        attack_bonus: 0
      },
      {
        name: "Pincer",
        desc: "Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 16 (2d10 + 5) bludgeoning damage. If the target is a Medium or smaller creature, it is grappled (escape DC 15). The glabrezu has two pincers, each of which can grapple only one target.",
        attack_bonus: 9,
        damage_dice: "2d10",
        damage_bonus: 5
      },
      {
        name: "Fist",
        desc: "Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) bludgeoning damage.",
        attack_bonus: 9,
        damage_dice: "2d4",
        damage_bonus: 2
      },
      {
        name: "Variant: Summon Demon (1/Day)",
        desc: "The demon chooses what to summon and attempts a magical summoning.\nA glabrezu has a 30 percent chance of summoning 1d3 vrocks, 1d2 hezrous, or one glabrezu.\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Gladiator",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 16,
    hp: 112,
    hit_dice: "15d8",
    speed: "30 ft.",
    stats: [18, 15, 16, 10, 12, 15],
    saves: [
      {
        strength: 7
      },
      {
        dexterity: 5
      },
      {
        constitution: 6
      }
    ],
    skillsaves: [
      {
        intimidation: 5
      },
      {
        athletics: 10
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 11",
    languages: "any one language (usually Common)",
    cr: "5",
    traits: [
      {
        name: "Brave",
        desc: "The gladiator has advantage on saving throws against being frightened.",
        attack_bonus: 0
      },
      {
        name: "Brute",
        desc: "A melee weapon deals one extra die of its damage when the gladiator hits with it (included in the attack).",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The gladiator makes three melee attacks or two ranged attacks.",
        attack_bonus: 0
      },
      {
        name: "Spear",
        desc: "Melee or Ranged Weapon Attack: +7 to hit, reach 5 ft. and range 20/60 ft., one target. Hit: 11 (2d6 + 4) piercing damage, or 13 (2d8 + 4) piercing damage if used with two hands to make a melee attack.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Shield Bash",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one creature. Hit: 9 (2d4 + 4) bludgeoning damage. If the target is a Medium or smaller creature, it must succeed on a DC 15 Strength saving throw or be knocked prone.",
        attack_bonus: 7,
        damage_dice: "2d4",
        damage_bonus: 4
      }
    ],
    reactions: [
      {
        name: "Parry",
        desc: "The gladiator adds 3 to its AC against one melee attack that would hit it. To do so, the gladiator must see the attacker and be wielding a melee weapon.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Gnoll",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "gnoll",
    alignment: "chaotic evil",
    ac: 15,
    hp: 22,
    hit_dice: "5d8",
    speed: "30 ft.",
    stats: [14, 12, 11, 6, 10, 7],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Gnoll",
    cr: "1/2",
    traits: [
      {
        name: "Rampage",
        desc: "When the gnoll reduces a creature to 0 hit points with a melee attack on its turn, the gnoll can take a bonus action to move up to half its speed and make a bite attack.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      },
      {
        name: "Spear",
        desc: "Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 5 (1d6 + 2) piercing damage, or 6 (1d8 + 2) piercing damage if used with two hands to make a melee attack.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Longbow",
        desc: "Ranged Weapon Attack: +3 to hit, range 150/600 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d8",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Goat",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 4,
    hit_dice: "1d8",
    speed: "40 ft.",
    stats: [12, 10, 11, 2, 10, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Charge",
        desc: "If the goat moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 2 (1d4) bludgeoning damage. If the target is a creature, it must succeed on a DC 10 Strength saving throw or be knocked prone.",
        attack_bonus: 0,
        damage_dice: "1d4"
      },
      {
        name: "Sure-Footed",
        desc: "The goat has advantage on Strength and Dexterity saving throws made against effects that would knock it prone.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Ram",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) bludgeoning damage.",
        attack_bonus: 3,
        damage_dice: "1d4",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Goblin",
    size: "Small",
    source: "SRD",
    type: "humanoid",
    subtype: "goblinoid",
    alignment: "neutral evil",
    ac: 15,
    hp: 7,
    hit_dice: "2d6",
    speed: "30 ft.",
    stats: [8, 14, 10, 10, 8, 8],
    skillsaves: [
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 9",
    languages: "Common, Goblin",
    cr: "1/4",
    traits: [
      {
        name: "Nimble Escape",
        desc: "The goblin can take the Disengage or Hide action as a bonus action on each of its turns.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Scimitar",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) slashing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Shortbow",
        desc: "Ranged Weapon Attack: +4 to hit, range 80/320 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Gold Dragon Wyrmling",
    size: "Medium",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 17,
    hp: 60,
    hit_dice: "8d8",
    speed: "30 ft., fly 60 ft., swim 30 ft.",
    stats: [19, 14, 17, 14, 11, 16],
    saves: [
      {
        dexterity: 4
      },
      {
        constitution: 5
      },
      {
        wisdom: 2
      },
      {
        charisma: 5
      }
    ],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 14",
    languages: "Draconic",
    cr: "3",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (1d10 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "1d10",
        damage_bonus: 4
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nFire Breath. The dragon exhales fire in a 15-foot cone. Each creature in that area must make a DC 13 Dexterity saving throw, taking 22 (4d10) fire damage on a failed save, or half as much damage on a successful one.\nWeakening Breath. The dragon exhales gas in a 15-foot cone. Each creature in that area must succeed on a DC 13 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0,
        damage_dice: "4d10"
      }
    ]
  },
  {
    name: "Gorgon",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 19,
    hp: 114,
    hit_dice: "12d10",
    speed: "40 ft.",
    stats: [20, 11, 18, 2, 12, 7],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "petrified",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "",
    cr: "5",
    traits: [
      {
        name: "Trampling Charge",
        desc: "If the gorgon moves at least 20 feet straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 16 Strength saving throw or be knocked prone. If the target is prone, the gorgon can make one attack with its hooves against it as a bonus action.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Gore",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 18 (2d12 + 5) piercing damage.",
        attack_bonus: 8,
        damage_dice: "2d12",
        damage_bonus: 5
      },
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 16 (2d10 + 5) bludgeoning damage.",
        attack_bonus: 8,
        damage_dice: "2d10",
        damage_bonus: 5
      },
      {
        name: "Petrifying Breath (Recharge 5-6)",
        desc: "The gorgon exhales petrifying gas in a 30-foot cone. Each creature in that area must succeed on a DC 13 Constitution saving throw. On a failed save, a target begins to turn to stone and is restrained. The restrained target must repeat the saving throw at the end of its next turn. On a success, the effect ends on the target. On a failure, the target is petrified until freed by the greater restoration spell or other magic.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Gray Ooze",
    size: "Medium",
    source: "SRD",
    type: "ooze",
    subtype: "",
    alignment: "unaligned",
    ac: 8,
    hp: 22,
    hit_dice: "3d8",
    speed: "10 ft., climb 10 ft.",
    stats: [12, 6, 16, 1, 6, 2],
    skillsaves: [
      {
        stealth: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "acid, cold, fire",
    damage_immunities: "",
    condition_immunities: "blinded, charmed, deafened, exhaustion, frightened, prone",
    senses: "blindsight 60 ft. (blind beyond this radius), passive Perception 8",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Amorphous",
        desc: "The ooze can move through a space as narrow as 1 inch wide without squeezing.",
        attack_bonus: 0
      },
      {
        name: "Corrode Metal",
        desc: "Any nonmagical weapon made of metal that hits the ooze corrodes. After dealing damage, the weapon takes a permanent and cumulative -1 penalty to damage rolls. If its penalty drops to -5, the weapon is destroyed. Nonmagical ammunition made of metal that hits the ooze is destroyed after dealing damage.\nThe ooze can eat through 2-inch-thick, nonmagical metal in 1 round.",
        attack_bonus: 0
      },
      {
        name: "False Appearance",
        desc: "While the ooze remains motionless, it is indistinguishable from an oily pool or wet rock.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Pseudopod",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage plus 7 (2d6) acid damage, and if the target is wearing nonmagical metal armor, its armor is partly corroded and takes a permanent and cumulative -1 penalty to the AC it offers. The armor is destroyed if the penalty reduces its AC to 10.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Green Dragon Wyrmling",
    size: "Medium",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful evil",
    ac: 17,
    hp: 38,
    hit_dice: "7d8",
    speed: "30 ft., fly 60 ft., swim 30 ft.",
    stats: [15, 12, 13, 14, 11, 13],
    saves: [
      {
        dexterity: 3
      },
      {
        constitution: 3
      },
      {
        wisdom: 2
      },
      {
        charisma: 3
      }
    ],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 14",
    languages: "Draconic",
    cr: "2",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 3 (1d6) poison damage.",
        attack_bonus: 4,
        damage_dice: "1d10 + 1d6",
        damage_bonus: 3
      },
      {
        name: "Poison Breath (Recharge 5-6)",
        desc: "The dragon exhales poisonous gas in a 15-foot cone. Each creature in that area must make a DC 11 Constitution saving throw, taking 21 (6d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "6d6"
      }
    ]
  },
  {
    name: "Green Hag",
    size: "Medium",
    source: "SRD",
    type: "fey",
    subtype: "",
    alignment: "neutral evil",
    ac: 17,
    hp: 82,
    hit_dice: "11d8",
    speed: "30 ft.",
    stats: [18, 12, 16, 13, 14, 14],
    skillsaves: [
      {
        arcana: 3
      },
      {
        deception: 4
      },
      {
        perception: 4
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "Common, Draconic, Sylvan",
    cr: "3",
    traits: [
      {
        name: "Amphibious",
        desc: "The hag can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The hag's innate spellcasting ability is Charisma (spell save DC 12). She can innately cast the following spells, requiring no material components:\n\nAt will: dancing lights, minor illusion, vicious mockery",
        attack_bonus: 0
      },
      {
        name: "Mimicry",
        desc: "The hag can mimic animal sounds and humanoid voices. A creature that hears the sounds can tell they are imitations with a successful DC 14 Wisdom (Insight) check.",
        attack_bonus: 0
      },
      {
        name: "Hag Coven",
        desc: "When hags must work together, they form covens, in spite of their selfish natures. A coven is made up of hags of any type, all of whom are equals within the group. However, each of the hags continues to desire more personal power.\nA coven consists of three hags so that any arguments between two hags can be settled by the third. If more than three hags ever come together, as might happen if two covens come into conflict, the result is usually chaos.",
        attack_bonus: 0
      },
      {
        name: "Shared Spellcasting (Coven Only)",
        desc: "While all three members of a hag coven are within 30 feet of one another, they can each cast the following spells from the wizard's spell list but must share the spell slots among themselves:\n\n\u2022 1st level (4 slots): identify, ray of sickness\n\u2022 2nd level (3 slots): hold person, locate object\n\u2022 3rd level (3 slots): bestow curse, counterspell, lightning bolt\n\u2022 4th level (3 slots): phantasmal killer, polymorph\n\u2022 5th level (2 slots): contact other plane, scrying\n\u2022 6th level (1 slot): eye bite\n\nFor casting these spells, each hag is a 12th-level spellcaster that uses Intelligence as her spellcasting ability. The spell save DC is 12+the hag's Intelligence modifier, and the spell attack bonus is 4+the hag's Intelligence modifier.",
        attack_bonus: 0
      },
      {
        name: "Hag Eye (Coven Only)",
        desc: "A hag coven can craft a magic item called a hag eye, which is made from a real eye coated in varnish and often fitted to a pendant or other wearable item. The hag eye is usually entrusted to a minion for safekeeping and transport. A hag in the coven can take an action to see what the hag eye sees if the hag eye is on the same plane of existence. A hag eye has AC 10, 1 hit point, and darkvision with a radius of 60 feet. If it is destroyed, each coven member takes 3d10 psychic damage and is blinded for 24 hours.\nA hag coven can have only one hag eye at a time, and creating a new one requires all three members of the coven to perform a ritual. The ritual takes 1 hour, and the hags can't perform it while blinded. During the ritual, if the hags take any action other than performing the ritual, they must start over.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",
        attack_bonus: 6,
        damage_dice: "2d8",
        damage_bonus: 4
      },
      {
        name: "Illusory Appearance",
        desc: "The hag covers herself and anything she is wearing or carrying with a magical illusion that makes her look like another creature of her general size and humanoid shape. The illusion ends if the hag takes a bonus action to end it or if she dies.\nThe changes wrought by this effect fail to hold up to physical inspection. For example, the hag could appear to have smooth skin, but someone touching her would feel her rough flesh. Otherwise, a creature must take an action to visually inspect the illusion and succeed on a DC 20 Intelligence (Investigation) check to discern that the hag is disguised.",
        attack_bonus: 0
      },
      {
        name: "Invisible Passage",
        desc: "The hag magically turns invisible until she attacks or casts a spell, or until her concentration ends (as if concentrating on a spell). While invisible, she leaves no physical evidence of her passage, so she can be tracked only by magic. Any equipment she wears or carries is invisible with her.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Grick",
    size: "Medium",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "neutral",
    ac: 14,
    hp: 27,
    hit_dice: "6d8",
    speed: "30 ft., climb 30 ft.",
    stats: [14, 14, 11, 3, 14, 5],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, and slashing damage from nonmagical weapons",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 12",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Stone Camouflage",
        desc: "The grick has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The grick makes one attack with its tentacles. If that attack hits, the grick can make one beak attack against the same target.",
        attack_bonus: 0
      },
      {
        name: "Tentacles",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) slashing damage.",
        attack_bonus: 4,
        damage_dice: "2d6",
        damage_bonus: 2
      },
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Griffon",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 59,
    hit_dice: "7d10",
    speed: "30 ft., fly 80 ft.",
    stats: [18, 15, 16, 2, 13, 8],
    skillsaves: [
      {
        perception: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 15",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Keen Sight",
        desc: "The griffon has advantage on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The griffon makes two attacks: one with its beak and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "1d8",
        damage_bonus: 4
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Grimlock",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "grimlock",
    alignment: "neutral evil",
    ac: 11,
    hp: 11,
    hit_dice: "2d8",
    speed: "30 ft.",
    stats: [16, 12, 12, 9, 8, 6],
    skillsaves: [
      {
        athletics: 5
      },
      {
        perception: 3
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "blinded",
    condition_immunities: "",
    senses: "blindsight 30 ft. or 10 ft. while deafened (blind beyond this radius), passive Perception 13",
    languages: "Undercommon",
    cr: "1/4",
    traits: [
      {
        name: "Blind Senses",
        desc: "The grimlock can't use its blindsight while deafened and unable to smell.",
        attack_bonus: 0
      },
      {
        name: "Keen Hearing and Smell",
        desc: "The grimlock has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      },
      {
        name: "Stone Camouflage",
        desc: "The grimlock has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Spiked Bone Club",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d4 + 3) bludgeoning damage plus 2 (1d4) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d4 + 1d4",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Guard",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 16,
    hp: 11,
    hit_dice: "2d8",
    speed: "30 ft.",
    stats: [13, 12, 12, 10, 11, 10],
    skillsaves: [
      {
        perception: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 12",
    languages: "any one language (usually Common)",
    cr: "1/8",
    actions: [
      {
        name: "Spear",
        desc: "Melee or Ranged Weapon Attack: +3 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d6 + 1) piercing damage or 5 (1d8 + 1) piercing damage if used with two hands to make a melee attack.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Guardian Naga",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "lawful good",
    ac: 18,
    hp: 127,
    hit_dice: "15d10",
    speed: "40 ft.",
    stats: [19, 18, 16, 16, 19, 18],
    saves: [
      {
        dexterity: 8
      },
      {
        constitution: 7
      },
      {
        intelligence: 7
      },
      {
        wisdom: 8
      },
      {
        charisma: 8
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "charmed, poisoned",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "Celestial, Common",
    cr: "10",
    traits: [
      {
        name: "Rejuvenation",
        desc: "If it dies, the naga returns to life in 1d6 days and regains all its hit points. Only a wish spell can prevent this trait from functioning.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one creature. Hit: 8 (1d8 + 4) piercing damage, and the target must make a DC 15 Constitution saving throw, taking 45 (10d8) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 8,
        damage_dice: "1d8",
        damage_bonus: 4
      },
      {
        name: "Spit Poison",
        desc: "Ranged Weapon Attack: +8 to hit, range 15/30 ft., one creature. Hit: The target must make a DC 15 Constitution saving throw, taking 45 (10d8) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 8,
        damage_dice: "10d8"
      }
    ],
    spells: [
      "The naga is an 11th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 16, +8 to hit with spell attacks), and it needs only verbal components to cast its spells. It has the following cleric spells prepared:",
      {
        "Cantrips (at will)": "mending, sacred flame, thaumaturgy"
      },
      {
        "1st level (4 slots)": "command, cure wounds, shield of faith"
      },
      {
        "2nd level (3 slots)": "calm emotions, hold person"
      },
      {
        "3rd level (3 slots)": "bestow curse, clairvoyance"
      },
      {
        "4th level (3 slots)": "banishment, freedom of movement"
      },
      {
        "5th level (2 slots)": "flame strike, geas"
      },
      {
        "6th level (1 slot)": "true seeing"
      }
    ]
  },
  {
    name: "Gynosphinx",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "lawful neutral",
    ac: 17,
    hp: 136,
    hit_dice: "16d10",
    speed: "40 ft., fly 60 ft.",
    stats: [18, 15, 16, 18, 18, 18],
    skillsaves: [
      {
        arcana: 12
      },
      {
        history: 12
      },
      {
        perception: 8
      },
      {
        religion: 8
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "psychic",
    condition_immunities: "charmed, frightened",
    senses: "truesight 120 ft., passive Perception 18",
    languages: "Common, Sphinx",
    cr: "11",
    traits: [
      {
        name: "Inscrutable",
        desc: "The sphinx is immune to any effect that would sense its emotions or read its thoughts, as well as any divination spell that it refuses. Wisdom (Insight) checks made to ascertain the sphinx's intentions or sincerity have disadvantage.",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The sphinx's weapon attacks are magical.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The sphinx makes two claw attacks.",
        attack_bonus: 0
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",
        attack_bonus: 9,
        damage_dice: "2d8",
        damage_bonus: 4
      }
    ],
    legendary_actions: [
      {
        name: "Claw Attack",
        desc: "The sphinx makes one claw attack.",
        attack_bonus: 0
      },
      {
        name: "Teleport (Costs 2 Actions)",
        desc: "The sphinx magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",
        attack_bonus: 0
      },
      {
        name: "Cast a Spell (Costs 3 Actions)",
        desc: "The sphinx casts a spell from its list of prepared spells, using a spell slot as normal.",
        attack_bonus: 0
      }
    ],
    spells: [
      "The sphinx is a 9th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 16, +8 to hit with spell attacks). It requires no material components to cast its spells. The sphinx has the following wizard spells prepared:",
      {
        "Cantrips (at will)": "mage hand, minor illusion, prestidigitation"
      },
      {
        "1st level (4 slots)": "detect magic, identify, shield"
      },
      {
        "2nd level (3 slots)": "darkness, locate object, suggestion"
      },
      {
        "3rd level (3 slots)": "dispel magic, remove curse, tongues"
      },
      {
        "4th level (3 slots)": "banishment, greater invisibility"
      },
      {
        "5th level (1 slot)": "legend lore"
      }
    ]
  },
  {
    name: "Half-Red Dragon Veteran",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "human",
    alignment: "any alignment",
    ac: 18,
    hp: 65,
    hit_dice: "10d8",
    speed: "30 ft.",
    stats: [16, 13, 14, 10, 11, 10],
    damage_vulnerabilities: "",
    damage_resistances: "fire",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 12",
    languages: "Common, Draconic",
    cr: "5",
    actions: [
      {
        name: "Multiattack",
        desc: "The veteran makes two longsword attacks. If it has a shortsword drawn, it can also make a shortsword attack.",
        attack_bonus: 0
      },
      {
        name: "Longsword",
        desc: "Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage, or 8 (1d10 + 3) slashing damage if used with two hands.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Shortsword",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Heavy Crossbow",
        desc: "Ranged Weapon Attack: +3 to hit, range 100/400 ft., one target. Hit: 6 (1d10 + 1) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d10",
        damage_bonus: 1
      },
      {
        name: "Fire Breath (Recharge 5-6)",
        desc: "The veteran exhales fire in a 15-foot cone. Each creature in that area must make a DC 15 Dexterity saving throw, taking 24 (7d6) fire damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "7d6"
      }
    ]
  },
  {
    name: "Harpy",
    size: "Medium",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "chaotic evil",
    ac: 11,
    hp: 38,
    hit_dice: "7d8",
    speed: "20 ft., fly 40 ft.",
    stats: [12, 13, 12, 7, 10, 13],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "Common",
    cr: "1",
    actions: [
      {
        name: "Multiattack",
        desc: "The harpy makes two attacks: one with its claws and one with its club.",
        attack_bonus: 0
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 6 (2d4 + 1) slashing damage.",
        attack_bonus: 3,
        damage_dice: "2d4",
        damage_bonus: 1
      },
      {
        name: "Club",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) bludgeoning damage.",
        attack_bonus: 3,
        damage_dice: "1d4",
        damage_bonus: 1
      },
      {
        name: "Luring Song",
        desc: "The harpy sings a magical melody. Every humanoid and giant within 300 ft. of the harpy that can hear the song must succeed on a DC 11 Wisdom saving throw or be charmed until the song ends. The harpy must take a bonus action on its subsequent turns to continue singing. It can stop singing at any time. The song ends if the harpy is incapacitated.\nWhile charmed by the harpy, a target is incapacitated and ignores the songs of other harpies. If the charmed target is more than 5 ft. away from the harpy, the must move on its turn toward the harpy by the most direct route. It doesn't avoid opportunity attacks, but before moving into damaging terrain, such as lava or a pit, and whenever it takes damage from a source other than the harpy, a target can repeat the saving throw. A creature can also repeat the saving throw at the end of each of its turns. If a creature's saving throw is successful, the effect ends on it.\nA target that successfully saves is immune to this harpy's song for the next 24 hours.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Hawk",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 1,
    hit_dice: "1d4",
    speed: "10 ft., fly 60 ft.",
    stats: [5, 16, 8, 2, 14, 6],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Keen Sight",
        desc: "The hawk has advantage on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Talons",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",
        attack_bonus: 5,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Hell Hound",
    size: "Medium",
    source: "SRD",
    type: "fiend",
    subtype: "",
    alignment: "lawful evil",
    ac: 15,
    hp: 45,
    hit_dice: "7d8",
    speed: "50 ft.",
    stats: [17, 12, 14, 6, 13, 6],
    skillsaves: [
      {
        perception: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 15",
    languages: "understands Infernal but can't speak it",
    cr: "3",
    traits: [
      {
        name: "Keen Hearing and Smell",
        desc: "The hound has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The hound has advantage on an attack roll against a creature if at least one of the hound's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 7 (2d6) fire damage.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Fire Breath (Recharge 5-6)",
        desc: "The hound exhales fire in a 15-foot cone. Each creature in that area must make a DC 12 Dexterity saving throw, taking 21 (6d6) fire damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "6d6"
      }
    ]
  },
  {
    name: "Hezrou",
    size: "Large",
    source: "SRD",
    type: "fiend",
    subtype: "demon",
    alignment: "chaotic evil",
    ac: 16,
    hp: 136,
    hit_dice: "13d10",
    speed: "30 ft.",
    stats: [19, 17, 20, 5, 12, 13],
    saves: [
      {
        strength: 7
      },
      {
        constitution: 8
      },
      {
        wisdom: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "darkvision 120 ft., passive Perception 11",
    languages: "Abyssal, telepathy 120 ft.",
    cr: "8",
    traits: [
      {
        name: "Magic Resistance",
        desc: "The hezrou has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Stench",
        desc: "Any creature that starts its turn within 10 feet of the hezrou must succeed on a DC 14 Constitution saving throw or be poisoned until the start of its next turn. On a successful saving throw, the creature is immune to the hezrou's stench for 24 hours.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The hezrou makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 15 (2d10 + 4) piercing damage.",
        attack_bonus: 7,
        damage_dice: "2d10",
        damage_bonus: 4
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Variant: Summon Demon (1/Day)",
        desc: "The demon chooses what to summon and attempts a magical summoning.\nA hezrou has a 30 percent chance of summoning 2d6 dretches or one hezrou.\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Hill Giant",
    size: "Huge",
    source: "SRD",
    type: "giant",
    subtype: "",
    alignment: "chaotic evil",
    ac: 13,
    hp: 105,
    hit_dice: "10d12",
    speed: "40 ft.",
    stats: [21, 8, 19, 5, 9, 6],
    skillsaves: [
      {
        perception: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 12",
    languages: "Giant",
    cr: "5",
    actions: [
      {
        name: "Multiattack",
        desc: "The giant makes two greatclub attacks.",
        attack_bonus: 0
      },
      {
        name: "Greatclub",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 18 (3d8 + 5) bludgeoning damage.",
        attack_bonus: 8,
        damage_dice: "3d8",
        damage_bonus: 5
      },
      {
        name: "Rock",
        desc: "Ranged Weapon Attack: +8 to hit, range 60/240 ft., one target. Hit: 21 (3d10 + 5) bludgeoning damage.",
        attack_bonus: 8,
        damage_dice: "3d10",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Hippogriff",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 19,
    hit_dice: "3d10",
    speed: "40 ft, fly 60 ft.",
    stats: [17, 13, 13, 2, 12, 8],
    skillsaves: [
      {
        perception: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 15",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Keen Sight",
        desc: "The hippogriff has advantage on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The hippogriff makes two attacks: one with its beak and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d10",
        damage_bonus: 3
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Hobgoblin",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "goblinoid",
    alignment: "lawful evil",
    ac: 18,
    hp: 11,
    hit_dice: "2d8",
    speed: "30 ft.",
    stats: [13, 12, 12, 10, 10, 9],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Common, Goblin",
    cr: "1/2",
    traits: [
      {
        name: "Martial Advantage",
        desc: "Once per turn, the hobgoblin can deal an extra 7 (2d6) damage to a creature it hits with a weapon attack if that creature is within 5 ft. of an ally of the hobgoblin that isn't incapacitated.",
        attack_bonus: 0,
        damage_dice: "2d6"
      }
    ],
    actions: [
      {
        name: "Longsword",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) slashing damage, or 6 (1d10 + 1) slashing damage if used with two hands.",
        attack_bonus: 3,
        damage_dice: "1d8",
        damage_bonus: 1
      },
      {
        name: "Longbow",
        desc: "Ranged Weapon Attack: +3 to hit, range 150/600 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d8",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Homunculus",
    size: "Tiny",
    source: "SRD",
    type: "construct",
    subtype: "",
    alignment: "neutral",
    ac: 13,
    hp: 5,
    hit_dice: "2d4",
    speed: "20 ft., fly 40 ft.",
    stats: [4, 15, 11, 10, 10, 7],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "charmed, poisoned",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "understands the languages of its creator but can't speak",
    cr: "0",
    traits: [
      {
        name: "Telepathic Bond",
        desc: "While the homunculus is on the same plane of existence as its master, it can magically convey what it senses to its master, and the two can communicate telepathically.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 1 piercing damage, and the target must succeed on a DC 10 Constitution saving throw or be poisoned for 1 minute. If the saving throw fails by 5 or more, the target is instead poisoned for 5 (1d10) minutes and unconscious while poisoned in this way.",
        attack_bonus: 4,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Horned Devil",
    size: "Large",
    source: "SRD",
    type: "fiend",
    subtype: "devil",
    alignment: "lawful evil",
    ac: 18,
    hp: 148,
    hit_dice: "17d10",
    speed: "20 ft., fly 60 ft.",
    stats: [22, 17, 21, 12, 16, 17],
    saves: [
      {
        strength: 10
      },
      {
        dexterity: 7
      },
      {
        wisdom: 7
      },
      {
        charisma: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "darkvision 120 ft., passive Perception 13",
    languages: "Infernal, telepathy 120 ft.",
    cr: "11",
    traits: [
      {
        name: "Devil's Sight",
        desc: "Magical darkness doesn't impede the devil's darkvision.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The devil has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The devil makes three melee attacks: two with its fork and one with its tail. It can use Hurl Flame in place of any melee attack.",
        attack_bonus: 0
      },
      {
        name: "Fork",
        desc: "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 15 (2d8 + 6) piercing damage.",
        attack_bonus: 10,
        damage_dice: "2d8",
        damage_bonus: 6
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 10 (1d8 + 6) piercing damage. If the target is a creature other than an undead or a construct, it must succeed on a DC 17 Constitution saving throw or lose 10 (3d6) hit points at the start of each of its turns due to an infernal wound. Each time the devil hits the wounded target with this attack, the damage dealt by the wound increases by 10 (3d6). Any creature can take an action to stanch the wound with a successful DC 12 Wisdom (Medicine) check. The wound also closes if the target receives magical healing.",
        attack_bonus: 10,
        damage_dice: "1d8",
        damage_bonus: 6
      },
      {
        name: "Hurl Flame",
        desc: "Ranged Spell Attack: +7 to hit, range 150 ft., one target. Hit: 14 (4d6) fire damage. If the target is a flammable object that isn't being worn or carried, it also catches fire.",
        attack_bonus: 7,
        damage_dice: "4d6"
      }
    ]
  },
  {
    name: "Hunter Shark",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 45,
    hit_dice: "6d10",
    speed: "swim 40 ft.",
    stats: [18, 13, 15, 1, 10, 4],
    skillsaves: [
      {
        perception: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 12",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Blood Frenzy",
        desc: "The shark has advantage on melee attack rolls against any creature that doesn't have all its hit points.",
        attack_bonus: 0
      },
      {
        name: "Water Breathing",
        desc: "The shark can breathe only underwater.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "2d8",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Hydra",
    size: "Huge",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 15,
    hp: 172,
    hit_dice: "15d12",
    speed: "30 ft., swim 30 ft.",
    stats: [20, 12, 20, 2, 10, 7],
    skillsaves: [
      {
        perception: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 16",
    languages: "",
    cr: "8",
    traits: [
      {
        name: "Hold Breath",
        desc: "The hydra can hold its breath for 1 hour.",
        attack_bonus: 0
      },
      {
        name: "Multiple Heads",
        desc: "The hydra has five heads. While it has more than one head, the hydra has advantage on saving throws against being blinded, charmed, deafened, frightened, stunned, and knocked unconscious.\nWhenever the hydra takes 25 or more damage in a single turn, one of its heads dies. If all its heads die, the hydra dies.\nAt the end of its turn, it grows two heads for each of its heads that died since its last turn, unless it has taken fire damage since its last turn. The hydra regains 10 hit points for each head regrown in this way.",
        attack_bonus: 0
      },
      {
        name: "Reactive Heads",
        desc: "For each head the hydra has beyond one, it gets an extra reaction that can be used only for opportunity attacks.",
        attack_bonus: 0
      },
      {
        name: "Wakeful",
        desc: "While the hydra sleeps, at least one of its heads is awake.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The hydra makes as many bite attacks as it has heads.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 10 (1d10 + 5) piercing damage.",
        attack_bonus: 8,
        damage_dice: "1d10",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Hyena",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 5,
    hit_dice: "1d8",
    speed: "50 ft.",
    stats: [11, 13, 12, 2, 12, 5],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Pack Tactics",
        desc: "The hyena has advantage on an attack roll against a creature if at least one of the hyena's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 3 (1d6) piercing damage.",
        attack_bonus: 2,
        damage_dice: "1d6"
      }
    ]
  },
  {
    name: "Ice Devil",
    size: "Large",
    source: "SRD",
    type: "fiend",
    subtype: "devil",
    alignment: "lawful evil",
    ac: 18,
    hp: 180,
    hit_dice: "19d10",
    speed: "40 ft.",
    stats: [21, 14, 18, 18, 15, 18],
    saves: [
      {
        dexterity: 7
      },
      {
        constitution: 9
      },
      {
        wisdom: 7
      },
      {
        charisma: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "blindsight 60 ft., darkvision 120 ft., passive Perception 12",
    languages: "Infernal, telepathy 120 ft.",
    cr: "14",
    traits: [
      {
        name: "Devil's Sight",
        desc: "Magical darkness doesn't impede the devil's darkvision.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The devil has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The devil makes three attacks: one with its bite, one with its claws, and one with its tail.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) piercing damage plus 10 (3d6) cold damage.",
        attack_bonus: 10,
        damage_dice: "2d6 + 3d6",
        damage_bonus: 5
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 10 (2d4 + 5) slashing damage plus 10 (3d6) cold damage.",
        attack_bonus: 10,
        damage_dice: "2d4 + 3d6",
        damage_bonus: 5
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack:+10 to hit, reach 10 ft., one target. Hit: 12 (2d6 + 5) bludgeoning damage plus 10 (3d6) cold damage.",
        attack_bonus: 10,
        damage_dice: "2d6 + 3d6",
        damage_bonus: 5
      },
      {
        name: "Wall of Ice",
        desc: "The devil magically forms an opaque wall of ice on a solid surface it can see within 60 feet of it. The wall is 1 foot thick and up to 30 feet long and 10 feet high, or it's a hemispherical dome up to 20 feet in diameter.\nWhen the wall appears, each creature in its space is pushed out of it by the shortest route. The creature chooses which side of the wall to end up on, unless the creature is incapacitated. The creature then makes a DC 17 Dexterity saving throw, taking 35 (10d6) cold damage on a failed save, or half as much damage on a successful one.\nThe wall lasts for 1 minute or until the devil is incapacitated or dies. The wall can be damaged and breached; each 10-foot section has AC 5, 30 hit points, vulnerability to fire damage, and immunity to acid, cold, necrotic, poison, and psychic damage. If a section is destroyed, it leaves behind a sheet of frigid air in the space the wall occupied. Whenever a creature finishes moving through the frigid air on a turn, willingly or otherwise, the creature must make a DC 17 Constitution saving throw, taking 17 (5d6) cold damage on a failed save, or half as much damage on a successful one. The frigid air dissipates when the rest of the wall vanishes.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ice Mephit",
    size: "Small",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral evil",
    ac: 11,
    hp: 21,
    hit_dice: "6d6",
    speed: "30 ft., fly 30 ft.",
    stats: [7, 13, 10, 9, 11, 12],
    skillsaves: [
      {
        perception: 2
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "bludgeoning, fire",
    damage_resistances: "",
    damage_immunities: "cold, poison",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 12",
    languages: "Aquan, Auran",
    cr: "1/2",
    traits: [
      {
        name: "Death Burst",
        desc: "When the mephit dies, it explodes in a burst of jagged ice. Each creature within 5 ft. of it must make a DC 10 Dexterity saving throw, taking 4 (1d8) slashing damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "1d8"
      },
      {
        name: "False Appearance",
        desc: "While the mephit remains motionless, it is indistinguishable from an ordinary shard of ice.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting (1/Day)",
        desc: "The mephit can innately cast fog cloud, requiring no material components. Its innate spellcasting ability is Charisma.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 3 (1d4 + 1) slashing damage plus 2 (1d4) cold damage.",
        attack_bonus: 3,
        damage_dice: "1d4",
        damage_bonus: 1
      },
      {
        name: "Frost Breath (Recharge 6)",
        desc: "The mephit exhales a 15-foot cone of cold air. Each creature in that area must succeed on a DC 10 Dexterity saving throw, taking 5 (2d4) cold damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0
      },
      {
        name: "Variant: Summon Mephits (1/Day)",
        desc: "The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Imp",
    size: "Tiny",
    source: "SRD",
    type: "fiend",
    subtype: "devil",
    alignment: "lawful evil",
    ac: 13,
    hp: 10,
    hit_dice: "3d4",
    speed: "20 ft., fly 40 ft.",
    stats: [6, 17, 13, 11, 12, 14],
    skillsaves: [
      {
        deception: 4
      },
      {
        insight: 3
      },
      {
        persuasion: 4
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold; bludgeoning, piercing, and slashing from nonmagical/nonsilver weapons",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "darkvision 120 ft., passive Perception 11",
    languages: "Infernal, Common",
    cr: "1",
    traits: [
      {
        name: "Shapechanger",
        desc: "The imp can use its action to polymorph into a beast form that resembles a rat (speed 20 ft.), a raven (20 ft., fly 60 ft.), or a spider (20 ft., climb 20 ft.), or back into its true form. Its statistics are the same in each form, except for the speed changes noted. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",
        attack_bonus: 0
      },
      {
        name: "Devil's Sight",
        desc: "Magical darkness doesn't impede the imp's darkvision.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The imp has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Variant: Familiar",
        desc: "The imp can serve another creature as a familiar, forming a telepathic bond with its willing master. While the two are bonded, the master can sense what the quasit senses as long as they are within 1 mile of each other. While the imp is within 10 feet of its master, the master shares the quasit's Magic Resistance trait. At any time and for any reason, the imp can end its service as a familiar, ending the telepathic bond.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Sting (Bite in Beast Form)",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft ., one target. Hit: 5 (1d4 + 3) piercing damage, and the target must make on a DC 11 Constitution saving throw, taking 10 (3d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 5,
        damage_dice: "1d4",
        damage_bonus: 3
      },
      {
        name: "Invisibility",
        desc: "The imp magically turns invisible until it attacks, or until its concentration ends (as if concentrating on a spell). Any equipment the imp wears or carries is invisible with it.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Invisible Stalker",
    size: "Medium",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral",
    ac: 14,
    hp: 104,
    hit_dice: "16d8",
    speed: "50 ft., fly 50 ft. (hover)",
    stats: [16, 19, 14, 10, 15, 11],
    skillsaves: [
      {
        perception: 8
      },
      {
        stealth: 10
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "poison",
    condition_immunities: "exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",
    senses: "darkvision 60 ft., passive Perception 18",
    languages: "Auran, understands Common but doesn't speak it",
    cr: "6",
    traits: [
      {
        name: "Invisibility",
        desc: "The stalker is invisible.",
        attack_bonus: 0
      },
      {
        name: "Faultless Tracker",
        desc: "The stalker is given a quarry by its summoner. The stalker knows the direction and distance to its quarry as long as the two of them are on the same plane of existence. The stalker also knows the location of its summoner.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The stalker makes two slam attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Iron Golem",
    size: "Large",
    source: "SRD",
    type: "construct",
    subtype: "",
    alignment: "unaligned",
    ac: 20,
    hp: 210,
    hit_dice: "20d10",
    speed: "30 ft.",
    stats: [24, 9, 20, 3, 11, 1],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire, poison, psychic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",
    condition_immunities: "charmed, exhaustion, frightened, paralyzed, petrified, poisoned",
    senses: "darkvision 120 ft., passive Perception 10",
    languages: "understands the languages of its creator but can't speak",
    cr: "16",
    traits: [
      {
        name: "Fire Absorption",
        desc: "Whenever the golem is subjected to fire damage, it takes no damage and instead regains a number of hit points equal to the fire damage dealt.",
        attack_bonus: 0
      },
      {
        name: "Immutable Form",
        desc: "The golem is immune to any spell or effect that would alter its form.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The golem has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The golem's weapon attacks are magical.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The golem makes two melee attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +13 to hit, reach 5 ft., one target. Hit: 20 (3d8 + 7) bludgeoning damage.",
        attack_bonus: 13,
        damage_dice: "3d8",
        damage_bonus: 7
      },
      {
        name: "Sword",
        desc: "Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 23 (3d10 + 7) slashing damage.",
        attack_bonus: 13,
        damage_dice: "3d10",
        damage_bonus: 7
      },
      {
        name: "Poison Breath (Recharge 5-6)",
        desc: "The golem exhales poisonous gas in a 15-foot cone. Each creature in that area must make a DC 19 Constitution saving throw, taking 45 (l0d8) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "10d8"
      }
    ]
  },
  {
    name: "Jackal",
    size: "Small",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 3,
    hit_dice: "1d6",
    speed: "40 ft.",
    stats: [8, 15, 11, 3, 12, 6],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Keen Hearing and Smell",
        desc: "The jackal has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The jackal has advantage on an attack roll against a creature if at least one of the jackal's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 1 (1d4 \u2014 1) piercing damage.",
        attack_bonus: 1,
        damage_dice: "1d4",
        damage_bonus: -1
      }
    ]
  },
  {
    name: "Killer Whale",
    size: "Huge",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 90,
    hit_dice: "12d12",
    speed: "swim 60 ft.",
    stats: [19, 10, 13, 3, 12, 7],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 120 ft., passive Perception 13",
    languages: "",
    cr: "3",
    traits: [
      {
        name: "Echolocation",
        desc: "The whale can't use its blindsight while deafened.",
        attack_bonus: 0
      },
      {
        name: "Hold Breath",
        desc: "The whale can hold its breath for 30 minutes",
        attack_bonus: 0
      },
      {
        name: "Keen Hearing",
        desc: "The whale has advantage on Wisdom (Perception) checks that rely on hearing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 21 (5d6 + 4) piercing damage.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Knight",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 18,
    hp: 52,
    hit_dice: "8d8",
    speed: "30 ft.",
    stats: [16, 11, 14, 11, 11, 15],
    saves: [
      {
        constitution: 4
      },
      {
        wisdom: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "any one language (usually Common)",
    cr: "3",
    traits: [
      {
        name: "Brave",
        desc: "The knight has advantage on saving throws against being frightened.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The knight makes two melee attacks.",
        attack_bonus: 0
      },
      {
        name: "Greatsword",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      },
      {
        name: "Heavy Crossbow",
        desc: "Ranged Weapon Attack: +2 to hit, range 100/400 ft., one target. Hit: 5 (1d10) piercing damage.",
        attack_bonus: 2,
        damage_dice: "1d10"
      },
      {
        name: "Leadership (Recharges after a Short or Long Rest)",
        desc: "For 1 minute, the knight can utter a special command or warning whenever a nonhostile creature that it can see within 30 ft. of it makes an attack roll or a saving throw. The creature can add a d4 to its roll provided it can hear and understand the knight. A creature can benefit from only one Leadership die at a time. This effect ends if the knight is incapacitated.",
        attack_bonus: 0
      }
    ],
    reactions: [
      {
        name: "Parry",
        desc: "The knight adds 2 to its AC against one melee attack that would hit it. To do so, the knight must see the attacker and be wielding a melee weapon.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Kobold",
    size: "Small",
    source: "SRD",
    type: "humanoid",
    subtype: "kobold",
    alignment: "lawful evil",
    ac: 12,
    hp: 5,
    hit_dice: "2d6",
    speed: "30 ft.",
    stats: [7, 15, 9, 8, 7, 8],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 8",
    languages: "Common, Draconic",
    cr: "1/8",
    traits: [
      {
        name: "Sunlight Sensitivity",
        desc: "While in sunlight, the kobold has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The kobold has advantage on an attack roll against a creature if at least one of the kobold's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Dagger",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      },
      {
        name: "Sling",
        desc: "Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 4 (1d4 + 2) bludgeoning damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Kraken",
    size: "Gargantuan",
    source: "SRD",
    type: "monstrosity",
    subtype: "titan",
    alignment: "chaotic evil",
    ac: 18,
    hp: 472,
    hit_dice: "27d20",
    speed: "20 ft., swim 60 ft.",
    stats: [30, 11, 25, 22, 18, 20],
    saves: [
      {
        strength: 17
      },
      {
        dexterity: 7
      },
      {
        constitution: 14
      },
      {
        intelligence: 13
      },
      {
        wisdom: 11
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning; bludgeoning, piercing, and slashing from nonmagical weapons",
    condition_immunities: "frightened, paralyzed",
    senses: "truesight 120 ft., passive Perception 14",
    languages: "understands Abyssal, Celestial, Infernal, and Primordial but can't speak, telepathy 120 ft.",
    cr: "23",
    traits: [
      {
        name: "Amphibious",
        desc: "The kraken can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Freedom of Movement",
        desc: "The kraken ignores difficult terrain, and magical effects can't reduce its speed or cause it to be restrained. It can spend 5 feet of movement to escape from nonmagical restraints or being grappled.",
        attack_bonus: 0
      },
      {
        name: "Siege Monster",
        desc: "The kraken deals double damage to objects and structures.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The kraken makes three tentacle attacks, each of which it can replace with one use of Fling.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 23 (3d8 + 10) piercing damage. If the target is a Large or smaller creature grappled by the kraken, that creature is swallowed, and the grapple ends. While swallowed, the creature is blinded and restrained, it has total cover against attacks and other effects outside the kraken, and it takes 42 (12d6) acid damage at the start of each of the kraken's turns. If the kraken takes 50 damage or more on a single turn from a creature inside it, the kraken must succeed on a DC 25 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet of the kraken. If the kraken dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 15 feet of movement, exiting prone.",
        attack_bonus: 7,
        damage_dice: "3d8",
        damage_bonus: 10
      },
      {
        name: "Tentacle",
        desc: "Melee Weapon Attack: +7 to hit, reach 30 ft., one target. Hit: 20 (3d6 + 10) bludgeoning damage, and the target is grappled (escape DC 18). Until this grapple ends, the target is restrained. The kraken has ten tentacles, each of which can grapple one target.",
        attack_bonus: 7,
        damage_dice: "3d6",
        damage_bonus: 10
      },
      {
        name: "Fling",
        desc: "One Large or smaller object held or creature grappled by the kraken is thrown up to 60 feet in a random direction and knocked prone. If a thrown target strikes a solid surface, the target takes 3 (1d6) bludgeoning damage for every 10 feet it was thrown. If the target is thrown at another creature, that creature must succeed on a DC 18 Dexterity saving throw or take the same damage and be knocked prone.",
        attack_bonus: 0
      },
      {
        name: "Lightning Storm",
        desc: "The kraken magically creates three bolts of lightning, each of which can strike a target the kraken can see within 120 feet of it. A target must make a DC 23 Dexterity saving throw, taking 22 (4d10) lightning damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "4d10"
      }
    ],
    legendary_actions: [
      {
        name: "Tentacle Attack or Fling",
        desc: "The kraken makes one tentacle attack or uses its Fling.",
        attack_bonus: 0
      },
      {
        name: "Lightning Storm (Costs 2 Actions)",
        desc: "The kraken uses Lightning Storm.",
        attack_bonus: 0
      },
      {
        name: "Ink Cloud (Costs 3 Actions)",
        desc: "While underwater, the kraken expels an ink cloud in a 60-foot radius. The cloud spreads around corners, and that area is heavily obscured to creatures other than the kraken. Each creature other than the kraken that ends its turn there must succeed on a DC 23 Constitution saving throw, taking 16 (3d10) poison damage on a failed save, or half as much damage on a successful one. A strong current disperses the cloud, which otherwise disappears at the end of the kraken's next turn.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Lamia",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "chaotic evil",
    ac: 13,
    hp: 97,
    hit_dice: "13d10",
    speed: "30 ft.",
    stats: [16, 13, 15, 14, 15, 16],
    skillsaves: [
      {
        deception: 7
      },
      {
        insight: 4
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 12",
    languages: "Abyssal, Common",
    cr: "4",
    traits: [
      {
        name: "Innate Spellcasting",
        desc: "The lamia's innate spellcasting ability is Charisma (spell save DC 13). It can innately cast the following spells, requiring no material components. At will: disguise self (any humanoid form), major image 3/day each: charm person, mirror image, scrying, suggestion 1/day: geas",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The lamia makes two attacks: one with its claws and one with its dagger or Intoxicating Touch.",
        attack_bonus: 0
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 14 (2d10 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "2d10",
        damage_bonus: 3
      },
      {
        name: "Dagger",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d4 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d4",
        damage_bonus: 3
      },
      {
        name: "Intoxicating Touch",
        desc: "Melee Spell Attack: +5 to hit, reach 5 ft., one creature. Hit: The target is magically cursed for 1 hour. Until the curse ends, the target has disadvantage on Wisdom saving throws and all ability checks.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Lemure",
    size: "Medium",
    source: "SRD",
    type: "fiend",
    subtype: "devil",
    alignment: "lawful evil",
    ac: 7,
    hp: 13,
    hit_dice: "3d8",
    speed: "15 ft.",
    stats: [10, 5, 11, 1, 11, 3],
    damage_vulnerabilities: "",
    damage_resistances: "cold",
    damage_immunities: "fire, poison",
    condition_immunities: "charmed, frightened, poisoned",
    senses: "darkvision 120 ft., passive Perception 10",
    languages: "understands infernal but can't speak",
    cr: "0",
    traits: [
      {
        name: "Devil's Sight",
        desc: "Magical darkness doesn't impede the lemure's darkvision.",
        attack_bonus: 0
      },
      {
        name: "Hellish Rejuvenation",
        desc: "A lemure that dies in the Nine Hells comes back to life with all its hit points in 1d10 days unless it is killed by a good-aligned creature with a bless spell cast on that creature or its remains are sprinkled with holy water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Fist",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage",
        attack_bonus: 3,
        damage_dice: "1d4"
      }
    ]
  },
  {
    name: "Lich",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "any evil alignment",
    ac: 17,
    hp: 135,
    hit_dice: "18d8",
    speed: "30 ft.",
    stats: [11, 16, 16, 20, 14, 16],
    saves: [
      {
        constitution: 10
      },
      {
        intelligence: 12
      },
      {
        wisdom: 9
      }
    ],
    skillsaves: [
      {
        arcana: 18
      },
      {
        history: 12
      },
      {
        insight: 9
      },
      {
        perception: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold, lightning, necrotic",
    damage_immunities: "poison; bludgeoning, piercing, and slashing from nonmagical weapons",
    condition_immunities: "charmed, exhaustion, frightened, paralyzed, poisoned",
    senses: "truesight 120 ft., passive Perception 19",
    languages: "Common plus up to five other languages",
    cr: "21",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the lich fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      },
      {
        name: "Rejuvenation",
        desc: "If it has a phylactery, a destroyed lich gains a new body in 1d10 days, regaining all its hit points and becoming active again. The new body appears within 5 feet of the phylactery.",
        attack_bonus: 0
      },
      {
        name: "Turn Resistance",
        desc: "The lich has advantage on saving throws against any effect that turns undead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Paralyzing Touch",
        desc: "Melee Spell Attack: +12 to hit, reach 5 ft., one creature. Hit: 10 (3d6) cold damage. The target must succeed on a DC 18 Constitution saving throw or be paralyzed for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 12,
        damage_dice: "3d6"
      }
    ],
    legendary_actions: [
      {
        name: "Cantrip",
        desc: "The lich casts a cantrip.",
        attack_bonus: 0
      },
      {
        name: "Paralyzing Touch (Costs 2 Actions)",
        desc: "The lich uses its Paralyzing Touch.",
        attack_bonus: 0
      },
      {
        name: "Frightening Gaze (Costs 2 Actions)",
        desc: "The lich fixes its gaze on one creature it can see within 10 feet of it. The target must succeed on a DC 18 Wisdom saving throw against this magic or become frightened for 1 minute. The frightened target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a target's saving throw is successful or the effect ends for it, the target is immune to the lich's gaze for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Disrupt Life (Costs 3 Actions)",
        desc: "Each living creature within 20 feet of the lich must make a DC 18 Constitution saving throw against this magic, taking 21 (6d6) necrotic damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "6d6"
      }
    ],
    spells: [
      "The lich is an 18th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 20, +12 to hit with spell attacks). The lich has the following wizard spells prepared:",
      {
        "Cantrips (at will)": "mage hand, prestidigitation, ray of frost"
      },
      {
        "1st level (4 slots)": "detect magic, magic missile, shield, thunderwave"
      },
      {
        "2nd level (3 slots)": "detect thoughts, invisibility, Melf's acid arrow, mirror image"
      },
      {
        "3rd level (3 slots)": "animate dead, counterspell, dispel magic, fireball"
      },
      {
        "4th level (3 slots)": "blight, dimension door"
      },
      {
        "5th level (3 slots)": "cloudkill, scrying"
      },
      {
        "6th level (1 slot)": "disintegrate, globe of invulnerability"
      },
      {
        "7th level (1 slot)": "finger of death, plane shift"
      },
      {
        "8th level (1 slot)": "dominate monster, power word stun"
      },
      {
        "9th level (1 slot)": "power word kill"
      }
    ]
  },
  {
    name: "Lion",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 26,
    hit_dice: "4d10",
    speed: "50 ft.",
    stats: [17, 15, 13, 3, 12, 8],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Keen Smell",
        desc: "The lion has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The lion has advantage on an attack roll against a creature if at least one of the lion's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      },
      {
        name: "Pounce",
        desc: "If the lion moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 13 Strength saving throw or be knocked prone. If the target is prone, the lion can make one bite attack against it as a bonus action.",
        attack_bonus: 0
      },
      {
        name: "Running Leap",
        desc: "With a 10-foot running start, the lion can long jump up to 25 ft..",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Lizard",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 2,
    hit_dice: "1d4",
    speed: "20 ft., climb 20 ft.",
    stats: [2, 11, 10, 1, 8, 3],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 9",
    languages: "",
    cr: "0",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",
        attack_bonus: 0,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Lizardfolk",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "lizardfolk",
    alignment: "neutral",
    ac: 15,
    hp: 22,
    hit_dice: "4d8",
    speed: "30 ft., swim 30 ft.",
    stats: [15, 10, 13, 7, 12, 7],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 4
      },
      {
        survival: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "Draconic",
    cr: "1/2",
    traits: [
      {
        name: "Hold Breath",
        desc: "The lizardfolk can hold its breath for 15 minutes.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The lizardfolk makes two melee attacks, each one with a different weapon.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Heavy Club",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) bludgeoning damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Javelin",
        desc: "Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Spiked Shield",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Mage",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 12,
    hp: 40,
    hit_dice: "9d8",
    speed: "30 ft.",
    stats: [9, 14, 11, 17, 12, 11],
    saves: [
      {
        intelligence: 6
      },
      {
        wisdom: 4
      }
    ],
    skillsaves: [
      {
        arcana: 6
      },
      {
        history: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 11",
    languages: "any four languages",
    cr: "6",
    traits: [],
    actions: [
      {
        name: "Dagger",
        desc: "Melee or Ranged Weapon Attack: +5 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ],
    spells: [
      "The mage is a 9th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 14, +6 to hit with spell attacks). The mage has the following wizard spells prepared:",
      {
        "Cantrips (at will)": "fire bolt, light, mage hand, prestidigitation"
      },
      {
        "1st level (4 slots)": "detect magic, mage armor, magic missile, shield"
      },
      {
        "2nd level (3 slots)": "misty step, suggestion"
      },
      {
        "3rd level (3 slots)": "counterspell, fireball, fly"
      },
      {
        "4th level (3 slots)": "greater invisibility, ice storm"
      },
      {
        "5th level (1 slot)": "cone of cold"
      }
    ]
  },
  {
    name: "Magma Mephit",
    size: "Small",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral evil",
    ac: 11,
    hp: 22,
    hit_dice: "5d6",
    speed: "30 ft., fly 30 ft.",
    stats: [8, 12, 12, 7, 10, 10],
    skillsaves: [
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "cold",
    damage_resistances: "",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Ignan, Terran",
    cr: "1/2",
    traits: [
      {
        name: "Death Burst",
        desc: "When the mephit dies, it explodes in a burst of lava. Each creature within 5 ft. of it must make a DC 11 Dexterity saving throw, taking 7 (2d6) fire damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "2d6"
      },
      {
        name: "False Appearance",
        desc: "While the mephit remains motionless, it is indistinguishable from an ordinary mound of magma.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting (1/Day)",
        desc: "The mephit can innately cast heat metal (spell save DC 10), requiring no material components. Its innate spellcasting ability is Charisma.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft ., one creature. Hit: 3 (1d4 + 1) slashing damage plus 2 (1d4) fire damage.",
        attack_bonus: 3,
        damage_dice: "1d4",
        damage_bonus: 1
      },
      {
        name: "Fire Breath (Recharge 6)",
        desc: "The mephit exhales a 15-foot cone of fire. Each creature in that area must make a DC 11 Dexterity saving throw, taking 7 (2d6) fire damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0
      },
      {
        name: "Variant: Summon Mephits (1/Day)",
        desc: "The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Magmin",
    size: "Small",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "chaotic neutral",
    ac: 14,
    hp: 9,
    hit_dice: "2d6",
    speed: "30 ft.",
    stats: [7, 15, 12, 8, 11, 10],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Ignan",
    cr: "1/2",
    traits: [
      {
        name: "Death Burst",
        desc: "When the magmin dies, it explodes in a burst of fire and magma. Each creature within 10 ft. of it must make a DC 11 Dexterity saving throw, taking 7 (2d6) fire damage on a failed save, or half as much damage on a successful one. Flammable objects that aren't being worn or carried in that area are ignited.",
        attack_bonus: 0,
        damage_dice: "2d6"
      },
      {
        name: "Ignited Illumination",
        desc: "As a bonus action, the magmin can set itself ablaze or extinguish its flames. While ablaze, the magmin sheds bright light in a 10-foot radius and dim light for an additional 10 ft.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Touch",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d6) fire damage. If the target is a creature or a flammable object, it ignites. Until a target takes an action to douse the fire, the target takes 3 (1d6) fire damage at the end of each of its turns.",
        attack_bonus: 4,
        damage_dice: "2d6"
      }
    ]
  },
  {
    name: "Mammoth",
    size: "Huge",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 126,
    hit_dice: "11d12",
    speed: "40 ft.",
    stats: [24, 9, 21, 3, 11, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "6",
    traits: [
      {
        name: "Trampling Charge",
        desc: "If the mammoth moves at least 20 ft. straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 18 Strength saving throw or be knocked prone. If the target is prone, the mammoth can make one stomp attack against it as a bonus action.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Gore",
        desc: "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 25 (4d8 + 7) piercing damage.",
        attack_bonus: 10,
        damage_dice: "4d8",
        damage_bonus: 7
      },
      {
        name: "Stomp",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one prone creature. Hit: 29 (4d10 + 7) bludgeoning damage.",
        attack_bonus: 10,
        damage_dice: "4d10",
        damage_bonus: 7
      }
    ]
  },
  {
    name: "Manticore",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "lawful evil",
    ac: 14,
    hp: 68,
    hit_dice: "8d10",
    speed: "30 ft., fly 50 ft.",
    stats: [17, 16, 17, 7, 12, 8],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 11",
    languages: "",
    cr: "3",
    traits: [
      {
        name: "Tail Spike Regrowth",
        desc: "The manticore has twenty-four tail spikes. Used spikes regrow when the manticore finishes a long rest.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The manticore makes three attacks: one with its bite and two with its claws or three with its tail spikes.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Tail Spike",
        desc: "Ranged Weapon Attack: +5 to hit, range 100/200 ft., one target. Hit: 7 (1d8 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Marilith",
    size: "Large",
    source: "SRD",
    type: "fiend",
    subtype: "demon",
    alignment: "chaotic evil",
    ac: 18,
    hp: 189,
    hit_dice: "18d10",
    speed: "40 ft.",
    stats: [18, 20, 20, 18, 16, 20],
    saves: [
      {
        strength: 9
      },
      {
        constitution: 10
      },
      {
        wisdom: 8
      },
      {
        charisma: 10
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "truesight 120 ft., passive Perception 13",
    languages: "Abyssal, telepathy 120 ft.",
    cr: "16",
    traits: [
      {
        name: "Magic Resistance",
        desc: "The marilith has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The marilith's weapon attacks are magical.",
        attack_bonus: 0
      },
      {
        name: "Reactive",
        desc: "The marilith can take one reaction on every turn in combat.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The marilith can make seven attacks: six with its longswords and one with its tail.",
        attack_bonus: 0
      },
      {
        name: "Longsword",
        desc: "Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",
        attack_bonus: 9,
        damage_dice: "2d8",
        damage_bonus: 4
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +9 to hit, reach 10 ft., one creature. Hit: 15 (2d10 + 4) bludgeoning damage. If the target is Medium or smaller, it is grappled (escape DC 19). Until this grapple ends, the target is restrained, the marilith can automatically hit the target with its tail, and the marilith can't make tail attacks against other targets.",
        attack_bonus: 9,
        damage_dice: "2d10",
        damage_bonus: 4
      },
      {
        name: "Teleport",
        desc: "The marilith magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",
        attack_bonus: 0
      },
      {
        name: "Variant: Summon Demon (1/Day)",
        desc: "The demon chooses what to summon and attempts a magical summoning.\nA marilith has a 50 percent chance of summoning 1d6 vrocks, 1d4 hezrous, 1d3 glabrezus, 1d2 nalfeshnees, or one marilith.\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",
        attack_bonus: 0
      }
    ],
    reactions: [
      {
        name: "Parry",
        desc: "The marilith adds 5 to its AC against one melee attack that would hit it. To do so, the marilith must see the attacker and be wielding a melee weapon.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Mastiff",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 5,
    hit_dice: "1d8",
    speed: "40 ft.",
    stats: [13, 14, 12, 3, 12, 7],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "1/8",
    traits: [
      {
        name: "Keen Hearing and Smell",
        desc: "The mastiff has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Medusa",
    size: "Medium",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "lawful evil",
    ac: 15,
    hp: 127,
    hit_dice: "17d8",
    speed: "30 ft.",
    stats: [10, 15, 16, 12, 13, 15],
    skillsaves: [
      {
        deception: 5
      },
      {
        insight: 4
      },
      {
        perception: 4
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "Common",
    cr: "6",
    traits: [
      {
        name: "Petrifying Gaze",
        desc: "When a creature that can see the medusa's eyes starts its turn within 30 ft. of the medusa, the medusa can force it to make a DC 14 Constitution saving throw if the medusa isn't incapacitated and can see the creature. If the saving throw fails by 5 or more, the creature is instantly petrified. Otherwise, a creature that fails the save begins to turn to stone and is restrained. The restrained creature must repeat the saving throw at the end of its next turn, becoming petrified on a failure or ending the effect on a success. The petrification lasts until the creature is freed by the greater restoration spell or other magic.\nUnless surprised, a creature can avert its eyes to avoid the saving throw at the start of its turn. If the creature does so, it can't see the medusa until the start of its next turn, when it can avert its eyes again. If the creature looks at the medusa in the meantime, it must immediately make the save.\nIf the medusa sees itself reflected on a polished surface within 30 ft. of it and in an area of bright light, the medusa is, due to its curse, affected by its own gaze.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The medusa makes either three melee attacks \u2014  one with its snake hair and two with its shortsword \u2014 or two ranged attacks with its longbow.",
        attack_bonus: 0
      },
      {
        name: "Snake Hair",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage plus 14 (4d6) poison damage.",
        attack_bonus: 5,
        damage_dice: "1d4",
        damage_bonus: 2
      },
      {
        name: "Shortsword",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Longbow",
        desc: "Ranged Weapon Attack: +5 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage plus 7 (2d6) poison damage.",
        attack_bonus: 5,
        damage_dice: "2d6"
      }
    ]
  },
  {
    name: "Merfolk",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "merfolk",
    alignment: "neutral",
    ac: 11,
    hp: 11,
    hit_dice: "2d8",
    speed: "10 ft., swim 40 ft.",
    stats: [10, 13, 12, 11, 11, 12],
    skillsaves: [
      {
        perception: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 12",
    languages: "Aquan, Common",
    cr: "1/8",
    traits: [
      {
        name: "Amphibious",
        desc: "The merfolk can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Spear",
        desc: "Melee or Ranged Weapon Attack: +2 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 3 (1d6) piercing damage, or 4 (1d8) piercing damage if used with two hands to make a melee attack.",
        attack_bonus: 2,
        damage_dice: "1d6"
      }
    ]
  },
  {
    name: "Merrow",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "chaotic evil",
    ac: 13,
    hp: 45,
    hit_dice: "6d10",
    speed: "10 ft., swim 40 ft.",
    stats: [18, 10, 15, 8, 10, 9],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Abyssal, Aquan",
    cr: "2",
    traits: [
      {
        name: "Amphibious",
        desc: "The merrow can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The merrow makes two attacks: one with its bite and one with its claws or harpoon.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "1d8",
        damage_bonus: 4
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (2d4 + 4) slashing damage.",
        attack_bonus: 6,
        damage_dice: "2d4",
        damage_bonus: 4
      },
      {
        name: "Harpoon",
        desc: "Melee or Ranged Weapon Attack: +6 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 11 (2d6 + 4) piercing damage. If the target is a Huge or smaller creature, it must succeed on a Strength contest against the merrow or be pulled up to 20 feet toward the merrow.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Mimic",
    size: "Medium",
    source: "SRD",
    type: "monstrosity",
    subtype: "shapechanger",
    alignment: "neutral",
    ac: 12,
    hp: 58,
    hit_dice: "9d8",
    speed: "15 ft.",
    stats: [17, 12, 15, 5, 13, 8],
    skillsaves: [
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid",
    condition_immunities: "prone",
    senses: "darkvision 60 ft., passive Perception 11",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Shapechanger",
        desc: "The mimic can use its action to polymorph into an object or back into its true, amorphous form. Its statistics are the same in each form. Any equipment it is wearing or carrying isn 't transformed. It reverts to its true form if it dies.",
        attack_bonus: 0
      },
      {
        name: "Adhesive (Object Form Only)",
        desc: "The mimic adheres to anything that touches it. A Huge or smaller creature adhered to the mimic is also grappled by it (escape DC 13). Ability checks made to escape this grapple have disadvantage.",
        attack_bonus: 0
      },
      {
        name: "False Appearance (Object Form Only)",
        desc: "While the mimic remains motionless, it is indistinguishable from an ordinary object.",
        attack_bonus: 0
      },
      {
        name: "Grappler",
        desc: "The mimic has advantage on attack rolls against any creature grappled by it.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Pseudopod",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) bludgeoning damage. If the mimic is in object form, the target is subjected to its Adhesive trait.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 4 (1d8) acid damage.",
        attack_bonus: 5,
        damage_dice: "1d8 + 1d8",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Minotaur",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "chaotic evil",
    ac: 14,
    hp: 76,
    hit_dice: "9d10",
    speed: "40 ft.",
    stats: [18, 11, 16, 6, 16, 9],
    skillsaves: [
      {
        perception: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 17",
    languages: "Abyssal",
    cr: "3",
    traits: [
      {
        name: "Charge",
        desc: "If the minotaur moves at least 10 ft. straight toward a target and then hits it with a gore attack on the same turn, the target takes an extra 9 (2d8) piercing damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be pushed up to 10 ft. away and knocked prone.",
        attack_bonus: 0,
        damage_dice: "2d8"
      },
      {
        name: "Labyrinthine Recall",
        desc: "The minotaur can perfectly recall any path it has traveled.",
        attack_bonus: 0
      },
      {
        name: "Reckless",
        desc: "At the start of its turn, the minotaur can gain advantage on all melee weapon attack rolls it makes during that turn, but attack rolls against it have advantage until the start of its next turn.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Greataxe",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 17 (2d12 + 4) slashing damage.",
        attack_bonus: 6,
        damage_dice: "2d12",
        damage_bonus: 4
      },
      {
        name: "Gore",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "2d8",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Minotaur Skeleton",
    size: "Large",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "lawful evil",
    ac: 12,
    hp: 67,
    hit_dice: "9d10",
    speed: "40 ft.",
    stats: [18, 11, 15, 6, 8, 5],
    damage_vulnerabilities: "bludgeoning",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "exhaustion, poisoned",
    senses: "darkvision 60 ft., passive Perception 9",
    languages: "understands Abyssal but can't speak",
    cr: "2",
    traits: [
      {
        name: "Charge",
        desc: "If the skeleton moves at least 10 feet straight toward a target and then hits it with a gore attack on the same turn, the target takes an extra 9 (2d8) piercing damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be pushed up to 10 feet away and knocked prone.",
        attack_bonus: 0,
        damage_dice: "2d8"
      }
    ],
    actions: [
      {
        name: "Greataxe",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 17 (2d12 + 4) slashing damage.",
        attack_bonus: 6,
        damage_dice: "2d12",
        damage_bonus: 4
      },
      {
        name: "Gore",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "2d8",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Mule",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 11,
    hit_dice: "2d8",
    speed: "40 ft.",
    stats: [14, 10, 13, 2, 10, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "1/8",
    traits: [
      {
        name: "Beast of Burden",
        desc: "The mule is considered to be a Large animal for the purpose of determining its carrying capacity.",
        attack_bonus: 0
      },
      {
        name: "Sure-Footed",
        desc: "The mule has advantage on Strength and Dexterity saving throws made against effects that would knock it prone.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) bludgeoning damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Mummy",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "lawful evil",
    ac: 11,
    hp: 58,
    hit_dice: "9d8",
    speed: "20 ft.",
    stats: [16, 8, 15, 6, 10, 12],
    saves: [
      {
        wisdom: 2
      }
    ],
    damage_vulnerabilities: "fire",
    damage_resistances: "",
    damage_immunities: "bludgeoning, piercing, and slashing from nonmagical weapons",
    condition_immunities: "necrotic, poisoned",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "the languages it knew in life",
    cr: "3",
    actions: [
      {
        name: "Multiattack",
        desc: "The mummy can use its Dreadful Glare and makes one attack with its rotting fist.",
        attack_bonus: 0
      },
      {
        name: "Rotting Fist",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage plus 10 (3d6) necrotic damage. If the target is a creature, it must succeed on a DC 12 Constitution saving throw or be cursed with mummy rot. The cursed target can't regain hit points, and its hit point maximum decreases by 10 (3d6) for every 24 hours that elapse. If the curse reduces the target's hit point maximum to 0, the target dies, and its body turns to dust. The curse lasts until removed by the remove curse spell or other magic.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      },
      {
        name: "Dreadful Glare",
        desc: "The mummy targets one creature it can see within 60 ft. of it. If the target can see the mummy, it must succeed on a DC 11 Wisdom saving throw against this magic or become frightened until the end of the mummy's next turn. If the target fails the saving throw by 5 or more, it is also paralyzed for the same duration. A target that succeeds on the saving throw is immune to the Dreadful Glare of all mummies (but not mummy lords) for the next 24 hours.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Mummy Lord",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "lawful evil",
    ac: 17,
    hp: 97,
    hit_dice: "13d8",
    speed: "20 ft.",
    stats: [18, 10, 17, 11, 18, 16],
    saves: [
      {
        constitution: 8
      },
      {
        intelligence: 5
      },
      {
        wisdom: 9
      },
      {
        charisma: 8
      }
    ],
    skillsaves: [
      {
        history: 5
      },
      {
        religion: 5
      }
    ],
    damage_vulnerabilities: "bludgeoning",
    damage_resistances: "",
    damage_immunities: "necrotic, poison; bludgeoning, piercing, and slashing from nonmagical weapons",
    condition_immunities: "charmed, exhaustion, frightened, paralyzed, poisoned",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "the languages it knew in life",
    cr: "15",
    traits: [
      {
        name: "Magic Resistance",
        desc: "The mummy lord has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Rejuvenation",
        desc: "A destroyed mummy lord gains a new body in 24 hours if its heart is intact, regaining all its hit points and becoming active again. The new body appears within 5 feet of the mummy lord's heart.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The mummy can use its Dreadful Glare and makes one attack with its rotting fist.",
        attack_bonus: 0
      },
      {
        name: "Rotting Fist",
        desc: "Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 14 (3d6 + 4) bludgeoning damage plus 21 (6d6) necrotic damage. If the target is a creature, it must succeed on a DC 16 Constitution saving throw or be cursed with mummy rot. The cursed target can't regain hit points, and its hit point maximum decreases by 10 (3d6) for every 24 hours that elapse. If the curse reduces the target's hit point maximum to 0, the target dies, and its body turns to dust. The curse lasts until removed by the remove curse spell or other magic.",
        attack_bonus: 9,
        damage_dice: "3d6 + 6d6",
        damage_bonus: 4
      },
      {
        name: "Dreadful Glare",
        desc: "The mummy lord targets one creature it can see within 60 feet of it. If the target can see the mummy lord, it must succeed on a DC 16 Wisdom saving throw against this magic or become frightened until the end of the mummy's next turn. If the target fails the saving throw by 5 or more, it is also paralyzed for the same duration. A target that succeeds on the saving throw is immune to the Dreadful Glare of all mummies and mummy lords for the next 24 hours.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Attack",
        desc: "The mummy lord makes one attack with its rotting fist or uses its Dreadful Glare.",
        attack_bonus: 0
      },
      {
        name: "Blinding Dust",
        desc: "Blinding dust and sand swirls magically around the mummy lord. Each creature within 5 feet of the mummy lord must succeed on a DC 16 Constitution saving throw or be blinded until the end of the creature's next turn.",
        attack_bonus: 0
      },
      {
        name: "Blasphemous Word (Costs 2 Actions)",
        desc: "The mummy lord utters a blasphemous word. Each non-undead creature within 10 feet of the mummy lord that can hear the magical utterance must succeed on a DC 16 Constitution saving throw or be stunned until the end of the mummy lord's next turn.",
        attack_bonus: 0
      },
      {
        name: "Channel Negative Energy (Costs 2 Actions)",
        desc: "The mummy lord magically unleashes negative energy. Creatures within 60 feet of the mummy lord, including ones behind barriers and around corners, can't regain hit points until the end of the mummy lord's next turn.",
        attack_bonus: 0
      },
      {
        name: "Whirlwind of Sand (Costs 2 Actions)",
        desc: "The mummy lord magically transforms into a whirlwind of sand, moves up to 60 feet, and reverts to its normal form. While in whirlwind form, the mummy lord is immune to all damage, and it can't be grappled, petrified, knocked prone, restrained, or stunned. Equipment worn or carried by the mummy lord remain in its possession.",
        attack_bonus: 0
      }
    ],
    spells: [
      "The mummy lord is a 10th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 17, +9 to hit with spell attacks). The mummy lord has the following cleric spells prepared:",
      {
        "Cantrips (at will)": "sacred flame, thaumaturgy"
      },
      {
        "1st level (4 slots)": "command, guiding bolt, shield of faith"
      },
      {
        "2nd level (3 slots)": "hold person, silence, spiritual weapon"
      },
      {
        "3rd level (3 slots)": "animate dead, dispel magic"
      },
      {
        "4th level (3 slots)": "divination, guardian of faith"
      },
      {
        "5th level (2 slots)": "contagion, insect plague"
      },
      {
        "6th level (1 slot)": "harm"
      }
    ]
  },
  {
    name: "Nalfeshnee",
    size: "Large",
    source: "SRD",
    type: "fiend",
    subtype: "demon",
    alignment: "chaotic evil",
    ac: 18,
    hp: 184,
    hit_dice: "16d10",
    speed: "20 ft., fly 30 ft.",
    stats: [21, 10, 22, 19, 12, 15],
    saves: [
      {
        constitution: 11
      },
      {
        intelligence: 9
      },
      {
        wisdom: 6
      },
      {
        charisma: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "truesight 120 ft., passive Perception 11",
    languages: "Abyssal, telepathy 120 ft.",
    cr: "13",
    traits: [
      {
        name: "Magic Resistance",
        desc: "The nalfeshnee has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The nalfeshnee uses Horror Nimbus if it can.  It then makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 32 (5d10 + 5) piercing damage.",
        attack_bonus: 10,
        damage_dice: "5d10",
        damage_bonus: 5
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 15 (3d6 + 5) slashing damage.",
        attack_bonus: 10,
        damage_dice: "3d6",
        damage_bonus: 5
      },
      {
        name: "Horror Nimbus (Recharge 5-6)",
        desc: "The nalfeshnee magically emits scintillating, multicolored light. Each creature within 15 feet of the nalfeshnee that can see the light must succeed on a DC 15 Wisdom saving throw or be frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the nalfeshnee's Horror Nimbus for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Teleport",
        desc: "The nalfeshnee magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",
        attack_bonus: 0
      },
      {
        name: "Variant: Summon Demon (1/Day)",
        desc: "The demon chooses what to summon and attempts a magical summoning.\nA nalfeshnee has a 50 percent chance of summoning 1d4 vrocks, 1d3 hezrous, 1d2 glabrezus, or one nalfeshnee.\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Night Hag",
    size: "Medium",
    source: "SRD",
    type: "fiend",
    subtype: "",
    alignment: "neutral evil",
    ac: 17,
    hp: 112,
    hit_dice: "15d8",
    speed: "30 ft.",
    stats: [18, 15, 16, 16, 14, 16],
    skillsaves: [
      {
        deception: 7
      },
      {
        insight: 6
      },
      {
        perception: 6
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold, fire; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    damage_immunities: "",
    condition_immunities: "charmed",
    senses: "darkvision 120 ft., passive Perception 16",
    languages: "Abyssal, Common, Infernal, Primordial",
    cr: "5",
    traits: [
      {
        name: "Innate Spellcasting",
        desc: "The hag's innate spellcasting ability is Charisma (spell save DC 14, +6 to hit with spell attacks). She can innately cast the following spells, requiring no material components:\n\nAt will: detect magic, magic missile\n2/day each: plane shift (self only), ray of enfeeblement, sleep",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The hag has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Night Hag Items",
        desc: "A night hag carries two very rare magic items that she must craft for herself If either object is lost, the night hag will go to great lengths to retrieve it, as creating a new tool takes time and effort.\nHeartstone: This lustrous black gem allows a night hag to become ethereal while it is in her possession. The touch of a heartstone also cures any disease. Crafting a heartstone takes 30 days.\nSoul Bag: When an evil humanoid dies as a result of a night hag's Nightmare Haunting, the hag catches the soul in this black sack made of stitched flesh. A soul bag can hold only one evil soul at a time, and only the night hag who crafted the bag can catch a soul with it. Crafting a soul bag takes 7 days and a humanoid sacrifice (whose flesh is used to make the bag).",
        attack_bonus: 0
      },
      {
        name: "Hag Coven",
        desc: "When hags must work together, they form covens, in spite of their selfish natures. A coven is made up of hags of any type, all of whom are equals within the group. However, each of the hags continues to desire more personal power.\nA coven consists of three hags so that any arguments between two hags can be settled by the third. If more than three hags ever come together, as might happen if two covens come into conflict, the result is usually chaos.",
        attack_bonus: 0
      },
      {
        name: "Shared Spellcasting (Coven Only)",
        desc: "While all three members of a hag coven are within 30 feet of one another, they can each cast the following spells from the wizard's spell list but must share the spell slots among themselves:\n\n\u2022 1st level (4 slots): identify, ray of sickness\n\u2022 2nd level (3 slots): hold person, locate object\n\u2022 3rd level (3 slots): bestow curse, counterspell, lightning bolt\n\u2022 4th level (3 slots): phantasmal killer, polymorph\n\u2022 5th level (2 slots): contact other plane, scrying\n\u2022 6th level (1 slot): eye bite\n\nFor casting these spells, each hag is a 12th-level spellcaster that uses Intelligence as her spellcasting ability. The spell save DC is 12+the hag's Intelligence modifier, and the spell attack bonus is 4+the hag's Intelligence modifier.",
        attack_bonus: 0
      },
      {
        name: "Hag Eye (Coven Only)",
        desc: "A hag coven can craft a magic item called a hag eye, which is made from a real eye coated in varnish and often fitted to a pendant or other wearable item. The hag eye is usually entrusted to a minion for safekeeping and transport. A hag in the coven can take an action to see what the hag eye sees if the hag eye is on the same plane of existence. A hag eye has AC 10, 1 hit point, and darkvision with a radius of 60 feet. If it is destroyed, each coven member takes 3d10 psychic damage and is blinded for 24 hours.\nA hag coven can have only one hag eye at a time, and creating a new one requires all three members of the coven to perform a ritual. The ritual takes 1 hour, and the hags can't perform it while blinded. During the ritual, if the hags take any action other than performing the ritual, they must start over.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claws (Hag Form Only)",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d8",
        damage_bonus: 4
      },
      {
        name: "Change Shape",
        desc: "The hag magically polymorphs into a Small or Medium female humanoid, or back into her true form. Her statistics are the same in each form. Any equipment she is wearing or carrying isn't transformed. She reverts to her true form if she dies.",
        attack_bonus: 0
      },
      {
        name: "Etherealness",
        desc: "The hag magically enters the Ethereal Plane from the Material Plane, or vice versa. To do so, the hag must have a heartstone in her possession.",
        attack_bonus: 0
      },
      {
        name: "Nightmare Haunting (1/Day)",
        desc: "While on the Ethereal Plane, the hag magically touches a sleeping humanoid on the Material Plane. A protection from evil and good spell cast on the target prevents this contact, as does a magic circle. As long as the contact persists, the target has dreadful visions. If these visions last for at least 1 hour, the target gains no benefit from its rest, and its hit point maximum is reduced by 5 (1d10). If this effect reduces the target's hit point maximum to 0, the target dies, and if the target was evil, its soul is trapped in the hag's soul bag. The reduction to the target's hit point maximum lasts until removed by the greater restoration spell or similar magic.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Nightmare",
    size: "Large",
    source: "SRD",
    type: "fiend",
    subtype: "",
    alignment: "neutral evil",
    ac: 13,
    hp: 68,
    hit_dice: "8d10",
    speed: "60 ft., fly 90 ft.",
    stats: [18, 15, 16, 10, 13, 15],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "passive Perception 11",
    languages: "understands Abyssal, Common, and Infernal but can't speak",
    cr: "3",
    traits: [
      {
        name: "Confer Fire Resistance",
        desc: "The nightmare can grant resistance to fire damage to anyone riding it.",
        attack_bonus: 0
      },
      {
        name: "Illumination",
        desc: "The nightmare sheds bright light in a 10-foot radius and dim light for an additional 10 feet.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage plus 7 (2d6) fire damage.",
        attack_bonus: 6,
        damage_dice: "2d8 + 2d6",
        damage_bonus: 4
      },
      {
        name: "Ethereal Stride",
        desc: "The nightmare and up to three willing creatures within 5 feet of it magically enter the Ethereal Plane from the Material Plane, or vice versa.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Noble",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 15,
    hp: 9,
    hit_dice: "2d8",
    speed: "30 ft.",
    stats: [11, 12, 11, 12, 14, 16],
    skillsaves: [
      {
        deception: 5
      },
      {
        insight: 4
      },
      {
        persuasion: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 12",
    languages: "any two languages",
    cr: "1/8",
    actions: [
      {
        name: "Rapier",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d8",
        damage_bonus: 1
      }
    ],
    reactions: [
      {
        name: "Parry",
        desc: "The noble adds 2 to its AC against one melee attack that would hit it. To do so, the noble must see the attacker and be wielding a melee weapon.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ochre Jelly",
    size: "Large",
    source: "SRD",
    type: "ooze",
    subtype: "",
    alignment: "unaligned",
    ac: 8,
    hp: 45,
    hit_dice: "6d10",
    speed: "10 ft., climb 10 ft.",
    stats: [15, 6, 14, 2, 6, 1],
    damage_vulnerabilities: "",
    damage_resistances: "acid",
    damage_immunities: "lightning, slashing",
    condition_immunities: "blinded, charmed, deafened, exhaustion, frightened, prone",
    senses: "blindsight 60 ft. (blind beyond this radius), passive Perception 8",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Amorphous",
        desc: "The jelly can move through a space as narrow as 1 inch wide without squeezing.",
        attack_bonus: 0
      },
      {
        name: "Spider Climb",
        desc: "The jelly can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Pseudopod",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) bludgeoning damage plus 3 (1d6) acid damage.",
        attack_bonus: 4,
        damage_dice: "2d6",
        damage_bonus: 2
      }
    ],
    reactions: [
      {
        name: "Split",
        desc: "When a jelly that is Medium or larger is subjected to lightning or slashing damage, it splits into two new jellies if it has at least 10 hit points. Each new jelly has hit points equal to half the original jelly's, rounded down. New jellies are one size smaller than the original jelly.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Octopus",
    size: "Small",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 3,
    hit_dice: "1d6",
    speed: "5 ft., swim 30 ft.",
    stats: [4, 15, 11, 3, 10, 4],
    skillsaves: [
      {
        perception: 2
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 12",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Hold Breath",
        desc: "While out of water, the octopus can hold its breath for 30 minutes.",
        attack_bonus: 0
      },
      {
        name: "Underwater Camouflage",
        desc: "The octopus has advantage on Dexterity (Stealth) checks made while underwater.",
        attack_bonus: 0
      },
      {
        name: "Water Breathing",
        desc: "The octopus can breathe only underwater.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Tentacles",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 1 bludgeoning damage, and the target is grappled (escape DC 10). Until this grapple ends, the octopus can't use its tentacles on another target.",
        attack_bonus: 4,
        damage_bonus: 1
      },
      {
        name: "Ink Cloud (Recharges after a Short or Long Rest)",
        desc: "A 5-foot-radius cloud of ink extends all around the octopus if it is underwater. The area is heavily obscured for 1 minute, although a significant current can disperse the ink. After releasing the ink, the octopus can use the Dash action as a bonus action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Ogre",
    size: "Large",
    source: "SRD",
    type: "giant",
    subtype: "",
    alignment: "chaotic evil",
    ac: 11,
    hp: 59,
    hit_dice: "7d10",
    speed: "40 ft.",
    stats: [19, 8, 16, 5, 7, 7],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 8",
    languages: "Common, Giant",
    cr: "2",
    actions: [
      {
        name: "Greatclub",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "2d8",
        damage_bonus: 4
      },
      {
        name: "Javelin",
        desc: "Melee or Ranged Weapon Attack: +6 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 11 (2d6 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Ogre Zombie",
    size: "Large",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "neutral evil",
    ac: 8,
    hp: 85,
    hit_dice: "9d10",
    speed: "30 ft.",
    stats: [19, 6, 18, 3, 6, 5],
    saves: [
      {
        wisdom: 0
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 8",
    languages: "understands Common and Giant but can't speak",
    cr: "2",
    traits: [
      {
        name: "Undead Fortitude",
        desc: "If damage reduces the zombie to 0 hit points, it must make a Constitution saving throw with a DC of 5+the damage taken, unless the damage is radiant or from a critical hit. On a success, the zombie drops to 1 hit point instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Morningstar",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "2d8",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Oni",
    size: "Large",
    source: "SRD",
    type: "giant",
    subtype: "",
    alignment: "lawful evil",
    ac: 16,
    hp: 110,
    hit_dice: "13d10",
    speed: "30 ft., fly 30 ft.",
    stats: [19, 11, 16, 14, 12, 15],
    saves: [
      {
        dexterity: 3
      },
      {
        constitution: 6
      },
      {
        wisdom: 4
      },
      {
        charisma: 5
      }
    ],
    skillsaves: [
      {
        arcana: 5
      },
      {
        deception: 8
      },
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "Common, Giant",
    cr: "7",
    traits: [
      {
        name: "Innate Spellcasting",
        desc: "The oni's innate spellcasting ability is Charisma (spell save DC 13). The oni can innately cast the following spells, requiring no material components:\n\nAt will: darkness, invisibility\n1/day each: charm person, cone of cold, gaseous form, sleep",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The oni's weapon attacks are magical.",
        attack_bonus: 0
      },
      {
        name: "Regeneration",
        desc: "The oni regains 10 hit points at the start of its turn if it has at least 1 hit point.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The oni makes two attacks, either with its claws or its glaive.",
        attack_bonus: 0
      },
      {
        name: "Claw (Oni Form Only)",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "1d8",
        damage_bonus: 4
      },
      {
        name: "Glaive",
        desc: "Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) slashing damage, or 9 (1d10 + 4) slashing damage in Small or Medium form.",
        attack_bonus: 7,
        damage_dice: "2d10",
        damage_bonus: 4
      },
      {
        name: "Change Shape",
        desc: "The oni magically polymorphs into a Small or Medium humanoid, into a Large giant, or back into its true form. Other than its size, its statistics are the same in each form. The only equipment that is transformed is its glaive, which shrinks so that it can be wielded in humanoid form. If the oni dies, it reverts to its true form, and its glaive reverts to its normal size.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Orc",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "orc",
    alignment: "chaotic evil",
    ac: 13,
    hp: 15,
    hit_dice: "2d8",
    speed: "30 ft.",
    stats: [16, 12, 16, 7, 11, 10],
    skillsaves: [
      {
        intimidation: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Common, Orc",
    cr: "1/2",
    traits: [
      {
        name: "Aggressive",
        desc: "As a bonus action, the orc can move up to its speed toward a hostile creature that it can see.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Greataxe",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 9 (1d12 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "1d12",
        damage_bonus: 3
      },
      {
        name: "Javelin",
        desc: "Melee or Ranged Weapon Attack: +5 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Otyugh",
    size: "Large",
    source: "SRD",
    type: "aberration",
    subtype: "",
    alignment: "neutral",
    ac: 14,
    hp: 114,
    hit_dice: "12d10",
    speed: "30 ft.",
    stats: [16, 11, 19, 6, 13, 6],
    saves: [
      {
        constitution: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 11",
    languages: "Otyugh",
    cr: "5",
    traits: [
      {
        name: "Limited Telepathy",
        desc: "The otyugh can magically transmit simple messages and images to any creature within 120 ft. of it that can understand a language. This form of telepathy doesn't allow the receiving creature to telepathically respond.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The otyugh makes three attacks: one with its bite and two with its tentacles.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 12 (2d8 + 3) piercing damage. If the target is a creature, it must succeed on a DC 15 Constitution saving throw against disease or become poisoned until the disease is cured. Every 24 hours that elapse, the target must repeat the saving throw, reducing its hit point maximum by 5 (1d10) on a failure. The disease is cured on a success. The target dies if the disease reduces its hit point maximum to 0. This reduction to the target's hit point maximum lasts until the disease is cured.",
        attack_bonus: 6,
        damage_dice: "2d8",
        damage_bonus: 3
      },
      {
        name: "Tentacle",
        desc: "Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 7 (1d8 + 3) bludgeoning damage plus 4 (1d8) piercing damage. If the target is Medium or smaller, it is grappled (escape DC 13) and restrained until the grapple ends. The otyugh has two tentacles, each of which can grapple one target.",
        attack_bonus: 6,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Tentacle Slam",
        desc: "The otyugh slams creatures grappled by it into each other or a solid surface. Each creature must succeed on a DC 14 Constitution saving throw or take 10 (2d6 + 3) bludgeoning damage and be stunned until the end of the otyugh's next turn. On a successful save, the target takes half the bludgeoning damage and isn't stunned.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Owl",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 1,
    hit_dice: "1d4",
    speed: "5 ft., fly 60 ft.",
    stats: [3, 13, 8, 2, 12, 7],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 13",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Flyby",
        desc: "The owl doesn't provoke opportunity attacks when it flies out of an enemy's reach.",
        attack_bonus: 0
      },
      {
        name: "Keen Hearing and Sight",
        desc: "The owl has advantage on Wisdom (Perception) checks that rely on hearing or sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Talons",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",
        attack_bonus: 3,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Owlbear",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 59,
    hit_dice: "7d10",
    speed: "40 ft.",
    stats: [20, 12, 17, 3, 12, 7],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 13",
    languages: "",
    cr: "3",
    traits: [
      {
        name: "Keen Sight and Smell",
        desc: "The owlbear has advantage on Wisdom (Perception) checks that rely on sight or smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The owlbear makes two attacks: one with its beak and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one creature. Hit: 10 (1d10 + 5) piercing damage.",
        attack_bonus: 7,
        damage_dice: "1d10",
        damage_bonus: 5
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d8",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Panther",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 13,
    hit_dice: "3d8",
    speed: "50 ft., climb 40 ft.",
    stats: [14, 15, 10, 3, 14, 7],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Keen Smell",
        desc: "The panther has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      },
      {
        name: "Pounce",
        desc: "If the panther moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 12 Strength saving throw or be knocked prone. If the target is prone, the panther can make one bite attack against it as a bonus action.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) slashing damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Pegasus",
    size: "Large",
    source: "SRD",
    type: "celestial",
    subtype: "",
    alignment: "chaotic good",
    ac: 12,
    hp: 59,
    hit_dice: "7d10",
    speed: "60 ft., fly 90 ft.",
    stats: [18, 15, 16, 10, 15, 13],
    saves: [
      {
        dexterity: 4
      },
      {
        wisdom: 4
      },
      {
        charisma: 3
      }
    ],
    skillsaves: [
      {
        perception: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 16",
    languages: "understands Celestial, Common, Elvish, and Sylvan but can't speak",
    cr: "2",
    actions: [
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Phase Spider",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 32,
    hit_dice: "5d10",
    speed: "30 ft., climb 30 ft.",
    stats: [15, 15, 12, 6, 10, 6],
    skillsaves: [
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "",
    cr: "3",
    traits: [
      {
        name: "Ethereal Jaunt",
        desc: "As a bonus action, the spider can magically shift from the Material Plane to the Ethereal Plane, or vice versa.",
        attack_bonus: 0
      },
      {
        name: "Spider Climb",
        desc: "The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      },
      {
        name: "Web Walker",
        desc: "The spider ignores movement restrictions caused by webbing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (1d10 + 2) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 18 (4d8) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",
        attack_bonus: 4,
        damage_dice: "1d10",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Pit Fiend",
    size: "Large",
    source: "SRD",
    type: "fiend",
    subtype: "devil",
    alignment: "lawful evil",
    ac: 19,
    hp: 300,
    hit_dice: "24d10",
    speed: "30 ft., fly 60 ft.",
    stats: [26, 14, 24, 22, 18, 24],
    saves: [
      {
        dexterity: 8
      },
      {
        constitution: 13
      },
      {
        wisdom: 10
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "truesight 120 ft., passive Perception 14",
    languages: "Infernal, telepathy 120 ft.",
    cr: "20",
    traits: [
      {
        name: "Fear Aura",
        desc: "Any creature hostile to the pit fiend that starts its turn within 20 feet of the pit fiend must make a DC 21 Wisdom saving throw, unless the pit fiend is incapacitated. On a failed save, the creature is frightened until the start of its next turn. If a creature's saving throw is successful, the creature is immune to the pit fiend's Fear Aura for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The pit fiend has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The pit fiend's weapon attacks are magical.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The pit fiend's spellcasting ability is Charisma (spell save DC 21). The pit fiend can innately cast the following spells, requiring no material components:\nAt will: detect magic, fireball\n3/day each: hold monster, wall of fire",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The pit fiend makes four attacks: one with its bite, one with its claw, one with its mace, and one with its tail.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +14 to hit, reach 5 ft., one target. Hit: 22 (4d6 + 8) piercing damage. The target must succeed on a DC 21 Constitution saving throw or become poisoned. While poisoned in this way, the target can't regain hit points, and it takes 21 (6d6) poison damage at the start of each of its turns. The poisoned target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 14,
        damage_dice: "4d6",
        damage_bonus: 8
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +14 to hit, reach 10 ft. , one target. Hit: 17 (2d8 + 8) slashing damage.",
        attack_bonus: 14,
        damage_dice: "2d8",
        damage_bonus: 8
      },
      {
        name: "Mace",
        desc: "Melee Weapon Attack: +14 to hit, reach 10ft., one target. Hit: 15 (2d6 + 8) bludgeoning damage plus 21 (6d6) fire damage.",
        attack_bonus: 14,
        damage_dice: "2d6",
        damage_bonus: 8
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +14 to hit, reach 10ft., one target. Hit: 24 (3d1O + 8) bludgeoning damage.",
        attack_bonus: 14,
        damage_dice: "3d10",
        damage_bonus: 8
      }
    ]
  },
  {
    name: "Planetar",
    size: "Large",
    source: "SRD",
    type: "celestial",
    subtype: "",
    alignment: "lawful good",
    ac: 19,
    hp: 200,
    hit_dice: "16d10",
    speed: "40 ft., fly 120 ft.",
    stats: [24, 20, 24, 19, 22, 25],
    saves: [
      {
        constitution: 12
      },
      {
        wisdom: 11
      },
      {
        charisma: 12
      }
    ],
    skillsaves: [
      {
        perception: 11
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "radiant; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "",
    condition_immunities: "charmed, exhaustion, frightened",
    senses: "truesight 120 ft., passive Perception 21",
    languages: "all, telepathy 120 ft.",
    cr: "16",
    traits: [
      {
        name: "Angelic Weapons",
        desc: "The planetar's weapon attacks are magical. When the planetar hits with any weapon, the weapon deals an extra 5d8 radiant damage (included in the attack).",
        attack_bonus: 0
      },
      {
        name: "Divine Awareness",
        desc: "The planetar knows if it hears a lie.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The planetar's spellcasting ability is Charisma (spell save DC 20). The planetar can innately cast the following spells, requiring no material components:\nAt will: detect evil and good, invisibility (self only)\n3/day each: blade barrier, dispel evil and good, flame strike, raise dead\n1/day each: commune, control weather, insect plague",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The planetar has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The planetar makes two melee attacks.",
        attack_bonus: 0
      },
      {
        name: "Greatsword",
        desc: "Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 21 (4d6 + 7) slashing damage plus 22 (5d8) radiant damage.",
        attack_bonus: 12,
        damage_dice: "4d6 + 5d8",
        damage_bonus: 7
      },
      {
        name: "Healing Touch (4/Day)",
        desc: "The planetar touches another creature. The target magically regains 30 (6d8 + 3) hit points and is freed from any curse, disease, poison, blindness, or deafness.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Plesiosaurus",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 68,
    hit_dice: "8d10",
    speed: "20 ft., swim 40 ft.",
    stats: [18, 15, 16, 2, 12, 5],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Hold Breath",
        desc: "The plesiosaurus can hold its breath for 1 hour.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 14 (3d6 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "3d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Poisonous Snake",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 2,
    hit_dice: "1d4",
    speed: "30 ft., swim 30 ft.",
    stats: [2, 16, 11, 1, 10, 3],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 10 ft., passive Perception 10",
    languages: "",
    cr: "1/8",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 1 piercing damage, and the target must make a DC 10 Constitution saving throw, taking 5 (2d4) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 5,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Polar Bear",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 42,
    hit_dice: "5d10",
    speed: "40 ft., swim 30 ft.",
    stats: [20, 10, 16, 2, 13, 7],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Keen Smell",
        desc: "The bear has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The bear makes two attacks: one with its bite and one with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 9 (1d8 + 5) piercing damage.",
        attack_bonus: 7,
        damage_dice: "1d8",
        damage_bonus: 5
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Pony",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 11,
    hit_dice: "2d8",
    speed: "40 ft.",
    stats: [15, 10, 13, 2, 11, 7],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "1/8",
    actions: [
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) bludgeoning damage.",
        attack_bonus: 4,
        damage_dice: "2d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Priest",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 13,
    hp: 27,
    hit_dice: "5d8",
    speed: "25 ft.",
    stats: [10, 10, 12, 13, 16, 13],
    skillsaves: [
      {
        medicine: 7
      },
      {
        persuasion: 3
      },
      {
        religion: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "any two languages",
    cr: "2",
    traits: [
      {
        name: "Divine Eminence",
        desc: "As a bonus action, the priest can expend a spell slot to cause its melee weapon attacks to magically deal an extra 10 (3d6) radiant damage to a target on a hit. This benefit lasts until the end of the turn. If the priest expends a spell slot of 2nd level or higher, the extra damage increases by 1d6 for each level above 1st.",
        attack_bonus: 0,
        damage_dice: "3d6"
      }
    ],
    actions: [
      {
        name: "Mace",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 3 (1d6) bludgeoning damage.",
        attack_bonus: 2,
        damage_dice: "1d6"
      }
    ],
    spells: [
      "The priest is a 5th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 13, +5 to hit with spell attacks). The priest has the following cleric spells prepared:",
      {
        "Cantrips (at will)": "light, sacred flame, thaumaturgy"
      },
      {
        "1st level (4 slots)": "cure wounds, guiding bolt, sanctuary"
      },
      {
        "2nd level (3 slots)": "lesser restoration, spiritual weapon"
      },
      {
        "3rd level (2 slots)": "dispel magic, spirit guardians"
      }
    ]
  },
  {
    name: "Pseudodragon",
    size: "Tiny",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "neutral good",
    ac: 13,
    hp: 7,
    hit_dice: "2d4",
    speed: "15 ft., fly 60 ft.",
    stats: [6, 15, 13, 10, 12, 10],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 13",
    languages: "understands Common and Draconic but can't speak",
    cr: "1/4",
    traits: [
      {
        name: "Keen Senses",
        desc: "The pseudodragon has advantage on Wisdom (Perception) checks that rely on sight, hearing, or smell.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The pseudodragon has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Limited Telepathy",
        desc: "The pseudodragon can magically communicate simple ideas, emotions, and images telepathically with any creature within 100 ft. of it that can understand a language.",
        attack_bonus: 0
      },
      {
        name: "Variant: Familiar",
        desc: "The pseudodragon can serve another creature as a familiar, forming a magic, telepathic bond with that willing companion. While the two are bonded, the companion can sense what the pseudodragon senses as long as they are within 1 mile of each other. While the pseudodragon is within 10 feet of its companion, the companion shares the pseudodragon's Magic Resistance trait. At any time and for any reason, the pseudodragon can end its service as a familiar, ending the telepathic bond.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      },
      {
        name: "Sting",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage, and the target must succeed on a DC 11 Constitution saving throw or become poisoned for 1 hour. If the saving throw fails by 5 or more, the target falls unconscious for the same duration, or until it takes damage or another creature uses an action to shake it awake.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Purple Worm",
    size: "Gargantuan",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 18,
    hp: 247,
    hit_dice: "15d20",
    speed: "50 ft., burrow 30 ft.",
    stats: [28, 7, 22, 1, 8, 4],
    saves: [
      {
        constitution: 11
      },
      {
        wisdom: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 30 ft., tremorsense 60 ft., passive Perception 9",
    languages: "",
    cr: "15",
    traits: [
      {
        name: "Tunneler",
        desc: "The worm can burrow through solid rock at half its burrow speed and leaves a 10-foot-diameter tunnel in its wake.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The worm makes two attacks: one with its bite and one with its stinger.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 22 (3d8 + 9) piercing damage. If the target is a Large or smaller creature, it must succeed on a DC 19 Dexterity saving throw or be swallowed by the worm. A swallowed creature is blinded and restrained, it has total cover against attacks and other effects outside the worm, and it takes 21 (6d6) acid damage at the start of each of the worm's turns.\nIf the worm takes 30 damage or more on a single turn from a creature inside it, the worm must succeed on a DC 21 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet of the worm. If the worm dies, a swallowed creature is no longer restrained by it and can escape from the corpse by using 20 feet of movement, exiting prone.",
        attack_bonus: 9,
        damage_dice: "3d8",
        damage_bonus: 9
      },
      {
        name: "Tail Stinger",
        desc: "Melee Weapon Attack: +9 to hit, reach 10 ft., one creature. Hit: 19 (3d6 + 9) piercing damage, and the target must make a DC 19 Constitution saving throw, taking 42 (12d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 9,
        damage_dice: "3d6",
        damage_bonus: 9
      }
    ]
  },
  {
    name: "Quasit",
    size: "Tiny",
    source: "SRD",
    type: "fiend",
    subtype: "demon",
    alignment: "chaotic evil",
    ac: 13,
    hp: 7,
    hit_dice: "3d4",
    speed: "40 ft.",
    stats: [5, 17, 10, 7, 10, 10],
    skillsaves: [
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold; fire; lightning; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "darkvision 120 ft., passive Perception 10",
    languages: "Abyssal, Common",
    cr: "1",
    traits: [
      {
        name: "Shapechanger",
        desc: "The quasit can use its action to polymorph into a beast form that resembles a bat (speed 10 ft. fly 40 ft.), a centipede (40 ft., climb 40 ft.), or a toad (40 ft., swim 40 ft.), or back into its true form . Its statistics are the same in each form, except for the speed changes noted. Any equipment it is wearing or carrying isn't transformed . It reverts to its true form if it dies.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The quasit has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Variant: Familiar",
        desc: "The quasit can serve another creature as a familiar, forming a telepathic bond with its willing master. While the two are bonded, the master can sense what the quasit senses as long as they are within 1 mile of each other. While the quasit is within 10 feet of its master, the master shares the quasit's Magic Resistance trait. At any time and for any reason, the quasit can end its service as a familiar, ending the telepathic bond.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claw (Bite in Beast Form)",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft ., one target. Hit: 5 (1d4 + 3) piercing damage, and the target must succeed on a DC 10 Constitution saving throw or take 5 (2d4) poison damage and become poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 3
      },
      {
        name: "Scare (1/day)",
        desc: "One creature of the quasit's choice within 20 ft. of it must succeed on a DC 10 Wisdom saving throw or be frightened for 1 minute. The target can repeat the saving throw at the end of each of its turns, with disadvantage if the quasit is within line of sight, ending the effect on itself on a success.",
        attack_bonus: 0
      },
      {
        name: "Invisibility",
        desc: "The quasit magically turns invisible until it attacks or uses Scare, or until its concentration ends (as if concentrating on a spell). Any equipment the quasit wears or carries is invisible with it.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Quipper",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 1,
    hit_dice: "1d4",
    speed: "swim 40 ft.",
    stats: [2, 16, 9, 1, 7, 2],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 8",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Blood Frenzy",
        desc: "The quipper has advantage on melee attack rolls against any creature that doesn't have all its hit points.",
        attack_bonus: 0
      },
      {
        name: "Water Breathing",
        desc: "The quipper can breathe only underwater.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",
        attack_bonus: 5,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Rakshasa",
    size: "Medium",
    source: "SRD",
    type: "fiend",
    subtype: "",
    alignment: "lawful evil",
    ac: 16,
    hp: 110,
    hit_dice: "13d8",
    speed: "40 ft.",
    stats: [14, 17, 18, 13, 16, 20],
    skillsaves: [
      {
        deception: 10
      },
      {
        insight: 8
      }
    ],
    damage_vulnerabilities: "piercing from magic weapons wielded by good creatures",
    damage_resistances: "",
    damage_immunities: "bludgeoning, piercing, and slashing from nonmagical weapons",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 13",
    languages: "Common, Infernal",
    cr: "13",
    traits: [
      {
        name: "Limited Magic Immunity",
        desc: "The rakshasa can't be affected or detected by spells of 6th level or lower unless it wishes to be. It has advantage on saving throws against all other spells and magical effects.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The rakshasa's innate spellcasting ability is Charisma (spell save DC 18, +10 to hit with spell attacks). The rakshasa can innately cast the following spells, requiring no material components:\n\nAt will: detect thoughts, disguise self, mage hand, minor illusion\n3/day each: charm person, detect magic, invisibility, major image, suggestion\n1/day each: dominate person, fly, plane shift, true seeing",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The rakshasa makes two claw attacks",
        attack_bonus: 0
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) slashing damage, and the target is cursed if it is a creature. The magical curse takes effect whenever the target takes a short or long rest, filling the target's thoughts with horrible images and dreams. The cursed target gains no benefit from finishing a short or long rest. The curse lasts until it is lifted by a remove curse spell or similar magic.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Rat",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 1,
    hit_dice: "1d4",
    speed: "20 ft.",
    stats: [2, 11, 9, 2, 10, 4],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 10",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Keen Smell",
        desc: "The rat has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",
        attack_bonus: 0,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Raven",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 1,
    hit_dice: "1d4",
    speed: "10 ft., fly 50 ft.",
    stats: [2, 14, 8, 2, 12, 6],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Mimicry",
        desc: "The raven can mimic simple sounds it has heard, such as a person whispering, a baby crying, or an animal chittering. A creature that hears the sounds can tell they are imitations with a successful DC 10 Wisdom (Insight) check.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Red Dragon Wyrmling",
    size: "Medium",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 17,
    hp: 75,
    hit_dice: "10d8",
    speed: "30 ft., climb 30 ft., fly 60 ft.",
    stats: [19, 10, 17, 12, 11, 15],
    saves: [
      {
        dexterity: 2
      },
      {
        constitution: 5
      },
      {
        wisdom: 2
      },
      {
        charisma: 4
      }
    ],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 14",
    languages: "Draconic",
    cr: "4",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (1d10 + 4) piercing damage plus 3 (1d6) fire damage.",
        attack_bonus: 6,
        damage_dice: "1d10 + 1d6",
        damage_bonus: 4
      },
      {
        name: "Fire Breath (Recharge 5-6)",
        desc: "The dragon exhales fire in a 15-foot cone. Each creature in that area must make a DC 13 Dexterity saving throw, taking 24 (7d6) fire damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "7d6"
      }
    ]
  },
  {
    name: "Reef Shark",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 22,
    hit_dice: "4d8",
    speed: "swim 40 ft.",
    stats: [14, 13, 13, 1, 10, 4],
    skillsaves: [
      {
        perception: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 30 ft., passive Perception 12",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Pack Tactics",
        desc: "The shark has advantage on an attack roll against a creature if at least one of the shark's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      },
      {
        name: "Water Breathing",
        desc: "The shark can breathe only underwater.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Remorhaz",
    size: "Huge",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 17,
    hp: 195,
    hit_dice: "17d12",
    speed: "30 ft., burrow 20 ft.",
    stats: [24, 13, 21, 4, 10, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold, fire",
    condition_immunities: "",
    senses: "darkvision 60 ft., tremorsense 60 ft., passive Perception 10",
    languages: "",
    cr: "11",
    traits: [
      {
        name: "Heated Body",
        desc: "A creature that touches the remorhaz or hits it with a melee attack while within 5 feet of it takes 10 (3d6) fire damage.",
        attack_bonus: 0,
        damage_dice: "3d6"
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 40 (6d10 + 7) piercing damage plus 10 (3d6) fire damage. If the target is a creature, it is grappled (escape DC 17). Until this grapple ends, the target is restrained, and the remorhaz can't bite another target.",
        attack_bonus: 11,
        damage_dice: "6d10 + 3d6",
        damage_bonus: 7
      },
      {
        name: "Swallow",
        desc: "The remorhaz makes one bite attack against a Medium or smaller creature it is grappling. If the attack hits, that creature takes the bite's damage and is swallowed, and the grapple ends. While swallowed, the creature is blinded and restrained, it has total cover against attacks and other effects outside the remorhaz, and it takes 21 (6d6) acid damage at the start of each of the remorhaz's turns.\nIf the remorhaz takes 30 damage or more on a single turn from a creature inside it, the remorhaz must succeed on a DC 15 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet oft he remorhaz. If the remorhaz dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 15 feet of movement, exiting prone.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Rhinoceros",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 45,
    hit_dice: "6d10",
    speed: "40 ft.",
    stats: [21, 8, 15, 2, 12, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 11",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Charge",
        desc: "If the rhinoceros moves at least 20 ft. straight toward a target and then hits it with a gore attack on the same turn, the target takes an extra 9 (2d8) bludgeoning damage. If the target is a creature, it must succeed on a DC 15 Strength saving throw or be knocked prone.",
        attack_bonus: 0,
        damage_dice: "2d8"
      }
    ],
    actions: [
      {
        name: "Gore",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) bludgeoning damage.",
        attack_bonus: 7,
        damage_dice: "2d8",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Riding Horse",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 13,
    hit_dice: "2d10",
    speed: "60 ft.",
    stats: [16, 10, 12, 2, 11, 7],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "1/4",
    actions: [
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (2d4 + 3) bludgeoning damage.",
        attack_bonus: 5,
        damage_dice: "2d4",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Roc",
    size: "Gargantuan",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 15,
    hp: 248,
    hit_dice: "16d20",
    speed: "20 ft., fly 120 ft.",
    stats: [28, 10, 20, 3, 10, 9],
    saves: [
      {
        dexterity: 4
      },
      {
        constitution: 9
      },
      {
        wisdom: 4
      },
      {
        charisma: 3
      }
    ],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "",
    cr: "11",
    traits: [
      {
        name: "Keen Sight",
        desc: "The roc has advantage on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The roc makes two attacks: one with its beak and one with its talons.",
        attack_bonus: 0
      },
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 27 (4d8 + 9) piercing damage.",
        attack_bonus: 13,
        damage_dice: "4d8",
        damage_bonus: 9
      },
      {
        name: "Talons",
        desc: "Melee Weapon Attack: +13 to hit, reach 5 ft., one target. Hit: 23 (4d6 + 9) slashing damage, and the target is grappled (escape DC 19). Until this grapple ends, the target is restrained, and the roc can't use its talons on another target.",
        attack_bonus: 13,
        damage_dice: "4d6",
        damage_bonus: 9
      }
    ]
  },
  {
    name: "Roper",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "neutral evil",
    ac: 20,
    hp: 93,
    hit_dice: "11d10",
    speed: "10 ft., climb 10 ft.",
    stats: [18, 8, 17, 7, 16, 6],
    skillsaves: [
      {
        perception: 6
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 16",
    languages: "",
    cr: "5",
    traits: [
      {
        name: "False Appearance",
        desc: "While the roper remains motionless, it is indistinguishable from a normal cave formation, such as a stalagmite.",
        attack_bonus: 0
      },
      {
        name: "Grasping Tendrils",
        desc: "The roper can have up to six tendrils at a time. Each tendril can be attacked (AC 20; 10 hit points; immunity to poison and psychic damage). Destroying a tendril deals no damage to the roper, which can extrude a replacement tendril on its next turn. A tendril can also be broken if a creature takes an action and succeeds on a DC 15 Strength check against it.",
        attack_bonus: 0
      },
      {
        name: "Spider Climb",
        desc: "The roper can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The roper makes four attacks with its tendrils, uses Reel, and makes one attack with its bite.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 22 (4d8 + 4) piercing damage.",
        attack_bonus: 7,
        damage_dice: "4d8",
        damage_bonus: 4
      },
      {
        name: "Tendril",
        desc: "Melee Weapon Attack: +7 to hit, reach 50 ft., one creature. Hit: The target is grappled (escape DC 15). Until the grapple ends, the target is restrained and has disadvantage on Strength checks and Strength saving throws, and the roper can't use the same tendril on another target.",
        attack_bonus: 7
      },
      {
        name: "Reel",
        desc: "The roper pulls each creature grappled by it up to 25 ft. straight toward it.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Rug of Smothering",
    size: "Large",
    source: "SRD",
    type: "construct",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 33,
    hit_dice: "6d10",
    speed: "10 ft.",
    stats: [17, 14, 10, 1, 3, 1],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison, psychic",
    condition_immunities: "blinded, charmed, deafened, frightened, paralyzed, petrified, poisoned",
    senses: "blindsight 60 ft. (blind beyond this radius), passive Perception 6",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Antimagic Susceptibility",
        desc: "The rug is incapacitated while in the area of an antimagic field. If targeted by dispel magic, the rug must succeed on a Constitution saving throw against the caster's spell save DC or fall unconscious for 1 minute.",
        attack_bonus: 0
      },
      {
        name: "Damage Transfer",
        desc: "While it is grappling a creature, the rug takes only half the damage dealt to it, and the creature grappled by the rug takes the other half.",
        attack_bonus: 0
      },
      {
        name: "False Appearance",
        desc: "While the rug remains motionless, it is indistinguishable from a normal rug.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Smother",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one Medium or smaller creature. Hit: The creature is grappled (escape DC 13). Until this grapple ends, the target is restrained, blinded, and at risk of suffocating, and the rug can't smother another target. In addition, at the start of each of the target's turns, the target takes 10 (2d6 + 3) bludgeoning damage.",
        attack_bonus: 0,
        damage_dice: "2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Rust Monster",
    size: "Medium",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "unaligned",
    ac: 14,
    hp: 27,
    hit_dice: "5d8",
    speed: "40 ft.",
    stats: [13, 12, 13, 2, 13, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 11",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Iron Scent",
        desc: "The rust monster can pinpoint, by scent, the location of ferrous metal within 30 feet of it.",
        attack_bonus: 0
      },
      {
        name: "Rust Metal",
        desc: "Any nonmagical weapon made of metal that hits the rust monster corrodes. After dealing damage, the weapon takes a permanent and cumulative -1 penalty to damage rolls. If its penalty drops to -5, the weapon is destroyed. Non magical ammunition made of metal that hits the rust monster is destroyed after dealing damage.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d8",
        damage_bonus: 1
      },
      {
        name: "Antennae",
        desc: "The rust monster corrodes a nonmagical ferrous metal object it can see within 5 feet of it. If the object isn't being worn or carried, the touch destroys a 1-foot cube of it. If the object is being worn or carried by a creature, the creature can make a DC 11 Dexterity saving throw to avoid the rust monster's touch.\nIf the object touched is either metal armor or a metal shield being worn or carried, its takes a permanent and cumulative -1 penalty to the AC it offers. Armor reduced to an AC of 10 or a shield that drops to a +0 bonus is destroyed. If the object touched is a held metal weapon, it rusts as described in the Rust Metal trait.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Saber-Toothed Tiger",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 52,
    hit_dice: "7d10",
    speed: "40 ft.",
    stats: [18, 14, 15, 3, 12, 8],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Keen Smell",
        desc: "The tiger has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      },
      {
        name: "Pounce",
        desc: "If the tiger moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 14 Strength saving throw or be knocked prone. If the target is prone, the tiger can make one bite attack against it as a bonus action.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (1d10 + 5) piercing damage.",
        attack_bonus: 6,
        damage_dice: "1d10",
        damage_bonus: 5
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 5
      }
    ]
  },
  {
    name: "Sahuagin",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "sahuagin",
    alignment: "lawful evil",
    ac: 12,
    hp: 22,
    hit_dice: "4d8",
    speed: "30 ft., swim 40 ft.",
    stats: [13, 11, 12, 12, 13, 9],
    skillsaves: [
      {
        perception: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 15",
    languages: "Sahuagin",
    cr: "1/2",
    traits: [
      {
        name: "Blood Frenzy",
        desc: "The sahuagin has advantage on melee attack rolls against any creature that doesn't have all its hit points.",
        attack_bonus: 0
      },
      {
        name: "Limited Amphibiousness",
        desc: "The sahuagin can breathe air and water, but it needs to be submerged at least once every 4 hours to avoid suffocating.",
        attack_bonus: 0
      },
      {
        name: "Shark Telepathy",
        desc: "The sahuagin can magically command any shark within 120 feet of it, using a limited telepathy.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The sahuagin makes two melee attacks: one with its bite and one with its claws or spear.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d4",
        damage_bonus: 1
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) slashing damage.",
        attack_bonus: 3,
        damage_dice: "1d4",
        damage_bonus: 1
      },
      {
        name: "Spear",
        desc: "Melee or Ranged Weapon Attack: +3 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d6 + 1) piercing damage, or 5 (1d8 + 1) piercing damage if used with two hands to make a melee attack.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Salamander",
    size: "Large",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral evil",
    ac: 15,
    hp: 90,
    hit_dice: "12d10",
    speed: "30 ft.",
    stats: [18, 14, 15, 11, 10, 12],
    damage_vulnerabilities: "cold",
    damage_resistances: "bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Ignan",
    cr: "5",
    traits: [
      {
        name: "Heated Body",
        desc: "A creature that touches the salamander or hits it with a melee attack while within 5 ft. of it takes 7 (2d6) fire damage.",
        attack_bonus: 0,
        damage_dice: "2d6"
      },
      {
        name: "Heated Weapons",
        desc: "Any metal melee weapon the salamander wields deals an extra 3 (1d6) fire damage on a hit (included in the attack).",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The salamander makes two attacks: one with its spear and one with its tail.",
        attack_bonus: 0
      },
      {
        name: "Spear",
        desc: "Melee or Ranged Weapon Attack: +7 to hit, reach 5 ft. or range 20 ft./60 ft., one target. Hit: 11 (2d6 + 4) piercing damage, or 13 (2d8 + 4) piercing damage if used with two hands to make a melee attack, plus 3 (1d6) fire damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage plus 7 (2d6) fire damage, and the target is grappled (escape DC 14). Until this grapple ends, the target is restrained, the salamander can automatically hit the target with its tail, and the salamander can't make tail attacks against other targets.",
        attack_bonus: 7,
        damage_dice: "2d6 + 2d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Satyr",
    size: "Medium",
    source: "SRD",
    type: "fey",
    subtype: "",
    alignment: "chaotic neutral",
    ac: 14,
    hp: 31,
    hit_dice: "7d8",
    speed: "40 ft.",
    stats: [12, 16, 11, 12, 10, 14],
    skillsaves: [
      {
        perception: 2
      },
      {
        performance: 6
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 12",
    languages: "Common, Elvish, Sylvan",
    cr: "1/2",
    traits: [
      {
        name: "Magic Resistance",
        desc: "The satyr has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Ram",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 6 (2d4 + 1) bludgeoning damage.",
        attack_bonus: 3,
        damage_dice: "2d4",
        damage_bonus: 1
      },
      {
        name: "Shortsword",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1 d6 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Shortbow",
        desc: "Ranged Weapon Attack: +5 to hit, range 80/320 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Variant: Panpipes",
        desc: "Gentle Lullaby. The creature falls asleep and is unconscious for 1 minute. The effect ends if the creature takes damage or if someone takes an action to shake the creature awake.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Scorpion",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 1,
    hit_dice: "1d4",
    speed: "10 ft.",
    stats: [2, 11, 8, 1, 8, 2],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "blindsight 10 ft., passive Perception 9",
    languages: "",
    cr: "0",
    actions: [
      {
        name: "Sting",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 1 piercing damage, and the target must make a DC 9 Constitution saving throw, taking 4 (1d8) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 2,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Scout",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 13,
    hp: 16,
    hit_dice: "3d8",
    speed: "30 ft.",
    stats: [11, 14, 12, 11, 13, 11],
    skillsaves: [
      {
        nature: 4
      },
      {
        perception: 5
      },
      {
        stealth: 6
      },
      {
        survival: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 15",
    languages: "any one language (usually Common)",
    cr: "1/2",
    traits: [
      {
        name: "Keen Hearing and Sight",
        desc: "The scout has advantage on Wisdom (Perception) checks that rely on hearing or sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The scout makes two melee attacks or two ranged attacks.",
        attack_bonus: 0
      },
      {
        name: "Shortsword",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Longbow",
        desc: "Ranged Weapon Attack: +4 to hit, ranged 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Sea Hag",
    size: "Medium",
    source: "SRD",
    type: "fey",
    subtype: "",
    alignment: "chaotic evil",
    ac: 14,
    hp: 52,
    hit_dice: "7d8",
    speed: "30 ft., swim 40 ft.",
    stats: [16, 13, 16, 12, 12, 13],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 11",
    languages: "Aquan, Common, Giant",
    cr: "2",
    traits: [
      {
        name: "Amphibious",
        desc: "The hag can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Horrific Appearance",
        desc: "Any humanoid that starts its turn within 30 feet of the hag and can see the hag's true form must make a DC 11 Wisdom saving throw. On a failed save, the creature is frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, with disadvantage if the hag is within line of sight, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the hag's Horrific Appearance for the next 24 hours.\nUnless the target is surprised or the revelation of the hag's true form is sudden, the target can avert its eyes and avoid making the initial saving throw. Until the start of its next turn, a creature that averts its eyes has disadvantage on attack rolls against the hag.",
        attack_bonus: 0
      },
      {
        name: "Hag Coven",
        desc: "When hags must work together, they form covens, in spite of their selfish natures. A coven is made up of hags of any type, all of whom are equals within the group. However, each of the hags continues to desire more personal power.\nA coven consists of three hags so that any arguments between two hags can be settled by the third. If more than three hags ever come together, as might happen if two covens come into conflict, the result is usually chaos.",
        attack_bonus: 0
      },
      {
        name: "Shared Spellcasting (Coven Only)",
        desc: "While all three members of a hag coven are within 30 feet of one another, they can each cast the following spells from the wizard's spell list but must share the spell slots among themselves:\n\n\u2022 1st level (4 slots): identify, ray of sickness\n\u2022 2nd level (3 slots): hold person, locate object\n\u2022 3rd level (3 slots): bestow curse, counterspell, lightning bolt\n\u2022 4th level (3 slots): phantasmal killer, polymorph\n\u2022 5th level (2 slots): contact other plane, scrying\n\u2022 6th level (1 slot): eye bite\n\nFor casting these spells, each hag is a 12th-level spellcaster that uses Intelligence as her spellcasting ability. The spell save DC is 12+the hag's Intelligence modifier, and the spell attack bonus is 4+the hag's Intelligence modifier.",
        attack_bonus: 0
      },
      {
        name: "Hag Eye (Coven Only)",
        desc: "A hag coven can craft a magic item called a hag eye, which is made from a real eye coated in varnish and often fitted to a pendant or other wearable item. The hag eye is usually entrusted to a minion for safekeeping and transport. A hag in the coven can take an action to see what the hag eye sees if the hag eye is on the same plane of existence. A hag eye has AC 10, 1 hit point, and darkvision with a radius of 60 feet. If it is destroyed, each coven member takes 3d10 psychic damage and is blinded for 24 hours.\nA hag coven can have only one hag eye at a time, and creating a new one requires all three members of the coven to perform a ritual. The ritual takes 1 hour, and the hags can't perform it while blinded. During the ritual, if the hags take any action other than performing the ritual, they must start over.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      },
      {
        name: "Death Glare",
        desc: "The hag targets one frightened creature she can see within 30 ft. of her. If the target can see the hag, it must succeed on a DC 11 Wisdom saving throw against this magic or drop to 0 hit points.",
        attack_bonus: 0
      },
      {
        name: "Illusory Appearance",
        desc: "The hag covers herself and anything she is wearing or carrying with a magical illusion that makes her look like an ugly creature of her general size and humanoid shape. The effect ends if the hag takes a bonus action to end it or if she dies.\nThe changes wrought by this effect fail to hold up to physical inspection. For example, the hag could appear to have no claws, but someone touching her hand might feel the claws. Otherwise, a creature must take an action to visually inspect the illusion and succeed on a DC 16 Intelligence (Investigation) check to discern that the hag is disguised.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Sea Horse",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 1,
    hit_dice: "1d4",
    speed: "swim 20 ft.",
    stats: [1, 12, 8, 1, 10, 2],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Water Breathing",
        desc: "The sea horse can breathe only underwater.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Shadow",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "chaotic evil",
    ac: 12,
    hp: 16,
    hit_dice: "3d8",
    speed: "40 ft.",
    stats: [6, 14, 13, 6, 10, 8],
    skillsaves: [
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "radiant",
    damage_resistances: "acid, cold, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "necrotic, poison",
    condition_immunities: "exhaustion, frightened, grappled, paralyzed, petrified, poisoned, prone, restrained",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Amorphous",
        desc: "The shadow can move through a space as narrow as 1 inch wide without squeezing.",
        attack_bonus: 0
      },
      {
        name: "Shadow Stealth",
        desc: "While in dim light or darkness, the shadow can take the Hide action as a bonus action. Its stealth bonus is also improved to +6.",
        attack_bonus: 0
      },
      {
        name: "Sunlight Weakness",
        desc: "While in sunlight, the shadow has disadvantage on attack rolls, ability checks, and saving throws.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Strength Drain",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 9 (2d6 + 2) necrotic damage, and the target's Strength score is reduced by 1d4. The target dies if this reduces its Strength to 0. Otherwise, the reduction lasts until the target finishes a short or long rest.\nIf a non-evil humanoid dies from this attack, a new shadow rises from the corpse 1d4 hours later.",
        attack_bonus: 4,
        damage_dice: "2d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Shambling Mound",
    size: "Large",
    source: "SRD",
    type: "plant",
    subtype: "",
    alignment: "unaligned",
    ac: 15,
    hp: 136,
    hit_dice: "16d10",
    speed: "20 ft., swim 20 ft.",
    stats: [18, 8, 16, 5, 10, 5],
    skillsaves: [
      {
        stealth: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold, fire",
    damage_immunities: "lightning",
    condition_immunities: "blinded, deafened, exhaustion",
    senses: "blindsight 60 ft. (blind beyond this radius), passive Perception 10",
    languages: "",
    cr: "5",
    traits: [
      {
        name: "Lightning Absorption",
        desc: "Whenever the shambling mound is subjected to lightning damage, it takes no damage and regains a number of hit points equal to the lightning damage dealt.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The shambling mound makes two slam attacks. If both attacks hit a Medium or smaller target, the target is grappled (escape DC 14), and the shambling mound uses its Engulf on it.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",
        attack_bonus: 7,
        damage_dice: "2d8",
        damage_bonus: 4
      },
      {
        name: "Engulf",
        desc: "The shambling mound engulfs a Medium or smaller creature grappled by it. The engulfed target is blinded, restrained, and unable to breathe, and it must succeed on a DC 14 Constitution saving throw at the start of each of the mound's turns or take 13 (2d8 + 4) bludgeoning damage. If the mound moves, the engulfed target moves with it. The mound can have only one creature engulfed at a time.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Shield Guardian",
    size: "Large",
    source: "SRD",
    type: "construct",
    subtype: "",
    alignment: "unaligned",
    ac: 17,
    hp: 142,
    hit_dice: "15d10",
    speed: "30 ft.",
    stats: [18, 8, 18, 7, 10, 3],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "charmed, exhaustion, frightened, paralyzed, poisoned",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 10",
    languages: "understands commands given in any language but can't speak",
    cr: "7",
    traits: [
      {
        name: "Bound",
        desc: "The shield guardian is magically bound to an amulet. As long as the guardian and its amulet are on the same plane of existence, the amulet's wearer can telepathically call the guardian to travel to it, and the guardian knows the distance and direction to the amulet. If the guardian is within 60 feet of the amulet's wearer, half of any damage the wearer takes (rounded up) is transferred to the guardian.",
        attack_bonus: 0
      },
      {
        name: "Regeneration",
        desc: "The shield guardian regains 10 hit points at the start of its turn if it has at least 1 hit. point.",
        attack_bonus: 0
      },
      {
        name: "Spell Storing",
        desc: "A spellcaster who wears the shield guardian's amulet can cause the guardian to store one spell of 4th level or lower. To do so, the wearer must cast the spell on the guardian. The spell has no effect but is stored within the guardian. When commanded to do so by the wearer or when a situation arises that was predefined by the spellcaster, the guardian casts the stored spell with any parameters set by the original caster, requiring no components. When the spell is cast or a new spell is stored, any previously stored spell is lost.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The guardian makes two fist attacks.",
        attack_bonus: 0
      },
      {
        name: "Fist",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      }
    ],
    reactions: [
      {
        name: "Shield",
        desc: "When a creature makes an attack against the wearer of the guardian's amulet, the guardian grants a +2 bonus to the wearer's AC if the guardian is within 5 feet of the wearer.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Shrieker",
    size: "Medium",
    source: "SRD",
    type: "plant",
    subtype: "",
    alignment: "unaligned",
    ac: 5,
    hp: 13,
    hit_dice: "3d8",
    speed: "0 ft.",
    stats: [1, 1, 10, 1, 3, 1],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "blinded, deafened, frightened",
    senses: "blindsight 30 ft. (blind beyond this radius), passive Perception 6",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "False Appearance",
        desc: "While the shrieker remains motionless, it is indistinguishable from an ordinary fungus.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Shriek",
        desc: "When bright light or a creature is within 30 feet of the shrieker, it emits a shriek audible within 300 feet of it. The shrieker continues to shriek until the disturbance moves out of range and for 1d4 of the shrieker's turns afterward",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Silver Dragon Wyrmling",
    size: "Medium",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 17,
    hp: 45,
    hit_dice: "6d8",
    speed: "30 ft., fly 60 ft.",
    stats: [19, 10, 17, 12, 11, 15],
    saves: [
      {
        dexterity: 2
      },
      {
        constitution: 5
      },
      {
        wisdom: 2
      },
      {
        charisma: 4
      }
    ],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 14",
    languages: "Draconic",
    cr: "2",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (1d10 + 4) piercing damage.",
        attack_bonus: 6,
        damage_dice: "1d10",
        damage_bonus: 4
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nCold Breath. The dragon exhales an icy blast in a 15-foot cone. Each creature in that area must make a DC 13 Constitution saving throw, taking 18 (4d8) cold damage on a failed save, or half as much damage on a successful one.\nParalyzing Breath. The dragon exhales paralyzing gas in a 15-foot cone. Each creature in that area must succeed on a DC 13 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0,
        damage_dice: "4d8"
      }
    ]
  },
  {
    name: "Skeleton",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "lawful evil",
    ac: 13,
    hp: 13,
    hit_dice: "2d8",
    speed: "30 ft.",
    stats: [10, 14, 15, 6, 8, 5],
    damage_vulnerabilities: "bludgeoning",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 9",
    languages: "understands all languages it spoke in life but can't speak",
    cr: "1/4",
    actions: [
      {
        name: "Shortsword",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Shortbow",
        desc: "Ranged Weapon Attack: +4 to hit, range 80/320 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Solar",
    size: "Large",
    source: "SRD",
    type: "celestial",
    subtype: "",
    alignment: "lawful good",
    ac: 21,
    hp: 243,
    hit_dice: "18d10",
    speed: "50 ft., fly 150 ft.",
    stats: [26, 22, 26, 25, 25, 30],
    saves: [
      {
        intelligence: 14
      },
      {
        wisdom: 14
      },
      {
        charisma: 17
      }
    ],
    skillsaves: [
      {
        perception: 14
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "radiant; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "necrotic, poison",
    condition_immunities: "charmed, exhaustion, frightened, poisoned",
    senses: "truesight 120 ft., passive Perception 24",
    languages: "all, telepathy 120 ft.",
    cr: "21",
    traits: [
      {
        name: "Angelic Weapons",
        desc: "The solar's weapon attacks are magical. When the solar hits with any weapon, the weapon deals an extra 6d8 radiant damage (included in the attack).",
        attack_bonus: 0
      },
      {
        name: "Divine Awareness",
        desc: "The solar knows if it hears a lie.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The solar's spell casting ability is Charisma (spell save DC 25). It can innately cast the following spells, requiring no material components:\nAt will: detect evil and good, invisibility (self only)\n3/day each: blade barrier, dispel evil and good, resurrection\n1/day each: commune, control weather",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The solar has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The solar makes two greatsword attacks.",
        attack_bonus: 0
      },
      {
        name: "Greatsword",
        desc: "Melee Weapon Attack: +15 to hit, reach 5 ft., one target. Hit: 22 (4d6 + 8) slashing damage plus 27 (6d8) radiant damage.",
        attack_bonus: 15,
        damage_dice: "4d6 + 6d8",
        damage_bonus: 8
      },
      {
        name: "Slaying Longbow",
        desc: "Ranged Weapon Attack: +13 to hit, range 150/600 ft., one target. Hit: 15 (2d8 + 6) piercing damage plus 27 (6d8) radiant damage. If the target is a creature that has 190 hit points or fewer, it must succeed on a DC 15 Constitution saving throw or die.",
        attack_bonus: 13,
        damage_dice: "2d8 + 6d8",
        damage_bonus: 6
      },
      {
        name: "Flying Sword",
        desc: "The solar releases its greatsword to hover magically in an unoccupied space within 5 ft. of it. If the solar can see the sword, the solar can mentally command it as a bonus action to fly up to 50 ft. and either make one attack against a target or return to the solar's hands. If the hovering sword is targeted by any effect, the solar is considered to be holding it. The hovering sword falls if the solar dies.",
        attack_bonus: 0
      },
      {
        name: "Healing Touch (4/Day)",
        desc: "The solar touches another creature. The target magically regains 40 (8d8 + 4) hit points and is freed from any curse, disease, poison, blindness, or deafness.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Teleport",
        desc: "The solar magically teleports, along with any equipment it is wearing or carrying, up to 120 ft. to an unoccupied space it can see.",
        attack_bonus: 0
      },
      {
        name: "Searing Burst (Costs 2 Actions)",
        desc: "The solar emits magical, divine energy. Each creature of its choice in a 10 -foot radius must make a DC 23 Dexterity saving throw, taking 14 (4d6) fire damage plus 14 (4d6) radiant damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0
      },
      {
        name: "Blinding Gaze (Costs 3 Actions)",
        desc: "The solar targets one creature it can see within 30 ft. of it. If the target can see it, the target must succeed on a DC 15 Constitution saving throw or be blinded until magic such as the lesser restoration spell removes the blindness.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Specter",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "chaotic evil",
    ac: 12,
    hp: 22,
    hit_dice: "5d8",
    speed: "0 ft., fly 50 ft. (hover)",
    stats: [1, 14, 11, 10, 10, 11],
    damage_vulnerabilities: "",
    damage_resistances: "acid, cold, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "necrotic, poison",
    condition_immunities: "charmed, exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "understands all languages it knew in life but can't speak",
    cr: "1",
    traits: [
      {
        name: "Incorporeal Movement",
        desc: "The specter can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",
        attack_bonus: 0
      },
      {
        name: "Sunlight Sensitivity",
        desc: "While in sunlight, the specter has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Life Drain",
        desc: "Melee Spell Attack: +4 to hit, reach 5 ft., one creature. Hit: 10 (3d6) necrotic damage. The target must succeed on a DC 10 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the creature finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",
        attack_bonus: 4,
        damage_dice: "3d6"
      }
    ]
  },
  {
    name: "Spider",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 1,
    hit_dice: "1d4",
    speed: "20 ft., climb 20 ft.",
    stats: [2, 14, 8, 1, 10, 2],
    skillsaves: [
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 30 ft., passive Perception 12",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Spider Climb",
        desc: "The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      },
      {
        name: "Web Sense",
        desc: "While in contact with a web, the spider knows the exact location of any other creature in contact with the same web.",
        attack_bonus: 0
      },
      {
        name: "Web Walker",
        desc: "The spider ignores movement restrictions caused by webbing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 1 piercing damage, and the target must succeed on a DC 9 Constitution saving throw or take 2 (1d4) poison damage.",
        attack_bonus: 4,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Spirit Naga",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "chaotic evil",
    ac: 15,
    hp: 75,
    hit_dice: "10d10",
    speed: "40 ft.",
    stats: [18, 17, 14, 16, 15, 16],
    saves: [
      {
        dexterity: 6
      },
      {
        constitution: 5
      },
      {
        wisdom: 5
      },
      {
        charisma: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "charmed, poisoned",
    senses: "darkvision 60 ft., passive Perception 12",
    languages: "Abyssal, Common",
    cr: "8",
    traits: [
      {
        name: "Rejuvenation",
        desc: "If it dies, the naga returns to life in 1d6 days and regains all its hit points. Only a wish spell can prevent this trait from functioning.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 10 ft., one creature. Hit: 7 (1d6 + 4) piercing damage, and the target must make a DC 13 Constitution saving throw, taking 31 (7d8) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 7,
        damage_dice: "1d6",
        damage_bonus: 4
      }
    ],
    spells: [
      "The naga is a 10th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 14, +6 to hit with spell attacks), and it needs only verbal components to cast its spells. It has the following wizard spells prepared:",
      {
        "Cantrips (at will)": "mage hand, minor illusion, ray of frost"
      },
      {
        "1st level (4 slots)": "charm person, detect magic, sleep"
      },
      {
        "2nd level (3 slots)": "detect thoughts, hold person"
      },
      {
        "3rd level (3 slots)": "lightning bolt, water breathing"
      },
      {
        "4th level (3 slots)": "blight, dimension door"
      },
      {
        "5th level (2 slots)": "dominate person"
      }
    ]
  },
  {
    name: "Sprite",
    size: "Tiny",
    source: "SRD",
    type: "fey",
    subtype: "",
    alignment: "neutral good",
    ac: 15,
    hp: 2,
    hit_dice: "1d4",
    speed: "10 ft., fly 40 ft.",
    stats: [3, 18, 10, 14, 13, 11],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 8
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "Common, Elvish, Sylvan",
    cr: "1/4",
    actions: [
      {
        name: "Longsword",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",
        attack_bonus: 2,
        damage_bonus: 1
      },
      {
        name: "Shortbow",
        desc: "Ranged Weapon Attack: +6 to hit, range 40/160 ft., one target. Hit: 1 piercing damage, and the target must succeed on a DC 10 Constitution saving throw or become poisoned for 1 minute. If its saving throw result is 5 or lower, the poisoned target falls unconscious for the same duration, or until it takes damage or another creature takes an action to shake it awake.",
        attack_bonus: 6,
        damage_bonus: 1
      },
      {
        name: "Heart Sight",
        desc: "The sprite touches a creature and magically knows the creature's current emotional state. If the target fails a DC 10 Charisma saving throw, the sprite also knows the creature's alignment. Celestials, fiends, and undead automatically fail the saving throw.",
        attack_bonus: 0
      },
      {
        name: "Invisibility",
        desc: "The sprite magically turns invisible until it attacks or casts a spell, or until its concentration ends (as if concentrating on a spell). Any equipment the sprite wears or carries is invisible with it.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Spy",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 12,
    hp: 27,
    hit_dice: "6d8",
    speed: "30 ft.",
    stats: [10, 15, 10, 12, 14, 16],
    skillsaves: [
      {
        deception: 5
      },
      {
        insight: 4
      },
      {
        investigation: 5
      },
      {
        perception: 6
      },
      {
        persuasion: 5
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 16",
    languages: "any two languages",
    cr: "1",
    traits: [
      {
        name: "Cunning Action",
        desc: "On each of its turns, the spy can use a bonus action to take the Dash, Disengage, or Hide action.",
        attack_bonus: 0
      },
      {
        name: "Sneak Attack (1/Turn)",
        desc: "The spy deals an extra 7 (2d6) damage when it hits a target with a weapon attack and has advantage on the attack roll, or when the target is within 5 ft. of an ally of the spy that isn't incapacitated and the spy doesn't have disadvantage on the attack roll.",
        attack_bonus: 0,
        damage_dice: "2d6"
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The spy makes two melee attacks.",
        attack_bonus: 0
      },
      {
        name: "Shortsword",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Hand Crossbow",
        desc: "Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Steam Mephit",
    size: "Small",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral evil",
    ac: 10,
    hp: 21,
    hit_dice: "6d6",
    speed: "30 ft., fly 30 ft.",
    stats: [5, 11, 10, 11, 10, 12],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire, poison",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Aquan, Ignan",
    cr: "1/4",
    traits: [
      {
        name: "Death Burst",
        desc: "When the mephit dies, it explodes in a cloud of steam. Each creature within 5 ft. of the mephit must succeed on a DC 10 Dexterity saving throw or take 4 (1d8) fire damage.",
        attack_bonus: 0,
        damage_dice: "1d8"
      },
      {
        name: "Innate Spellcasting (1/Day)",
        desc: "The mephit can innately cast blur, requiring no material components. Its innate spellcasting ability is Charisma.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 2 (1d4) slashing damage plus 2 (1d4) fire damage.",
        attack_bonus: 2,
        damage_dice: "2d4"
      },
      {
        name: "Steam Breath (Recharge 6)",
        desc: "The mephit exhales a 15-foot cone of scalding steam. Each creature in that area must succeed on a DC 10 Dexterity saving throw, taking 4 (1d8) fire damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0
      },
      {
        name: "Variant: Summon Mephits (1/Day)",
        desc: "The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Stirge",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 14,
    hp: 2,
    hit_dice: "1d4",
    speed: "10 ft., fly 40 ft.",
    stats: [4, 16, 11, 2, 8, 6],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 9",
    languages: "",
    cr: "1/8",
    actions: [
      {
        name: "Blood Drain",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 5 (1d4 + 3) piercing damage, and the stirge attaches to the target. While attached, the stirge doesn't attack. Instead, at the start of each of the stirge's turns, the target loses 5 (1d4 + 3) hit points due to blood loss.\nThe stirge can detach itself by spending 5 feet of its movement. It does so after it drains 10 hit points of blood from the target or the target dies. A creature, including the target, can use its action to detach the stirge.",
        attack_bonus: 5,
        damage_dice: "1d4",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Stone Giant",
    size: "Huge",
    source: "SRD",
    type: "giant",
    subtype: "",
    alignment: "neutral",
    ac: 17,
    hp: 126,
    hit_dice: "11d12",
    speed: "40 ft.",
    stats: [23, 15, 20, 10, 12, 9],
    saves: [
      {
        dexterity: 5
      },
      {
        constitution: 8
      },
      {
        wisdom: 4
      }
    ],
    skillsaves: [
      {
        athletics: 12
      },
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "Giant",
    cr: "7",
    traits: [
      {
        name: "Stone Camouflage",
        desc: "The giant has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The giant makes two greatclub attacks.",
        attack_bonus: 0
      },
      {
        name: "Greatclub",
        desc: "Melee Weapon Attack: +9 to hit, reach 15 ft., one target. Hit: 19 (3d8 + 6) bludgeoning damage.",
        attack_bonus: 9,
        damage_dice: "3d8",
        damage_bonus: 6
      },
      {
        name: "Rock",
        desc: "Ranged Weapon Attack: +9 to hit, range 60/240 ft., one target. Hit: 28 (4d10 + 6) bludgeoning damage. If the target is a creature, it must succeed on a DC 17 Strength saving throw or be knocked prone.",
        attack_bonus: 9,
        damage_dice: "4d10",
        damage_bonus: 6
      }
    ],
    reactions: [
      {
        name: "Rock Catching",
        desc: "If a rock or similar object is hurled at the giant, the giant can, with a successful DC 10 Dexterity saving throw, catch the missile and take no bludgeoning damage from it.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Stone Golem",
    size: "Large",
    source: "SRD",
    type: "construct",
    subtype: "",
    alignment: "unaligned",
    ac: 17,
    hp: 178,
    hit_dice: "17d10",
    speed: "30 ft.",
    stats: [22, 9, 20, 3, 11, 1],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison, psychic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",
    condition_immunities: "charmed, exhaustion, frightened, paralyzed, petrified, poisoned",
    senses: "darkvision 120 ft., passive Perception 10",
    languages: "understands the languages of its creator but can't speak",
    cr: "10",
    traits: [
      {
        name: "Immutable Form",
        desc: "The golem is immune to any spell or effect that would alter its form.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The golem has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The golem's weapon attacks are magical.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The golem makes two slam attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 19 (3d8 + 6) bludgeoning damage.",
        attack_bonus: 10,
        damage_dice: "3d8",
        damage_bonus: 6
      },
      {
        name: "Slow (Recharge 5-6)",
        desc: "The golem targets one or more creatures it can see within 10 ft. of it. Each target must make a DC 17 Wisdom saving throw against this magic. On a failed save, a target can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the target can take either an action or a bonus action on its turn, not both. These effects last for 1 minute. A target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Storm Giant",
    size: "Huge",
    source: "SRD",
    type: "giant",
    subtype: "",
    alignment: "chaotic good",
    ac: 16,
    hp: 230,
    hit_dice: "20d12",
    speed: "50 ft., swim 50 ft.",
    stats: [29, 14, 20, 16, 18, 18],
    saves: [
      {
        strength: 14
      },
      {
        constitution: 10
      },
      {
        wisdom: 9
      },
      {
        charisma: 9
      }
    ],
    skillsaves: [
      {
        arcana: 8
      },
      {
        athletics: 14
      },
      {
        history: 8
      },
      {
        perception: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold",
    damage_immunities: "lightning, thunder",
    condition_immunities: "",
    senses: "passive Perception 19",
    languages: "Common, Giant",
    cr: "13",
    traits: [
      {
        name: "Amphibious",
        desc: "The giant can breathe air and water.",
        attack_bonus: 0
      },
      {
        name: "Innate Spellcasting",
        desc: "The giant's innate spellcasting ability is Charisma (spell save DC 17). It can innately cast the following spells, requiring no material components:\n\nAt will: detect magic, feather fall, levitate, light\n3/day each: control weather, water breathing",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The giant makes two greatsword attacks.",
        attack_bonus: 0
      },
      {
        name: "Greatsword",
        desc: "Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 30 (6d6 + 9) slashing damage.",
        attack_bonus: 14,
        damage_dice: "6d6",
        damage_bonus: 9
      },
      {
        name: "Rock",
        desc: "Ranged Weapon Attack: +14 to hit, range 60/240 ft., one target. Hit: 35 (4d12 + 9) bludgeoning damage.",
        attack_bonus: 14,
        damage_dice: "4d12",
        damage_bonus: 9
      },
      {
        name: "Lightning Strike (Recharge 5-6)",
        desc: "The giant hurls a magical lightning bolt at a point it can see within 500 feet of it. Each creature within 10 feet of that point must make a DC 17 Dexterity saving throw, taking 54 (12d8) lightning damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "12d8"
      }
    ]
  },
  {
    name: "Succubus/Incubus",
    size: "Medium",
    source: "SRD",
    type: "fiend",
    subtype: "shapechanger",
    alignment: "neutral evil",
    ac: 15,
    hp: 66,
    hit_dice: "12d8",
    speed: "30 ft., fly 60 ft.",
    stats: [8, 17, 13, 15, 12, 20],
    skillsaves: [
      {
        deception: 9
      },
      {
        insight: 5
      },
      {
        perception: 5
      },
      {
        persuasion: 9
      },
      {
        stealth: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold, fire, lightning, poison; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 15",
    languages: "Abyssal, Common, Infernal, telepathy 60 ft.",
    cr: "4",
    traits: [
      {
        name: "Telepathic Bond",
        desc: "The fiend ignores the range restriction on its telepathy when communicating with a creature it has charmed. The two don't even need to be on the same plane of existence.",
        attack_bonus: 0
      },
      {
        name: "Shapechanger",
        desc: "The fiend can use its action to polymorph into a Small or Medium humanoid, or back into its true form. Without wings, the fiend loses its flying speed. Other than its size and speed, its statistics are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Claw (Fiend Form Only)",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Charm",
        desc: "One humanoid the fiend can see within 30 feet of it must succeed on a DC 15 Wisdom saving throw or be magically charmed for 1 day. The charmed target obeys the fiend's verbal or telepathic commands. If the target suffers any harm or receives a suicidal command, it can repeat the saving throw, ending the effect on a success. If the target successfully saves against the effect, or if the effect on it ends, the target is immune to this fiend's Charm for the next 24 hours.\nThe fiend can have only one target charmed at a time. If it charms another, the effect on the previous target ends.",
        attack_bonus: 0
      },
      {
        name: "Draining Kiss",
        desc: "The fiend kisses a creature charmed by it or a willing creature. The target must make a DC 15 Constitution saving throw against this magic, taking 32 (5d10 + 5) psychic damage on a failed save, or half as much damage on a successful one. The target's hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",
        attack_bonus: 0,
        damage_dice: "5d10",
        damage_bonus: 5
      },
      {
        name: "Etherealness",
        desc: "The fiend magically enters the Ethereal Plane from the Material Plane, or vice versa.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Swarm of Bats",
    size: "Medium",
    type: "swarm of Tiny beasts",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 22,
    hit_dice: "5d8",
    speed: "0 ft., fly 30 ft.",
    stats: [5, 15, 10, 2, 12, 4],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, slashing",
    damage_immunities: "",
    condition_immunities: "charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",
    senses: "blindsight 60 ft., passive Perception 11",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Echolocation",
        desc: "The swarm can't use its blindsight while deafened.",
        attack_bonus: 0
      },
      {
        name: "Keen Hearing",
        desc: "The swarm has advantage on Wisdom (Perception) checks that rely on hearing.",
        attack_bonus: 0
      },
      {
        name: "Swarm",
        desc: "The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny bat. The swarm can't regain hit points or gain temporary hit points.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bites",
        desc: "Melee Weapon Attack: +4 to hit, reach 0 ft., one creature in the swarm's space. Hit: 5 (2d4) piercing damage, or 2 (1d4) piercing damage if the swarm has half of its hit points or fewer.",
        attack_bonus: 4,
        damage_dice: "2d4"
      }
    ]
  },
  {
    name: "Swarm of Beetles",
    size: "Medium",
    type: "swarm of Tiny beasts",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 22,
    hit_dice: "5d8",
    speed: "20 ft., burrow 5 ft., climb 20 ft.",
    stats: [3, 13, 10, 1, 7, 1],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, slashing",
    damage_immunities: "",
    condition_immunities: "charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",
    senses: "blindsight 10 ft., passive Perception 8",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Swarm",
        desc: "The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bites",
        desc: "Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",
        attack_bonus: 3,
        damage_dice: "4d4"
      }
    ]
  },
  {
    name: "Swarm of Centipedes",
    size: "Medium",
    type: "swarm of Tiny beasts",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 22,
    hit_dice: "5d8",
    speed: "20 ft., climb 20 ft.",
    stats: [3, 13, 10, 1, 7, 1],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, slashing",
    damage_immunities: "",
    condition_immunities: "charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",
    senses: "blindsight 10 ft., passive Perception 8",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Swarm",
        desc: "The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bites",
        desc: "Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.\nA creature reduced to 0 hit points by a swarm of centipedes is stable but poisoned for 1 hour, even after regaining hit points, and paralyzed while poisoned in this way.",
        attack_bonus: 3,
        damage_dice: "4d4"
      }
    ]
  },
  {
    name: "Swarm of Insects",
    size: "Medium",
    type: "swarm of Tiny beasts",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 22,
    hit_dice: "5d8",
    speed: "20 ft., climb 20 ft.",
    stats: [3, 13, 10, 1, 7, 1],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, slashing",
    damage_immunities: "",
    condition_immunities: "charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",
    senses: "blindsight 10 ft., passive Perception 8",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Swarm",
        desc: "The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bites",
        desc: "Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",
        attack_bonus: 3,
        damage_dice: "4d4"
      }
    ]
  },
  {
    name: "Swarm of Poisonous Snakes",
    size: "Medium",
    type: "swarm of Tiny beasts",
    subtype: "",
    alignment: "unaligned",
    ac: 14,
    hp: 36,
    hit_dice: "8d8",
    speed: "30 ft., swim 30 ft.",
    stats: [8, 18, 11, 1, 10, 3],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, slashing",
    damage_immunities: "",
    condition_immunities: "charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",
    senses: "blindsight 10 ft., passive Perception 10",
    languages: "",
    cr: "2",
    traits: [
      {
        name: "Swarm",
        desc: "The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny snake. The swarm can't regain hit points or gain temporary hit points.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bites",
        desc: "Melee Weapon Attack: +6 to hit, reach 0 ft., one creature in the swarm's space. Hit: 7 (2d6) piercing damage, or 3 (1d6) piercing damage if the swarm has half of its hit points or fewer. The target must make a DC 10 Constitution saving throw, taking 14 (4d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 6,
        damage_dice: "2d6"
      }
    ]
  },
  {
    name: "Swarm of Quippers",
    size: "Medium",
    type: "swarm of Tiny beasts",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 28,
    hit_dice: "8d8",
    speed: "0 ft., swim 40 ft.",
    stats: [13, 16, 9, 1, 7, 2],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, slashing",
    damage_immunities: "",
    condition_immunities: "charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",
    senses: "darkvision 60 ft., passive Perception 8",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Blood Frenzy",
        desc: "The swarm has advantage on melee attack rolls against any creature that doesn't have all its hit points.",
        attack_bonus: 0
      },
      {
        name: "Swarm",
        desc: "The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny quipper. The swarm can't regain hit points or gain temporary hit points.",
        attack_bonus: 0
      },
      {
        name: "Water Breathing",
        desc: "The swarm can breathe only underwater.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bites",
        desc: "Melee Weapon Attack: +5 to hit, reach 0 ft., one creature in the swarm's space. Hit: 14 (4d6) piercing damage, or 7 (2d6) piercing damage if the swarm has half of its hit points or fewer.",
        attack_bonus: 5,
        damage_dice: "4d6"
      }
    ]
  },
  {
    name: "Swarm of Rats",
    size: "Medium",
    type: "swarm of Tiny beasts",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 24,
    hit_dice: "7d8",
    speed: "30 ft.",
    stats: [9, 11, 9, 2, 10, 3],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, slashing",
    damage_immunities: "",
    condition_immunities: "charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",
    senses: "darkvision 30 ft., passive Perception 10",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Keen Smell",
        desc: "The swarm has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      },
      {
        name: "Swarm",
        desc: "The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny rat. The swarm can't regain hit points or gain temporary hit points.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bites",
        desc: "Melee Weapon Attack: +2 to hit, reach 0 ft., one target in the swarm's space. Hit: 7 (2d6) piercing damage, or 3 (1d6) piercing damage if the swarm has half of its hit points or fewer.",
        attack_bonus: 2,
        damage_dice: "2d6"
      }
    ]
  },
  {
    name: "Swarm of Ravens",
    size: "Medium",
    type: "swarm of Tiny beasts",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 24,
    hit_dice: "7d8",
    speed: "10 ft., fly 50 ft.",
    stats: [6, 14, 8, 3, 12, 6],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, slashing",
    damage_immunities: "",
    condition_immunities: "charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",
    senses: "passive Perception 15",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Swarm",
        desc: "The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny raven. The swarm can't regain hit points or gain temporary hit points.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Beaks",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target in the swarm's space. Hit: 7 (2d6) piercing damage, or 3 (1d6) piercing damage if the swarm has half of its hit points or fewer.",
        attack_bonus: 4,
        damage_dice: "2d6"
      }
    ]
  },
  {
    name: "Swarm of Spiders",
    size: "Medium",
    type: "swarm of Tiny beasts",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 22,
    hit_dice: "5d8",
    speed: "20 ft., climb 20 ft.",
    stats: [3, 13, 10, 1, 7, 1],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, slashing",
    damage_immunities: "",
    condition_immunities: "charmed, frightened, paralyzed, petrified, prone, restrained, stunned",
    senses: "blindsight 10 ft., passive Perception 8",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Swarm",
        desc: "The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",
        attack_bonus: 0
      },
      {
        name: "Spider Climb",
        desc: "The swarm can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      },
      {
        name: "Web Sense",
        desc: "While in contact with a web, the swarm knows the exact location of any other creature in contact with the same web.",
        attack_bonus: 0
      },
      {
        name: "Web Walker",
        desc: "The swarm ignores movement restrictions caused by webbing.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bites",
        desc: "Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",
        attack_bonus: 3,
        damage_dice: "4d4"
      }
    ]
  },
  {
    name: "Swarm of Wasps",
    size: "Medium",
    type: "swarm of Tiny beasts",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 22,
    hit_dice: "5d8",
    speed: "5 ft., fly 30 ft.",
    stats: [3, 13, 10, 1, 7, 1],
    damage_vulnerabilities: "",
    damage_resistances: "bludgeoning, piercing, slashing",
    damage_immunities: "",
    condition_immunities: "charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",
    senses: "blindsight 10 ft., passive Perception 8",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Swarm",
        desc: "The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bites",
        desc: "Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",
        attack_bonus: 3,
        damage_dice: "4d4"
      }
    ]
  },
  {
    name: "Tarrasque",
    size: "Gargantuan",
    source: "SRD",
    type: "monstrosity",
    subtype: "titan",
    alignment: "unaligned",
    ac: 25,
    hp: 676,
    hit_dice: "33d20",
    speed: "40 ft.",
    stats: [30, 11, 30, 3, 11, 11],
    saves: [
      {
        intelligence: 5
      },
      {
        wisdom: 9
      },
      {
        charisma: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire, poison; bludgeoning, piercing, and slashing from nonmagical weapons",
    condition_immunities: "charmed, frightened, paralyzed, poisoned",
    senses: "blindsight 120 ft., passive Perception 10",
    languages: "",
    cr: "30",
    traits: [
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the tarrasque fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The tarrasque has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Reflective Carapace",
        desc: "Any time the tarrasque is targeted by a magic missile spell, a line spell, or a spell that requires a ranged attack roll, roll a d6. On a 1 to 5, the tarrasque is unaffected. On a 6, the tarrasque is unaffected, and the effect is reflected back at the caster as though it originated from the tarrasque, turning the caster into the target.",
        attack_bonus: 0
      },
      {
        name: "Siege Monster",
        desc: "The tarrasque deals double damage to objects and structures.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The tarrasque can use its Frightful Presence. It then makes five attacks: one with its bite, two with its claws, one with its horns, and one with its tai l. It can use its Swallow instead of its bite.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +19 to hit, reach 10 ft., one target. Hit: 36 (4d12 + 10) piercing damage. If the target is a creature, it is grappled (escape DC 20). Until this grapple ends, the target is restrained, and the tarrasque can't bite another target.",
        attack_bonus: 19,
        damage_dice: "4d12",
        damage_bonus: 10
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +19 to hit, reach 15 ft., one target. Hit: 28 (4d8 + 10) slashing damage.",
        attack_bonus: 19,
        damage_dice: "4d8",
        damage_bonus: 10
      },
      {
        name: "Horns",
        desc: "Melee Weapon Attack: +19 to hit, reach 10 ft., one target. Hit: 32 (4d10 + 10) piercing damage.",
        attack_bonus: 19,
        damage_dice: "4d10",
        damage_bonus: 10
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +19 to hit, reach 20 ft., one target. Hit: 24 (4d6 + 10) bludgeoning damage. If the target is a creature, it must succeed on a DC 20 Strength saving throw or be knocked prone.",
        attack_bonus: 19,
        damage_dice: "4d6",
        damage_bonus: 10
      },
      {
        name: "Frightful Presence",
        desc: "Each creature of the tarrasque's choice within 120 feet of it and aware of it must succeed on a DC 17 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, with disadvantage if the tarrasque is within line of sight, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the tarrasque's Frightful Presence for the next 24 hours.",
        attack_bonus: 0
      },
      {
        name: "Swallow",
        desc: "The tarrasque makes one bite attack against a Large or smaller creature it is grappling. If the attack hits, the target takes the bite's damage, the target is swallowed, and the grapple ends. While swallowed, the creature is blinded and restrained, it has total cover against attacks and other effects outside the tarrasque, and it takes 56 (16d6) acid damage at the start of each of the tarrasque's turns.\nIf the tarrasque takes 60 damage or more on a single turn from a creature inside it, the tarrasque must succeed on a DC 20 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet of the tarrasque. If the tarrasque dies, a swallowed creature is no longer restrained by it and can escape from the corpse by using 30 feet of movement, exiting prone.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Attack",
        desc: "The tarrasque makes one claw attack or tail attack.",
        attack_bonus: 0
      },
      {
        name: "Move",
        desc: "The tarrasque moves up to half its speed.",
        attack_bonus: 0
      },
      {
        name: "Chomp (Costs 2 Actions)",
        desc: "The tarrasque makes one bite attack or uses its Swallow.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Thug",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any non-good alignment",
    ac: 11,
    hp: 32,
    hit_dice: "5d8",
    speed: "30 ft.",
    stats: [15, 11, 14, 10, 10, 11],
    skillsaves: [
      {
        intimidation: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "any one language (usually Common)",
    cr: "1/2",
    traits: [
      {
        name: "Pack Tactics",
        desc: "The thug has advantage on an attack roll against a creature if at least one of the thug's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The thug makes two melee attacks.",
        attack_bonus: 0
      },
      {
        name: "Mace",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) bludgeoning damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Heavy Crossbow",
        desc: "Ranged Weapon Attack: +2 to hit, range 100/400 ft., one target. Hit: 5 (1d10) piercing damage.",
        attack_bonus: 2,
        damage_dice: "1d10"
      }
    ]
  },
  {
    name: "Tiger",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 12,
    hp: 37,
    hit_dice: "5d10",
    speed: "40 ft.",
    stats: [17, 15, 14, 3, 12, 8],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 13",
    languages: "",
    cr: "1",
    traits: [
      {
        name: "Keen Smell",
        desc: "The tiger has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      },
      {
        name: "Pounce",
        desc: "If the tiger moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 13 Strength saving throw or be knocked prone. If the target is prone, the tiger can make one bite attack against it as a bonus action.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d10",
        damage_bonus: 3
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Treant",
    size: "Huge",
    source: "SRD",
    type: "plant",
    subtype: "",
    alignment: "chaotic good",
    ac: 16,
    hp: 138,
    hit_dice: "12d12",
    speed: "30 ft.",
    stats: [23, 8, 21, 12, 16, 12],
    damage_vulnerabilities: "fire",
    damage_resistances: "bludgeoning, piercing",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "Common, Druidic, Elvish, Sylvan",
    cr: "9",
    traits: [
      {
        name: "False Appearance",
        desc: "While the treant remains motionless, it is indistinguishable from a normal tree.",
        attack_bonus: 0
      },
      {
        name: "Siege Monster",
        desc: "The treant deals double damage to objects and structures.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The treant makes two slam attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 16 (3d6 + 6) bludgeoning damage.",
        attack_bonus: 10,
        damage_dice: "3d6",
        damage_bonus: 6
      },
      {
        name: "Rock",
        desc: "Ranged Weapon Attack: +10 to hit, range 60/180 ft., one target. Hit: 28 (4d10 + 6) bludgeoning damage.",
        attack_bonus: 10,
        damage_dice: "4d10",
        damage_bonus: 6
      },
      {
        name: "Animate Trees (1/Day)",
        desc: "The treant magically animates one or two trees it can see within 60 feet of it. These trees have the same statistics as a treant, except they have Intelligence and Charisma scores of 1, they can't speak, and they have only the Slam action option. An animated tree acts as an ally of the treant. The tree remains animate for 1 day or until it dies; until the treant dies or is more than 120 feet from the tree; or until the treant takes a bonus action to turn it back into an inanimate tree. The tree then takes root if possible.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Tribal Warrior",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 12,
    hp: 11,
    hit_dice: "2d8",
    speed: "30 ft.",
    stats: [13, 11, 12, 8, 11, 8],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "any one language",
    cr: "1/8",
    traits: [
      {
        name: "Pack Tactics",
        desc: "The warrior has advantage on an attack roll against a creature if at least one of the warrior's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Spear",
        desc: "Melee or Ranged Weapon Attack: +3 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d6 + 1) piercing damage, or 5 (1d8 + 1) piercing damage if used with two hands to make a melee attack.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Triceratops",
    size: "Huge",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 95,
    hit_dice: "10d12",
    speed: "50 ft.",
    stats: [22, 9, 17, 2, 11, 5],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 10",
    languages: "",
    cr: "5",
    traits: [
      {
        name: "Trampling Charge",
        desc: "If the triceratops moves at least 20 ft. straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 13 Strength saving throw or be knocked prone. If the target is prone, the triceratops can make one stomp attack against it as a bonus action.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Gore",
        desc: "Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 24 (4d8 + 6) piercing damage.",
        attack_bonus: 9,
        damage_dice: "4d8",
        damage_bonus: 6
      },
      {
        name: "Stomp",
        desc: "Melee Weapon Attack: +9 to hit, reach 5 ft., one prone creature. Hit: 22 (3d10 + 6) bludgeoning damage",
        attack_bonus: 9,
        damage_dice: "3d10",
        damage_bonus: 6
      }
    ]
  },
  {
    name: "Troll",
    size: "Large",
    source: "SRD",
    type: "giant",
    subtype: "",
    alignment: "chaotic evil",
    ac: 15,
    hp: 84,
    hit_dice: "8d10",
    speed: "30 ft.",
    stats: [18, 13, 20, 7, 9, 7],
    skillsaves: [
      {
        perception: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 12",
    languages: "Giant",
    cr: "5",
    traits: [
      {
        name: "Keen Smell",
        desc: "The troll has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      },
      {
        name: "Regeneration",
        desc: "The troll regains 10 hit points at the start of its turn. If the troll takes acid or fire damage, this trait doesn't function at the start of the troll's next turn. The troll dies only if it starts its turn with 0 hit points and doesn't regenerate.",
        attack_bonus: 0
      },
      {
        name: "Variant: Loathsome Limbs",
        desc: "Whenever the troll takes at least 15 slashing damage at one time, roll a d20 to determine what else happens to it:\n1-10: Nothing else happens.\n11-14: One leg is severed from the troll if it has any legs left.\n15- 18: One arm is severed from the troll if it has any arms left.\n19-20: The troll is decapitated, but the troll dies only if it can't regenerate. If it dies, so does the severed head.\nIf the troll finishes a short or long rest without reattaching a severed limb or head, the part regrows. At that point, the severed part dies. Until then, a severed part acts on the troll's initiative and has its own action and movement. A severed part has AC 13, 10 hit points, and the troll's Regeneration trait.\nA severed leg is unable to attack and has a speed of 5 feet.\nA severed arm has a speed of 5 feet and can make one claw attack on its turn, with disadvantage on the attack roll unless the troll can see the arm and its target. Each time the troll loses an arm, it loses a claw attack.\nIf its head is severed, the troll loses its bite attack and its body is blinded unless the head can see it. The severed head has a speed of 0 feet and the troll's Keen Smell trait. It can make a bite attack but only against a target in its space.\nThe troll's speed is halved if it's missing a leg. If it loses both legs, it falls prone. If it has both arms, it can crawl. With only one arm, it can still crawl, but its speed is halved. With no arms or legs, its speed is 0, and it can't benefit from bonuses to speed.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The troll makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 7 (1d6 + 4) piercing damage.",
        attack_bonus: 7,
        damage_dice: "1d6",
        damage_bonus: 4
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Tyrannosaurus Rex",
    size: "Huge",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 136,
    hit_dice: "13d12",
    speed: "50 ft.",
    stats: [25, 10, 19, 2, 12, 9],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "",
    cr: "8",
    actions: [
      {
        name: "Multiattack",
        desc: "The tyrannosaurus makes two attacks: one with its bite and one with its tail. It can't make both attacks against the same target.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 33 (4d12 + 7) piercing damage. If the target is a Medium or smaller creature, it is grappled (escape DC 17). Until this grapple ends, the target is restrained, and the tyrannosaurus can't bite another target.",
        attack_bonus: 10,
        damage_dice: "4d12",
        damage_bonus: 7
      },
      {
        name: "Tail",
        desc: "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 20 (3d8 + 7) bludgeoning damage.",
        attack_bonus: 10,
        damage_dice: "3d8",
        damage_bonus: 7
      }
    ]
  },
  {
    name: "Unicorn",
    size: "Large",
    source: "SRD",
    type: "celestial",
    subtype: "",
    alignment: "lawful good",
    ac: 12,
    hp: 67,
    hit_dice: "9d10",
    speed: "50 ft.",
    stats: [18, 14, 15, 11, 17, 16],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "charmed, paralyzed, poisoned",
    senses: "darkvision 60 ft., passive Perception 13",
    languages: "Celestial, Elvish, Sylvan, telepathy 60 ft.",
    cr: "5",
    traits: [
      {
        name: "Charge",
        desc: "If the unicorn moves at least 20 ft. straight toward a target and then hits it with a horn attack on the same turn, the target takes an extra 9 (2d8) piercing damage. If the target is a creature, it must succeed on a DC 15 Strength saving throw or be knocked prone.",
        attack_bonus: 0,
        damage_dice: "2d8"
      },
      {
        name: "Innate Spellcasting",
        desc: "The unicorn's innate spellcasting ability is Charisma (spell save DC 14). The unicorn can innately cast the following spells, requiring no components:\n\nAt will: detect evil and good, druidcraft, pass without trace\n1/day each: calm emotions, dispel evil and good, entangle",
        attack_bonus: 0
      },
      {
        name: "Magic Resistance",
        desc: "The unicorn has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      },
      {
        name: "Magic Weapons",
        desc: "The unicorn's weapon attacks are magical.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The unicorn makes two attacks: one with its hooves and one with its horn.",
        attack_bonus: 0
      },
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft ., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Horn",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft ., one target. Hit: 8 (1d8 + 4) piercing damage.",
        attack_bonus: 7,
        damage_dice: "1d8",
        damage_bonus: 4
      },
      {
        name: "Healing Touch (3/Day)",
        desc: "The unicorn touches another creature with its horn. The target magically regains 11 (2d8 + 2) hit points. In addition, the touch removes all diseases and neutralizes all poisons afflicting the target.",
        attack_bonus: 0
      },
      {
        name: "Teleport (1/Day)",
        desc: "The unicorn magically teleports itself and up to three willing creatures it can see within 5 ft. of it, along with any equipment they are wearing or carrying, to a location the unicorn is familiar with, up to 1 mile away.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Hooves",
        desc: "The unicorn makes one attack with its hooves.",
        attack_bonus: 0
      },
      {
        name: "Shimmering Shield (Costs 2 Actions)",
        desc: "The unicorn creates a shimmering, magical field around itself or another creature it can see within 60 ft. of it. The target gains a +2 bonus to AC until the end of the unicorn's next turn.",
        attack_bonus: 0
      },
      {
        name: "Heal Self (Costs 3 Actions)",
        desc: "The unicorn magically regains 11 (2d8 + 2) hit points.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Vampire",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "shapechanger",
    alignment: "lawful evil",
    ac: 16,
    hp: 144,
    hit_dice: "17d8",
    speed: "30 ft.",
    stats: [18, 18, 18, 17, 15, 18],
    saves: [
      {
        dexterity: 9
      },
      {
        wisdom: 7
      },
      {
        charisma: 9
      }
    ],
    skillsaves: [
      {
        perception: 7
      },
      {
        stealth: 9
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "necrotic; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 120 ft., passive Perception 17",
    languages: "the languages it knew in life",
    cr: "13",
    traits: [
      {
        name: "Shapechanger",
        desc: "If the vampire isn't in sun light or running water, it can use its action to polymorph into a Tiny bat or a Medium cloud of mist, or back into its true form.\nWhile in bat form, the vampire can't speak, its walking speed is 5 feet, and it has a flying speed of 30 feet. Its statistics, other than its size and speed, are unchanged. Anything it is wearing transforms with it, but nothing it is carrying does. It reverts to its true form if it dies.\nWhile in mist form, the vampire can't take any actions, speak, or manipulate objects. It is weightless, has a flying speed of 20 feet, can hover, and can enter a hostile creature's space and stop there. In addition, if air can pass through a space, the mist can do so without squeezing, and it can't pass through water. It has advantage on Strength, Dexterity, and Constitution saving throws, and it is immune to all nonmagical damage, except the damage it takes from sunlight.",
        attack_bonus: 0
      },
      {
        name: "Legendary Resistance (3/Day)",
        desc: "If the vampire fails a saving throw, it can choose to succeed instead.",
        attack_bonus: 0
      },
      {
        name: "Misty Escape",
        desc: "When it drops to 0 hit points outside its resting place, the vampire transforms into a cloud of mist (as in the Shapechanger trait) instead of falling unconscious, provided that it isn't in sunlight or running water. If it can't transform, it is destroyed.\nWhile it has 0 hit points in mist form, it can't revert to its vampire form, and it must reach its resting place within 2 hours or be destroyed. Once in its resting place, it reverts to its vampire form. It is then paralyzed until it regains at least 1 hit point. After spending 1 hour in its resting place with 0 hit points, it regains 1 hit point.",
        attack_bonus: 0
      },
      {
        name: "Regeneration",
        desc: "The vampire regains 20 hit points at the start of its turn if it has at least 1 hit point and isn't in sunlight or running water. If the vampire takes radiant damage or damage from holy water, this trait doesn't function at the start of the vampire's next turn.",
        attack_bonus: 0
      },
      {
        name: "Spider Climb",
        desc: "The vampire can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      },
      {
        name: "Vampire Weaknesses",
        desc: "The vampire has the following flaws:\nForbiddance. The vampire can't enter a residence without an invitation from one of the occupants.\nHarmed by Running Water. The vampire takes 20 acid damage if it ends its turn in running water.\nStake to the Heart. If a piercing weapon made of wood is driven into the vampire's heart while the vampire is incapacitated in its resting place, the vampire is paralyzed until the stake is removed.\nSunlight Hypersensitivity. The vampire takes 20 radiant damage when it starts its turn in sunlight. While in sunlight, it has disadvantage on attack rolls and ability checks.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack (Vampire Form Only)",
        desc: "The vampire makes two attacks, only one of which can be a bite attack.",
        attack_bonus: 0
      },
      {
        name: "Unarmed Strike (Vampire Form Only)",
        desc: "Melee Weapon Attack: +9 to hit, reach 5 ft., one creature. Hit: 8 (1d8 + 4) bludgeoning damage. Instead of dealing damage, the vampire can grapple the target (escape DC 18).",
        attack_bonus: 9,
        damage_dice: "1d8",
        damage_bonus: 4
      },
      {
        name: "Bite (Bat or Vampire Form Only)",
        desc: "Melee Weapon Attack: +9 to hit, reach 5 ft., one willing creature, or a creature that is grappled by the vampire, incapacitated, or restrained. Hit: 7 (1d6 + 4) piercing damage plus 10 (3d6) necrotic damage. The target's hit point maximum is reduced by an amount equal to the necrotic damage taken, and the vampire regains hit points equal to that amount. The reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0. A humanoid slain in this way and then buried in the ground rises the following night as a vampire spawn under the vampire's control.",
        attack_bonus: 9,
        damage_dice: "1d6 + 3d6",
        damage_bonus: 4
      },
      {
        name: "Charm",
        desc: "The vampire targets one humanoid it can see within 30 ft. of it. If the target can see the vampire, the target must succeed on a DC 17 Wisdom saving throw against this magic or be charmed by the vampire. The charmed target regards the vampire as a trusted friend to be heeded and protected. Although the target isn't under the vampire's control, it takes the vampire's requests or actions in the most favorable way it can, and it is a willing target for the vampire's bit attack.\nEach time the vampire or the vampire's companions do anything harmful to the target, it can repeat the saving throw, ending the effect on itself on a success. Otherwise, the effect lasts 24 hours or until the vampire is destroyed, is on a different plane of existence than the target, or takes a bonus action to end the effect.",
        attack_bonus: 0
      },
      {
        name: "Children of the Night (1/Day)",
        desc: "The vampire magically calls 2d4 swarms of bats or rats, provided that the sun isn't up. While outdoors, the vampire can call 3d6 wolves instead. The called creatures arrive in 1d4 rounds, acting as allies of the vampire and obeying its spoken commands. The beasts remain for 1 hour, until the vampire dies, or until the vampire dismisses them as a bonus action.",
        attack_bonus: 0
      }
    ],
    legendary_actions: [
      {
        name: "Move",
        desc: "The vampire moves up to its speed without provoking opportunity attacks.",
        attack_bonus: 0
      },
      {
        name: "Unarmed Strike",
        desc: "The vampire makes one unarmed strike.",
        attack_bonus: 0
      },
      {
        name: "Bite (Costs 2 Actions)",
        desc: "The vampire makes one bite attack.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Vampire Spawn",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "neutral evil",
    ac: 15,
    hp: 82,
    hit_dice: "11d8",
    speed: "30 ft.",
    stats: [16, 16, 16, 11, 10, 12],
    saves: [
      {
        dexterity: 6
      },
      {
        wisdom: 3
      }
    ],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "necrotic; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 13",
    languages: "the languages it knew in life",
    cr: "5",
    traits: [
      {
        name: "Regeneration",
        desc: "The vampire regains 10 hit points at the start of its turn if it has at least 1 hit point and isn't in sunlight or running water. If the vampire takes radiant damage or damage from holy water, this trait doesn't function at the start of the vampire's next turn.",
        attack_bonus: 0
      },
      {
        name: "Spider Climb",
        desc: "The vampire can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",
        attack_bonus: 0
      },
      {
        name: "Vampire Weaknesses",
        desc: "The vampire has the following flaws:\nForbiddance. The vampire can't enter a residence without an invitation from one of the occupants.\nHarmed by Running Water. The vampire takes 20 acid damage when it ends its turn in running water.\nStake to the Heart. The vampire is destroyed if a piercing weapon made of wood is driven into its heart while it is incapacitated in its resting place.\nSunlight Hypersensitivity. The vampire takes 20 radiant damage when it starts its turn in sunlight. While in sunlight, it has disadvantage on attack rolls and ability checks.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The vampire makes two attacks, only one of which can be a bite attack.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one willing creature, or a creature that is grappled by the vampire, incapacitated, or restrained. Hit: 6 (1d6 + 3) piercing damage plus 7 (2d6) necrotic damage. The target's hit point maximum is reduced by an amount equal to the necrotic damage taken, and the vampire regains hit points equal to that amount. The reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",
        attack_bonus: 61
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 8 (2d4 + 3) slashing damage. Instead of dealing damage, the vampire can grapple the target (escape DC 13).",
        attack_bonus: 6,
        damage_dice: "2d4",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Veteran",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "any race",
    alignment: "any alignment",
    ac: 17,
    hp: 58,
    hit_dice: "9d8",
    speed: "30 ft.",
    stats: [16, 13, 14, 10, 11, 10],
    skillsaves: [
      {
        athletics: 5
      },
      {
        perception: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 12",
    languages: "any one language (usually Common)",
    cr: "3",
    actions: [
      {
        name: "Multiattack",
        desc: "The veteran makes two longsword attacks. If it has a shortsword drawn, it can also make a shortsword attack.",
        attack_bonus: 0
      },
      {
        name: "Longsword",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage, or 8 (1d10 + 3) slashing damage if used with two hands.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Shortsword",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Heavy Crossbow",
        desc: "Ranged Weapon Attack: +3 to hit, range 100/400 ft., one target. Hit: 6 (1d10 + 1) piercing damage.",
        attack_bonus: 3,
        damage_dice: "1d10",
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Violet Fungus",
    size: "Medium",
    source: "SRD",
    type: "plant",
    subtype: "",
    alignment: "unaligned",
    ac: 5,
    hp: 18,
    hit_dice: "4d8",
    speed: "5 ft.",
    stats: [3, 1, 10, 1, 3, 1],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "blinded, deafened, frightened",
    senses: "blindsight 30 ft. (blind beyond this radius), passive Perception 6",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "False Appearance",
        desc: "While the violet fungus remains motionless, it is indistinguishable from an ordinary fungus.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The fungus makes 1d4 Rotting Touch attacks.",
        attack_bonus: 0
      },
      {
        name: "Rotting Touch",
        desc: "Melee Weapon Attack: +2 to hit, reach 10 ft., one creature. Hit: 4 (1d8) necrotic damage.",
        attack_bonus: 2,
        damage_dice: "1d8"
      }
    ]
  },
  {
    name: "Vrock",
    size: "Large",
    source: "SRD",
    type: "fiend",
    subtype: "demon",
    alignment: "chaotic evil",
    ac: 15,
    hp: 104,
    hit_dice: "11d10",
    speed: "40 ft., fly 60 ft.",
    stats: [17, 15, 18, 8, 13, 8],
    saves: [
      {
        dexterity: 5
      },
      {
        wisdom: 4
      },
      {
        charisma: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "darkvision 120 ft., passive Perception 11",
    languages: "Abyssal, telepathy 120 ft.",
    cr: "6",
    traits: [
      {
        name: "Magic Resistance",
        desc: "The vrock has advantage on saving throws against spells and other magical effects.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The vrock makes two attacks: one with its beak and one with its talons.",
        attack_bonus: 0
      },
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 3
      },
      {
        name: "Talons",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 14 (2d10 + 3) slashing damage.",
        attack_bonus: 6,
        damage_dice: "2d10",
        damage_bonus: 3
      },
      {
        name: "Spores (Recharge 6)",
        desc: "A 15-foot-radius cloud of toxic spores extends out from the vrock. The spores spread around corners. Each creature in that area must succeed on a DC 14 Constitution saving throw or become poisoned. While poisoned in this way, a target takes 5 (1d10) poison damage at the start of each of its turns. A target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. Emptying a vial of holy water on the target also ends the effect on it.",
        attack_bonus: 0
      },
      {
        name: "Stunning Screech (1/Day)",
        desc: "The vrock emits a horrific screech. Each creature within 20 feet of it that can hear it and that isn't a demon must succeed on a DC 14 Constitution saving throw or be stunned until the end of the vrock's next turn .",
        attack_bonus: 0
      },
      {
        name: "Variant: Summon Demon (1/Day)",
        desc: "The demon chooses what to summon and attempts a magical summoning.\nA vrock has a 30 percent chance of summoning 2d4 dretches or one vrock.\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Vulture",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 10,
    hp: 5,
    hit_dice: "1d8",
    speed: "10 ft., fly 50 ft.",
    stats: [7, 10, 13, 2, 12, 4],
    skillsaves: [
      {
        perception: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Keen Sight and Smell",
        desc: "The vulture has advantage on Wisdom (Perception) checks that rely on sight or smell.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The vulture has advantage on an attack roll against a creature if at least one of the vulture's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Beak",
        desc: "Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) piercing damage.",
        attack_bonus: 2,
        damage_dice: "1d4"
      }
    ]
  },
  {
    name: "Warhorse",
    size: "Large",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 11,
    hp: 19,
    hit_dice: "3d10",
    speed: "60 ft.",
    stats: [18, 12, 13, 2, 12, 7],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 11",
    languages: "",
    cr: "1/2",
    traits: [
      {
        name: "Trampling Charge",
        desc: "If the horse moves at least 20 ft. straight toward a creature and then hits it with a hooves attack on the same turn, that target must succeed on a DC 14 Strength saving throw or be knocked prone. If the target is prone, the horse can make another attack with its hooves against it as a bonus action.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Warhorse Skeleton",
    size: "Large",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "lawful evil",
    ac: 13,
    hp: 22,
    hit_dice: "3d10",
    speed: "60 ft.",
    stats: [18, 12, 15, 2, 8, 5],
    damage_vulnerabilities: "bludgeoning",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "exhaustion, poisoned",
    senses: "darkvision 60 ft., passive Perception 9",
    languages: "",
    cr: "1/2",
    actions: [
      {
        name: "Hooves",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Water Elemental",
    size: "Large",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral",
    ac: 14,
    hp: 114,
    hit_dice: "12d10",
    speed: "30 ft., swim 90 ft.",
    stats: [18, 14, 18, 5, 10, 8],
    damage_vulnerabilities: "",
    damage_resistances: "acid; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "poison",
    condition_immunities: "exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",
    senses: "darkvision 60 ft., passive Perception 10",
    languages: "Aquan",
    cr: "5",
    traits: [
      {
        name: "Water Form",
        desc: "The elemental can enter a hostile creature's space and stop there. It can move through a space as narrow as 1 inch wide without squeezing.",
        attack_bonus: 0
      },
      {
        name: "Freeze",
        desc: "If the elemental takes cold damage, it partially freezes; its speed is reduced by 20 ft. until the end of its next turn.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The elemental makes two slam attacks.",
        attack_bonus: 0
      },
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",
        attack_bonus: 7,
        damage_dice: "2d8",
        damage_bonus: 4
      },
      {
        name: "Whelm (Recharge 4-6)",
        desc: "Each creature in the elemental's space must make a DC 15 Strength saving throw. On a failure, a target takes 13 (2d8 + 4) bludgeoning damage. If it is Large or smaller, it is also grappled (escape DC 14). Until this grapple ends, the target is restrained and unable to breathe unless it can breathe water. If the saving throw is successful, the target is pushed out of the elemental's space.\nThe elemental can grapple one Large creature or up to two Medium or smaller creatures at one time. At the start of each of the elemental's turns, each target grappled by it takes 13 (2d8 + 4) bludgeoning damage. A creature within 5 feet of the elemental can pull a creature or object out of it by taking an action to make a DC 14 Strength and succeeding.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Weasel",
    size: "Tiny",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 1,
    hit_dice: "1d4",
    speed: "30 ft.",
    stats: [3, 16, 8, 2, 12, 3],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "0",
    traits: [
      {
        name: "Keen Hearing and Smell",
        desc: "The weasel has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 1 piercing damage.",
        attack_bonus: 5,
        damage_bonus: 1
      }
    ]
  },
  {
    name: "Werebear",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "human",
    alignment: "neutral good",
    ac: 10,
    hp: 135,
    hit_dice: "18d8",
    speed: "30 ft. (40 ft., climb 30 ft. in bear or hybrid form)",
    stats: [19, 10, 17, 11, 12, 12],
    skillsaves: [
      {
        perception: 7
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",
    condition_immunities: "",
    senses: "passive Perception 17",
    languages: "Common (can't speak in bear form)",
    cr: "5",
    traits: [
      {
        name: "Shapechanger",
        desc: "The werebear can use its action to polymorph into a Large bear-humanoid hybrid or into a Large bear, or back into its true form, which is humanoid. Its statistics, other than its size and AC, are the same in each form. Any equipment it. is wearing or carrying isn't transformed. It reverts to its true form if it dies.",
        attack_bonus: 0
      },
      {
        name: "Keen Smell",
        desc: "The werebear has advantage on WisGlom (Perception) checks that rely on smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "In bear form, the werebear makes two claw attacks. In humanoid form, it makes two greataxe attacks. In hybrid form, it can attack like a bear or a humanoid.",
        attack_bonus: 0
      },
      {
        name: "Bite (Bear or Hybrid Form Only)",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 15 (2d10 + 4) piercing damage. If the target is a humanoid, it must succeed on a DC 14 Constitution saving throw or be cursed with were bear lycanthropy.",
        attack_bonus: 7,
        damage_dice: "2d10",
        damage_bonus: 4
      },
      {
        name: "Claw (Bear or Hybrid Form Only)",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d8",
        damage_bonus: 4
      },
      {
        name: "Greataxe (Humanoid or Hybrid Form Only)",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 10 (1d12 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "1d12",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Wereboar",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "human",
    alignment: "neutral evil",
    ac: 10,
    hp: 78,
    hit_dice: "12d8",
    speed: "30 ft. (40 ft. in boar form)",
    stats: [17, 10, 15, 10, 11, 8],
    skillsaves: [
      {
        perception: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",
    condition_immunities: "",
    senses: "passive Perception 12",
    languages: "Common (can't speak in boar form)",
    cr: "4",
    traits: [
      {
        name: "Shapechanger",
        desc: "The wereboar can use its action to polymorph into a boar-humanoid hybrid or into a boar, or back into its true form, which is humanoid. Its statistics, other than its AC, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",
        attack_bonus: 0
      },
      {
        name: "Charge (Boar or Hybrid Form Only)",
        desc: "If the wereboar moves at least 15 feet straight toward a target and then hits it with its tusks on the same turn, the target takes an extra 7 (2d6) slashing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",
        attack_bonus: 0,
        damage_dice: "2d6"
      },
      {
        name: "Relentless (Recharges after a Short or Long Rest)",
        desc: "If the wereboar takes 14 damage or less that would reduce it to 0 hit points, it is reduced to 1 hit point instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack (Humanoid or Hybrid Form Only)",
        desc: "The wereboar makes two attacks, only one of which can be with its tusks.",
        attack_bonus: 0
      },
      {
        name: "Maul (Humanoid or Hybrid Form Only)",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      },
      {
        name: "Tusks (Boar or Hybrid Form Only)",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage. If the target is a humanoid, it must succeed on a DC 12 Constitution saving throw or be cursed with wereboar lycanthropy.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Wererat",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "human",
    alignment: "lawful evil",
    ac: 12,
    hp: 33,
    hit_dice: "6d8",
    speed: "30 ft.",
    stats: [10, 15, 12, 11, 10, 8],
    skillsaves: [
      {
        perception: 2
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",
    condition_immunities: "",
    senses: "darkvision 60 ft. (rat form only), passive Perception 12",
    languages: "Common (can't speak in rat form)",
    cr: "2",
    traits: [
      {
        name: "Shapechanger",
        desc: "The wererat can use its action to polymorph into a rat-humanoid hybrid or into a giant rat, or back into its true form, which is humanoid. Its statistics, other than its size, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",
        attack_bonus: 0
      },
      {
        name: "Keen Smell",
        desc: "The wererat has advantage on Wisdom (Perception) checks that rely on smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack (Humanoid or Hybrid Form Only)",
        desc: "The wererat makes two attacks, only one of which can be a bite.",
        attack_bonus: 0
      },
      {
        name: "Bite (Rat or Hybrid Form Only).",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage. If the target is a humanoid, it must succeed on a DC 11 Constitution saving throw or be cursed with wererat lycanthropy.",
        attack_bonus: 4,
        damage_dice: "1d4",
        damage_bonus: 2
      },
      {
        name: "Shortsword (Humanoid or Hybrid Form Only)",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Hand Crossbow (Humanoid or Hybrid Form Only)",
        desc: "Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Weretiger",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "human",
    alignment: "neutral",
    ac: 12,
    hp: 120,
    hit_dice: "16d8",
    speed: "30 ft. (40 ft. in tiger form)",
    stats: [17, 15, 16, 10, 13, 11],
    skillsaves: [
      {
        perception: 5
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 15",
    languages: "Common (can't speak in tiger form)",
    cr: "4",
    traits: [
      {
        name: "Shapechanger",
        desc: "The weretiger can use its action to polymorph into a tiger-humanoid hybrid or into a tiger, or back into its true form, which is humanoid. Its statistics, other than its size, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",
        attack_bonus: 0
      },
      {
        name: "Keen Hearing and Smell",
        desc: "The weretiger has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      },
      {
        name: "Pounce (Tiger or Hybrid Form Only)",
        desc: "If the weretiger moves at least 15 feet straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 14 Strength saving throw or be knocked prone. If the target is prone, the weretiger can make one bite attack against it as a bonus action.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack (Humanoid or Hybrid Form Only)",
        desc: "In humanoid form, the weretiger makes two scimitar attacks or two longbow attacks. In hybrid form, it can attack like a humanoid or make two claw attacks.",
        attack_bonus: 0
      },
      {
        name: "Bite (Tiger or Hybrid Form Only)",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage. If the target is a humanoid, it must succeed on a DC 13 Constitution saving throw or be cursed with weretiger lycanthropy.",
        attack_bonus: 5,
        damage_dice: "1d10",
        damage_bonus: 3
      },
      {
        name: "Claw (Tiger or Hybrid Form Only)",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "1d8",
        damage_bonus: 3
      },
      {
        name: "Scimitar (Humanoid or Hybrid Form Only)",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",
        attack_bonus: 5,
        damage_dice: "1d6",
        damage_bonus: 3
      },
      {
        name: "Longbow (Humanoid or Hybrid Form Only)",
        desc: "Ranged Weapon Attack: +4 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Werewolf",
    size: "Medium",
    source: "SRD",
    type: "humanoid",
    subtype: "human",
    alignment: "chaotic evil",
    ac: 11,
    hp: 58,
    hit_dice: "9d8",
    speed: "30 ft. (40 ft. in wolf form)",
    stats: [15, 13, 14, 10, 11, 10],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",
    condition_immunities: "",
    senses: "passive Perception 14",
    languages: "Common (can't speak in wolf form)",
    cr: "3",
    traits: [
      {
        name: "Shapechanger",
        desc: "The werewolf can use its action to polymorph into a wolf-humanoid hybrid or into a wolf, or back into its true form, which is humanoid. Its statistics, other than its AC, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",
        attack_bonus: 0
      },
      {
        name: "Keen Hearing and Smell",
        desc: "The werewolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack (Humanoid or Hybrid Form Only)",
        desc: "The werewolf makes two attacks: one with its bite and one with its claws or spear.",
        attack_bonus: 0
      },
      {
        name: "Bite (Wolf or Hybrid Form Only)",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage. If the target is a humanoid, it must succeed on a DC 12 Constitution saving throw or be cursed with werewolf lycanthropy.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      },
      {
        name: "Claws (Hybrid Form Only)",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (2d4 + 2) slashing damage.",
        attack_bonus: 4,
        damage_dice: "2d4",
        damage_bonus: 2
      },
      {
        name: "Spear (Humanoid Form Only)",
        desc: "Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 20/60 ft., one creature. Hit: 5 (1d6 + 2) piercing damage, or 6 (1d8 + 2) piercing damage if used with two hands to make a melee attack.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: -2
      }
    ]
  },
  {
    name: "White Dragon Wyrmling",
    size: "Medium",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 16,
    hp: 32,
    hit_dice: "5d8",
    speed: "30 ft., burrow 15 ft., fly 60 ft., swim 30 ft.",
    stats: [14, 10, 14, 5, 10, 11],
    saves: [
      {
        dexterity: 2
      },
      {
        constitution: 4
      },
      {
        wisdom: 2
      },
      {
        charisma: 2
      }
    ],
    skillsaves: [
      {
        perception: 4
      },
      {
        stealth: 2
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold",
    condition_immunities: "",
    senses: "blindsight 10 ft., darkvision 60 ft., passive Perception 14",
    languages: "Draconic",
    cr: "2",
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 2 (1d4) cold damage.",
        attack_bonus: 4,
        damage_dice: "1d10 + 1d4",
        damage_bonus: 2
      },
      {
        name: "Cold Breath (Recharge 5-6)",
        desc: "The dragon exhales an icy blast of hail in a 15-foot cone. Each creature in that area must make a DC 12 Constitution saving throw, taking 22 (5d8) cold damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "5d8"
      }
    ]
  },
  {
    name: "Wight",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "neutral evil",
    ac: 14,
    hp: 45,
    hit_dice: "6d8",
    speed: "30 ft.",
    stats: [15, 14, 16, 10, 13, 15],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "necrotic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 13",
    languages: "the languages it knew in life",
    cr: "3",
    traits: [
      {
        name: "Sunlight Sensitivity",
        desc: "While in sunlight, the wight has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The wight makes two longsword attacks or two longbow attacks. It can use its Life Drain in place of one longsword attack.",
        attack_bonus: 0
      },
      {
        name: "Life Drain",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) necrotic damage. The target must succeed on a DC 13 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.\nA humanoid slain by this attack rises 24 hours later as a zombie under the wight's control, unless the humanoid is restored to life or its body is destroyed. The wight can have no more than twelve zombies under its control at one time.",
        attack_bonus: 4,
        damage_dice: "1d6",
        damage_bonus: 2
      },
      {
        name: "Longsword",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) slashing damage, or 7 (1d10 + 2) slashing damage if used with two hands.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      },
      {
        name: "Longbow",
        desc: "Ranged Weapon Attack: +4 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",
        attack_bonus: 4,
        damage_dice: "1d8",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Will-o'-Wisp",
    size: "Tiny",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "chaotic evil",
    ac: 19,
    hp: 22,
    hit_dice: "9d4",
    speed: "0 ft., fly 50 ft. (hover)",
    stats: [1, 28, 10, 13, 14, 11],
    damage_vulnerabilities: "",
    damage_resistances: "acid, cold, fire, necrotic, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",
    damage_immunities: "lightning, poison",
    condition_immunities: "exhaustion, grappled, paralyzed, poisoned, prone, restrained, unconscious",
    senses: "darkvision 120 ft., passive Perception 12",
    languages: "the languages it knew in life",
    cr: "2",
    traits: [
      {
        name: "Consume Life",
        desc: "As a bonus action, the will-o'-wisp can target one creature it can see within 5 ft. of it that has 0 hit points and is still alive. The target must succeed on a DC 10 Constitution saving throw against this magic or die. If the target dies, the will-o'-wisp regains 10 (3d6) hit points.",
        attack_bonus: 0
      },
      {
        name: "Ephemeral",
        desc: "The will-o'-wisp can't wear or carry anything.",
        attack_bonus: 0
      },
      {
        name: "Incorporeal Movement",
        desc: "The will-o'-wisp can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",
        attack_bonus: 0
      },
      {
        name: "Variable Illumination",
        desc: "The will-o'-wisp sheds bright light in a 5- to 20-foot radius and dim light for an additional number of ft. equal to the chosen radius. The will-o'-wisp can alter the radius as a bonus action.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Shock",
        desc: "Melee Spell Attack: +4 to hit, reach 5 ft., one creature. Hit: 9 (2d8) lightning damage.",
        attack_bonus: 4,
        damage_dice: "2d8"
      },
      {
        name: "Invisibility",
        desc: "The will-o'-wisp and its light magically become invisible until it attacks or uses its Consume Life, or until its concentration ends (as if concentrating on a spell).",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Winter Wolf",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "neutral evil",
    ac: 13,
    hp: 75,
    hit_dice: "10d10",
    speed: "50 ft.",
    stats: [18, 13, 14, 7, 12, 8],
    skillsaves: [
      {
        perception: 5
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold",
    condition_immunities: "",
    senses: "passive Perception 15",
    languages: "Common, Giant, Winter Wolf",
    cr: "3",
    traits: [
      {
        name: "Keen Hearing and Smell",
        desc: "The wolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The wolf has advantage on an attack roll against a creature if at least one of the wolf's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      },
      {
        name: "Snow Camouflage",
        desc: "The wolf has advantage on Dexterity (Stealth) checks made to hide in snowy terrain.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) piercing damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be knocked prone.",
        attack_bonus: 6,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Cold Breath (Recharge 5-6)",
        desc: "The wolf exhales a blast of freezing wind in a 15-foot cone. Each creature in that area must make a DC 12 Dexterity saving throw, taking 18 (4d8) cold damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "4d8"
      }
    ]
  },
  {
    name: "Wolf",
    size: "Medium",
    source: "SRD",
    type: "beast",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 11,
    hit_dice: "2d8",
    speed: "40 ft.",
    stats: [12, 15, 12, 3, 12, 6],
    skillsaves: [
      {
        perception: 3
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "passive Perception 13",
    languages: "",
    cr: "1/4",
    traits: [
      {
        name: "Keen Hearing and Smell",
        desc: "The wolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      },
      {
        name: "Pack Tactics",
        desc: "The wolf has advantage on an attack roll against a creature if at least one of the wolf's allies is within 5 ft. of the creature and the ally isn't incapacitated.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) piercing damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",
        attack_bonus: 4,
        damage_dice: "2d4",
        damage_bonus: 2
      }
    ]
  },
  {
    name: "Worg",
    size: "Large",
    source: "SRD",
    type: "monstrosity",
    subtype: "",
    alignment: "neutral evil",
    ac: 13,
    hp: 26,
    hit_dice: "4d10",
    speed: "50 ft.",
    stats: [16, 13, 13, 7, 11, 8],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "Goblin, Worg",
    cr: "1/2",
    traits: [
      {
        name: "Keen Hearing and Smell",
        desc: "The worg has advantage on Wisdom (Perception) checks that rely on hearing or smell.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",
        attack_bonus: 5,
        damage_dice: "2d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Wraith",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "neutral evil",
    ac: 13,
    hp: 67,
    hit_dice: "9d8",
    speed: "0 ft., fly 60 ft. (hover)",
    stats: [6, 16, 16, 12, 14, 15],
    damage_vulnerabilities: "",
    damage_resistances: "acid, cold, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",
    damage_immunities: "necrotic, poison",
    condition_immunities: "charmed, exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained",
    senses: "darkvision 60 ft., passive Perception 12",
    languages: "the languages it knew in life",
    cr: "5",
    traits: [
      {
        name: "Incorporeal Movement",
        desc: "The wraith can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",
        attack_bonus: 0
      },
      {
        name: "Sunlight Sensitivity",
        desc: "While in sunlight, the wraith has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Life Drain",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 21 (4d8 + 3) necrotic damage. The target must succeed on a DC 14 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",
        attack_bonus: 6,
        damage_dice: "4d8",
        damage_bonus: 3
      },
      {
        name: "Create Specter",
        desc: "The wraith targets a humanoid within 10 feet of it that has been dead for no longer than 1 minute and died violently. The target's spirit rises as a specter in the space of its corpse or in the nearest unoccupied space. The specter is under the wraith's control. The wraith can have no more than seven specters under its control at one time.",
        attack_bonus: 0
      }
    ]
  },
  {
    name: "Wyvern",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "unaligned",
    ac: 13,
    hp: 110,
    hit_dice: "13d10",
    speed: "20 ft., fly 80 ft.",
    stats: [19, 10, 16, 5, 12, 6],
    skillsaves: [
      {
        perception: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., passive Perception 14",
    languages: "",
    cr: "6",
    actions: [
      {
        name: "Multiattack",
        desc: "The wyvern makes two attacks: one with its bite and one with its stinger. While flying, it can use its claws in place of one other attack.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 10 ft., one creature. Hit: 11 (2d6 + 4) piercing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Claws",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d8",
        damage_bonus: 4
      },
      {
        name: "Stinger",
        desc: "Melee Weapon Attack: +7 to hit, reach 10 ft., one creature. Hit: 11 (2d6 + 4) piercing damage. The target must make a DC 15 Constitution saving throw, taking 24 (7d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      }
    ]
  },
  {
    name: "Xorn",
    size: "Medium",
    source: "SRD",
    type: "elemental",
    subtype: "",
    alignment: "neutral",
    ac: 19,
    hp: 73,
    hit_dice: "7d8",
    speed: "20 ft., burrow 20 ft.",
    stats: [17, 10, 22, 11, 10, 11],
    skillsaves: [
      {
        perception: 6
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "piercing and slashing from nonmagical weapons that aren't adamantine",
    damage_immunities: "",
    condition_immunities: "",
    senses: "darkvision 60 ft., tremorsense 60 ft., passive Perception 16",
    languages: "Terran",
    cr: "5",
    traits: [
      {
        name: "Earth Glide",
        desc: "The xorn can burrow through nonmagical, unworked earth and stone. While doing so, the xorn doesn't disturb the material it moves through.",
        attack_bonus: 0
      },
      {
        name: "Stone Camouflage",
        desc: "The xorn has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",
        attack_bonus: 0
      },
      {
        name: "Treasure Sense",
        desc: "The xorn can pinpoint, by scent, the location of precious metals and stones, such as coins and gems, within 60 ft. of it.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The xorn makes three claw attacks and one bite attack.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (3d6 + 3) piercing damage.",
        attack_bonus: 6,
        damage_dice: "3d6",
        damage_bonus: 3
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",
        attack_bonus: 6,
        damage_dice: "1d6",
        damage_bonus: 3
      }
    ]
  },
  {
    name: "Young Black Dragon",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 18,
    hp: 127,
    hit_dice: "15d10",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [19, 14, 17, 12, 11, 15],
    saves: [
      {
        dexterity: 5
      },
      {
        constitution: 6
      },
      {
        wisdom: 3
      },
      {
        charisma: 5
      }
    ],
    skillsaves: [
      {
        perception: 6
      },
      {
        stealth: 5
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid",
    condition_immunities: "",
    senses: "blindsight 30 ft., darkvision 120 ft., passive Perception 16",
    languages: "Common, Draconic",
    cr: "7",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage plus 4 (1d8) acid damage.",
        attack_bonus: 7,
        damage_dice: "2d10 + 1d8",
        damage_bonus: 4
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Acid Breath (Recharge 5-6)",
        desc: "The dragon exhales acid in a 30-foot line that is 5 feet wide. Each creature in that line must make a DC 14 Dexterity saving throw, taking 49 (11d8) acid damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "11d8"
      }
    ]
  },
  {
    name: "Young Blue Dragon",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful evil",
    ac: 18,
    hp: 152,
    hit_dice: "16d10",
    speed: "40 ft., burrow 40 ft., fly 80 ft.",
    stats: [21, 10, 19, 14, 13, 17],
    saves: [
      {
        dexterity: 4
      },
      {
        constitution: 8
      },
      {
        wisdom: 5
      },
      {
        charisma: 7
      }
    ],
    skillsaves: [
      {
        perception: 9
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning",
    condition_immunities: "",
    senses: "blindsight 30 ft., darkvision 120 ft., passive Perception 19",
    languages: "Common, Draconic",
    cr: "9",
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 16 (2d10 + 5) piercing damage plus 5 (1d10) lightning damage.",
        attack_bonus: 9,
        damage_dice: "2d10 + 1d10",
        damage_bonus: 5
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",
        attack_bonus: 9,
        damage_dice: "2d6",
        damage_bonus: 5
      },
      {
        name: "Lightning Breath (Recharge 5-6)",
        desc: "The dragon exhales lightning in an 60-foot line that is 5 feet wide. Each creature in that line must make a DC 16 Dexterity saving throw, taking 55 (10d10) lightning damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "10d10"
      }
    ]
  },
  {
    name: "Young Brass Dragon",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic good",
    ac: 17,
    hp: 110,
    hit_dice: "13d10",
    speed: "40 ft., burrow 20 ft., fly 80 ft.",
    stats: [19, 10, 17, 12, 11, 15],
    saves: [
      {
        dexterity: 3
      },
      {
        constitution: 6
      },
      {
        wisdom: 3
      },
      {
        charisma: 5
      }
    ],
    skillsaves: [
      {
        perception: 6
      },
      {
        persuasion: 5
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 30 ft., darkvision 120 ft., passive Perception 16",
    languages: "Common, Draconic",
    cr: "6",
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage.",
        attack_bonus: 7,
        damage_dice: "2d10",
        damage_bonus: 4
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nFire Breath. The dragon exhales fire in a 40-foot line that is 5 feet wide. Each creature in that line must make a DC 14 Dexterity saving throw, taking 42 (12d6) fire damage on a failed save, or half as much damage on a successful one.\nSleep Breath. The dragon exhales sleep gas in a 30-foot cone. Each creature in that area must succeed on a DC 14 Constitution saving throw or fall unconscious for 5 minutes. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.",
        attack_bonus: 0,
        damage_dice: "12d6"
      }
    ]
  },
  {
    name: "Young Bronze Dragon",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 18,
    hp: 142,
    hit_dice: "15d10",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [21, 10, 19, 14, 13, 17],
    saves: [
      {
        dexterity: 3
      },
      {
        constitution: 7
      },
      {
        wisdom: 4
      },
      {
        charisma: 6
      }
    ],
    skillsaves: [
      {
        insight: 4
      },
      {
        perception: 7
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "lightning",
    condition_immunities: "",
    senses: "blindsight 30 ft., darkvision 120 ft., passive Perception 17",
    languages: "Common, Draconic",
    cr: "8",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 16 (2d10 + 5) piercing damage.",
        attack_bonus: 8,
        damage_dice: "2d10",
        damage_bonus: 5
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",
        attack_bonus: 8,
        damage_dice: "2d6",
        damage_bonus: 5
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nLightning Breath. The dragon exhales lightning in a 60-foot line that is 5 feet wide. Each creature in that line must make a DC 15 Dexterity saving throw, taking 55 (10d10) lightning damage on a failed save, or half as much damage on a successful one.\nRepulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 15 Strength saving throw. On a failed save, the creature is pushed 40 feet away from the dragon.",
        attack_bonus: 0,
        damage_dice: "10d10"
      }
    ]
  },
  {
    name: "Young Copper Dragon",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic good",
    ac: 17,
    hp: 119,
    hit_dice: "14d10",
    speed: "40 ft., climb 40 ft., fly 80 ft.",
    stats: [19, 12, 17, 16, 13, 15],
    saves: [
      {
        dexterity: 4
      },
      {
        constitution: 6
      },
      {
        wisdom: 4
      },
      {
        charisma: 5
      }
    ],
    skillsaves: [
      {
        deception: 5
      },
      {
        perception: 7
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "acid",
    condition_immunities: "",
    senses: "blindsight 30 ft., darkvision 120 ft., passive Perception 17",
    languages: "Common, Draconic",
    cr: "7",
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage.",
        attack_bonus: 7,
        damage_dice: "2d10",
        damage_bonus: 4
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nAcid Breath. The dragon exhales acid in an 40-foot line that is 5 feet wide. Each creature in that line must make a DC 14 Dexterity saving throw, taking 40 (9d8) acid damage on a failed save, or half as much damage on a successful one.\nSlowing Breath. The dragon exhales gas in a 30-foot cone. Each creature in that area must succeed on a DC 14 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.",
        attack_bonus: 0,
        damage_dice: "9d8"
      }
    ]
  },
  {
    name: "Young Gold Dragon",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 18,
    hp: 178,
    hit_dice: "17d10",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [23, 14, 21, 16, 13, 20],
    saves: [
      {
        dexterity: 6
      },
      {
        constitution: 9
      },
      {
        wisdom: 5
      },
      {
        charisma: 9
      }
    ],
    skillsaves: [
      {
        insight: 5
      },
      {
        perception: 9
      },
      {
        persuasion: 9
      },
      {
        stealth: 6
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 30 ft., darkvision 120 ft., passive Perception 19",
    languages: "Common, Draconic",
    cr: "10",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",
        attack_bonus: 10,
        damage_dice: "2d10",
        damage_bonus: 6
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",
        attack_bonus: 10,
        damage_dice: "2d6",
        damage_bonus: 6
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nFire Breath. The dragon exhales fire in a 30-foot cone. Each creature in that area must make a DC 17 Dexterity saving throw, taking 55 (10d10) fire damage on a failed save, or half as much damage on a successful one.\nWeakening Breath. The dragon exhales gas in a 30-foot cone. Each creature in that area must succeed on a DC 17 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0,
        damage_dice: "10d10"
      }
    ]
  },
  {
    name: "Young Green Dragon",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful evil",
    ac: 18,
    hp: 136,
    hit_dice: "16d10",
    speed: "40 ft., fly 80 ft., swim 40 ft.",
    stats: [19, 12, 17, 16, 13, 15],
    saves: [
      {
        dexterity: 4
      },
      {
        constitution: 6
      },
      {
        wisdom: 4
      },
      {
        charisma: 5
      }
    ],
    skillsaves: [
      {
        deception: 5
      },
      {
        perception: 7
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "poison",
    condition_immunities: "poisoned",
    senses: "blindsight 30 ft., darkvision 120 ft., passive Perception 17",
    languages: "Common, Draconic",
    cr: "8",
    traits: [
      {
        name: "Amphibious",
        desc: "The dragon can breathe air and water.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage plus 7 (2d6) poison damage.",
        attack_bonus: 7,
        damage_dice: "2d10 + 2d6",
        damage_bonus: 4
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Poison Breath (Recharge 5-6)",
        desc: "The dragon exhales poisonous gas in a 30-foot cone. Each creature in that area must make a DC 14 Constitution saving throw, taking 42 (12d6) poison damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "12d6"
      }
    ]
  },
  {
    name: "Young Red Dragon",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 18,
    hp: 178,
    hit_dice: "17d10",
    speed: "40 ft., climb 40 ft., fly 80 ft.",
    stats: [23, 10, 21, 14, 11, 19],
    saves: [
      {
        dexterity: 4
      },
      {
        constitution: 9
      },
      {
        wisdom: 4
      },
      {
        charisma: 8
      }
    ],
    skillsaves: [
      {
        perception: 8
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "fire",
    condition_immunities: "",
    senses: "blindsight 30 ft., darkvision 120 ft., passive Perception 18",
    languages: "Common, Draconic",
    cr: "10",
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 3 (1d6) fire damage.",
        attack_bonus: 10,
        damage_dice: "2d10 + 1d6",
        damage_bonus: 6
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",
        attack_bonus: 10,
        damage_dice: "2d6",
        damage_bonus: 6
      },
      {
        name: "Fire Breath (Recharge 5-6)",
        desc: "The dragon exhales fire in a 30-foot cone. Each creature in that area must make a DC 17 Dexterity saving throw, taking 56 (16d6) fire damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "16d6"
      }
    ]
  },
  {
    name: "Young Silver Dragon",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "lawful good",
    ac: 18,
    hp: 168,
    hit_dice: "16d10",
    speed: "40 ft., fly 80 ft.",
    stats: [23, 10, 21, 14, 11, 19],
    saves: [
      {
        dexterity: 4
      },
      {
        constitution: 9
      },
      {
        wisdom: 4
      },
      {
        charisma: 8
      }
    ],
    skillsaves: [
      {
        arcana: 6
      },
      {
        history: 6
      },
      {
        perception: 8
      },
      {
        stealth: 4
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold",
    condition_immunities: "",
    senses: "blindsight 30 ft., darkvision 120 ft., passive Perception 18",
    languages: "Common, Draconic",
    cr: "9",
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",
        attack_bonus: 10,
        damage_dice: "2d10",
        damage_bonus: 6
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",
        attack_bonus: 10,
        damage_dice: "2d6",
        damage_bonus: 6
      },
      {
        name: "Breath Weapons (Recharge 5-6)",
        desc: "The dragon uses one of the following breath weapons.\nCold Breath. The dragon exhales an icy blast in a 30-foot cone. Each creature in that area must make a DC 17 Constitution saving throw, taking 54 (12d8) cold damage on a failed save, or half as much damage on a successful one.\nParalyzing Breath. The dragon exhales paralyzing gas in a 30-foot cone. Each creature in that area must succeed on a DC 17 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",
        attack_bonus: 0,
        damage_dice: "12d8"
      }
    ]
  },
  {
    name: "Young White Dragon",
    size: "Large",
    source: "SRD",
    type: "dragon",
    subtype: "",
    alignment: "chaotic evil",
    ac: 17,
    hp: 133,
    hit_dice: "14d10",
    speed: "40 ft., burrow 20 ft., fly 80 ft., swim 40 ft.",
    stats: [18, 10, 18, 6, 11, 12],
    saves: [
      {
        dexterity: 3
      },
      {
        constitution: 7
      },
      {
        wisdom: 3
      },
      {
        charisma: 4
      }
    ],
    skillsaves: [
      {
        perception: 6
      },
      {
        stealth: 3
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "cold",
    condition_immunities: "",
    senses: "blindsight 30 ft., darkvision 120 ft., passive Perception 16",
    languages: "Common, Draconic",
    cr: "6",
    traits: [
      {
        name: "Ice Walk",
        desc: "The dragon can move across and climb icy surfaces without needing to make an ability check. Additionally, difficult terrain composed of ice or snow doesn't cost it extra moment.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Multiattack",
        desc: "The dragon makes three attacks: one with its bite and two with its claws.",
        attack_bonus: 0
      },
      {
        name: "Bite",
        desc: "Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage plus 4 (1d8) cold damage.",
        attack_bonus: 7,
        damage_dice: "2d10 + 1d8",
        damage_bonus: 4
      },
      {
        name: "Claw",
        desc: "Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",
        attack_bonus: 7,
        damage_dice: "2d6",
        damage_bonus: 4
      },
      {
        name: "Cold Breath (Recharge 5-6)",
        desc: "The dragon exhales an icy blast in a 30-foot cone. Each creature in that area must make a DC 15 Constitution saving throw, taking 45 (10d8) cold damage on a failed save, or half as much damage on a successful one.",
        attack_bonus: 0,
        damage_dice: "10d8"
      }
    ]
  },
  {
    name: "Zombie",
    size: "Medium",
    source: "SRD",
    type: "undead",
    subtype: "",
    alignment: "neutral evil",
    ac: 8,
    hp: 22,
    hit_dice: "3d8",
    speed: "20 ft.",
    stats: [13, 6, 16, 3, 6, 5],
    saves: [
      {
        wisdom: 0
      }
    ],
    damage_vulnerabilities: "",
    damage_resistances: "",
    damage_immunities: "",
    condition_immunities: "poisoned",
    senses: "darkvision 60 ft., passive Perception 8",
    languages: "understands all languages it spoke in life but can't speak",
    cr: "1/4",
    traits: [
      {
        name: "Undead Fortitude",
        desc: "If damage reduces the zombie to 0 hit points, it must make a Constitution saving throw with a DC of 5+the damage taken, unless the damage is radiant or from a critical hit. On a success, the zombie drops to 1 hit point instead.",
        attack_bonus: 0
      }
    ],
    actions: [
      {
        name: "Slam",
        desc: "Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage.",
        attack_bonus: 3,
        damage_dice: "1d6",
        damage_bonus: 1
      }
    ]
  }
];
var BESTIARY_BY_NAME = new Map(BESTIARY.map((monster) => {
  return [monster.name, monster];
}));

// src/view.ts
var import_obsidian19 = __toModule(require("obsidian"));

// src/svelte/Controls.svelte
var import_obsidian9 = __toModule(require("obsidian"));
var import_obsidian10 = __toModule(require("obsidian"));
function add_css4(target) {
  append_styles(target, "svelte-g63m31", ".buttons.svelte-g63m31.svelte-g63m31{display:flex;justify-content:space-between;padding:0 0 0.5rem 0}.state.svelte-g63m31.svelte-g63m31{display:flex;justify-content:flex-start;align-items:center}.clean.svelte-g63m31.svelte-g63m31{display:flex;justify-content:flex-end;align-items:center}.state.svelte-g63m31>.svelte-g63m31:not(:last-child),.clean.svelte-g63m31>.svelte-g63m31:not(:last-child){margin-right:0.25rem}");
}
function create_else_block4(ctx) {
  let div;
  let playButton_action;
  let mounted;
  let dispose;
  return {
    c() {
      div = element("div");
      attr(div, "class", "svelte-g63m31");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      if (!mounted) {
        dispose = action_destroyer(playButton_action = ctx[1].call(null, div));
        mounted = true;
      }
    },
    d(detaching) {
      if (detaching)
        detach(div);
      mounted = false;
      dispose();
    }
  };
}
function create_if_block5(ctx) {
  let div0;
  let stopButton_action;
  let t0;
  let div1;
  let prevButton_action;
  let t1;
  let div2;
  let nextButton_action;
  let mounted;
  let dispose;
  return {
    c() {
      div0 = element("div");
      t0 = space();
      div1 = element("div");
      t1 = space();
      div2 = element("div");
      attr(div0, "class", "svelte-g63m31");
      attr(div1, "class", "svelte-g63m31");
      attr(div2, "class", "svelte-g63m31");
    },
    m(target, anchor) {
      insert(target, div0, anchor);
      insert(target, t0, anchor);
      insert(target, div1, anchor);
      insert(target, t1, anchor);
      insert(target, div2, anchor);
      if (!mounted) {
        dispose = [
          action_destroyer(stopButton_action = ctx[2].call(null, div0)),
          action_destroyer(prevButton_action = ctx[4].call(null, div1)),
          action_destroyer(nextButton_action = ctx[3].call(null, div2))
        ];
        mounted = true;
      }
    },
    d(detaching) {
      if (detaching)
        detach(div0);
      if (detaching)
        detach(t0);
      if (detaching)
        detach(div1);
      if (detaching)
        detach(t1);
      if (detaching)
        detach(div2);
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_fragment5(ctx) {
  let div3;
  let div0;
  let t;
  let div2;
  let div1;
  let menuIcon_action;
  let mounted;
  let dispose;
  function select_block_type(ctx2, dirty) {
    if (ctx2[0])
      return create_if_block5;
    return create_else_block4;
  }
  let current_block_type = select_block_type(ctx, -1);
  let if_block = current_block_type(ctx);
  return {
    c() {
      div3 = element("div");
      div0 = element("div");
      if_block.c();
      t = space();
      div2 = element("div");
      div1 = element("div");
      attr(div0, "class", "state svelte-g63m31");
      attr(div1, "class", "svelte-g63m31");
      attr(div2, "class", "clean svelte-g63m31");
      attr(div3, "class", "buttons svelte-g63m31");
    },
    m(target, anchor) {
      insert(target, div3, anchor);
      append(div3, div0);
      if_block.m(div0, null);
      append(div3, t);
      append(div3, div2);
      append(div2, div1);
      if (!mounted) {
        dispose = [
          action_destroyer(menuIcon_action = ctx[6].call(null, div1)),
          listen(div1, "click", ctx[8])
        ];
        mounted = true;
      }
    },
    p(ctx2, [dirty]) {
      if (current_block_type !== (current_block_type = select_block_type(ctx2, dirty))) {
        if_block.d(1);
        if_block = current_block_type(ctx2);
        if (if_block) {
          if_block.c();
          if_block.m(div0, null);
        }
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div3);
      if_block.d();
      mounted = false;
      run_all(dispose);
    }
  };
}
function instance5($$self, $$props, $$invalidate) {
  let { state = false } = $$props;
  let { map = false } = $$props;
  let view = getContext("view");
  const playButton = (node) => {
    new import_obsidian9.ExtraButtonComponent(node).setIcon(PLAY).setTooltip("Play").onClick(() => {
      view.toggleState();
      $$invalidate(0, state = view.state);
    });
  };
  const stopButton = (node) => {
    new import_obsidian9.ExtraButtonComponent(node).setIcon(STOP).setTooltip("Stop").onClick(() => {
      view.toggleState();
      $$invalidate(0, state = view.state);
    });
  };
  const nextButton = (node) => {
    new import_obsidian9.ExtraButtonComponent(node).setIcon(FORWARD).setTooltip("Next").onClick(() => {
      view.goToNext();
    });
  };
  const prevButton = (node) => {
    new import_obsidian9.ExtraButtonComponent(node).setIcon(BACKWARD).setTooltip("Previous").onClick(() => {
      view.goToPrevious();
    });
  };
  const plugin = getContext("plugin");
  const open = (evt) => {
    menu.showAtMouseEvent(evt);
  };
  const menu = new import_obsidian10.Menu(plugin.app);
  menu.addItem((item) => {
    item.setIcon(NEW).setTitle("New Encounter").onClick(() => view.newEncounter());
  });
  menu.addItem((item) => {
    item.setIcon(REDO).setTitle("Reset HP & Status").onClick(() => view.resetEncounter());
  });
  menu.addItem((item) => {
    item.setIcon(DICE).setTitle("Re-roll Initiatives").onClick(() => view.rollInitiatives());
  });
  if (plugin.data.parties && plugin.data.parties.length) {
    menu.addItem((item) => {
      item.setIcon("switch").setTitle("Switch Party").onClick((evt) => {
        menu.hide();
        const partyMenu = new import_obsidian10.Menu(plugin.app).setNoIcon();
        for (const party of plugin.data.parties) {
          partyMenu.addItem((item2) => {
            var _a;
            item2.setTitle(party.name).onClick(() => {
              view.switchParty(party.name);
            }).setDisabled(((_a = view.party) === null || _a === void 0 ? void 0 : _a.name) == party.name);
          });
        }
        partyMenu.showAtMouseEvent(evt);
      });
    });
  }
  menu.addItem((item) => {
    item.setIcon(GROUP).setTitle(view.condense ? "Expand Creatures" : "Group Creatures").onClick(() => {
      view.toggleCondensed();
      item.setIcon(view.condense ? EXPAND : GROUP);
      item.setTitle(view.condense ? "Expand Creatures" : "Group Creatures");
    });
  });
  const dispatch = createEventDispatcher();
  menu.addSeparator();
  menu.addItem((item) => {
    item.setIcon(SAVE).setTitle("Save Encounter").onClick(() => {
      dispatch("save");
    });
  });
  menu.addItem((item) => {
    item.setIcon("open-elsewhere-glyph").setTitle("Load Encounter").onClick(() => {
      dispatch("load");
    });
  });
  if (map) {
    menu.addSeparator();
    menu.addItem((item) => {
      item.setIcon(MAP).setTitle("Open Leaflet Map").onClick(() => {
        view.openInitiativeView();
      });
    });
  }
  const menuIcon = (node) => {
    new import_obsidian9.ExtraButtonComponent(node).setIcon("vertical-three-dots");
  };
  const click_handler3 = (evt) => open(evt);
  $$self.$$set = ($$props2) => {
    if ("state" in $$props2)
      $$invalidate(0, state = $$props2.state);
    if ("map" in $$props2)
      $$invalidate(7, map = $$props2.map);
  };
  return [
    state,
    playButton,
    stopButton,
    nextButton,
    prevButton,
    open,
    menuIcon,
    map,
    click_handler3
  ];
}
var Controls = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance5, create_fragment5, safe_not_equal, { state: 0, map: 7 }, add_css4);
  }
};
var Controls_default = Controls;

// src/svelte/Table.svelte
var import_obsidian14 = __toModule(require("obsidian"));

// node_modules/svelte/easing/index.mjs
function cubicOut(t) {
  const f = t - 1;
  return f * f * f + 1;
}

// node_modules/svelte/animate/index.mjs
function flip2(node, { from, to }, params = {}) {
  const style = getComputedStyle(node);
  const transform = style.transform === "none" ? "" : style.transform;
  const [ox, oy] = style.transformOrigin.split(" ").map(parseFloat);
  const dx = from.left + from.width * ox / to.width - (to.left + ox);
  const dy = from.top + from.height * oy / to.height - (to.top + oy);
  const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing = cubicOut } = params;
  return {
    delay,
    duration: is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration,
    easing,
    css: (t, u) => {
      const x = u * dx;
      const y = u * dy;
      const sx = t + u * from.width / to.width;
      const sy = t + u * from.height / to.height;
      return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`;
    }
  };
}

// node_modules/svelte-dnd-action/dist/index.mjs
function _typeof(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof = function(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof(obj);
}
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }
  return obj;
}
function ownKeys(object, enumerableOnly) {
  var keys = Object.keys(object);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object);
    if (enumerableOnly)
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      });
    keys.push.apply(keys, symbols);
  }
  return keys;
}
function _objectSpread2(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i] != null ? arguments[i] : {};
    if (i % 2) {
      ownKeys(Object(source), true).forEach(function(key) {
        _defineProperty(target, key, source[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
      ownKeys(Object(source)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }
  }
  return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
  if (source == null)
    return {};
  var target = {};
  var sourceKeys = Object.keys(source);
  var key, i;
  for (i = 0; i < sourceKeys.length; i++) {
    key = sourceKeys[i];
    if (excluded.indexOf(key) >= 0)
      continue;
    target[key] = source[key];
  }
  return target;
}
function _objectWithoutProperties(source, excluded) {
  if (source == null)
    return {};
  var target = _objectWithoutPropertiesLoose(source, excluded);
  var key, i;
  if (Object.getOwnPropertySymbols) {
    var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
    for (i = 0; i < sourceSymbolKeys.length; i++) {
      key = sourceSymbolKeys[i];
      if (excluded.indexOf(key) >= 0)
        continue;
      if (!Object.prototype.propertyIsEnumerable.call(source, key))
        continue;
      target[key] = source[key];
    }
  }
  return target;
}
function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr))
    return _arrayLikeToArray(arr);
}
function _arrayWithHoles(arr) {
  if (Array.isArray(arr))
    return arr;
}
function _iterableToArray(iter) {
  if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter))
    return Array.from(iter);
}
function _iterableToArrayLimit(arr, i) {
  if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr)))
    return;
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = void 0;
  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
      _arr.push(_s.value);
      if (i && _arr.length === i)
        break;
    }
  } catch (err) {
    _d = true;
    _e = err;
  } finally {
    try {
      if (!_n && _i["return"] != null)
        _i["return"]();
    } finally {
      if (_d)
        throw _e;
    }
  }
  return _arr;
}
function _unsupportedIterableToArray(o, minLen) {
  if (!o)
    return;
  if (typeof o === "string")
    return _arrayLikeToArray(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor)
    n = o.constructor.name;
  if (n === "Map" || n === "Set")
    return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
    return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
  if (len == null || len > arr.length)
    len = arr.length;
  for (var i = 0, arr2 = new Array(len); i < len; i++)
    arr2[i] = arr[i];
  return arr2;
}
function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _createForOfIteratorHelper(o, allowArrayLike) {
  var it;
  if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
    if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
      if (it)
        o = it;
      var i = 0;
      var F = function() {
      };
      return {
        s: F,
        n: function() {
          if (i >= o.length)
            return {
              done: true
            };
          return {
            done: false,
            value: o[i++]
          };
        },
        e: function(e) {
          throw e;
        },
        f: F
      };
    }
    throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }
  var normalCompletion = true, didErr = false, err;
  return {
    s: function() {
      it = o[Symbol.iterator]();
    },
    n: function() {
      var step = it.next();
      normalCompletion = step.done;
      return step;
    },
    e: function(e) {
      didErr = true;
      err = e;
    },
    f: function() {
      try {
        if (!normalCompletion && it.return != null)
          it.return();
      } finally {
        if (didErr)
          throw err;
      }
    }
  };
}
var FINALIZE_EVENT_NAME = "finalize";
var CONSIDER_EVENT_NAME = "consider";
function dispatchFinalizeEvent(el, items, info) {
  el.dispatchEvent(new CustomEvent(FINALIZE_EVENT_NAME, {
    detail: {
      items,
      info
    }
  }));
}
function dispatchConsiderEvent(el, items, info) {
  el.dispatchEvent(new CustomEvent(CONSIDER_EVENT_NAME, {
    detail: {
      items,
      info
    }
  }));
}
var DRAGGED_ENTERED_EVENT_NAME = "draggedEntered";
var DRAGGED_LEFT_EVENT_NAME = "draggedLeft";
var DRAGGED_OVER_INDEX_EVENT_NAME = "draggedOverIndex";
var DRAGGED_LEFT_DOCUMENT_EVENT_NAME = "draggedLeftDocument";
var DRAGGED_LEFT_TYPES = {
  LEFT_FOR_ANOTHER: "leftForAnother",
  OUTSIDE_OF_ANY: "outsideOfAny"
};
function dispatchDraggedElementEnteredContainer(containerEl, indexObj, draggedEl2) {
  containerEl.dispatchEvent(new CustomEvent(DRAGGED_ENTERED_EVENT_NAME, {
    detail: {
      indexObj,
      draggedEl: draggedEl2
    }
  }));
}
function dispatchDraggedElementLeftContainerForAnother(containerEl, draggedEl2, theOtherDz) {
  containerEl.dispatchEvent(new CustomEvent(DRAGGED_LEFT_EVENT_NAME, {
    detail: {
      draggedEl: draggedEl2,
      type: DRAGGED_LEFT_TYPES.LEFT_FOR_ANOTHER,
      theOtherDz
    }
  }));
}
function dispatchDraggedElementLeftContainerForNone(containerEl, draggedEl2) {
  containerEl.dispatchEvent(new CustomEvent(DRAGGED_LEFT_EVENT_NAME, {
    detail: {
      draggedEl: draggedEl2,
      type: DRAGGED_LEFT_TYPES.OUTSIDE_OF_ANY
    }
  }));
}
function dispatchDraggedElementIsOverIndex(containerEl, indexObj, draggedEl2) {
  containerEl.dispatchEvent(new CustomEvent(DRAGGED_OVER_INDEX_EVENT_NAME, {
    detail: {
      indexObj,
      draggedEl: draggedEl2
    }
  }));
}
function dispatchDraggedLeftDocument(draggedEl2) {
  window.dispatchEvent(new CustomEvent(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, {
    detail: {
      draggedEl: draggedEl2
    }
  }));
}
var TRIGGERS = {
  DRAG_STARTED: "dragStarted",
  DRAGGED_ENTERED: DRAGGED_ENTERED_EVENT_NAME,
  DRAGGED_ENTERED_ANOTHER: "dragEnteredAnother",
  DRAGGED_OVER_INDEX: DRAGGED_OVER_INDEX_EVENT_NAME,
  DRAGGED_LEFT: DRAGGED_LEFT_EVENT_NAME,
  DRAGGED_LEFT_ALL: "draggedLeftAll",
  DROPPED_INTO_ZONE: "droppedIntoZone",
  DROPPED_INTO_ANOTHER: "droppedIntoAnother",
  DROPPED_OUTSIDE_OF_ANY: "droppedOutsideOfAny",
  DRAG_STOPPED: "dragStopped"
};
var SOURCES = {
  POINTER: "pointer",
  KEYBOARD: "keyboard"
};
var SHADOW_ITEM_MARKER_PROPERTY_NAME = "isDndShadowItem";
var SHADOW_ELEMENT_ATTRIBUTE_NAME = "data-is-dnd-shadow-item";
var SHADOW_PLACEHOLDER_ITEM_ID = "id:dnd-shadow-placeholder-0000";
var DRAGGED_ELEMENT_ID = "dnd-action-dragged-el";
var ITEM_ID_KEY = "id";
var activeDndZoneCount = 0;
function incrementActiveDropZoneCount() {
  activeDndZoneCount++;
}
function decrementActiveDropZoneCount() {
  if (activeDndZoneCount === 0) {
    throw new Error("Bug! trying to decrement when there are no dropzones");
  }
  activeDndZoneCount--;
}
var isOnServer = typeof window === "undefined";
var printDebug = function printDebug2() {
};
function getBoundingRectNoTransforms(el) {
  var ta;
  var rect = el.getBoundingClientRect();
  var style = getComputedStyle(el);
  var tx = style.transform;
  if (tx) {
    var sx, sy, dx, dy;
    if (tx.startsWith("matrix3d(")) {
      ta = tx.slice(9, -1).split(/, /);
      sx = +ta[0];
      sy = +ta[5];
      dx = +ta[12];
      dy = +ta[13];
    } else if (tx.startsWith("matrix(")) {
      ta = tx.slice(7, -1).split(/, /);
      sx = +ta[0];
      sy = +ta[3];
      dx = +ta[4];
      dy = +ta[5];
    } else {
      return rect;
    }
    var to = style.transformOrigin;
    var x = rect.x - dx - (1 - sx) * parseFloat(to);
    var y = rect.y - dy - (1 - sy) * parseFloat(to.slice(to.indexOf(" ") + 1));
    var w = sx ? rect.width / sx : el.offsetWidth;
    var h = sy ? rect.height / sy : el.offsetHeight;
    return {
      x,
      y,
      width: w,
      height: h,
      top: y,
      right: x + w,
      bottom: y + h,
      left: x
    };
  } else {
    return rect;
  }
}
function getAbsoluteRectNoTransforms(el) {
  var rect = getBoundingRectNoTransforms(el);
  return {
    top: rect.top + window.scrollY,
    bottom: rect.bottom + window.scrollY,
    left: rect.left + window.scrollX,
    right: rect.right + window.scrollX
  };
}
function getAbsoluteRect(el) {
  var rect = el.getBoundingClientRect();
  return {
    top: rect.top + window.scrollY,
    bottom: rect.bottom + window.scrollY,
    left: rect.left + window.scrollX,
    right: rect.right + window.scrollX
  };
}
function findCenter(rect) {
  return {
    x: (rect.left + rect.right) / 2,
    y: (rect.top + rect.bottom) / 2
  };
}
function calcDistance(pointA, pointB) {
  return Math.sqrt(Math.pow(pointA.x - pointB.x, 2) + Math.pow(pointA.y - pointB.y, 2));
}
function isPointInsideRect(point, rect) {
  return point.y <= rect.bottom && point.y >= rect.top && point.x >= rect.left && point.x <= rect.right;
}
function findCenterOfElement(el) {
  return findCenter(getAbsoluteRect(el));
}
function isCenterOfAInsideB(elA, elB) {
  var centerOfA = findCenterOfElement(elA);
  var rectOfB = getAbsoluteRectNoTransforms(elB);
  return isPointInsideRect(centerOfA, rectOfB);
}
function calcDistanceBetweenCenters(elA, elB) {
  var centerOfA = findCenterOfElement(elA);
  var centerOfB = findCenterOfElement(elB);
  return calcDistance(centerOfA, centerOfB);
}
function isElementOffDocument(el) {
  var rect = getAbsoluteRect(el);
  return rect.right < 0 || rect.left > document.documentElement.scrollWidth || rect.bottom < 0 || rect.top > document.documentElement.scrollHeight;
}
function calcInnerDistancesBetweenPointAndSidesOfElement(point, el) {
  var rect = getAbsoluteRect(el);
  if (!isPointInsideRect(point, rect)) {
    return null;
  }
  return {
    top: point.y - rect.top,
    bottom: rect.bottom - point.y,
    left: point.x - rect.left,
    right: Math.min(rect.right, document.documentElement.clientWidth) - point.x
  };
}
var dzToShadowIndexToRect;
function resetIndexesCache() {
  printDebug(function() {
    return "resetting indexes cache";
  });
  dzToShadowIndexToRect = /* @__PURE__ */ new Map();
}
resetIndexesCache();
function cacheShadowRect(dz) {
  var shadowElIndex = Array.from(dz.children).findIndex(function(child) {
    return child.getAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME);
  });
  if (shadowElIndex >= 0) {
    if (!dzToShadowIndexToRect.has(dz)) {
      dzToShadowIndexToRect.set(dz, /* @__PURE__ */ new Map());
    }
    dzToShadowIndexToRect.get(dz).set(shadowElIndex, getAbsoluteRectNoTransforms(dz.children[shadowElIndex]));
    return shadowElIndex;
  }
  return void 0;
}
function findWouldBeIndex(floatingAboveEl, collectionBelowEl) {
  if (!isCenterOfAInsideB(floatingAboveEl, collectionBelowEl)) {
    return null;
  }
  var children2 = collectionBelowEl.children;
  if (children2.length === 0) {
    return {
      index: 0,
      isProximityBased: true
    };
  }
  var shadowElIndex = cacheShadowRect(collectionBelowEl);
  for (var i = 0; i < children2.length; i++) {
    if (isCenterOfAInsideB(floatingAboveEl, children2[i])) {
      var cachedShadowRect = dzToShadowIndexToRect.has(collectionBelowEl) && dzToShadowIndexToRect.get(collectionBelowEl).get(i);
      if (cachedShadowRect) {
        if (!isPointInsideRect(findCenterOfElement(floatingAboveEl), cachedShadowRect)) {
          return {
            index: shadowElIndex,
            isProximityBased: false
          };
        }
      }
      return {
        index: i,
        isProximityBased: false
      };
    }
  }
  var minDistanceSoFar = Number.MAX_VALUE;
  var indexOfMin = void 0;
  for (var _i = 0; _i < children2.length; _i++) {
    var distance = calcDistanceBetweenCenters(floatingAboveEl, children2[_i]);
    if (distance < minDistanceSoFar) {
      minDistanceSoFar = distance;
      indexOfMin = _i;
    }
  }
  return {
    index: indexOfMin,
    isProximityBased: true
  };
}
var SCROLL_ZONE_PX = 25;
function makeScroller() {
  var scrollingInfo;
  function resetScrolling2() {
    scrollingInfo = {
      directionObj: void 0,
      stepPx: 0
    };
  }
  resetScrolling2();
  function scrollContainer(containerEl) {
    var _scrollingInfo = scrollingInfo, directionObj = _scrollingInfo.directionObj, stepPx = _scrollingInfo.stepPx;
    if (directionObj) {
      containerEl.scrollBy(directionObj.x * stepPx, directionObj.y * stepPx);
      window.requestAnimationFrame(function() {
        return scrollContainer(containerEl);
      });
    }
  }
  function calcScrollStepPx(distancePx) {
    return SCROLL_ZONE_PX - distancePx;
  }
  function scrollIfNeeded2(pointer, elementToScroll) {
    if (!elementToScroll) {
      return false;
    }
    var distances = calcInnerDistancesBetweenPointAndSidesOfElement(pointer, elementToScroll);
    if (distances === null) {
      resetScrolling2();
      return false;
    }
    var isAlreadyScrolling = !!scrollingInfo.directionObj;
    var scrollingVertically = false, scrollingHorizontally = false;
    if (elementToScroll.scrollHeight > elementToScroll.clientHeight) {
      if (distances.bottom < SCROLL_ZONE_PX) {
        scrollingVertically = true;
        scrollingInfo.directionObj = {
          x: 0,
          y: 1
        };
        scrollingInfo.stepPx = calcScrollStepPx(distances.bottom);
      } else if (distances.top < SCROLL_ZONE_PX) {
        scrollingVertically = true;
        scrollingInfo.directionObj = {
          x: 0,
          y: -1
        };
        scrollingInfo.stepPx = calcScrollStepPx(distances.top);
      }
      if (!isAlreadyScrolling && scrollingVertically) {
        scrollContainer(elementToScroll);
        return true;
      }
    }
    if (elementToScroll.scrollWidth > elementToScroll.clientWidth) {
      if (distances.right < SCROLL_ZONE_PX) {
        scrollingHorizontally = true;
        scrollingInfo.directionObj = {
          x: 1,
          y: 0
        };
        scrollingInfo.stepPx = calcScrollStepPx(distances.right);
      } else if (distances.left < SCROLL_ZONE_PX) {
        scrollingHorizontally = true;
        scrollingInfo.directionObj = {
          x: -1,
          y: 0
        };
        scrollingInfo.stepPx = calcScrollStepPx(distances.left);
      }
      if (!isAlreadyScrolling && scrollingHorizontally) {
        scrollContainer(elementToScroll);
        return true;
      }
    }
    resetScrolling2();
    return false;
  }
  return {
    scrollIfNeeded: scrollIfNeeded2,
    resetScrolling: resetScrolling2
  };
}
function toString(object) {
  return JSON.stringify(object, null, 2);
}
function getDepth(node) {
  if (!node) {
    throw new Error("cannot get depth of a falsy node");
  }
  return _getDepth(node, 0);
}
function _getDepth(node) {
  var countSoFar = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  if (!node.parentElement) {
    return countSoFar - 1;
  }
  return _getDepth(node.parentElement, countSoFar + 1);
}
function areObjectsShallowEqual(objA, objB) {
  if (Object.keys(objA).length !== Object.keys(objB).length) {
    return false;
  }
  for (var keyA in objA) {
    if (!{}.hasOwnProperty.call(objB, keyA) || objB[keyA] !== objA[keyA]) {
      return false;
    }
  }
  return true;
}
function areArraysShallowEqualSameOrder(arrA, arrB) {
  if (arrA.length !== arrB.length) {
    return false;
  }
  for (var i = 0; i < arrA.length; i++) {
    if (arrA[i] !== arrB[i]) {
      return false;
    }
  }
  return true;
}
var INTERVAL_MS = 200;
var TOLERANCE_PX = 10;
var _makeScroller = makeScroller();
var scrollIfNeeded = _makeScroller.scrollIfNeeded;
var resetScrolling = _makeScroller.resetScrolling;
var next;
function observe(draggedEl2, dropZones) {
  var intervalMs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : INTERVAL_MS;
  var lastDropZoneFound;
  var lastIndexFound;
  var lastIsDraggedInADropZone = false;
  var lastCentrePositionOfDragged;
  var dropZonesFromDeepToShallow = Array.from(dropZones).sort(function(dz1, dz2) {
    return getDepth(dz2) - getDepth(dz1);
  });
  function andNow() {
    var currentCenterOfDragged = findCenterOfElement(draggedEl2);
    var scrolled = scrollIfNeeded(currentCenterOfDragged, lastDropZoneFound);
    if (!scrolled && lastCentrePositionOfDragged && Math.abs(lastCentrePositionOfDragged.x - currentCenterOfDragged.x) < TOLERANCE_PX && Math.abs(lastCentrePositionOfDragged.y - currentCenterOfDragged.y) < TOLERANCE_PX) {
      next = window.setTimeout(andNow, intervalMs);
      return;
    }
    if (isElementOffDocument(draggedEl2)) {
      printDebug(function() {
        return "off document";
      });
      dispatchDraggedLeftDocument(draggedEl2);
      return;
    }
    lastCentrePositionOfDragged = currentCenterOfDragged;
    var isDraggedInADropZone = false;
    var _iterator = _createForOfIteratorHelper(dropZonesFromDeepToShallow), _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done; ) {
        var dz = _step.value;
        var indexObj = findWouldBeIndex(draggedEl2, dz);
        if (indexObj === null) {
          continue;
        }
        var index = indexObj.index;
        isDraggedInADropZone = true;
        if (dz !== lastDropZoneFound) {
          lastDropZoneFound && dispatchDraggedElementLeftContainerForAnother(lastDropZoneFound, draggedEl2, dz);
          dispatchDraggedElementEnteredContainer(dz, indexObj, draggedEl2);
          lastDropZoneFound = dz;
        } else if (index !== lastIndexFound) {
          dispatchDraggedElementIsOverIndex(dz, indexObj, draggedEl2);
          lastIndexFound = index;
        }
        break;
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    if (!isDraggedInADropZone && lastIsDraggedInADropZone && lastDropZoneFound) {
      dispatchDraggedElementLeftContainerForNone(lastDropZoneFound, draggedEl2);
      lastDropZoneFound = void 0;
      lastIndexFound = void 0;
      lastIsDraggedInADropZone = false;
    } else {
      lastIsDraggedInADropZone = true;
    }
    next = window.setTimeout(andNow, intervalMs);
  }
  andNow();
}
function unobserve() {
  printDebug(function() {
    return "unobserving";
  });
  clearTimeout(next);
  resetScrolling();
  resetIndexesCache();
}
var INTERVAL_MS$1 = 300;
var mousePosition;
function updateMousePosition(e) {
  var c = e.touches ? e.touches[0] : e;
  mousePosition = {
    x: c.clientX,
    y: c.clientY
  };
}
var _makeScroller$1 = makeScroller();
var scrollIfNeeded$1 = _makeScroller$1.scrollIfNeeded;
var resetScrolling$1 = _makeScroller$1.resetScrolling;
var next$1;
function loop2() {
  if (mousePosition) {
    scrollIfNeeded$1(mousePosition, document.documentElement);
  }
  next$1 = window.setTimeout(loop2, INTERVAL_MS$1);
}
function armWindowScroller() {
  printDebug(function() {
    return "arming window scroller";
  });
  window.addEventListener("mousemove", updateMousePosition);
  window.addEventListener("touchmove", updateMousePosition);
  loop2();
}
function disarmWindowScroller() {
  printDebug(function() {
    return "disarming window scroller";
  });
  window.removeEventListener("mousemove", updateMousePosition);
  window.removeEventListener("touchmove", updateMousePosition);
  mousePosition = void 0;
  window.clearTimeout(next$1);
  resetScrolling$1();
}
var TRANSITION_DURATION_SECONDS = 0.2;
function trs(property) {
  return "".concat(property, " ").concat(TRANSITION_DURATION_SECONDS, "s ease");
}
function createDraggedElementFrom(originalElement, positionCenterOnXY) {
  var rect = originalElement.getBoundingClientRect();
  var draggedEl2 = originalElement.cloneNode(true);
  copyStylesFromTo(originalElement, draggedEl2);
  draggedEl2.id = DRAGGED_ELEMENT_ID;
  draggedEl2.style.position = "fixed";
  var elTopPx = rect.top;
  var elLeftPx = rect.left;
  draggedEl2.style.top = "".concat(elTopPx, "px");
  draggedEl2.style.left = "".concat(elLeftPx, "px");
  if (positionCenterOnXY) {
    var center = findCenter(rect);
    elTopPx -= center.y - positionCenterOnXY.y;
    elLeftPx -= center.x - positionCenterOnXY.x;
    window.setTimeout(function() {
      draggedEl2.style.top = "".concat(elTopPx, "px");
      draggedEl2.style.left = "".concat(elLeftPx, "px");
    }, 0);
  }
  draggedEl2.style.margin = "0";
  draggedEl2.style.boxSizing = "border-box";
  draggedEl2.style.height = "".concat(rect.height, "px");
  draggedEl2.style.width = "".concat(rect.width, "px");
  draggedEl2.style.transition = "".concat(trs("top"), ", ").concat(trs("left"), ", ").concat(trs("background-color"), ", ").concat(trs("opacity"), ", ").concat(trs("color"), " ");
  window.setTimeout(function() {
    return draggedEl2.style.transition += ", ".concat(trs("width"), ", ").concat(trs("height"));
  }, 0);
  draggedEl2.style.zIndex = "9999";
  draggedEl2.style.cursor = "grabbing";
  return draggedEl2;
}
function moveDraggedElementToWasDroppedState(draggedEl2) {
  draggedEl2.style.cursor = "grab";
}
function morphDraggedElementToBeLike(draggedEl2, copyFromEl, currentMouseX, currentMouseY, transformDraggedElement) {
  var newRect = copyFromEl.getBoundingClientRect();
  var draggedElRect = draggedEl2.getBoundingClientRect();
  var widthChange = newRect.width - draggedElRect.width;
  var heightChange = newRect.height - draggedElRect.height;
  if (widthChange || heightChange) {
    var relativeDistanceOfMousePointerFromDraggedSides = {
      left: (currentMouseX - draggedElRect.left) / draggedElRect.width,
      top: (currentMouseY - draggedElRect.top) / draggedElRect.height
    };
    draggedEl2.style.height = "".concat(newRect.height, "px");
    draggedEl2.style.width = "".concat(newRect.width, "px");
    draggedEl2.style.left = "".concat(parseFloat(draggedEl2.style.left) - relativeDistanceOfMousePointerFromDraggedSides.left * widthChange, "px");
    draggedEl2.style.top = "".concat(parseFloat(draggedEl2.style.top) - relativeDistanceOfMousePointerFromDraggedSides.top * heightChange, "px");
  }
  copyStylesFromTo(copyFromEl, draggedEl2);
  transformDraggedElement();
}
function copyStylesFromTo(copyFromEl, copyToEl) {
  var computedStyle = window.getComputedStyle(copyFromEl);
  Array.from(computedStyle).filter(function(s) {
    return s.startsWith("background") || s.startsWith("padding") || s.startsWith("font") || s.startsWith("text") || s.startsWith("align") || s.startsWith("justify") || s.startsWith("display") || s.startsWith("flex") || s.startsWith("border") || s === "opacity" || s === "color" || s === "list-style-type";
  }).forEach(function(s) {
    return copyToEl.style.setProperty(s, computedStyle.getPropertyValue(s), computedStyle.getPropertyPriority(s));
  });
}
function styleDraggable(draggableEl, dragDisabled) {
  draggableEl.draggable = false;
  draggableEl.ondragstart = function() {
    return false;
  };
  if (!dragDisabled) {
    draggableEl.style.userSelect = "none";
    draggableEl.style.WebkitUserSelect = "none";
    draggableEl.style.cursor = "grab";
  } else {
    draggableEl.style.userSelect = "";
    draggableEl.style.WebkitUserSelect = "";
    draggableEl.style.cursor = "";
  }
}
function hideOriginalDragTarget(dragTarget) {
  dragTarget.style.display = "none";
  dragTarget.style.position = "fixed";
  dragTarget.style.zIndex = "-5";
}
function decorateShadowEl(shadowEl) {
  shadowEl.style.visibility = "hidden";
  shadowEl.setAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME, "true");
}
function unDecorateShadowElement(shadowEl) {
  shadowEl.style.visibility = "";
  shadowEl.removeAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME);
}
function styleActiveDropZones(dropZones) {
  var getStyles = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : function() {
  };
  var getClasses = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function() {
    return [];
  };
  dropZones.forEach(function(dz) {
    var styles = getStyles(dz);
    Object.keys(styles).forEach(function(style) {
      dz.style[style] = styles[style];
    });
    getClasses(dz).forEach(function(c) {
      return dz.classList.add(c);
    });
  });
}
function styleInactiveDropZones(dropZones) {
  var getStyles = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : function() {
  };
  var getClasses = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function() {
    return [];
  };
  dropZones.forEach(function(dz) {
    var styles = getStyles(dz);
    Object.keys(styles).forEach(function(style) {
      dz.style[style] = "";
    });
    getClasses(dz).forEach(function(c) {
      return dz.classList.contains(c) && dz.classList.remove(c);
    });
  });
}
function preventShrinking(el) {
  var originalMinHeight = el.style.minHeight;
  el.style.minHeight = window.getComputedStyle(el).getPropertyValue("height");
  var originalMinWidth = el.style.minWidth;
  el.style.minWidth = window.getComputedStyle(el).getPropertyValue("width");
  return function undo() {
    el.style.minHeight = originalMinHeight;
    el.style.minWidth = originalMinWidth;
  };
}
var DEFAULT_DROP_ZONE_TYPE = "--any--";
var MIN_OBSERVATION_INTERVAL_MS = 100;
var MIN_MOVEMENT_BEFORE_DRAG_START_PX = 3;
var DEFAULT_DROP_TARGET_STYLE = {
  outline: "rgba(255, 255, 102, 0.7) solid 2px"
};
var originalDragTarget;
var draggedEl;
var draggedElData;
var draggedElType;
var originDropZone;
var originIndex;
var shadowElData;
var shadowElDropZone;
var dragStartMousePosition;
var currentMousePosition;
var isWorkingOnPreviousDrag = false;
var finalizingPreviousDrag = false;
var unlockOriginDzMinDimensions;
var isDraggedOutsideOfAnyDz = false;
var typeToDropZones = /* @__PURE__ */ new Map();
var dzToConfig = /* @__PURE__ */ new Map();
var elToMouseDownListener = new WeakMap();
function registerDropZone(dropZoneEl, type) {
  printDebug(function() {
    return "registering drop-zone if absent";
  });
  if (!typeToDropZones.has(type)) {
    typeToDropZones.set(type, /* @__PURE__ */ new Set());
  }
  if (!typeToDropZones.get(type).has(dropZoneEl)) {
    typeToDropZones.get(type).add(dropZoneEl);
    incrementActiveDropZoneCount();
  }
}
function unregisterDropZone(dropZoneEl, type) {
  typeToDropZones.get(type)["delete"](dropZoneEl);
  decrementActiveDropZoneCount();
  if (typeToDropZones.get(type).size === 0) {
    typeToDropZones["delete"](type);
  }
}
function watchDraggedElement() {
  printDebug(function() {
    return "watching dragged element";
  });
  armWindowScroller();
  var dropZones = typeToDropZones.get(draggedElType);
  var _iterator = _createForOfIteratorHelper(dropZones), _step;
  try {
    for (_iterator.s(); !(_step = _iterator.n()).done; ) {
      var dz = _step.value;
      dz.addEventListener(DRAGGED_ENTERED_EVENT_NAME, handleDraggedEntered);
      dz.addEventListener(DRAGGED_LEFT_EVENT_NAME, handleDraggedLeft);
      dz.addEventListener(DRAGGED_OVER_INDEX_EVENT_NAME, handleDraggedIsOverIndex);
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }
  window.addEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, handleDrop);
  var observationIntervalMs = Math.max.apply(Math, [MIN_OBSERVATION_INTERVAL_MS].concat(_toConsumableArray(Array.from(dropZones.keys()).map(function(dz2) {
    return dzToConfig.get(dz2).dropAnimationDurationMs;
  }))));
  observe(draggedEl, dropZones, observationIntervalMs * 1.07);
}
function unWatchDraggedElement() {
  printDebug(function() {
    return "unwatching dragged element";
  });
  disarmWindowScroller();
  var dropZones = typeToDropZones.get(draggedElType);
  var _iterator2 = _createForOfIteratorHelper(dropZones), _step2;
  try {
    for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
      var dz = _step2.value;
      dz.removeEventListener(DRAGGED_ENTERED_EVENT_NAME, handleDraggedEntered);
      dz.removeEventListener(DRAGGED_LEFT_EVENT_NAME, handleDraggedLeft);
      dz.removeEventListener(DRAGGED_OVER_INDEX_EVENT_NAME, handleDraggedIsOverIndex);
    }
  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }
  window.removeEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, handleDrop);
  unobserve();
}
function findShadowPlaceHolderIdx(items) {
  return items.findIndex(function(item) {
    return item[ITEM_ID_KEY] === SHADOW_PLACEHOLDER_ITEM_ID;
  });
}
function findShadowElementIdx(items) {
  return items.findIndex(function(item) {
    return !!item[SHADOW_ITEM_MARKER_PROPERTY_NAME] && item[ITEM_ID_KEY] !== SHADOW_PLACEHOLDER_ITEM_ID;
  });
}
function handleDraggedEntered(e) {
  printDebug(function() {
    return ["dragged entered", e.currentTarget, e.detail];
  });
  var _dzToConfig$get = dzToConfig.get(e.currentTarget), items = _dzToConfig$get.items, dropFromOthersDisabled = _dzToConfig$get.dropFromOthersDisabled;
  if (dropFromOthersDisabled && e.currentTarget !== originDropZone) {
    printDebug(function() {
      return "ignoring dragged entered because drop is currently disabled";
    });
    return;
  }
  isDraggedOutsideOfAnyDz = false;
  items = items.filter(function(item) {
    return item[ITEM_ID_KEY] !== shadowElData[ITEM_ID_KEY];
  });
  printDebug(function() {
    return "dragged entered items ".concat(toString(items));
  });
  if (originDropZone !== e.currentTarget) {
    var originZoneItems = dzToConfig.get(originDropZone).items;
    var newOriginZoneItems = originZoneItems.filter(function(item) {
      return !item[SHADOW_ITEM_MARKER_PROPERTY_NAME];
    });
    dispatchConsiderEvent(originDropZone, newOriginZoneItems, {
      trigger: TRIGGERS.DRAGGED_ENTERED_ANOTHER,
      id: draggedElData[ITEM_ID_KEY],
      source: SOURCES.POINTER
    });
  } else {
    var shadowPlaceHolderIdx = findShadowPlaceHolderIdx(items);
    if (shadowPlaceHolderIdx !== -1) {
      printDebug(function() {
        return "removing placeholder item from origin dz";
      });
      items.splice(shadowPlaceHolderIdx, 1);
    }
  }
  var _e$detail$indexObj = e.detail.indexObj, index = _e$detail$indexObj.index, isProximityBased = _e$detail$indexObj.isProximityBased;
  var shadowElIdx = isProximityBased && index === e.currentTarget.children.length - 1 ? index + 1 : index;
  shadowElDropZone = e.currentTarget;
  items.splice(shadowElIdx, 0, shadowElData);
  dispatchConsiderEvent(e.currentTarget, items, {
    trigger: TRIGGERS.DRAGGED_ENTERED,
    id: draggedElData[ITEM_ID_KEY],
    source: SOURCES.POINTER
  });
}
function handleDraggedLeft(e) {
  if (!isWorkingOnPreviousDrag)
    return;
  printDebug(function() {
    return ["dragged left", e.currentTarget, e.detail];
  });
  var _dzToConfig$get2 = dzToConfig.get(e.currentTarget), items = _dzToConfig$get2.items, dropFromOthersDisabled = _dzToConfig$get2.dropFromOthersDisabled;
  if (dropFromOthersDisabled && e.currentTarget !== originDropZone && e.currentTarget !== shadowElDropZone) {
    printDebug(function() {
      return "drop is currently disabled";
    });
    return;
  }
  var shadowElIdx = findShadowElementIdx(items);
  var shadowItem = items.splice(shadowElIdx, 1)[0];
  shadowElDropZone = void 0;
  var _e$detail = e.detail, type = _e$detail.type, theOtherDz = _e$detail.theOtherDz;
  if (type === DRAGGED_LEFT_TYPES.OUTSIDE_OF_ANY || type === DRAGGED_LEFT_TYPES.LEFT_FOR_ANOTHER && theOtherDz !== originDropZone && dzToConfig.get(theOtherDz).dropFromOthersDisabled) {
    printDebug(function() {
      return "dragged left all, putting shadow element back in the origin dz";
    });
    isDraggedOutsideOfAnyDz = true;
    shadowElDropZone = originDropZone;
    var originZoneItems = dzToConfig.get(originDropZone).items;
    originZoneItems.splice(originIndex, 0, shadowItem);
    dispatchConsiderEvent(originDropZone, originZoneItems, {
      trigger: TRIGGERS.DRAGGED_LEFT_ALL,
      id: draggedElData[ITEM_ID_KEY],
      source: SOURCES.POINTER
    });
  }
  dispatchConsiderEvent(e.currentTarget, items, {
    trigger: TRIGGERS.DRAGGED_LEFT,
    id: draggedElData[ITEM_ID_KEY],
    source: SOURCES.POINTER
  });
}
function handleDraggedIsOverIndex(e) {
  printDebug(function() {
    return ["dragged is over index", e.currentTarget, e.detail];
  });
  var _dzToConfig$get3 = dzToConfig.get(e.currentTarget), items = _dzToConfig$get3.items, dropFromOthersDisabled = _dzToConfig$get3.dropFromOthersDisabled;
  if (dropFromOthersDisabled && e.currentTarget !== originDropZone) {
    printDebug(function() {
      return "drop is currently disabled";
    });
    return;
  }
  isDraggedOutsideOfAnyDz = false;
  var index = e.detail.indexObj.index;
  var shadowElIdx = findShadowElementIdx(items);
  items.splice(shadowElIdx, 1);
  items.splice(index, 0, shadowElData);
  dispatchConsiderEvent(e.currentTarget, items, {
    trigger: TRIGGERS.DRAGGED_OVER_INDEX,
    id: draggedElData[ITEM_ID_KEY],
    source: SOURCES.POINTER
  });
}
function handleMouseMove(e) {
  e.preventDefault();
  var c = e.touches ? e.touches[0] : e;
  currentMousePosition = {
    x: c.clientX,
    y: c.clientY
  };
  draggedEl.style.transform = "translate3d(".concat(currentMousePosition.x - dragStartMousePosition.x, "px, ").concat(currentMousePosition.y - dragStartMousePosition.y, "px, 0)");
}
function handleDrop() {
  printDebug(function() {
    return "dropped";
  });
  finalizingPreviousDrag = true;
  window.removeEventListener("mousemove", handleMouseMove);
  window.removeEventListener("touchmove", handleMouseMove);
  window.removeEventListener("mouseup", handleDrop);
  window.removeEventListener("touchend", handleDrop);
  unWatchDraggedElement();
  moveDraggedElementToWasDroppedState(draggedEl);
  if (!shadowElDropZone) {
    printDebug(function() {
      return "element was dropped right after it left origin but before entering somewhere else";
    });
    shadowElDropZone = originDropZone;
  }
  printDebug(function() {
    return ["dropped in dz", shadowElDropZone];
  });
  var _dzToConfig$get4 = dzToConfig.get(shadowElDropZone), items = _dzToConfig$get4.items, type = _dzToConfig$get4.type;
  styleInactiveDropZones(typeToDropZones.get(type), function(dz) {
    return dzToConfig.get(dz).dropTargetStyle;
  }, function(dz) {
    return dzToConfig.get(dz).dropTargetClasses;
  });
  var shadowElIdx = findShadowElementIdx(items);
  if (shadowElIdx === -1)
    shadowElIdx = originIndex;
  items = items.map(function(item) {
    return item[SHADOW_ITEM_MARKER_PROPERTY_NAME] ? draggedElData : item;
  });
  function finalizeWithinZone() {
    unlockOriginDzMinDimensions();
    dispatchFinalizeEvent(shadowElDropZone, items, {
      trigger: isDraggedOutsideOfAnyDz ? TRIGGERS.DROPPED_OUTSIDE_OF_ANY : TRIGGERS.DROPPED_INTO_ZONE,
      id: draggedElData[ITEM_ID_KEY],
      source: SOURCES.POINTER
    });
    if (shadowElDropZone !== originDropZone) {
      dispatchFinalizeEvent(originDropZone, dzToConfig.get(originDropZone).items, {
        trigger: TRIGGERS.DROPPED_INTO_ANOTHER,
        id: draggedElData[ITEM_ID_KEY],
        source: SOURCES.POINTER
      });
    }
    unDecorateShadowElement(shadowElDropZone.children[shadowElIdx]);
    cleanupPostDrop();
  }
  animateDraggedToFinalPosition(shadowElIdx, finalizeWithinZone);
}
function animateDraggedToFinalPosition(shadowElIdx, callback) {
  var shadowElRect = getBoundingRectNoTransforms(shadowElDropZone.children[shadowElIdx]);
  var newTransform = {
    x: shadowElRect.left - parseFloat(draggedEl.style.left),
    y: shadowElRect.top - parseFloat(draggedEl.style.top)
  };
  var _dzToConfig$get5 = dzToConfig.get(shadowElDropZone), dropAnimationDurationMs = _dzToConfig$get5.dropAnimationDurationMs;
  var transition = "transform ".concat(dropAnimationDurationMs, "ms ease");
  draggedEl.style.transition = draggedEl.style.transition ? draggedEl.style.transition + "," + transition : transition;
  draggedEl.style.transform = "translate3d(".concat(newTransform.x, "px, ").concat(newTransform.y, "px, 0)");
  window.setTimeout(callback, dropAnimationDurationMs);
}
function cleanupPostDrop() {
  draggedEl.remove();
  originalDragTarget.remove();
  draggedEl = void 0;
  originalDragTarget = void 0;
  draggedElData = void 0;
  draggedElType = void 0;
  originDropZone = void 0;
  originIndex = void 0;
  shadowElData = void 0;
  shadowElDropZone = void 0;
  dragStartMousePosition = void 0;
  currentMousePosition = void 0;
  isWorkingOnPreviousDrag = false;
  finalizingPreviousDrag = false;
  unlockOriginDzMinDimensions = void 0;
  isDraggedOutsideOfAnyDz = false;
}
function dndzone(node, options) {
  var config = {
    items: void 0,
    type: void 0,
    flipDurationMs: 0,
    dragDisabled: false,
    morphDisabled: false,
    dropFromOthersDisabled: false,
    dropTargetStyle: DEFAULT_DROP_TARGET_STYLE,
    dropTargetClasses: [],
    transformDraggedElement: function transformDraggedElement() {
    },
    centreDraggedOnCursor: false
  };
  printDebug(function() {
    return ["dndzone good to go options: ".concat(toString(options), ", config: ").concat(toString(config)), {
      node
    }];
  });
  var elToIdx = /* @__PURE__ */ new Map();
  function addMaybeListeners() {
    window.addEventListener("mousemove", handleMouseMoveMaybeDragStart, {
      passive: false
    });
    window.addEventListener("touchmove", handleMouseMoveMaybeDragStart, {
      passive: false,
      capture: false
    });
    window.addEventListener("mouseup", handleFalseAlarm, {
      passive: false
    });
    window.addEventListener("touchend", handleFalseAlarm, {
      passive: false
    });
  }
  function removeMaybeListeners() {
    window.removeEventListener("mousemove", handleMouseMoveMaybeDragStart);
    window.removeEventListener("touchmove", handleMouseMoveMaybeDragStart);
    window.removeEventListener("mouseup", handleFalseAlarm);
    window.removeEventListener("touchend", handleFalseAlarm);
  }
  function handleFalseAlarm() {
    removeMaybeListeners();
    originalDragTarget = void 0;
    dragStartMousePosition = void 0;
    currentMousePosition = void 0;
  }
  function handleMouseMoveMaybeDragStart(e) {
    e.preventDefault();
    var c = e.touches ? e.touches[0] : e;
    currentMousePosition = {
      x: c.clientX,
      y: c.clientY
    };
    if (Math.abs(currentMousePosition.x - dragStartMousePosition.x) >= MIN_MOVEMENT_BEFORE_DRAG_START_PX || Math.abs(currentMousePosition.y - dragStartMousePosition.y) >= MIN_MOVEMENT_BEFORE_DRAG_START_PX) {
      removeMaybeListeners();
      handleDragStart();
    }
  }
  function handleMouseDown(e) {
    if (e.target !== e.currentTarget && (e.target.value !== void 0 || e.target.isContentEditable)) {
      printDebug(function() {
        return "won't initiate drag on a nested input element";
      });
      return;
    }
    if (e.button) {
      printDebug(function() {
        return "ignoring none left click button: ".concat(e.button);
      });
      return;
    }
    if (isWorkingOnPreviousDrag) {
      printDebug(function() {
        return "cannot start a new drag before finalizing previous one";
      });
      return;
    }
    e.stopPropagation();
    var c = e.touches ? e.touches[0] : e;
    dragStartMousePosition = {
      x: c.clientX,
      y: c.clientY
    };
    currentMousePosition = _objectSpread2({}, dragStartMousePosition);
    originalDragTarget = e.currentTarget;
    addMaybeListeners();
  }
  function handleDragStart() {
    printDebug(function() {
      return ["drag start config: ".concat(toString(config)), originalDragTarget];
    });
    isWorkingOnPreviousDrag = true;
    var currentIdx = elToIdx.get(originalDragTarget);
    originIndex = currentIdx;
    originDropZone = originalDragTarget.parentElement;
    var rootNode = originDropZone.getRootNode();
    var originDropZoneRoot = rootNode.body || rootNode;
    var items = config.items, type = config.type, centreDraggedOnCursor = config.centreDraggedOnCursor;
    draggedElData = _objectSpread2({}, items[currentIdx]);
    draggedElType = type;
    shadowElData = _objectSpread2(_objectSpread2({}, draggedElData), {}, _defineProperty({}, SHADOW_ITEM_MARKER_PROPERTY_NAME, true));
    var placeHolderElData = _objectSpread2(_objectSpread2({}, shadowElData), {}, _defineProperty({}, ITEM_ID_KEY, SHADOW_PLACEHOLDER_ITEM_ID));
    draggedEl = createDraggedElementFrom(originalDragTarget, centreDraggedOnCursor && currentMousePosition);
    function keepOriginalElementInDom() {
      if (!draggedEl.parentElement) {
        originDropZoneRoot.appendChild(draggedEl);
        draggedEl.focus();
        watchDraggedElement();
        hideOriginalDragTarget(originalDragTarget);
        originDropZoneRoot.appendChild(originalDragTarget);
      } else {
        window.requestAnimationFrame(keepOriginalElementInDom);
      }
    }
    window.requestAnimationFrame(keepOriginalElementInDom);
    styleActiveDropZones(Array.from(typeToDropZones.get(config.type)).filter(function(dz) {
      return dz === originDropZone || !dzToConfig.get(dz).dropFromOthersDisabled;
    }), function(dz) {
      return dzToConfig.get(dz).dropTargetStyle;
    }, function(dz) {
      return dzToConfig.get(dz).dropTargetClasses;
    });
    items.splice(currentIdx, 1, placeHolderElData);
    unlockOriginDzMinDimensions = preventShrinking(originDropZone);
    dispatchConsiderEvent(originDropZone, items, {
      trigger: TRIGGERS.DRAG_STARTED,
      id: draggedElData[ITEM_ID_KEY],
      source: SOURCES.POINTER
    });
    window.addEventListener("mousemove", handleMouseMove, {
      passive: false
    });
    window.addEventListener("touchmove", handleMouseMove, {
      passive: false,
      capture: false
    });
    window.addEventListener("mouseup", handleDrop, {
      passive: false
    });
    window.addEventListener("touchend", handleDrop, {
      passive: false
    });
  }
  function configure(_ref) {
    var _ref$items = _ref.items, items = _ref$items === void 0 ? void 0 : _ref$items, _ref$flipDurationMs = _ref.flipDurationMs, dropAnimationDurationMs = _ref$flipDurationMs === void 0 ? 0 : _ref$flipDurationMs, _ref$type = _ref.type, newType = _ref$type === void 0 ? DEFAULT_DROP_ZONE_TYPE : _ref$type, _ref$dragDisabled = _ref.dragDisabled, dragDisabled = _ref$dragDisabled === void 0 ? false : _ref$dragDisabled, _ref$morphDisabled = _ref.morphDisabled, morphDisabled = _ref$morphDisabled === void 0 ? false : _ref$morphDisabled, _ref$dropFromOthersDi = _ref.dropFromOthersDisabled, dropFromOthersDisabled = _ref$dropFromOthersDi === void 0 ? false : _ref$dropFromOthersDi, _ref$dropTargetStyle = _ref.dropTargetStyle, dropTargetStyle = _ref$dropTargetStyle === void 0 ? DEFAULT_DROP_TARGET_STYLE : _ref$dropTargetStyle, _ref$dropTargetClasse = _ref.dropTargetClasses, dropTargetClasses = _ref$dropTargetClasse === void 0 ? [] : _ref$dropTargetClasse, _ref$transformDragged = _ref.transformDraggedElement, transformDraggedElement = _ref$transformDragged === void 0 ? function() {
    } : _ref$transformDragged, _ref$centreDraggedOnC = _ref.centreDraggedOnCursor, centreDraggedOnCursor = _ref$centreDraggedOnC === void 0 ? false : _ref$centreDraggedOnC;
    config.dropAnimationDurationMs = dropAnimationDurationMs;
    if (config.type && newType !== config.type) {
      unregisterDropZone(node, config.type);
    }
    config.type = newType;
    registerDropZone(node, newType);
    config.items = _toConsumableArray(items);
    config.dragDisabled = dragDisabled;
    config.morphDisabled = morphDisabled;
    config.transformDraggedElement = transformDraggedElement;
    config.centreDraggedOnCursor = centreDraggedOnCursor;
    if (isWorkingOnPreviousDrag && !finalizingPreviousDrag && (!areObjectsShallowEqual(dropTargetStyle, config.dropTargetStyle) || !areArraysShallowEqualSameOrder(dropTargetClasses, config.dropTargetClasses))) {
      styleInactiveDropZones([node], function() {
        return config.dropTargetStyle;
      }, function() {
        return dropTargetClasses;
      });
      styleActiveDropZones([node], function() {
        return dropTargetStyle;
      }, function() {
        return dropTargetClasses;
      });
    }
    config.dropTargetStyle = dropTargetStyle;
    config.dropTargetClasses = _toConsumableArray(dropTargetClasses);
    function getConfigProp(dz, propName) {
      return dzToConfig.get(dz) ? dzToConfig.get(dz)[propName] : config[propName];
    }
    if (isWorkingOnPreviousDrag && config.dropFromOthersDisabled !== dropFromOthersDisabled) {
      if (dropFromOthersDisabled) {
        styleInactiveDropZones([node], function(dz) {
          return getConfigProp(dz, "dropTargetStyle");
        }, function(dz) {
          return getConfigProp(dz, "dropTargetClasses");
        });
      } else {
        styleActiveDropZones([node], function(dz) {
          return getConfigProp(dz, "dropTargetStyle");
        }, function(dz) {
          return getConfigProp(dz, "dropTargetClasses");
        });
      }
    }
    config.dropFromOthersDisabled = dropFromOthersDisabled;
    dzToConfig.set(node, config);
    var shadowElIdx = findShadowElementIdx(config.items);
    var _loop = function _loop2(idx2) {
      var draggableEl = node.children[idx2];
      styleDraggable(draggableEl, dragDisabled);
      if (idx2 === shadowElIdx) {
        if (!morphDisabled) {
          morphDraggedElementToBeLike(draggedEl, draggableEl, currentMousePosition.x, currentMousePosition.y, function() {
            return config.transformDraggedElement(draggedEl, draggedElData, idx2);
          });
        }
        decorateShadowEl(draggableEl);
        return "continue";
      }
      draggableEl.removeEventListener("mousedown", elToMouseDownListener.get(draggableEl));
      draggableEl.removeEventListener("touchstart", elToMouseDownListener.get(draggableEl));
      if (!dragDisabled) {
        draggableEl.addEventListener("mousedown", handleMouseDown);
        draggableEl.addEventListener("touchstart", handleMouseDown);
        elToMouseDownListener.set(draggableEl, handleMouseDown);
      }
      elToIdx.set(draggableEl, idx2);
    };
    for (var idx = 0; idx < node.children.length; idx++) {
      var _ret = _loop(idx);
      if (_ret === "continue")
        continue;
    }
  }
  configure(options);
  return {
    update: function update2(newOptions) {
      printDebug(function() {
        return "pointer dndzone will update newOptions: ".concat(toString(newOptions));
      });
      configure(newOptions);
    },
    destroy: function destroy() {
      printDebug(function() {
        return "pointer dndzone will destroy";
      });
      unregisterDropZone(node, config.type);
      dzToConfig["delete"](node);
    }
  };
}
var _ID_TO_INSTRUCTION;
var INSTRUCTION_IDs = {
  DND_ZONE_ACTIVE: "dnd-zone-active",
  DND_ZONE_DRAG_DISABLED: "dnd-zone-drag-disabled"
};
var ID_TO_INSTRUCTION = (_ID_TO_INSTRUCTION = {}, _defineProperty(_ID_TO_INSTRUCTION, INSTRUCTION_IDs.DND_ZONE_ACTIVE, "Tab to one the items and press space-bar or enter to start dragging it"), _defineProperty(_ID_TO_INSTRUCTION, INSTRUCTION_IDs.DND_ZONE_DRAG_DISABLED, "This is a disabled drag and drop list"), _ID_TO_INSTRUCTION);
var ALERT_DIV_ID = "dnd-action-aria-alert";
var alertsDiv;
function initAriaOnBrowser() {
  alertsDiv = document.createElement("div");
  (function initAlertsDiv() {
    alertsDiv.id = ALERT_DIV_ID;
    alertsDiv.style.position = "fixed";
    alertsDiv.style.bottom = "0";
    alertsDiv.style.left = "0";
    alertsDiv.style.zIndex = "-5";
    alertsDiv.style.opacity = "0";
    alertsDiv.style.height = "0";
    alertsDiv.style.width = "0";
    alertsDiv.setAttribute("role", "alert");
  })();
  document.body.prepend(alertsDiv);
  Object.entries(ID_TO_INSTRUCTION).forEach(function(_ref) {
    var _ref2 = _slicedToArray(_ref, 2), id = _ref2[0], txt = _ref2[1];
    return document.body.prepend(instructionToHiddenDiv(id, txt));
  });
}
function initAria() {
  if (isOnServer)
    return null;
  if (document.readyState === "complete") {
    initAriaOnBrowser();
  } else {
    window.addEventListener("DOMContentLoaded", initAriaOnBrowser);
  }
  return _objectSpread2({}, INSTRUCTION_IDs);
}
function instructionToHiddenDiv(id, txt) {
  var div = document.createElement("div");
  div.id = id;
  div.innerHTML = "<p>".concat(txt, "</p>");
  div.style.display = "none";
  div.style.position = "fixed";
  div.style.zIndex = "-5";
  return div;
}
function alertToScreenReader(txt) {
  alertsDiv.innerHTML = "";
  var alertText = document.createTextNode(txt);
  alertsDiv.appendChild(alertText);
  alertsDiv.style.display = "none";
  alertsDiv.style.display = "inline";
}
var DEFAULT_DROP_ZONE_TYPE$1 = "--any--";
var DEFAULT_DROP_TARGET_STYLE$1 = {
  outline: "rgba(255, 255, 102, 0.7) solid 2px"
};
var isDragging = false;
var draggedItemType;
var focusedDz;
var focusedDzLabel = "";
var focusedItem;
var focusedItemId;
var focusedItemLabel = "";
var allDragTargets = new WeakSet();
var elToKeyDownListeners = new WeakMap();
var elToFocusListeners = new WeakMap();
var dzToHandles = /* @__PURE__ */ new Map();
var dzToConfig$1 = /* @__PURE__ */ new Map();
var typeToDropZones$1 = /* @__PURE__ */ new Map();
var INSTRUCTION_IDs$1 = initAria();
function registerDropZone$1(dropZoneEl, type) {
  printDebug(function() {
    return "registering drop-zone if absent";
  });
  if (typeToDropZones$1.size === 0) {
    printDebug(function() {
      return "adding global keydown and click handlers";
    });
    window.addEventListener("keydown", globalKeyDownHandler);
    window.addEventListener("click", globalClickHandler);
  }
  if (!typeToDropZones$1.has(type)) {
    typeToDropZones$1.set(type, /* @__PURE__ */ new Set());
  }
  if (!typeToDropZones$1.get(type).has(dropZoneEl)) {
    typeToDropZones$1.get(type).add(dropZoneEl);
    incrementActiveDropZoneCount();
  }
}
function unregisterDropZone$1(dropZoneEl, type) {
  printDebug(function() {
    return "unregistering drop-zone";
  });
  if (focusedDz === dropZoneEl) {
    handleDrop$1();
  }
  typeToDropZones$1.get(type)["delete"](dropZoneEl);
  decrementActiveDropZoneCount();
  if (typeToDropZones$1.get(type).size === 0) {
    typeToDropZones$1["delete"](type);
  }
  if (typeToDropZones$1.size === 0) {
    printDebug(function() {
      return "removing global keydown and click handlers";
    });
    window.removeEventListener("keydown", globalKeyDownHandler);
    window.removeEventListener("click", globalClickHandler);
  }
}
function globalKeyDownHandler(e) {
  if (!isDragging)
    return;
  switch (e.key) {
    case "Escape": {
      handleDrop$1();
      break;
    }
  }
}
function globalClickHandler() {
  if (!isDragging)
    return;
  if (!allDragTargets.has(document.activeElement)) {
    printDebug(function() {
      return "clicked outside of any draggable";
    });
    handleDrop$1();
  }
}
function handleZoneFocus(e) {
  printDebug(function() {
    return "zone focus";
  });
  if (!isDragging)
    return;
  var newlyFocusedDz = e.currentTarget;
  if (newlyFocusedDz === focusedDz)
    return;
  focusedDzLabel = newlyFocusedDz.getAttribute("aria-label") || "";
  var _dzToConfig$get = dzToConfig$1.get(focusedDz), originItems = _dzToConfig$get.items;
  var originItem = originItems.find(function(item) {
    return item[ITEM_ID_KEY] === focusedItemId;
  });
  var originIdx = originItems.indexOf(originItem);
  var itemToMove = originItems.splice(originIdx, 1)[0];
  var _dzToConfig$get2 = dzToConfig$1.get(newlyFocusedDz), targetItems = _dzToConfig$get2.items, autoAriaDisabled = _dzToConfig$get2.autoAriaDisabled;
  if (newlyFocusedDz.getBoundingClientRect().top < focusedDz.getBoundingClientRect().top || newlyFocusedDz.getBoundingClientRect().left < focusedDz.getBoundingClientRect().left) {
    targetItems.push(itemToMove);
    if (!autoAriaDisabled) {
      alertToScreenReader("Moved item ".concat(focusedItemLabel, " to the end of the list ").concat(focusedDzLabel));
    }
  } else {
    targetItems.unshift(itemToMove);
    if (!autoAriaDisabled) {
      alertToScreenReader("Moved item ".concat(focusedItemLabel, " to the beginning of the list ").concat(focusedDzLabel));
    }
  }
  var dzFrom = focusedDz;
  dispatchFinalizeEvent(dzFrom, originItems, {
    trigger: TRIGGERS.DROPPED_INTO_ANOTHER,
    id: focusedItemId,
    source: SOURCES.KEYBOARD
  });
  dispatchFinalizeEvent(newlyFocusedDz, targetItems, {
    trigger: TRIGGERS.DROPPED_INTO_ZONE,
    id: focusedItemId,
    source: SOURCES.KEYBOARD
  });
  focusedDz = newlyFocusedDz;
}
function triggerAllDzsUpdate() {
  dzToHandles.forEach(function(_ref, dz) {
    var update2 = _ref.update;
    return update2(dzToConfig$1.get(dz));
  });
}
function handleDrop$1() {
  var dispatchConsider = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
  printDebug(function() {
    return "drop";
  });
  if (!dzToConfig$1.get(focusedDz).autoAriaDisabled) {
    alertToScreenReader("Stopped dragging item ".concat(focusedItemLabel));
  }
  if (allDragTargets.has(document.activeElement)) {
    document.activeElement.blur();
  }
  if (dispatchConsider) {
    dispatchConsiderEvent(focusedDz, dzToConfig$1.get(focusedDz).items, {
      trigger: TRIGGERS.DRAG_STOPPED,
      id: focusedItemId,
      source: SOURCES.KEYBOARD
    });
  }
  styleInactiveDropZones(typeToDropZones$1.get(draggedItemType), function(dz) {
    return dzToConfig$1.get(dz).dropTargetStyle;
  }, function(dz) {
    return dzToConfig$1.get(dz).dropTargetClasses;
  });
  focusedItem = null;
  focusedItemId = null;
  focusedItemLabel = "";
  draggedItemType = null;
  focusedDz = null;
  focusedDzLabel = "";
  isDragging = false;
  triggerAllDzsUpdate();
}
function dndzone$1(node, options) {
  var config = {
    items: void 0,
    type: void 0,
    dragDisabled: false,
    zoneTabIndex: 0,
    dropFromOthersDisabled: false,
    dropTargetStyle: DEFAULT_DROP_TARGET_STYLE$1,
    dropTargetClasses: [],
    autoAriaDisabled: false
  };
  function swap(arr, i, j) {
    if (arr.length <= 1)
      return;
    arr.splice(j, 1, arr.splice(i, 1, arr[j])[0]);
  }
  function handleKeyDown(e) {
    printDebug(function() {
      return ["handling key down", e.key];
    });
    switch (e.key) {
      case "Enter":
      case " ": {
        if ((e.target.disabled !== void 0 || e.target.href || e.target.isContentEditable) && !allDragTargets.has(e.target)) {
          return;
        }
        e.preventDefault();
        e.stopPropagation();
        if (isDragging) {
          handleDrop$1();
        } else {
          handleDragStart(e);
        }
        break;
      }
      case "ArrowDown":
      case "ArrowRight": {
        if (!isDragging)
          return;
        e.preventDefault();
        e.stopPropagation();
        var _dzToConfig$get3 = dzToConfig$1.get(node), items = _dzToConfig$get3.items;
        var children2 = Array.from(node.children);
        var idx = children2.indexOf(e.currentTarget);
        printDebug(function() {
          return ["arrow down", idx];
        });
        if (idx < children2.length - 1) {
          if (!config.autoAriaDisabled) {
            alertToScreenReader("Moved item ".concat(focusedItemLabel, " to position ").concat(idx + 2, " in the list ").concat(focusedDzLabel));
          }
          swap(items, idx, idx + 1);
          dispatchFinalizeEvent(node, items, {
            trigger: TRIGGERS.DROPPED_INTO_ZONE,
            id: focusedItemId,
            source: SOURCES.KEYBOARD
          });
        }
        break;
      }
      case "ArrowUp":
      case "ArrowLeft": {
        if (!isDragging)
          return;
        e.preventDefault();
        e.stopPropagation();
        var _dzToConfig$get4 = dzToConfig$1.get(node), _items = _dzToConfig$get4.items;
        var _children = Array.from(node.children);
        var _idx = _children.indexOf(e.currentTarget);
        printDebug(function() {
          return ["arrow up", _idx];
        });
        if (_idx > 0) {
          if (!config.autoAriaDisabled) {
            alertToScreenReader("Moved item ".concat(focusedItemLabel, " to position ").concat(_idx, " in the list ").concat(focusedDzLabel));
          }
          swap(_items, _idx, _idx - 1);
          dispatchFinalizeEvent(node, _items, {
            trigger: TRIGGERS.DROPPED_INTO_ZONE,
            id: focusedItemId,
            source: SOURCES.KEYBOARD
          });
        }
        break;
      }
    }
  }
  function handleDragStart(e) {
    printDebug(function() {
      return "drag start";
    });
    setCurrentFocusedItem(e.currentTarget);
    focusedDz = node;
    draggedItemType = config.type;
    isDragging = true;
    var dropTargets = Array.from(typeToDropZones$1.get(config.type)).filter(function(dz) {
      return dz === focusedDz || !dzToConfig$1.get(dz).dropFromOthersDisabled;
    });
    styleActiveDropZones(dropTargets, function(dz) {
      return dzToConfig$1.get(dz).dropTargetStyle;
    }, function(dz) {
      return dzToConfig$1.get(dz).dropTargetClasses;
    });
    if (!config.autoAriaDisabled) {
      var msg = "Started dragging item ".concat(focusedItemLabel, ". Use the arrow keys to move it within its list ").concat(focusedDzLabel);
      if (dropTargets.length > 1) {
        msg += ", or tab to another list in order to move the item into it";
      }
      alertToScreenReader(msg);
    }
    dispatchConsiderEvent(node, dzToConfig$1.get(node).items, {
      trigger: TRIGGERS.DRAG_STARTED,
      id: focusedItemId,
      source: SOURCES.KEYBOARD
    });
    triggerAllDzsUpdate();
  }
  function handleClick(e) {
    if (!isDragging)
      return;
    if (e.currentTarget === focusedItem)
      return;
    e.stopPropagation();
    handleDrop$1(false);
    handleDragStart(e);
  }
  function setCurrentFocusedItem(draggableEl) {
    var _dzToConfig$get5 = dzToConfig$1.get(node), items = _dzToConfig$get5.items;
    var children2 = Array.from(node.children);
    var focusedItemIdx = children2.indexOf(draggableEl);
    focusedItem = draggableEl;
    focusedItem.tabIndex = 0;
    focusedItemId = items[focusedItemIdx][ITEM_ID_KEY];
    focusedItemLabel = children2[focusedItemIdx].getAttribute("aria-label") || "";
  }
  function configure(_ref2) {
    var _ref2$items = _ref2.items, items = _ref2$items === void 0 ? [] : _ref2$items, _ref2$type = _ref2.type, newType = _ref2$type === void 0 ? DEFAULT_DROP_ZONE_TYPE$1 : _ref2$type, _ref2$dragDisabled = _ref2.dragDisabled, dragDisabled = _ref2$dragDisabled === void 0 ? false : _ref2$dragDisabled, _ref2$zoneTabIndex = _ref2.zoneTabIndex, zoneTabIndex = _ref2$zoneTabIndex === void 0 ? 0 : _ref2$zoneTabIndex, _ref2$dropFromOthersD = _ref2.dropFromOthersDisabled, dropFromOthersDisabled = _ref2$dropFromOthersD === void 0 ? false : _ref2$dropFromOthersD, _ref2$dropTargetStyle = _ref2.dropTargetStyle, dropTargetStyle = _ref2$dropTargetStyle === void 0 ? DEFAULT_DROP_TARGET_STYLE$1 : _ref2$dropTargetStyle, _ref2$dropTargetClass = _ref2.dropTargetClasses, dropTargetClasses = _ref2$dropTargetClass === void 0 ? [] : _ref2$dropTargetClass, _ref2$autoAriaDisable = _ref2.autoAriaDisabled, autoAriaDisabled = _ref2$autoAriaDisable === void 0 ? false : _ref2$autoAriaDisable;
    config.items = _toConsumableArray(items);
    config.dragDisabled = dragDisabled;
    config.dropFromOthersDisabled = dropFromOthersDisabled;
    config.zoneTabIndex = zoneTabIndex;
    config.dropTargetStyle = dropTargetStyle;
    config.dropTargetClasses = dropTargetClasses;
    config.autoAriaDisabled = autoAriaDisabled;
    if (!autoAriaDisabled) {
      node.setAttribute("aria-disabled", dragDisabled);
      node.setAttribute("role", "list");
      node.setAttribute("aria-describedby", dragDisabled ? INSTRUCTION_IDs$1.DND_ZONE_DRAG_DISABLED : INSTRUCTION_IDs$1.DND_ZONE_ACTIVE);
    }
    if (config.type && newType !== config.type) {
      unregisterDropZone$1(node, config.type);
    }
    config.type = newType;
    registerDropZone$1(node, newType);
    dzToConfig$1.set(node, config);
    if (isDragging) {
      node.tabIndex = node === focusedDz || focusedItem.contains(node) || config.dropFromOthersDisabled || focusedDz && config.type !== dzToConfig$1.get(focusedDz).type ? -1 : 0;
    } else {
      node.tabIndex = config.zoneTabIndex;
    }
    node.addEventListener("focus", handleZoneFocus);
    var _loop = function _loop2(i2) {
      var draggableEl = node.children[i2];
      allDragTargets.add(draggableEl);
      draggableEl.tabIndex = isDragging ? -1 : 0;
      if (!autoAriaDisabled) {
        draggableEl.setAttribute("role", "listitem");
      }
      draggableEl.removeEventListener("keydown", elToKeyDownListeners.get(draggableEl));
      draggableEl.removeEventListener("click", elToFocusListeners.get(draggableEl));
      if (!dragDisabled) {
        draggableEl.addEventListener("keydown", handleKeyDown);
        elToKeyDownListeners.set(draggableEl, handleKeyDown);
        draggableEl.addEventListener("click", handleClick);
        elToFocusListeners.set(draggableEl, handleClick);
      }
      if (isDragging && config.items[i2][ITEM_ID_KEY] === focusedItemId) {
        printDebug(function() {
          return ["focusing on", {
            i: i2,
            focusedItemId
          }];
        });
        focusedItem = draggableEl;
        focusedItem.tabIndex = 0;
        draggableEl.focus();
      }
    };
    for (var i = 0; i < node.children.length; i++) {
      _loop(i);
    }
  }
  configure(options);
  var handles = {
    update: function update2(newOptions) {
      printDebug(function() {
        return "keyboard dndzone will update newOptions: ".concat(toString(newOptions));
      });
      configure(newOptions);
    },
    destroy: function destroy() {
      printDebug(function() {
        return "keyboard dndzone will destroy";
      });
      unregisterDropZone$1(node, config.type);
      dzToConfig$1["delete"](node);
      dzToHandles["delete"](node);
    }
  };
  dzToHandles.set(node, handles);
  return handles;
}
function dndzone$2(node, options) {
  validateOptions(options);
  var pointerZone = dndzone(node, options);
  var keyboardZone = dndzone$1(node, options);
  return {
    update: function update2(newOptions) {
      validateOptions(newOptions);
      pointerZone.update(newOptions);
      keyboardZone.update(newOptions);
    },
    destroy: function destroy() {
      pointerZone.destroy();
      keyboardZone.destroy();
    }
  };
}
function validateOptions(options) {
  var items = options.items, flipDurationMs2 = options.flipDurationMs, type = options.type, dragDisabled = options.dragDisabled, morphDisabled = options.morphDisabled, dropFromOthersDisabled = options.dropFromOthersDisabled, zoneTabIndex = options.zoneTabIndex, dropTargetStyle = options.dropTargetStyle, dropTargetClasses = options.dropTargetClasses, transformDraggedElement = options.transformDraggedElement, autoAriaDisabled = options.autoAriaDisabled, centreDraggedOnCursor = options.centreDraggedOnCursor, rest = _objectWithoutProperties(options, ["items", "flipDurationMs", "type", "dragDisabled", "morphDisabled", "dropFromOthersDisabled", "zoneTabIndex", "dropTargetStyle", "dropTargetClasses", "transformDraggedElement", "autoAriaDisabled", "centreDraggedOnCursor"]);
  if (Object.keys(rest).length > 0) {
    console.warn("dndzone will ignore unknown options", rest);
  }
  if (!items) {
    throw new Error("no 'items' key provided to dndzone");
  }
  var itemWithMissingId = items.find(function(item) {
    return !{}.hasOwnProperty.call(item, ITEM_ID_KEY);
  });
  if (itemWithMissingId) {
    throw new Error("missing '".concat(ITEM_ID_KEY, "' property for item ").concat(toString(itemWithMissingId)));
  }
  if (dropTargetClasses && !Array.isArray(dropTargetClasses)) {
    throw new Error("dropTargetClasses should be an array but instead it is a ".concat(_typeof(dropTargetClasses), ", ").concat(toString(dropTargetClasses)));
  }
  if (zoneTabIndex && !isInt(zoneTabIndex)) {
    throw new Error("zoneTabIndex should be a number but instead it is a ".concat(_typeof(zoneTabIndex), ", ").concat(toString(zoneTabIndex)));
  }
}
function isInt(value) {
  return !isNaN(value) && function(x) {
    return (x | 0) === x;
  }(parseFloat(value));
}

// src/svelte/Initiative.svelte
var import_obsidian11 = __toModule(require("obsidian"));
function add_css5(target) {
  append_styles(target, "svelte-1kp13ds", '.tree-item-flair-outer.svelte-1kp13ds::after{content:""}.initiative.svelte-1kp13ds{display:block;padding:0;width:20px;text-align:center;white-space:nowrap;user-select:all;border:0;color:inherit}');
}
function create_key_block(ctx) {
  let input;
  let input_aria_label_value;
  let mounted;
  let dispose;
  return {
    c() {
      input = element("input");
      attr(input, "class", "editable initiative tree-item-flair svelte-1kp13ds");
      attr(input, "aria-label", input_aria_label_value = `${ctx[0] - ctx[1]} + ${ctx[1]}`);
      input.value = ctx[0];
    },
    m(target, anchor) {
      insert(target, input, anchor);
      if (!mounted) {
        dispose = [
          listen(input, "click", click_handler),
          listen(input, "blur", ctx[3]),
          listen(input, "keydown", keydown_handler)
        ];
        mounted = true;
      }
    },
    p(ctx2, dirty) {
      if (dirty & 3 && input_aria_label_value !== (input_aria_label_value = `${ctx2[0] - ctx2[1]} + ${ctx2[1]}`)) {
        attr(input, "aria-label", input_aria_label_value);
      }
      if (dirty & 1 && input.value !== ctx2[0]) {
        input.value = ctx2[0];
      }
    },
    d(detaching) {
      if (detaching)
        detach(input);
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_fragment6(ctx) {
  let div;
  let previous_key = ctx[0];
  let key_block = create_key_block(ctx);
  return {
    c() {
      div = element("div");
      key_block.c();
      attr(div, "class", "tree-item-flair-outer svelte-1kp13ds");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      key_block.m(div, null);
    },
    p(ctx2, [dirty]) {
      if (dirty & 1 && safe_not_equal(previous_key, previous_key = ctx2[0])) {
        key_block.d(1);
        key_block = create_key_block(ctx2);
        key_block.c();
        key_block.m(div, null);
      } else {
        key_block.p(ctx2, dirty);
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div);
      key_block.d(detaching);
    }
  };
}
var click_handler = function(evt) {
  this.select();
};
var keydown_handler = function(evt) {
  if (evt.key === "Enter" || evt.key === "Tab") {
    evt.preventDefault();
    this.blur();
    return;
  }
  if (!/^(\d*\.?\d*|Backspace|Delete|Arrow\w+)$/.test(evt.key)) {
    evt.preventDefault();
    return false;
  }
};
function instance6($$self, $$props, $$invalidate) {
  const dispatch = createEventDispatcher();
  let { initiative } = $$props;
  let { modifier } = $$props;
  const blur_handler = function(evt) {
    const value = this.value;
    if (isNaN(Number(value)) || Number(value) < 1) {
      new import_obsidian11.Notice("Enter a valid initiative.");
      this.value = `${initiative}`;
      return;
    }
    if (initiative == Number(value)) {
      return;
    }
    dispatch("initiative", Number(value));
  };
  $$self.$$set = ($$props2) => {
    if ("initiative" in $$props2)
      $$invalidate(0, initiative = $$props2.initiative);
    if ("modifier" in $$props2)
      $$invalidate(1, modifier = $$props2.modifier);
  };
  return [initiative, modifier, dispatch, blur_handler];
}
var Initiative = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance6, create_fragment6, safe_not_equal, { initiative: 0, modifier: 1 }, add_css5);
  }
};
var Initiative_default = Initiative;

// src/svelte/CreatureControls.svelte
var import_obsidian12 = __toModule(require("obsidian"));
function add_css6(target) {
  append_styles(target, "svelte-ptr4mi", ".controls.svelte-ptr4mi{display:flex;justify-content:flex-end}.icon.svelte-ptr4mi .clickable-icon{margin-right:0}");
}
function create_fragment7(ctx) {
  let div1;
  let div0;
  let hamburgerIcon_action;
  let mounted;
  let dispose;
  return {
    c() {
      div1 = element("div");
      div0 = element("div");
      attr(div0, "class", "add-button icon svelte-ptr4mi");
      attr(div1, "class", "controls svelte-ptr4mi");
    },
    m(target, anchor) {
      insert(target, div1, anchor);
      append(div1, div0);
      if (!mounted) {
        dispose = action_destroyer(hamburgerIcon_action = ctx[0].call(null, div0));
        mounted = true;
      }
    },
    p: noop,
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div1);
      mounted = false;
      dispose();
    }
  };
}
function instance7($$self, $$props, $$invalidate) {
  const dispatch = createEventDispatcher();
  let { view } = $$props;
  let { creature } = $$props;
  const hamburgerIcon = (node) => {
    const hamburger = new import_obsidian12.ExtraButtonComponent(node).setIcon("vertical-three-dots").setTooltip("Actions");
    hamburger.extraSettingsEl.onclick = (evt) => {
      evt.stopPropagation();
      const menu = new import_obsidian12.Menu(view.plugin.app);
      menu.addItem((item) => {
        item.setIcon("pencil").setTitle("Edit").onClick(() => {
          dispatch("edit", creature);
        });
      });
      menu.addItem((item) => {
        item.setIcon(TAG).setTitle("Add Status").onClick(() => {
          dispatch("tag", creature);
        });
      });
      if (creature.enabled) {
        menu.addItem((item) => {
          item.setIcon(DISABLE).setTitle("Disable").onClick(() => {
            view.setCreatureState(creature, false);
          });
        });
      } else {
        menu.addItem((item) => {
          item.setIcon(ENABLE).setTitle("Enable").onClick(() => {
            view.setCreatureState(creature, true);
          });
        });
      }
      if (view.plugin.data.leafletIntegration) {
        menu.addItem((item) => {
          item.setIcon(MAPMARKER).setTitle("Change Marker").onClick((evt2) => {
            const markerMenu = new import_obsidian12.Menu(view.plugin.app);
            markerMenu.setNoIcon();
            for (let marker of view.plugin.leaflet.markerIcons) {
              markerMenu.addItem((item2) => {
                item2.setTitle(marker.type);
                item2.onClick(() => {
                  view.updateCreature(creature, { marker: marker.type });
                });
              });
            }
            markerMenu.showAtMouseEvent(evt2);
          });
        });
      }
      menu.addItem((item) => {
        item.setIcon(REMOVE).setTitle("Remove").onClick(() => {
          view.removeCreature(creature);
        });
      });
      menu.showAtPosition(evt);
    };
  };
  $$self.$$set = ($$props2) => {
    if ("view" in $$props2)
      $$invalidate(1, view = $$props2.view);
    if ("creature" in $$props2)
      $$invalidate(2, creature = $$props2.creature);
  };
  return [hamburgerIcon, view, creature];
}
var CreatureControls = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance7, create_fragment7, safe_not_equal, { view: 1, creature: 2 }, add_css6);
  }
};
var CreatureControls_default = CreatureControls;

// src/svelte/Status.svelte
var import_obsidian13 = __toModule(require("obsidian"));
function add_css7(target) {
  append_styles(target, "svelte-7lk3cs", ".tag.svelte-7lk3cs{display:flex;align-items:center;gap:0.125rem;color:var(--text-muted);font-size:small;width:fit-content;border-radius:0.25rem}.tag.svelte-7lk3cs .clickable-icon{margin:0}");
}
function create_fragment8(ctx) {
  let div1;
  let span;
  let t0_value = ctx[0].name + "";
  let t0;
  let t1;
  let div0;
  let deleteIcon_action;
  let div1_aria_label_value;
  let mounted;
  let dispose;
  return {
    c() {
      div1 = element("div");
      span = element("span");
      t0 = text(t0_value);
      t1 = space();
      div0 = element("div");
      attr(div1, "class", "tag svelte-7lk3cs");
      attr(div1, "aria-label", div1_aria_label_value = ctx[0].description?.length ? ctx[0].description : null);
      attr(div1, "aria-label-classes", "initiative-tracker-condition-tooltip");
    },
    m(target, anchor) {
      insert(target, div1, anchor);
      append(div1, span);
      append(span, t0);
      append(div1, t1);
      append(div1, div0);
      if (!mounted) {
        dispose = [
          action_destroyer(deleteIcon_action = ctx[2].call(null, div0)),
          listen(div0, "click", ctx[3])
        ];
        mounted = true;
      }
    },
    p(ctx2, [dirty]) {
      if (dirty & 1 && t0_value !== (t0_value = ctx2[0].name + ""))
        set_data(t0, t0_value);
      if (dirty & 1 && div1_aria_label_value !== (div1_aria_label_value = ctx2[0].description?.length ? ctx2[0].description : null)) {
        attr(div1, "aria-label", div1_aria_label_value);
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div1);
      mounted = false;
      run_all(dispose);
    }
  };
}
function instance8($$self, $$props, $$invalidate) {
  const dispatch = createEventDispatcher();
  let { status } = $$props;
  const deleteIcon = (node) => {
    new import_obsidian13.ExtraButtonComponent(node).setIcon("cross-in-box");
  };
  const click_handler3 = () => dispatch("remove");
  $$self.$$set = ($$props2) => {
    if ("status" in $$props2)
      $$invalidate(0, status = $$props2.status);
  };
  return [status, dispatch, deleteIcon, click_handler3];
}
var Status = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance8, create_fragment8, safe_not_equal, { status: 0 }, add_css7);
  }
};
var Status_default = Status;

// src/svelte/Creature.svelte
function add_css8(target) {
  append_styles(target, "svelte-cnqzyh", ".name-holder.svelte-cnqzyh{display:flex;gap:0.25rem;font-size:small}.name.svelte-cnqzyh{display:block;text-align:left;background-color:inherit;border:0;padding:0;height:unset;word-break:keep-all}.center.svelte-cnqzyh{text-align:center}.editable.svelte-cnqzyh:not(.player){cursor:pointer}.statuses.svelte-cnqzyh{display:flex;flex-flow:row wrap;column-gap:0.25rem}.initiative-container.svelte-cnqzyh{border-top-left-radius:0.25rem;border-bottom-left-radius:0.25rem}.controls-container.svelte-cnqzyh{border-top-right-radius:0.25rem;border-bottom-right-radius:0.25rem}");
}
function get_each_context5(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[10] = list[i];
  return child_ctx;
}
function create_else_block5(ctx) {
  let span;
  return {
    c() {
      span = element("span");
      span.textContent = `${ctx[4]()}`;
      attr(span, "class", "name svelte-cnqzyh");
    },
    m(target, anchor) {
      insert(target, span, anchor);
    },
    p: noop,
    d(detaching) {
      if (detaching)
        detach(span);
    }
  };
}
function create_if_block_14(ctx) {
  let strong;
  let t_value = ctx[0].name + "";
  let t;
  return {
    c() {
      strong = element("strong");
      t = text(t_value);
      attr(strong, "class", "name player svelte-cnqzyh");
    },
    m(target, anchor) {
      insert(target, strong, anchor);
      append(strong, t);
    },
    p(ctx2, dirty) {
      if (dirty & 1 && t_value !== (t_value = ctx2[0].name + ""))
        set_data(t, t_value);
    },
    d(detaching) {
      if (detaching)
        detach(strong);
    }
  };
}
function create_if_block6(ctx) {
  let each_1_anchor;
  let current;
  let each_value = [...ctx[1]];
  let each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1) {
    each_blocks[i] = create_each_block5(get_each_context5(ctx, each_value, i));
  }
  const out = (i) => transition_out(each_blocks[i], 1, 1, () => {
    each_blocks[i] = null;
  });
  return {
    c() {
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].c();
      }
      each_1_anchor = empty();
    },
    m(target, anchor) {
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].m(target, anchor);
      }
      insert(target, each_1_anchor, anchor);
      current = true;
    },
    p(ctx2, dirty) {
      if (dirty & 3) {
        each_value = [...ctx2[1]];
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context5(ctx2, each_value, i);
          if (each_blocks[i]) {
            each_blocks[i].p(child_ctx, dirty);
            transition_in(each_blocks[i], 1);
          } else {
            each_blocks[i] = create_each_block5(child_ctx);
            each_blocks[i].c();
            transition_in(each_blocks[i], 1);
            each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
          }
        }
        group_outros();
        for (i = each_value.length; i < each_blocks.length; i += 1) {
          out(i);
        }
        check_outros();
      }
    },
    i(local) {
      if (current)
        return;
      for (let i = 0; i < each_value.length; i += 1) {
        transition_in(each_blocks[i]);
      }
      current = true;
    },
    o(local) {
      each_blocks = each_blocks.filter(Boolean);
      for (let i = 0; i < each_blocks.length; i += 1) {
        transition_out(each_blocks[i]);
      }
      current = false;
    },
    d(detaching) {
      destroy_each(each_blocks, detaching);
      if (detaching)
        detach(each_1_anchor);
    }
  };
}
function create_each_block5(ctx) {
  let status;
  let current;
  function remove_handler() {
    return ctx[6](ctx[10]);
  }
  status = new Status_default({ props: { status: ctx[10] } });
  status.$on("remove", remove_handler);
  return {
    c() {
      create_component(status.$$.fragment);
    },
    m(target, anchor) {
      mount_component(status, target, anchor);
      current = true;
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      const status_changes = {};
      if (dirty & 2)
        status_changes.status = ctx[10];
      status.$set(status_changes);
    },
    i(local) {
      if (current)
        return;
      transition_in(status.$$.fragment, local);
      current = true;
    },
    o(local) {
      transition_out(status.$$.fragment, local);
      current = false;
    },
    d(detaching) {
      destroy_component(status, detaching);
    }
  };
}
function create_fragment9(ctx) {
  let td0;
  let initiative;
  let t0;
  let td1;
  let div0;
  let t1;
  let div1;
  let t2;
  let td2;
  let span;
  let t3_value = ctx[0].hpDisplay + "";
  let t3;
  let t4;
  let td3;
  let t5_value = (ctx[0].ac ?? DEFAULT_UNDEFINED) + "";
  let t5;
  let t6;
  let td4;
  let creaturecontrols;
  let current;
  let mounted;
  let dispose;
  initiative = new Initiative_default({
    props: {
      initiative: ctx[0].initiative,
      modifier: ctx[0].modifier
    }
  });
  initiative.$on("click", click_handler2);
  initiative.$on("initiative", ctx[5]);
  function select_block_type(ctx2, dirty) {
    if (ctx2[0].player)
      return create_if_block_14;
    return create_else_block5;
  }
  let current_block_type = select_block_type(ctx, -1);
  let if_block0 = current_block_type(ctx);
  let if_block1 = ctx[1].size && create_if_block6(ctx);
  creaturecontrols = new CreatureControls_default({
    props: {
      view: ctx[3],
      creature: ctx[0]
    }
  });
  creaturecontrols.$on("click", click_handler_4);
  creaturecontrols.$on("tag", ctx[8]);
  creaturecontrols.$on("edit", ctx[9]);
  return {
    c() {
      td0 = element("td");
      create_component(initiative.$$.fragment);
      t0 = space();
      td1 = element("td");
      div0 = element("div");
      if_block0.c();
      t1 = space();
      div1 = element("div");
      if (if_block1)
        if_block1.c();
      t2 = space();
      td2 = element("td");
      span = element("span");
      t3 = text(t3_value);
      t4 = space();
      td3 = element("td");
      t5 = text(t5_value);
      t6 = space();
      td4 = element("td");
      create_component(creaturecontrols.$$.fragment);
      attr(td0, "class", "initiative-container svelte-cnqzyh");
      attr(div0, "class", "name-holder svelte-cnqzyh");
      attr(div1, "class", "statuses svelte-cnqzyh");
      attr(td1, "class", "name-container");
      attr(span, "class", "editable svelte-cnqzyh");
      attr(td2, "class", "center hp-container svelte-cnqzyh");
      attr(td3, "class", "center ac-container svelte-cnqzyh");
      attr(td4, "class", "controls-container svelte-cnqzyh");
    },
    m(target, anchor) {
      insert(target, td0, anchor);
      mount_component(initiative, td0, null);
      insert(target, t0, anchor);
      insert(target, td1, anchor);
      append(td1, div0);
      if_block0.m(div0, null);
      append(td1, t1);
      append(td1, div1);
      if (if_block1)
        if_block1.m(div1, null);
      insert(target, t2, anchor);
      insert(target, td2, anchor);
      append(td2, span);
      append(span, t3);
      insert(target, t4, anchor);
      insert(target, td3, anchor);
      append(td3, t5);
      insert(target, t6, anchor);
      insert(target, td4, anchor);
      mount_component(creaturecontrols, td4, null);
      current = true;
      if (!mounted) {
        dispose = [
          listen(td0, "click", click_handler_1),
          listen(div1, "click", click_handler_2),
          listen(span, "click", ctx[7])
        ];
        mounted = true;
      }
    },
    p(ctx2, [dirty]) {
      const initiative_changes = {};
      if (dirty & 1)
        initiative_changes.initiative = ctx2[0].initiative;
      if (dirty & 1)
        initiative_changes.modifier = ctx2[0].modifier;
      initiative.$set(initiative_changes);
      if (current_block_type === (current_block_type = select_block_type(ctx2, dirty)) && if_block0) {
        if_block0.p(ctx2, dirty);
      } else {
        if_block0.d(1);
        if_block0 = current_block_type(ctx2);
        if (if_block0) {
          if_block0.c();
          if_block0.m(div0, null);
        }
      }
      if (ctx2[1].size) {
        if (if_block1) {
          if_block1.p(ctx2, dirty);
          if (dirty & 2) {
            transition_in(if_block1, 1);
          }
        } else {
          if_block1 = create_if_block6(ctx2);
          if_block1.c();
          transition_in(if_block1, 1);
          if_block1.m(div1, null);
        }
      } else if (if_block1) {
        group_outros();
        transition_out(if_block1, 1, 1, () => {
          if_block1 = null;
        });
        check_outros();
      }
      if ((!current || dirty & 1) && t3_value !== (t3_value = ctx2[0].hpDisplay + ""))
        set_data(t3, t3_value);
      if ((!current || dirty & 1) && t5_value !== (t5_value = (ctx2[0].ac ?? DEFAULT_UNDEFINED) + ""))
        set_data(t5, t5_value);
      const creaturecontrols_changes = {};
      if (dirty & 1)
        creaturecontrols_changes.creature = ctx2[0];
      creaturecontrols.$set(creaturecontrols_changes);
    },
    i(local) {
      if (current)
        return;
      transition_in(initiative.$$.fragment, local);
      transition_in(if_block1);
      transition_in(creaturecontrols.$$.fragment, local);
      current = true;
    },
    o(local) {
      transition_out(initiative.$$.fragment, local);
      transition_out(if_block1);
      transition_out(creaturecontrols.$$.fragment, local);
      current = false;
    },
    d(detaching) {
      if (detaching)
        detach(td0);
      destroy_component(initiative);
      if (detaching)
        detach(t0);
      if (detaching)
        detach(td1);
      if_block0.d();
      if (if_block1)
        if_block1.d();
      if (detaching)
        detach(t2);
      if (detaching)
        detach(td2);
      if (detaching)
        detach(t4);
      if (detaching)
        detach(td3);
      if (detaching)
        detach(t6);
      if (detaching)
        detach(td4);
      destroy_component(creaturecontrols);
      mounted = false;
      run_all(dispose);
    }
  };
}
var click_handler2 = (e) => e.stopPropagation();
var click_handler_1 = (e) => e.stopPropagation();
var click_handler_2 = (e) => e.stopPropagation();
var click_handler_4 = (e) => e.stopPropagation();
function instance9($$self, $$props, $$invalidate) {
  let statuses;
  let { creature } = $$props;
  const dispatch = createEventDispatcher();
  let view = getContext("view");
  const name = () => {
    if (creature.display) {
      return creature.display;
    }
    if (creature.number > 0) {
      return `${creature.name} ${creature.number}`;
    }
    return creature.name;
  };
  const initiative_handler = (e) => {
    view.updateCreature(creature, { initiative: Number(e.detail) });
  };
  const remove_handler = (status) => {
    creature.status.delete(status);
    $$invalidate(1, statuses = creature.status);
  };
  const click_handler_3 = (e) => {
    dispatch("hp", creature);
    e.stopPropagation();
  };
  function tag_handler(event) {
    bubble.call(this, $$self, event);
  }
  function edit_handler(event) {
    bubble.call(this, $$self, event);
  }
  $$self.$$set = ($$props2) => {
    if ("creature" in $$props2)
      $$invalidate(0, creature = $$props2.creature);
  };
  $$self.$$.update = () => {
    if ($$self.$$.dirty & 1) {
      $:
        $$invalidate(1, statuses = creature.status);
    }
  };
  return [
    creature,
    statuses,
    dispatch,
    view,
    name,
    initiative_handler,
    remove_handler,
    click_handler_3,
    tag_handler,
    edit_handler
  ];
}
var Creature2 = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance9, create_fragment9, safe_not_equal, { creature: 0 }, add_css8);
  }
};
var Creature_default = Creature2;

// src/svelte/Table.svelte
function add_css9(target) {
  append_styles(target, "svelte-mzbbdu", ".no-creatures.svelte-mzbbdu{margin:1rem;text-align:center}.initiative-tracker-table.svelte-mzbbdu{padding:0.5rem;align-items:center;gap:0.25rem 0.5rem;width:100%;margin-left:0rem;table-layout:fixed;border-collapse:separate;border-spacing:0 2px}.left.svelte-mzbbdu{text-align:left}.center.svelte-mzbbdu{text-align:center}.tracker-table-header.svelte-mzbbdu{font-weight:bolder;display:contents}.initiative-tracker-creature.svelte-mzbbdu{position:relative}.initiative-tracker-creature.active.svelte-mzbbdu{background-color:rgba(0, 0, 0, 0.1)}.theme-dark .initiative-tracker-creature.active.svelte-mzbbdu{background-color:rgba(255, 255, 255, 0.1)}.initiative-tracker-creature.disabled.svelte-mzbbdu *{color:var(--text-faint)}.initiative-tracker-creature.svelte-mzbbdu td{border-top:1px solid transparent;border-bottom:1px solid transparent}.initiative-tracker-creature.svelte-mzbbdu td:first-child{border-left:1px solid transparent}.initiative-tracker-creature.svelte-mzbbdu td:last-child{border-right:1px solid transparent}.initiative-tracker-creature.svelte-mzbbdu:hover td,.initiative-tracker-creature.viewing.svelte-mzbbdu td{border-top:1px solid var(--background-modifier-border);border-bottom:1px solid var(--background-modifier-border)}.initiative-tracker-creature.svelte-mzbbdu:hover td:first-child,.initiative-tracker-creature.viewing.svelte-mzbbdu td:first-child{border-left:1px solid var(--background-modifier-border)}.initiative-tracker-creature.svelte-mzbbdu:hover td:last-child,.initiative-tracker-creature.viewing.svelte-mzbbdu td:last-child{border-right:1px solid var(--background-modifier-border)}");
}
function get_each_context6(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[16] = list[i].creature;
  child_ctx[17] = list[i].id;
  return child_ctx;
}
function create_else_block6(ctx) {
  let div;
  return {
    c() {
      div = element("div");
      div.innerHTML = `<p>Add a creature to get started!</p> 
            <small>Players may be created in settings.</small>`;
      attr(div, "class", "no-creatures svelte-mzbbdu");
    },
    m(target, anchor) {
      insert(target, div, anchor);
    },
    p: noop,
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div);
    }
  };
}
function create_if_block7(ctx) {
  let table;
  let thead;
  let th0;
  let t0;
  let th1;
  let t2;
  let th2;
  let hpIcon_action;
  let t3;
  let th3;
  let acIcon_action;
  let t4;
  let th4;
  let t5;
  let tbody;
  let each_blocks = [];
  let each_1_lookup = /* @__PURE__ */ new Map();
  let dndzone_action;
  let current;
  let mounted;
  let dispose;
  let each_value = ctx[2];
  const get_key = (ctx2) => ctx2[17];
  for (let i = 0; i < each_value.length; i += 1) {
    let child_ctx = get_each_context6(ctx, each_value, i);
    let key = get_key(child_ctx);
    each_1_lookup.set(key, each_blocks[i] = create_each_block6(key, child_ctx));
  }
  return {
    c() {
      table = element("table");
      thead = element("thead");
      th0 = element("th");
      t0 = space();
      th1 = element("th");
      th1.textContent = "Name";
      t2 = space();
      th2 = element("th");
      t3 = space();
      th3 = element("th");
      t4 = space();
      th4 = element("th");
      t5 = space();
      tbody = element("tbody");
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].c();
      }
      set_style(th0, "width", "10%");
      attr(th1, "class", "left svelte-mzbbdu");
      set_style(th1, "width", "55%");
      set_style(th2, "width", "15%");
      attr(th2, "class", "center svelte-mzbbdu");
      set_style(th3, "width", "15%");
      attr(th3, "class", "center svelte-mzbbdu");
      set_style(th4, "width", "5%");
      attr(thead, "class", "tracker-table-header svelte-mzbbdu");
      attr(table, "class", "initiative-tracker-table svelte-mzbbdu");
    },
    m(target, anchor) {
      insert(target, table, anchor);
      append(table, thead);
      append(thead, th0);
      append(thead, t0);
      append(thead, th1);
      append(thead, t2);
      append(thead, th2);
      append(thead, t3);
      append(thead, th3);
      append(thead, t4);
      append(thead, th4);
      append(table, t5);
      append(table, tbody);
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].m(tbody, null);
      }
      current = true;
      if (!mounted) {
        dispose = [
          action_destroyer(hpIcon_action = ctx[3].call(null, th2)),
          action_destroyer(acIcon_action = ctx[4].call(null, th3)),
          action_destroyer(dndzone_action = dndzone$2.call(null, tbody, {
            items: ctx[2],
            flipDurationMs,
            dropTargetStyle: {},
            morphDisabled: true
          })),
          listen(tbody, "consider", ctx[5]),
          listen(tbody, "finalize", ctx[6])
        ];
        mounted = true;
      }
    },
    p(ctx2, dirty) {
      if (dirty & 390) {
        each_value = ctx2[2];
        group_outros();
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i].r();
        each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, tbody, fix_and_outro_and_destroy_block, create_each_block6, null, get_each_context6);
        for (let i = 0; i < each_blocks.length; i += 1)
          each_blocks[i].a();
        check_outros();
      }
      if (dndzone_action && is_function(dndzone_action.update) && dirty & 4)
        dndzone_action.update.call(null, {
          items: ctx2[2],
          flipDurationMs,
          dropTargetStyle: {},
          morphDisabled: true
        });
    },
    i(local) {
      if (current)
        return;
      for (let i = 0; i < each_value.length; i += 1) {
        transition_in(each_blocks[i]);
      }
      current = true;
    },
    o(local) {
      for (let i = 0; i < each_blocks.length; i += 1) {
        transition_out(each_blocks[i]);
      }
      current = false;
    },
    d(detaching) {
      if (detaching)
        detach(table);
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].d();
      }
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_each_block6(key_1, ctx) {
  let tr;
  let creaturetemplate;
  let t;
  let tr_data_hp_value;
  let tr_data_hp_max_value;
  let tr_data_hp_percent_value;
  let rect;
  let stop_animation = noop;
  let current;
  let mounted;
  let dispose;
  creaturetemplate = new Creature_default({
    props: { creature: ctx[16] }
  });
  creaturetemplate.$on("hp", ctx[9]);
  creaturetemplate.$on("tag", ctx[10]);
  creaturetemplate.$on("edit", ctx[11]);
  function click_handler3() {
    return ctx[12](ctx[16]);
  }
  function contextmenu_handler(...args) {
    return ctx[13](ctx[16], ...args);
  }
  return {
    key: key_1,
    first: null,
    c() {
      tr = element("tr");
      create_component(creaturetemplate.$$.fragment);
      t = space();
      attr(tr, "class", "draggable initiative-tracker-creature svelte-mzbbdu");
      attr(tr, "data-hp", tr_data_hp_value = ctx[16].hp);
      attr(tr, "data-hp-max", tr_data_hp_max_value = ctx[16].max);
      attr(tr, "data-hp-percent", tr_data_hp_percent_value = Math.round((ctx[16].hp ?? 0) / ctx[16].max * 100));
      toggle_class(tr, "disabled", !ctx[16].enabled);
      toggle_class(tr, "active", ctx[1] && ctx[16].active);
      toggle_class(tr, "viewing", ctx[16].viewing);
      this.first = tr;
    },
    m(target, anchor) {
      insert(target, tr, anchor);
      mount_component(creaturetemplate, tr, null);
      append(tr, t);
      current = true;
      if (!mounted) {
        dispose = [
          listen(tr, "click", click_handler3),
          listen(tr, "contextmenu", contextmenu_handler)
        ];
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      const creaturetemplate_changes = {};
      if (dirty & 4)
        creaturetemplate_changes.creature = ctx[16];
      creaturetemplate.$set(creaturetemplate_changes);
      if (!current || dirty & 4 && tr_data_hp_value !== (tr_data_hp_value = ctx[16].hp)) {
        attr(tr, "data-hp", tr_data_hp_value);
      }
      if (!current || dirty & 4 && tr_data_hp_max_value !== (tr_data_hp_max_value = ctx[16].max)) {
        attr(tr, "data-hp-max", tr_data_hp_max_value);
      }
      if (!current || dirty & 4 && tr_data_hp_percent_value !== (tr_data_hp_percent_value = Math.round((ctx[16].hp ?? 0) / ctx[16].max * 100))) {
        attr(tr, "data-hp-percent", tr_data_hp_percent_value);
      }
      if (dirty & 4) {
        toggle_class(tr, "disabled", !ctx[16].enabled);
      }
      if (dirty & 6) {
        toggle_class(tr, "active", ctx[1] && ctx[16].active);
      }
      if (dirty & 4) {
        toggle_class(tr, "viewing", ctx[16].viewing);
      }
    },
    r() {
      rect = tr.getBoundingClientRect();
    },
    f() {
      fix_position(tr);
      stop_animation();
    },
    a() {
      stop_animation();
      stop_animation = create_animation(tr, rect, flip2, { duration: flipDurationMs });
    },
    i(local) {
      if (current)
        return;
      transition_in(creaturetemplate.$$.fragment, local);
      current = true;
    },
    o(local) {
      transition_out(creaturetemplate.$$.fragment, local);
      current = false;
    },
    d(detaching) {
      if (detaching)
        detach(tr);
      destroy_component(creaturetemplate);
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_fragment10(ctx) {
  let div;
  let current_block_type_index;
  let if_block;
  let current;
  const if_block_creators = [create_if_block7, create_else_block6];
  const if_blocks = [];
  function select_block_type(ctx2, dirty) {
    if (ctx2[0].length)
      return 0;
    return 1;
  }
  current_block_type_index = select_block_type(ctx, -1);
  if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
  return {
    c() {
      div = element("div");
      if_block.c();
    },
    m(target, anchor) {
      insert(target, div, anchor);
      if_blocks[current_block_type_index].m(div, null);
      current = true;
    },
    p(ctx2, [dirty]) {
      let previous_block_index = current_block_type_index;
      current_block_type_index = select_block_type(ctx2, dirty);
      if (current_block_type_index === previous_block_index) {
        if_blocks[current_block_type_index].p(ctx2, dirty);
      } else {
        group_outros();
        transition_out(if_blocks[previous_block_index], 1, 1, () => {
          if_blocks[previous_block_index] = null;
        });
        check_outros();
        if_block = if_blocks[current_block_type_index];
        if (!if_block) {
          if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
          if_block.c();
        } else {
          if_block.p(ctx2, dirty);
        }
        transition_in(if_block, 1);
        if_block.m(div, null);
      }
    },
    i(local) {
      if (current)
        return;
      transition_in(if_block);
      current = true;
    },
    o(local) {
      transition_out(if_block);
      current = false;
    },
    d(detaching) {
      if (detaching)
        detach(div);
      if_blocks[current_block_type_index].d();
    }
  };
}
var flipDurationMs = 300;
function instance10($$self, $$props, $$invalidate) {
  let items;
  let { creatures = [] } = $$props;
  let { state } = $$props;
  const dispatch = createEventDispatcher();
  const view = getContext("view");
  const hpIcon = (node) => {
    (0, import_obsidian14.setIcon)(node, HP);
  };
  const acIcon = (node) => {
    (0, import_obsidian14.setIcon)(node, AC);
  };
  function handleDndConsider(e) {
    $$invalidate(2, items = e.detail.items);
  }
  function handleDndFinalize(e) {
    if (e.detail.items.length > 1) {
      let dropped = e.detail.items.find(({ id }) => id == e.detail.info.id);
      const index = e.detail.items.findIndex((c) => c.id == e.detail.info.id);
      if (index == e.detail.items.length - 1) {
        dropped.creature.initiative = e.detail.items[index - 1].creature.initiative;
      } else {
        dropped.creature.initiative = e.detail.items[index + 1].creature.initiative;
      }
    }
    $$invalidate(2, items = e.detail.items);
    view.setCreatures(items.map(({ creature }) => creature));
  }
  const openView = (creature) => {
    view.openCombatant(creature);
  };
  const hamburgerIcon = (evt, creature) => {
    evt.stopPropagation();
    const menu = new import_obsidian14.Menu(view.plugin.app);
    menu.addItem((item) => {
      item.setIcon("pencil").setTitle("Edit").onClick(() => {
        dispatch("edit", creature);
      });
    });
    menu.addItem((item) => {
      item.setIcon(TAG).setTitle("Add Status").onClick(() => {
        dispatch("tag", creature);
      });
    });
    if (creature.enabled) {
      menu.addItem((item) => {
        item.setIcon(DISABLE).setTitle("Disable").onClick(() => {
          view.setCreatureState(creature, false);
        });
      });
    } else {
      menu.addItem((item) => {
        item.setIcon(ENABLE).setTitle("Enable").onClick(() => {
          view.setCreatureState(creature, true);
        });
      });
    }
    if (view.plugin.data.leafletIntegration) {
      menu.addItem((item) => {
        item.setIcon(MAPMARKER).setTitle("Change Marker").onClick((evt2) => {
          const markerMenu = new import_obsidian14.Menu(view.plugin.app);
          markerMenu.setNoIcon();
          for (let marker of view.plugin.leaflet.markerIcons) {
            markerMenu.addItem((item2) => {
              item2.setTitle(marker.type);
              item2.onClick(() => {
                view.updateCreature(creature, { marker: marker.type });
              });
            });
          }
          markerMenu.showAtMouseEvent(evt2);
        });
      });
    }
    menu.addItem((item) => {
      item.setIcon(REMOVE).setTitle("Remove").onClick(() => {
        view.removeCreature(creature);
      });
    });
    menu.showAtPosition(evt);
  };
  function hp_handler(event) {
    bubble.call(this, $$self, event);
  }
  function tag_handler(event) {
    bubble.call(this, $$self, event);
  }
  function edit_handler(event) {
    bubble.call(this, $$self, event);
  }
  const click_handler3 = (creature) => openView(creature);
  const contextmenu_handler = (creature, evt) => hamburgerIcon(evt, creature);
  $$self.$$set = ($$props2) => {
    if ("creatures" in $$props2)
      $$invalidate(0, creatures = $$props2.creatures);
    if ("state" in $$props2)
      $$invalidate(1, state = $$props2.state);
  };
  $$self.$$.update = () => {
    if ($$self.$$.dirty & 1) {
      $:
        $$invalidate(2, items = [...creatures].map((c) => {
          return { creature: c, id: getId() };
        }));
    }
  };
  return [
    creatures,
    state,
    items,
    hpIcon,
    acIcon,
    handleDndConsider,
    handleDndFinalize,
    openView,
    hamburgerIcon,
    hp_handler,
    tag_handler,
    edit_handler,
    click_handler3,
    contextmenu_handler
  ];
}
var Table = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance10, create_fragment10, safe_not_equal, { creatures: 0, state: 1 }, add_css9);
  }
};
var Table_default = Table;

// src/svelte/Create.svelte
var import_obsidian15 = __toModule(require("obsidian"));
function add_css10(target) {
  append_styles(target, "svelte-1rjv45j", ".create-new.svelte-1rjv45j>.svelte-1rjv45j{display:grid;grid-template-columns:33% 66%;margin-bottom:0.5rem}.context-buttons.svelte-1rjv45j.svelte-1rjv45j{display:flex;justify-content:flex-end;align-items:center;grid-gap:0.125rem}.cancel-button.svelte-1rjv45j.svelte-1rjv45j{color:var(--text-faint)}.initiative.svelte-1rjv45j.svelte-1rjv45j{position:relative}.initiative.svelte-1rjv45j>.dice.svelte-1rjv45j{position:absolute;right:0.25rem;top:50%;transform:translateY(-50%)}");
}
function create_if_block8(ctx) {
  let div;
  let label;
  let t1;
  let input;
  let mounted;
  let dispose;
  return {
    c() {
      div = element("div");
      label = element("label");
      label.textContent = "Amount";
      t1 = space();
      input = element("input");
      attr(label, "for", "add-init");
      attr(input, "id", "add-init");
      attr(input, "type", "number");
      attr(input, "name", "initiative");
      attr(input, "tabindex", "0");
      attr(div, "class", "amount svelte-1rjv45j");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, label);
      append(div, t1);
      append(div, input);
      set_input_value(input, ctx[7]);
      if (!mounted) {
        dispose = listen(input, "input", ctx[19]);
        mounted = true;
      }
    },
    p(ctx2, dirty) {
      if (dirty & 128 && to_number(input.value) !== ctx2[7]) {
        set_input_value(input, ctx2[7]);
      }
    },
    d(detaching) {
      if (detaching)
        detach(div);
      mounted = false;
      dispose();
    }
  };
}
function create_fragment11(ctx) {
  let div7;
  let div0;
  let label0;
  let t1;
  let input0;
  let t2;
  let div1;
  let label1;
  let t4;
  let input1;
  let t5;
  let div2;
  let label2;
  let t7;
  let input2;
  let t8;
  let div3;
  let label3;
  let t10;
  let input3;
  let t11;
  let div4;
  let label4;
  let t13;
  let input4;
  let t14;
  let div6;
  let label5;
  let t16;
  let input5;
  let t17;
  let div5;
  let diceButton_action;
  let t18;
  let t19;
  let div10;
  let div8;
  let saveButton_action;
  let t20;
  let div9;
  let cancelButton_action;
  let mounted;
  let dispose;
  let if_block = !ctx[6] && create_if_block8(ctx);
  return {
    c() {
      div7 = element("div");
      div0 = element("div");
      label0 = element("label");
      label0.textContent = "Creature";
      t1 = space();
      input0 = element("input");
      t2 = space();
      div1 = element("div");
      label1 = element("label");
      label1.textContent = "Display Name";
      t4 = space();
      input1 = element("input");
      t5 = space();
      div2 = element("div");
      label2 = element("label");
      label2.textContent = "HP";
      t7 = space();
      input2 = element("input");
      t8 = space();
      div3 = element("div");
      label3 = element("label");
      label3.textContent = "AC";
      t10 = space();
      input3 = element("input");
      t11 = space();
      div4 = element("div");
      label4 = element("label");
      label4.textContent = "Modifier";
      t13 = space();
      input4 = element("input");
      t14 = space();
      div6 = element("div");
      label5 = element("label");
      label5.textContent = "Initiative";
      t16 = space();
      input5 = element("input");
      t17 = space();
      div5 = element("div");
      t18 = space();
      if (if_block)
        if_block.c();
      t19 = space();
      div10 = element("div");
      div8 = element("div");
      t20 = space();
      div9 = element("div");
      attr(label0, "for", "add-name");
      attr(input0, "id", "add-name");
      attr(input0, "type", "text");
      attr(input0, "name", "name");
      attr(input0, "tabindex", "0");
      attr(div0, "class", "svelte-1rjv45j");
      attr(label1, "for", "add-display");
      attr(input1, "id", "add-display");
      attr(input1, "type", "text");
      attr(input1, "name", "display");
      attr(input1, "tabindex", "0");
      attr(div1, "class", "svelte-1rjv45j");
      attr(label2, "for", "add-hp");
      attr(input2, "id", "add-hp");
      attr(input2, "type", "number");
      attr(input2, "name", "hp");
      attr(input2, "tabindex", "0");
      attr(div2, "class", "svelte-1rjv45j");
      attr(label3, "for", "add-ac");
      attr(input3, "id", "add-ac");
      attr(input3, "type", "number");
      attr(input3, "name", "ac");
      attr(input3, "tabindex", "0");
      attr(div3, "class", "svelte-1rjv45j");
      attr(label4, "for", "add-mod");
      attr(input4, "id", "add-mod");
      attr(input4, "type", "number");
      attr(input4, "name", "ac");
      attr(input4, "tabindex", "0");
      attr(div4, "class", "svelte-1rjv45j");
      attr(label5, "for", "add-init");
      attr(input5, "id", "add-init");
      attr(input5, "type", "number");
      attr(input5, "name", "initiative");
      attr(input5, "tabindex", "0");
      attr(div5, "class", "dice svelte-1rjv45j");
      attr(div6, "class", "initiative svelte-1rjv45j");
      attr(div7, "class", "create-new svelte-1rjv45j");
      attr(div8, "class", "add-button");
      attr(div9, "class", "add-button cancel-button svelte-1rjv45j");
      attr(div10, "class", "context-buttons svelte-1rjv45j");
    },
    m(target, anchor) {
      insert(target, div7, anchor);
      append(div7, div0);
      append(div0, label0);
      append(div0, t1);
      append(div0, input0);
      set_input_value(input0, ctx[0]);
      append(div7, t2);
      append(div7, div1);
      append(div1, label1);
      append(div1, t4);
      append(div1, input1);
      set_input_value(input1, ctx[1]);
      append(div7, t5);
      append(div7, div2);
      append(div2, label2);
      append(div2, t7);
      append(div2, input2);
      set_input_value(input2, ctx[2]);
      append(div7, t8);
      append(div7, div3);
      append(div3, label3);
      append(div3, t10);
      append(div3, input3);
      set_input_value(input3, ctx[4]);
      append(div7, t11);
      append(div7, div4);
      append(div4, label4);
      append(div4, t13);
      append(div4, input4);
      set_input_value(input4, ctx[5]);
      append(div7, t14);
      append(div7, div6);
      append(div6, label5);
      append(div6, t16);
      append(div6, input5);
      set_input_value(input5, ctx[3]);
      append(div6, t17);
      append(div6, div5);
      append(div7, t18);
      if (if_block)
        if_block.m(div7, null);
      insert(target, t19, anchor);
      insert(target, div10, anchor);
      append(div10, div8);
      append(div10, t20);
      append(div10, div9);
      if (!mounted) {
        dispose = [
          listen(input0, "input", ctx[12]),
          listen(input0, "focus", ctx[13]),
          listen(input1, "input", ctx[14]),
          listen(input2, "input", ctx[15]),
          listen(input3, "input", ctx[16]),
          listen(input4, "input", ctx[17]),
          listen(input5, "input", ctx[18]),
          action_destroyer(diceButton_action = ctx[10].call(null, div5)),
          action_destroyer(saveButton_action = ctx[8].call(null, div8)),
          action_destroyer(cancelButton_action = ctx[9].call(null, div9))
        ];
        mounted = true;
      }
    },
    p(ctx2, [dirty]) {
      if (dirty & 1 && input0.value !== ctx2[0]) {
        set_input_value(input0, ctx2[0]);
      }
      if (dirty & 2 && input1.value !== ctx2[1]) {
        set_input_value(input1, ctx2[1]);
      }
      if (dirty & 4 && to_number(input2.value) !== ctx2[2]) {
        set_input_value(input2, ctx2[2]);
      }
      if (dirty & 16 && to_number(input3.value) !== ctx2[4]) {
        set_input_value(input3, ctx2[4]);
      }
      if (dirty & 32 && to_number(input4.value) !== ctx2[5]) {
        set_input_value(input4, ctx2[5]);
      }
      if (dirty & 8 && to_number(input5.value) !== ctx2[3]) {
        set_input_value(input5, ctx2[3]);
      }
      if (!ctx2[6]) {
        if (if_block) {
          if_block.p(ctx2, dirty);
        } else {
          if_block = create_if_block8(ctx2);
          if_block.c();
          if_block.m(div7, null);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div7);
      if (if_block)
        if_block.d();
      if (detaching)
        detach(t19);
      if (detaching)
        detach(div10);
      mounted = false;
      run_all(dispose);
    }
  };
}
function instance11($$self, $$props, $$invalidate) {
  const dispatch = createEventDispatcher();
  let view = getContext("view");
  let { editing = false } = $$props;
  let { name = null } = $$props;
  let { display = null } = $$props;
  let { hp = null } = $$props;
  let { initiative = null } = $$props;
  let { ac = null } = $$props;
  let { modifier = null } = $$props;
  let xp;
  let player;
  let level;
  let number = 1;
  const saveButton = (node) => {
    new import_obsidian15.ExtraButtonComponent(node).setTooltip("Add Creature").setIcon(SAVE).onClick(() => {
      if (!name || !(name === null || name === void 0 ? void 0 : name.length)) {
        new import_obsidian15.Notice("Enter a name!");
        return;
      }
      if (!modifier) {
        $$invalidate(5, modifier = 0);
      }
      dispatch("save", {
        name,
        hp,
        display,
        initiative: (initiative !== null && initiative !== void 0 ? initiative : Math.floor(Math.random() * 19 + 1)) - modifier,
        ac,
        modifier,
        xp,
        player,
        level,
        number: Number(number)
      });
    });
  };
  const cancelButton = (node) => {
    new import_obsidian15.ExtraButtonComponent(node).setTooltip("Cancel").setIcon("cross").onClick(() => {
      dispatch("cancel");
    });
  };
  const diceButton = (node) => {
    new import_obsidian15.ExtraButtonComponent(node).setIcon(DICE).setTooltip("Roll Initiative").onClick(() => {
      $$invalidate(3, initiative = Math.floor(Math.random() * 19 + 1) + (modifier !== null && modifier !== void 0 ? modifier : 0));
    });
  };
  const openModal = (nameInput) => {
    const modal = new SRDMonsterSuggestionModal(view.plugin, nameInput);
    modal.onClose = () => __awaiter(void 0, void 0, void 0, function* () {
      var _a;
      if (modal.creature) {
        let newCreature = Creature.from(modal.creature);
        $$invalidate(0, name = newCreature.name);
        if (newCreature.hp)
          $$invalidate(2, hp = `${newCreature.hp}`);
        if (newCreature.ac)
          $$invalidate(4, ac = `${newCreature.ac}`);
        $$invalidate(5, modifier = (_a = newCreature.modifier) !== null && _a !== void 0 ? _a : 0);
        xp = newCreature.xp;
        player = newCreature.player;
        level = newCreature.level;
        $$invalidate(3, initiative = yield view.getInitiativeValue(modifier));
      }
    });
    modal.open();
  };
  function input0_input_handler() {
    name = this.value;
    $$invalidate(0, name);
  }
  const focus_handler = function() {
    openModal(this);
  };
  function input1_input_handler() {
    display = this.value;
    $$invalidate(1, display);
  }
  function input2_input_handler() {
    hp = to_number(this.value);
    $$invalidate(2, hp);
  }
  function input3_input_handler() {
    ac = to_number(this.value);
    $$invalidate(4, ac);
  }
  function input4_input_handler() {
    modifier = to_number(this.value);
    $$invalidate(5, modifier);
  }
  function input5_input_handler() {
    initiative = to_number(this.value);
    $$invalidate(3, initiative);
  }
  function input_input_handler() {
    number = to_number(this.value);
    $$invalidate(7, number);
  }
  $$self.$$set = ($$props2) => {
    if ("editing" in $$props2)
      $$invalidate(6, editing = $$props2.editing);
    if ("name" in $$props2)
      $$invalidate(0, name = $$props2.name);
    if ("display" in $$props2)
      $$invalidate(1, display = $$props2.display);
    if ("hp" in $$props2)
      $$invalidate(2, hp = $$props2.hp);
    if ("initiative" in $$props2)
      $$invalidate(3, initiative = $$props2.initiative);
    if ("ac" in $$props2)
      $$invalidate(4, ac = $$props2.ac);
    if ("modifier" in $$props2)
      $$invalidate(5, modifier = $$props2.modifier);
  };
  return [
    name,
    display,
    hp,
    initiative,
    ac,
    modifier,
    editing,
    number,
    saveButton,
    cancelButton,
    diceButton,
    openModal,
    input0_input_handler,
    focus_handler,
    input1_input_handler,
    input2_input_handler,
    input3_input_handler,
    input4_input_handler,
    input5_input_handler,
    input_input_handler
  ];
}
var Create = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance11, create_fragment11, safe_not_equal, {
      editing: 6,
      name: 0,
      display: 1,
      hp: 2,
      initiative: 3,
      ac: 4,
      modifier: 5
    }, add_css10);
  }
};
var Create_default = Create;

// src/svelte/App.svelte
var import_obsidian18 = __toModule(require("obsidian"));

// node_modules/svelte/store/index.mjs
var subscriber_queue = [];
function writable(value, start2 = noop) {
  let stop;
  const subscribers = /* @__PURE__ */ new Set();
  function set(new_value) {
    if (safe_not_equal(value, new_value)) {
      value = new_value;
      if (stop) {
        const run_queue = !subscriber_queue.length;
        for (const subscriber of subscribers) {
          subscriber[1]();
          subscriber_queue.push(subscriber, value);
        }
        if (run_queue) {
          for (let i = 0; i < subscriber_queue.length; i += 2) {
            subscriber_queue[i][0](subscriber_queue[i + 1]);
          }
          subscriber_queue.length = 0;
        }
      }
    }
  }
  function update2(fn2) {
    set(fn2(value));
  }
  function subscribe2(run2, invalidate = noop) {
    const subscriber = [run2, invalidate];
    subscribers.add(subscriber);
    if (subscribers.size === 1) {
      stop = start2(set) || noop;
    }
    run2(value);
    return () => {
      subscribers.delete(subscriber);
      if (subscribers.size === 0) {
        stop();
        stop = null;
      }
    };
  }
  return { set, update: update2, subscribe: subscribe2 };
}

// node_modules/svelte/motion/index.mjs
function is_date(obj) {
  return Object.prototype.toString.call(obj) === "[object Date]";
}
function get_interpolator(a, b) {
  if (a === b || a !== a)
    return () => a;
  const type = typeof a;
  if (type !== typeof b || Array.isArray(a) !== Array.isArray(b)) {
    throw new Error("Cannot interpolate values of different type");
  }
  if (Array.isArray(a)) {
    const arr = b.map((bi, i) => {
      return get_interpolator(a[i], bi);
    });
    return (t) => arr.map((fn2) => fn2(t));
  }
  if (type === "object") {
    if (!a || !b)
      throw new Error("Object cannot be null");
    if (is_date(a) && is_date(b)) {
      a = a.getTime();
      b = b.getTime();
      const delta = b - a;
      return (t) => new Date(a + t * delta);
    }
    const keys = Object.keys(b);
    const interpolators = {};
    keys.forEach((key) => {
      interpolators[key] = get_interpolator(a[key], b[key]);
    });
    return (t) => {
      const result = {};
      keys.forEach((key) => {
        result[key] = interpolators[key](t);
      });
      return result;
    };
  }
  if (type === "number") {
    const delta = b - a;
    return (t) => a + t * delta;
  }
  throw new Error(`Cannot interpolate ${type} values`);
}
function tweened(value, defaults = {}) {
  const store = writable(value);
  let task;
  let target_value = value;
  function set(new_value, opts) {
    if (value == null) {
      store.set(value = new_value);
      return Promise.resolve();
    }
    target_value = new_value;
    let previous_task = task;
    let started = false;
    let { delay = 0, duration = 400, easing = identity, interpolate = get_interpolator } = assign(assign({}, defaults), opts);
    if (duration === 0) {
      if (previous_task) {
        previous_task.abort();
        previous_task = null;
      }
      store.set(value = target_value);
      return Promise.resolve();
    }
    const start2 = now() + delay;
    let fn2;
    task = loop((now2) => {
      if (now2 < start2)
        return true;
      if (!started) {
        fn2 = interpolate(value, new_value);
        if (typeof duration === "function")
          duration = duration(value, new_value);
        started = true;
      }
      if (previous_task) {
        previous_task.abort();
        previous_task = null;
      }
      const elapsed = now2 - start2;
      if (elapsed > duration) {
        store.set(value = new_value);
        return false;
      }
      store.set(value = fn2(easing(elapsed / duration)));
      return true;
    });
    return task.promise;
  }
  return {
    set,
    update: (fn2, opts) => set(fn2(target_value, value), opts),
    subscribe: store.subscribe
  };
}

// src/svelte/Difficulty.svelte
function add_css11(target) {
  append_styles(target, "svelte-137y560", ".difficulty-bar-container.svelte-137y560{display:grid;grid-template-columns:auto 1fr auto;gap:0.5rem;align-items:center;padding:0 0.5rem;margin-bottom:0.5rem;width:100%}.difficulty-bar.svelte-137y560{width:100%;border:1px solid #ccc;border-radius:3px}");
}
function create_if_block9(ctx) {
  let div;
  let span0;
  let t1;
  let span1;
  let meter;
  let t2;
  let span2;
  let div_aria_label_value;
  return {
    c() {
      div = element("div");
      span0 = element("span");
      span0.textContent = "Easy";
      t1 = space();
      span1 = element("span");
      meter = element("meter");
      t2 = space();
      span2 = element("span");
      span2.textContent = "Deadly";
      attr(meter, "class", "difficulty-bar svelte-137y560");
      attr(meter, "min", "0");
      attr(meter, "low", "0.33");
      attr(meter, "high", "0.66");
      attr(meter, "optimum", "0");
      meter.value = ctx[2];
      attr(div, "class", "difficulty-bar-container svelte-137y560");
      attr(div, "aria-label", div_aria_label_value = formatDifficultyReport(ctx[1]));
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, span0);
      append(div, t1);
      append(div, span1);
      append(span1, meter);
      append(div, t2);
      append(div, span2);
    },
    p(ctx2, dirty) {
      if (dirty & 4) {
        meter.value = ctx2[2];
      }
      if (dirty & 2 && div_aria_label_value !== (div_aria_label_value = formatDifficultyReport(ctx2[1]))) {
        attr(div, "aria-label", div_aria_label_value);
      }
    },
    d(detaching) {
      if (detaching)
        detach(div);
    }
  };
}
function create_fragment12(ctx) {
  let if_block_anchor;
  let if_block = ctx[0] && create_if_block9(ctx);
  return {
    c() {
      if (if_block)
        if_block.c();
      if_block_anchor = empty();
    },
    m(target, anchor) {
      if (if_block)
        if_block.m(target, anchor);
      insert(target, if_block_anchor, anchor);
    },
    p(ctx2, [dirty]) {
      if (ctx2[0]) {
        if (if_block) {
          if_block.p(ctx2, dirty);
        } else {
          if_block = create_if_block9(ctx2);
          if_block.c();
          if_block.m(if_block_anchor.parentNode, if_block_anchor);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (if_block)
        if_block.d(detaching);
      if (detaching)
        detach(if_block_anchor);
    }
  };
}
function instance12($$self, $$props, $$invalidate) {
  let $difficultyBar;
  var _a;
  let { creatures } = $$props;
  let canDisplayDifficulty = false;
  const difficultyBar = tweened(0, { duration: 400, easing: cubicOut });
  component_subscribe($$self, difficultyBar, (value) => $$invalidate(2, $difficultyBar = value));
  let dr;
  $$self.$$set = ($$props2) => {
    if ("creatures" in $$props2)
      $$invalidate(4, creatures = $$props2.creatures);
  };
  $$self.$$.update = () => {
    if ($$self.$$.dirty & 48) {
      $: {
        let playerLevels = [];
        let monstersXp = [];
        $$invalidate(5, _a = creatures === null || creatures === void 0 ? void 0 : creatures.filter((creature) => creature.enabled)) === null || _a === void 0 ? void 0 : _a.forEach((creature) => {
          if (creature.level) {
            playerLevels.push(creature.level);
          } else {
            monstersXp.push(creature.xp);
          }
        });
        let dif = encounterDifficulty(playerLevels.filter((p) => p), monstersXp.filter((m) => m));
        if (!dif) {
          $$invalidate(0, canDisplayDifficulty = false);
        } else {
          $$invalidate(0, canDisplayDifficulty = true);
          let progress = dif.adjustedXp / dif.budget.deadly > 1 ? 1 : dif.adjustedXp / dif.budget.deadly;
          difficultyBar.set(progress);
          $$invalidate(1, dr = dif);
        }
      }
    }
  };
  return [canDisplayDifficulty, dr, $difficultyBar, difficultyBar, creatures, _a];
}
var Difficulty = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance12, create_fragment12, safe_not_equal, { creatures: 4 }, add_css11);
  }
};
var Difficulty_default = Difficulty;

// src/svelte/SaveEncounter.svelte
var import_obsidian16 = __toModule(require("obsidian"));
function add_css12(target) {
  append_styles(target, "svelte-1ud8n4x", ".saving-container.svelte-1ud8n4x.svelte-1ud8n4x{padding:0.5rem}.saving-encounter.svelte-1ud8n4x.svelte-1ud8n4x{display:flex;align-items:center;justify-content:space-between}.save-buttons.svelte-1ud8n4x.svelte-1ud8n4x{margin-top:1rem;display:flex;justify-content:flex-end;gap:1rem}.save-buttons.svelte-1ud8n4x>div.svelte-1ud8n4x{display:flex;align-items:center}.save-buttons.svelte-1ud8n4x .clickable-icon{margin:0}.save-buttons.svelte-1ud8n4x>.save.svelte-1ud8n4x .clickable-icon.is-disabled{cursor:not-allowed;color:var(--text-faint)}");
}
function create_if_block10(ctx) {
  let span;
  return {
    c() {
      span = element("span");
      span.innerHTML = `<small>An encounter by that name already exists. Are you sure?</small>`;
      attr(span, "class", "checking");
    },
    m(target, anchor) {
      insert(target, span, anchor);
    },
    d(detaching) {
      if (detaching)
        detach(span);
    }
  };
}
function create_fragment13(ctx) {
  let div4;
  let div0;
  let span;
  let t1;
  let input;
  let t2;
  let div3;
  let t3;
  let div1;
  let save_action;
  let t4;
  let div2;
  let cancel_action;
  let mounted;
  let dispose;
  let if_block = ctx[1] && create_if_block10(ctx);
  return {
    c() {
      div4 = element("div");
      div0 = element("div");
      span = element("span");
      span.textContent = "Save encounter as:";
      t1 = space();
      input = element("input");
      t2 = space();
      div3 = element("div");
      if (if_block)
        if_block.c();
      t3 = space();
      div1 = element("div");
      t4 = space();
      div2 = element("div");
      attr(input, "type", "text");
      attr(div0, "class", "saving-encounter svelte-1ud8n4x");
      attr(div1, "class", "save svelte-1ud8n4x");
      attr(div2, "class", "cancel svelte-1ud8n4x");
      attr(div3, "class", "save-buttons svelte-1ud8n4x");
      attr(div4, "class", "saving-container svelte-1ud8n4x");
    },
    m(target, anchor) {
      insert(target, div4, anchor);
      append(div4, div0);
      append(div0, span);
      append(div0, t1);
      append(div0, input);
      set_input_value(input, ctx[0]);
      append(div4, t2);
      append(div4, div3);
      if (if_block)
        if_block.m(div3, null);
      append(div3, t3);
      append(div3, div1);
      append(div3, t4);
      append(div3, div2);
      if (!mounted) {
        dispose = [
          listen(input, "input", ctx[6]),
          listen(input, "input", ctx[2]),
          action_destroyer(save_action = ctx[3].call(null, div1)),
          action_destroyer(cancel_action = ctx[4].call(null, div2))
        ];
        mounted = true;
      }
    },
    p(ctx2, [dirty]) {
      if (dirty & 1 && input.value !== ctx2[0]) {
        set_input_value(input, ctx2[0]);
      }
      if (ctx2[1]) {
        if (if_block) {
        } else {
          if_block = create_if_block10(ctx2);
          if_block.c();
          if_block.m(div3, t3);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div4);
      if (if_block)
        if_block.d();
      mounted = false;
      run_all(dispose);
    }
  };
}
function instance13($$self, $$props, $$invalidate) {
  let { name } = $$props;
  let encounterName = name;
  const view = getContext("view");
  let saveButton;
  const checkSave = () => {
    if ((encounterName === null || encounterName === void 0 ? void 0 : encounterName.length) && saveButton.disabled) {
      saveButton.setDisabled(false);
    } else if (!(encounterName === null || encounterName === void 0 ? void 0 : encounterName.length) && !saveButton.disabled) {
      saveButton.setDisabled(true);
    }
  };
  let checking = false;
  const save = (node) => {
    saveButton = new import_obsidian16.ExtraButtonComponent(node).setIcon(SAVE).setDisabled(!(encounterName != void 0 && (encounterName === null || encounterName === void 0 ? void 0 : encounterName.length) > 0)).onClick(() => __awaiter(void 0, void 0, void 0, function* () {
      if (encounterName && encounterName in view.plugin.data.encounters && !checking) {
        $$invalidate(1, checking = true);
      } else {
        yield view.saveEncounter(encounterName);
        dispatch("cancel");
      }
    }));
  };
  const dispatch = createEventDispatcher();
  const cancel = (node) => {
    new import_obsidian16.ExtraButtonComponent(node).setIcon("cross").onClick(() => {
      dispatch("cancel");
    });
  };
  function input_input_handler() {
    encounterName = this.value;
    $$invalidate(0, encounterName);
  }
  $$self.$$set = ($$props2) => {
    if ("name" in $$props2)
      $$invalidate(5, name = $$props2.name);
  };
  return [encounterName, checking, checkSave, save, cancel, name, input_input_handler];
}
var SaveEncounter = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance13, create_fragment13, safe_not_equal, { name: 5 }, add_css12);
  }
};
var SaveEncounter_default = SaveEncounter;

// src/svelte/LoadEncounter.svelte
var import_obsidian17 = __toModule(require("obsidian"));
function add_css13(target) {
  append_styles(target, "svelte-vsvyan", ".controls.svelte-vsvyan.svelte-vsvyan{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--background-modifier-border)}.controls.svelte-vsvyan h4.svelte-vsvyan{margin:0}.loading-container.svelte-vsvyan.svelte-vsvyan{display:flex;flex-flow:column nowrap;gap:0.5rem;padding:0.5rem;height:100%}.loading-container.svelte-vsvyan .clickable-icon{margin:0}.encounter-container.svelte-vsvyan.svelte-vsvyan{height:100%;display:flex;flex-flow:column nowrap;gap:1rem;overflow-y:auto}.no-encounters.svelte-vsvyan.svelte-vsvyan{color:var(--text-muted);display:flex;justify-content:center}.encounter.svelte-vsvyan.svelte-vsvyan{display:flex;justify-content:space-between;align-items:center}.encounter-controls.svelte-vsvyan.svelte-vsvyan{display:flex;align-items:center;gap:1rem}");
}
function get_each_context7(ctx, list, i) {
  const child_ctx = ctx.slice();
  child_ctx[7] = list[i];
  return child_ctx;
}
function create_if_block11(ctx) {
  let span;
  return {
    c() {
      span = element("span");
      span.innerHTML = `<em>There are no saved encounters.</em>`;
      attr(span, "class", "no-encounters svelte-vsvyan");
    },
    m(target, anchor) {
      insert(target, span, anchor);
    },
    d(detaching) {
      if (detaching)
        detach(span);
    }
  };
}
function create_each_block7(ctx) {
  let div3;
  let span;
  let t0_value = ctx[7] + "";
  let t0;
  let t1;
  let div2;
  let div0;
  let load_action;
  let t2;
  let div1;
  let trash_action;
  let t3;
  let mounted;
  let dispose;
  return {
    c() {
      div3 = element("div");
      span = element("span");
      t0 = text(t0_value);
      t1 = space();
      div2 = element("div");
      div0 = element("div");
      t2 = space();
      div1 = element("div");
      t3 = space();
      attr(div2, "class", "encounter-controls svelte-vsvyan");
      attr(div3, "class", "encounter svelte-vsvyan");
    },
    m(target, anchor) {
      insert(target, div3, anchor);
      append(div3, span);
      append(span, t0);
      append(div3, t1);
      append(div3, div2);
      append(div2, div0);
      append(div2, t2);
      append(div2, div1);
      append(div3, t3);
      if (!mounted) {
        dispose = [
          action_destroyer(load_action = ctx[3].call(null, div0, ctx[7])),
          action_destroyer(trash_action = ctx[4].call(null, div1, ctx[7]))
        ];
        mounted = true;
      }
    },
    p(new_ctx, dirty) {
      ctx = new_ctx;
      if (dirty & 1 && t0_value !== (t0_value = ctx[7] + ""))
        set_data(t0, t0_value);
      if (load_action && is_function(load_action.update) && dirty & 1)
        load_action.update.call(null, ctx[7]);
      if (trash_action && is_function(trash_action.update) && dirty & 1)
        trash_action.update.call(null, ctx[7]);
    },
    d(detaching) {
      if (detaching)
        detach(div3);
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_fragment14(ctx) {
  let div3;
  let div1;
  let h4;
  let t1;
  let div0;
  let cancel_action;
  let t2;
  let div2;
  let show_if = !ctx[0] || !Object.keys(ctx[0])?.length;
  let t3;
  let mounted;
  let dispose;
  let if_block = show_if && create_if_block11(ctx);
  let each_value = Object.keys(ctx[0]);
  let each_blocks = [];
  for (let i = 0; i < each_value.length; i += 1) {
    each_blocks[i] = create_each_block7(get_each_context7(ctx, each_value, i));
  }
  return {
    c() {
      div3 = element("div");
      div1 = element("div");
      h4 = element("h4");
      h4.textContent = "Load An Encounter";
      t1 = space();
      div0 = element("div");
      t2 = space();
      div2 = element("div");
      if (if_block)
        if_block.c();
      t3 = space();
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].c();
      }
      attr(h4, "class", "svelte-vsvyan");
      attr(div1, "class", "controls svelte-vsvyan");
      attr(div2, "class", "encounter-container svelte-vsvyan");
      attr(div3, "class", "loading-container svelte-vsvyan");
    },
    m(target, anchor) {
      insert(target, div3, anchor);
      append(div3, div1);
      append(div1, h4);
      append(div1, t1);
      append(div1, div0);
      append(div3, t2);
      append(div3, div2);
      if (if_block)
        if_block.m(div2, null);
      append(div2, t3);
      for (let i = 0; i < each_blocks.length; i += 1) {
        each_blocks[i].m(div2, null);
      }
      if (!mounted) {
        dispose = [
          action_destroyer(cancel_action = ctx[2].call(null, div0)),
          listen(div0, "click", ctx[5])
        ];
        mounted = true;
      }
    },
    p(ctx2, [dirty]) {
      if (dirty & 1)
        show_if = !ctx2[0] || !Object.keys(ctx2[0])?.length;
      if (show_if) {
        if (if_block) {
        } else {
          if_block = create_if_block11(ctx2);
          if_block.c();
          if_block.m(div2, t3);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
      if (dirty & 1) {
        each_value = Object.keys(ctx2[0]);
        let i;
        for (i = 0; i < each_value.length; i += 1) {
          const child_ctx = get_each_context7(ctx2, each_value, i);
          if (each_blocks[i]) {
            each_blocks[i].p(child_ctx, dirty);
          } else {
            each_blocks[i] = create_each_block7(child_ctx);
            each_blocks[i].c();
            each_blocks[i].m(div2, null);
          }
        }
        for (; i < each_blocks.length; i += 1) {
          each_blocks[i].d(1);
        }
        each_blocks.length = each_value.length;
      }
    },
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div3);
      if (if_block)
        if_block.d();
      destroy_each(each_blocks, detaching);
      mounted = false;
      run_all(dispose);
    }
  };
}
function instance14($$self, $$props, $$invalidate) {
  let encounters;
  const dispatch = createEventDispatcher();
  const view = getContext("view");
  const cancel = (node) => {
    new import_obsidian17.ExtraButtonComponent(node).setIcon("cross").setTooltip("Cancel");
  };
  const load = (node, encounter) => {
    new import_obsidian17.ExtraButtonComponent(node).setIcon("open-elsewhere-glyph").setTooltip("Load Encounter").onClick(() => {
      view.loadEncounter(encounter);
      dispatch("cancel");
    });
  };
  const trash = (node, encounter) => {
    new import_obsidian17.ExtraButtonComponent(node).setIcon("trash").setTooltip("Delete Encounter").onClick(() => {
      delete view.plugin.data.encounters[encounter];
      $$invalidate(0, encounters = view.plugin.data.encounters);
    });
  };
  const click_handler3 = () => dispatch("cancel");
  $:
    $$invalidate(0, encounters = view.plugin.data.encounters);
  return [encounters, dispatch, cancel, load, trash, click_handler3];
}
var LoadEncounter = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance14, create_fragment14, safe_not_equal, {}, add_css13);
  }
};
var LoadEncounter_default = LoadEncounter;

// src/svelte/App.svelte
function add_css14(target) {
  append_styles(target, "svelte-rp16qm", ".obsidian-initiative-tracker.svelte-rp16qm{margin:0.5rem;min-width:180px}.initiative-tracker-round-container.svelte-rp16qm,.initiave-tracker-party.svelte-rp16qm{padding:0 0.5rem}.add-creature-container.svelte-rp16qm{display:flex;flex-flow:column nowrap;justify-content:flex-start;margin-right:0.5rem}.context-container.svelte-rp16qm{display:flex;flex-flow:row nowrap;justify-content:space-between}.copy-button.svelte-rp16qm{width:min-content;opacity:0.25}.copy-button.svelte-rp16qm:hover{opacity:1}.add-button.svelte-rp16qm{width:min-content}.add-button.svelte-rp16qm .clickable-icon{margin:0}.initiative-tracker-name-container.svelte-rp16qm{display:flex;justify-content:space-between;align-items:center;padding:0 0.5rem}.initiative-tracker-name.svelte-rp16qm{margin:0}");
}
function create_if_block_9(ctx) {
  let h4;
  let t;
  return {
    c() {
      h4 = element("h4");
      t = text(ctx[9]);
      attr(h4, "class", "initiave-tracker-party svelte-rp16qm");
    },
    m(target, anchor) {
      insert(target, h4, anchor);
      append(h4, t);
    },
    p(ctx2, dirty) {
      if (dirty[0] & 512)
        set_data(t, ctx2[9]);
    },
    d(detaching) {
      if (detaching)
        detach(h4);
    }
  };
}
function create_if_block_82(ctx) {
  let div;
  let small;
  let em;
  let t0;
  let t1;
  return {
    c() {
      div = element("div");
      small = element("small");
      em = element("em");
      t0 = text("Round ");
      t1 = text(ctx[8]);
      attr(div, "class", "initiative-tracker-round-container svelte-rp16qm");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, small);
      append(small, em);
      append(em, t0);
      append(em, t1);
    },
    p(ctx2, dirty) {
      if (dirty[0] & 256)
        set_data(t1, ctx2[8]);
    },
    d(detaching) {
      if (detaching)
        detach(div);
    }
  };
}
function create_if_block_62(ctx) {
  let div;
  let h2;
  let t0;
  let t1;
  let if_block = ctx[11] > 0 && create_if_block_72(ctx);
  return {
    c() {
      div = element("div");
      h2 = element("h2");
      t0 = text(ctx[4]);
      t1 = space();
      if (if_block)
        if_block.c();
      attr(h2, "class", "initiative-tracker-name svelte-rp16qm");
      attr(div, "class", "initiative-tracker-name-container svelte-rp16qm");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, h2);
      append(h2, t0);
      append(div, t1);
      if (if_block)
        if_block.m(div, null);
    },
    p(ctx2, dirty) {
      if (dirty[0] & 16)
        set_data(t0, ctx2[4]);
      if (ctx2[11] > 0) {
        if (if_block) {
          if_block.p(ctx2, dirty);
        } else {
          if_block = create_if_block_72(ctx2);
          if_block.c();
          if_block.m(div, null);
        }
      } else if (if_block) {
        if_block.d(1);
        if_block = null;
      }
    },
    d(detaching) {
      if (detaching)
        detach(div);
      if (if_block)
        if_block.d();
    }
  };
}
function create_if_block_72(ctx) {
  let span;
  let t0;
  let t1;
  return {
    c() {
      span = element("span");
      t0 = text(ctx[11]);
      t1 = text(" XP");
      attr(span, "class", "initiative-tracker-xp encounter-xp");
    },
    m(target, anchor) {
      insert(target, span, anchor);
      append(span, t0);
      append(span, t1);
    },
    p(ctx2, dirty) {
      if (dirty[0] & 2048)
        set_data(t0, ctx2[11]);
    },
    d(detaching) {
      if (detaching)
        detach(span);
    }
  };
}
function create_if_block_53(ctx) {
  let difficulty;
  let current;
  difficulty = new Difficulty_default({
    props: { creatures: ctx[3] }
  });
  return {
    c() {
      create_component(difficulty.$$.fragment);
    },
    m(target, anchor) {
      mount_component(difficulty, target, anchor);
      current = true;
    },
    p(ctx2, dirty) {
      const difficulty_changes = {};
      if (dirty[0] & 8)
        difficulty_changes.creatures = ctx2[3];
      difficulty.$set(difficulty_changes);
    },
    i(local) {
      if (current)
        return;
      transition_in(difficulty.$$.fragment, local);
      current = true;
    },
    o(local) {
      transition_out(difficulty.$$.fragment, local);
      current = false;
    },
    d(detaching) {
      destroy_component(difficulty, detaching);
    }
  };
}
function create_else_block7(ctx) {
  let div;
  let current_block_type_index;
  let if_block;
  let current;
  const if_block_creators = [create_if_block_43, create_else_block_13];
  const if_blocks = [];
  function select_block_type_1(ctx2, dirty) {
    if (ctx2[13] || ctx2[12] || ctx2[2])
      return 0;
    return 1;
  }
  current_block_type_index = select_block_type_1(ctx, [-1, -1]);
  if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
  return {
    c() {
      div = element("div");
      if_block.c();
      attr(div, "class", "add-creature-container svelte-rp16qm");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      if_blocks[current_block_type_index].m(div, null);
      current = true;
    },
    p(ctx2, dirty) {
      let previous_block_index = current_block_type_index;
      current_block_type_index = select_block_type_1(ctx2, dirty);
      if (current_block_type_index === previous_block_index) {
        if_blocks[current_block_type_index].p(ctx2, dirty);
      } else {
        group_outros();
        transition_out(if_blocks[previous_block_index], 1, 1, () => {
          if_blocks[previous_block_index] = null;
        });
        check_outros();
        if_block = if_blocks[current_block_type_index];
        if (!if_block) {
          if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
          if_block.c();
        } else {
          if_block.p(ctx2, dirty);
        }
        transition_in(if_block, 1);
        if_block.m(div, null);
      }
    },
    i(local) {
      if (current)
        return;
      transition_in(if_block);
      current = true;
    },
    o(local) {
      transition_out(if_block);
      current = false;
    },
    d(detaching) {
      if (detaching)
        detach(div);
      if_blocks[current_block_type_index].d();
    }
  };
}
function create_if_block_33(ctx) {
  let loadencounter;
  let current;
  loadencounter = new LoadEncounter_default({});
  loadencounter.$on("cancel", ctx[34]);
  return {
    c() {
      create_component(loadencounter.$$.fragment);
    },
    m(target, anchor) {
      mount_component(loadencounter, target, anchor);
      current = true;
    },
    p: noop,
    i(local) {
      if (current)
        return;
      transition_in(loadencounter.$$.fragment, local);
      current = true;
    },
    o(local) {
      transition_out(loadencounter.$$.fragment, local);
      current = false;
    },
    d(detaching) {
      destroy_component(loadencounter, detaching);
    }
  };
}
function create_if_block_24(ctx) {
  let saveencounter;
  let current;
  saveencounter = new SaveEncounter_default({ props: { name: ctx[4] } });
  saveencounter.$on("cancel", ctx[33]);
  return {
    c() {
      create_component(saveencounter.$$.fragment);
    },
    m(target, anchor) {
      mount_component(saveencounter, target, anchor);
      current = true;
    },
    p(ctx2, dirty) {
      const saveencounter_changes = {};
      if (dirty[0] & 16)
        saveencounter_changes.name = ctx2[4];
      saveencounter.$set(saveencounter_changes);
    },
    i(local) {
      if (current)
        return;
      transition_in(saveencounter.$$.fragment, local);
      current = true;
    },
    o(local) {
      transition_out(saveencounter.$$.fragment, local);
      current = false;
    },
    d(detaching) {
      destroy_component(saveencounter, detaching);
    }
  };
}
function create_if_block_15(ctx) {
  let div;
  let span;
  let t1;
  let input;
  let init_action;
  let mounted;
  let dispose;
  return {
    c() {
      div = element("div");
      span = element("span");
      span.textContent = "Apply status:";
      t1 = space();
      input = element("input");
      attr(input, "type", "text");
      attr(div, "class", "updating-hp");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, span);
      append(div, t1);
      append(div, input);
      if (!mounted) {
        dispose = [
          listen(input, "focus", ctx[31]),
          listen(input, "blur", ctx[32]),
          listen(input, "keydown", keydown_handler_1),
          action_destroyer(init_action = init2.call(null, input))
        ];
        mounted = true;
      }
    },
    p: noop,
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div);
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_if_block12(ctx) {
  let div;
  let span;
  let t1;
  let input;
  let init_action;
  let mounted;
  let dispose;
  return {
    c() {
      div = element("div");
      span = element("span");
      span.textContent = "Apply damage(+) or healing(-):";
      t1 = space();
      input = element("input");
      attr(input, "type", "number");
      attr(div, "class", "updating-hp");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      append(div, span);
      append(div, t1);
      append(div, input);
      if (!mounted) {
        dispose = [
          listen(input, "blur", ctx[30]),
          listen(input, "keydown", keydown_handler2),
          action_destroyer(init_action = init2.call(null, input))
        ];
        mounted = true;
      }
    },
    p: noop,
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div);
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_else_block_13(ctx) {
  let div2;
  let div0;
  let copyButton_action;
  let t;
  let div1;
  let addButton_action;
  let mounted;
  let dispose;
  return {
    c() {
      div2 = element("div");
      div0 = element("div");
      t = space();
      div1 = element("div");
      attr(div0, "class", "copy-button svelte-rp16qm");
      attr(div1, "class", "add-button svelte-rp16qm");
      attr(div2, "class", "context-container svelte-rp16qm");
    },
    m(target, anchor) {
      insert(target, div2, anchor);
      append(div2, div0);
      append(div2, t);
      append(div2, div1);
      if (!mounted) {
        dispose = [
          action_destroyer(copyButton_action = ctx[21].call(null, div0)),
          action_destroyer(addButton_action = ctx[20].call(null, div1))
        ];
        mounted = true;
      }
    },
    p: noop,
    i: noop,
    o: noop,
    d(detaching) {
      if (detaching)
        detach(div2);
      mounted = false;
      run_all(dispose);
    }
  };
}
function create_if_block_43(ctx) {
  let create;
  let current;
  create = new Create_default({
    props: {
      editing: ctx[13] != null,
      name: ctx[13]?.name,
      display: ctx[13]?.display,
      hp: `${ctx[13]?.hp}`,
      initiative: ctx[13]?.initiative,
      modifier: ctx[13]?.modifier,
      ac: `${ctx[13]?.ac}`
    }
  });
  create.$on("cancel", ctx[35]);
  create.$on("save", ctx[36]);
  return {
    c() {
      create_component(create.$$.fragment);
    },
    m(target, anchor) {
      mount_component(create, target, anchor);
      current = true;
    },
    p(ctx2, dirty) {
      const create_changes = {};
      if (dirty[0] & 8192)
        create_changes.editing = ctx2[13] != null;
      if (dirty[0] & 8192)
        create_changes.name = ctx2[13]?.name;
      if (dirty[0] & 8192)
        create_changes.display = ctx2[13]?.display;
      if (dirty[0] & 8192)
        create_changes.hp = `${ctx2[13]?.hp}`;
      if (dirty[0] & 8192)
        create_changes.initiative = ctx2[13]?.initiative;
      if (dirty[0] & 8192)
        create_changes.modifier = ctx2[13]?.modifier;
      if (dirty[0] & 8192)
        create_changes.ac = `${ctx2[13]?.ac}`;
      create.$set(create_changes);
    },
    i(local) {
      if (current)
        return;
      transition_in(create.$$.fragment, local);
      current = true;
    },
    o(local) {
      transition_out(create.$$.fragment, local);
      current = false;
    },
    d(detaching) {
      destroy_component(create, detaching);
    }
  };
}
function create_fragment15(ctx) {
  let div;
  let t0;
  let controls;
  let t1;
  let t2;
  let t3;
  let table;
  let t4;
  let t5;
  let current_block_type_index;
  let if_block4;
  let current;
  let if_block0 = ctx[9] && create_if_block_9(ctx);
  controls = new Controls_default({
    props: {
      state: ctx[5],
      map: ctx[10]
    }
  });
  controls.$on("save", ctx[25]);
  controls.$on("load", ctx[26]);
  let if_block1 = ctx[5] && create_if_block_82(ctx);
  let if_block2 = ctx[4] && ctx[4].length && create_if_block_62(ctx);
  table = new Table_default({
    props: {
      creatures: ctx[3],
      state: ctx[5]
    }
  });
  table.$on("hp", ctx[27]);
  table.$on("tag", ctx[28]);
  table.$on("edit", ctx[29]);
  let if_block3 = ctx[6].data.displayDifficulty && create_if_block_53(ctx);
  const if_block_creators = [
    create_if_block12,
    create_if_block_15,
    create_if_block_24,
    create_if_block_33,
    create_else_block7
  ];
  const if_blocks = [];
  function select_block_type(ctx2, dirty) {
    if (ctx2[0])
      return 0;
    if (ctx2[1])
      return 1;
    if (ctx2[15])
      return 2;
    if (ctx2[16])
      return 3;
    return 4;
  }
  current_block_type_index = select_block_type(ctx, [-1, -1]);
  if_block4 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
  return {
    c() {
      div = element("div");
      if (if_block0)
        if_block0.c();
      t0 = space();
      create_component(controls.$$.fragment);
      t1 = space();
      if (if_block1)
        if_block1.c();
      t2 = space();
      if (if_block2)
        if_block2.c();
      t3 = space();
      create_component(table.$$.fragment);
      t4 = space();
      if (if_block3)
        if_block3.c();
      t5 = space();
      if_block4.c();
      attr(div, "class", "obsidian-initiative-tracker svelte-rp16qm");
    },
    m(target, anchor) {
      insert(target, div, anchor);
      if (if_block0)
        if_block0.m(div, null);
      append(div, t0);
      mount_component(controls, div, null);
      append(div, t1);
      if (if_block1)
        if_block1.m(div, null);
      append(div, t2);
      if (if_block2)
        if_block2.m(div, null);
      append(div, t3);
      mount_component(table, div, null);
      append(div, t4);
      if (if_block3)
        if_block3.m(div, null);
      append(div, t5);
      if_blocks[current_block_type_index].m(div, null);
      current = true;
    },
    p(ctx2, dirty) {
      if (ctx2[9]) {
        if (if_block0) {
          if_block0.p(ctx2, dirty);
        } else {
          if_block0 = create_if_block_9(ctx2);
          if_block0.c();
          if_block0.m(div, t0);
        }
      } else if (if_block0) {
        if_block0.d(1);
        if_block0 = null;
      }
      const controls_changes = {};
      if (dirty[0] & 32)
        controls_changes.state = ctx2[5];
      if (dirty[0] & 1024)
        controls_changes.map = ctx2[10];
      controls.$set(controls_changes);
      if (ctx2[5]) {
        if (if_block1) {
          if_block1.p(ctx2, dirty);
        } else {
          if_block1 = create_if_block_82(ctx2);
          if_block1.c();
          if_block1.m(div, t2);
        }
      } else if (if_block1) {
        if_block1.d(1);
        if_block1 = null;
      }
      if (ctx2[4] && ctx2[4].length) {
        if (if_block2) {
          if_block2.p(ctx2, dirty);
        } else {
          if_block2 = create_if_block_62(ctx2);
          if_block2.c();
          if_block2.m(div, t3);
        }
      } else if (if_block2) {
        if_block2.d(1);
        if_block2 = null;
      }
      const table_changes = {};
      if (dirty[0] & 8)
        table_changes.creatures = ctx2[3];
      if (dirty[0] & 32)
        table_changes.state = ctx2[5];
      table.$set(table_changes);
      if (ctx2[6].data.displayDifficulty) {
        if (if_block3) {
          if_block3.p(ctx2, dirty);
          if (dirty[0] & 64) {
            transition_in(if_block3, 1);
          }
        } else {
          if_block3 = create_if_block_53(ctx2);
          if_block3.c();
          transition_in(if_block3, 1);
          if_block3.m(div, t5);
        }
      } else if (if_block3) {
        group_outros();
        transition_out(if_block3, 1, 1, () => {
          if_block3 = null;
        });
        check_outros();
      }
      let previous_block_index = current_block_type_index;
      current_block_type_index = select_block_type(ctx2, dirty);
      if (current_block_type_index === previous_block_index) {
        if_blocks[current_block_type_index].p(ctx2, dirty);
      } else {
        group_outros();
        transition_out(if_blocks[previous_block_index], 1, 1, () => {
          if_blocks[previous_block_index] = null;
        });
        check_outros();
        if_block4 = if_blocks[current_block_type_index];
        if (!if_block4) {
          if_block4 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
          if_block4.c();
        } else {
          if_block4.p(ctx2, dirty);
        }
        transition_in(if_block4, 1);
        if_block4.m(div, null);
      }
    },
    i(local) {
      if (current)
        return;
      transition_in(controls.$$.fragment, local);
      transition_in(table.$$.fragment, local);
      transition_in(if_block3);
      transition_in(if_block4);
      current = true;
    },
    o(local) {
      transition_out(controls.$$.fragment, local);
      transition_out(table.$$.fragment, local);
      transition_out(if_block3);
      transition_out(if_block4);
      current = false;
    },
    d(detaching) {
      if (detaching)
        detach(div);
      if (if_block0)
        if_block0.d();
      destroy_component(controls);
      if (if_block1)
        if_block1.d();
      if (if_block2)
        if_block2.d();
      destroy_component(table);
      if (if_block3)
        if_block3.d();
      if_blocks[current_block_type_index].d();
    }
  };
}
function init2(el) {
  el.focus();
}
var keydown_handler2 = function(evt) {
  if (evt.key === "Enter" || evt.key === "Tab") {
    evt.preventDefault();
    this.blur();
    return;
  }
  if (evt.key === "Escape") {
    this.value = "";
    this.blur();
    return;
  }
  if (!/^(-?\d*\.?\d*|Backspace|Delete|Arrow\w+)$/.test(evt.key)) {
    evt.preventDefault();
    return false;
  }
};
var keydown_handler_1 = function(evt) {
  if (evt.key === "Escape") {
    this.value = "";
    this.blur();
    return;
  }
  if (evt.key === "Enter" || evt.key === "Tab") {
    evt.preventDefault();
    this.blur();
    return;
  }
  if (evt.key === "Escape") {
    this.value = "";
    this.blur();
    return;
  }
};
function instance15($$self, $$props, $$invalidate) {
  var _a;
  const dispatch = createEventDispatcher();
  let { creatures = [] } = $$props;
  let { name = null } = $$props;
  let { state } = $$props;
  let { xp } = $$props;
  let { plugin } = $$props;
  let { view } = $$props;
  let { round: round3 } = $$props;
  let { party = null } = $$props;
  let { map = plugin.data.leafletIntegration } = $$props;
  setContext("plugin", plugin);
  setContext("view", view);
  let totalXP = xp;
  let { updatingHP = null } = $$props;
  const updateHP = (toAdd) => {
    view.updateCreature(updatingHP, { hp: -1 * toAdd });
    $$invalidate(0, updatingHP = null);
  };
  let { updatingStatus = null } = $$props;
  const addStatus = (tag) => {
    view.addStatus(updatingStatus, tag);
    $$invalidate(1, updatingStatus = null);
  };
  let addNew = false;
  let { addNewAsync = false } = $$props;
  let editCreature = null;
  const addButton = (node) => {
    new import_obsidian18.ExtraButtonComponent(node).setTooltip("Add Creature").setIcon(ADD).onClick(() => {
      $$invalidate(12, addNew = true);
    });
  };
  const copyButton = (node) => {
    new import_obsidian18.ExtraButtonComponent(node).setTooltip("Copy Initiative Order").setIcon(COPY).onClick(() => __awaiter(void 0, void 0, void 0, function* () {
      const contents = creatures.map((creature) => `${creature.initiative} ${creature.name}`).join("\n");
      yield navigator.clipboard.writeText(contents);
    }));
  };
  let modal;
  const suggestConditions = (node) => {
    $$invalidate(14, modal = new ConditionSuggestionModal(view.plugin, node));
    $$invalidate(14, modal.onClose = () => {
      node.blur();
    }, modal);
    modal.open();
  };
  let saving = false;
  let loading = false;
  const save_handler = () => $$invalidate(15, saving = true);
  const load_handler = () => $$invalidate(16, loading = true);
  const hp_handler = (evt) => {
    $$invalidate(0, updatingHP = evt.detail);
  };
  const tag_handler = (evt) => {
    $$invalidate(1, updatingStatus = evt.detail);
  };
  const edit_handler = (evt) => {
    $$invalidate(13, editCreature = evt.detail);
  };
  const blur_handler = function(evt) {
    updateHP(Number(this.value));
  };
  const focus_handler = function(evt) {
    suggestConditions(this);
  };
  const blur_handler_1 = function(evt) {
    if (!this.value.length) {
      $$invalidate(1, updatingStatus = null);
      return;
    }
    addStatus(modal.condition);
  };
  const cancel_handler = () => $$invalidate(15, saving = false);
  const cancel_handler_1 = () => $$invalidate(16, loading = false);
  const cancel_handler_2 = () => {
    $$invalidate(12, addNew = false);
    $$invalidate(2, addNewAsync = false);
    $$invalidate(13, editCreature = null);
    dispatch("cancel-add-new-async");
  };
  const save_handler_1 = (evt) => {
    const creature = evt.detail;
    const newCreature = new Creature({
      name: creature.name,
      display: creature.display,
      hp: creature.hp,
      ac: creature.ac,
      modifier: creature.modifier,
      marker: view.plugin.data.monsterMarker,
      xp: creature.xp,
      player: creature.player,
      level: creature.level
    }, creature.initiative);
    if (addNewAsync) {
      dispatch("add-new-async", newCreature);
    } else if (editCreature) {
      $$invalidate(13, editCreature.name = creature.name, editCreature);
      $$invalidate(13, editCreature.ac = creature.ac, editCreature);
      $$invalidate(13, editCreature.display = creature.display, editCreature);
      $$invalidate(13, editCreature.initiative = creature.initiative, editCreature);
      $$invalidate(13, editCreature.modifier = creature.modifier, editCreature);
      view.updateCreature(editCreature, { name: creature.name });
    } else {
      const number = Math.max(isNaN(creature.number) ? 1 : creature.number, 1);
      view.addCreatures([...Array(number).keys()].map((k) => Creature.new(newCreature)));
    }
    $$invalidate(12, addNew = false);
    $$invalidate(2, addNewAsync = false);
    $$invalidate(13, editCreature = null);
  };
  $$self.$$set = ($$props2) => {
    if ("creatures" in $$props2)
      $$invalidate(3, creatures = $$props2.creatures);
    if ("name" in $$props2)
      $$invalidate(4, name = $$props2.name);
    if ("state" in $$props2)
      $$invalidate(5, state = $$props2.state);
    if ("xp" in $$props2)
      $$invalidate(23, xp = $$props2.xp);
    if ("plugin" in $$props2)
      $$invalidate(6, plugin = $$props2.plugin);
    if ("view" in $$props2)
      $$invalidate(7, view = $$props2.view);
    if ("round" in $$props2)
      $$invalidate(8, round3 = $$props2.round);
    if ("party" in $$props2)
      $$invalidate(9, party = $$props2.party);
    if ("map" in $$props2)
      $$invalidate(10, map = $$props2.map);
    if ("updatingHP" in $$props2)
      $$invalidate(0, updatingHP = $$props2.updatingHP);
    if ("updatingStatus" in $$props2)
      $$invalidate(1, updatingStatus = $$props2.updatingStatus);
    if ("addNewAsync" in $$props2)
      $$invalidate(2, addNewAsync = $$props2.addNewAsync);
  };
  $$self.$$.update = () => {
    if ($$self.$$.dirty[0] & 25165832) {
      $: {
        if (!xp) {
          $$invalidate(11, totalXP = $$invalidate(24, _a = creatures === null || creatures === void 0 ? void 0 : creatures.filter((creature) => creature.xp)) === null || _a === void 0 ? void 0 : _a.reduce((num, cr) => num + cr.xp, 0));
        }
      }
    }
  };
  return [
    updatingHP,
    updatingStatus,
    addNewAsync,
    creatures,
    name,
    state,
    plugin,
    view,
    round3,
    party,
    map,
    totalXP,
    addNew,
    editCreature,
    modal,
    saving,
    loading,
    dispatch,
    updateHP,
    addStatus,
    addButton,
    copyButton,
    suggestConditions,
    xp,
    _a,
    save_handler,
    load_handler,
    hp_handler,
    tag_handler,
    edit_handler,
    blur_handler,
    focus_handler,
    blur_handler_1,
    cancel_handler,
    cancel_handler_1,
    cancel_handler_2,
    save_handler_1
  ];
}
var App3 = class extends SvelteComponent {
  constructor(options) {
    super();
    init(this, options, instance15, create_fragment15, safe_not_equal, {
      creatures: 3,
      name: 4,
      state: 5,
      xp: 23,
      plugin: 6,
      view: 7,
      round: 8,
      party: 9,
      map: 10,
      updatingHP: 0,
      updatingStatus: 1,
      addNewAsync: 2
    }, add_css14, [-1, -1]);
  }
};
var App_default = App3;

// src/view.ts
var TrackerView = class extends import_obsidian19.ItemView {
  constructor(leaf, plugin) {
    super(leaf);
    this.leaf = leaf;
    this.plugin = plugin;
    this.creatures = [];
    this.state = false;
    this.condense = this.plugin.data.condense;
    this.round = 1;
    this._rendered = false;
    this.party = this.plugin.defaultParty;
    this.playerNames = [];
    if (this.plugin.data.state?.creatures?.length) {
      this.newEncounterFromState(this.plugin.data.state);
    } else {
      this.newEncounter();
    }
  }
  async saveEncounter(name) {
    if (!name) {
      new import_obsidian19.Notice("An encounter must have a name to be saved.");
      return;
    }
    this.plugin.data.encounters[name] = {
      creatures: [...this.ordered.map((c) => c.toJSON())],
      state: this.state,
      name,
      round: this.round
    };
    await this.plugin.saveSettings();
  }
  async loadEncounter(name) {
    const state = this.plugin.data.encounters[name];
    if (!state) {
      new import_obsidian19.Notice("There was an issue loading the encounter.");
      return;
    }
    this.newEncounterFromState(state);
  }
  toggleCondensed() {
    this.condense = !this.condense;
    this.setAppState({ creatures: this.ordered });
  }
  setCondensed(bool) {
    this.condense = bool;
    this.setAppState({ creatures: this.ordered });
  }
  async openCombatant(creature) {
    const view = this.plugin.combatant;
    if (!view) {
      const leaf = this.app.workspace.getRightLeaf(true);
      await leaf.setViewState({
        type: CREATURE_TRACKER_VIEW
      });
    }
    this.ordered.forEach((c) => c.viewing = false);
    creature.viewing = true;
    this.setAppState({ creatures: this.ordered });
    const ref = this.app.workspace.on("initiative-tracker:stop-viewing", () => {
      creature.viewing = false;
      this.setAppState({ creatures: this.ordered });
      this.app.workspace.offref(ref);
    });
    this.registerEvent(ref);
    this.plugin.combatant.render(creature);
  }
  get pcs() {
    return this.players;
  }
  get npcs() {
    return this.creatures.filter((c) => !c.player);
  }
  async switchParty(party) {
    if (!this.plugin.data.parties.find((p) => p.name == party))
      return;
    this.party = this.plugin.data.parties.find((p) => p.name == party);
    console.log("\u{1F680} ~ file: view.ts ~ line 120 ~ this.party", this.party);
    this.setAppState({ party: this.party.name });
    this.creatures = this.creatures.filter((p) => !p.player);
    for (const player of this.players) {
      player.initiative = await this.getInitiativeValue(player.modifier);
      this._addCreature(player);
    }
  }
  get players() {
    if (this.party) {
      let players = this.party.players;
      if (players) {
        return Array.from(this.plugin.playerCreatures.values()).filter((p) => players.includes(p.name));
      }
    }
    return Array.from(this.plugin.playerCreatures.values());
  }
  updatePlayers() {
    this.trigger("initiative-tracker:players-updated", this.pcs);
    this.setAppState({
      creatures: this.ordered
    });
  }
  updateState() {
    this.setAppState(this.appState);
  }
  newEncounterFromState(initiativeState) {
    if (!initiativeState || !initiativeState?.creatures?.length) {
      this.newEncounter();
    }
    const { creatures, state, name, round: round3 = 1 } = initiativeState;
    this.setCreatures([...creatures.map((c) => Creature.fromJSON(c))]);
    this.name = name;
    this.round = round3;
    this.state = state;
    this.trigger("initiative-tracker:new-encounter", this.appState);
    this.setAppState({
      creatures: this.ordered,
      state: this.state,
      round: this.round,
      name: this.name
    });
  }
  _addCreature(creature) {
    this.addCreatures([creature], false);
  }
  get condensed() {
    if (this.condense) {
      this.creatures.forEach((creature, _, arr) => {
        const equiv = arr.filter((c) => equivalent(c, creature));
        equiv.forEach((eq) => {
          eq.initiative = Math.max(...equiv.map((i) => i.initiative));
        });
      });
    }
    return this.creatures;
  }
  get ordered() {
    const sort = [...this.condensed];
    sort.sort((a, b) => {
      return b.initiative - a.initiative;
    });
    return sort;
  }
  get enabled() {
    return this.ordered.filter((c) => c.enabled);
  }
  addCreatures(creatures, trigger = true) {
    this.setCreatures([...this.creatures ?? [], ...creatures ?? []]);
    if (trigger)
      this.trigger("initiative-tracker:creatures-added", creatures);
    this.setAppState({
      creatures: this.ordered
    });
  }
  removeCreature(...creatures) {
    if (creatures.some((c) => c.active)) {
      const active2 = this.creatures.find((c) => c.active);
      this.goToNext();
      this.setCreatures(this.creatures.filter((c) => c != active2));
      this.removeCreature(...creatures.filter((c) => c != active2));
      return;
    }
    this.setCreatures(this.creatures.filter((c) => !creatures.includes(c)));
    this.trigger("initiative-tracker:creatures-removed", creatures);
    this.setAppState({
      creatures: this.ordered
    });
  }
  setCreatures(creatures) {
    this.creatures = creatures;
    for (let i = 0; i < this.creatures.length; i++) {
      const creature = this.creatures[i];
      if (creature.player || this.creatures.filter((c) => c.name == creature.name).length == 1) {
        continue;
      }
      if (creature.number > 0)
        continue;
      const prior = this.creatures.slice(0, i).filter((c) => c.name == creature.name).map((c) => c.number);
      creature.number = prior?.length ? Math.max(...prior) + 1 : 1;
    }
  }
  async newEncounter({
    name,
    party,
    players,
    creatures,
    roll,
    xp
  } = {
    party: this.party?.name,
    players: [...this.plugin.data.players.map((p) => p.name)],
    creatures: [],
    roll: true
  }) {
    this.creatures = [];
    const playerNames = new Set(players ?? []);
    if (party) {
      playerNames.clear();
      this.party = this.plugin.data.parties.find((p) => p.name == party);
      for (const player of this.players) {
        playerNames.add(player.name);
      }
    }
    for (const player of playerNames) {
      if (!this.plugin.playerCreatures.has(player))
        continue;
      this.creatures.push(this.plugin.playerCreatures.get(player));
    }
    if (creatures)
      this.setCreatures([...this.creatures, ...creatures]);
    this.name = name;
    this.round = 1;
    this.setAppState({
      party: this.party?.name,
      name: this.name,
      round: this.round,
      xp
    });
    for (let creature of this.creatures) {
      creature.enabled = true;
    }
    this.trigger("initiative-tracker:new-encounter", this.appState);
    if (roll)
      await this.rollInitiatives();
    else {
      this.setAppState({
        creatures: this.ordered
      });
    }
  }
  resetEncounter() {
    for (let creature of this.ordered) {
      creature.hp = creature.max;
      this.setCreatureState(creature, true);
      const statuses = Array.from(creature.status);
      statuses.forEach((status) => {
        this.removeStatus(creature, status);
      });
      creature.active = false;
    }
    if (this.ordered.length)
      this.ordered[0].active = true;
    this.setAppState({
      creatures: this.ordered
    });
  }
  setMapState(v) {
    this.setAppState({
      map: v
    });
  }
  async getInitiativeValue(modifier = 0) {
    return await this.plugin.getInitiativeValue(modifier);
  }
  async rollInitiatives() {
    for (let creature of this.creatures) {
      creature.initiative = await this.getInitiativeValue(creature.modifier);
      creature.active = false;
    }
    if (this.ordered.length)
      this.ordered[0].active = true;
    this.setAppState({
      creatures: this.ordered
    });
  }
  get appState() {
    return {
      state: this.state,
      pcs: this.pcs,
      npcs: this.npcs,
      creatures: this.ordered
    };
  }
  goToNext(active2 = this.ordered.findIndex((c) => c.active)) {
    if (active2 == -1)
      return;
    const sliced = [
      ...this.ordered.slice(active2 + 1),
      ...this.ordered.slice(0, active2)
    ];
    const next2 = sliced.find((c) => c.enabled);
    if (this.ordered[active2])
      this.ordered[active2].active = false;
    if (!next2)
      return;
    if (active2 > this.ordered.indexOf(next2))
      this.round++;
    next2.active = true;
    this.trigger("initiative-tracker:active-change", next2);
    this.setAppState({
      creatures: this.ordered,
      round: this.round
    });
  }
  goToPrevious(active2 = this.ordered.findIndex((c) => c.active)) {
    if (active2 == -1)
      return;
    const previous = [...this.ordered].slice(0, active2).reverse();
    const after = [...this.ordered].slice(active2 + 1).reverse();
    const creature = [...previous, ...after].find((c) => c.enabled);
    if (!creature)
      return;
    if (active2 < this.ordered.indexOf(creature)) {
      if (this.round == 1) {
        return;
      }
      this.round = this.round - 1;
    }
    if (this.ordered[active2])
      this.ordered[active2].active = false;
    creature.active = true;
    this.trigger("initiative-tracker:active-change", creature);
    this.setAppState({
      creatures: this.ordered,
      round: this.round
    });
  }
  toggleState() {
    this.state = !this.state;
    this.creatures.forEach((c) => c.active = false);
    if (this.state) {
      const active2 = this.ordered.find((c) => c.enabled);
      if (active2) {
        active2.active = true;
        this.trigger("initiative-tracker:active-change", active2);
      }
    } else {
      this.trigger("initiative-tracker:active-change", null);
    }
    this.setAppState({
      state: this.state
    });
  }
  addStatus(creature, tag) {
    creature.status.add(tag);
    this.trigger("initiative-tracker:creature-updated", creature);
    this.setAppState({
      creatures: this.ordered
    });
  }
  removeStatus(creature, tag) {
    creature.status.delete(tag);
    this.trigger("initiative-tracker:creature-updated", creature);
    this.setAppState({
      creatures: this.ordered
    });
  }
  updateCreature(creature, {
    hp,
    max: max2,
    ac,
    initiative,
    name,
    marker
  }) {
    if (initiative) {
      creature.initiative = Number(initiative);
    }
    if (name) {
      creature.name = name;
      creature.number = 0;
    }
    if (hp) {
      if (this.plugin.data.clamp && creature.hp + Number(hp) < 0) {
        hp = -creature.hp;
      }
      creature.hp += Number(hp);
      if (this.plugin.data.autoStatus && creature.hp <= 0) {
        this.addStatus(creature, this.plugin.data.statuses.find((s) => s.name == "Unconscious"));
      }
    }
    if (max2) {
      if (creature.hp == creature.max) {
        creature.hp = Number(max2);
      }
      creature.max = Number(max2);
    }
    if (ac) {
      creature.ac = ac;
    }
    if (marker) {
      creature.marker = marker;
    }
    this.trigger("initiative-tracker:creature-updated", creature);
    this.setAppState({
      creatures: this.ordered
    });
  }
  async copyInitiativeOrder() {
    const contents = this.ordered.map((creature) => `${creature.initiative} ${creature.name}`).join("\n");
    await navigator.clipboard.writeText(contents);
  }
  setCreatureState(creature, enabled) {
    if (enabled) {
      this._enableCreature(creature);
    } else {
      this._disableCreature(creature);
    }
    this.trigger("initiative-tracker:creature-updated", creature);
    this.setAppState({
      creatures: this.ordered
    });
  }
  _enableCreature(creature) {
    creature.enabled = true;
    if (this.enabled.length == 1) {
      creature.active = true;
    }
  }
  _disableCreature(creature) {
    if (creature.active) {
      this.goToNext();
    }
    creature.enabled = false;
  }
  setAppState(state) {
    if (this._app && this._rendered) {
      this.plugin.app.workspace.trigger("initiative-tracker:state-change", this.appState);
      this._app.$set(state);
    }
    this.plugin.data.state = this.toState();
    this.trigger("initiative-tracker:should-save");
  }
  async onOpen() {
    this._app = new App_default({
      target: this.contentEl,
      props: {
        party: this.party?.name,
        creatures: this.ordered,
        state: this.state,
        xp: null,
        view: this,
        plugin: this.plugin,
        round: this.round
      }
    });
    this._rendered = true;
  }
  async onClose() {
    this._app.$destroy();
    this._rendered = false;
    this.trigger("initiative-tracker:closed");
  }
  getViewType() {
    return INTIATIVE_TRACKER_VIEW;
  }
  getDisplayText() {
    return "Initiative Tracker";
  }
  getIcon() {
    return BASE;
  }
  openInitiativeView() {
    this.plugin.leaflet.openInitiativeView(this.pcs, this.npcs);
  }
  trigger(...args) {
    const [name, ...data] = args;
    this.app.workspace.trigger(name, ...data);
  }
  toState() {
    if (!this.state)
      return null;
    return {
      creatures: [...this.ordered.map((c) => c.toJSON())],
      state: this.state,
      name: this.name,
      round: this.round
    };
  }
  async onunload() {
    this.plugin.data.state = this.toState();
    await this.plugin.saveSettings();
  }
  registerEvents() {
    this.registerEvent(this.app.workspace.on("initiative-tracker:add-creature-here", async (latlng) => {
      this.app.workspace.revealLeaf(this.leaf);
      let addNewAsync = this._app.$on("add-new-async", (evt) => {
        const creature = evt.detail;
        this._addCreature(creature);
        this.trigger("initiative-tracker:creature-added-at-location", creature, latlng);
        addNewAsync();
        cancel();
      });
      let cancel = this._app.$on("cancel-add-new-async", () => {
        addNewAsync();
        cancel();
      });
      this._app.$set({ addNewAsync: true });
    }));
    this.registerEvent(this.app.workspace.on("initiative-tracker:creature-updated-in-settings", (creature) => {
      const existing = this.creatures.find((c) => c == creature);
      if (existing) {
        this.updateCreature(existing, creature);
      }
    }));
    this.registerEvent(this.app.workspace.on("initiative-tracker:remove", (creature) => {
      const existing = this.creatures.find((c) => c.id == creature.id);
      if (existing) {
        this.removeCreature(existing);
      }
    }));
    this.registerEvent(this.app.workspace.on("initiative-tracker:enable-disable", (creature, enable) => {
      const existing = this.creatures.find((c) => c.id == creature.id);
      if (existing) {
        this.setCreatureState(existing, enable);
      }
    }));
    this.registerEvent(this.app.workspace.on("initiative-tracker:apply-damage", (creature) => {
      const existing = this.creatures.find((c) => c.id == creature.id);
      if (existing) {
        this.setAppState({
          updatingHP: existing
        });
      }
    }));
    this.registerEvent(this.app.workspace.on("initiative-tracker:add-status", (creature) => {
      const existing = this.creatures.find((c) => c.id == creature.id);
      if (existing) {
        this.setAppState({
          updatingStatus: existing
        });
      }
    }));
  }
};
var CreatureView = class extends import_obsidian19.ItemView {
  constructor(leaf, plugin) {
    super(leaf);
    this.plugin = plugin;
    this.buttonEl = this.contentEl.createDiv("creature-view-button");
    this.statblockEl = this.contentEl.createDiv("creature-statblock-container");
    this.load();
    this.containerEl.addClass("creature-view-container");
  }
  onload() {
    new import_obsidian19.ExtraButtonComponent(this.buttonEl).setIcon("cross").setTooltip("Close Statblock").onClick(() => {
      this.render();
      this.app.workspace.trigger("initiative-tracker:stop-viewing");
    });
  }
  onunload() {
    this.app.workspace.trigger("initiative-tracker:stop-viewing");
  }
  render(creature) {
    this.statblockEl.empty();
    if (!creature) {
      this.statblockEl.createEl("em", {
        text: "Select a creature to view it here."
      });
      return;
    }
    if (this.plugin.canUseStatBlocks && this.plugin.statblockVersion?.major >= 2) {
      const statblock = this.plugin.statblocks.render(creature, this.statblockEl, creature.display);
      if (statblock) {
        this.addChild(statblock);
      }
    } else {
      this.statblockEl.createEl("em", {
        text: "Install the TTRPG Statblocks plugin to use this feature!"
      });
    }
  }
  getDisplayText() {
    return "Combatant";
  }
  getIcon() {
    return CREATURE;
  }
  getViewType() {
    return CREATURE_TRACKER_VIEW;
  }
};

// src/main.ts
var InitiativeTracker = class extends import_obsidian20.Plugin {
  constructor() {
    super(...arguments);
    this.playerCreatures = /* @__PURE__ */ new Map();
    this.homebrewCreatures = /* @__PURE__ */ new Map();
    this.watchers = /* @__PURE__ */ new Map();
  }
  async parseDice(text2) {
    if (!this.canUseDiceRoller)
      return null;
    return await this.app.plugins.getPlugin("obsidian-dice-roller").parseDice(text2, "initiative-tracker");
  }
  getRoller(str) {
    if (!this.canUseDiceRoller)
      return;
    const roller = this.app.plugins.getPlugin("obsidian-dice-roller").getRollerSync(str, "statblock", true);
    return roller;
  }
  get canUseDiceRoller() {
    if (this.app.plugins.getPlugin("obsidian-dice-roller") != null) {
      if (!this.app.plugins.getPlugin("obsidian-dice-roller").getRollerSync) {
        new import_obsidian20.Notice("Please update Dice Roller to the latest version to use with Initiative Tracker.");
      } else {
        return true;
      }
    }
    return false;
  }
  async getInitiativeValue(modifier = 0) {
    let initiative = Math.floor(Math.random() * 19 + 1) + modifier;
    if (this.canUseDiceRoller) {
      const num = await this.app.plugins.getPlugin("obsidian-dice-roller").parseDice(this.data.initiative.replace(/%mod%/g, `(${modifier})`), "initiative-tracker");
      initiative = num.result;
    }
    return initiative;
  }
  get canUseStatBlocks() {
    return this.app.plugins.getPlugin("obsidian-5e-statblocks") != null;
  }
  get statblocks() {
    return this.app.plugins.getPlugin("obsidian-5e-statblocks");
  }
  get statblockVersion() {
    return this.statblocks?.settings?.version ?? { major: 0 };
  }
  get canUseLeaflet() {
    return this.app.plugins.getPlugin("obsidian-leaflet-plugin") != null && Number(this.app.plugins.getPlugin("obsidian-leaflet-plugin").data?.version?.major >= 4);
  }
  get leaflet() {
    if (this.canUseLeaflet) {
      return this.app.plugins.getPlugin("obsidian-leaflet-plugin");
    }
  }
  get statblock_creatures() {
    if (!this.data.sync)
      return [];
    if (!this.app.plugins.getPlugin("obsidian-5e-statblocks"))
      return [];
    return [
      ...Array.from(this.app.plugins.getPlugin("obsidian-5e-statblocks").data?.values() ?? [])
    ];
  }
  get homebrew() {
    return [...this.statblock_creatures, ...this.data.homebrew];
  }
  get bestiary() {
    return [...BESTIARY, ...this.homebrew];
  }
  get view() {
    const leaves = this.app.workspace.getLeavesOfType(INTIATIVE_TRACKER_VIEW);
    const leaf = leaves?.length ? leaves[0] : null;
    if (leaf && leaf.view && leaf.view instanceof TrackerView)
      return leaf.view;
  }
  get combatant() {
    const leaves = this.app.workspace.getLeavesOfType(CREATURE_TRACKER_VIEW);
    const leaf = leaves?.length ? leaves[0] : null;
    if (leaf && leaf.view && leaf.view instanceof CreatureView)
      return leaf.view;
  }
  get defaultParty() {
    return this.data.parties.find((p) => p.name == this.data.defaultParty);
  }
  async onload() {
    registerIcons();
    await this.loadSettings();
    this.addSettingTab(new InitiativeTrackerSettings(this));
    this.registerView(INTIATIVE_TRACKER_VIEW, (leaf) => new TrackerView(leaf, this));
    this.registerView(CREATURE_TRACKER_VIEW, (leaf) => new CreatureView(leaf, this));
    this.addCommands();
    this.registerMarkdownCodeBlockProcessor("encounter", (src, el, ctx) => {
      const handler = new EncounterBlock(this, src, el);
      ctx.addChild(handler);
    });
    this.registerMarkdownCodeBlockProcessor("encounter-table", (src, el, ctx) => {
      const handler = new EncounterBlock(this, src, el, true);
      ctx.addChild(handler);
    });
    this.registerMarkdownPostProcessor(async (el, ctx) => {
      if (!el || !el.firstElementChild)
        return;
      const codeEls = el.querySelectorAll("code");
      if (!codeEls || !codeEls.length)
        return;
      const codes = Array.from(codeEls).filter((code) => /^encounter:\s/.test(code.innerText));
      if (!codes.length)
        return;
      for (const code of codes) {
        const creatures = code.innerText.replace(`encounter:`, "").trim().split(",").map((s) => (0, import_obsidian20.parseYaml)(s.trim()));
        const parser = new EncounterParser(this);
        const parsed = await parser.parse({ creatures });
        if (!parsed || !parsed.creatures || !parsed.creatures.size)
          continue;
        const target = createSpan("initiative-tracker-encounter-line");
        new EncounterLine_default({
          target,
          props: {
            ...parsed,
            plugin: this
          }
        });
        code.replaceWith(target);
      }
    });
    this.playerCreatures = new Map(this.data.players.map((p) => [p.name, Creature.from(p)]));
    this.homebrewCreatures = new Map(this.bestiary.map((p) => [p.name, Creature.from(p)]));
    this.app.workspace.onLayoutReady(async () => {
      this.addTrackerView();
      for (const player of this.data.players) {
        if (player.path)
          continue;
        if (!player.note)
          continue;
        const file = await this.app.metadataCache.getFirstLinkpathDest(player.note, "");
        if (!file || !this.app.metadataCache.getFileCache(file)?.frontmatter) {
          new import_obsidian20.Notice(`Initiative Tracker: There was an issue with the linked note for ${player.name}.

Please re-link it in settings.`);
          continue;
        }
      }
      this.registerEvent(this.app.metadataCache.on("changed", (file) => {
        if (!(file instanceof import_obsidian20.TFile))
          return;
        const players = this.data.players.filter((p) => p.path == file.path);
        if (!players.length)
          return;
        const frontmatter = this.app.metadataCache.getFileCache(file)?.frontmatter;
        if (!frontmatter)
          return;
        for (let player of players) {
          const { ac, hp, modifier, level } = frontmatter;
          player.ac = ac;
          player.hp = hp;
          player.modifier = modifier;
          player.level = level;
          this.playerCreatures.set(player.name, Creature.from(player));
          if (this.view) {
            const creature = this.view.ordered.find((c) => c.name == player.name);
            if (creature) {
              this.view.updateCreature(creature, {
                max: player.hp,
                ac: player.ac
              });
            }
          }
        }
      }));
      this.registerEvent(this.app.vault.on("rename", (file, old) => {
        if (!(file instanceof import_obsidian20.TFile))
          return;
        const players = this.data.players.filter((p) => p.path == old);
        if (!players.length)
          return;
        for (const player of players) {
          player.path = file.path;
          player.note = file.basename;
        }
      }));
      this.registerEvent(this.app.vault.on("delete", (file) => {
        if (!(file instanceof import_obsidian20.TFile))
          return;
        const players = this.data.players.filter((p) => p.path == file.path);
        if (!players.length)
          return;
        for (const player of players) {
          player.path = null;
          player.note = null;
        }
      }));
    });
    console.log("Initiative Tracker v" + this.manifest.version + " loaded");
  }
  addCommands() {
    this.addCommand({
      id: "open-tracker",
      name: "Open Initiative Tracker",
      checkCallback: (checking) => {
        if (!this.view) {
          if (!checking) {
            this.addTrackerView();
          }
          return true;
        }
      }
    });
    this.addCommand({
      id: "toggle-encounter",
      name: "Toggle Encounter",
      checkCallback: (checking) => {
        const view = this.view;
        if (view) {
          if (!checking) {
            view.toggleState();
          }
          return true;
        }
      }
    });
    this.addCommand({
      id: "next-combatant",
      name: "Next Combatant",
      checkCallback: (checking) => {
        const view = this.view;
        if (view && view.state) {
          if (!checking) {
            view.goToNext();
          }
          return true;
        }
      }
    });
    this.addCommand({
      id: "prev-combatant",
      name: "Previous Combatant",
      checkCallback: (checking) => {
        const view = this.view;
        if (view && view.state) {
          if (!checking) {
            view.goToPrevious();
          }
          return true;
        }
      }
    });
  }
  addEvents() {
    this.registerEvent(this.app.workspace.on("initiative-tracker:should-save", async () => await this.saveSettings()));
    this.registerEvent(this.app.workspace.on("initiative-tracker:start-encounter", async (homebrews) => {
      try {
        const creatures = homebrews.map((h) => Creature.from(h));
        const view = this.view;
        if (!view) {
          await this.addTrackerView();
        }
        if (view) {
          view?.newEncounter({
            creatures
          });
          this.app.workspace.revealLeaf(view.leaf);
        } else {
          new import_obsidian20.Notice("Could not find the Initiative Tracker. Try reloading the note!");
        }
      } catch (e) {
        new import_obsidian20.Notice("There was an issue launching the encounter.\n\n" + e.message);
        console.error(e);
        return;
      }
    }));
  }
  async onunload() {
    await this.saveSettings();
    this.app.workspace.trigger("initiative-tracker:unload");
    this.app.workspace.getLeavesOfType(INTIATIVE_TRACKER_VIEW).forEach((leaf) => leaf.detach());
    this.app.workspace.getLeavesOfType(CREATURE_TRACKER_VIEW).forEach((leaf) => leaf.detach());
    console.log("Initiative Tracker unloaded");
  }
  async addTrackerView() {
    if (this.app.workspace.getLeavesOfType(INTIATIVE_TRACKER_VIEW)?.length) {
      return;
    }
    await this.app.workspace.getRightLeaf(false).setViewState({
      type: INTIATIVE_TRACKER_VIEW
    });
  }
  async saveMonsters(importedMonsters) {
    this.data.homebrew.push(...importedMonsters);
    for (let monster of importedMonsters) {
      this.homebrewCreatures.set(monster.name, Creature.from(monster));
    }
    await this.saveSettings();
  }
  async saveMonster(monster) {
    this.data.homebrew.push(monster);
    this.homebrewCreatures.set(monster.name, Creature.from(monster));
    await this.saveSettings();
  }
  async updatePlayer(existing, player) {
    if (!this.playerCreatures.has(existing.name)) {
      await this.savePlayer(player);
      return;
    }
    const creature = this.playerCreatures.get(existing.name);
    creature.update(player);
    this.data.players.splice(this.data.players.indexOf(existing), 1, player);
    this.playerCreatures.set(player.name, creature);
    this.playerCreatures.delete(existing.name);
    const view = this.view;
    if (view) {
      view.updateState();
    }
    await this.saveSettings();
  }
  async updateMonster(existing, monster) {
    if (!this.homebrewCreatures.has(existing.name)) {
      await this.saveMonster(monster);
      return;
    }
    const creature = this.homebrewCreatures.get(existing.name);
    creature.update(monster);
    this.data.homebrew.splice(this.data.homebrew.indexOf(existing), 1, monster);
    this.homebrewCreatures.set(monster.name, creature);
    this.homebrewCreatures.delete(existing.name);
    const view = this.view;
    if (view) {
      view.updateState();
    }
    await this.saveSettings();
  }
  async deleteMonster(monster) {
    this.data.homebrew = this.data.homebrew.filter((m) => m != monster);
    this.homebrewCreatures.delete(monster.name);
    await this.saveSettings();
  }
  async savePlayer(player) {
    this.data.players.push(player);
    this.playerCreatures.set(player.name, Creature.from(player));
    await this.saveSettings();
  }
  async savePlayers(...players) {
    for (let monster of players) {
      this.data.players.push(monster);
      this.playerCreatures.set(monster.name, Creature.from(monster));
    }
    await this.saveSettings();
  }
  async deletePlayer(player) {
    this.data.players = this.data.players.filter((p) => p != player);
    this.playerCreatures.delete(player.name);
    await this.saveSettings();
  }
  async loadSettings() {
    const data = Object.assign({}, { ...DEFAULT_SETTINGS }, await this.loadData());
    this.data = data;
    if (this.data.leafletIntegration && !this.data.players.every((p) => p.marker)) {
      this.data.players = this.data.players.map((p) => {
        p.marker = p.marker ?? this.data.playerMarker;
        return p;
      });
    }
  }
  async saveSettings() {
    if (this.data.leafletIntegration && !this.data.players.every((p) => p.marker)) {
      this.data.players = this.data.players.map((p) => {
        p.marker = p.marker ?? this.data.playerMarker;
        return p;
      });
    }
    await this.saveData(this.data);
  }
};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
