code:
//=============================================================================
// Nore_TesValidator.js
//=============================================================================
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//=============================================================================
/*:ja
 * @target MZ
 * @author ル
 * @plugindesc  Nore_Tes の文法チェックスクリプトです。
 * @url https://ci-en.dlsite.com/creator/276
 *
 * @help
 * ver 0.1.0
 *
 * プラグインコマンドはありません。
 *
 * ・利用規約
 * 作者に無断で改変、再配布が可能で、利用形態（商用、18禁利用等）
 * についても制限はありません。
 * このプラグインはもうあなたのものです。
 */
var Nore;
(function (Nore) {
  var Tes;
  (function (Tes) {
    Tes.validates = {};
    var NumericValidator = /** @class */ (function () {
      function NumericValidator(_lowerLimit, _upperLimit, _type) {
        this._lowerLimit = _lowerLimit;
        this._upperLimit = _upperLimit;
        this._type = _type;
      }
      NumericValidator.prototype.validate = function (
        context,
        paramName,
        value
      ) {
        if (this._type && context.headerStr(this._type) === "const") {
          return;
        }
        if (value === undefined) {
          return;
        }
        var num = parseInt(value);
        if (isNaN(num)) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u578B\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u5FC5\u8981\u306A\u3082\u306E: number\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: "
              )
              .concat(value)
          );
          return;
        }
        if (this._lowerLimit == null) {
          return;
        }
        if (this._lowerLimit > num) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u5024\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u6700\u4F4E\u5024: "
              )
              .concat(
                this._lowerLimit,
                "\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: "
              )
              .concat(value)
          );
        }
        if (this._upperLimit == null) {
          return;
        }
        if (this._upperLimit < num) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u5024\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u6700\u5927\u5024: "
              )
              .concat(
                this._upperLimit,
                "\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: "
              )
              .concat(value)
          );
        }
      };
      NumericValidator.prototype.priority = function () {
        return 10;
      };
      return NumericValidator;
    })();
    Tes.NumericValidator = NumericValidator;
    var NotEmptyValidator = /** @class */ (function () {
      function NotEmptyValidator() {}
      NotEmptyValidator.prototype.validate = function (
        context,
        paramName,
        value
      ) {
        if (value == null) {
          context.error(
            "param: ".concat(paramName, " \u306F\u5FC5\u9808\u3067\u3059\u3002")
          );
        }
      };
      NotEmptyValidator.prototype.priority = function () {
        return 20;
      };
      return NotEmptyValidator;
    })();
    Tes.NotEmptyValidator = NotEmptyValidator;
    var NumericParamValidator = /** @class */ (function () {
      function NumericParamValidator(_target) {
        this._target = _target;
      }
      NumericParamValidator.prototype.validate = function (
        context,
        paramName,
        value
      ) {
        if (value === undefined) {
          return;
        }
        var num = parseInt(value);
        if (isNaN(num)) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u578B\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u5FC5\u8981\u306A\u3082\u306E: number\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: "
              )
              .concat(value)
          );
          return;
        }
        var target = context.headerInt(this._target);
        if (target > num) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u5024\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u6700\u4F4E\u5024: "
              )
              .concat(
                this._target,
                "\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: "
              )
              .concat(value)
          );
        }
      };
      NumericParamValidator.prototype.priority = function () {
        return 0;
      };
      return NumericParamValidator;
    })();
    Tes.NumericParamValidator = NumericParamValidator;
    var ListValidator = /** @class */ (function () {
      function ListValidator(_target) {
        this._target = _target;
      }
      ListValidator.prototype.validate = function (context, paramName, value) {
        if (value === undefined) {
          return;
        }
        if (this._target.indexOf(value) === -1) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u5024\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u5FC5\u8981\u5024: "
              )
              .concat(
                JSON.stringify(this._target),
                "\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: "
              )
              .concat(value)
          );
        }
      };
      ListValidator.prototype.priority = function () {
        return 5;
      };
      return ListValidator;
    })();
    Tes.ListValidator = ListValidator;
    var RegExpValidator = /** @class */ (function () {
      function RegExpValidator(_target) {
        this._target = _target;
      }
      RegExpValidator.prototype.validate = function (
        context,
        paramName,
        value
      ) {
        if (value === undefined) {
          return;
        }
        if (!this._target.exec(value)) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u5024\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: "
              )
              .concat(value)
          );
        }
      };
      RegExpValidator.prototype.priority = function () {
        return 5;
      };
      return RegExpValidator;
    })();
    Tes.RegExpValidator = RegExpValidator;
    var VarValidator = /** @class */ (function () {
      function VarValidator(_target) {
        this._target = _target;
      }
      VarValidator.prototype.validate = function (context, paramName, value) {
        if (value === undefined) {
          return;
        }
        var ret = this._target.exec(value);
        if (!ret) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u5024\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: "
              )
              .concat(value)
          );
        }
        var vId = parseInt(ret[2]);
        if (vId < 1) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u5024\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u6700\u4F4E\u5024: "
              )
              .concat(1, "\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: ")
              .concat(vId)
          );
        }
      };
      VarValidator.prototype.priority = function () {
        return 5;
      };
      return VarValidator;
    })();
    Tes.VarValidator = VarValidator;
    var VarValidator2 = /** @class */ (function () {
      function VarValidator2(_type) {
        this._type = _type;
      }
      VarValidator2.prototype.validate = function (context, paramName, value) {
        if (value === undefined) {
          return;
        }
        if (this._type && context.headerStr(this._type) !== "var") {
          return;
        }
        var num = parseInt(value);
        if (isNaN(num)) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u578B\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u5FC5\u8981\u306A\u3082\u306E: number\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: "
              )
              .concat(value)
          );
          return;
        }
        var lowerLimit = 1;
        if (lowerLimit > num) {
          context.error(
            "param: "
              .concat(
                paramName,
                " \u306E\u5024\u304C\u305F\u3060\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u6700\u4F4E\u5024: "
              )
              .concat(
                lowerLimit,
                "\u3002\u8A2D\u5B9A\u3055\u308C\u305F\u3082\u306E: "
              )
              .concat(value)
          );
        }
      };
      VarValidator2.prototype.priority = function () {
        return 5;
      };
      return VarValidator2;
    })();
    Tes.VarValidator2 = VarValidator2;
    Tes.isNumeric = function (lowerLimit, upperLimit, type) {
      return new NumericValidator(lowerLimit, upperLimit, type);
    };
    Tes.isNumericParam = function (paramName) {
      return new NumericParamValidator(paramName);
    };
    Tes.notEmpty = function () {
      return new NotEmptyValidator();
    };
    Tes.list = function () {
      var arg = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        arg[_i] = arguments[_i];
      }
      return new ListValidator(arg);
    };
    Tes.isBool = function () {
      return new ListValidator(["true", "false"]);
    };
    Tes.regCheck = function (reg) {
      return new RegExpValidator(reg);
    };
    Tes.varCheck = function (reg) {
      return new VarValidator(reg);
    };
    Tes.varCheck2 = function (str) {
      return new VarValidator2(str);
    };
    Tes.validates[""] = {};
    Tes.validates["n1"] = {
      index: Tes.isNumeric(0),
      back: Tes.list("0", "1", "2"),
      pos: Tes.list("0", "1", "2"),
    };
    for (var i = 2; i <= 99; i++) {
      Tes.validates["n" + i] = Tes.validates["n1"];
    }
    Tes.validates["m1"] = {
      index: Tes.isNumeric(0),
    };
    for (var i = 2; i <= 99; i++) {
      Tes.validates["m" + i] = Tes.validates["m1"];
    }
    Tes.validates["mob1"] = {
      name: Tes.notEmpty(),
    };
    for (var i = 2; i <= 99; i++) {
      Tes.validates["mob" + i] = Tes.validates["mob1"];
    }
    Tes.validates["messages"] = {};
    Tes.validates["normal_messages"] = {};
    Tes.validates["not_close"] = {
      flag: Tes.list("on", "off"),
    };
    Tes.validates["return"] = {};
    Tes.validates["hide_window"] = {};
    Tes.validates["event_break"] = {};
    Tes.validates["start"] = {};
    Tes.validates["hide"] = {};
    Tes.validates["else"] = {};
    Tes.validates["loop"] = {};
    Tes.validates["loop_end"] = {};
    Tes.validates["loop_break"] = {};
    Tes.validates["return"] = {};
    Tes.validates["hide_left"] = {};
    Tes.validates["hide_right"] = {};
    Tes.validates["hide_center"] = {};
    Tes.validates["color"] = {};
    Tes.validates["default_pos"] = {
      actor: [Tes.notEmpty(), Tes.isNumeric(1)],
      position: Tes.list("right", "left", "center"),
    };
    Tes.validates["turn_left"] = {
      event: [Tes.isNumeric(-1)],
      skip: Tes.isBool(),
      wait: Tes.isBool(),
    };
    Tes.validates["turn_up"] =
      Tes.validates["turn_down"] =
      Tes.validates["turn_right"] =
        Tes.validates["turn_left"];
    Tes.validates["move_up"] =
      Tes.validates["move_down"] =
      Tes.validates["move_right"] =
      Tes.validates["move_left"] =
        Tes.validates["turn_left"];
    Tes.validates["step_anime_on"] = Tes.validates["step_anime_off"] =
      Tes.validates["turn_left"];
    Tes.validates["end"] = {};
    Tes.validates["end_else"] = {};
    Tes.validates["vehicle"] = {};
    Tes.validates["choice_end"] = {};
    Tes.validates["choice_cancel"] = {};
    Tes.validates["input_num"] = {
      var: [Tes.isNumeric(1), Tes.notEmpty()],
      num: Tes.isNumeric(1, 9),
    };
    Tes.validates["choice_item"] = {
      var: [Tes.isNumeric(1), Tes.notEmpty()],
      type: Tes.isNumeric(1),
    };
    Tes.validates["scroll_h"] = {
      speed: [Tes.isNumeric(1, 8), Tes.notEmpty()],
      noSkip: Tes.isBool(),
    };
    Tes.validates["menu_open"] = {};
    Tes.validates["save_open"] = {};
    Tes.validates["gameover"] = {};
    Tes.validates["title_return"] = {};
    Tes.validates["fadein"] = {};
    Tes.validates["fadeout"] = {};
    Tes.validates["eroUp"] = {};
    Tes.validates["stop_se"] = {};
    Tes.validates["message_h"] = {
      index: Tes.isNumeric(0, 7),
      back: Tes.isNumeric(0, 2),
      pos: Tes.isNumeric(0, 29),
    };
    Tes.validates["message"] = {
      value: Tes.notEmpty(),
    };
    Tes.validates["choice_h"] = {
      cancel: Tes.isNumeric(-2, 7),
    };
    Tes.validates["choice_if"] = {
      index: [Tes.notEmpty(), Tes.isNumeric(1, 6)],
    };
    Tes.validates["input_num"] = {
      var: [Tes.notEmpty(), Tes.isNumeric(1)],
      num: [Tes.notEmpty(), Tes.isNumeric(1, 8)],
    };
    Tes.validates["choice_item"] = {
      var: [Tes.notEmpty(), Tes.isNumeric(1)],
    };
    Tes.validates["map_move"] = {
      type: Tes.list("const", "var"),
      map: [Tes.notEmpty(), Tes.isNumeric(1)],
      x: [Tes.notEmpty(), Tes.isNumeric(0), Tes.varCheck2("type")],
      y: [Tes.notEmpty(), Tes.isNumeric(0), Tes.varCheck2("type")],
      direction: Tes.list(
        "0",
        "2",
        "4",
        "6",
        "8",
        "left",
        "right",
        "up",
        "down"
      ),
      fade: Tes.list("0", "1", "2", "black", "white", "none"),
    };
    Tes.validates["vehicle_pos"] = {
      vehicle: [Tes.notEmpty(), Tes.isNumeric(0, 2)],
      type: Tes.list("const", "var"),
      map: [Tes.notEmpty(), Tes.isNumeric(1)],
      x: [Tes.notEmpty(), Tes.isNumeric(0), Tes.varCheck2("type")],
      y: [Tes.notEmpty(), Tes.isNumeric(0), Tes.varCheck2("type")],
    };
    Tes.validates["event_pos"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(-1)],
      type: Tes.list("const", "var", "target"),
      x: [Tes.notEmpty(), Tes.isNumeric(0), Tes.varCheck2("type")],
      y: [Tes.notEmpty(), Tes.isNumeric(0), Tes.varCheck2("type")],
      direction: Tes.list(
        "0",
        "2",
        "4",
        "6",
        "8",
        "left",
        "right",
        "up",
        "down"
      ),
    };
    Tes.validates["scroll_map"] = {
      direction: [
        Tes.notEmpty(),
        Tes.list("2", "4", "6", "8", "left", "right", "up", "down"),
      ],
      num: [Tes.notEmpty(), Tes.isNumeric(0, 100)],
      speed: [Tes.isNumeric(1, 6)],
    };
    Tes.validates["scroll_h"] = {
      speed: [Tes.notEmpty(), Tes.isNumeric(1, 8)],
      noskip: Tes.isBool(),
    };
    Tes.validates["scroll"] = {
      value: Tes.notEmpty(),
    };
    Tes.validates["if_sw"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
      flag: Tes.list("on", "off"),
    };
    Tes.validates["if_var"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
      value: [Tes.notEmpty(), Tes.regCheck(/^[-+]{0,1}(var\.){0,1}\d+$/)],
      op: Tes.list("=", ">=", "<=", ">", "<", "><"),
    };
    Tes.validates["if_self_sw"] = {
      id: [Tes.notEmpty(), Tes.list("A", "B", "C", "D")],
      flag: Tes.list("on", "off"),
    };
    Tes.validates["if_timer"] = {
      time: [Tes.notEmpty(), Tes.isNumeric(0, 5999)],
      op: Tes.list(">=", "<="),
    };
    Tes.validates["if_actor"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
      type: Tes.list(
        "party",
        "name",
        "class",
        "skill",
        "weapon",
        "armor",
        "state"
      ),
    };
    Tes.validates["if_enemy"] = {
      enemy: [Tes.notEmpty(), Tes.isNumeric(1)],
      type: Tes.list("visible", "state"),
      value: Tes.isNumeric(1),
    };
    Tes.validates["if_character"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(-1)],
      direction: [
        Tes.notEmpty(),
        Tes.list("2", "4", "6", "8", "left", "right", "up", "down"),
      ],
    };
    Tes.validates["if_vehicle"] = {
      vehicle: [Tes.notEmpty(), Tes.isNumeric(0, 2)],
    };
    Tes.validates["if_money"] = {
      money: [Tes.notEmpty(), Tes.isNumeric(0)],
      op: Tes.list(">=", "<=", "<"),
    };
    Tes.validates["if_item"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
    };
    Tes.validates["if_weapon"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
      equip: Tes.isBool(),
    };
    Tes.validates["if_armor"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
      equip: Tes.isBool(),
    };
    Tes.validates["if_button"] = {
      button: [
        Tes.notEmpty(),
        Tes.list(
          "2",
          "4",
          "6",
          "8",
          "11",
          "12",
          "13",
          "14",
          "15",
          "16",
          "17",
          "18",
          "down",
          "left",
          "right",
          "up",
          "A",
          "B",
          "C",
          "X",
          "Y",
          "Z",
          "L",
          "R"
        ),
      ],
    };
    Tes.validates["if_script"] = {
      script: Tes.notEmpty(),
    };
    Tes.validates["common"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
    };
    Tes.validates["label"] = {
      value: Tes.notEmpty(),
    };
    Tes.validates["label_jump"] = {
      value: Tes.notEmpty(),
    };
    Tes.validates["money"] = {
      value: Tes.notEmpty(),
    };
    Tes.validates["item"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
      value: Tes.notEmpty(),
    };
    Tes.validates["weapon"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
      value: Tes.notEmpty(),
      equip: Tes.isBool(),
    };
    Tes.validates["armor"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
      value: Tes.notEmpty(),
      equip: Tes.isBool(),
    };
    Tes.validates["common"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
    };
    Tes.validates["sw"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
      end: Tes.isNumericParam("id"),
      flag: [Tes.notEmpty(), Tes.list("on", "off")],
    };
    Tes.validates["var"] = {
      id: [Tes.notEmpty(), Tes.isNumeric(1)],
      end: Tes.isNumericParam("id"),
      op: [Tes.notEmpty(), Tes.list("=", "+", "-", "*", "/", "%")],
      value: [Tes.notEmpty(), Tes.regCheck(/^[-+]{0,1}(var\.){0,1}\d+$/)],
    };
    Tes.validates["self_sw"] = {
      id: [Tes.notEmpty(), Tes.list("A", "B", "C", "D")],
      flag: [Tes.notEmpty(), Tes.list("on", "off")],
    };
    Tes.validates["timer"] = {
      flag: [Tes.notEmpty(), Tes.list("on", "off")],
      time: Tes.isNumeric(1, 5999),
    };
    Tes.validates["save_disable"] = {
      flag: Tes.isBool(),
    };
    Tes.validates["menu_disable"] = {
      flag: Tes.isBool(),
    };
    Tes.validates["encount_disable"] = {
      flag: Tes.isBool(),
    };
    Tes.validates["formation_disable"] = {
      flag: Tes.isBool(),
    };
    Tes.validates["transparent"] = {
      flag: Tes.isBool(),
    };
    Tes.validates["followers"] = {
      flag: Tes.isBool(),
    };
    Tes.validates["gather"] = {};
    Tes.validates["erace"] = {};
    Tes.validates["save_bgm"] = {};
    Tes.validates["resume_bgm"] = {};
    Tes.validates["anime"] = {
      target: [Tes.notEmpty(), Tes.isNumeric(-1)],
      anime: [Tes.notEmpty(), Tes.isNumeric(1)],
      wait: Tes.isBool(),
    };
    Tes.validates["route_h"] = {
      event: [Tes.notEmpty(), Tes.isNumeric(-1)],
      repeat: Tes.isBool(),
      skip: Tes.isBool(),
      wait: Tes.isBool(),
    };
    Tes.validates["route"] = {};
    Tes.validates["balloon"] = {
      target: [Tes.notEmpty(), Tes.isNumeric(-1)],
      balloon: [Tes.notEmpty(), Tes.isNumeric(1)],
      wait: [Tes.isBool()],
    };
    Tes.validates["tone"] = {
      red: Tes.isNumeric(-255, 255),
      green: Tes.isNumeric(-255, 255),
      blue: Tes.isNumeric(-255, 255),
      gray: Tes.isNumeric(0, 255),
      time: Tes.isNumeric(1, 600),
      wait: Tes.isBool(),
    };
    Tes.validates["flash"] = {
      red: Tes.isNumeric(0, 255),
      green: Tes.isNumeric(0, 255),
      blue: Tes.isNumeric(0, 255),
      strength: Tes.isNumeric(0, 255),
      time: Tes.isNumeric(1, 600),
      wait: Tes.isBool(),
    };
    Tes.validates["shake"] = {
      strength: Tes.isNumeric(1, 9),
      speed: Tes.isNumeric(1, 9),
      time: Tes.isNumeric(1, 600),
      wait: Tes.isBool(),
    };
    Tes.validates["wait"] = {
      time: Tes.isNumeric(1, 999),
    };
    Tes.validates["picture"] = {
      layer: [Tes.notEmpty(), Tes.isNumeric(1, 100)],
      file: Tes.notEmpty(),
      origin: Tes.list("ul", "center"),
      type: Tes.list("const", "var"),
      x: [Tes.isNumeric(-9999, 9999, "type"), Tes.varCheck2("type")],
      y: [Tes.isNumeric(-9999, 9999, "type"), Tes.varCheck2("type")],
      zoom_x: Tes.isNumeric(0, 2000),
      zoom_y: Tes.isNumeric(0, 2000),
      transparent: Tes.isNumeric(0, 255),
      blend: Tes.isNumeric(0, 2),
    };
    Tes.validates["picture_move"] = {
      layer: [Tes.notEmpty(), Tes.isNumeric(1, 100)],
      origin: [Tes.list("ul", "center")],
      type: [Tes.list("const", "var")],
      x: [Tes.notEmpty(), Tes.isNumeric(-9999, 9999)],
      y: [Tes.notEmpty(), Tes.isNumeric(-9999, 9999)],
      zoom_x: Tes.isNumeric(0, 2000),
      zoom_y: Tes.isNumeric(0, 2000),
      transparent: Tes.isNumeric(0, 255),
      blend: Tes.isNumeric(0, 2),
      time: Tes.isNumeric(1, 600),
      wait: Tes.isBool(),
    };
    Tes.validates["picture_rotation"] = {
      layer: [Tes.notEmpty(), Tes.isNumeric(1, 100)],
      speed: Tes.isNumeric(-90, 90),
    };
    Tes.validates["picture_tone"] = {
      layer: [Tes.notEmpty(), Tes.isNumeric(1, 100)],
      red: Tes.isNumeric(-255, 255),
      green: Tes.isNumeric(-255, 255),
      blue: Tes.isNumeric(-255, 255),
      gray: Tes.isNumeric(0, 255),
      time: Tes.isNumeric(1, 600),
      wait: Tes.isBool(),
    };
    Tes.validates["picture_erace"] = {
      layer: [Tes.notEmpty(), Tes.isNumeric(1, 100)],
    };
    Tes.validates["weather"] = {
      weather: Tes.list("none", "rain", "storm", "snow"),
      strength: Tes.isNumeric(1, 9),
      time: Tes.isNumeric(0, 600),
      wait: Tes.isBool(),
    };
    Tes.validates["bgm"] = {
      volume: Tes.isNumeric(0, 100),
      pitch: Tes.isNumeric(50, 150),
      pan: Tes.isNumeric(-100, 100),
    };
    Tes.validates["fadeout_bgm"] = {
      time: Tes.isNumeric(1, 60),
    };
    Tes.validates["bgs"] = {
      volume: Tes.isNumeric(0, 100),
      pitch: Tes.isNumeric(50, 150),
      pan: Tes.isNumeric(-100, 100),
    };
    Tes.validates["fadeout_bgs"] = {
      time: Tes.isNumeric(1, 60),
    };
    Tes.validates["me"] = {
      volume: Tes.isNumeric(0, 100),
      pitch: Tes.isNumeric(50, 150),
      pan: Tes.isNumeric(-100, 100),
    };
    Tes.validates["se"] = {
      volume: Tes.isNumeric(0, 100),
      pitch: Tes.isNumeric(50, 150),
      pan: Tes.isNumeric(-100, 100),
    };
    Tes.validates["movie"] = {
      file: Tes.notEmpty(),
    };
    Tes.validates["all_recovery"] = {
      actor: [
        Tes.notEmpty(),
        Tes.regCheck(/^[+]{0,1}(var\.){0,1}\d+$/),
        Tes.varCheck(/^[+]{0,1}(var\.){0,1}(\d+)$/),
      ],
    };
    Tes.validates["exp"] = {
      actor: [
        Tes.notEmpty(),
        Tes.regCheck(/^[+]{0,1}(var\.){0,1}\d+$/),
        Tes.varCheck(/^[+]{0,1}(var\.){0,1}(\d+)$/),
      ],
      value: [
        Tes.notEmpty(),
        Tes.regCheck(/^[-+]{0,1}(var\.){0,1}\d+$/),
        Tes.varCheck(/^[-+]{0,1}(var\.){0,1}(\d+)$/),
      ],
      message: Tes.isBool(),
    };
    Tes.validates["level"] = {
      actor: [
        Tes.notEmpty(),
        Tes.regCheck(/^[+]{0,1}(var\.){0,1}\d+$/),
        Tes.varCheck(/^[+]{0,1}(var\.){0,1}(\d+)$/),
      ],
      value: [
        Tes.notEmpty(),
        Tes.regCheck(/^[-+]{0,1}(var\.){0,1}\d+$/),
        Tes.varCheck(/^[-+]{0,1}(var\.){0,1}(\d+)$/),
      ],
      message: Tes.isBool(),
    };
    Tes.validates["capability"] = {
      actor: [
        Tes.notEmpty(),
        Tes.regCheck(/^[+]{0,1}(var\.){0,1}\d+$/),
        Tes.varCheck(/^[+]{0,1}(var\.){0,1}(\d+)$/),
      ],
      capability: [
        Tes.notEmpty(),
        Tes.list(
          "0",
          "1",
          "2",
          "3",
          "4",
          "5",
          "6",
          "7",
          "maxhp",
          "maxmp",
          "atk",
          "def",
          "matk",
          "mdef",
          "agi",
          "luk"
        ),
      ],
      value: [
        Tes.notEmpty(),
        Tes.regCheck(/^[-+]{0,1}(var\.){0,1}\d+$/),
        Tes.varCheck(/^[-+]{0,1}(var\.){0,1}(\d+)$/),
      ],
    };
    Tes.validates["skill"] = {
      actor: [
        Tes.notEmpty(),
        Tes.regCheck(/^[+]{0,1}(var\.){0,1}\d+$/),
        Tes.varCheck(/^[+]{0,1}(var\.){0,1}(\d+)$/),
      ],
      value: [
        Tes.notEmpty(),
        Tes.isNumeric(0),
        //:zeroCheck => []
      ],
    };
    Tes.validates["equip"] = {
      actor: [Tes.notEmpty(), Tes.isNumeric(1)],
      part: [Tes.notEmpty(), Tes.isNumeric(0, 4)],
      id: [Tes.notEmpty(), Tes.isNumeric(0)],
    };
    Tes.validates["name"] = {
      actor: [Tes.notEmpty(), Tes.isNumeric(1)],
      value: Tes.notEmpty(),
    };
    Tes.validates["class"] = {
      actor: [Tes.notEmpty(), Tes.isNumeric(1)],
      value: [Tes.notEmpty(), Tes.isNumeric(1)],
    };
    Tes.validates["nickname"] = {
      actor: [Tes.notEmpty(), Tes.isNumeric(1)],
      value: Tes.notEmpty(),
    };
    Tes.validates["plugin"] = {
      name: Tes.notEmpty(),
      command: Tes.notEmpty(),
      args: Tes.notEmpty(),
    };
  })((Tes = Nore.Tes || (Nore.Tes = {})));
})(Nore || (Nore = {}));


