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 FORMATION_W = 830 - 30;
  var Scene_Formation = /** @class */ (function (_super) {
    __extends(Scene_Formation, _super);
    function Scene_Formation() {
      return (_super !== null && _super.apply(this, arguments)) || this;
    }
    Scene_Formation.prototype.create = function () {
      _super.prototype.create.call(this);
      this.createPictures();
      this.createWindowLayer();
      this.createAllWindows();
      this.createFormationWindow();
    };
    Scene_Formation.prototype.start = function () {
      _super.prototype.start.call(this);
      this._formationWindow.refresh();
      this._formationDetailWindow.refresh();
    };
    Scene_Formation.prototype.createPictures = function () {
      var width = Graphics.width;
      var height = Graphics.height;
      var x = (Graphics.width - width) / 2;
      var y = (Graphics.height - height) / 2;
      this._pictureContainer = new Sprite();
      this._pictureContainer.setFrame(x, y, width, height);
      for (var i = 0; i <= $gameScreen.maxPictures(); i++) {
        this._pictureContainer.addChild(new Sprite_Picture(i));
      }
      this.addChild(this._pictureContainer);
    };
    Scene_Formation.prototype.createFormationWindow = function () {
      this._formationWindow = new Window_Formation();
      this.addWindow(this._formationWindow);
      this._formationDetailWindow = new Window_FormationDetail();
      this._formationDetailWindow.activate();
      this._formationDetailWindow.select(0);
      this._formationDetailWindow.setHandler(
        "cancel",
        this.onCancel.bind(this)
      );
      this._formationDetailWindow.setHandler("ok", this.onOk.bind(this));
      this.addWindow(this._formationDetailWindow);
    };
    Scene_Formation.prototype.onCancel = function () {
      var formation = $slg.formation();
      if (!formation.isValid()) {
        SoundManager.playBuzzer();
        this._formationDetailWindow.activate();
      } else {
        this.popScene();
      }
    };
    Scene_Formation.prototype.onOk = function () {
      var actor = this._formationDetailWindow.selectedActor();
      if (!actor) {
        return;
      }
      var formation = $slg.formation();
      formation.selectActor(actor);
      this._formationWindow.makeData();
      this._formationWindow.refresh();
      this._formationDetailWindow.makeData();
      this._formationDetailWindow.refresh();
      this._formationDetailWindow.activate();
    };
    return Scene_Formation;
  })(Nore.Scene_Talk);
  Nore.Scene_Formation = Scene_Formation;
  var Window_FormationSelectable = /** @class */ (function (_super) {
    __extends(Window_FormationSelectable, _super);
    function Window_FormationSelectable() {
      return (_super !== null && _super.apply(this, arguments)) || this;
    }
    Window_FormationSelectable.prototype.drawFormation = function (
      index,
      actor,
      disable,
      imageOffset
    ) {
      if (disable === void 0) {
        disable = false;
      }
      if (imageOffset === void 0) {
        imageOffset = 0;
      }
      if (!actor) {
        return;
      }
      this.changePaintOpacity(true);
      var rect = this.itemRect(index);
      this.drawFormationRect(rect, actor, disable, imageOffset);
    };
    Window_FormationSelectable.prototype.drawFormationRect = function (
      rect,
      actor,
      disable,
      imageOffset
    ) {
      if (disable === void 0) {
        disable = false;
      }
      if (imageOffset === void 0) {
        imageOffset = 0;
      }
      this.contents.fontSize = 14;
      /*if (disable) {
                this.contents.textColor = '#DDDDDD';
            } else {
                this.contents.textColor = ColorManager.normalColor();
            }*/
      this.contents.textColor = ColorManager.normalColor();
      var frameX = 13;
      var frameY = 13;
      if (actor.rare() > 0) {
        var sprite = getFrameSprite(actor.rare(), actor.element());
        /*if (disable) {
                    sprite.alpha = 0.5;
                }*/
        sprite.x = rect.x + imageOffset + frameX;
        sprite.y = rect.y + frameY;
        this._windowContentsSprite.addChild(sprite);
      }
      this.drawText(actor.name(), rect.x, rect.y + 82, 90, "center");
      this.contents.textColor = ColorManager.normalColor();
      this.contents.fontSize = 12;
      this.drawImage(
        actor,
        rect.x + imageOffset + frameX,
        rect.y + frameY,
        false
      );
      if (disable) {
        var g = new PIXI.Graphics();
        g.beginFill(0x000033, 0.8);
        g.drawRect(0, 0, rect.width, rect.height);
        g.endFill();
        g.x = rect.x + 12;
        g.y = rect.y + 12;
        this._windowContentsSprite.addChild(g);
      }
    };
    Window_FormationSelectable.prototype.drawImage = function (
      actor,
      x,
      y,
      disable
    ) {
      var u = new BattleUnitDir2(actor, disable);
      var s = new Sprite_SlotUnit(u, new Rectangle(x + 18, y + 70, 100, 100));
      this._windowContentsSprite.addChild(s);
    };
    Window_FormationSelectable.prototype.itemHeight = function () {
      return 120;
    };
    Window_FormationSelectable.prototype.itemWidth = function () {
      return 96;
    };
    Window_FormationSelectable.prototype.selectedActor = function () {
      return this.item(this.index());
    };
    Window_FormationSelectable.prototype.item = function (index) {
      return null;
    };
    return Window_FormationSelectable;
  })(Window_Selectable);
  var Window_Formation = /** @class */ (function (_super) {
    __extends(Window_Formation, _super);
    function Window_Formation() {
      var _this = this;
      var r = new Rectangle(Nore.MAIN_MENU_W, Nore.TOP_Y, FORMATION_W, 222);
      _this = _super.call(this, r) || this;
      _this.makeData();
      _this.refresh();
      return _this;
    }
    Window_Formation.prototype.maxItems = function () {
      return 5;
    };
    Window_Formation.prototype.update = function () {
      _super.prototype.update.call(this);
      if ($slg.formation().isLevelUp()) {
        $slg.formation().clearLevelUp();
        this.refresh();
      }
      this.removeTutoArrow();
      this.updateTabKey();
    };
    Window_Formation.prototype.removeTutoArrow = function () {
      if (!this._tutoArrow) {
        return;
      }
      if ($gameTutorial.nextTarget() == TextManager.target_0_3) {
        return;
      }
      this._windowContentsSprite.removeChild(this._tutoArrow);
      this._tutoArrow = null;
    };
    Window_Formation.prototype.updateTabKey = function () {
      if (!this.active) {
        return;
      }
      if (Input.isTriggered("tab")) {
        this.callHandler("tab");
      }
    };
    Window_Formation.prototype.refresh = function () {
      this._tutoArrow = null;
      this._windowContentsSprite.removeChildren();
      _super.prototype.refresh.call(this);
      this.refreshLabel();
    };
    Window_Formation.prototype.refreshLabel = function () {
      this.contents.fontSize = 14;
      var textX = 22;
      var offsetY = ConfigManager.language == "jp" ? 0 : 30;
      var s = this.getSprite(96, 314 + offsetY, 200, 24);
      s.x = 13;
      s.y = 11;
      this.addChild(s);
    };
    Window_Formation.prototype.getSprite = function (x, y, w, h) {
      var baseTexture = Nore.getSystemBaseTexture("gacha");
      var r = new Rectangle(x, y, w, h);
      var texture = new PIXI.Texture(baseTexture, r);
      var s = new PIXI.Sprite(texture);
      return s;
    };
    Window_Formation.prototype.drawTotalPower = function () {};
    Window_Formation.prototype.makeData = function () {
      this._members = $slg.formation().battleMembers();
    };
    Window_Formation.prototype.maxCols = function () {
      return 5;
    };
    Window_Formation.prototype.itemWidth = function () {
      return 154;
    };
    Window_Formation.prototype.drawItem = function (index) {
      this.changePaintOpacity(true);
      var rect = this.itemRect(index);
      if (index >= $slg.formation().maxBattleMembers()) {
        this.drawIcon(1922, rect.x + 38, rect.y + 18);
      }
      var actor = this._members[index];
      if (!actor) {
        return;
      }
      this.drawFormation(index, actor, false, 0);
      this.drawParam(0, "LV", actor.level(), rect);
      this.drawParam(1, "HP", actor.mhp(), rect);
      this.drawParam(2, "ATK", actor.atk(), rect);
      this.drawParam(3, TextManager.interval, actor.agiText(), rect);
      this.drawSkill(actor, rect);
      this.changePaintOpacity(true);
      var buttonY = 125 + rect.y;
      if (index > 0) {
        this.addLeftButton(index, buttonY);
      }
      if (index < $slg.formation().maxBattleMembers() - 1) {
        this.addRightButton(index, buttonY);
      }
      if (!actor.isMaxLevel()) {
        this.addLevelUpButton(index, buttonY);
        this.addTutoArrow(rect.x, buttonY);
      }
    };
    Window_Formation.prototype.drawSkill = function (actor, rect) {
      var yy = rect.y + 86;
      var xx = rect.x + 90;
      var learnings = actor.learnings();
      for (var i = 0; i < learnings.length; i++) {
        var l = learnings[i];
        var iconIndex = Icon.skillEmpty;
        if (l.level <= actor.level()) {
          iconIndex = Icon.skill2;
          this.changePaintOpacity(true);
        } else {
          this.changePaintOpacity(false);
        }
        this.drawIcon(iconIndex, xx, yy);
        xx += 21;
      }
    };
    Window_Formation.prototype.drawParam = function (
      index,
      title,
      param,
      rect
    ) {
      var xx = rect.x - 20;
      var yy = 14 + index * 18;
      this.contents.fontSize = 14;
      //this.drawText(title, xx, yy, 100);
      this.drawText(param + "", xx, yy, 150, "right");
    };
    Window_Formation.prototype.buttonInterval = function () {
      return 47;
    };
    Window_Formation.prototype.buttonOffset = function () {
      return -10;
    };
    Window_Formation.prototype.addLevelUpButton = function (index, y) {
      var rect = this.itemRect(index);
      var button = new Sprite_Button2("levelup", true);
      button.x = rect.x + this.buttonInterval() + this.buttonOffset();
      button.y = y;
      this.addChild(button);
      button.setClickHandler(this.onLevelUp.bind(this, index));
      this._windowContentsSprite.addChild(button);
    };
    Window_Formation.prototype.addLeftButton = function (index, y) {
      var rect = this.itemRect(index);
      var button = new Sprite_Button2("pageup", true);
      button.x = rect.x + this.buttonOffset();
      button.y = y;
      this.addChild(button);
      button.setClickHandler(this.onLeft.bind(this, index));
      this._windowContentsSprite.addChild(button);
    };
    Window_Formation.prototype.addRightButton = function (index, y) {
      var rect = this.itemRect(index);
      var button = new Sprite_Button2("pagedown", true);
      button.x = rect.x + this.buttonInterval() * 2 + this.buttonOffset();
      button.y = y;
      this.addChild(button);
      button.setClickHandler(this.onRight.bind(this, index));
      this._windowContentsSprite.addChild(button);
    };
    Window_Formation.prototype.onLevelUp = function (index) {
      if (!this.active) {
        return;
      }
      this.select(index);
      this.callHandler("tab");
    };
    Window_Formation.prototype.onLeft = function (index) {
      if (!this.active) {
        return;
      }
      this.select(index);
      this.pageup();
    };
    Window_Formation.prototype.onRight = function (index) {
      if (!this.active) {
        return;
      }
      this.select(index);
      this.pagedown();
    };
    Window_Formation.prototype.itemRect = function (index) {
      var rect = _super.prototype.itemRect.call(this, index);
      rect.x += 6;
      rect.y += 19;
      return rect;
    };
    Window_Formation.prototype.setBattleActor = function (actor) {
      var index = this.index();
      if (index == 4) {
        $gameSwitches.setValue(251, true);
      }
      $slg.formation().setActor(index, actor);
      this.makeData();
      this.refresh();
    };
    Window_Formation.prototype.isCurrentItemEnabled = function () {
      return true;
    };
    Window_Formation.prototype.item = function (index) {
      return this._members[index];
    };
    Window_Formation.prototype.pageup = function () {
      SoundManager.playCursor();
      var index = this.index();
      var next = index - 1;
      if (next < 0) {
        this.activate();
        return;
      }
      $slg.formation().swap(index, next);
      this._members = $slg.formation().battleMembers();
      this.refresh();
      this.select(next);
      this.activate();
    };
    Window_Formation.prototype.pagedown = function () {
      SoundManager.playCursor();
      var index = this.index();
      var next = index + 1;
      if (next >= $slg.formation().maxBattleMembers()) {
        this.activate();
        return;
      }
      $slg.formation().swap(index, next);
      this._members = $slg.formation().battleMembers();
      this.refresh();
      this.select(next);
      this.activate();
    };
    Window_Formation.prototype.addTutoArrow = function (x, y) {
      if (this._tutoArrow) {
        return;
      }
      if ($gameTutorial.nextTarget() != TextManager.target_0_3) {
        return;
      }
      var baseTexture2 = Nore.getSystemBaseTexture("0213_sys");
      var texture = new PIXI.Texture(baseTexture2);
      var sprite = new PIXI.Sprite(texture);
      sprite.x = x + 37;
      sprite.y = y + 18;
      sprite.rotation = (-90 / 180) * Math.PI;
      this._tutoArrow = sprite;
      this._windowContentsSprite.addChild(sprite);
    };
    return Window_Formation;
  })(Window_FormationSelectable);
  Nore.Window_Formation = Window_Formation;
  var Window_FormationList = /** @class */ (function (_super) {
    __extends(Window_FormationList, _super);
    function Window_FormationList() {
      var _this = this;
      var r = new Rectangle(Nore.MAIN_MENU_W, 338, FORMATION_W, 462);
      _this = _super.call(this, r) || this;
      _this.makeData();
      _this.refresh();
      return _this;
    }
    Window_FormationList.prototype.update = function () {
      if ($slg.formation().filterChanged()) {
        $slg.formation().clearFilterChanged();
        this.makeData();
        this.refresh();
      }
      _super.prototype.update.call(this);
    };
    Window_FormationList.prototype.refresh = function () {
      this._windowContentsSprite.removeChildren();
      _super.prototype.refresh.call(this);
    };
    Window_FormationList.prototype.drawAllItems = function () {
      this._windowContentsSprite.removeChildren();
      _super.prototype.drawAllItems.call(this);
    };
    Window_FormationList.prototype.makeData = function () {
      this._members = [];
      for (
        var _i = 0, _a = $slg.formation().allMembers();
        _i < _a.length;
        _i++
      ) {
        var m = _a[_i];
        if (this.include(m)) {
          this._members.push(m);
        }
      }
      var sort = $slg.formation().sortValue();
      this._members = this._members.sort(function (a, b) {
        switch (sort) {
          case MonsterSort.newArrival:
            return 1;
          case MonsterSort.rare:
            if (a.rare() == b.rare()) {
              return a.element() - b.element();
            }
            return b.rare() - a.rare();
          case MonsterSort.element:
            if (a.element() == b.element()) {
              return b.rare() - a.rare();
            }
            if (a.element() == MonsterElement.none) {
              return 1;
            }
            if (b.element() == MonsterElement.none) {
              return -1;
            }
            return a.element() - b.element();
        }
      });
    };
    Window_FormationList.prototype.include = function (m) {
      if (this.rareNg(m)) {
        return false;
      }
      if (this.elementNg(m)) {
        return false;
      }
      return true;
    };
    Window_FormationList.prototype.rareNg = function (m) {
      return !$slg.formation().isRareEnabled(m.rare());
    };
    Window_FormationList.prototype.elementNg = function (m) {
      return !$slg.formation().isElementEnabled(m.element());
    };
    Window_FormationList.prototype.maxCols = function () {
      return 5;
    };
    Window_FormationList.prototype.itemWidth = function () {
      return 148;
    };
    Window_FormationList.prototype.maxItems = function () {
      if (!this._members) {
        return 1;
      }
      return this._members.length;
    };
    Window_FormationList.prototype.drawItem = function (index) {
      var rect = this.itemRect(index);
      var actor = this._members[index];
      if (!actor) {
        return;
      }
      var formation = $slg.formation();
      var slot = formation.slotBy(actor.id());
      var isActive = slot >= 0;
      this.drawFormation(index, actor, isActive);
      this.changePaintOpacity(true);
      this.drawParam(0, "LV", actor.level(), rect);
      this.drawParam(1, "HP", actor.mhp(), rect);
      this.drawParam(2, "ATK", actor.atk(), rect);
      this.drawParam(3, TextManager.interval, actor.agiText(), rect);
      this.drawSkill(actor, rect);
    };
    Window_FormationList.prototype.drawParam = function (
      index,
      title,
      param,
      rect
    ) {
      var xx = rect.x - 20;
      var yy = rect.y + index * 18;
      this.contents.fontSize = 14;
      //this.drawText(title, xx, yy, 100);
      this.drawText(param + "", xx, yy, 150, "right");
    };
    Window_FormationList.prototype.drawSkill = function (actor, rect) {
      var yy = rect.y + 86;
      var xx = rect.x + 90;
      var learnings = actor.learnings();
      for (var i = 0; i < learnings.length; i++) {
        var l = learnings[i];
        var iconIndex = Icon.skillEmpty;
        if (l.level <= actor.level()) {
          iconIndex = Icon.skill2;
          this.changePaintOpacity(true);
        } else {
          this.changePaintOpacity(false);
        }
        this.drawIcon(iconIndex, xx, yy);
        xx += 21;
      }
    };
    Window_FormationList.prototype.selectedActor = function () {
      return this._members[this.index()];
    };
    Window_FormationList.prototype.addIcon = function (index, x, y) {
      var ww = 32;
      var hh = 32;
      var xx = index % 16;
      var yy = Math.floor(index / 16);
      var sprite = new Sprite();
      sprite.bitmap = ImageManager.loadSystem("IconSet");
      sprite.setFrame(xx * ww, yy * hh, ww, hh);
      sprite.x = x;
      sprite.y = y;
      this._windowContentsSprite.addChild(sprite);
    };
    Window_FormationList.prototype.item = function (index) {
      return this._members[index];
    };
    Window_FormationList.prototype.processTouch = function () {
      if (this._disableTouch) {
        return;
      }
      if (!this.active) {
        if (TouchInput.isPressed()) {
          this.onTouchSelect(true);
        }
        return;
      }
      _super.prototype.processTouch.call(this);
    };
    Window_FormationList.prototype.onTouchSelect = function (trigger) {
      if (!this.visible) {
        return;
      }
      this._doubleTouch = false;
      if (!this.active) {
        var lastIndex = this.index();
        var hitIndex = this.hitIndex();
        if (hitIndex >= 0) {
          if (hitIndex === this.index()) {
            this._doubleTouch = true;
          }
          if (TouchInput.isTriggered()) {
            SoundManager.playCursor();
            this.select(hitIndex);
          }
        }
        return;
      }
      _super.prototype.onTouchSelect.call(this, trigger);
    };
    Window_FormationList.prototype.disableTouch = function () {
      this._disableTouch = true;
    };
    Window_FormationList.prototype.enableTouch = function () {
      this._disableTouch = false;
    };
    Window_FormationList.prototype.isCurrentItemEnabled = function () {
      var actor = this.selectedActor();
      if (!actor) {
        return false;
      }
      if ($slg.formation().isBattleMamber(actor)) {
        return false;
      }
      return true;
    };
    Window_FormationList.prototype.itemRect = function (index) {
      var r = _super.prototype.itemRect.call(this, index);
      r.x += 10;
      r.y += 2;
      return r;
    };
    return Window_FormationList;
  })(Window_FormationSelectable);
  Nore.Window_FormationList = Window_FormationList;
  var FormationBarRate = /** @class */ (function () {
    function FormationBarRate(baseRate, totalRate) {
      this.baseRate = baseRate;
      this.totalRate = totalRate;
    }
    FormationBarRate.prototype.rank = function () {
      return Math.round((this.totalRate * 100) / 20);
    };
    return FormationBarRate;
  })();
  var Window_FormationDetail = /** @class */ (function (_super) {
    __extends(Window_FormationDetail, _super);
    function Window_FormationDetail() {
      var _this = this;
      var r = new Rectangle(980, Nore.TOP_Y, 300, 800 - Nore.TOP_Y);
      _this = _super.call(this, r) || this;
      _this.visible = false;
      return _this;
    }
    Window_FormationDetail.prototype.isShowLevelUp = function () {
      return this._levelUpWindow.visible;
    };
    Window_FormationDetail.prototype.setLevelUpWindow = function (
      levelUpWindow
    ) {
      this._levelUpWindow = levelUpWindow;
    };
    Window_FormationDetail.prototype.setListWindow = function (
      formationListWindow
    ) {
      this._formationListWindow = formationListWindow;
    };
    Window_FormationDetail.prototype.setFormationWindow = function (
      formationWindow
    ) {
      this._formationWindow = formationWindow;
    };
    Window_FormationDetail.prototype.setup = function (actor) {
      if (this.isShowLevelUp()) {
        return;
      }
      this._actor = actor;
      this.refresh();
    };
    Window_FormationDetail.prototype.refresh = function () {
      this.changePaintOpacity(true);
      this._windowContentsSprite.removeChildren();
      _super.prototype.refresh.call(this);
      this.drawLabel();
      this.drawTraning();
      this.drawSkills();
      this.drawRare();
      this.addButton();
      this.visible = this._actor != null;
    };
    Window_FormationDetail.prototype.drawLabel = function () {
      var s = this.getSprite(0, 264, 60, 130);
      s.x = 34;
      s.y = 150;
      this._windowContentsSprite.addChild(s);
      {
        var s_1 = this.getSprite(96, 290, 228, 14);
        s_1.x = 36;
        s_1.y = 288;
        this._windowContentsSprite.addChild(s_1);
        var s2 = this.getSprite(96, 290, 228, 14);
        s2.x = 36;
        s2.y = 288 + 174;
        this._windowContentsSprite.addChild(s2);
      }
      {
        var s_2 = this.getSprite(96, 260, 80, 30);
        s_2.x = 36;
        s_2.y = 314;
        this._windowContentsSprite.addChild(s_2);
      }
    };
    Window_FormationDetail.prototype.getSprite = function (x, y, w, h) {
      var baseTexture = Nore.getSystemBaseTexture("gacha");
      var r = new Rectangle(x, y, w, h);
      var texture = new PIXI.Texture(baseTexture, r);
      var s = new PIXI.Sprite(texture);
      return s;
    };
    Window_FormationDetail.prototype.drawTraning = function () {
      if (!this._actor) {
        return;
      }
      var info = $slg.formation().trainingInfo();
      if (info.actor() != this._actor) {
        return;
      }
      this.contents.fontSize = 14;
      this.changeTextColor(ColorManager.crisisColor());
      this.drawText(TextManager.inTraining2, 170, 5, 150);
    };
    Window_FormationDetail.prototype.drawRare = function () {
      if (!this._actor) {
        return;
      }
      this.changePaintOpacity(true);
      this.drawIcon(this.rareIcon(this._actor.rare()), 110, 13);
    };
    Window_FormationDetail.prototype.rareIcon = function (rare) {
      switch (rare) {
        case MonsterRare.common:
          return Icon.n;
        case MonsterRare.rare:
          return Icon.r;
        case MonsterRare.sr:
          return Icon.sr;
        case MonsterRare.ssr:
          return Icon.ssr;
      }
    };
    Window_FormationDetail.prototype.addButton = function () {
      if (!this._actor) {
        return;
      }
      var cost = this._actor.levelUpCost();
      if (cost == 0) {
        return;
      }
      this.changePaintOpacity(cost <= $gameParty.gold());
      var yy = 54;
      var lvUpButton = new Sprite_Button2("levelup", true);
      lvUpButton.x = 106;
      lvUpButton.y = yy;
      this._windowContentsSprite.addChild(lvUpButton);
      lvUpButton.setClickHandler(this.onLevelUp.bind(this));
      this._lvUpButton = lvUpButton;
      this.drawText(TextManager.detailLvUp, 170, yy - 5, 150);
      this.drawText(TextManager.detailLvUpCost + ":", 170, yy + 20, 150);
      this.drawText("%1".format(cost), 160, yy + 20, 82, "right");
      this.drawIcon(Icon.gold, 237, yy + 22);
    };
    Window_FormationDetail.prototype.disableOtherWindow = function () {
      this._formationListWindow.deactivate();
      this._formationListWindow.disableTouch();
      this._formationWindow.deactivate();
    };
    Window_FormationDetail.prototype.enableOtherWindow = function () {
      this._formationListWindow.enableTouch();
      this._formationWindow.activate();
    };
    Window_FormationDetail.prototype.onLevelUp = function () {
      if (this._levelUpWindow.visible) {
        return;
      }
      SoundManager.playOk();
      this.disableOtherWindow();
      var onLevelUp = this.onLevelUpOk.bind(this);
      var onLevelUpCancel = this.onLevelUpCancel.bind(this);
      var onLevelUpTraining = this.onLevelUpTraining.bind(this);
      this._levelUpWindow.setup(
        this._actor,
        onLevelUp,
        onLevelUpCancel,
        onLevelUpTraining
      );
    };
    Window_FormationDetail.prototype.onLevelUpOk = function () {
      var cost = this._actor.levelUpCost();
      SoundManager.playShop();
      $slg.formation().levelUp(this._actor.actorId());
      this.refresh();
      $slg.formation().onLevelUp();
      $gameParty.loseGold(cost);
      if (this._actor.isMaxLevel()) {
        this.enableOtherWindow();
        this._levelUpWindow.hide();
      } else {
        this._levelUpWindow.activate();
      }
    };
    Window_FormationDetail.prototype.onLevelUpCancel = function () {
      this.enableOtherWindow();
    };
    Window_FormationDetail.prototype.onLevelUpTraining = function () {
      var trainingInfo = $slg.formation().trainingInfo();
      if (trainingInfo.actor() == this._actor) {
        this.enableOtherWindow();
        return;
      }
      trainingInfo.setup(this._actor);
      SoundManager.playEquip();
      this.refresh();
      this.enableOtherWindow();
    };
    Window_FormationDetail.prototype.maxItems = function () {
      return 1;
    };
    Window_FormationDetail.prototype.drawItem = function (index) {
      if (!this._actor) {
        return;
      }
      this.drawParam(0, "LV", this._actor.level(), 0, null);
      this.drawParam(
        1,
        "HP",
        this._actor.mhp(),
        this._actor.mhpPlus(),
        this.hpBarRate()
      );
      this.drawParam(
        2,
        "ATK",
        this._actor.atk(),
        this._actor.atkPlus(),
        this.atkBarRate()
      );
      this.drawParam(
        3,
        TextManager.interval,
        this._actor.agiText(),
        this._actor.agiPlusText(),
        this.agiBarRate()
      );
      this.drawFormation(index, this._actor);
    };
    Window_FormationDetail.prototype.hpBarRate = function () {
      var max = 290;
      var min = 50;
      var mhp = this._actor.mhpBase();
      var baseRate = (mhp - min) / (max - min);
      var total = this._actor.mhp();
      var totalRate = (total - min) / (max - min);
      return new FormationBarRate(baseRate, totalRate);
    };
    Window_FormationDetail.prototype.atkBarRate = function () {
      var max = 80;
      var min = 10;
      var mhp = this._actor.atkBase();
      var baseRate = (mhp - min) / (max - min);
      var total = this._actor.atk();
      var totalRate = (total - min) / (max - min);
      return new FormationBarRate(baseRate, totalRate);
    };
    Window_FormationDetail.prototype.agiBarRate = function () {
      var max = 130;
      var min = 30;
      var mhp = max - this._actor.agiBase();
      var baseRate = (mhp - min) / (max - min);
      var total = max - this._actor.agi();
      var totalRate = (total - min) / (max - min);
      return new FormationBarRate(baseRate, totalRate);
    };
    Window_FormationDetail.prototype.drawParam = function (
      index,
      title,
      param,
      plus,
      barRate
    ) {
      var xx = 20;
      var yy = 136 + index * 32;
      this.contents.fontSize = 22;
      //this.drawText(title, xx, yy, 100);
      this.drawText(param + "", xx, yy, 175, "right");
      if (barRate) {
        var barX = xx + 34;
        for (var i = 0; i < barRate.rank(); i++) {
          this.drawIcon(Icon.star, barX, yy + 4);
          barX += 18;
        }
      }
      if (plus > 0) {
        this.drawText("(+" + plus + ")", xx, yy, 232, "right");
      }
    };
    Window_FormationDetail.prototype.drawSkills = function () {
      if (!this._actor) {
        return;
      }
      var learnings = this._actor.learnings();
      if (learnings.length == 0) {
        return;
      }
      this.drawSkillIcon(100, 304, learnings);
      this.changePaintOpacity(true);
      this.drawSkill(learnings[0], 340);
      if (learnings[1]) {
        this.changePaintOpacity(true);
        this.drawSkill(learnings[1], 470);
      }
    };
    Window_FormationDetail.prototype.drawSkillIcon = function (
      xx,
      yy,
      learnings
    ) {
      for (var i = 0; i < learnings.length; i++) {
        var l = learnings[i];
        var iconIndex = Icon.skillEmpty;
        if (l.level <= this._actor.level()) {
          iconIndex = Icon.skill2;
          this.changePaintOpacity(true);
        } else {
          this.changePaintOpacity(false);
        }
        this.drawIcon(iconIndex, xx, yy);
        xx += 21;
      }
    };
    Window_FormationDetail.prototype.drawSkill = function (learning, y) {
      var top = y;
      var left = 30;
      this.contents.fontSize = 16;
      this.changeTextColor(ColorManager.normalColor());
      var lh = 25;
      var skill = $dataSkills[learning.skillId];
      if (learning.level > 1) {
        this.drawText(
          TextManager.learnSkillLv + learning.level,
          left,
          top,
          200
        );
        top += 25;
      }
      this.contents.fontSize = 16;
      this.changeTextColor("#f3de67");
      this.changePaintOpacity(this._actor.level() >= learning.level);
      this.drawText(this.skillName(skill), left, top, 130);
      this.contents.fontSize = 16;
      this.changeTextColor(ColorManager.normalColor());
      if (skill.stypeId == 2) {
        this.drawText(TextManager.passive, left + 134, top, 84, "right");
      } else {
        if (ConfigManager.language == "jp") {
          this.drawText(TextManager.probability, left + 130, top, 120);
        }
        this.changeTextColor("#84ecff");
        this.drawText(
          this._actor.skillRate(skill) + "％",
          left,
          top,
          220,
          "right"
        );
      }
      this.changeTextColor(ColorManager.normalColor());
      var value = this.skillValue(skill);
      var texts = this.skillDescs(skill);
      this.drawText(texts[0].format(value), left, top + lh * 1, 220);
      if (texts.length > 1) {
        this.drawText(texts[1].format(value), left, top + lh * 2, 220);
      }
    };
    Window_FormationDetail.prototype.skillDescs = function (skill) {
      switch (ConfigManager.language) {
        case "en":
          var result = [];
          if (skill.meta["descEn"]) {
            result.push(skill.meta["descEn"]);
          }
          if (skill.meta["desc1En"]) {
            result.push(skill.meta["desc1En"]);
          }
          if (skill.meta["desc2En"]) {
            result.push(skill.meta["desc2En"]);
          }
          if (result.length > 0) {
            return result;
          }
          break;
        case "ch":
        case "jp":
          break;
      }
      return skill.description.split("\n");
    };
    Window_FormationDetail.prototype.skillName = function (skill) {
      switch (ConfigManager.language) {
        case "en":
          if (skill.meta["nameEn"]) {
            return skill.meta["nameEn"];
          }
          break;
        case "ch":
        case "jp":
          break;
      }
      return skill.name;
    };
    Window_FormationDetail.prototype.skillValue = function (skill) {
      var valueMetaList = SKILL_VALUE_META_LIST;
      for (
        var _i = 0, valueMetaList_1 = valueMetaList;
        _i < valueMetaList_1.length;
        _i++
      ) {
        var m = valueMetaList_1[_i];
        if (skill.meta[m]) {
          return skill.meta[m];
        }
      }
      return 0;
    };
    return Window_FormationDetail;
  })(Window_FormationSelectable);
  Nore.Window_FormationDetail = Window_FormationDetail;
  var Window_FormationFilter = /** @class */ (function (_super) {
    __extends(Window_FormationFilter, _super);
    function Window_FormationFilter() {
      var _this = this;
      var r = new Rectangle(Nore.MAIN_MENU_W, 270, FORMATION_W, 72);
      _this = _super.call(this, r) || this;
      _this.makeData();
      _this.refresh();
      return _this;
    }
    Window_FormationFilter.prototype.makeData = function () {
      this._data = [];
      this._data.push(
        new FormationFilter(MonsterRare.none, MonsterElement.none)
      );
      this._data.push(
        new FormationFilter(MonsterRare.common, MonsterElement.none)
      );
      this._data.push(
        new FormationFilter(MonsterRare.rare, MonsterElement.none)
      );
      this._data.push(new FormationFilter(MonsterRare.sr, MonsterElement.none));
      this._data.push(
        new FormationFilter(MonsterRare.ssr, MonsterElement.none)
      );
      this._data.push(
        new FormationFilter(MonsterRare.none, MonsterElement.flame)
      );
      this._data.push(
        new FormationFilter(MonsterRare.none, MonsterElement.water)
      );
      this._data.push(
        new FormationFilter(MonsterRare.none, MonsterElement.wood)
      );
    };
    Window_FormationFilter.prototype.maxCols = function () {
      return this.maxItems();
    };
    Window_FormationFilter.prototype.maxItems = function () {
      if (this._data) {
        return this._data.length;
      }
      return 0;
    };
    Window_FormationFilter.prototype.drawItem = function (index) {
      var item = this._data[index];
      if (!item) {
        this.drawOrder(index);
        return;
      }
      var rect = this.itemRect(index);
      if (this.isSelected(item)) {
        this.contents.fillRect(
          rect.x,
          rect.y,
          rect.width,
          rect.height,
          "#777711"
        );
      }
      if (item.rare() != MonsterRare.none) {
        this.drawIcon(item.iconIndex(), rect.x + 5 + item.iconX(), rect.y + 5);
        this.contents.fontSize = 14;
        var text = this.rareMonsterText(item.rare());
        this.drawText(text, rect.x + 20, rect.y + 12, 64, "right");
      } else {
        this.contents.fontSize = 26;
        this.contents.fontBold = true;
        this.changeTextColor(item.textColor());
        this.changeOutlineColor(item.outlineColor());
        this.drawText(item.name(), rect.x, rect.y + 2, rect.width, "center");
        this.contents.fontBold = false;
      }
      this.changeTextColor(ColorManager.normalColor());
      this.changeOutlineColor(ColorManager.outlineColor());
    };
    Window_FormationFilter.prototype.rareMonsterText = function (rare) {
      var n = 0;
      for (
        var _i = 0, _a = $slg.formation().allMembers();
        _i < _a.length;
        _i++
      ) {
        var a = _a[_i];
        if (a.rare() == rare) {
          n++;
        }
      }
      var total = 0;
      for (var key in KAIJIN_PARAMS) {
        var param = KAIJIN_PARAMS[key];
        if (param[0] == rare) {
          total++;
        }
      }
      return n + "/" + total;
    };
    Window_FormationFilter.prototype.drawOrder = function (index) {
      var rect = this.itemRect(index);
      var sort = $slg.formation().sortValue();
      var text = "新着順";
      switch (sort) {
        case MonsterSort.rare:
          text = "レア順";
          break;
        case MonsterSort.element:
          text = "属性順";
          break;
      }
      this.drawText(text, rect.x, rect.y, rect.width, "center");
    };
    Window_FormationFilter.prototype.isSelected = function (item) {
      if (item.element() != MonsterElement.none) {
        if ($slg.formation().isElementSelected(item.element())) {
          return true;
        }
      }
      if (item.rare() != MonsterRare.none) {
        if ($slg.formation().isRareSelected(item.rare())) {
          return true;
        }
      }
      return false;
    };
    Window_FormationFilter.prototype.processTouch = function () {
      if (!this.active) {
        if (TouchInput.isTriggered()) {
          this.onTouchSelect(true);
        }
        return;
      }
      _super.prototype.processTouch.call(this);
    };
    Window_FormationFilter.prototype._refreshCursor = function () {};
    Window_FormationFilter.prototype.onTouchSelect = function (trigger) {
      this._doubleTouch = false;
      if (!this.active) {
        var lastIndex = this.index();
        var hitIndex = this.hitIndex();
        if (hitIndex >= 0) {
          if (hitIndex === this.index()) {
            this._doubleTouch = true;
          }
          SoundManager.playCursor();
          this.select(hitIndex);
        }
        return;
      }
      _super.prototype.onTouchSelect.call(this, trigger);
    };
    Window_FormationFilter.prototype.select = function (index) {
      if (!this._data) {
        return;
      }
      _super.prototype.select.call(this, index);
      var item = this._data[index];
      if (index == 0) {
        $slg.formation().clearRareFilter();
        $slg.formation().clearElementFilter();
        this.refresh();
        return;
      }
      if (index == this.maxItems()) {
        $slg.formation().changeSort();
        this.refresh();
        return;
      }
      if (item.element() != MonsterElement.none) {
        $slg.formation().putElementFilter(item.element());
        this.refresh();
      }
      if (item.rare() != MonsterRare.none) {
        $slg.formation().putRareFilter(item.rare());
        this.refresh();
      }
    };
    Window_FormationFilter.prototype.itemRect = function (index) {
      var r = _super.prototype.itemRect.call(this, index);
      r.y += 2;
      return r;
    };
    return Window_FormationFilter;
  })(Window_Selectable);
  Nore.Window_FormationFilter = Window_FormationFilter;
  var Window_FormationLevelUp = /** @class */ (function (_super) {
    __extends(Window_FormationLevelUp, _super);
    function Window_FormationLevelUp() {
      var _this = this;
      var r = new Rectangle(560, 72, 400, 530);
      _this = _super.call(this, r) || this;
      _this.makeData();
      _this.refresh();
      _this.setHandler("cancel", _this.onCancel.bind(_this));
      return _this;
    }
    Window_FormationLevelUp.prototype.setup = function (
      actor,
      onOk,
      onCancel,
      onTraining
    ) {
      this._actor = actor;
      this._onOk = onOk;
      this._onCancel = onCancel;
      this._onTraining = onTraining;
      this.refresh();
      this.visible = true;
      this.activate();
      this.select(-1);
    };
    Window_FormationLevelUp.prototype.makeData = function () {
      if ($slg.facilityInfo().hasFacility(28)) {
        this._data = ["OK", "CANCEL", TextManager.training];
      } else {
        this._data = ["OK", "CANCEL"];
      }
    };
    Window_FormationLevelUp.prototype.maxItems = function () {
      if (this._data) {
        return this._data.length;
      }
      return 0;
    };
    Window_FormationLevelUp.prototype.maxCols = function () {
      return 3;
    };
    Window_FormationLevelUp.prototype.itemRect = function (index) {
      var rect = _super.prototype.itemRect.call(this, index);
      rect.x += 74;
      rect.y += 424;
      if (index == 2) {
        rect.x = 166;
        rect.y = 108;
      }
      return rect;
    };
    Window_FormationLevelUp.prototype.itemHeight = function () {
      return 44;
    };
    Window_FormationLevelUp.prototype.itemWidth = function () {
      return 120;
    };
    Window_FormationLevelUp.prototype.drawItem = function (index) {
      this.contents.fontSize = 20;
      var rect = this.itemRect(index);
      var item = this._data[index];
      this.changePaintOpacity(true);
      if (index == 0) {
        this.changePaintOpacity(this.canLevelUp());
      }
      this.drawText(item, rect.x, rect.y + 2, rect.width, "center");
    };
    Window_FormationLevelUp.prototype.refresh = function () {
      _super.prototype.refresh.call(this);
      this.removeTutoArrow();
      if (!this._actor) {
        return;
      }
      this.refreshLabel();
      this.drawDetail();
      this.drawTitle();
      this.drawParams();
      this.drawTraining();
    };
    Window_FormationLevelUp.prototype.removeTutoArrow = function () {
      if (this._tutoArrow) {
        this.removeChild(this._tutoArrow);
        this._tutoArrow = null;
      }
    };
    Window_FormationLevelUp.prototype.refreshLabel = function () {
      var s = this.getSprite(0, 264, 60, 130);
      s.x = 80;
      s.y = 254;
      this._windowContentsSprite.addChild(s);
    };
    Window_FormationLevelUp.prototype.getSprite = function (x, y, w, h) {
      var baseTexture = Nore.getSystemBaseTexture("gacha");
      var r = new Rectangle(x, y, w, h);
      var texture = new PIXI.Texture(baseTexture, r);
      var s = new PIXI.Sprite(texture);
      return s;
    };
    Window_FormationLevelUp.prototype.isOkEnabled = function () {
      if (!this._actor) {
        return false;
      }
      return true;
    };
    Window_FormationLevelUp.prototype.canLevelUp = function () {
      if (!this._actor) {
        return false;
      }
      return this._actor.levelUpCost() <= $gameParty.gold();
    };
    Window_FormationLevelUp.prototype.callOkHandler = function () {
      Input.clear();
      TouchInput.clear();
      if (!this._onOk) {
        return;
      }
      switch (this.index()) {
        case 0:
          if (!this.canLevelUp()) {
            SoundManager.playBuzzer();
            this.activate();
            return;
          }
          this._onOk.call(this);
          this.refresh();
          break;
        case 1:
          this._onCancel.call(this);
          this.hide();
          break;
        case 2:
          this._onTraining.call(this);
          this.hide();
          break;
        default:
          this.activate();
          return;
      }
    };
    Window_FormationLevelUp.prototype.onCancel = function () {
      this.hide();
      this._onCancel.call(this);
    };
    Window_FormationLevelUp.prototype.drawDetail = function () {
      this.changeTextColor(ColorManager.normalColor());
      var actor = this._actor;
      var rect = new Rectangle(50, 60, 120, 120);
      this.drawFormationRect(rect, actor, false, 0);
    };
    Window_FormationLevelUp.prototype.drawTitle = function () {
      this.contents.fontSize = 24;
      this.drawText(TextManager.formationLevelUp, 0, 10, 370, "center");
    };
    Window_FormationLevelUp.prototype.drawParams = function () {
      var copy = JsonEx.makeDeepCopy(this._actor);
      copy.levelUp();
      if (this.canLevelUp()) {
        this.drawIcon(Icon.gold2, 70, 194);
        this.drawParam(
          0,
          "GOLD",
          $gameParty.gold(),
          $gameParty.gold() - this._actor.levelUpCost()
        );
      } else {
        this.drawText("Insufficient Ｇ", 70, 180, 200);
      }
      this.drawParam(1, "LV", this._actor.level(), copy.level());
      this.drawParam(2, "HP", this._actor.mhp(), copy.mhp());
      this.drawParam(3, "ATK", this._actor.atk(), copy.atk());
      this.drawParam(
        4,
        TextManager.interval,
        this._actor.agiText(),
        copy.agiText()
      );
      if (this._actor.skills().length < copy.skills().length) {
        this.drawNewSkill();
      }
    };
    Window_FormationLevelUp.prototype.drawParam = function (
      index,
      title,
      param,
      after
    ) {
      var xx = 100;
      var yy = 192 + index * 32;
      if (index > 0) {
        yy += 15;
      }
      this.contents.fontSize = 22;
      //this.drawText(title, xx, yy, 100);
      this.drawText(param + "", xx, yy, 105, "right");
      this.drawText("→", xx + 124, yy, 45, "left");
      this.drawText(after + "", xx, yy, 205, "right");
    };
    Window_FormationLevelUp.prototype.drawNewSkill = function () {
      this.changeTextColor("#84ecff");
      this.drawText(TextManager.learnNewSkill, 88, 372, 200, "center");
    };
    Window_FormationLevelUp.prototype.drawTraining = function () {
      this.contents.fontSize = 16;
      this.changeTextColor(ColorManager.normalColor());
      if (!$slg.facilityInfo().hasFacility(28)) {
        return;
      }
      this.addTutoArrow(200, 50);
      var trainingInfo = $slg.formation().trainingInfo();
      var time = trainingInfo.calcTrainingTime(this._actor);
      var yy = 52;
      this.drawText(TextManager.trainingTime, 170, yy, 90);
      var sec = Math.floor(time / 60);
      if (sec > 60) {
        var min = Math.floor(sec / 60);
        sec = sec % 60;
        this.drawText(
          TextManager.levelUpMinSec.format(min, sec),
          170,
          yy,
          180,
          "right"
        );
      } else {
        this.drawText(
          TextManager.levelUpSec.format(sec),
          170,
          yy,
          150,
          "right"
        );
      }
      if (!trainingInfo.isEmpty()) {
        this.changeTextColor(ColorManager.crisisColor());
        this.drawText(
          TextManager.inTraining.format(trainingInfo.actorName()),
          170,
          75,
          220,
          "left"
        );
        this.changeTextColor(ColorManager.normalColor());
      }
    };
    Window_FormationLevelUp.prototype.addTutoArrow = function (x, y) {
      if (this._tutoArrow) {
        return;
      }
      if ($gameTutorial.nextTarget() != TextManager.target_0_3) {
        return;
      }
      var baseTexture2 = Nore.getSystemBaseTexture("0213_sys");
      var texture = new PIXI.Texture(baseTexture2);
      var sprite = new PIXI.Sprite(texture);
      sprite.x = x + 87;
      sprite.y = y + 50;
      //sprite.rotation = 90 / 180 * Math.PI;
      this._tutoArrow = sprite;
      this._windowContentsSprite.addChild(sprite);
    };
    return Window_FormationLevelUp;
  })(Window_FormationSelectable);
  Nore.Window_FormationLevelUp = Window_FormationLevelUp;
})(Nore || (Nore = {}));
var MonsterSort;
(function (MonsterSort) {
  MonsterSort[(MonsterSort["newArrival"] = 0)] = "newArrival";
  MonsterSort[(MonsterSort["rare"] = 1)] = "rare";
  MonsterSort[(MonsterSort["element"] = 2)] = "element";
})(MonsterSort || (MonsterSort = {}));
var FormationFilter = /** @class */ (function () {
  function FormationFilter(rare, element) {
    this._rare = rare;
    this._element = element;
  }
  FormationFilter.prototype.rare = function () {
    return this._rare;
  };
  FormationFilter.prototype.element = function () {
    return this._element;
  };
  FormationFilter.prototype.name = function () {
    switch (this._rare) {
      case MonsterRare.common:
        return "N";
      case MonsterRare.rare:
        return "R";
      case MonsterRare.sr:
        return "SR";
      case MonsterRare.ssr:
        return "SSR";
    }
    switch (this._element) {
      case MonsterElement.flame:
        return TextManager.flame;
      case MonsterElement.water:
        return TextManager.water;
      case MonsterElement.wood:
        return TextManager.wood;
    }
    return TextManager.reset;
  };
  FormationFilter.prototype.iconIndex = function () {
    switch (this._rare) {
      case MonsterRare.common:
        return Icon.n;
      case MonsterRare.rare:
        return Icon.r;
      case MonsterRare.sr:
        return Icon.sr;
      case MonsterRare.ssr:
        return Icon.ssr;
    }
    return -1;
  };
  FormationFilter.prototype.iconX = function () {
    switch (this._rare) {
      case MonsterRare.common:
        return 12;
      case MonsterRare.rare:
        return 12;
      case MonsterRare.sr:
        return 6;
    }
    return 0;
  };
  FormationFilter.prototype.textColor = function () {
    switch (this._element) {
      case MonsterElement.flame:
        return MonsterElementStringColor.flame;
      case MonsterElement.water:
        return MonsterElementStringColor.water;
      case MonsterElement.wood:
        return MonsterElementStringColor.wood;
    }
    return ColorManager.normalColor();
  };
  FormationFilter.prototype.outlineColor = function () {
    switch (this._element) {
      case MonsterElement.flame:
      case MonsterElement.water:
      case MonsterElement.wood:
        return "rgba(255, 255, 255, 0.9)";
    }
    return ColorManager.outlineColor();
  };
  return FormationFilter;
})();
function getFrameSprite(rare, element) {
  var baseTexture2 = Nore.getSystemBaseTexture("Frame");
  var rect = new Rectangle(88 * (rare - 1), 0, 88, 89);
  var texture = new PIXI.Texture(baseTexture2, rect);
  var sprite = new PIXI.Sprite(texture);
  var index = -1;
  switch (element) {
    case MonsterElement.flame:
      index = 0;
      break;
    case MonsterElement.water:
      index = 1;
      break;
    case MonsterElement.wood:
      index = 2;
      break;
  }
  if (index >= 0) {
    var rect2 = new Rectangle(88 * index, 89, 88, 89);
    var texture2 = new PIXI.Texture(baseTexture2, rect2);
    var sprite2 = new PIXI.Sprite(texture2);
    sprite.addChild(sprite2);
  }
  return sprite;
}


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 _Game_Message_prototype_clear = Game_Message.prototype.clear;
Game_Message.prototype.clear = function () {
  _Game_Message_prototype_clear.call(this);
  this._gizagiza = false;
};
Game_Message.prototype.gizagiza = function () {
  return this._gizagiza;
};
Game_Message.prototype.setGizagiza = function (b) {
  this._gizagiza = b;
};
Game_Interpreter.prototype.command101 = function (params) {
  if ($gameMessage.isBusy()) {
    return false;
  }
  $gameMessage.setFaceImage(params[0], params[1]);
  $gameMessage.setBackground(params[2]);
  $gameMessage.setPositionType(params[3]);
  $gameMessage.setSpeakerName(params[4]);
  $gameMessage.setGizagiza(params[5]);
  while (this.nextEventCode() === 401) {
    // Text data
    this._index++;
    $gameMessage.add(this.currentCommand().parameters[0]);
  }
  switch (this.nextEventCode()) {
    case 102: // Show Choices
      this._index++;
      this.setupChoices(this.currentCommand().parameters);
      break;
    case 103: // Input Number
      this._index++;
      this.setupNumInput(this.currentCommand().parameters);
      break;
    case 104: // Select Item
      this._index++;
      this.setupItemChoice(this.currentCommand().parameters);
      break;
  }
  this.setWaitMode("message");
  return true;
};
var Fukidashi;
(function (Fukidashi) {
  Fukidashi[(Fukidashi["none"] = 0)] = "none";
  Fukidashi[(Fukidashi["left"] = 1)] = "left";
  Fukidashi[(Fukidashi["center"] = 2)] = "center";
  Fukidashi[(Fukidashi["right"] = 3)] = "right";
})(Fukidashi || (Fukidashi = {}));
var MessageWindowType;
(function (MessageWindowType) {
  MessageWindowType[(MessageWindowType["w688"] = 688)] = "w688";
  MessageWindowType[(MessageWindowType["w628"] = 628)] = "w628";
  MessageWindowType[(MessageWindowType["w550"] = 550)] = "w550";
})(MessageWindowType || (MessageWindowType = {}));
var MessageBackSprite = /** @class */ (function (_super) {
  __extends(MessageBackSprite, _super);
  function MessageBackSprite() {
    var _this = _super.call(this) || this;
    _this.bitmap = new Bitmap(715, 258);
    _this.x = -25;
    _this.y = -110;
    return _this;
  }
  MessageBackSprite.prototype.setType = function (type) {
    if (this._type == type) {
      return;
    }
    this._type = type;
    this.refresh();
  };
  MessageBackSprite.prototype.setName = function (name) {
    if (this._name == name) {
      return;
    }
    this._name = name;
    this.refresh();
  };
  MessageBackSprite.prototype.setFukidashi = function (fukidashi) {
    if (this._fukidashi == fukidashi) {
      return;
    }
    this._fukidashi = fukidashi;
    this.refresh();
  };
  MessageBackSprite.prototype.refresh = function () {
    this.bitmap.clear();
    this.refreshBase();
    this.refreshFukidashi();
  };
  MessageBackSprite.prototype.refreshBase = function () {
    switch (this._type) {
      case MessageWindowType.w688:
        this.refreshW688();
        break;
      case MessageWindowType.w628:
        this.refreshW628();
        break;
      case MessageWindowType.w550:
        this.refreshW550();
        break;
    }
  };
  MessageBackSprite.prototype.refreshW688 = function () {
    var bitmap = ImageManager.loadSystem("msg_window");
    this.bitmap.blt(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0);
  };
  MessageBackSprite.prototype.refreshW628 = function () {
    var bitmap = ImageManager.loadSystem("msg_window_628");
    this.bitmap.blt(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0);
  };
  MessageBackSprite.prototype.refreshW550 = function () {
    var bitmap = ImageManager.loadSystem("msg_window_550");
    this.bitmap.blt(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0);
  };
  MessageBackSprite.prototype.refreshFukidashi = function () {
    if (!this._name || this._name.length == 0) {
      return;
    }
    switch (this._fukidashi) {
      case Fukidashi.none:
        this.refreshFukidashiNone();
        return;
      case Fukidashi.left:
        this.refreshFukidashiNone();
        this.refreshFukidashiLeft();
        return;
      case Fukidashi.right:
        this.refreshFukidashiNone();
        this.refreshFukidashiRight();
        return;
      case Fukidashi.center:
        this.refreshFukidashiNone();
        this.refreshFukidashiCenter();
        return;
    }
  };
  MessageBackSprite.prototype.refreshFukidashiLeft = function () {
    var bitmap2 = ImageManager.loadSystem("msg_window_option");
    this.bitmap.clearRect(0, 0, 200, 92);
    this.bitmap.blt(bitmap2, 0, 0, 200, 92, 2, 0, 200, 92);
  };
  MessageBackSprite.prototype.refreshFukidashiNone = function () {
    var bitmap2 = ImageManager.loadSystem("msg_window_option");
    if (this.isLongName()) {
      this.bitmap.clearRect(0, 0, 367, 128);
      this.bitmap.blt(bitmap2, 60, 126, 360, 64, 14, 65);
    } else {
      this.bitmap.clearRect(0, 0, 250 + 14, 123);
      this.bitmap.blt(bitmap2, 60, 190, 250, 64, 14, 59);
    }
  };
  MessageBackSprite.prototype.isLongName = function () {
    if (!this._name) {
      return false;
    }
    var regExp = /N\[([0-9]+)\]/g;
    var result = regExp.exec(this._name);
    if (!result) {
      return false;
    }
    var actorId = parseInt(result[1]);
    if (actorId > 0) {
      return $gameActors.actor(actorId).name().length >= 7;
    }
    return false;
  };
  MessageBackSprite.prototype.refreshFukidashiRight = function () {
    var bitmap2 = ImageManager.loadSystem("msg_window_option");
    this.bitmap.clearRect(600, 0, 350, 92);
    this.bitmap.blt(bitmap2, 600, 0, 350, 92, 600, 0);
  };
  MessageBackSprite.prototype.refreshFukidashiCenter = function () {
    var bitmap2 = ImageManager.loadSystem("msg_window_option");
    this.bitmap.clearRect(370, 0, 60, 92);
    this.bitmap.blt(bitmap2, 370, 0, 60, 92, 370, 0);
  };
  return MessageBackSprite;
})(Sprite);
var Window_NormalMessage = /** @class */ (function (_super) {
  __extends(Window_NormalMessage, _super);
  function Window_NormalMessage() {
    var _this = (_super !== null && _super.apply(this, arguments)) || this;
    _this._backType = -1;
    return _this;
  }
  Window_NormalMessage.prototype.initialize = function (rect) {
    _super.prototype.initialize.call(this, rect);
    this.frameVisible = false;
    this.backOpacity = ConfigManager.windowAlpha * 2.55;
  };
  Window_NormalMessage.prototype.updateSpeakerName = function () {
    this._nameBoxWindow.setName($gameMessage.speakerName());
    if (this._messageBack) {
      this._messageBack.setName($gameMessage.speakerName());
    }
  };
  Window_NormalMessage.prototype._createAllParts = function () {
    this._createContainer();
    this.createBgContainer();
    this._createBackSprite();
    this._createFrameSprite();
    this._createClientArea();
    this._createContentsBackSprite();
    this._createCursorSprite();
    this._createContentsSprite();
    this._createArrowSprites();
    this._createPauseSignSprites();
    this._backSprite.visible = false;
  };
  Window_NormalMessage.prototype._createFrameSprite = function () {
    _super.prototype._createFrameSprite.call(this);
    this._bgSprite = new Sprite();
    this._container.addChild(this._bgSprite);
  };
  Window_NormalMessage.prototype._updateContentsBack = function () {
    this._contentsBackSprite.visible = false;
  };
  Window_NormalMessage.prototype.createBgContainer = function () {
    this._bgContainer = new PIXI.Sprite();
    this._container.addChild(this._bgContainer);
    this.updateBackType();
    this._messageBack = new MessageBackSprite();
    this._container.addChild(this._messageBack);
  };
  Window_NormalMessage.prototype.updateBackType = function () {
    if (!this._messageBack) {
      return;
    }
    if (this._backType === $gameVariables.value(18)) {
      return;
    }
    this._messageBack.alpha = ConfigManager.windowAlpha / 100;
    this._bgContainer.destroyAndRemoveChildren();
    this._backType = $gameVariables.value(18);
    switch (this._backType) {
      case 0:
      case 6:
        this.setBack1();
        break;
      case 1:
      case 2:
        this.setBack2();
        break;
      case 3:
      case 4:
      case 7:
      case 8:
        this.setBack3();
        break;
      default:
        this.setBack2();
        break;
    }
  };
  Window_NormalMessage.prototype.setBack1 = function () {
    this._messageBack.setType(MessageWindowType.w688);
  };
  Window_NormalMessage.prototype.setBack2 = function () {
    this._messageBack.setType(MessageWindowType.w628);
  };
  Window_NormalMessage.prototype.setBack3 = function () {
    this._messageBack.setType(MessageWindowType.w550);
  };
  Window_NormalMessage.prototype.update = function () {
    if (this._lastInvisible) {
      this._lastInvisible = false;
      this.visible = true;
    }
    this._nameBoxWindow.visible = false;
    _super.prototype.update.call(this);
    if (this.isOpen()) {
      if ($gameTemp.isMessageVisible()) {
        this.visible = true;
        this._nameBoxWindow.visible = true;
      } else {
        this.visible = false;
        this._nameBoxWindow.visible = false;
      }
    } else {
    }
    this.updateX();
    this.updateY();
    this.updateWidth();
    this.updateBackType();
    //this.updateFukidashi();
  };
  Window_NormalMessage.prototype.updateOpen = function () {
    var last = this._opening;
    _super.prototype.updateOpen.call(this);
    if (last && !this._opening) {
      this.updateFukidashiNewPage();
    }
  };
  Window_NormalMessage.prototype.updateClose = function () {
    _super.prototype.updateClose.call(this);
    if (this._closing) {
      this._messageBack.setFukidashi(Fukidashi.none);
    }
  };
  Window_NormalMessage.prototype.updateFukidashiNewPage = function () {
    if ($gameMessage.speakerName().length == 0) {
      this._messageBack.setFukidashi(Fukidashi.none);
      return;
    }
    this.updateFukidashi();
  };
  Window_NormalMessage.prototype.updateFukidashi = function () {
    if (!this._messageBack) {
      return;
    }
    if ($gameVariables.value(18) != 0) {
      this._messageBack.setFukidashi(Fukidashi.none);
      return;
    }
    if (this._openness < 255) {
      this._messageBack.setFukidashi(Fukidashi.none);
      return;
    }
    switch ($gameVariables.value(12)) {
      case 0:
      case Nore.Tachie.CENTER3_POS:
        this._messageBack.setFukidashi(Fukidashi.none);
        break;
      case Nore.Tachie.LEFT_POS:
      case Nore.Tachie.CENTER2_POS:
        this._messageBack.setFukidashi(Fukidashi.left);
        break;
      case Nore.Tachie.RIGHT_POS:
        this._messageBack.setFukidashi(Fukidashi.right);
        break;
      case Nore.Tachie.CENTER_POS:
        this._messageBack.setFukidashi(Fukidashi.center);
        break;
    }
  };
  Window_NormalMessage.prototype.updateX = function () {
    switch ($gameVariables.value(18)) {
      case 0:
        if ($gameSwitches.value(43)) {
          if ($gameSwitches.value(17)) {
            this.x = 302;
          } else {
            this.x = 314 + 130;
          }
        } else {
          this.x = 314;
        }
        //this.x = 234;
        break;
      case 1:
        this.x = 0;
        break;
      case 2:
        this.x = 670;
        break;
      case 3:
        this.x = 0;
        break;
      case 4:
        this.x = 730;
        break;
      case 5:
        this.x = 314;
        break;
      default:
        this.x = 0;
        break;
    }
  };
  Window_NormalMessage.prototype.updateY = function () {
    switch ($gameVariables.value(18)) {
      case 10:
        this.y = 424;
        //this.x = 234;
        break;
      default:
        this.y = 652;
        break;
    }
  };
  Window_NormalMessage.prototype.updateWidth = function () {
    if (this.width != this.windowWidth()) {
      this.width = this.windowWidth();
    }
  };
  Window_NormalMessage.prototype.lineHeight = function () {
    return 34;
  };
  Window_NormalMessage.prototype.windowWidth = function () {
    switch ($gameVariables.value(18)) {
      case 0:
      case 6:
        return 688;
      //return 728;
      case 1:
      case 2:
        return 688;
      case 3:
        return 688;
      case 4:
      case 7:
      case 8:
        return 688;
      case 5:
        return 688;
      default:
        return 688;
    }
  };
  Window_NormalMessage.prototype.resetFontSettings = function () {
    this.contents.fontFace = $gameSystem.mainFontFace();
    this.contents.fontSize = 20;
    this.resetTextColor();
  };
  Window_NormalMessage.prototype.newLineX = function (textState) {
    var faceExists = $gameMessage.faceName() !== "";
    var faceWidth = ImageManager.faceWidth;
    var spacing = 20;
    var margin = faceExists ? faceWidth + spacing : 4;
    var offset = 5;
    switch (this._backType) {
      case 0:
        offset = 10;
        //offset = 45;
        break;
    }
    if ($gameSwitches.value(334)) {
      offset -= 17;
    }
    return textState.rtl ? this.innerWidth - margin : margin + offset;
  };
  Window_NormalMessage.prototype.newPage = function (textState) {
    this.contents.clear();
    this.resetFontSettings();
    this.clearFlags();
    this.updateSpeakerName();
    this.loadMessageFace();
    textState.x = textState.startX;
    textState.y = 0;
    textState.height = this.calcTextHeight(textState);
    this.updateFukidashiNewPage();
  };
  Window_NormalMessage.prototype._refreshPauseSign = function () {
    var sx = 144;
    var sy = 96;
    var p = 24;
    this._pauseSignSprite.bitmap = ImageManager.loadSystem("msg_window_option");
    this._pauseSignSprite.anchor.x = 0.5;
    this._pauseSignSprite.anchor.y = 1;
    this._pauseSignSprite.move(this.rightX(), this._height - 10);
    //if ($gameMessage.autoFlg()) {
    //    this._pauseSignSprite.setFrame(4, 140 + 20, 34, 50);
    //} else {
    this._pauseSignSprite.setFrame(4, 140, 34, 30);
    //}
    this._pauseSignSprite.alpha = 0;
  };
  Window_NormalMessage.prototype.rightX = function () {
    switch ($gameVariables.value(18)) {
      case 0:
        return 620;
      case 1:
      case 2:
        return 560;
      case 3:
        return 500;
      case 4:
        return 480;
    }
  };
  Window_NormalMessage.prototype.centerX = function () {
    switch ($gameVariables.value(18)) {
      case 0:
        return 320;
      case 1:
      case 2:
        return 360;
      case 3:
        return 300;
      case 4:
        return 280;
    }
  };
  Window_NormalMessage.prototype._updatePauseSign = function () {
    var sprite = this._pauseSignSprite;
    var x = Math.floor(this._animationCount / 16) % 2;
    var y = Math.floor(this._animationCount / 16 / 2) % 2;
    var sx = 144;
    var sy = 96;
    var p = 24;
    if (!this.pause) {
      sprite.alpha = 0;
    } else if (sprite.alpha < 1) {
      sprite.alpha = Math.min(sprite.alpha + 0.1, 1);
    }
    if ($gameMessage.autoFlg()) {
      this._pauseSignSprite.setFrame(4, 140 + 30, 40, 50);
    } else {
      this._pauseSignSprite.setFrame(4, 140, 40, 30);
    }
    this._pauseSignSprite.move(this.rightX() + 3, this._height + y - 10);
    //sprite.setFrame(sx + x * p, sy + y * p, p, p);
    sprite.visible = this.isOpen();
  };
  return Window_NormalMessage;
})(Window_Message);
var BitmapNoOutline = /** @class */ (function (_super) {
  __extends(BitmapNoOutline, _super);
  function BitmapNoOutline() {
    return (_super !== null && _super.apply(this, arguments)) || this;
  }
  BitmapNoOutline.prototype._drawTextOutline = function (
    text,
    tx,
    ty,
    maxWidth
  ) {};
  return BitmapNoOutline;
})(Bitmap);
var Window_Fukidashi = /** @class */ (function (_super) {
  __extends(Window_Fukidashi, _super);
  function Window_Fukidashi() {
    var _this = _super.call(this, new Rectangle(800, 0, 400, 200)) || this;
    _this.backOpacity = 0;
    _this.frameVisible = false;
    _this.refreshBack(null);
    _this.createFadeSprite();
    return _this;
  }
  Window_Fukidashi.prototype.createFadeSprite = function () {
    this._fadeSprite = new ScreenSprite();
    this.addChild(this._fadeSprite);
  };
  Window_Fukidashi.prototype.createContents = function () {
    var width = this.contentsWidth();
    var height = this.contentsHeight();
    this.destroyContents();
    this.contents = new BitmapNoOutline(width, height);
    this.contentsBack = new Bitmap(width, height);
    this.resetFontSettings();
  };
  Window_Fukidashi.prototype._createFrameSprite = function () {
    _super.prototype._createFrameSprite.call(this);
    this._bgSprite = new Sprite();
    this._container.addChild(this._bgSprite);
  };
  Window_Fukidashi.prototype.resetFontSettings = function () {
    this.contents.fontFace = $gameSystem.mainFontFace();
    this.contents.fontSize = 20;
    this.contents.fontBold = true;
    this.resetTextColor();
  };
  Window_Fukidashi.prototype.resetTextColor = function () {
    this.changeTextColor(ColorManager.textColor(15));
    this.changeOutlineColor(ColorManager.normalColor());
  };
  Window_Fukidashi.prototype.refreshBack = function (text) {
    this._bgSprite.removeChildren();
    var baseTexture = this.getBaseTexture();
    var texture = new PIXI.Texture(baseTexture);
    var type = 0;
    if ($gameMessage.gizagiza()) {
      type = 3;
    } else if (!$gameMessage.speakerName()) {
      type = 2;
    } else if (text && text.indexOf("（") == 0) {
      type = 1;
      this.changeOutlineColor("#bbb");
    } else {
      this.changeOutlineColor(ColorManager.normalColor());
    }
    texture.frame = new PIXI.Rectangle(
      512 * (type % 2),
      384 * Math.floor(type / 2),
      512,
      384
    );
    var sprite = new PIXI.Sprite(texture);
    sprite.x = -80;
    sprite.y = -80;
    this._bgSprite.addChild(sprite);
  };
  Window_Fukidashi.prototype.getBaseTexture = function () {
    var baseTexture = PIXI.utils.BaseTextureCache["system/fukidashi"];
    if (!baseTexture) {
      var bitmap = ImageManager.loadSystem("fukidashi");
      if (!bitmap.isReady()) {
        return;
      }
      baseTexture = new PIXI.BaseTexture(bitmap._image);
      baseTexture.imageUrl = "system/fukidashi";
      PIXI.utils.BaseTextureCache["system/fukidashi"] = baseTexture;
    }
    return baseTexture;
  };
  Window_Fukidashi.prototype.updatePlacement = function () {};
  Window_Fukidashi.prototype.update = function () {
    _super.prototype.update.call(this);
    this.visible = true;
    //this.opacity = $gameScreen.brightness();
    this._fadeSprite.opacity = 255 - $gameScreen.brightness();
    this.x = 800;
  };
  Window_Fukidashi.prototype.synchronizeNameBox = function () {};
  Window_Fukidashi.prototype.isAnySubWindowActive = function () {
    return false;
  };
  Window_Fukidashi.prototype.updateSpeakerName = function () {};
  Window_Fukidashi.prototype.startMessage = function () {
    var text = $gameMessage.allText();
    var textState = this.createTextState(text, 0, 0, 0);
    textState.x = this.newLineX(textState);
    textState.startX = textState.x;
    this._textState = textState;
    this.newPage(this._textState);
    this.updatePlacement();
    this.updateBackground();
    this.refreshBack(text);
    this.open();
  };
  Window_Fukidashi.prototype.terminateMessage = function () {
    //this.close();
    $gameMessage.clear();
  };
  Window_Fukidashi.prototype.newLineX = function (textState) {
    var faceExists = $gameMessage.faceName() !== "";
    var faceWidth = ImageManager.faceWidth;
    var spacing = 20;
    var margin = faceExists ? faceWidth + spacing : 4;
    return textState.rtl ? this.innerWidth - margin : margin + 50;
  };
  return Window_Fukidashi;
})(Window_Message);
Scene_Message.prototype.createMessageWindow = function () {
  var rect = this.messageWindowRect();
  this._messageWindow = new Window_NormalMessage(rect);
  this.addWindow(this._messageWindow);
};
Window_NameBox.prototype.updatePlacement = function () {
  this.width = this.windowWidth();
  this.height = this.windowHeight();
  var messageWindow = this._messageWindow;
  var offset = 53;
  /*if ($gameMessage.isRTL()) {
        this.x = messageWindow.x + messageWindow.width - this.width + offset;
    } else {
        this.x = messageWindow.x + offset;
    }*/
  this.x = messageWindow.x + 12;
  this.y = messageWindow.y - this.height + 14;
  if ($gameVariables.value(18) == 8) {
    this.y = 0;
  }
};
Window_NameBox.prototype.initialize = function () {
  Window_Base.prototype.initialize.call(this, new Rectangle());
  this.openness = 0;
  this._name = "";
  this.frameVisible = false;
  this._isWindow = false;
};
Window_NameBox.prototype.setBackgroundType = function (type) {
  this.opacity = 0;
};
Window_ChoiceList.prototype.initialize = function () {
  Window_Command.prototype.initialize.call(this, new Rectangle());
  this.createCancelButton();
  this.openness = 0;
  this.deactivate();
  this._background = 0;
  this._isWindow = false;
  this._canRepeat = false;
};

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 gacha
 *
 * @command decideGachaHalo
 * @text ガチャ背景IDを変数78番に代入
 *
 * @command showGachaResult
 * @text ガチャリザルト表示
 * @des ガチャリザルト表示
 * @arg battleActorId
 * @type number
 * @text battleActorId
 * @desc battleActorId
 *
 * @command showGachaResultList
 * @text ガチャリザルト５連表示
 * @des ガチャリザルト５連表示
 *
 * @command showGachaResultCharacter
 * @text ガチャリザルトキャラ表示
 * @des ガチャリザルトキャラ表示
 *
 * @command hideGachaResult
 * @text ガチャリザルト非表示
 * @des ガチャリザルト非表示
 *
 * @command joinActor
 * @text 怪人を追加
 * @des 怪人を追加
 * @arg actorId
 * @type number
 * @text actorId
 * @desc actorId
 * @arg level
 * @type number
 * @text level
 * @desc level
 *
 * @command showGachaRate
 * @text ガチャ確率表示
 * @des ガチャ確率表示
 *
 * @command hideGachaRate
 * @text ガチャ確率消す
 * @des ガチャ確率消す
 *
 * @command getGachaTicket
 * @text ガチャチケットを獲得
 * @des ガチャチケットを獲得
 *
 * @command showMonsterBonus
 * @text 怪人ボーナステキスト表示
 *
 * @command hideMonsterBonus
 * @text 怪人ボーナステキスト非表示
 */