code:
var Nore;
(function (Nore) {
  function showTextInput(currentText) {
    var textInput = document.getElementById("textInput");
    textInput.style.display = "block";
    textInput.focus();
    textInput.value = currentText;
    textInput.placeholder = TextManager.placeholder;
    $gameTemp.inInput = true;
  }
  Nore.showTextInput = showTextInput;
  function hideTextInput() {
    var textInput = document.getElementById("textInput");
    textInput.style.display = "none";
    textInput.blur();
    /*
        const textInputHankaku = document.getElementById('textInputHankaku');
        textInputHankaku.style.display = 'block';
        textInputHankaku.focus();
        textInputHankaku.blur();
        textInputHankaku.style.display = 'none';
        */
    $gameTemp.inInput = false;
    return textInput.value;
  }
  Nore.hideTextInput = hideTextInput;
  var _Input_shouldPreventDefault = Input._shouldPreventDefault;
  Input._shouldPreventDefault = function (keyCode) {
    if ($gameTemp && !$gameTemp.inInput) {
      return _Input_shouldPreventDefault.call(this);
    }
    switch (keyCode) {
      case 8: // backspace
      case 37: // left arrow
      case 39: // right arrow
        return false;
    }
    return _Input_shouldPreventDefault.call(this);
  };
  var _Input_onKeyDown = Input._onKeyDown;
  Input._onKeyDown = function (event) {
    _Input_onKeyDown.call(this, event);
    if ($gameTemp && !$gameTemp.inInput) {
      return;
    }
    if (event.keyCode == 13) {
      this._currentState["enter"] = true;
    }
    if (event.keyCode == 27) {
      this._currentState["escapeText"] = true;
    }
  };
  var _Input_onKeyUp = Input._onKeyUp;
  Input._onKeyUp = function (event) {
    _Input_onKeyUp.call(this, event);
    if ($gameTemp && !$gameTemp.inInput) {
      return;
    }
    if (event.keyCode == 13) {
      this._currentState["enter"] = false;
    }
    if (event.keyCode == 27) {
      this._currentState["escapeText"] = false;
    }
  };
})(Nore || (Nore = {}));

repo_name: onms/dead

license: unknown


code:
var __extends =
  (this && this.__extends) ||
  (function () {
    var extendStatics = function (d, b) {
      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];
        };
      return extendStatics(d, b);
    };
    return 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 __());
    };
  })();
/*:ja
 * @target MZ
 * @author ル
 *
 * @command reserveCommonEvent
 * @text コモンイベント実行
 * @des コモンイベント実行
 * @arg commonEventId
 * @type number
 * @text commonEventId
 * @desc commonEventId
 * @arg time
 * @type number
 * @text time
 * @desc time
 * @arg actorId
 * @type number
 * @text actorId
 * @desc actorId
 * @arg text
 * @type string
 * @text text
 * @desc text
 * @arg itemId
 * @type number
 * @text itemId
 * @desc itemId
 *
 * @command removeCommonEvent
 * @text コモンイベント削除
 * @des コモンイベント削除
 * @arg commonEventId
 * @type number
 * @text commonEventId
 * @desc commonEventId
 *
 * @command reserveScenario
 * @text シナリオ実行
 * @des シナリオ実行
 * @arg scenarioId
 * @type string
 * @text scenarioId
 * @desc scenarioId
 * @arg time
 * @type number
 * @text time
 * @desc time
 * @arg actorId
 * @type number
 * @text actorId
 * @desc actorId
 * @arg text
 * @type string
 * @text text
 * @desc text
 * @arg itemId
 * @type number
 * @text itemId
 * @desc itemId
 *
 * @command hpRecover
 * @text HP回復イベント
 * @des HP回復イベント
 * @arg actorId
 * @type number
 * @text actorId
 * @desc actorId
 * @arg scenarioId
 * @type string
 * @text scenarioId
 * @desc scenarioId
 *
 * @command battle
 * @text バトルイベント
 * @des バトルイベント
 * @arg actorId
 * @type number
 * @text actorId
 * @desc actorId
 *
 * @command ninshin
 * @text 妊娠
 * @des 妊娠
 * @arg actorId
 * @type number
 * @text actorId
 * @desc actorId
 * @arg scenarioId
 * @type string
 * @text scenarioId
 * @desc scenarioId
 *
 * @command bote
 * @text ボテ腹
 * @des ボテ腹
 * @arg actorId
 * @type number
 * @text actorId
 * @desc actorId
 * @arg scenarioId
 * @type string
 * @text scenarioId
 * @desc scenarioId
 *
 * @command douseiSyusan
 * @text 同棲出産
 * @des 同棲出産
 * @arg actorId
 * @type number
 * @text actorId
 * @desc actorId
 *
 * @command removeCommonTImeGaugeEvent
 * @text コモンタイムゲージイベントを削除
 * @des コモンタイムゲージイベントを削除
 * @arg commonId
 * @type number
 * @text commonId
 * @desc commonId
 */