var KAIJIN_ACTOR_ID_VAR = 64;
var Nore;
(function (Nore) {
  var pluginName = "Nore_Gacha";
  PluginManager.registerCommand(pluginName, "decideGachaHalo", function (args) {
    if ($gameSwitches.value(19)) {
      // ５連
      var list = $gameTemp.lastJoinBattleActorIdList;
      var varId = 76;
      for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
        var battleActorId = list_1[_i];
        var actor = $slg.formation().findBattleActor(battleActorId);
        if (!actor) {
          return;
        }
        if (actor.element() == MonsterElement.flame) {
          $gameVariables.setValue(varId, 2);
        }
        if (actor.element() == MonsterElement.water) {
          $gameVariables.setValue(varId, 1);
        }
        if (actor.element() == MonsterElement.wood) {
          $gameVariables.setValue(varId, 3);
        }
        varId++;
      }
    } else {
      var battleActorId = $gameTemp.lastJoinBattleActorId;
      var actor = $slg.formation().findBattleActor(battleActorId);
      if (!actor) {
        return;
      }
      var varId = 78;
      if (actor.element() == MonsterElement.flame) {
        $gameVariables.setValue(varId, 2);
      }
      if (actor.element() == MonsterElement.water) {
        $gameVariables.setValue(varId, 1);
      }
      if (actor.element() == MonsterElement.wood) {
        $gameVariables.setValue(varId, 3);
      }
    }
  });
  PluginManager.registerCommand(
    pluginName,
    "showGachaResultList",
    function (args) {
      var list = $gameTemp.lastJoinBattleActorIdList;
      var newList = $gameTemp.lastJoinBattleActorNewList;
      SceneManager._scene.showGachaResultList(list, newList);
    }
  );
  PluginManager.registerCommand(pluginName, "showGachaResult", function (args) {
    var battleActorId = parseInt(args.battleActorId);
    var isNew = false;
    if (isNaN(battleActorId) || battleActorId <= 0) {
      battleActorId = $gameTemp.lastJoinBattleActorId;
      isNew = $gameTemp.lastJoinBattleActorNew;
    }
    SceneManager._scene.showGachaResult(battleActorId, isNew);
  });
  PluginManager.registerCommand(
    pluginName,
    "showGachaResultCharacter",
    function (args) {
      var battleActorId = $gameTemp.lastJoinBattleActorId;
      var actor = $slg.formation().findBattleActor(battleActorId);
      if (!actor) {
        console.error(battleActorId + "のキャラが存在しません");
        return;
      }
      $gameVariables.setValue(KAIJIN_ACTOR_ID_VAR, actor.actorId());
    }
  );
  PluginManager.registerCommand(pluginName, "hideGachaResult", function (args) {
    SceneManager._scene.hideGachaResult();
  });
  PluginManager.registerCommand(pluginName, "joinActor", function (args) {
    var actorId = parseInt(args.actorId);
    var level = parseInt(args.level);
    var battleActorId = $slg.formation().addMember(actorId, level);
    $gameTemp.lastJoinBattleActorId = battleActorId;
  });
  PluginManager.registerCommand(pluginName, "showGachaRate", function (args) {
    var rareList = new Gacha().rareRate();
    SceneManager._scene.showGachaRate(rareList);
  });
  PluginManager.registerCommand(pluginName, "hideGachaRate", function (args) {
    SceneManager._scene.hideGachaRate();
  });
  PluginManager.registerCommand(pluginName, "getGachaTicket", function (args) {
    $gameSwitches.setValue(339, false);
    $gameSwitches.setValue(353, false);
    var actorId = $slg.formation().selectRandomMonster();
    p("ガチャチケ獲得:" + $gameActors.actor(actorId).name());
    var t = new GachaTicket(actorId);
    $gameParty.addGachaTicket(t);
  });
  PluginManager.registerCommand(
    pluginName,
    "showMonsterBonus",
    function (args) {
      var types = [
        FriendshipBonusType.atkFlame,
        FriendshipBonusType.atkWater,
        FriendshipBonusType.atkWood,
        FriendshipBonusType.hpFlame,
        FriendshipBonusType.hpWater,
        FriendshipBonusType.hpWood,
      ];
      for (var _i = 0, types_1 = types; _i < types_1.length; _i++) {
        var type = types_1[_i];
        var bonus = $gameParty.friendshipBonus(type);
        if (bonus) {
          $gameSwitches.setValue(20, true);
          SceneManager._scene.showMonsterBonus();
          return;
        }
      }
    }
  );
  PluginManager.registerCommand(
    pluginName,
    "hideMonsterBonus",
    function (args) {
      SceneManager._scene.hideMonsterBonus();
    }
  );
  var Sprite_GachaResult = /** @class */ (function (_super) {
    __extends(Sprite_GachaResult, _super);
    function Sprite_GachaResult(actor, isNew) {
      var _this = _super.call(this) || this;
      _this.x = Graphics.width / 2 - 100;
      _this.y = 236;
      var back = _this.getSprite(0, 0, 240, 230);
      back.y = 160;
      _this.addChild(back);
      var contents = new Sprite_GachaResultContents(actor);
      _this.addChild(contents);
      if (isNew) {
        var x = 0;
        switch (actor.rare()) {
          case MonsterRare.rare:
            x = 60;
            break;
          case MonsterRare.sr:
            x = 120;
            break;
          case MonsterRare.ssr:
            x = 180;
            break;
        }
        var newSprite = _this.getSprite(x, 230, 60, 30);
        newSprite.x = 79;
        newSprite.y = 0;
        _this.addChild(newSprite);
      }
      return _this;
    }
    Sprite_GachaResult.prototype.getSprite = function (x, y, w, h) {
      var baseTexture = Nore.getSystemBaseTexture("gacha");
      var r = new Rectangle(x, y, w, h);
      var texture = new PIXI.Texture(baseTexture, r);
      var s = new PIXI.Sprite(texture);
      return s;
    };
    return Sprite_GachaResult;
  })(Sprite);
  Nore.Sprite_GachaResult = Sprite_GachaResult;
  var Sprite_GachaResultContents = /** @class */ (function (_super) {
    __extends(Sprite_GachaResultContents, _super);
    function Sprite_GachaResultContents(actor) {
      var _this = _super.call(this) || this;
      _this.bitmap = new Bitmap(300, 400);
      _this._actor = actor;
      _this.refresh();
      return _this;
    }
    Sprite_GachaResultContents.prototype.refresh = function () {
      this.bitmap.clear();
      this.bitmap.outlineWidth = 5;
      var yy = 170;
      this.bitmap.textColor = ColorManager.normalColor();
      //this.bitmap.fillRect(0, yy, 200, 270, '#00000088');
      var actor = this._actor;
      this.bitmap.fontSize = 18;
      var frameX = 13;
      var frameY = 13;
      if (actor.rare() > 0) {
        var sprite = getFrameSprite(actor.rare(), actor.element());
        sprite.x = 50 + frameX;
        sprite.y = 16 + frameY;
        this.addChild(sprite);
      }
      this.drawRare(actor, yy);
      //this.bitmap.drawText(this.rareText(actor.rare()), 10, 0 + yy, 200, 40, 'left');
      this.bitmap.drawText(actor.name(), 50, yy - 4, 160, 40, "center");
      this.drawParam(0, "HP", this._actor.mhp(), yy);
      this.drawParam(1, "ATK", this._actor.atk(), yy);
      this.drawParam(2, TextManager.interval, this._actor.agi(), yy);
      this.drawSkill(actor.learnings(), yy);
      var u = new BattleUnitDir2(actor, false);
      var s = new Sprite_SlotUnit(u, new Rectangle(82, 100, 100, 100));
      this.addChild(s);
    };
    Sprite_GachaResultContents.prototype.drawRare = function (actor, y) {
      var x = 30;
      if (actor.rare() == MonsterRare.sr) {
        x -= 10;
      }
      if (actor.rare() == MonsterRare.ssr) {
        x -= 12;
      }
      this.drawIcon(this.rareIcon(actor.rare()), x, y);
    };
    Sprite_GachaResultContents.prototype.drawParam = function (
      index,
      title,
      param,
      yyy
    ) {
      var xx = 20;
      var yy = 40 + index * 33 + yyy;
      this.bitmap.fontSize = 22;
      //  this.bitmap.drawText(title, xx, yy, 100, 30);
      this.bitmap.drawText(param + "", xx, yy, 150, 30, "right");
    };
    Sprite_GachaResultContents.prototype.rareIcon = function (rare) {
      switch (rare) {
        case MonsterRare.common:
          return Icon.n;
        case MonsterRare.rare:
          return Icon.r;
        case MonsterRare.sr:
          return Icon.sr;
        case MonsterRare.ssr:
          return Icon.ssr;
      }
    };
    Sprite_GachaResultContents.prototype.drawSkill = function (learnings, yyy) {
      if (learnings.length == 0) {
        return;
      }
      var learning = learnings[0];
      var skill = $dataSkills[learning.skillId];
      var xx = 30;
      this.bitmap.fontSize = 18;
      this.bitmap.textColor = ColorManager.normalColor();
      this.bitmap.drawText(
        this.skillName(skill),
        xx,
        135 + yyy + 46,
        140,
        30,
        "right"
      );
    };
    Sprite_GachaResultContents.prototype.skillName = function (skill) {
      if (ConfigManager.language == "en") {
        if (skill.meta["nameEn"]) {
          return skill.meta["nameEn"];
        }
      }
      return skill.name;
    };
    return Sprite_GachaResultContents;
  })(Sprite);
  Nore.Sprite_GachaResultContents = Sprite_GachaResultContents;
  var Sprite_GachaResult5Ren = /** @class */ (function (_super) {
    __extends(Sprite_GachaResult5Ren, _super);
    function Sprite_GachaResult5Ren(actor, isNew, index) {
      var _this = _super.call(this) || this;
      var point = _this.positionByIndex(index);
      _this.x = point.x;
      _this.y = point.y;
      _this.bitmap = new Bitmap(300, 300);
      _this._actor = actor;
      _this._isNew = isNew;
      _this.refresh();
      return _this;
    }
    Sprite_GachaResult5Ren.prototype.positionByIndex = function (index) {
      switch (index) {
        case 0:
          return new Point(Graphics.width / 2 - 100 - 200, 236);
        case 1:
          return new Point(Graphics.width / 2 - 100 - 100, 286);
        case 2:
          return new Point(Graphics.width / 2 - 100, 236);
        case 3:
          return new Point(Graphics.width / 2 - 100 + 100, 286);
        case 4:
          return new Point(Graphics.width / 2 - 100 + 200, 236);
      }
      return new Point(0, 0);
    };
    Sprite_GachaResult5Ren.prototype.refresh = function () {
      this.bitmap.clear();
      var actor = this._actor;
      if (this._isNew) {
        this.drawNew(actor.rare());
      }
      this.bitmap.fontSize = 20;
      var frameX = 13;
      var frameY = 13;
      if (actor.rare() > 0) {
        var sprite = getFrameSprite(actor.rare(), actor.element());
        sprite.x = 50 + frameX;
        sprite.y = 16 + frameY;
        this.addChild(sprite);
      }
      var u = new BattleUnitDir2(actor, false);
      var s = new Sprite_SlotUnit(u, new Rectangle(82, 100, 100, 100));
      this.addChild(s);
    };
    Sprite_GachaResult5Ren.prototype.drawNew = function (rare) {
      var x = 0;
      switch (rare) {
        case MonsterRare.rare:
          x = 60;
          break;
        case MonsterRare.sr:
          x = 120;
          break;
        case MonsterRare.ssr:
          x = 180;
          break;
      }
      var newSprite = this.getSprite(x, 230, 60, 30);
      newSprite.x = 79;
      newSprite.y = 0;
      this.addChild(newSprite);
    };
    Sprite_GachaResult5Ren.prototype.getSprite = function (x, y, w, h) {
      var baseTexture = Nore.getSystemBaseTexture("gacha");
      var r = new Rectangle(x, y, w, h);
      var texture = new PIXI.Texture(baseTexture, r);
      var s = new PIXI.Sprite(texture);
      return s;
    };
    return Sprite_GachaResult5Ren;
  })(Sprite);
  Nore.Sprite_GachaResult5Ren = Sprite_GachaResult5Ren;
  var Sprite_GachaRate = /** @class */ (function (_super) {
    __extends(Sprite_GachaRate, _super);
    function Sprite_GachaRate(rate) {
      var _this = _super.call(this) || this;
      _this.x = Graphics.width / 2 + 66 + $gameVariables.value(9);
      _this.y = 256;
      var back = _this.getSprite(238, 0, 205, 200);
      _this.addChild(back);
      var y = 200;
      if (ConfigManager.language == "en") {
        y += 30;
      }
      var text = _this.getSprite(238, y, 200, 30);
      text.y = 8;
      _this.addChild(text);
      _this._contents = new Sprite_GachaRateContents(rate);
      _this.addChild(_this._contents);
      return _this;
    }
    Sprite_GachaRate.prototype.getSprite = function (x, y, w, h) {
      var baseTexture = Nore.getSystemBaseTexture("gacha");
      var r = new Rectangle(x, y, w, h);
      var texture = new PIXI.Texture(baseTexture, r);
      var s = new PIXI.Sprite(texture);
      return s;
    };
    return Sprite_GachaRate;
  })(Sprite);
  Nore.Sprite_GachaRate = Sprite_GachaRate;
  var Sprite_GachaRateContents = /** @class */ (function (_super) {
    __extends(Sprite_GachaRateContents, _super);
    function Sprite_GachaRateContents(rate) {
      var _this = _super.call(this) || this;
      _this.bitmap = new Bitmap(200, 200);
      _this._rateList = rate;
      _this.refresh();
      return _this;
    }
    Sprite_GachaRateContents.prototype.refresh = function () {
      this.bitmap.clear();
      this.bitmap.fontSize = 22;
      this.bitmap.outlineWidth = 5;
      //this.bitmap.fillRect(0, yy, 196, 180, '#00000088');
      var yy = 46;
      var xx = 20;
      for (var i = 0; i < this._rateList.length; i++) {
        var text = this.rareText(i + 1);
        var rate = this._rateList[i];
        //this.bitmap.drawText(text, xx, yy, 100, 30);
        this.bitmap.drawText(rate + "%", xx, yy, 140, 30, "right");
        yy += 34;
      }
    };
    Sprite_GachaRateContents.prototype.rareText = function (rare) {
      switch (rare) {
        case MonsterRare.common:
          return "N";
        case MonsterRare.rare:
          return "R";
        case MonsterRare.sr:
          return "SR";
        case MonsterRare.ssr:
          return "SSR";
      }
    };
    return Sprite_GachaRateContents;
  })(Sprite);
  Nore.Sprite_GachaRateContents = Sprite_GachaRateContents;
  var BomusItem = /** @class */ (function () {
    function BomusItem(_type, _value) {
      this._type = _type;
      this._value = _value;
    }
    BomusItem.prototype.type = function () {
      return this._type;
    };
    BomusItem.prototype.value = function () {
      return this._value;
    };
    return BomusItem;
  })();
  var Sprite_MonsterBonus = /** @class */ (function (_super) {
    __extends(Sprite_MonsterBonus, _super);
    function Sprite_MonsterBonus(h) {
      var _this = this;
      var r = new Rectangle(300, 200, 360, 100);
      _this = _super.call(this, r) || this;
      _this.makeItems();
      _this.height = _this._items.length * _this.itemHeight() + 24;
      _this.createContents();
      _this.refresh();
      return _this;
    }
    Sprite_MonsterBonus.prototype.makeItems = function () {
      this._items = [];
      var types = [
        FriendshipBonusType.atkFlame,
        FriendshipBonusType.atkWater,
        FriendshipBonusType.atkWood,
        FriendshipBonusType.hpFlame,
        FriendshipBonusType.hpWater,
        FriendshipBonusType.hpWood,
      ];
      for (var _i = 0, types_2 = types; _i < types_2.length; _i++) {
        var type = types_2[_i];
        var bonus =
          $gameParty.friendshipBonus(type) *
          $gameParty.friendshipBonusRate(type);
        if (bonus) {
          this._items.push(new BomusItem(type, bonus));
        }
      }
    };
    Sprite_MonsterBonus.prototype.maxItems = function () {
      if (this._items) {
        return this._items.length;
      }
      return 0;
    };
    Sprite_MonsterBonus.prototype.maxCols = function () {
      return 1;
    };
    Sprite_MonsterBonus.prototype.resetFontSettings = function () {
      _super.prototype.resetFontSettings.call(this);
      this.contents.fontSize = 24;
    };
    Sprite_MonsterBonus.prototype.drawItem = function (index) {
      var item = this._items[index];
      var rect = this.itemRect(index);
      var text = this.makeBonusLabel(item.type());
      this.drawTextEx(text, rect.x, rect.y, rect.width);
      this.drawText(
        "+ " + item.value(),
        rect.x,
        rect.y,
        rect.width - 20,
        "right"
      );
    };
    Sprite_MonsterBonus.prototype.makeBonusLabel = function (type) {
      switch (type) {
        case FriendshipBonusType.atkFlame:
          return TextManager.atkFlame2;
        case FriendshipBonusType.atkWater:
          return TextManager.atkWater2;
        case FriendshipBonusType.atkWood:
          return TextManager.atkWood2;
        case FriendshipBonusType.hpFlame:
          return TextManager.hpFlame2;
        case FriendshipBonusType.hpWater:
          return TextManager.hpWater2;
        case FriendshipBonusType.hpWood:
          return TextManager.hpWood2;
      }
    };
    Sprite_MonsterBonus.prototype.itemHeight = function () {
      return 40;
    };
    return Sprite_MonsterBonus;
  })(Window_Selectable);
  Nore.Sprite_MonsterBonus = Sprite_MonsterBonus;
})(Nore || (Nore = {}));
var Gacha = /** @class */ (function () {
  function Gacha() {}
  Gacha.prototype.decideRare = function () {
    var rareRate = this.rareRate();
    var dice = Math.randomInt(100);
    var remain = dice;
    for (var rare = 0; rare < rareRate.length; rare++) {
      var value = rareRate[rare];
      if (remain <= value) {
        return rare + 1;
      }
      remain -= value;
    }
    console.error("不正なレア度です:" + dice);
    console.error(rareRate);
    return MonsterRare.common;
  };
  Gacha.prototype.rareRate = function () {
    if ($gameSwitches.value(339)) {
      // SRボーナスガチャ
      return [0, 0, 100, 0];
    }
    if ($gameSwitches.value(353)) {
      // SSRボーナスガチャ
      return [0, 0, 0, 100];
    }
    if ($slg.facilityInfo().hasFacility(77)) {
      // 研究所LV5
      return [23, 31, 28, 18];
    }
    if ($slg.facilityInfo().hasFacility(74)) {
      // 研究所LV4
      return [34, 33, 23, 10];
    }
    if ($slg.facilityInfo().hasFacility(73)) {
      // 研究所LV3
      return [42, 33, 20, 5];
    }
    if ($slg.facilityInfo().hasFacility(72)) {
      // 研究所LV2
      return [55, 35, 10, 0];
    }
    if ($slg.facilityInfo().hasFacility(71)) {
      // 研究所LV1
      return [64, 33, 3, 0];
    }
    return [80, 20, 0, 0];
  };
  return Gacha;
})();
function isKaijinEvent(event) {
  if (!event) {
    return false;
  }
  if (!event.event()) {
    return false;
  }
  return event.event().meta["kaijin"] != null;
}
var Sprite_Kaijin = /** @class */ (function (_super) {
  __extends(Sprite_Kaijin, _super);
  function Sprite_Kaijin(event) {
    return _super.call(this, event) || this;
  }
  Sprite_Kaijin.prototype.updateBitmap = function () {
    if (this.isImageChanged()) {
      this._tilesetId = $gameMap.tilesetId();
      this._tileId = this._character.tileId();
      this._characterName = this.characterName();
      this._characterIndex = this.characterIndex();
      if (this._tileId > 0) {
        this.setTileBitmap();
      } else {
        this.setCharacterBitmap();
      }
    }
  };
  Sprite_Kaijin.prototype.characterName = function () {
    var id = $gameVariables.value(KAIJIN_ACTOR_ID_VAR);
    if (id <= 0) {
      return "";
    }
    var actor = $gameActors.actor(id);
    return actor.characterName();
  };
  Sprite_Kaijin.prototype.characterIndex = function () {
    var id = $gameVariables.value(KAIJIN_ACTOR_ID_VAR);
    if (id <= 0) {
      return 0;
    }
    var actor = $gameActors.actor(id);
    return actor.characterIndex();
  };
  Sprite_Kaijin.prototype.isImageChanged = function () {
    return (
      this._characterName !== this.characterName() ||
      this._characterIndex !== this.characterIndex()
    );
  };
  Sprite_Kaijin.prototype.characterBlockX = function () {
    if (this._isBigCharacter) {
      return 0;
    } else {
      var index = this.characterIndex();
      return (index % 4) * 3;
    }
  };
  Sprite_Kaijin.prototype.characterBlockY = function () {
    var index = this.characterIndex();
    return Math.floor(index / 4) * 4;
  };
  Sprite_Kaijin.prototype.characterPatternX = function () {
    return 1;
  };
  return Sprite_Kaijin;
})(Sprite_Character);


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 EffectType;
  (function (EffectType) {
    EffectType[(EffectType["none"] = -1)] = "none";
    EffectType[(EffectType["gold"] = 0)] = "gold";
    EffectType[(EffectType["mhp"] = 1)] = "mhp";
    EffectType[(EffectType["kikaku"] = 2)] = "kikaku";
  })((EffectType = Nore.EffectType || (Nore.EffectType = {})));
  var Sprite_Effect = /** @class */ (function (_super) {
    __extends(Sprite_Effect, _super);
    function Sprite_Effect(type1, value1, type2, value2) {
      if (type2 === void 0) {
        type2 = EffectType.none;
      }
      if (value2 === void 0) {
        value2 = -1;
      }
      var _this = _super.call(this) || this;
      _this._type1 = type1;
      _this._type2 = type2;
      _this._value1 = value1;
      _this._value2 = value2;
      _this._moveCount = 20;
      _this._waitCount = 60;
      _this.bitmap = new Bitmap(120, 80);
      _this.refresh();
      return _this;
    }
    Sprite_Effect.prototype.refresh = function () {
      var text = this.makeText1();
      this.bitmap.fontSize = 12;
      this.bitmap.textColor = ColorManager.crisisColor();
      this.bitmap.drawText(text, 0, 0, 120, 30, "center");
      var text2 = this.makeText2();
      if (text2) {
        this.bitmap.drawText(text2, 0, 20, 120, 30, "center");
      }
      this.playSound();
    };
    Sprite_Effect.prototype.playSound = function () {
      switch (this._type1) {
        case EffectType.gold:
          AudioManager.playSe({ name: "Coin", volume: 80, pitch: 100, pan: 0 });
          break;
        case EffectType.mhp:
          AudioManager.playSe({
            name: "Heal1",
            volume: 80,
            pitch: 140,
            pan: 0,
          });
          break;
      }
    };
    Sprite_Effect.prototype.makeText1 = function () {
      return this.makeText(this._type1, this.value1());
    };
    Sprite_Effect.prototype.makeText2 = function () {
      return this.makeText(this._type2, this.value2());
    };
    Sprite_Effect.prototype.makeText = function (type, value) {
      switch (type) {
        case EffectType.gold:
          return TextManager.money + " + %1".format(value);
      }
    };
    Sprite_Effect.prototype.value1 = function () {
      return this._value1;
    };
    Sprite_Effect.prototype.value2 = function () {
      return this._value2;
    };
    Sprite_Effect.prototype.update = function () {
      _super.prototype.update.call(this);
      this.updateMove();
      this.updateWait();
    };
    Sprite_Effect.prototype.updateMove = function () {
      if (this._moveCount == 0) {
        return;
      }
      this._moveCount--;
      this.y--;
    };
    Sprite_Effect.prototype.updateWait = function () {
      if (this._waitCount == 0) {
        this._waitCount = -1;
        if (this.parent) {
          this.parent.removeChild(this);
        }
        return;
      }
      this._waitCount--;
    };
    return Sprite_Effect;
  })(Sprite);
  Nore.Sprite_Effect = Sprite_Effect;
})(Nore || (Nore = {}));


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 Window_Help2 = /** @class */ (function (_super) {
  __extends(Window_Help2, _super);
  function Window_Help2() {
    return (_super !== null && _super.apply(this, arguments)) || this;
  }
  Window_Help2.prototype.baseTextRect = function () {
    var rect = new Rectangle(
      40,
      10,
      this.innerWidth - 80,
      this.innerHeight - 20
    );
    rect.pad(-this.itemPadding(), 0);
    return rect;
  };
  return Window_Help2;
})(Window_Help);