var Nore;
(function (Nore) {
  var pluginName = "Nore_TimeEvent";
  PluginManager.registerCommand(
    pluginName,
    "reserveCommonEvent",
    function (args) {
      var commonEventId = parseInt(args.commonEventId);
      var time = parseInt(args.time);
      var actorId = parseInt(args.actorId);
      var itemId = parseInt(args.itemId);
      var text = args.text;
      var e = new CommonEventTimeGaugeEvent(
        commonEventId,
        time,
        actorId,
        text,
        itemId
      );
      $slg.addTimeGaugeEvent(e);
    }
  );
  PluginManager.registerCommand(
    pluginName,
    "removeCommonEvent",
    function (args) {
      var commonEventId = parseInt(args.commonEventId);
      $slg.removeCommonTimeGaugeEvent(commonEventId);
    }
  );
  PluginManager.registerCommand(pluginName, "reserveScenario", function (args) {
    var scenarioId = args.scenarioId;
    var time = parseInt(args.time);
    var actorId = parseInt(args.actorId);
    var itemId = parseInt(args.itemId);
    var text = args.text;
    var e = new ScenarioTimeGaugeEvent(scenarioId, time, actorId, text, itemId);
    $slg.addTimeGaugeEvent(e);
  });
  PluginManager.registerCommand(pluginName, "hpRecover", function (args) {
    var actorId = parseInt(args.actorId);
    var scenarioId = args.scenarioId;
    //let time = 6000;
    //$gameActors.actor(actorId).setHp(1);
    var e = new HpTimeGaugeEvent(-1, actorId, scenarioId);
    $slg.addTimeGaugeEvent(e);
  });
  PluginManager.registerCommand(pluginName, "bote", function (args) {
    var actorId = parseInt(args.actorId);
    var scenarioId = args.scenarioId;
    var time = 700;
    if ($slg.facilityInfo().hasFacility(57)) {
      time = Math.floor(time / 3);
    }
    var e = new BoteTimeGaugeEvent(actorId, time, scenarioId);
    $slg.addTimeGaugeEvent(e);
  });
  PluginManager.registerCommand(pluginName, "douseiSyusan", function (args) {
    var actorId = parseInt(args.actorId);
    var time = 1200;
    var e = new DouseiSyusanTimeGaugeEvent(time, actorId);
    $slg.addTimeGaugeEvent(e);
  });
  PluginManager.registerCommand(
    pluginName,
    "removeCommonTImeGaugeEvent",
    function (args) {
      var commonId = parseInt(args.commonId);
      $slg.removeCommonTimeGaugeEvent(commonId);
    }
  );
})(Nore || (Nore = {}));
var NO_ALARM_SOUND_SW = 49;
var TimeGaugeEventType;
(function (TimeGaugeEventType) {
  TimeGaugeEventType["av"] = "av";
  TimeGaugeEventType["sale"] = "sale";
  TimeGaugeEventType["commonEvent"] = "commonEvent";
  TimeGaugeEventType["facility"] = "facility";
  TimeGaugeEventType["scenario"] = "scenario";
  TimeGaugeEventType["battle"] = "battle";
  TimeGaugeEventType["ninshin"] = "ninshin";
  TimeGaugeEventType["dousei"] = "dousei";
  TimeGaugeEventType["douseiSyusan"] = "douseiSyusan";
  TimeGaugeEventType["bote"] = "bote";
  TimeGaugeEventType["soupKichen"] = "soupKichen";
  TimeGaugeEventType["training"] = "training";
})(TimeGaugeEventType || (TimeGaugeEventType = {}));
var TimeGaugeEvent = /** @class */ (function () {
  function TimeGaugeEvent(type, time) {
    this._fadeoutFrame = 0;
    this._waitFireEvent = 0;
    this._type = type;
    this._time = time;
    this._remain = time;
    this._id = $slg.nextTimeEventId();
  }
  TimeGaugeEvent.prototype.maxFadeFrame = function () {
    return 60;
    //return 20;
  };
  TimeGaugeEvent.prototype.fadeout = function () {
    this._fadeoutFrame = this.maxFadeFrame();
  };
  TimeGaugeEvent.prototype.id = function () {
    return this._id;
  };
  TimeGaugeEvent.prototype.timePer = function () {
    return Math.round(this.timeRate() * 100);
  };
  TimeGaugeEvent.prototype.timeRate = function () {
    return this._remain / this._time;
  };
  TimeGaugeEvent.prototype.fadeoutFrame = function () {
    return this._fadeoutFrame;
  };
  TimeGaugeEvent.prototype.updateFade = function () {
    if (this._fadeoutFrame > 0) {
      this.updateFadeout();
      return;
    }
  };
  TimeGaugeEvent.prototype.speedUp = function () {
    this._speedUp = true;
  };
  TimeGaugeEvent.prototype.update = function () {
    if (this._waitClick) {
      return;
    }
    if (this._waitFireEvent > 0) {
      this._waitFireEvent--;
      if (this._waitFireEvent == 0) {
        $gameSwitches.setValue(NO_ALARM_SOUND_SW, true);
        this.fireEvent();
      }
      return;
    }
    if (this._fadeoutFrame > 0) {
      return;
    }
    if (this._remain <= 0) {
      return;
    }
    this._remain--;
    if (this._speedUp) {
      this._remain -= 4;
      this._speedUp = false;
      this._lastSpeedUp = true;
    }
    if (this._remain <= 0) {
      this._remain = 0;
      if (this.isNeedClick()) {
        this._waitClick = true;
        this._remain = 1;
        SoundManager.playMiss();
        return;
      }
      this.fireEvent();
    }
  };
  TimeGaugeEvent.prototype.updateFadeout = function () {
    this._fadeoutFrame--;
    if (this._fadeoutFrame <= 0) {
      $slg.removeTimeGaugeEvent(this._id);
    }
  };
  TimeGaugeEvent.prototype.finish = function () {
    this._finished = true;
    this._dirty = true;
  };
  TimeGaugeEvent.prototype.fireEvent = function () {
    this.finish();
  };
  TimeGaugeEvent.prototype.isDirty = function () {
    return this._dirty;
  };
  TimeGaugeEvent.prototype.clearDirty = function () {
    this._dirty = false;
  };
  TimeGaugeEvent.prototype.isFinished = function () {
    return this._finished;
  };
  TimeGaugeEvent.prototype.iconId = function () {
    return -1;
  };
  TimeGaugeEvent.prototype.extraIconId = function () {
    return -1;
  };
  TimeGaugeEvent.prototype.iconByActor = function (actorId) {
    var actor = $gameActors.actor(actorId);
    return actor.iconIndex();
  };
  TimeGaugeEvent.prototype.getTexts = function () {
    return [""];
  };
  TimeGaugeEvent.prototype.type = function () {
    return this._type;
  };
  TimeGaugeEvent.prototype.actorId = function () {
    return -1;
  };
  TimeGaugeEvent.prototype.sprite = function () {
    return null;
  };
  TimeGaugeEvent.prototype.isVisible = function () {
    if (this._remain <= 0) {
      return false;
    }
    return true;
  };
  TimeGaugeEvent.prototype.clearLastSpeedUp = function () {
    this._lastSpeedUp = false;
  };
  TimeGaugeEvent.prototype.isLastSpeedUp = function () {
    return this._lastSpeedUp;
  };
  TimeGaugeEvent.prototype.isWaitClick = function () {
    return this._waitClick;
  };
  TimeGaugeEvent.prototype.isNeedClick = function () {
    if (ConfigManager.autoTimeEvent) {
      return false;
    }
    return true;
  };
  TimeGaugeEvent.prototype.onClick = function () {
    if (!this.canClick()) {
      return;
    }
    this._waitClick = false;
    this._waitFireEvent = 20;
    //this.fireEvent();
    SoundManager.playEvasion();
  };
  TimeGaugeEvent.prototype.canClick = function () {
    if ($gameMap._interpreter.isRunning()) {
      return false;
    }
    if ($gameTemp.isCommonEventReserved()) {
      return false;
    }
    if ($gameParty.hasCommonEvent()) {
      return false;
    }
    if ($slg.hasWaitFireTimeEvent()) {
      return false;
    }
    return true;
  };
  TimeGaugeEvent.prototype.isWaitFire = function () {
    return this._waitFireEvent > 0;
  };
  return TimeGaugeEvent;
})();
var CommonEventTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(CommonEventTimeGaugeEvent, _super);
  function CommonEventTimeGaugeEvent(
    commonEventId,
    time,
    actorId,
    text,
    itemId
  ) {
    if (itemId === void 0) {
      itemId = -1;
    }
    var _this = _super.call(this, TimeGaugeEventType.commonEvent, time) || this;
    _this._commonEventId = commonEventId;
    _this._actorId = actorId;
    _this._text = text;
    _this._itemId = itemId;
    return _this;
  }
  CommonEventTimeGaugeEvent.prototype.fireEvent = function () {
    $gameParty.addCommonEvent(this._commonEventId, this._id);
    //        $commonEvent.reserveCommonEvent(this._commonEventId, this._id);
  };
  CommonEventTimeGaugeEvent.prototype.getTexts = function () {
    var itemText = this.itemText();
    if (itemText) {
      return [itemText];
    }
    return [this._text];
  };
  CommonEventTimeGaugeEvent.prototype.iconId = function () {
    return this.iconByActor(this._actorId);
  };
  CommonEventTimeGaugeEvent.prototype.actorId = function () {
    return this._actorId;
  };
  CommonEventTimeGaugeEvent.prototype.itemText = function () {
    if (this._itemId > 0) {
      var item = $dataItems[this._itemId];
      switch (ConfigManager.language) {
        case "en":
          if (item.meta["nameEn"]) {
            return item.meta["nameEn"];
          }
          break;
        case "ch":
        case "jp":
          break;
      }
      return item.name;
    } else {
      switch (ConfigManager.language) {
        case "en":
          return "Event";
      }
      return null;
    }
  };
  return CommonEventTimeGaugeEvent;
})(TimeGaugeEvent);
var ScenarioTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(ScenarioTimeGaugeEvent, _super);
  function ScenarioTimeGaugeEvent(scenarioId, time, actorId, text, itemId) {
    var _this = _super.call(this, TimeGaugeEventType.scenario, time) || this;
    _this._scenarioId = scenarioId;
    _this._actorId = actorId;
    _this._text = text;
    _this._itemId = itemId;
    return _this;
  }
  ScenarioTimeGaugeEvent.prototype.fireEvent = function () {
    $gameParty.addScenario(this._scenarioId, this._id);
  };
  ScenarioTimeGaugeEvent.prototype.getTexts = function () {
    if (this._itemId > 0) {
      var item = $dataItems[this._itemId];
      switch (ConfigManager.language) {
        case "en":
          if (item.meta["nameEn"]) {
            return [item.meta["nameEn"]];
          }
          break;
        case "ch":
        case "jp":
          break;
      }
      return [item.name];
    } else {
      switch (ConfigManager.language) {
        case "en":
          return ["Event"];
      }
      return [this._text];
    }
  };
  ScenarioTimeGaugeEvent.prototype.iconId = function () {
    return this.iconByActor(this._actorId);
  };
  return ScenarioTimeGaugeEvent;
})(TimeGaugeEvent);
var HpTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(HpTimeGaugeEvent, _super);
  function HpTimeGaugeEvent(time, actorId, scenarioId) {
    var _this = _super.call(this, TimeGaugeEventType.commonEvent, time) || this;
    _this._actorId = actorId;
    _this._scenarioId = scenarioId;
    return _this;
  }
  HpTimeGaugeEvent.prototype.update = function () {
    if (this._fadeoutFrame > 0) {
      return;
    }
    if (this._remain == 0) {
      return;
    }
    if (this.actor().hp >= this.actor().mhp) {
      this._remain = 0;
      this.fireEvent();
    }
    _super.prototype.update.call(this);
  };
  HpTimeGaugeEvent.prototype.timeRate = function () {
    return 1 - this.actor().hpRate();
  };
  HpTimeGaugeEvent.prototype.fireEvent = function () {
    this.actor().recoverAll();
    $gameSwitches.setValue(62, false);
    if (this._scenarioId) {
      $gameParty.addScenario(this._scenarioId, this._id);
    } else if (this._actorId == 9 && $gameActors.actor(9).countSyusan() == 0) {
      //$gameParty.addScenario('出産しよう_01', this._id);
    } else {
      this.finish();
    }
  };
  HpTimeGaugeEvent.prototype.actor = function () {
    return $gameActors.actor(this._actorId);
  };
  HpTimeGaugeEvent.prototype.getTexts = function () {
    return ["体力回復中"];
  };
  HpTimeGaugeEvent.prototype.iconId = function () {
    return this.iconByActor(this._actorId);
  };
  HpTimeGaugeEvent.prototype.isVisible = function () {
    return false;
  };
  return HpTimeGaugeEvent;
})(TimeGaugeEvent);
var NinshinTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(NinshinTimeGaugeEvent, _super);
  function NinshinTimeGaugeEvent(actorId, time, taneoyaId) {
    var _this = _super.call(this, TimeGaugeEventType.ninshin, time) || this;
    _this._actorId = actorId;
    _this._taneoyaId = taneoyaId;
    return _this;
  }
  NinshinTimeGaugeEvent.prototype.fireEvent = function () {
    $gameParty.addScenario(this.scenarioId(), this._id);
  };
  NinshinTimeGaugeEvent.prototype.getTexts = function () {
    return [this.text().format(this.actorName())];
  };
  NinshinTimeGaugeEvent.prototype.text = function () {
    return TextManager.jusei;
  };
  NinshinTimeGaugeEvent.prototype.actorName = function () {
    return $gameActors.actor(this._actorId).name();
  };
  NinshinTimeGaugeEvent.prototype.iconId = function () {
    return this.iconByActor(this._actorId);
  };
  NinshinTimeGaugeEvent.prototype.actorId = function () {
    return this._actorId;
  };
  NinshinTimeGaugeEvent.prototype.scenarioId = function () {
    switch (this._actorId) {
      case 4:
        return getMarinaNinshinScenarioId(this.actor());
      case 8:
        return getSenriNinshinScenarioId(this.actor());
      case 9:
        return getNonokaNinshinScenarioId(this.actor());
      case 10:
        return getKanamiNinshinScenarioId(this.actor());
      case 11:
        return getMiyuNinshinScenarioId(this.actor());
      case 13:
        return getSakiNinshinScenarioId(this.actor());
      case 17:
        return getKokonaNinshinScenarioId(this.actor());
    }
    return null;
  };
  NinshinTimeGaugeEvent.prototype.actor = function () {
    return $gameActors.actor(this._actorId);
  };
  NinshinTimeGaugeEvent.prototype.isNeedClick = function () {
    return false;
  };
  return NinshinTimeGaugeEvent;
})(TimeGaugeEvent);
var BoteTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(BoteTimeGaugeEvent, _super);
  function BoteTimeGaugeEvent(actorId, time, scenarioId) {
    var _this = _super.call(this, TimeGaugeEventType.bote, time) || this;
    _this._actorId = actorId;
    _this._scenarioId = scenarioId;
    return _this;
  }
  BoteTimeGaugeEvent.prototype.fireEvent = function () {
    var actor = $gameActors.actor(this._actorId);
    actor.lastBaby().setBote();
    actor.setBote(1);
    if (actor.dousei().isSkipBoteEvent()) {
      $slg.fadeoutTimeGaugeEvent(this._id);
      return;
    }
    $gameParty.addScenario(this._scenarioId, this._id);
  };
  BoteTimeGaugeEvent.prototype.getTexts = function () {
    return [TextManager.toNinshin.format(this.actorName())];
  };
  BoteTimeGaugeEvent.prototype.actorName = function () {
    return $gameActors.actor(this._actorId).name();
  };
  BoteTimeGaugeEvent.prototype.iconId = function () {
    return this.iconByActor(this._actorId);
  };
  BoteTimeGaugeEvent.prototype.actorId = function () {
    return this._actorId;
  };
  BoteTimeGaugeEvent.prototype.isNeedClick = function () {
    return false;
  };
  return BoteTimeGaugeEvent;
})(TimeGaugeEvent);
var FacilityTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(FacilityTimeGaugeEvent, _super);
  function FacilityTimeGaugeEvent(time, facilityId, level) {
    var _this = _super.call(this, TimeGaugeEventType.facility, time) || this;
    _this._facilityId = facilityId;
    _this._level = level;
    return _this;
  }
  FacilityTimeGaugeEvent.prototype.fireEvent = function () {
    $slg.facilityInfo().levelUp(this._facilityId, this._id);
  };
  FacilityTimeGaugeEvent.prototype.getTexts = function () {
    return [
      TextManager.underConstruction.format(this.facility().nameWithoutLevel()),
    ];
  };
  FacilityTimeGaugeEvent.prototype.facility = function () {
    return new Facility(this._facilityId, this._level);
  };
  FacilityTimeGaugeEvent.prototype.iconId = function () {
    return this.iconByActor(8);
  };
  FacilityTimeGaugeEvent.prototype.facilityId = function () {
    return this._facilityId;
  };
  FacilityTimeGaugeEvent.prototype.isNeedClick = function () {
    if (ConfigManager.autoTimeEvent) {
      return false;
    }
    var facility = new Facility(this._facilityId, this._level);
    return $slg.facilityInfo().checkFacilityEvent(facility) != null;
  };
  return FacilityTimeGaugeEvent;
})(TimeGaugeEvent);
var DouseiSyusanTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(DouseiSyusanTimeGaugeEvent, _super);
  function DouseiSyusanTimeGaugeEvent(time, actorId) {
    var _this =
      _super.call(this, TimeGaugeEventType.douseiSyusan, time) || this;
    _this._actorId = actorId;
    return _this;
  }
  DouseiSyusanTimeGaugeEvent.prototype.fireEvent = function () {
    $slg.fadeoutTimeGaugeEvent(this._id);
    var commonId = this.commonEventId();
    if (commonId > 0) {
      $gameParty.addCommonEvent(commonId, -1);
    }
  };
  DouseiSyusanTimeGaugeEvent.prototype.commonEventId = function () {
    switch (this._actorId) {
      case 4:
        return 566;
      case 8:
        return 656;
      case 9:
        return 536;
      case 10:
        return 506;
      case 11:
        return 476;
      case 13:
        return 596;
      case 17:
        return 626;
      default:
        console.error("DouseiSyusanTimeGaugeEventのactorId が不正です");
        return -1;
    }
  };
  DouseiSyusanTimeGaugeEvent.prototype.getTexts = function () {
    return [this.actor().name() + " Cohabation & Childbirth"];
  };
  DouseiSyusanTimeGaugeEvent.prototype.actor = function () {
    return $gameActors.actor(this._actorId);
  };
  DouseiSyusanTimeGaugeEvent.prototype.iconId = function () {
    return this.iconByActor(this._actorId);
  };
  DouseiSyusanTimeGaugeEvent.prototype.actorId = function () {
    return this._actorId;
  };
  return DouseiSyusanTimeGaugeEvent;
})(TimeGaugeEvent);
var KaijinTrainingTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(KaijinTrainingTimeGaugeEvent, _super);
  function KaijinTrainingTimeGaugeEvent(trainingId, remain) {
    var _this = _super.call(this, TimeGaugeEventType.training, remain) || this;
    _this._trainingId = trainingId;
    return _this;
  }
  KaijinTrainingTimeGaugeEvent.prototype.getTexts = function () {
    var info = $slg.formation().trainingInfo();
    return [info.actorName() + "LV" + info.level() + TextManager.inTraining2];
  };
  KaijinTrainingTimeGaugeEvent.prototype.iconId = function () {
    var info = $slg.formation().trainingInfo();
    var iconId = this.iconByMonster(info.actor().actorId());
    if (iconId > 0) {
      return iconId;
    }
    return this.iconByActor(10);
  };
  KaijinTrainingTimeGaugeEvent.prototype.iconByMonster = function (actorId) {
    switch (actorId) {
      case 101:
        return 337;
      case 102:
        return 343;
      case 103:
        return 341;
      case 104:
        return 342;
      case 105:
        return 344;
      case 106:
        return 345; //かぐや
      case 107:
        return 348;
      case 108:
        return 349;
      case 109:
        return 336;
      case 110:
        return 339;
      case 111:
        return 333; // 凄腕の暗殺者
      case 112:
        return 326;
      case 113:
        return 353; // ディーナ
      case 114:
        return 328;
      case 115:
        return 329;
      case 116:
        return 330;
      case 117:
        return 331; // ヒュプノス
      case 118:
        return 332;
      case 119:
        return 335;
      case 120:
        return 354; // ターニャ
      case 121:
        return 340; // デビルクイーン
      case 122:
        return 350; // テオ
      case 123:
        return 351;
      case 124:
        return 324; // カレン
      case 125:
        return 334;
      case 126:
        return 321;
      case 127:
        return 347;
      case 128:
        return 346;
      case 129:
        return 323;
      case 130:
        return 352;
      case 131:
        return 320;
      case 132:
        return 322;
      case 133:
        return 325;
    }
    return -1;
  };
  KaijinTrainingTimeGaugeEvent.prototype.fireEvent = function () {
    /*if ($slg.clickerStage().enemyId() > 0) {
            // バトル中はレベルアップなし
            this._remain++;
            return;
        }*/
    var info = $slg.formation().trainingInfo();
    var actor = info.actor();
    info.levelUp();
    $slg.formation().calcPassiveSkill();
    SoundManager.playRecovery();
    //if ($slg.facilityInfo().hasFacility(29)) {
    // 怪人訓練 Lv2
    if (!actor.isMaxLevel()) {
      $slg.removeTimeGaugeEventType(TimeGaugeEventType.training);
      info.setup(actor);
    }
    //}
  };
  KaijinTrainingTimeGaugeEvent.prototype.reduceRemain = function (num) {
    this._remain -= num * 60;
    if (this._remain <= 0) {
      this._remain = 1;
    }
  };
  KaijinTrainingTimeGaugeEvent.prototype.isNeedClick = function () {
    return false;
  };
  return KaijinTrainingTimeGaugeEvent;
})(TimeGaugeEvent);
var AvTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(AvTimeGaugeEvent, _super);
  function AvTimeGaugeEvent(type, time, av) {
    var _this = _super.call(this, type, time) || this;
    _this._totalReward = 0;
    _this._avId = av.id();
    _this._stepList = [0, 25, 50, 75];
    return _this;
  }
  AvTimeGaugeEvent.prototype.update = function () {
    if (this._fadeoutFrame > 0) {
      return;
    }
    if (this._remain <= 0) {
      return;
    }
    var before = this.currentStep();
    var count = 1;
    if (this._speedUp) {
      count = 5;
      if ($slg.facilityInfo().hasFacility(23)) {
        count = 10;
      }
      this._speedUp = false;
      this._lastSpeedUp = true;
    }
    for (var i = 0; i <= count; i++) {
      this._remain--;
      var after = this.currentStep();
      if (before != after) {
        this.gainReward(after == 0);
        before = after;
      }
      if (this._remain <= 0) {
        this.fireEvent();
        break;
      }
    }
  };
  AvTimeGaugeEvent.prototype.fireEvent = function () {
    this.av().finishSale();
    if (this.av().isAuto()) {
      // スキップしたものはセール情報もなし
      this.av().showResult();
      $slg.plusFan(this.av().plusFan());
      this.finish();
      AudioManager.playSe({
        name: "FCPC1_SE14_Select14",
        volume: 90,
        pitch: 120,
        pan: 0,
      });
      return;
    }
    $slg.avInfo().pushResultAv(this._avId, this._id);
  };
  AvTimeGaugeEvent.prototype.gainReward = function (isLast) {
    var r = this.av().reward();
    if (isLast) {
      $gameParty.gainGold(r - this._totalReward);
      this._totalReward = r;
    } else {
      var gainReward = Math.round(r / this._stepList.length);
      $gameParty.gainGold(gainReward);
      this._totalReward += gainReward;
    }
  };
  AvTimeGaugeEvent.prototype.av = function () {
    return $slg.avInfo().findAv(this._avId);
  };
  AvTimeGaugeEvent.prototype.currentStep = function () {
    var per = this.timePer();
    var n = 0;
    for (var _i = 0, _a = this._stepList; _i < _a.length; _i++) {
      var step = _a[_i];
      if (per <= step) {
        return n;
      }
      n++;
    }
    return n;
  };
  AvTimeGaugeEvent.prototype.iconId = function () {
    return 2273;
  };
  AvTimeGaugeEvent.prototype.getTexts = function () {
    return [TextManager.saleAv];
  };
  AvTimeGaugeEvent.prototype.getAvSaleText = function () {
    var av = this.av();
    return av.name();
  };
  AvTimeGaugeEvent.prototype.sprite = function () {
    var av = this.av();
    var jacket = av.avJacket();
    if (!jacket) {
      return null;
    }
    return new Sprite_AvScreenShot(jacket.screenShot(), false);
  };
  return AvTimeGaugeEvent;
})(TimeGaugeEvent);
var DouseiTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(DouseiTimeGaugeEvent, _super);
  function DouseiTimeGaugeEvent(type, time, actorId) {
    var _this = _super.call(this, type, time) || this;
    _this._actorId = actorId;
    _this._stepList = [12, 25, 37, 50, 63, 75, 88];
    var dousei = _this.dousei();
    _this._itemList = dousei.makeItemList();
    _this.play(true);
    return _this;
  }
  DouseiTimeGaugeEvent.prototype.dousei = function () {
    var actor = $gameActors.actor(this._actorId);
    return actor.dousei();
  };
  DouseiTimeGaugeEvent.prototype.update = function () {
    if (this._fadeoutFrame > 0) {
      return;
    }
    if (this._remain <= 0) {
      return;
    }
    var before = this.currentStep();
    this._remain--;
    var after = this.currentStep();
    if (before != after) {
      this.play(false);
    }
    if (this._remain <= 0) {
      this.play(false);
      this.fireEvent();
    }
  };
  DouseiTimeGaugeEvent.prototype.fireEvent = function () {
    $slg.removeTimeGaugeEvent(this._id);
    var type = TimeGaugeEventType.dousei;
    var event = new DouseiTimeGaugeEvent(type, this._time, this._actorId);
    $slg.addTimeGaugeEvent(event);
  };
  DouseiTimeGaugeEvent.prototype.play = function (isInitial) {
    var step = this.currentStep();
    var playId = this._itemList[step];
    this._currentPlay = playId;
    if (!isInitial) {
      this.dousei().upCurrentPlay();
    }
    this.dousei().setCurrentPlay(playId);
  };
  DouseiTimeGaugeEvent.prototype.currentPlay = function () {
    return this._currentPlay;
  };
  DouseiTimeGaugeEvent.prototype.currentStep = function () {
    var per = this.timePer();
    var n = 0;
    for (var _i = 0, _a = this._stepList; _i < _a.length; _i++) {
      var step = _a[_i];
      if (per <= step) {
        return n;
      }
      n++;
    }
    return n;
  };
  DouseiTimeGaugeEvent.prototype.iconId = function () {
    return this.iconByActor(this._actorId);
  };
  DouseiTimeGaugeEvent.prototype.extraIconId = function () {
    var item = this.dousei().currentPlayItem();
    if (item) {
      return item.iconIndex();
    }
    return -1;
  };
  DouseiTimeGaugeEvent.prototype.getTexts = function () {
    var playName = this.playName();
    if (!playName) {
      return [this.manName() + "と同棲中"];
    } else {
      return [this.manName() + "と同棲", playName + "中"];
    }
  };
  DouseiTimeGaugeEvent.prototype.actorName = function () {
    return $gameActors.actor(this._actorId).name();
  };
  DouseiTimeGaugeEvent.prototype.playName = function () {
    if (this.currentPlay() >= 1) {
      return $dataItems[this.currentPlay()].name;
    } else {
      return null;
    }
  };
  DouseiTimeGaugeEvent.prototype.manName = function () {
    var manId = this.dousei().manId();
    return $gameActors.actor(manId).name();
  };
  DouseiTimeGaugeEvent.prototype.actorId = function () {
    return this._actorId;
  };
  return DouseiTimeGaugeEvent;
})(TimeGaugeEvent);
var SoupKichenTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(SoupKichenTimeGaugeEvent, _super);
  function SoupKichenTimeGaugeEvent(time) {
    return _super.call(this, TimeGaugeEventType.soupKichen, time) || this;
  }
  SoupKichenTimeGaugeEvent.prototype.calcTime = function (level) {};
  SoupKichenTimeGaugeEvent.prototype.fireEvent = function () {
    $slg.manInfo().soupKichen().reload();
  };
  SoupKichenTimeGaugeEvent.prototype.getTexts = function () {
    return [TextManager.changeActor];
  };
  SoupKichenTimeGaugeEvent.prototype.iconId = function () {
    return this.iconByActor(8);
  };
  SoupKichenTimeGaugeEvent.prototype.isNeedClick = function () {
    return false;
  };
  return SoupKichenTimeGaugeEvent;
})(TimeGaugeEvent);
var Sprite_TimeGaugeEventSet = /** @class */ (function (_super) {
  __extends(Sprite_TimeGaugeEventSet, _super);
  function Sprite_TimeGaugeEventSet() {
    var _this = _super.call(this) || this;
    _this.refresh();
    return _this;
  }
  Sprite_TimeGaugeEventSet.prototype.update = function () {
    _super.prototype.update.call(this);
    this.updatePosition();
    if (!this._eventList || this._eventList.length == 0) {
      $gameTemp.timeSpeedUp = false;
    }
    if ($slg.isTimeGaugeChanged()) {
      this.refresh();
      $slg.clearTimeGaugeChanged();
    }
  };
  Sprite_TimeGaugeEventSet.prototype.updatePosition = function () {
    var s = SceneManager._scene._spriteset;
    if (s) {
      if (s._clickerWindow) {
        if (s._clickerWindow.visible) {
          this.x = 772 + 8;
          return;
        }
      }
    }
    this.x = 1072 + 8;
  };
  Sprite_TimeGaugeEventSet.prototype.refresh = function () {
    this.removeChildren();
    this._eventList = [];
    var list = $slg.timeGaugeEventList();
    var index = 0;
    for (var i = 0; i < list.length; i++) {
      var e = list[i];
      if (e.isVisible()) {
        this.addEvent(e, index);
        index++;
      }
    }
  };
  Sprite_TimeGaugeEventSet.prototype.addEvent = function (e, index) {
    var sprite = new Sprite_TimeGaugeEvent(e);
    sprite.y = index * this.itemHeight();
    this.addChild(sprite);
    this._eventList.push(sprite);
  };
  Sprite_TimeGaugeEventSet.prototype.itemHeight = function () {
    return 46;
  };
  return Sprite_TimeGaugeEventSet;
})(Sprite);
var Sprite_TimeGaugeEvent = /** @class */ (function (_super) {
  __extends(Sprite_TimeGaugeEvent, _super);
  function Sprite_TimeGaugeEvent(event) {
    var _this = _super.call(this) || this;
    _this._lastFadeFrame = 0;
    _this._event = event;
    _this.bitmap = new Bitmap(_this.timeWidth(), 50);
    _this._gaugeSprite = new PIXI.Sprite();
    _this.addChild(_this._gaugeSprite);
    _this.createFlashSprite();
    _this.createOverFrameSprite();
    _this.refresh();
    return _this;
  }
  Sprite_TimeGaugeEvent.prototype.createFlashSprite = function () {
    var g = new PIXI.Graphics();
    g.beginFill(0x9999ff, 0.8);
    g.drawRect(0, 0, this.timeWidth() - 10, 44);
    g.endFill();
    g.x = 1;
    g.y = 2;
    g.visible = false;
    this._flashSprite = g;
    this.addChild(g);
  };
  Sprite_TimeGaugeEvent.prototype.createOverFrameSprite = function () {
    var g = new PIXI.Graphics();
    var ww = this.timeWidth() - 10;
    var hh = 44;
    g.beginFill(0x9999ff, 0.3);
    g.drawRect(0, 0, ww, hh);
    g.endFill();
    g.lineStyle(1, 0xbbbbff, 0.8);
    g.moveTo(0, 0).lineTo(ww, 0).lineTo(ww, hh).lineTo(0, hh).lineTo(0, 0);
    g.x = 1;
    g.y = 2;
    g.visible = false;
    this._overFrameSprite = g;
    this.addChild(g);
  };
  Sprite_TimeGaugeEvent.prototype.destroy = function (options) {
    if (this._imageSprite) {
      this.removeChild(this._imageSprite);
      this._imageSprite = null;
    }
    _super.prototype.destroy.call(this, options);
  };
  Sprite_TimeGaugeEvent.prototype.timeWidth = function () {
    return 210;
  };
  Sprite_TimeGaugeEvent.prototype.update = function () {
    _super.prototype.update.call(this);
    this.updateTouch();
    if (this.isChange()) {
      this.refreshGauge();
    }
    if (this._lastFadeFrame > 0) {
      this.updateFade();
    }
    if (this._event.isWaitClick()) {
      this.drawBalloon();
    }
    this.updateFlash();
  };
  Sprite_TimeGaugeEvent.prototype.updateTouch = function () {
    if (this._event.isWaitClick()) {
      this.updateOver();
    } else {
      this._overFrameSprite.visible = false;
    }
    if (!TouchInput.isPressed()) {
      $gameTemp.timeSpeedUp = false;
      return;
    }
    var touchPos = new Point(TouchInput.x, TouchInput.y);
    var localPos = this.worldTransform.applyInverse(touchPos);
    var leftMargin = 25;
    var frame2 = new Rectangle(
      this._frame.x - leftMargin,
      this._frame.y + 2,
      this._frame.width + leftMargin,
      this._frame.height - 4
    );
    if (frame2.contains(localPos.x, localPos.y)) {
      if (this._event.isWaitClick()) {
        this._event.onClick();
        return;
      }
      this._event.speedUp();
      $gameTemp.timeSpeedUp = true;
    }
  };
  Sprite_TimeGaugeEvent.prototype.updateOver = function () {
    if (!this._event.canClick()) {
      return;
    }
    var touchPos = new Point(TouchInput.x, TouchInput.y);
    var localPos = this.worldTransform.applyInverse(touchPos);
    var leftMargin = 25;
    var frame2 = new Rectangle(
      this._frame.x - leftMargin,
      this._frame.y + 2,
      this._frame.width + leftMargin,
      this._frame.height - 4
    );
    if (frame2.contains(localPos.x, localPos.y)) {
      this._overFrameSprite.visible = true;
    } else {
      this._overFrameSprite.visible = false;
    }
  };
  Sprite_TimeGaugeEvent.prototype.updateFade = function () {
    if (this._event.maxFadeFrame() - this._lastFadeFrame < 2) {
      return;
    }
    this.opacity -= 5;
  };
  Sprite_TimeGaugeEvent.prototype.updateFlash = function () {
    if (!this._event.isWaitFire()) {
      return;
    }
    this._flashSprite.visible = true;
    this._flashSprite.alpha -= 0.07;
  };
  Sprite_TimeGaugeEvent.prototype.isChange = function () {
    if (this._lastFadeFrame != this._event.fadeoutFrame()) {
      return true;
    }
    if (this._lastWaitClick != this._event.isWaitClick()) {
      return true;
    }
    return this._lastGaugeRate != this._event.timeRate();
  };
  Sprite_TimeGaugeEvent.prototype.refresh = function () {
    this.bitmap.clear();
    this.drawBackground();
    this.drawSprite();
    this.drawText();
    this.drawGauge();
    this.drawCharImage();
    this.drawExtraIcon();
    if (this._event.isWaitClick()) {
      this.drawBalloon();
    }
  };
  Sprite_TimeGaugeEvent.prototype.drawBackground = function () {
    var bitmap = ImageManager.loadSystem("main");
    this.bitmap.blt(bitmap, 0, 100, 211, 46, 0, 0);
  };
  Sprite_TimeGaugeEvent.prototype.drawSprite = function () {
    var sprite = this._event.sprite();
    if (!sprite) {
      return;
    }
    this._imageSprite = sprite;
    this._imageSprite.scale.x = 0.35;
    this._imageSprite.scale.y = 0.35;
    this._imageSprite.x = 4;
    this._imageSprite.y = 11;
    this.addChild(this._imageSprite);
  };
  Sprite_TimeGaugeEvent.prototype.drawCharImage = function () {
    var iconId = this._event.iconId();
    if (iconId <= 0) {
      return;
    }
    this.drawIcon(iconId, 13, 10);
  };
  Sprite_TimeGaugeEvent.prototype.drawIcon = function (iconIndex, x, y) {
    var bitmap = ImageManager.loadSystem("IconSet");
    var pw = ImageManager.iconWidth;
    var ph = ImageManager.iconHeight;
    var sx = (iconIndex % 16) * pw;
    var sy = Math.floor(iconIndex / 16) * ph;
    this.bitmap.blt(bitmap, sx, sy, pw, ph, x, y);
  };
  Sprite_TimeGaugeEvent.prototype.drawExtraIcon = function () {
    var extraIcon = this._event.extraIconId();
    if (extraIcon <= 0) {
      return;
    }
    this.drawIcon(extraIcon, 152, 6);
  };
  Sprite_TimeGaugeEvent.prototype.refreshGauge = function () {
    this._gaugeSprite.removeChildren();
    this.drawGauge();
  };
  Sprite_TimeGaugeEvent.prototype.drawText = function () {
    var texts = this._event.getTexts();
    this.bitmap.fontSize = 15;
    var xx = 59;
    var yy = 2;
    for (var _i = 0, texts_1 = texts; _i < texts_1.length; _i++) {
      var text = texts_1[_i];
      this.bitmap.drawText(text, xx, yy, 134, 26);
      yy += 23;
    }
  };
  Sprite_TimeGaugeEvent.prototype.drawGauge = function () {
    this._lastFadeFrame = this._event.fadeoutFrame();
    this._lastGaugeRate = this._event.timeRate();
    this._lastWaitClick = this._event.isWaitClick();
    if (
      this._lastFadeFrame > 0 ||
      this._event.isWaitClick() ||
      this._event.isWaitFire()
    ) {
      var gaugeSprite = this.getGaugeSprite(1, 1);
      this._gaugeSprite.addChild(gaugeSprite);
    } else {
      var gaugeSprite = void 0;
      if (this._event.isLastSpeedUp()) {
        this._event.clearLastSpeedUp();
        gaugeSprite = this.getGaugeSprite(2, 1 - this._lastGaugeRate);
      } else {
        gaugeSprite = this.getGaugeSprite(0, 1 - this._lastGaugeRate);
      }
      this._gaugeSprite.addChild(gaugeSprite);
    }
  };
  Sprite_TimeGaugeEvent.prototype.getGaugeSprite = function (index, rate) {
    var baseTexture = Nore.getSystemBaseTexture("main");
    var r = new Rectangle(0, 320 + index * 28, Math.floor(128 * rate), 20);
    var texture = new PIXI.Texture(baseTexture, r);
    var s = new PIXI.Sprite(texture);
    s.x = 61;
    s.y = 27;
    return s;
  };
  Sprite_TimeGaugeEvent.prototype.drawBalloon = function () {
    if (this._balloonSprite) {
      return;
    }
    var s = this.getBalloonSprite();
    s.x = -25;
    s.y = -4;
    this.addChild(s);
    this._balloonSprite = s;
  };
  Sprite_TimeGaugeEvent.prototype.getBalloonSprite = function () {
    var baseTexture = Nore.getSystemBaseTexture("main");
    var r = new Rectangle(32 * 10, 32 * 12, 32 * 3, 32);
    var texture = new PIXI.Texture(baseTexture, r);
    var s = new PIXI.Sprite(texture);
    return s;
  };
  return Sprite_TimeGaugeEvent;
})(Sprite);
var Sprite_MiniTimeGaugeEvent = /** @class */ (function (_super) {
  __extends(Sprite_MiniTimeGaugeEvent, _super);
  function Sprite_MiniTimeGaugeEvent(event, h, erase, title) {
    if (h === void 0) {
      h = 5;
    }
    if (erase === void 0) {
      erase = false;
    }
    if (title === void 0) {
      title = null;
    }
    var _this = _super.call(this) || this;
    _this._gaugeHeight = h;
    _this._event = event;
    _this._erase = erase;
    _this._title = title;
    _this.bitmap = new Bitmap(_this.timeWidth(), 30);
    _this.refresh();
    return _this;
  }
  Sprite_MiniTimeGaugeEvent.prototype.timeWidth = function () {
    if (this._title) {
      return 100 + 60;
    }
    return 100;
  };
  Sprite_MiniTimeGaugeEvent.prototype.update = function () {
    _super.prototype.update.call(this);
    if (this.isChange()) {
      this.refreshGauge();
    }
  };
  Sprite_MiniTimeGaugeEvent.prototype.isChange = function () {
    return this._lastGaugeRate != this._event.timeRate();
  };
  Sprite_MiniTimeGaugeEvent.prototype.refreshGauge = function () {
    this.refresh();
  };
  Sprite_MiniTimeGaugeEvent.prototype.refresh = function () {
    this.bitmap.clear();
    this.drawTitle();
    this.drawGauge();
    this.checkErase();
  };
  Sprite_MiniTimeGaugeEvent.prototype.checkErase = function () {
    if (!this._erase) {
      return;
    }
    if (this._event.timeRate() <= 0) {
      if (this.parent) {
        this.parent.removeChild(this);
      }
    }
  };
  Sprite_MiniTimeGaugeEvent.prototype.drawTitle = function () {
    if (!this._title) {
      return;
    }
    this.bitmap.fontSize = 11;
    this.bitmap.drawText(this._title, 10, -9, 84, 30);
  };
  Sprite_MiniTimeGaugeEvent.prototype.drawGauge = function () {
    this._lastGaugeRate = this._event.timeRate();
    var xx = 1;
    if (this._title) {
      xx += 48;
    }
    var yy = 3;
    var ww = 83;
    var hh = this._gaugeHeight;
    this._bitmap.fillRect(xx, yy, ww + 2, hh + 2, "#000000");
    var www = Math.round((1 - this._lastGaugeRate) * ww);
    this._bitmap.gradientFillRect(
      xx + 1,
      yy + 1,
      www,
      hh,
      ColorManager.tpGaugeColor1(),
      ColorManager.tpGaugeColor2()
    );
  };
  return Sprite_MiniTimeGaugeEvent;
})(Sprite);


code:
var Nore;
(function (Nore) {
  Scene_Title.prototype.commandWindowRect = function () {
    var offsetX = $dataSystem.titleCommandWindow.offsetX;
    var offsetY = $dataSystem.titleCommandWindow.offsetY;
    var ww = this.mainCommandWidth() + 20;
    var wh = this.calcWindowHeight(5, true) + 20;
    var wx = (Graphics.boxWidth - ww) / 2 + offsetX;
    var wy = Graphics.boxHeight - wh - 96 + offsetY;
    return new Rectangle(wx, wy, ww, wh);
  };
  var Window_TitleCommand_makeCommandList =
    Window_TitleCommand.prototype.makeCommandList;
  Window_TitleCommand.prototype.makeCommandList = function () {
    Window_TitleCommand_makeCommandList.call(this);
    this.clearCommandList();
    this.addCommand(TextManager._newGame, "newGame");
    this.addCommand(
      TextManager._continue_,
      "continue",
      this.isContinueEnabled()
    );
    this.addCommand(TextManager.recollection, "recollection");
    this.addCommand(TextManager._options, "options");
    this.addCommand(TextManager._gameEnd, "gameEnd");
    this.contents.fontFace = "rate";
  };
  Scene_Title.prototype.adjustBackground = function () {
    this.scaleSprite(this._backSprite1);
    //this.scaleSprite(this._backSprite2);
    this.centerSprite(this._backSprite1);
    //this.centerSprite(this._backSprite2);
    if (!Nore.isTaikenban()) {
      this._backSprite2.visible = false;
    }
  };
  var _Window_TitleCommand_prototype_itemRect =
    Window_TitleCommand.prototype.itemRect;
  Window_TitleCommand.prototype.itemRect = function (index) {
    var rect = _Window_TitleCommand_prototype_itemRect.call(this, index);
    var m = 10;
    rect.x += m;
    rect.y += m;
    rect.width -= m * 2;
    return rect;
  };
})(Nore || (Nore = {}));
Scene_Gameover.prototype.createBackground = function () {
  this._backSprite = new Sprite();
  this.addChild(this._backSprite);
};


code:
var __extends =
  (this && this.__extends) ||
  (function () {
    var extendStatics = function (d, b) {
      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];
        };
      return extendStatics(d, b);
    };
    return 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 __());
    };
  })();
var Nore;
(function (Nore) {
  var Window_Top = /** @class */ (function (_super) {
    __extends(Window_Top, _super);
    function Window_Top(isSlg) {
      var _this = this;
      var r = new Rectangle(0, 0, Graphics.width, 46);
      _this = _super.call(this, r) || this;
      _this._buttonList = [];
      _this._isSlg = isSlg;
      _this.backOpacity = 255;
      _this._margin = 0;
      _this._padding = 0;
      _this.refresh();
      _this.createGaugeSprite();
      _this.frameVisible = false;
      _this._refreshBack();
      _this.createButtons();
      return _this;
    }
    Window_Top.prototype.createButtons = function () {
      this.createOptionButton();
      this.createWarpButton();
      this.createMenuButton();
    };
    Window_Top.prototype.createMenuButton = function () {
      var disable = false;
      if (this._isSlg) {
        disable = true;
      }
      this._menuButton = new Sprite_OverableButton("menu", false, disable);
      this._menuButton.x = this.buttonX() + this.buttonInterval();
      this._menuButton.y = this.buttonY();
      this._menuButton.visible = true;
      this.addChild(this._menuButton);
      this._buttonList.push(this._menuButton);
    };
    Window_Top.prototype.createWarpButton = function () {
      var disable = false;
      if (this._isSlg) {
        disable = true;
      }
      this._warpButton = new Sprite_OverableButton("warp", false, disable);
      this._warpButton.x = this.buttonX();
      this._warpButton.y = this.buttonY();
      this._warpButton.visible = true;
      this.addChild(this._warpButton);
      this._buttonList.push(this._warpButton);
    };
    Window_Top.prototype.createOptionButton = function () {
      this._optionButton = new Sprite_OverableButton("option", this._isSlg);
      this._optionButton.x = this.buttonX() + this.buttonInterval() * 2;
      this._optionButton.y = this.buttonY();
      this._optionButton.visible = true;
      this.addChild(this._optionButton);
      this._buttonList.push(this._optionButton);
      this._optionButton.setClickHandler(this.onOption.bind(this));
    };
    Window_Top.prototype.onOption = function () {
      SoundManager.playOk();
      SceneManager.push(Scene_Options);
    };
    Window_Top.prototype.buttonY = function () {
      return -3;
    };
    Window_Top.prototype.buttonInterval = function () {
      return 55;
    };
    Window_Top.prototype.buttonX = function () {
      return 1042;
    };
    Window_Top.prototype._createBackSprite = function () {
      this._backSprite = new Sprite();
      var backWidth = 432;
      for (var i = 0; i < 3; i++) {
        var baseTexture = Nore.getSystemBaseTexture("main");
        var rect = new Rectangle(0, 0, backWidth, 46);
        var texture = new PIXI.Texture(baseTexture, rect);
        var s = new PIXI.Sprite(texture);
        s.x = i * backWidth;
        this._backSprite.addChild(s);
      }
      this._container.addChild(this._backSprite);
    };
    Window_Top.prototype._refreshBack = function () {};
    Window_Top.prototype.contentsHeight = function () {
      return 50;
    };
    Window_Top.prototype.createGaugeSprite = function () {
      this._gaugeSpriteSet = new Sprite_TimeGaugeEventSet();
      this.addChild(this._gaugeSpriteSet);
      this._gaugeSpriteSet.y = 46;
    };
    Window_Top.prototype.hideTimeGauge = function () {
      this._gaugeSpriteSet.hide();
    };
    Window_Top.prototype.refresh = function () {
      this._windowContentsSprite.removeChildren();
      this.contents.clear();
      this.contents.fontSize = 30;
      this.drawGold(20, 2);
      this.drawFan(168, 2);
      this.drawTicket(310, 2);
      this.drawTutorial(461, 2);
    };
    Window_Top.prototype.drawTicket = function (xx, yy) {
      this.drawIcon(Icon.ticket, xx - 5, yy + 6);
      var labelX = 40;
      this._lastTicket = $gameParty.gachaTicket();
      this.drawNumber(this._lastTicket, xx + labelX, yy + 12, 100, "left", 2);
    };
    Window_Top.prototype.drawGold = function (xx, yy) {
      this.contents.fontSize = 26;
      var ww = 100;
      this.drawIcon(Icon.gold2, xx, yy + 4);
      var labelX = 40;
      if ($gameParty.upGoldValue() > 0) {
        var g = $gameParty.upGoldValue();
        $gameParty.clearUpGoldValue();
        if (!$gameSwitches.value(18)) {
          this.addGainGoldSprite(g);
        }
      }
      this._lastMoney = $gameParty.gold();
      this.drawNumber($gameParty.gold(), xx + labelX, yy + 12, ww, "left", 2);
    };
    Window_Top.prototype.addGainGoldSprite = function (g) {
      this.removeGoldSprite();
      var s = new Sprite_GainGold(g);
      s.x = this.calcGainGoldSpriteX();
      s.y = -8;
      this.addChild(s);
      this._gainGoldSprite = s;
    };
    Window_Top.prototype.calcGainGoldSpriteX = function () {
      var goldLen = ($gameParty.gold() + "").length;
      return goldLen * 14;
    };
    Window_Top.prototype.removeGoldSprite = function () {
      if (this._gainGoldSprite) {
        this.removeChild(this._gainGoldSprite);
      }
      this._gainGoldSprite = null;
    };
    Window_Top.prototype.drawFan = function (xx, yy) {
      var ww = 100;
      this.drawIcon(Icon.fan, xx, yy + 4);
      var labelX = 40;
      this._lastFan = $slg.fan();
      this.drawNumber(
        this._lastFan * FAN_UNIT,
        xx + labelX,
        yy + 12,
        ww,
        "left",
        2
      );
    };
    Window_Top.prototype.drawTutorial = function (xx, yy) {
      var target = $gameTutorial.nextTarget();
      this._lastTutorial = target;
      if (!target) {
        return;
      }
      {
        var baseTexture = Nore.getSystemBaseTexture("main");
        var x = 0;
        if (ConfigManager.language == "en") {
          x = 100;
        }
        var rect = new Rectangle(x, 45, 100, 26);
        var texture = new PIXI.Texture(baseTexture, rect);
        var s = new PIXI.Sprite(texture);
        s.x = xx;
        s.y = 10;
        this._windowContentsSprite.addChild(s);
      }
      this.contents.fontSize = 18;
      this.drawText(target, xx - 8, yy + 14, 520, "left");
    };
    Window_Top.prototype.itemRect = function (index) {
      var r = new Rectangle(302, 8, 40, 40);
      r.x += index * 40;
      return r;
    };
    Window_Top.prototype.maxItems = function () {
      return 2;
    };
    Window_Top.prototype.maxCols = function () {
      return 2;
    };
    Window_Top.prototype.update = function () {
      _super.prototype.update.call(this);
      if (this.isChanged()) {
        this.refresh();
      }
      this.updateVisible();
      this.updateOpacity();
    };
    Window_Top.prototype.isChanged = function () {
      if (this._lastMoney != $gameParty.gold()) {
        return true;
      }
      if (this._lastFan != $slg.fan()) {
        return true;
      }
      if (this._lastTutorial != $gameTutorial.nextTarget()) {
        return true;
      }
      if (this._lastTicket != $gameParty.gachaTicket()) {
        return true;
      }
      return false;
    };
    Window_Top.prototype.updateOpacity = function () {
      if (!$gameSwitches.value(53)) {
        this.alpha = 1;
        return;
      }
      if ($gameScreen.picture(1)) {
        this.alpha = 1 - $gameScreen.picture(1).opacity() / 255;
      } else {
        this.alpha = 1;
      }
    };
    Window_Top.prototype.updateVisible = function () {
      if ($gameSwitches.value(999)) {
        this.visible = false;
        return;
      }
      if ($gameSwitches.value(18)) {
        this.visible = false;
      } else {
        this.visible = true;
      }
    };
    return Window_Top;
  })(Window_Base);
  Nore.Window_Top = Window_Top;
})(Nore || (Nore = {}));
var Sprite_GainGold = /** @class */ (function (_super) {
  __extends(Sprite_GainGold, _super);
  function Sprite_GainGold(gold) {
    var _this = _super.call(this) || this;
    _this.bitmap = new Bitmap(100, 30);
    _this.bitmap.fontSize = 12;
    _this.bitmap.textColor = "#FFFF88";
    _this.bitmap.fontBold = true;
    _this.bitmap.drawText("+" + gold, 0, 0, 80, 30, "right");
    if (!$slg.goldSe) {
      //AudioManager.playSe({ name: 'Coin', volume: 100, pitch: 100, pan: 0 });
      $slg.goldSe = true;
    }
    _this._wait = 50;
    return _this;
  }
  Sprite_GainGold.prototype.update = function () {
    _super.prototype.update.call(this);
    if (this._wait > 0) {
      this._wait--;
    }
    if (this._wait <= 0) {
      this.opacity -= 10;
      if (this.opacity <= 0) {
        if (this.parent && this.parent.removeGoldSprite) {
          this.parent.removeGoldSprite();
        }
      }
    }
  };
  return Sprite_GainGold;
})(Sprite);


code:
var TrainingInfo = /** @class */ (function () {
  function TrainingInfo() {
    this._trainingId = -1;
  }
  TrainingInfo.prototype.update = function () {
    /*if (this.isEmpty()) {
            return;
        }
        if (this._remainTime > 0) {
            this._remainTime--;
            if (this._remainTime == 0) {
                this.levelUp();
            }
        }*/
  };
  TrainingInfo.prototype.setup = function (actor) {
    this.removeTimeGaugeEvent();
    if (actor) {
      this._trainingId = actor.id();
      this._totalTime = this.calcTrainingTime(actor);
      this._remainTime = this._totalTime;
      this.addTimeGaugeEvent(this._totalTime);
    } else {
      this._trainingId = -1;
    }
  };
  TrainingInfo.prototype.actor = function () {
    if (this._trainingId >= 0) {
      return $slg.formation().findBattleActor(this._trainingId);
    } else {
      return null;
    }
  };
  TrainingInfo.prototype.calcTrainingTime = function (actor) {
    var time = actor.levelUpCost() * 30;
    if ($slg.facilityInfo().hasFacility(29)) {
      time *= 0.8;
    }
    if ($slg.facilityInfo().hasFacility(30)) {
      time *= 0.8;
    }
    if ($slg.facilityInfo().hasFacility(26)) {
      time *= 0.75;
    }
    if ($slg.facilityInfo().hasFacility(27)) {
      time *= 0.75;
    }
    return Math.floor(time);
  };
  TrainingInfo.prototype.isEmpty = function () {
    return this._trainingId == -1;
  };
  TrainingInfo.prototype.levelUp = function () {
    this.removeTimeGaugeEvent();
    this.actor().levelUp();
    this._trainingId = -1;
  };
  TrainingInfo.prototype.removeTimeGaugeEvent = function () {
    for (var i = 0; i < 2; i++) {
      // 不具合の修正のために２回
      $slg.removeTimeGaugeEventType(TimeGaugeEventType.training);
    }
  };
  TrainingInfo.prototype.clearTraining = function () {
    this._trainingId = -1;
    this.removeTimeGaugeEvent();
  };
  TrainingInfo.prototype.addTimeGaugeEvent = function (time) {
    // チュートリアル完了
    $gameSwitches.setValue(357, true);
    var e = new KaijinTrainingTimeGaugeEvent(this._trainingId, time);
    $slg.addTimeGaugeEvent(e);
  };
  TrainingInfo.prototype.actorName = function () {
    var actor = this.actor();
    if (actor) {
      return actor.name();
    } else {
      return "";
    }
  };
  TrainingInfo.prototype.level = function () {
    var actor = this.actor();
    if (actor) {
      return actor.level();
    } else {
      return -1;
    }
  };
  TrainingInfo.prototype.totalTime = function () {
    return this._totalTime;
  };
  TrainingInfo.prototype.remainTime = function () {
    return this._remainTime;
  };
  TrainingInfo.prototype.trainingActorId = function () {
    if (!this.actor()) {
      return -1;
    }
    return this.actor().actorId();
  };
  TrainingInfo.prototype.onAv = function () {
    this.onGacha();
  };
  TrainingInfo.prototype.onGacha = function () {
    if (!this.actor()) {
      return -1;
    }
    if (!$slg.facilityInfo().hasFacility(24)) {
      return;
    }
    var timeEvent = $slg.getTimeGaugeEvent(TimeGaugeEventType.training);
    if (!timeEvent) {
      return;
    }
    timeEvent.reduceRemain(60);
  };
  return TrainingInfo;
})();


code:
var __extends =
  (this && this.__extends) ||
  (function () {
    var extendStatics = function (d, b) {
      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];
        };
      return extendStatics(d, b);
    };
    return 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 __());
    };
  })();
var Nore;
(function (Nore) {
  Nore.TROOP_MAP = {
    1: [7, 8, 9],
    2: [11, 12, 13],
  };
  function makeAreaTroopData(areaId, clearNum) {
    var result = [];
    var battleId = 1;
    for (var i = 0; i < Nore.TROOP_MAP[areaId].length; i++) {
      if (clearNum + 1 > i) {
        var troopId = Nore.TROOP_MAP[areaId][i];
        var data = makeTroopData(areaId, troopId);
        data.setBattleId(battleId);
        result.push(data);
      }
      battleId++;
    }
    return result.reverse();
  }
  Nore.makeAreaTroopData = makeAreaTroopData;
  function makeTroopData(areaId, troopId) {
    var troop = $dataTroops[troopId];
    return new TroopData(areaId, troopId);
  }
  Nore.makeTroopData = makeTroopData;
})(Nore || (Nore = {}));
var EnemyElement;
(function (EnemyElement) {
  EnemyElement[(EnemyElement["none"] = 1)] = "none";
  EnemyElement[(EnemyElement["fire"] = 2)] = "fire";
  EnemyElement[(EnemyElement["water"] = 3)] = "water";
  EnemyElement[(EnemyElement["forest"] = 4)] = "forest";
})(EnemyElement || (EnemyElement = {}));
var TroopData = /** @class */ (function () {
  function TroopData(areaId, troopId) {
    this._areaId = areaId;
    this._troopId = troopId;
    this.parseLevels();
    this.makeEnemyList();
  }
  TroopData.prototype.setBattleId = function (id) {
    this._battleId = id;
  };
  TroopData.prototype.makeEnemyList = function () {
    this._enemyList = [];
    var troop = $dataTroops[this._troopId];
    for (var i = 0; i < troop.members.length; i++) {
      var e = troop.members[i];
      var level = this._levelList[i];
      var enemy = new EnemyData(e.enemyId);
      enemy.setLevel(level);
      this._enemyList.push(enemy);
    }
  };
  TroopData.prototype.enemyList = function () {
    return this._enemyList;
  };
  TroopData.prototype.battleId = function () {
    return this._battleId;
  };
  TroopData.prototype.troopId = function () {
    return this._troopId;
  };
  TroopData.prototype.areaId = function () {
    return this._areaId;
  };
  TroopData.prototype.levelList = function () {
    return this._levelList;
  };
  TroopData.prototype.parseLevels = function () {
    this._levelList = [];
    var name = $dataTroops[this._troopId].name;
    var regexp1 = /.*<([0-9,]+)>.*/g;
    var result = regexp1.exec(name);
    //p(result)
    if (!result) {
      return;
    }
    var match = result[1];
    var list = match.split(",");
    for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
      var s = list_1[_i];
      this._levelList.push(parseInt(s));
    }
  };
  return TroopData;
})();
var EnemyData = /** @class */ (function () {
  function EnemyData(enemyId) {
    this._enemyId = enemyId;
    this._level = 0;
  }
  EnemyData.prototype.setLevel = function (n) {
    this._level = n;
  };
  EnemyData.prototype.level = function () {
    return this._level;
  };
  EnemyData.prototype.element = function () {
    for (var _i = 0, _a = this.enemy().traits; _i < _a.length; _i++) {
      var t = _a[_i];
      if (t.code == 31) {
        return t.dataId;
      }
    }
    return EnemyElement.none;
  };
  EnemyData.prototype.enemy = function () {
    return $dataEnemies[this._enemyId];
  };
  return EnemyData;
})();
var Game_Troop2 = /** @class */ (function (_super) {
  __extends(Game_Troop2, _super);
  function Game_Troop2() {
    return (_super !== null && _super.apply(this, arguments)) || this;
  }
  Game_Troop2.prototype.setup = function (troopId) {
    this._troopData = new TroopData(-1, troopId);
    this.clear();
    this._troopId = troopId;
    this._enemies = [];
    for (var i = 0; i < this.troop().members.length; i++) {
      var member = this.troop().members[i];
      var level = this._troopData.levelList()[i];
      if ($dataEnemies[member.enemyId]) {
        var enemyId = member.enemyId;
        var x = member.x;
        var y = member.y;
        var enemy = new Game_Enemy2(enemyId, x, y, level);
        if (member.hidden) {
          enemy.hide();
        }
        this._enemies.push(enemy);
      }
    }
    this.makeUniqueNames();
  };
  Game_Troop2.prototype.hpPer = function () {
    var max = 0;
    var current = 0;
    for (var _i = 0, _a = this.members(); _i < _a.length; _i++) {
      var enemy = _a[_i];
      max += enemy.mhp;
      current += enemy.hp;
    }
    return Math.round((current * 100) / max);
  };
  return Game_Troop2;
})(Game_Troop);


code:
var Tutorial;
(function (Tutorial) {
  Tutorial[(Tutorial["NONE"] = -1)] = "NONE";
  Tutorial[(Tutorial["AV"] = 1)] = "AV";
  Tutorial[(Tutorial["FACILITY_1"] = 2)] = "FACILITY_1";
  Tutorial[(Tutorial["FACILITY_2"] = 3)] = "FACILITY_2";
  Tutorial[(Tutorial["COMBATANT"] = 4)] = "COMBATANT";
  Tutorial[(Tutorial["BATTLE"] = 5)] = "BATTLE";
  Tutorial[(Tutorial["DECISIVE_BATTLE_1"] = 6)] = "DECISIVE_BATTLE_1";
  Tutorial[(Tutorial["DECISIVE_BATTLE_2"] = 7)] = "DECISIVE_BATTLE_2";
  Tutorial[(Tutorial["AV_2"] = 8)] = "AV_2";
  Tutorial[(Tutorial["NEXT_DAY"] = 9)] = "NEXT_DAY";
  Tutorial[(Tutorial["FORMATION"] = 10)] = "FORMATION";
})(Tutorial || (Tutorial = {}));
var Game_Tutorial = /** @class */ (function () {
  function Game_Tutorial() {}
  Game_Tutorial.prototype.currentTutorial = function () {
    if ($slg.avInfo().currentAvList().length == 0) {
      // AV撮影
      return Tutorial.AV;
    }
    if ($gameSwitches.value(210)) {
      if ($slg.facilityInfo().facilityList().length == 0) {
        var f = $slg.facilityInfo().facilityAt(31);
        if (!f.inConstruction()) {
          if ($gameParty.gold() >= f.price()) {
            // 施設建設
            return Tutorial.FACILITY_1;
          }
        }
      }
    }
    if ($slg.avInfo().currentAvList().length == 1) {
      // AV撮影
      if ($gameActors.actor(8).hpRate() === 1) {
        if ($gameSwitches.value(105)) {
          return Tutorial.AV_2;
        }
        return;
      }
    }
    // 決戦
    if ($slg.decisiveBattleInfo().canExecute()) {
      return Tutorial.DECISIVE_BATTLE_1;
    } else {
      //return Tutorial.DECISIVE_BATTLE_2;
    }
    if (this.nextTarget() == TextManager.target_2_4) {
      return Tutorial.FORMATION;
    }
    if (this.nextTarget() == TextManager.target_0_3) {
      return Tutorial.FORMATION;
    }
    if (this.nextTarget() == TextManager.target_0_2) {
      return Tutorial.FACILITY_1;
    }
    if (this.nextTarget() == TextManager.target_4_2) {
      return Tutorial.FACILITY_1;
    }
    if (this.nextTarget() == TextManager.target_5_2) {
      return Tutorial.FACILITY_1;
    }
    if (this.nextTarget() == TextManager.target_2_2) {
      var f = $slg.facilityInfo().facilityAt(46);
      if (f.inConstruction()) {
        return Tutorial.NONE;
      }
      return Tutorial.FACILITY_1;
    }
    return Tutorial.NONE;
  };
  Game_Tutorial.prototype.nextTarget = function () {
    var common = this.commonTutorial();
    if (common) {
      return common;
    }
    switch ($slg.stage()) {
      case 1:
        return this.nextTarget1();
      case 2:
        return this.nextTarget2();
      case 3:
        return this.nextTarget3();
      case 4:
        return this.nextTarget4();
      case 5:
        return this.nextTarget5();
    }
    return null;
  };
  Game_Tutorial.prototype.commonTutorial = function () {
    if ($slg.facilityInfo().hasFacility(43)) {
      if ($slg.manInfo().hireCount() == 0) {
        return TextManager.target_0_1;
      }
    }
    if ($gameSwitches.value(1084)) {
      if (!$slg.facilityInfo().hasFacility(48)) {
        var f = $slg.facilityInfo().facilityAt(48);
        if (!$slg.facilityInfo().inConstruction(f)) {
          return TextManager.target_0_2;
        }
      }
    }
    if ($slg.facilityInfo().hasFacility(28)) {
      if (!$gameSwitches.value(357)) {
        return TextManager.target_0_3;
      }
    }
  };
  Game_Tutorial.prototype.nextTarget1 = function () {
    if ($slg.avInfo().finishedAvCount() == 0) {
      return TextManager.target_1_1;
    }
    if ($gameSwitches.value(210)) {
      if ($slg.facilityInfo().facilityList().length == 0) {
        var f = $slg.facilityInfo().facilityAt(31);
        if ($gameParty.gold() >= f.price()) {
          // 施設建設
          if ($gameSwitches.value(101)) {
            return TextManager.target_1_3;
          }
        }
        return null;
      }
    } else {
      return "";
    }
    if ($slg.avInfo().finishedAvCount() == 1) {
      // AV撮影
      if ($gameActors.actor(8).hpRate() === 1) {
        if (!$gameSwitches.value(105)) {
          return TextManager.target_1_7;
        }
        return TextManager.target_1_4;
      }
    }
    if ($slg.decisiveBattleInfo().canExecute()) {
      return TextManager.target_1_5;
    } else {
      if (!$gameSwitches.value(245)) {
        return TextManager.target_1_6;
      }
    }
    return TextManager.target_1_7;
  };
  Game_Tutorial.prototype.nextTarget2 = function () {
    if ($gameSwitches.value(219)) {
      return null;
    }
    var avInfo = $slg.avInfo();
    if (!avInfo.hasAv(122)) {
      return TextManager.target_2_1;
    }
    if ($gameSwitches.value(1037)) {
      if (!$slg.facilityInfo().hasFacility(46)) {
        return TextManager.target_2_2;
      }
      if (!$gameSwitches.value(243)) {
        // ブスジマと同棲
        if (!$gameSwitches.value(303)) {
          return TextManager.target_2_8;
        }
        if (!$gameSwitches.value(352)) {
          return TextManager.target_2_12;
        }
      }
    }
    if ($gameActors.actor(9).countSyusan() == 0) {
      if ($gameActors.actor(9).boteId == 1) {
        return TextManager.target_2_3;
      } else {
        return TextManager.target_2_13;
      }
    }
    if (!$slg.formation().kaijinExists()) {
      if ($slg.formation().kaijinCount() == 1) {
        return TextManager.target_2_4;
      }
    }
    if ($gameSwitches.value(216)) {
      if (!$gameSwitches.value(243)) {
        if ($gameSwitches.value(331)) {
          return TextManager.target_2_11;
        } else {
          return TextManager.target_2_5;
        }
      } else {
        if ($gameSwitches.value(218)) {
          return TextManager.target_2_7;
        } else {
          return TextManager.target_2_6;
        }
      }
    }
    if (!$slg.facilityInfo().hasFacility(43)) {
      return TextManager.target_2_10;
    }
    return null;
  };
  Game_Tutorial.prototype.nextTarget3 = function () {
    var avInfo = $slg.avInfo();
    if ($gameSwitches.value(229)) {
      return TextManager.target_3_8;
    }
    if (!avInfo.hasAv(161)) {
      return TextManager.target_3_1;
    }
    if (!$slg.facilityInfo().hasFacility(43)) {
      return TextManager.target_3_7;
    }
    if ($gameSwitches.value(221)) {
      if (!$slg.facilityInfo().hasFacility(64)) {
        return TextManager.target_3_2;
      }
    }
    if ($gameSwitches.value(1082)) {
      if (!$gameSwitches.value(1084)) {
        return TextManager.target_3_5;
      }
      if (!$gameSwitches.value(307)) {
        return TextManager.target_3_6;
      }
    }
    return TextManager.target_3_1;
  };
  Game_Tutorial.prototype.nextTarget4 = function () {
    if ($gameSwitches.value(235)) {
      return TextManager.target_4_11;
    }
    var avInfo = $slg.avInfo();
    if (!avInfo.hasAv(261)) {
      return TextManager.target_4_1;
    }
    if (!$gameSwitches.value(1144)) {
      return TextManager.target_4_1;
    }
    if ($gameSwitches.value(1144)) {
      if (!$slg.facilityInfo().hasFacility(50)) {
        var f = $slg.facilityInfo().facilityAt(50);
        if (!$slg.facilityInfo().inConstruction(f)) {
          return TextManager.target_4_2;
        }
      }
    }
    if (!$gameSwitches.value(311)) {
      //サキとカスゾウを同棲させましょう
      return TextManager.target_4_3;
    }
    if (!$gameSwitches.value(109)) {
      return TextManager.target_4_12;
    }
    if (!$slg.facilityInfo().hasFacility(71)) {
      return TextManager.target_4_4;
    }
    var kaijinCount = $slg.formation().kaijinCount();
    if (kaijinCount < 14) {
      return TextManager.target_4_8.format(kaijinCount);
    }
    if (!$slg.facilityInfo().hasFacility(79)) {
      return TextManager.target_4_9;
    }
    if ($gameSwitches.value(234)) {
      return TextManager.target_4_10;
    }
  };
  Game_Tutorial.prototype.nextTarget5 = function () {
    if ($gameSwitches.value(249)) {
      return TextManager.target_5_12;
    }
    var avInfo = $slg.avInfo();
    if (!avInfo.hasAv(302)) {
      return TextManager.target_5_1;
    }
    if (!$slg.facilityInfo().hasFacility(53)) {
      var f = $slg.facilityInfo().facilityAt(53);
      if (!$slg.facilityInfo().inConstruction(f)) {
        return TextManager.target_5_2;
      }
    }
    if (!$gameSwitches.value(315)) {
      //ココナとオリバーを同棲させましょう
      return TextManager.target_5_5;
    }
    if (!$slg.facilityInfo().hasFacility(72)) {
      return TextManager.target_5_3;
    }
    if ($gameSwitches.value(240)) {
      if (!$slg.facilityInfo().hasFacility(80)) {
        return TextManager.target_5_11;
      }
    } else {
      return TextManager.target_4_12;
    }
    if (!$gameSwitches.value(237)) {
      return TextManager.target_5_10;
    }
    return TextManager.target_5_13;
  };
  return Game_Tutorial;
})();