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 Sprite_DouseiSet = /** @class */ (function (_super) {
  __extends(Sprite_DouseiSet, _super);
  function Sprite_DouseiSet() {
    var _this = _super.call(this) || this;
    _this._douseiLayer = new Sprite();
    _this.addChild(_this._douseiLayer);
    _this.bitmap = new Bitmap(200, 60);
    _this.refresh();
    _this.x = 880;
    _this.y = 50;
    return _this;
  }
  Sprite_DouseiSet.prototype.refresh = function () {
    this.refreshChildren();
    if (this._douseiLayer.children.length > 0) {
      this.refreshTitle();
    }
  };
  Sprite_DouseiSet.prototype.refreshTitle = function () {
    this.bitmap.fillRect(0, 0, 200, 40, "#333333");
    this.bitmap.drawText("同棲中の女の子たち", 0, 0, 200, 30);
  };
  Sprite_DouseiSet.prototype.refreshChildren = function () {
    this._douseiLayer.removeChildren();
    var index = 0;
    var top = 40;
    for (var _i = 0, _a = $gameParty.getActorIdList(); _i < _a.length; _i++) {
      var actorId = _a[_i];
      var dousei = $gameActors.actor(actorId).dousei();
      if (!dousei.isActive()) {
        continue;
      }
      p("dousei");
      var s = new Sprite_Dousei(dousei, index);
      this._douseiLayer.addChild(s);
      index++;
    }
  };
  Sprite_DouseiSet.prototype.update = function () {
    _super.prototype.update.call(this);
    this.updateVisible();
  };
  Sprite_DouseiSet.prototype.updateVisible = function () {
    if ($gameMap._interpreter.isRunning()) {
      this.visible = false;
    } else {
      this.visible = true;
    }
  };
  return Sprite_DouseiSet;
})(Sprite);
var Sprite_Dousei = /** @class */ (function (_super) {
  __extends(Sprite_Dousei, _super);
  function Sprite_Dousei(dousei, yy) {
    var _this = _super.call(this) || this;
    _this._dousei = dousei;
    _this.y = yy;
    _this._eroSprite = new Sprite_DouseiH(dousei);
    _this.addChild(_this._eroSprite);
    _this.bitmap = new Bitmap(300, 129);
    _this._eroSprite.x = 0;
    _this._eroSprite.y = 26;
    _this._numberSprite = new Sprite();
    _this.addChild(_this._numberSprite);
    _this.refresh();
    return _this;
  }
  Sprite_Dousei.prototype.spriteHeight = function () {
    return 120;
  };
  Sprite_Dousei.prototype.update = function () {
    _super.prototype.update.call(this);
    //this.updateGold();
    if (this._dousei.isDirty()) {
      this._dousei.clearDirty();
      this.refresh();
    }
    if (this.isVisibleChanged()) {
      this.refresh();
    }
    /*if (this.isRestChanged()) {
            this.refresh();
        }*/
  };
  Sprite_Dousei.prototype.updateGold = function () {
    if (this._dousei.lastGainGold() > 0) {
      this.addGainGoldSprite(this._dousei.lastGainGold());
      this._dousei.clearLastGainGold();
    }
  };
  Sprite_Dousei.prototype.addGainGoldSprite = function (g) {
    var s = new Sprite_GainGold(g);
    s.x = 122;
    s.y = 18;
    this.addChild(s);
  };
  Sprite_Dousei.prototype.isVisibleChanged = function () {
    return this._lastVisible != this._eroSprite.visible;
  };
  Sprite_Dousei.prototype.isRestChanged = function () {
    return this._lastRest != this._dousei.isRest();
  };
  Sprite_Dousei.prototype.refresh = function () {
    this._numberSprite.removeChildren();
    this.bitmap.clear();
    this.refreshBack();
    this.refreshEroAnime();
    this.refreshText();
    this.refreshParams();
    this._lastVisible = this._eroSprite.visible;
  };
  Sprite_Dousei.prototype.refreshBack = function () {
    //this.bitmap.fillRect(0, 0, 200, 120, '#cccccc');
  };
  Sprite_Dousei.prototype.refreshParams = function () {
    if ($gameTemp.isIdleMode()) {
      return;
    }
    var upList = this._dousei.nextUpInfo();
    if (!upList) {
      return;
    }
    if (this._dousei.isRest()) {
      return;
    }
    for (var _i = 0, upList_1 = upList; _i < upList_1.length; _i++) {
      var up = upList_1[_i];
      this.drawNumber(
        this.upValueText1(up),
        167,
        87,
        48,
        "right",
        1,
        this._numberSprite
      );
      this.drawNumber(
        this.upValueText2(up),
        226,
        87,
        48,
        "right",
        1,
        this._numberSprite
      );
      this.drawIcon(up.iconIndex(), 152, 89);
      {
        var baseTexture = Nore.getSystemBaseTexture("main");
        var r2 = new Rectangle(0, 74, 20, 20);
        var texture2 = new PIXI.Texture(baseTexture, r2);
        var s2 = new PIXI.Sprite(texture2);
        s2.x = 224;
        s2.y = 101;
        this._numberSprite.addChild(s2);
      }
    }
  };
  Sprite_Dousei.prototype.upValueText1 = function (up) {
    var value = this._dousei.actor().eroParam(up.type);
    var text1 = Math.floor(value / 10);
    var text2 = value % 10;
    return text1 + "." + text2;
  };
  Sprite_Dousei.prototype.upValueText2 = function (up) {
    var value = this._dousei.actor().eroParam(up.type);
    var value2 = value + up.up;
    var text1 = Math.floor(value2 / 10);
    var text2 = value2 % 10;
    return text1 + "." + text2;
  };
  Sprite_Dousei.prototype.refreshEroAnime = function () {
    this._eroSprite.stop();
    if (!this._dousei.isActive()) {
      this._eroSprite.visible = false;
      return;
    }
    if (this._dousei.manId() == 0) {
      return;
    }
    this._eroSprite.visible = true;
    switch (this._dousei.actorId()) {
      case 4:
        this.refreshActor4();
        return;
      case 8:
        this.refreshActor8();
        return;
      case 9:
        this.refreshActor9();
        return;
      case 10:
        this.refreshActor10();
        return; // カナミ
      case 11:
        this.refreshActor11();
        return; // ミユ
      case 13:
        this.refreshActor13();
        return; // サキ
      case 17:
        this.refreshActor17();
        return; // ココナ
    }
  };
  Sprite_Dousei.prototype.refreshText = function () {
    //this.bitmap.fillRect(0, 0, 200, 120, '#666666');
    this.bitmap.fontSize = 14;
    //this.bitmap.drawText(this._dousei.name(), 154, 20, 190, 30);
  };
  Sprite_Dousei.prototype.refreshActor4 = function () {
    var actor = $gameActors.actor(this._dousei.actorId());
    var boteId = actor.boteId;
    switch (this._dousei.currentPlayItem().itemId()) {
      case DouseiPlayId.sex:
        this.refreshActor4Sex(boteId);
        break;
      case DouseiPlayId.chichi:
        this.refreshActor4Chichi(boteId);
        break;
      case DouseiPlayId.fela:
        this.refreshActor4Fela();
        break;
      case DouseiPlayId.sm:
        this.refreshActor4Sm(boteId);
        break;
      case DouseiPlayId.kunni:
        this.refreshActor4Kunni(boteId);
        break;
      case DouseiPlayId.anal:
        this.refreshActor4Anal(boteId);
        break;
    }
    this.refreshActor4Sw();
  };
  Sprite_Dousei.prototype.refreshActor4Sw = function () {
    var base = 141;
    this.offActorSwicthes(base);
    var list = this.actor4SwList(base);
    var dice = 0; //Math.randomInt(list.length);
    $gameSwitches.setValue(list[dice], true);
  };
  Sprite_Dousei.prototype.actor4SwList = function (base) {
    switch (this._dousei.currentDouseiValue()) {
      case Nore.DOUSEI_CHAR_VAR.sex:
      case Nore.DOUSEI_CHAR_VAR.gyaku:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.fela:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.sm:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.kunni:
        return [base, base + 2];
      case Nore.DOUSEI_CHAR_VAR.chichi:
        return [base, base + 1, base + 2];
      case Nore.DOUSEI_CHAR_VAR.kijoui:
        return [base];
      default:
        return [base];
    }
  };
  Sprite_Dousei.prototype.refreshActor4Sex = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
    if (this.isShota()) {
      this._eroSprite.setup(100, [4], 0, boteId);
      this._eroSprite.setupEroAnime("04_02", 200, EroSpeed.normal, 500);
    } else {
      this._eroSprite.setup(100, [], 0, boteId);
      this._eroSprite.setupEroAnime("04_03", 200, EroSpeed.normal, 500);
    }
  };
  Sprite_Dousei.prototype.refreshActor4Chichi = function (boteId) {
    this._eroSprite.setup(10, [], 0, boteId);
    this._eroSprite.setupBaseEroSprite("04_05", 10, []);
    this._eroSprite.setupEroSprite1(11, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor4Sm = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.back);
    this._eroSprite.setup(2000, [], 0, boteId);
    this._eroSprite.setupBaseEroSprite("04_02", 2000, []);
    this._eroSprite.setupEroSprite1(2001, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor4Fela = function () {
    this._eroSprite.setup(50, []);
    this._eroSprite.setupEroAnime("04_06", 50, EroSpeed.normal, 60);
  };
  Sprite_Dousei.prototype.refreshActor4Anal = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.back);
    this._eroSprite.setup(100, [], 0, boteId);
    this._eroSprite.setupEroAnime("04_06", 200, EroSpeed.normal, 300);
  };
  Sprite_Dousei.prototype.refreshActor4Kunni = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.kunni);
    if (this.isShota()) {
      this._eroSprite.setup(100, [], 3, boteId);
      this._eroSprite.setupBaseEroSprite("04_11", 100, []);
      this._eroSprite.setupEroSprite1(101, []);
      this._eroSprite.update();
    } else {
      this._eroSprite.setup(100, [], 1, boteId);
      this._eroSprite.setupBaseEroSprite("04_11", 100, []);
      this._eroSprite.setupEroSprite1(101, [], 2);
      this._eroSprite.update();
    }
  };
  Sprite_Dousei.prototype.refreshActor8 = function () {
    var actor = $gameActors.actor(this._dousei.actorId());
    var boteId = actor.boteId;
    switch (this._dousei.currentPlayItem().itemId()) {
      case DouseiPlayId.sex:
        this.refreshActor8Sex(boteId);
        break;
      case DouseiPlayId.chichi:
        this.refreshActor8Chichi(boteId);
        break;
      case DouseiPlayId.fela:
        this.refreshActor8Fela();
        break;
      case DouseiPlayId.sm:
        this.refreshActor8Sm(boteId);
        break;
      case DouseiPlayId.kunni:
        this.refreshActor8Kunni(boteId);
        break;
      case DouseiPlayId.anal:
        this.refreshActor8Anal(boteId);
        break;
      default:
        console.error(this._dousei.currentPlayItem().itemId());
    }
    this.refreshActor8Sw();
  };
  Sprite_Dousei.prototype.refreshActor8Sw = function () {
    var base = 131;
    this.offActorSwicthes(base);
    var list = this.actor8SwList(base);
    var dice = Math.randomInt(list.length);
    $gameSwitches.setValue(list[dice], true);
  };
  Sprite_Dousei.prototype.actor8SwList = function (base) {
    switch (this._dousei.currentDouseiValue()) {
      case Nore.DOUSEI_CHAR_VAR.sex:
      case Nore.DOUSEI_CHAR_VAR.gyaku:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.fela:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.sm:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.kunni:
        return [base, base + 2];
      case Nore.DOUSEI_CHAR_VAR.chichi:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.kijoui:
        return [base];
      default:
        return [base];
    }
  };
  Sprite_Dousei.prototype.refreshActor8Sex = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
    if (this._dousei.manId() == 5) {
      this._eroSprite.setup(100, [5]);
      this._eroSprite.setupEroAnime("05_02", 200, EroSpeed.normal, 400);
    } else {
      this._eroSprite.setup(100, [], 0, boteId);
      this._eroSprite.setupEroAnime("08_05", 100, EroSpeed.normal, 200);
    }
  };
  Sprite_Dousei.prototype.refreshActor8Anal = function (boteId) {
    if (this._dousei.manId() == 5) {
      this._eroSprite.setup(100, [], 0, boteId);
      this._eroSprite.setupEroAnime("05_03", 200, EroSpeed.normal, 400);
    } else {
      this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
      this._eroSprite.setup(100, [], 0, boteId);
      this._eroSprite.setupEroAnime("08_01", 200, EroSpeed.normal, 400);
    }
  };
  Sprite_Dousei.prototype.refreshActor8Chichi = function (boteId) {
    this._eroSprite.setup(9, [], 0, boteId);
    this._eroSprite.setupBaseEroSprite("08_03", 101, []);
    this._eroSprite.setupEroSprite1(102, []);
    this._eroSprite.update();
    return;
    if (this._dousei.manId() == 5) {
      this._eroSprite.setup(100, [5], 0, boteId);
      this._eroSprite.setupEroAnime("05_03", 200, EroSpeed.normal, 400);
    } else {
      this._eroSprite.stop();
    }
  };
  Sprite_Dousei.prototype.refreshActor8Fela = function () {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.fela);
    if (this._dousei.manId() == 5) {
      this._eroSprite.setup(10, [], 2);
      this._eroSprite.setupBaseEroSprite("08_06", 10, [4]);
      this._eroSprite.setupEroSprite1(11, []);
      this._eroSprite.update();
    } else {
      this._eroSprite.setup(10, [], 1);
      this._eroSprite.setupBaseEroSprite("08_06", 10, [4]);
      this._eroSprite.setupEroSprite1(11, []);
      this._eroSprite.update();
    }
  };
  Sprite_Dousei.prototype.refreshActor8Kunni = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.kunni);
    if (this._dousei.manId() == 5) {
      this._eroSprite.setup(1, [], 1, boteId);
      this._eroSprite.setupBaseEroSprite("08_04", 1, []);
      this._eroSprite.setupEroSprite1(2, []);
      this._eroSprite.update();
    } else {
      this._eroSprite.setup(9, [], 1, boteId);
      this._eroSprite.setupBaseEroSprite("08_03", 20, [4]);
      this._eroSprite.setupEroSprite1(21, []);
      this._eroSprite.update();
    }
  };
  Sprite_Dousei.prototype.refreshActor8Sm = function (boteId) {
    this._eroSprite.setup(100, [], 0, boteId);
    this._eroSprite.setupEroAnime("08_09", 100, EroSpeed.normal, 200);
  };
  Sprite_Dousei.prototype.refreshActor9 = function () {
    var actor = $gameActors.actor(this._dousei.actorId());
    var boteId = actor.boteId;
    switch (this._dousei.currentPlayItem().itemId()) {
      case DouseiPlayId.sex:
        this.refreshActor9Sex(boteId);
        break;
      case DouseiPlayId.fela:
        this.refreshActor9Fela();
        break;
      case DouseiPlayId.sm:
        this.refreshActor9Sm(boteId);
        break;
      case DouseiPlayId.kunni:
        this.refreshActor9Kunni();
        break;
      case DouseiPlayId.chichi:
        this.refreshActor9Chichi(boteId);
        break;
      case DouseiPlayId.anal:
        this.refreshActor9Anal(boteId);
        break;
      default:
        console.error(this._dousei.currentPlayItem().itemId());
    }
    this.refreshActor9Sw();
  };
  Sprite_Dousei.prototype.refreshActor9Sw = function () {
    var base = 136;
    this.offActorSwicthes(base);
    var list = this.actor9SwList(base);
    var dice = 0; //Math.randomInt(list.length);
    $gameSwitches.setValue(list[dice], true);
  };
  Sprite_Dousei.prototype.actor9SwList = function (base) {
    switch (this._dousei.currentDouseiValue()) {
      case Nore.DOUSEI_CHAR_VAR.sex:
      case Nore.DOUSEI_CHAR_VAR.gyaku:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.fela:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.sm:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.kunni:
        return [base, base + 2];
      case Nore.DOUSEI_CHAR_VAR.chichi:
        return [base, base + 1, base + 2];
      case Nore.DOUSEI_CHAR_VAR.kijoui:
        return [base];
      default:
        return [base];
    }
  };
  Sprite_Dousei.prototype.refreshActor9Sex = function (boteId) {
    if (this.isShota()) {
      this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
      this._eroSprite.setup(100, [5], 2, boteId);
      if (boteId > 0) {
        this._eroSprite.setupEroAnime("09_09", 300, EroSpeed.normal, 500);
      } else {
        this._eroSprite.setupEroAnime("09_09", 300, EroSpeed.normal, 500);
      }
      return;
    }
    var dice = Math.randomInt(2);
    switch (dice) {
      case 1:
        this.refreshActor9Sex1(boteId);
        break;
      default:
        this.refreshActor9Sex2(boteId);
        break;
    }
  };
  Sprite_Dousei.prototype.refreshActor9Sex1 = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
    this._eroSprite.setup(100, [5], 0, boteId);
    if (boteId > 0) {
      this._eroSprite.setupEroAnime("09_04", 800, EroSpeed.normal, 900);
    } else {
      this._eroSprite.setupEroAnime("09_04", 800, EroSpeed.normal, 900);
    }
  };
  Sprite_Dousei.prototype.refreshActor9Sex2 = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.kijoui);
    if (boteId > 0) {
      var ignoreList = [6, 7];
      var actor = $gameActors.actor(this._dousei.actorId());
      if (!actor.isKuroChikubi()) {
        ignoreList.push(3);
      }
      this._eroSprite.setup(100, ignoreList, 0, boteId, 2);
      this._eroSprite.setupEroAnime("09_06", 400, EroSpeed.normal, 600);
    } else {
      this._eroSprite.setup(100, [], 0, boteId, 2);
      this._eroSprite.setupEroAnime("09_06", 400, EroSpeed.normal, 600);
    }
  };
  Sprite_Dousei.prototype.refreshActor9Fela = function () {
    this._eroSprite.setup(100, []);
    this._eroSprite.setupEroAnime("09_14", 100, EroSpeed.normal, 200);
  };
  Sprite_Dousei.prototype.refreshActor9Sm = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.back);
    if (boteId > 0) {
      this._eroSprite.setup(1, [3, 4, 5], 0, boteId, 2);
      this._eroSprite.setupBaseEroSprite("09_02", 1, [3, 4, 5, 7]);
      this._eroSprite.setupEroSprite1(20, [3, 4, 5]);
      this._eroSprite.update();
    } else {
      var type = this.animeTypeId(DouseiPlayId.sm, 2);
      if (type == 0) {
        this._eroSprite.setup(100, []);
        this._eroSprite.setupEroAnime("09_03", 100, EroSpeed.normal, 200);
      } else {
        this._eroSprite.setup(1, [3, 4, 5], 0, boteId, 2);
        this._eroSprite.setupBaseEroSprite("09_02", 1, [3, 4, 5, 7]);
        this._eroSprite.setupEroSprite1(20, [3, 4, 5]);
        this._eroSprite.update();
      }
    }
  };
  Sprite_Dousei.prototype.refreshActor9Kunni = function () {
    this._eroSprite.setup(20, []);
    this._eroSprite.setupBaseEroSprite("09_13", 21, []);
    this._eroSprite.setupEroSprite1(22, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor9Chichi = function (boteId) {
    this._eroSprite.setup(10, [], 0, boteId);
    this._eroSprite.setupBaseEroSprite("09_09", 10, [5]);
    this._eroSprite.setupEroSprite1(11, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor9Anal = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.back);
    this._eroSprite.setup(100, [], 0, boteId);
    this._eroSprite.setupEroAnime("09_16", 100, EroSpeed.normal, 200);
  };
  Sprite_Dousei.prototype.refreshActor10 = function () {
    var actor = $gameActors.actor(this._dousei.actorId());
    var boteId = actor.boteId;
    switch (this._dousei.currentPlayItem().itemId()) {
      case DouseiPlayId.sex:
        this.refreshActor10Sex(boteId);
        break;
      case DouseiPlayId.fela:
        this.refreshActor10Fela(boteId);
        break;
      case DouseiPlayId.sm:
        this.refreshActor10Sm(boteId);
        break;
      case DouseiPlayId.kunni:
        this.refreshActor10Kunni(boteId);
        break;
      case DouseiPlayId.chichi:
        this.refreshActor10Chichi(boteId);
        break;
      case DouseiPlayId.anal:
        this.refreshActor10Anal(boteId);
        break;
      default:
        console.error(this._dousei.currentPlayItem().itemId());
    }
    this.refreshActor10Sw();
  };
  Sprite_Dousei.prototype.refreshActor10Sw = function () {
    var base = 126;
    this.offActorSwicthes(base);
    var list = this.actor10SwList(base);
    var dice = Math.randomInt(list.length);
    $gameSwitches.setValue(list[dice], true);
  };
  Sprite_Dousei.prototype.actor10SwList = function (base) {
    switch (this._dousei.currentDouseiValue()) {
      case Nore.DOUSEI_CHAR_VAR.sex:
      case Nore.DOUSEI_CHAR_VAR.gyaku:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.fela:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.sm:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.kunni:
        return [base, base + 2];
      case Nore.DOUSEI_CHAR_VAR.chichi:
        return [base, base + 1, base + 2];
      case Nore.DOUSEI_CHAR_VAR.kijoui:
        return [base];
      default:
        return [base];
    }
  };
  Sprite_Dousei.prototype.refreshActor10Sex = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
    if (this._dousei.manId() != 3) {
      this._eroSprite.setup(100, [], 0, boteId);
      this._eroSprite.setupEroAnime("010_03", 900, EroSpeed.normal, 800);
    } else {
      this._eroSprite.setup(100, [], 0, boteId);
      this._eroSprite.setupEroAnime("010_06", 900, EroSpeed.normal, 800);
    }
  };
  Sprite_Dousei.prototype.refreshActor10Fela = function (boteId) {
    if (this._dousei.manId() != 3 && this._dousei.manId() != 5) {
      this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.fela);
      this._eroSprite.setup(100, [], 0, boteId);
      this._eroSprite.setupEroAnime("010_10", 100, EroSpeed.normal, 200);
    } else {
      this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.fela);
      this._eroSprite.setup(300, [], 0, boteId);
      this._eroSprite.setupEroAnime("010_10", 300, EroSpeed.normal, 400);
    }
  };
  Sprite_Dousei.prototype.refreshActor10Chichi = function (boteId) {
    this._eroSprite.setup(10, [], 0, boteId);
    this._eroSprite.setupBaseEroSprite("010_08", 10, []);
    this._eroSprite.setupEroSprite1(11, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor10Sm = function (boteId) {
    this._eroSprite.setup(20, [], 0, boteId);
    this._eroSprite.setupBaseEroSprite("010_01", 20, []);
    this._eroSprite.setupEroSprite1(21, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor10Kunni = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.kunni);
    if (this._dousei.manId() != 3 && this._dousei.manId() != 5) {
      this._eroSprite.setup(10, [], 9, boteId);
      this._eroSprite.setupBaseEroSprite("010_06", 12, []);
      this._eroSprite.setupEroSprite1(14, [], 10);
      this._eroSprite.update();
    } else {
      this._eroSprite.setup(10, [], 2, boteId);
      this._eroSprite.setupBaseEroSprite("010_06", 12, []);
      this._eroSprite.setupEroSprite1(14, [], 6);
      this._eroSprite.update();
    }
  };
  Sprite_Dousei.prototype.refreshActor10Anal = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
    this._eroSprite.setup(2000, [], 0, boteId);
    this._eroSprite.setupEroAnime("010_04", 2000, EroSpeed.normal, 2100);
  };
  Sprite_Dousei.prototype.refreshActor11Sex = function (boteId) {
    var dice = Math.randomInt(2);
    if (dice == 0) {
      this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
      this._eroSprite.setup(100, [], 0, boteId);
      this._eroSprite.setupEroAnime("011_02", 400, EroSpeed.normal, 800);
    } else {
      this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.kijoui);
      this._eroSprite.setup(100, [], 0, boteId);
      this._eroSprite.setupEroAnime("011_07", 400, EroSpeed.normal, 800);
    }
  };
  Sprite_Dousei.prototype.refreshActor11 = function () {
    var actor = $gameActors.actor(this._dousei.actorId());
    var boteId = actor.boteId;
    switch (this._dousei.currentPlayItem().itemId()) {
      case DouseiPlayId.sex:
        this.refreshActor11Sex(boteId);
        break;
      case DouseiPlayId.fela:
        this.refreshActor11Fela(boteId);
        break;
      case DouseiPlayId.sm:
        this.refreshActor11Sm(boteId);
        break;
      case DouseiPlayId.kunni:
        this.refreshActor11Kunni(boteId);
        break;
      case DouseiPlayId.chichi:
        this.refreshActor11Chichi(boteId);
        break;
      case DouseiPlayId.anal:
        this.refreshActor11Anal(boteId);
        break;
      default:
        console.error(this._dousei.currentPlayItem().itemId());
    }
    this.refreshActor11Sw();
  };
  Sprite_Dousei.prototype.offActorSwicthes = function (start) {
    for (var i = 0; i < 5; i++) {
      $gameSwitches.setValue(start + i, false);
    }
  };
  Sprite_Dousei.prototype.refreshActor11Sw = function () {
    var base = 121;
    this.offActorSwicthes(base);
    var list = this.actor11SwList(base);
    var dice = Math.randomInt(list.length);
    $gameSwitches.setValue(list[dice], true);
  };
  Sprite_Dousei.prototype.actor11SwList = function (base) {
    switch (this._dousei.currentDouseiValue()) {
      case Nore.DOUSEI_CHAR_VAR.sex:
      case Nore.DOUSEI_CHAR_VAR.gyaku:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.fela:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.sm:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.kunni:
        return [base, base + 2];
      case Nore.DOUSEI_CHAR_VAR.chichi:
        return [base, base + 1, base + 2];
      case Nore.DOUSEI_CHAR_VAR.kijoui:
        return [base];
      default:
        return [base];
    }
  };
  Sprite_Dousei.prototype.refreshActor11Fela = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.fela);
    this._eroSprite.setup(100, [], 0, boteId);
    this._eroSprite.setupEroAnime("011_09", 100, EroSpeed.normal, 200);
  };
  Sprite_Dousei.prototype.refreshActor11Kunni = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.kunni);
    this._eroSprite.setup(20, [], 0, boteId);
    this._eroSprite.setupBaseEroSprite("011_08", 20, []);
    this._eroSprite.setupEroSprite1(21, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor11Sm = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.back);
    this._eroSprite.setup(1, [], 0, boteId);
    this._eroSprite.setupBaseEroSprite("011_04", 1, [5]);
    this._eroSprite.setupEroSprite1(2, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor11Anal = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.back);
    this._eroSprite.setup(2000, [], 0, boteId);
    this._eroSprite.setupEroAnime("011_06", 200, EroSpeed.normal, 600);
  };
  Sprite_Dousei.prototype.refreshActor11Chichi = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.chichi);
    this._eroSprite.setup(10, [], 0, boteId);
    this._eroSprite.setupBaseEroSprite("011_10", 10, []);
    this._eroSprite.setupEroSprite1(11, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor13 = function () {
    var actor = $gameActors.actor(this._dousei.actorId());
    var boteId = actor.boteId;
    switch (this._dousei.currentPlayItem().itemId()) {
      case DouseiPlayId.sex:
        this.refreshActor13Sex(boteId);
        break;
      case DouseiPlayId.anal:
        this.refreshActor13Anal(boteId);
        break;
      case DouseiPlayId.sm:
        this.refreshActor13Sm(boteId);
        break;
      case DouseiPlayId.kunni:
        this.refreshActor13Kunni();
        break;
      case DouseiPlayId.chichi:
        this.refreshActor13Chichi(boteId);
        break;
      case DouseiPlayId.fela:
        this.refreshActor13Fela(boteId);
        break;
    }
    this.refreshActor13Sw();
  };
  Sprite_Dousei.prototype.refreshActor13Sw = function () {
    var base = 146;
    this.offActorSwicthes(base);
    var list = this.actor13SwList(base);
    var dice = 0; //Math.randomInt(list.length);
    $gameSwitches.setValue(list[dice], true);
  };
  Sprite_Dousei.prototype.actor13SwList = function (base) {
    switch (this._dousei.currentPlayItem().itemId()) {
      case DouseiPlayId.anal:
        return [base + 1];
    }
    switch (this._dousei.currentDouseiValue()) {
      case Nore.DOUSEI_CHAR_VAR.sex:
      case Nore.DOUSEI_CHAR_VAR.gyaku:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.fela:
        return [base + 1];
      case Nore.DOUSEI_CHAR_VAR.sm:
        return [base + 1];
      case Nore.DOUSEI_CHAR_VAR.kunni:
        return [base, base + 2];
      case Nore.DOUSEI_CHAR_VAR.chichi:
        return [base + 1];
      case Nore.DOUSEI_CHAR_VAR.kijoui:
        return [base];
      default:
        return [base];
    }
  };
  Sprite_Dousei.prototype.refreshActor13Fela = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.fela);
    this._eroSprite.setup(100, [], 0, boteId);
    this._eroSprite.setupEroAnime("013_02", 100, EroSpeed.normal, 300);
  };
  Sprite_Dousei.prototype.refreshActor13Sex = function (boteId) {
    if (this.isShota()) {
      this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.back);
      this._eroSprite.setup(100, [], 2, boteId);
      this._eroSprite.setupEroAnime("013_04", 100, EroSpeed.normal, 700);
    } else {
      this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
      var dice = Math.randomInt(2);
      if (dice == 0) {
        this._eroSprite.setup(100, [], 1, boteId);
        this._eroSprite.setupEroAnime("013_04", 100, EroSpeed.normal, 700);
      } else {
        this._eroSprite.setup(100, [5], 0, boteId);
        this._eroSprite.setupEroAnime("013_01", 100, EroSpeed.normal, 700);
      }
    }
  };
  Sprite_Dousei.prototype.isShota = function () {
    switch (this._dousei.manId()) {
      case 1:
      case 3:
      case 5:
        return true;
    }
    return false;
  };
  Sprite_Dousei.prototype.refreshActor13Anal = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
    this._eroSprite.setup(100, [5], 1, boteId);
    this._eroSprite.setupEroAnime("013_05", 100, EroSpeed.normal, 700);
  };
  Sprite_Dousei.prototype.refreshActor13Sm = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.fela);
    var max = 2;
    if ($gameSwitches.value(1156)) {
      max++;
    }
    var dice = Math.randomInt(max);
    switch (dice) {
      case 0:
        this._eroSprite.setup(21, [], 0, boteId);
        this._eroSprite.setupBaseEroSprite("013_02", 31, [5]);
        this._eroSprite.setupEroSprite1(34, [5]);
        this._eroSprite.update();
        break;
      case 1:
        this._eroSprite.setup(40, [], 0, boteId);
        this._eroSprite.setupBaseEroSprite("013_02", 40, [5]);
        this._eroSprite.setupEroSprite1(41, [5]);
        this._eroSprite.update();
        break;
      case 2:
        this._eroSprite.setup(10, [], 0, boteId);
        this._eroSprite.setupBaseEroSprite("013_06", 10, [3, 5, 6, 8, 9]);
        this._eroSprite.setupEroSprite1(13, [3, 6, 8, 9]);
        this._eroSprite.update();
        break;
      default:
        console.error("不正なダイスです:" + dice);
    }
  };
  Sprite_Dousei.prototype.refreshActor13Kunni = function () {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.kunni);
    this._eroSprite.setup(10, []);
    this._eroSprite.setupBaseEroSprite("013_13", 13, []);
    this._eroSprite.setupEroSprite1(20, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor13Chichi = function (boteId) {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.chichi);
    this._eroSprite.setup(2000, [], 0, boteId);
    this._eroSprite.setupBaseEroSprite("013_07", 2000, []);
    this._eroSprite.setupEroSprite1(2001, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor17 = function () {
    var actor = $gameActors.actor(this._dousei.actorId());
    switch (this._dousei.currentPlayItem().itemId()) {
      case DouseiPlayId.sex:
        this.refreshActor17Sex();
        break;
      case DouseiPlayId.anal:
        this.refreshActor17Anal();
        break;
      case DouseiPlayId.kunni:
        this.refreshActor17Kunni();
        break;
      case DouseiPlayId.sm:
        this.refreshActor17Sm(actor);
        break;
      case DouseiPlayId.chichi:
        this.refreshActor17Chichi(actor);
        break;
      case DouseiPlayId.fela:
        this.refreshActor17Fela(actor);
        break;
    }
    this.refreshActor17Sw();
  };
  Sprite_Dousei.prototype.refreshActor17Sw = function () {
    var base = 151;
    this.offActorSwicthes(base);
    var list = this.actor17SwList(base);
    var dice = 0; //Math.randomInt(list.length);
    $gameSwitches.setValue(list[dice], true);
  };
  Sprite_Dousei.prototype.actor17SwList = function (base) {
    switch (this._dousei.currentDouseiValue()) {
      case Nore.DOUSEI_CHAR_VAR.sex:
      case Nore.DOUSEI_CHAR_VAR.gyaku:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.fela:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.sm:
        return [base, base + 1];
      case Nore.DOUSEI_CHAR_VAR.kunni:
        return [base, base + 2];
      case Nore.DOUSEI_CHAR_VAR.chichi:
        return [base, base + 1, base + 2];
      case Nore.DOUSEI_CHAR_VAR.kijoui:
        return [base];
      default:
        return [base];
    }
  };
  Sprite_Dousei.prototype.refreshActor17Sex = function () {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.gyaku);
    var dice = Math.randomInt(2);
    if (dice == 0) {
      if (this.isShota()) {
        this._eroSprite.setup(100, [], 1, 0);
        this._eroSprite.setupEroAnime("017_04", 100, EroSpeed.normal, 400);
      } else {
        this._eroSprite.setup(100, [], 0, this.boteId());
        this._eroSprite.setupEroAnime("017_04", 100, EroSpeed.normal, 400);
      }
    } else {
      if (this.isShota()) {
        this._eroSprite.setup(100, [5, 7], 1, this.boteId());
        this._eroSprite.setupEroAnime("017_02", 100, EroSpeed.normal, 400);
      } else {
        this._eroSprite.setup(100, [5, 7], 0, this.boteId());
        this._eroSprite.setupEroAnime("017_02", 100, EroSpeed.normal, 400);
      }
    }
  };
  Sprite_Dousei.prototype.refreshActor17Anal = function () {
    this._dousei.setDouseiValue(Nore.DOUSEI_CHAR_VAR.kijoui);
    this._eroSprite.setup(100, [7, 8], 0, this.boteId());
    this._eroSprite.setupEroAnime("017_09", 100, EroSpeed.normal, 400);
  };
  Sprite_Dousei.prototype.refreshActor17Kunni = function () {
    this._eroSprite.setup(20, [], 0, this.boteId());
    this._eroSprite.setupBaseEroSprite("017_07", 20, []);
    this._eroSprite.setupEroSprite1(21, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor17Sm = function (actor) {
    var ignoreList = [5];
    if (actor.isKuroChikubi()) {
      ignoreList = [];
    }
    this._eroSprite.setup(10, ignoreList, 0, actor.boteId);
    this._eroSprite.setupBaseEroSprite("017_03", 50, ignoreList);
    this._eroSprite.setupEroSprite1(51, ignoreList);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor17Fela = function (actor) {
    this._eroSprite.setup(60, [], 0, this.boteId());
    this._eroSprite.setupBaseEroSprite("017_05", 60, []);
    this._eroSprite.setupEroSprite1(61, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.refreshActor17Chichi = function (actor) {
    this._eroSprite.setup(10, [], 0, this.boteId());
    this._eroSprite.setupBaseEroSprite("017_12", 10, []);
    this._eroSprite.setupEroSprite1(11, []);
    this._eroSprite.update();
  };
  Sprite_Dousei.prototype.boteId = function () {
    return this._dousei.actor().boteId;
  };
  Sprite_Dousei.prototype.animeTypeId = function (id, max) {
    this._animeTypeMap = this._animeTypeMap || {};
    this._animeTypeMap[id] = this._animeTypeMap[id] || 0;
    this._animeTypeMap[id]++;
    return this._animeTypeMap[id] % max;
  };
  return Sprite_Dousei;
})(Sprite);
var EroSpeed;
(function (EroSpeed) {
  EroSpeed["normal"] = "normal";
  EroSpeed["fast"] = "fast";
})(EroSpeed || (EroSpeed = {}));
var DouseiAnimeType;
(function (DouseiAnimeType) {
  DouseiAnimeType["anime"] = "anime";
  DouseiAnimeType["sprite"] = "sprite";
})(DouseiAnimeType || (DouseiAnimeType = {}));
var DouseiDrawType;
(function (DouseiDrawType) {
  DouseiDrawType["anime"] = "anime";
  DouseiDrawType["spriteBase"] = "apriteBase";
  DouseiDrawType["sprite1"] = "aprite1";
  DouseiDrawType["sprite2"] = "aprite2";
})(DouseiDrawType || (DouseiDrawType = {}));
var Sprite_DouseiH = /** @class */ (function (_super) {
  __extends(Sprite_DouseiH, _super);
  function Sprite_DouseiH(dousei) {
    var _this = _super.call(this) || this;
    _this._isEroReverse = false;
    _this._boteId = 0;
    _this._manId = 0;
    _this._backId = 0;
    _this._baseManId = 0;
    _this._startWait = 0;
    _this._dousei = dousei;
    _this._renderTexture = PIXI.RenderTexture.create(147, 92);
    _this._sw11 = true;
    return _this;
  }
  Sprite_DouseiH.prototype.stop = function () {
    this._animeId = null;
    this._animeFiles = [];
    this._animeIndex = 0;
    this._loopCount = 0;
    this.removeChildren();
  };
  Sprite_DouseiH.prototype.maxLoopCount = function () {
    return 7;
  };
  Sprite_DouseiH.prototype.setupEroAnime = function (
    eroId,
    animeId,
    speed,
    finishAnimeId
  ) {
    this._eroId = eroId;
    this._animeId = animeId;
    this._finishAnimeId = finishAnimeId;
    this._animeIndex = 0;
    this._loopCount = 0;
    this._finish = false;
    this._waiting = false;
    this._animeFiles = [];
    this._startWait = 0; //Math.randomInt(10);
    this._type = DouseiAnimeType.anime;
    this._sw10 = false;
    if (animeId >= 100) {
      this._sw11 = true;
    } else {
      this._sw11 = false;
    }
    switch (speed) {
      case EroSpeed.normal:
        this._animeFiles = this.setupNormalAnime();
        break;
    }
    this.update();
  };
  Sprite_DouseiH.prototype.setupBaseEroSprite = function (
    eroId,
    animeId,
    ignoreIndexList
  ) {
    this._eroId = eroId;
    this._animeId = animeId;
    this._ignoreIndexSpriteBase = ignoreIndexList;
    this._finish = false;
    this._waiting = false;
    this._startWait = 0;
    this._type = DouseiAnimeType.sprite;
    this._isDrawBaseSprite = true;
    this._spriteWait = this.spriteAnimeWait();
    this._sw10 = true;
    this._sw11 = false;
  };
  Sprite_DouseiH.prototype.spriteAnimeWait = function () {
    return 90;
  };
  Sprite_DouseiH.prototype.setupEroSprite1 = function (
    animeId,
    ignoreIndexList,
    manId
  ) {
    if (manId === void 0) {
      manId = -1;
    }
    this._spriteAnimeId1 = animeId;
    this._ignoreIndexSpriteAnime1 = ignoreIndexList;
    this._spriteManId1 = manId;
  };
  Sprite_DouseiH.prototype.setupEroSprite2 = function (
    animeId,
    ignoreIndexList
  ) {
    this._spriteAnimeId2 = animeId;
    this._ignoreIndexSpriteAnime2 = ignoreIndexList;
  };
  Sprite_DouseiH.prototype.setupFinish = function () {
    this._finish = true;
    var files = [];
    {
      var index = this._animeId;
      for (var i = 0; i < 5; i++) {
        files.push(this._eroId + "_" + (index + this.getEroIndex(i)));
      }
    }
    {
      var index2 = this._finishAnimeId;
      for (var i = 5; i < 10; i++) {
        files.push(this._eroId + "_" + (index2 + this.getEroIndex(i)));
      }
    }
    this._animeFiles = files;
  };
  Sprite_DouseiH.prototype.setupNormalAnime = function () {
    var files = [];
    var index = this._animeId;
    for (var i = 0; i < 10; i++) {
      files.push(this._eroId + "_" + (index + this.getEroIndex(i)));
    }
    for (var i = 0; i < 10; i++) {
      for (var k = 0; k < 2; k++) {
        files.push(this._eroId + "_" + (index + this.getEroIndex(9 - i)));
      }
    }
    return files;
  };
  Sprite_DouseiH.prototype.getEroIndex = function (i) {
    if (this._isEroReverse) {
      return 9 - i;
    } else {
      return i;
    }
  };
  Sprite_DouseiH.prototype.setup = function (
    eroBaseId,
    ignoreIndex,
    manId,
    boteId,
    backId
  ) {
    if (manId === void 0) {
      manId = 0;
    }
    if (boteId === void 0) {
      boteId = 0;
    }
    if (backId === void 0) {
      backId = 1;
    }
    this._eroBaseId = eroBaseId;
    this._ignoreIndex = ignoreIndex;
    this._manId = manId;
    this._baseManId = manId;
    this._boteId = boteId;
    this._backId = backId;
  };
  Sprite_DouseiH.prototype.eroBaseId = function () {
    return this._eroBaseId;
  };
  Sprite_DouseiH.prototype.isIgnoreIndex = function (index, drawType) {
    switch (drawType) {
      case DouseiDrawType.anime:
        return this._ignoreIndex.contains(index);
      case DouseiDrawType.spriteBase:
        return this._ignoreIndexSpriteBase.contains(index);
      case DouseiDrawType.sprite1:
        return this._ignoreIndexSpriteAnime1.contains(index);
      case DouseiDrawType.sprite2:
        return this._ignoreIndexSpriteAnime2.contains(index);
    }
  };
  Sprite_DouseiH.prototype.update = function () {
    _super.prototype.update.call(this);
    //this.updateVisible();
    if (this._type == DouseiAnimeType.anime) {
      if (this._waiting) {
        return;
      }
      if (this._startWait > 0) {
        this._startWait--;
        return;
      }
    }
    if (this._type == DouseiAnimeType.sprite) {
      this.updateEroSprite();
    } else {
      this.updateEroAnime();
    }
  };
  Sprite_DouseiH.prototype.updateEroAnime = function () {
    if (this._animeId && this._animeFiles.length > 0) {
      this.drawEroAnime();
    }
  };
  Sprite_DouseiH.prototype.updateEroSprite = function () {
    if (!this._animeId) {
      return;
    }
    this._spriteWait--;
    if (this._spriteWait == 0) {
      this._spriteWait = this.spriteAnimeWait();
      this._isDrawBaseSprite = !this._isDrawBaseSprite;
    }
    if (this._isDrawBaseSprite) {
      this._manId = this._baseManId;
      var file = this._eroId + "_" + this._animeId.padZero(2);
      this.drawEro(file, DouseiDrawType.spriteBase);
    } else {
      if (this._spriteManId1 > 0) {
        this._manId = this._spriteManId1;
      } else {
        this._manId = this._baseManId;
      }
      var file = this._eroId + "_" + this._spriteAnimeId1.padZero(2);
      this.drawEro(file, DouseiDrawType.sprite1);
    }
  };
  Sprite_DouseiH.prototype.drawEroAnime = function () {
    var file = this._animeFiles[this._animeIndex];
    this.drawEro(file, DouseiDrawType.anime);
    this._animeIndex++;
    if (this._animeIndex >= this._animeFiles.length) {
      if (this._finish) {
        this._waiting = true;
        return;
      }
      this._animeIndex = 0;
      this._loopCount++;
      if (this._loopCount >= this.maxLoopCount()) {
        this.setupFinish();
      }
    }
  };
  Sprite_DouseiH.prototype.drawEro = function (file, drawType) {
    var renderTexture = this._renderTexture;
    var s = new PIXI.Sprite();
    var index = file.indexOf("_") == 2 ? 6 : 7;
    switch (1) {
      case 1:
        this.drawEro2(s, file.substring(0, index) + "back" + this._backId);
        break;
    }
    var max = 10;
    for (var i = 1; i <= max; i++) {
      var imageId = i.padZero(2);
      if (this.isIgnoreIndex(i, drawType)) {
        continue;
      }
      this.drawEro2(s, file + "_" + imageId, file, i);
    }
    //this.drawNakaRakugaki(s, file);
    var renderer = Graphics.app.renderer;
    renderer.render(s, renderTexture);
    var sprite = new PIXI.Sprite(renderTexture);
    this.removeChildren();
    this._eroSprite = sprite;
    this.addChild(sprite);
  };
  Sprite_DouseiH.prototype.drawEro2 = function (s, file, fileId, index) {
    var texture = this.selectEro2Texture(s, file, fileId, index);
    if (!texture) {
      return;
    }
    var sprite = new PIXI.Sprite(texture);
    if (texture.textureCacheIds.length > 0) {
      if (texture.textureCacheIds[0].includes("man")) {
        sprite.alpha = $gameSystem.manAlpha();
      }
    }
    s.addChild(sprite);
  };
  Sprite_DouseiH.prototype.selectEro2Texture = function (
    s,
    file,
    fileId,
    index
  ) {
    var texture = this.selectTexture(s, file);
    if (texture) {
      return texture;
    }
    var eroBaseId = this.eroBaseId();
    if (eroBaseId == 0) {
      return null;
    }
    if (!fileId) {
      return null;
    }
    var list = fileId.split("_");
    var eroId = Math.trunc(list[2]);
    var animeId;
    if (this._sw10) {
      animeId = eroBaseId;
    } else {
      if (this._sw11) {
        animeId = eroBaseId + (eroId % 100);
      } else {
        animeId = eroBaseId + (eroId % 10);
      }
    }
    var baseFileId =
      list[0] +
      "_" +
      list[1] +
      "_" +
      animeId.padZero(2) +
      "_" +
      index.padZero(2);
    texture = this.selectTexture(s, baseFileId);
    if (texture) {
      return texture;
    }
    if (this._sw12) {
      var baseFileId4 =
        list[0] +
        "_" +
        list[1] +
        "_" +
        Math.floor(eroId / 10) * 10 +
        "_" +
        index.padZero(2);
      texture = this.selectTexture(s, baseFileId4);
      if (!texture) {
        return null;
      }
    } else {
      // ベースの index
      var animeId_1 = eroBaseId;
      var baseFileId2 =
        list[0] +
        "_" +
        list[1] +
        "_" +
        animeId_1.padZero(2) +
        "_" +
        index.padZero(2);
      texture = this.selectTexture(s, baseFileId2);
      if (texture) {
        return texture;
      }
      // 今の
      if (!this._sw11) {
        return null;
      }
      animeId_1 = Math.round(eroId / 100) * 100;
      var baseFileId3 =
        list[0] +
        "_" +
        list[1] +
        "_" +
        animeId_1.padZero(2) +
        "_" +
        index.padZero(2);
      texture = this.selectTexture(s, baseFileId3);
      if (!texture) {
        return null;
      }
    }
    return texture;
  };
  Sprite_DouseiH.prototype.selectTexture = function (s, file) {
    var prefix = "av_";
    var boteId = this._boteId;
    var manId = this._manId;
    if (manId > 0) {
      var manFile = file + "_man" + manId.padZero(2) + ".png";
      if (boteId > 0) {
        var texture1_1 =
          PIXI.utils.TextureCache[
            prefix +
              file +
              "_man" +
              manId.padZero(2) +
              "_bote" +
              boteId +
              ".png"
          ];
        if (texture1_1) {
          return texture1_1;
        }
        var texture2 =
          PIXI.utils.TextureCache[
            prefix + file + "_man" + manId.padZero(2) + "_bote" + ".png"
          ];
        if (texture2) {
          return texture2;
        }
      }
      var texture1 = PIXI.utils.TextureCache[prefix + manFile];
      if (texture1) {
        return texture1;
      }
    }
    if (boteId > 0) {
      var texture1 =
        PIXI.utils.TextureCache[prefix + file + "_bote" + boteId + ".png"];
      if (texture1) {
        return texture1;
      }
      var texture2 = PIXI.utils.TextureCache[prefix + file + "_bote" + ".png"];
      if (texture2) {
        return texture2;
      }
    }
    var texture = PIXI.utils.TextureCache[prefix + file + ".png"];
    if (texture) {
      return texture;
    }
    return texture;
  };
  return Sprite_DouseiH;
})(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_Enemy2 = /** @class */ (function (_super) {
  __extends(Game_Enemy2, _super);
  function Game_Enemy2(enemyId, x, y, level) {
    var _this = _super.call(this, enemyId, x, y) || this;
    _this._level = level;
    p("level:" + _this._level);
    _this.calcMhp();
    _this.calcAtk();
    _this.calcDef();
    _this.recoverAll();
    return _this;
  }
  Game_Enemy2.prototype.calcMhp = function () {
    var n = this.param(0);
    this._mhp = Math.round(n * this.levelHpRate());
  };
  Game_Enemy2.prototype.calcAtk = function () {
    var n = this.param(2);
    this._atk = Math.round(n * this.levelAtkRate());
  };
  Game_Enemy2.prototype.calcDef = function () {
    var n = this.param(3);
    this._def = 0;
  };
  Object.defineProperty(Game_Enemy2.prototype, "mhp", {
    get: function () {
      return this._mhp;
    },
    enumerable: false,
    configurable: true,
  });
  Game_Enemy2.prototype.levelHpRate = function () {
    var rate = 1 + (this._level - 1) / 2;
    return rate;
  };
  Game_Enemy2.prototype.levelAtkRate = function () {
    var rate = 1 + (this._level - 1) / 3;
    return rate;
  };
  Game_Enemy2.prototype.hpValue = function (n) {
    switch (n) {
      case 1:
        return 10;
      case 2:
        return 12;
      case 3:
        return 14;
      case 4:
        return 17;
      case 5:
        return 20;
      case 6:
        return 25;
      case 7:
        return 30;
      case 8:
        return 36;
      case 9:
        return 43;
      case 10:
        return 50;
    }
    console.error("不正なHPです " + n);
    return n;
  };
  Game_Enemy2.prototype.atkValue = function (n) {
    switch (n) {
      case 1:
        return 3;
      case 2:
        return 4;
      case 3:
        return 5;
      case 4:
        return 6;
      case 5:
        return 7;
      case 6:
        return 8;
      case 7:
        return 9;
      case 8:
        return 10;
      case 9:
        return 11;
      case 10:
        return 12;
    }
    console.error("不正なATKです " + n);
    return n;
  };
  Game_Enemy2.prototype.level = function () {
    return this._level;
  };
  Game_Enemy2.prototype.element = function () {
    for (var _i = 0, _a = this.enemy().traits; _i < _a.length; _i++) {
      var t = _a[_i];
      if (t.code == 31) {
        return t.dataId;
      }
    }
    return EnemyElement.none;
  };
  Game_Enemy2.prototype.atk2 = function () {
    return this._atk;
  };
  Game_Enemy2.prototype.def2 = function () {
    return this._def;
  };
  return Game_Enemy2;
})(Game_Enemy);

repo_name: onms/dead

license: unknown


code:
var Nore;
(function (Nore) {
  function isTaikenban() {
    return false;
  }
  Nore.isTaikenban = isTaikenban;
  function isOmakeRecollection(switchId) {
    return false;
  }
  Nore.isOmakeRecollection = isOmakeRecollection;
  /**
   * AVジャケットのテキスト入力ができる場合 true を返す
   * スマホ版は false に
   */
  function isTextInputEnabled() {
    return true;
  }
  Nore.isTextInputEnabled = isTextInputEnabled;
  /**
   * AVジャケットを画像としてDLする機能を提供する場合 true を返す
   * スマホ版は false に
   */
  function isTakeScreenshotEnabled() {
    return true;
  }
  Nore.isTakeScreenshotEnabled = isTakeScreenshotEnabled;
})(Nore || (Nore = {}));


code:
/*:ja
 * @target MZ
 * @author ル
 *
 * @command runEpilogue
 * @text エピローグ実行
 * @arg actorId
 * @type number
 * @text actorId
 * @desc actorId
 * @arg scenarioBase
 * @type string
 * @desc シナリオID
 */
var Nore;
(function (Nore) {
  var pluginName = "Nore_Epilogue";
  PluginManager.registerCommand(pluginName, "runEpilogue", function (args) {
    var actorId = parseInt(args.actorId);
    var scenarioBase = args.scenarioBase;
    var actor = $gameActors.actor(actorId);
    var actorName = actor.nameJp();
    if (!actor.lastBaby()) {
      console.error("子供が存在しません:" + actorId);
      return;
    }
    if (!actor.lastBaby().isBote() && !actor.lastBaby().isJusei()) {
      console.error("ボテ腹になっていません:" + actorId);
      return;
    }
    var manId = actor.lastBaby().taneoyaId();
    var man = $gameActors.actor(manId);
    $gameVariables.setValue(52, man.nameJp());
    $gameVariables.setValue(55, manId);
    var text1 = scenarioBase.format(man.nameJp());
    if (this.runDouseiScenario(text1)) {
      return;
    }
    var manParam = MAN_PARAMS[manId];
    if (!manParam) {
      // 想定外のAV男優　バグ修正用
      var type = "子供";
      if (manId == 47) {
        type = "外人";
      }
      var text2_1 = scenarioBase.format(type);
      if (this.runDouseiScenario(text2_1)) {
        return;
      }
      return;
    }
    var text2 = scenarioBase.format(manParam.type);
    if (this.runDouseiScenario(text2)) {
      return;
    }
    console.error(
      ""
        .concat(actorName, "\u3068")
        .concat(
          man.nameJp(),
          "\u306E\u30A8\u30D4\u30ED\u30FC\u30B0\u30A4\u30D9\u30F3\u30C8\u304C\u5B58\u5728\u3057\u307E\u305B\u3093"
        )
    );
  });
})(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 __());
    };
  })();
/*:ja
 * @target MZ
 * @author ル
 *

 */
var Nore;
(function (Nore) {
  var pluginName = "Nore_EroActor";
})(Nore || (Nore = {}));
var EroType;
(function (EroType) {
  EroType["nakadashi"] = "nakadashi";
  EroType["anal"] = "anal";
  EroType["acme"] = "acme";
  EroType["fela"] = "fela";
  EroType["chichi"] = "chichi";
  EroType["syusan"] = "syusan";
  EroType["depravity"] = "depravity";
  EroType["reputation"] = "reputation";
})(EroType || (EroType = {}));
var AvEroType;
(function (AvEroType) {
  AvEroType["avCount"] = "avCount";
  AvEroType["popularity"] = "popularity";
  AvEroType["number"] = "number";
})(AvEroType || (AvEroType = {}));
var BodyType;
(function (BodyType) {
  BodyType["chichi"] = "chichi";
  BodyType["manko"] = "manko";
  BodyType["anal"] = "anal";
  BodyType["cri"] = "cri";
  BodyType["kiss"] = "kiss";
  BodyType["sm"] = "sm";
})(BodyType || (BodyType = {}));
var Game_EroActor = /** @class */ (function (_super) {
  __extends(Game_EroActor, _super);
  function Game_EroActor() {
    var _this = (_super !== null && _super.apply(this, arguments)) || this;
    _this._eroCount = {};
    _this._reputation = 100;
    _this._depravity = 23;
    return _this;
  }
  //_douseiCount: {[key: string]: Dousei} = {}
  /*douseiList(): Array<Dousei> {
        let result = [];
        for (let key in this._douseiCount) {
            let dousei = this._douseiCount[key];
            if (dousei.count() > 0) {
                result.push(dousei);
            }
        }
        return result;
    }*/
  /*addDousei(actorId: number, count: number) {
        if (! this._douseiCount[actorId]) {
            this._douseiCount[actorId] = new Dousei(actorId);
        }
        const dousei = this._douseiCount[actorId];
        dousei.addCount(count);
    }*/
  Game_EroActor.prototype.countSyusan = function () {
    return 0;
  };
  Game_EroActor.prototype.countEro = function (type) {
    if (type == EroType.syusan) {
      return this.countSyusan();
    }
    if (type == EroType.reputation) {
      return this.reputation();
    }
    if (type == EroType.depravity) {
      return this.depravity();
    }
    if (this._eroCount[type]) {
      return this._eroCount[type];
    }
    return 0;
  };
  Game_EroActor.prototype.reputation = function () {
    var n = 0;
    for (
      var _i = 0, _a = $slg.avInfo().actorAvList(this._actorId);
      _i < _a.length;
      _i++
    ) {
      var av = _a[_i];
      n += av.fan();
    }
    return -Math.floor(n / 40);
  };
  Game_EroActor.prototype.depravity = function () {
    if (this.isFriends()) {
      return 0;
    }
    var total = this.totalAvCount();
    if (total == 0) {
      console.error("AV数が０です");
      return 0;
    }
    //p('total:' + total);
    var map = {};
    var n = 0;
    for (
      var _i = 0, _a = $slg.avInfo().actorAvList(this.actorId());
      _i < _a.length;
      _i++
    ) {
      var av = _a[_i];
      if (map[av.itemId()]) {
        continue;
      }
      map[av.itemId()] = true;
      n++;
    }
    return Math.floor((n / total) * 100);
  };
  Game_EroActor.prototype.totalAvCount = function () {
    var actorId = this.actorId();
    var n = 0;
    for (var _i = 0, _a = this.avList(); _i < _a.length; _i++) {
      var av = _a[_i];
      if (av.type == AvItemType.sex) {
        n++;
      }
    }
    return n;
  };
  Game_EroActor.prototype.avList = function () {
    switch (this.actorId()) {
      case 4:
        return MARINA_AV;
      case 8:
        return SENRI_AV;
      case 9:
        return NONOKA_AV;
      case 10:
        return KANAMI_AV;
      case 11:
        return MIYU_AV;
      case 13:
        return SAKI_AV;
      case 17:
        return KOKONA_AV;
    }
  };
  Game_EroActor.prototype.isFriends = function () {
    switch (this.actorId()) {
      case 8:
      case 10:
      case 11:
        return true;
    }
    return false;
  };
  Game_EroActor.prototype.upEro = function (type, value) {
    if (!this._eroCount[type]) {
      this._eroCount[type] = 0;
    }
    this._eroCount[type] += value;
  };
  Game_EroActor.prototype.countAv = function (type) {
    switch (type) {
      case AvEroType.avCount:
        return $slg.avInfo().actorAvList(this.actorId()).length;
      case AvEroType.number:
        return this.countAvNumber();
    }
    return 0;
  };
  Game_EroActor.prototype.countAvNumber = function () {
    var list = $slg.avInfo().actorAvList(this.actorId());
    var n = 0;
    for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
      var av = list_1[_i];
      if (av.isFinishSale()) {
        n += av.realSales();
      }
    }
    return n;
  };
  Game_EroActor.prototype.mankoId = function () {
    return 0;
  };
  Game_EroActor.prototype.analId = function () {
    return 1;
  };
  Game_EroActor.prototype.attributeList = function () {
    return this.skills();
  };
  Game_EroActor.prototype.manParam = function (param) {
    var manParam = MAN_PARAMS[this.actorId()];
    if (!manParam) {
      console.error(this.actorId() + " の MAN_PARAMS が見つかりません");
      return 0;
    }
    return manParam[param];
  };
  Game_EroActor.prototype.manSkillList = function () {
    var result = [];
    var manParam = MAN_PARAMS[this.actorId()];
    if (!manParam) {
      console.error(this.actorId() + " の MAN_PARAMS が見つかりません");
      return result;
    }
    var skill1 = findManSkill(manParam.skill1);
    var skill2 = findManSkill(manParam.skill2);
    var skill3 = findManSkill(manParam.skill3);
    if (skill1) {
      result.push(skill1);
    }
    if (skill2) {
      result.push(skill2);
    }
    if (skill3) {
      result.push(skill3);
    }
    return result;
  };
  Game_EroActor.prototype.job = function () {
    var manParam = MAN_PARAMS[this.actorId()];
    if (!manParam) {
      console.error(this.actorId() + " の MAN_PARAMS が見つかりません");
      return "";
    }
    if (ConfigManager.language == "en") {
      return manParam.jobEn;
    }
    return manParam.job;
  };
  return Game_EroActor;
})(Game_CostumeActor);


code:
/*:ja
 * @target MZ
 * @author ル
 *
 * @command PreloadJpg
 * @text JPGロード
 * @des JPGロード
 * @arg file
 * @type string
 * @text file
 * @desc file
 *
 * @command PreloadWebp
 * @text webpロード
 * @des webpロード
 * @arg file
 * @type string
 * @text file
 * @desc file
 *
 * @command PreloadWebp2
 * @text webpリストロード
 * @des webpリストロード
 * @arg file
 * @type string
 * @text file
 * @desc file
 *
 * @command ReleaseWebp
 * @text webpリリース
 * @des webpリリース
 * @arg file
 * @type string
 * @text file
 * @desc file
 *
 * @command IgnoreFile
 * @text 画像無視
 * @des 画像無視
 * @arg file
 * @type string
 * @text 無視するファイルID
 * @desc 無視するファイルID(01_02)
 * @arg index
 * @type number
 * @text インデックス
 * @desc インデックス
 * @arg note
 * @text ノート
 * @type string
 *
 * @command IgnoreFileList
 * @text 画像無視リスト
 * @des 画像無視リスト
 * @arg file
 * @type string
 * @text 無視するファイルID
 * @desc 無視するファイルID(01_02)
 * @arg indexList
 * @type string
 * @text インデックス
 * @desc インデックス
 *
 * @command removeIgnore
 * @text 画像無視解除
 * @des 画像無視解除
 * @arg file
 * @type string
 * @text 無視するファイルID
 * @desc 無視するファイルID(01_02)
 * @arg index
 * @type number
 * @text インデックス
 * @desc インデックス
 *
 * @command setEroBase
 * @text 基本画像設定
 * @des 基本画像設定
 * @arg value
 * @type number
 *
 * @command hideGion
 *
 * @command hideAegi
 *
 */
var Nore;
(function (Nore) {
  Nore.GION_PIC_ID = 27;
  Nore.AEGI_PIC_ID = 29;
  var GION_RANDOM_X = 70;
  var AEGI_RANDOM_X = 160;
  Nore.spriteSheetCache = {};
  function isCached(id) {
    if (!PIXI.utils.BaseTextureCache) {
      return false;
    }
    return PIXI.utils.BaseTextureCache["img/ero/ero%1_1.webp".format(id)];
  }
  Nore.isCached = isCached;
  var cgFolder = "ero";
  var jpegPrefix = "__CG_JPG__";
  Nore.gionPrefix = "0gion_";
  Nore.aegiPrefix = "0aegi_";
  Nore.webpPrefix = "__CG_WEBP__";
  var pluginName = "Nore_EroImg";
  PluginManager.registerCommand(pluginName, "PreloadJpg", function (args) {
    ImageManager.loadJpeg(args.file);
  });
  PluginManager.registerCommand(pluginName, "PreloadWebp", function (args) {
    preloadWebp(args.file);
    this.setWaitMode("image");
  });
  PluginManager.registerCommand(pluginName, "PreloadWebp2", function (args) {
    preloadWebp2(args.file);
    this.setWaitMode("image");
  });
  function preloadWebp2(imageId, callback) {
    if (callback === void 0) {
      callback = null;
    }
    var max = WEBP_FILES[imageId];
    if (!max) {
      console.error("webp 情報が存在しません:" + imageId);
      return;
    }
    var callbackCount = 0;
    var localCallbak = null;
    if (max > 1) {
      localCallbak = function () {
        callbackCount++;
        if (callbackCount == max) {
          ImageManager._loadingSpriteSheet = false;
          if (callback) {
            callback();
          }
        } else {
          ImageManager._loadingSpriteSheet = true;
        }
      };
    }
    for (var i = 0; i < max; i++) {
      var file = imageId + "_" + (i + 1);
      if (localCallbak) {
        preloadWebp(file, localCallbak);
      } else {
        preloadWebp(file, callback);
      }
    }
  }
  Nore.preloadWebp2 = preloadWebp2;
  function preloadWebp(fileName, callback) {
    if (callback === void 0) {
      callback = null;
    }
    var file = "img/ero/ero" + fileName + ".json";
    var sheet = Nore.spriteSheetCache[file];
    if (sheet) {
      if (callback) {
        callback();
      }
      return;
    }
    p("load:" + fileName);
    ImageManager.loadSpriteSheet(file, callback);
  }
  Nore.preloadWebp = preloadWebp;
  function isWebpLoaded(fileName) {
    var file = "img/ero/ero" + fileName + ".json";
    var sheet = Nore.spriteSheetCache[file];
    if (sheet) {
      return true;
    }
    return false;
  }
  Nore.isWebpLoaded = isWebpLoaded;
  PluginManager.registerCommand(pluginName, "ReleaseWebp", function (args) {
    releaseWebp(args.file);
  });
  function releaseWebp(fileName) {
    var file = "img/ero/ero" + fileName + ".json";
    var lastIndex = (fileName + "").lastIndexOf("_");
    var successFirst = ImageManager.releaseSpriteSheetPath(file);
    if (successFirst) {
      p("release:" + file);
    }
    if (lastIndex > 0) {
      var base = fileName.substring(0, lastIndex + 1);
      var start = parseInt(fileName.substring(lastIndex + 1));
      for (var i = start + 1; i < 7; i++) {
        var otherFile = "img/ero/ero" + base + i + ".json";
        var success = ImageManager.releaseSpriteSheetPath(otherFile, true);
        if (!success) {
          return;
        }
        p("release:" + otherFile);
      }
    }
  }
  Nore.releaseWebp = releaseWebp;
  PluginManager.registerCommand(pluginName, "IgnoreFile", function (args) {
    var index = args.index;
    var file = args.file;
    $gameTemp.addIgnoreFileSet(file, index);
  });
  PluginManager.registerCommand(pluginName, "IgnoreFileList", function (args) {
    var file = args.file;
    var indexList = args.indexList;
    var list = indexList.split(",");
    for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
      var i = list_1[_i];
      $gameTemp.addIgnoreFileSet(file, i);
    }
  });
  PluginManager.registerCommand(pluginName, "removeIgnore", function (args) {
    var index = args.index;
    var file = args.file;
    $gameTemp.removeIgnoreFileSet(file, index);
  });
  PluginManager.registerCommand(pluginName, "setEroBase", function (args) {
    var file = Math.trunc(args.value);
    $gameTemp.setEroBaseId(file);
  });
  PluginManager.registerCommand(pluginName, "showGion", function (args) {
    var file = args.id;
    $gameTemp.showGion(file);
  });
  PluginManager.registerCommand(pluginName, "hideGion", function (args) {
    $gameTemp.hideGion();
  });
  PluginManager.registerCommand(pluginName, "showAegi", function (args) {
    var file = args.id;
    $gameTemp.showAegi(file);
  });
  PluginManager.registerCommand(pluginName, "setAegiIds", function (args) {
    $gameTemp.setAegiIds(args.ids);
  });
  PluginManager.registerCommand(pluginName, "showAegiRandom", function (args) {
    var file = Nore.shuffle(args.ids)[0];
    $gameTemp.showAegi(file);
  });
  PluginManager.registerCommand(pluginName, "hideAegi", function (args) {
    $gameTemp.hideAegi();
  });
  PluginManager.registerCommand(pluginName, "SetEroId", function (args) {
    $gameTemp.setEroId(args.id);
  });
  ImageManager.preloadEro = function (filename, hue, smooth) {
    var folder = "img/ero/";
    if (filename) {
      var path = folder + encodeURIComponent(filename) + ".jpg";
      var key = path + ":" + hue;
      this.cache2 = this.cache2 || {};
      if (!this._cache2[key]) {
        this.loadNormalBitmap2(path, hue || 0);
      }
    }
  };
  ImageManager.loadEro = function (filename, hue, smooth) {
    return this.loadBitmap("img/" + cgFolder + "/", filename, hue, true);
  };
  ImageManager.loadWebp = function (filename, hue) {
    return this._loadWebp("img/" + cgFolder + "/", filename, hue, true);
  };
  ImageManager._loadWebp = function (folder, filename, hue, smooth) {
    if (filename) {
      var path = folder + encodeURIComponent(filename) + ".webp";
      var bitmap = this.loadNormalBitmap2(path, hue || 0);
      bitmap.smooth = smooth;
      return bitmap;
    } else {
      return this.loadEmptyBitmap();
    }
  };
  ImageManager.loadJpeg = function (filename, hue) {
    return this._loadJpeg("img/" + cgFolder + "/", filename, hue, true);
  };
  ImageManager._loadJpeg = function (folder, filename, hue, smooth) {
    if (filename) {
      var path = folder + encodeURIComponent(filename) + ".jpg";
      var bitmap = this.loadNormalBitmap2(path, hue || 0);
      bitmap.smooth = smooth;
      return bitmap;
    } else {
      return this.loadEmptyBitmap();
    }
  };
  ImageManager.loadNormalBitmap2 = function (path, hue) {
    var key = path + ":" + hue;
    this.cache2 = this.cache2 || {};
    var bitmap = this.cache2[key];
    if (!bitmap) {
      bitmap = Bitmap.load(path);
      bitmap.addLoadListener(function () {
        bitmap.rotateHue(hue);
      });
      this.cache2[key] = bitmap;
    }
    return bitmap;
  };
  ImageManager.clearEro = function () {
    p("clearEro");
    this.cache2 = this.cache2 || {};
    for (var key in this.cache2) {
      this.cache2[key].destroy();
    }
    this.cache2 = {};
  };
  ImageManager.releaseSpriteSheet = function (file) {
    var path = "img/ero/" + file + ".json";
    this.releaseSpriteSheetPath(path);
  };
  ImageManager.releaseSpriteSheetPath = function (path, ignoreError) {
    if (ignoreError === void 0) {
      ignoreError = false;
    }
    var sheet = Nore.spriteSheetCache[path];
    if (!sheet) {
      if (!ignoreError) {
        console.error(path);
      }
      return false;
    }
    delete Nore.spriteSheetCache[path];
    //p('release:' + path);
    var baseTex = null;
    for (var key in sheet.textures) {
      sheet.textures[key].destroy(true);
      baseTex = sheet.textures[key].baseTexture;
    }
    PIXI.Texture.removeFromCache(PIXI.utils.TextureCache[path]);
    PIXI.Texture.removeFromCache(PIXI.utils.TextureCache[path + "_image"]);
    if (baseTex) {
      baseTex.destroy(true);
      Graphics.callGC();
    }
    return true;
  };
  Sprite_Picture.prototype.clear = function () {
    this.eroAnime = null;
    this._pictureName = "";
    if (this._gionSprite) {
      this.removeChildren();
      this._gionSprite = null;
    }
    if (this._aegiSprite) {
      this.removeChildren();
      this._aegiSprite = null;
    }
    this.update();
  };
  var _Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap;
  Sprite_Picture.prototype.loadBitmap = function () {
    if (this._pictureName instanceof Array) {
      $gameTemp.ignoreFiles = {};
      this.drawEroList(this._pictureName);
    } else if (this._pictureName.indexOf(Nore.gionPrefix) === 0) {
      var gionId_1 = this._pictureName;
      this.eroGionFrame = 100;
      this.drawGionPicture(gionId_1);
    } else if (this._pictureName.indexOf(Nore.aegiPrefix) === 0) {
      var aegiId_1 = this._pictureName;
      this.eroAegiFrame = 140;
      //this.drawAegiPicture(aegiId);
    } else if (this._pictureName.indexOf(jpegPrefix) === 0) {
      this.eroAnime = null;
      this.bitmap = ImageManager.loadJpeg(
        this._pictureName.substr(jpegPrefix.length)
      );
    } else if (this._pictureName.indexOf(Nore.webpPrefix) === 0) {
      var file = this._pictureName.substr(Nore.webpPrefix.length);
      if (file.length <= 17) {
        this.eroAnime = null;
        this.drawEro(file);
      } else {
        try {
          var json = JSON.parse(file);
          var wait = Math.floor(json.wait);
          this.eroAnime = json.pic;
          this.eroAnimeIndex = 0;
          this.eroAnimeWait = wait;
          this.eroAnimeFrameIndex = 0;
          this.eroSeIndex = json.seIndex;
          this.eroGionIndex = json.gionIndex;
          this.eroOnce = json.once;
          this.eroSeList = json.se;
          this.eroGionList = json.gion;
          this.drawEro(this.eroAnime[this.eroAnimeIndex]);
        } catch (e) {
          p(file);
          throw e;
        }
      }
    } else {
      _Sprite_Picture_loadBitmap.call(this);
    }
  };
  var _Sprite_Picture_update = Sprite_Picture.prototype.update;
  Sprite_Picture.prototype.update = function () {
    _Sprite_Picture_update.call(this);
    if (this._pictureName.indexOf(Nore.webpPrefix) === 0) {
      if (this._lastManAlpha != $gameSystem.manAlpha()) {
        var file = this._pictureName.substr(Nore.webpPrefix.length);
        if (file.length <= 15) {
          this.loadBitmap();
        }
      }
      this._lastManAlpha = $gameSystem.manAlpha();
    }
  };
  Sprite_Picture.prototype.drawGionPicture = function (filename) {
    var texture = PIXI.utils.TextureCache[filename + ".png"];
    if (!texture) {
      //p('gion が見つかりません:' + filename)
      return;
    }
    if (this._gionSprite) {
      this.removeChildren();
      this._gionSprite = null;
    }
    if (this._gionSprite) {
      return;
    }
    var sprite = new PIXI.Sprite(texture);
    sprite.x = -(texture.trim.width / 2);
    sprite.y = -(texture.trim.height / 2);
    this.removeChildren();
    this.addChild(sprite);
    this._gionSprite = sprite;
  };
  Sprite_Picture.prototype.drawAegiPicture = function (filename) {
    var texture = PIXI.utils.TextureCache[filename + ".png"];
    if (!texture) {
      //p('aegi が見つかりません:' + filename)
      return;
    }
    if (this._aegiSprite) {
      this.removeChildren();
      this._aegiSprite = null;
    }
    if (this._aegiSprite) {
      return;
    }
    var sprite = new PIXI.Sprite(texture);
    sprite.x = -(texture.trim.width / 2);
    sprite.y = -(texture.trim.height / 2);
    this.removeChildren();
    this.addChild(sprite);
    this._aegiSprite = sprite;
  };
  var _ImageManager_loadPicture = ImageManager.loadPicture;
  ImageManager.loadPicture = function (filename) {
    if (filename.indexOf(Nore.webpPrefix) === 0) {
      return;
    }
    return _ImageManager_loadPicture.call(this, filename);
  };
  Sprite_Picture.prototype.drawEro = function (file) {
    if (file.contains("omanko")) {
      this.drawOmanko(file);
      return;
    }
    var renderTexture = $gameTemp.getActorBitmapBodyCache(this._pictureId);
    var s = new PIXI.Sprite();
    var index = file.indexOf("_") == 2 ? 6 : 7;
    switch ($gameVariables.value(10)) {
      case 1:
        this.drawEro2(s, file.substr(0, index) + "back1");
        break;
      case 2:
        this.drawEro2(s, file.substr(0, index) + "back2");
        break;
      case 3:
        this.drawEro2(s, file.substr(0, index) + "back3");
        break;
      case 4:
        this.drawEro2(s, file.substr(0, index) + "back4");
        break;
    }
    //p(file)
    var max = $gameVariables.value(14);
    for (var i = 1; i <= max; i++) {
      var imageId = i.padZero(2);
      this.drawEro2(s, file + "_" + imageId, file, i);
    }
    //this.drawNakaRakugaki(s, file);
    var renderer = Graphics.app.renderer;
    renderer.render(s, renderTexture);
    var sprite = new PIXI.Sprite(renderTexture);
    this.removeChildren();
    this._eroSprite = sprite;
    this.addChild(sprite);
  };
  Sprite_Picture.prototype.drawNakaRakugaki = function (s, fileId) {
    var eroBaseId = $gameTemp.eroBaseId();
    if (eroBaseId == 0) {
      return;
    }
    if (!fileId) {
      return;
    }
    var list = fileId.split("_");
    var actorId = Math.trunc(list[0]);
    var eroId = Math.trunc(list[2]);
    var animeId;
    if ($gameSwitches.value(10)) {
      animeId = eroBaseId;
    } else {
      if ($gameSwitches.value(11)) {
        animeId = eroBaseId + (eroId % 100);
      } else {
        animeId = eroBaseId + (eroId % 10);
      }
    }
    var actor = $gameActors.actor(actorId);
    var nakadashi = Math.min(
      actor.nakadashiRakugakiCount(),
      $gameTemp.maxNakadashiRakuagki()
    );
    var baseFileId =
      list[0] +
      "_" +
      list[1] +
      "_" +
      animeId.padZero(2) +
      "_" +
      "naka_" +
      nakadashi.padZero(2);
    var texture = this.selectTexture(s, baseFileId);
    if (!texture) {
      return null;
    }
    var sprite = new PIXI.Sprite(texture);
    sprite.x = $gameVariables.value(45);
    sprite.y = $gameVariables.value(46);
    s.addChild(sprite);
  };
  Sprite_Picture.prototype.drawEroList = function (fileList) {
    var renderTexture = $gameTemp.getActorBitmapBodyCache(this._pictureId);
    var s = new PIXI.Sprite();
    //this.drawEro2(s, '01_50_back');
    for (var i = 0; i < fileList.length; i++) {
      this.drawEro2(s, fileList[i]);
    }
    var renderer = Graphics.app.renderer;
    renderer.render(s, renderTexture);
    var sprite = new PIXI.Sprite(renderTexture);
    this.removeChildren();
    this._eroSprite = sprite;
    this.addChild(sprite);
  };
  var _Sprite_Picture_prototype_destroy = Sprite_Picture.prototype.destroy;
  Sprite_Picture.prototype.destroy = function () {
    if (this._eroSprite) {
      this.removeChild(this._eroSprite);
      this._eroSprite = null;
    }
    _Sprite_Picture_prototype_destroy.call(this);
  };
  Sprite_Picture.prototype.drawEro2 = function (s, file, fileId, index, alpha) {
    if (alpha === void 0) {
      alpha = 1;
    }
    var texture = this.selectEro2Texture(s, file, fileId, index);
    if (!texture) {
      return;
    }
    //p(texture.textureCacheIds)
    var sprite = new PIXI.Sprite(texture);
    sprite.x = $gameVariables.value(45);
    sprite.y = $gameVariables.value(46);
    if (alpha < 1) {
      sprite.alpha = alpha;
    }
    s.addChild(sprite);
    if ($gameVariables.value(49) > 0) {
      if (texture.textureCacheIds.length > 0) {
        if (texture.textureCacheIds[0].includes("man")) {
          //sprite.alpha = $gameSystem.manAlpha();
          var sprite_1 = new PIXI.Sprite(texture);
          sprite_1.x = $gameVariables.value(45);
          sprite_1.y = $gameVariables.value(46);
          s.addChild(sprite_1);
          setManColorFilter($gameVariables.value(49), sprite_1);
          /*
                    if ($gameVariables.value(49) == 1) {

                        const filter = new PIXI.filters.ColorMatrixFilter();
                        //filter.colorTone(0, 0, '0x412130', '0x000000', false);
                        filter.vintage(true);
                        sprite.filters = [filter];
                    }
                    if ($gameVariables.value(49) == 2) {
                        const filter = new PIXI.filters.ColorMatrixFilter();
                        //filter.colorTone(0, 0, '0x412130', '0x000000', false);
                        filter.sepia (false);
                        sprite.filters = [filter];
                        sprite.alpha = 0.5;
                    }
                        */
        }
      }
    }
  };
  Sprite_Picture.prototype.selectEro2Texture = function (
    s,
    file,
    fileId,
    index
  ) {
    var texture = this.selectTexture(s, file);
    if (texture) {
      return texture;
    }
    var eroBaseId = $gameTemp.eroBaseId();
    if (eroBaseId == 0) {
      return null;
    }
    if (!fileId) {
      return null;
    }
    var list = fileId.split("_");
    var eroId = Math.trunc(list[2]);
    var animeId;
    if ($gameSwitches.value(10)) {
      animeId = eroBaseId;
    } else {
      if ($gameSwitches.value(11)) {
        animeId = eroBaseId + (eroId % 100);
      } else {
        animeId = eroBaseId + (eroId % 10);
      }
    }
    var baseFileId =
      list[0] +
      "_" +
      list[1] +
      "_" +
      animeId.padZero(2) +
      "_" +
      index.padZero(2);
    texture = this.selectTexture(s, baseFileId);
    if (texture) {
      return texture;
    }
    if ($gameSwitches.value(12)) {
      var baseFileId4 =
        list[0] +
        "_" +
        list[1] +
        "_" +
        Math.floor(eroId / 10) * 10 +
        "_" +
        index.padZero(2);
      texture = this.selectTexture(s, baseFileId4);
      if (!texture) {
        return null;
      }
    } else {
      // ベースの index
      var animeId_1 = eroBaseId;
      var baseFileId2 =
        list[0] +
        "_" +
        list[1] +
        "_" +
        animeId_1.padZero(2) +
        "_" +
        index.padZero(2);
      texture = this.selectTexture(s, baseFileId2);
      if (texture) {
        return texture;
      }
      // 今の
      if (!$gameSwitches.value(11)) {
        return null;
      }
      //animeId = Math.round(eroId / 100) * 100 + ;
      var baseFileId3 =
        list[0] + "_" + list[1] + "_" + eroId + "_" + index.padZero(2);
      texture = this.selectTexture(s, baseFileId3);
      if (!texture) {
        return null;
      }
    }
    return texture;
  };
  Sprite_Picture.prototype.selectTexture = function (s, file) {
    if ($gameTemp.ignoreFiles[file]) {
      return null;
    }
    var boteId = $gameVariables.value(980);
    var manId = $gameVariables.value(48);
    if (manId > 0) {
      var manFile = file + "_man" + manId.padZero(2) + ".png";
      if (boteId > 0) {
        var texture1_1 =
          PIXI.utils.TextureCache[
            file + "_man" + manId.padZero(2) + "_bote" + boteId + ".png"
          ];
        if (texture1_1) {
          return texture1_1;
        }
        var texture2 =
          PIXI.utils.TextureCache[
            file + "_man" + manId.padZero(2) + "_bote" + ".png"
          ];
        if (texture2) {
          return texture2;
        }
      }
      var texture1 = PIXI.utils.TextureCache[manFile];
      if (texture1) {
        return texture1;
      }
    }
    var mankoId = $gameVariables.value(979);
    if (mankoId > 0) {
      var mankoFile = file + "_omanko0" + mankoId + ".png";
      var texture1 = PIXI.utils.TextureCache[mankoFile];
      if (texture1) {
        return texture1;
      }
    }
    var analId = $gameVariables.value(976);
    if (analId > 0) {
      var analFile = file + "_anal0" + analId + ".png";
      var texture1 = PIXI.utils.TextureCache[analFile];
      if (texture1) {
        return texture1;
      }
    }
    if (boteId > 0) {
      var texture1 = PIXI.utils.TextureCache[file + "_bote" + boteId + ".png"];
      if (texture1) {
        return texture1;
      }
      var texture2 = PIXI.utils.TextureCache[file + "_bote" + ".png"];
      if (texture2) {
        return texture2;
      }
    }
    var texture = PIXI.utils.TextureCache[file + ".png"];
    if (texture) {
      return texture;
    }
    return texture;
  };
  Sprite_Picture.prototype.updateGion = function () {
    if (this.eroGionFrame > 0) {
    } else {
      return;
    }
    if (!this._gionSprite) {
      return;
    }
    if (
      $gameTemp.gionId &&
      Nore.gionPrefix + $gameTemp.gionId == this._pictureName
    ) {
      return;
    }
    this.eroGionFrame--;
    this.eroGionFrame--;
    this.eroGionFrame--;
    this.eroGionFrame--;
    //p(this.eroGionFrame)
    var f = this.eroGionFrame;
    var opacity = 255;
    if (f > 70) {
      opacity = 255 - (f - 70) * 5;
    } else if (f < 40) {
      opacity = f * 6;
    } else {
      opacity = 255;
    }
    this._gionSprite.alpha = opacity / 255;
    if (this.eroGionFrame <= 0) {
      this.removeChildren();
      this._gionSprite = null;
      this.eroGionFrame = 0;
      this._pictureName = "";
      var picture = this.picture();
      picture.initBasic();
    }
  };
  Sprite_Picture.prototype.updateAegiSprite = function () {
    if (this.eroAegiFrame > 0) {
    } else {
      return;
    }
    if (!this._aegiSprite) {
      return;
    }
    if (
      $gameTemp.aegiId &&
      Nore.aegiPrefix + $gameTemp.aegiId == this._pictureName
    ) {
      return;
    }
    this.eroAegiFrame--;
    this.eroAegiFrame--;
    this.eroAegiFrame--;
    //p(this.eroAegiFrame)
    var f = this.eroAegiFrame;
    var opacity = 255;
    if (f > 70) {
      opacity = 255 - (f - 70) * 5;
    } else if (f < 40) {
      opacity = f * 6;
    } else {
      opacity = 255;
    }
    this._aegiSprite.alpha = opacity / 255;
    if (this.eroAegiFrame <= 0) {
      this.removeChildren();
      this._aegiSprite = null;
      this.eroAegiFrame = 0;
      this._pictureName = "";
      var picture = this.picture();
      picture.initBasic();
    }
  };
  var Sprite_Picture_prototype_updateOther =
    Sprite_Picture.prototype.updateOther;
  Sprite_Picture.prototype.updateOther = function () {
    Sprite_Picture_prototype_updateOther.call(this);
    this.updateGion();
    this.updateAegiSprite();
    var picture = this.picture();
    this.opacity = picture.opacity();
    this.blendMode = picture.blendMode();
    this.alpha = this.opacity / 255;
    this.rotation = (picture.angle() * Math.PI) / 180;
    var lastIndex = this.eroAnimeIndex;
    if (this.opacity == 0 || !this.visible) {
      return;
    }
    if (this.eroAnime) {
      if ($gameSwitches.value(10)) {
        return;
      }
      this.alpha = 1;
      this.eroAnimeFrameIndex++;
      if (this.eroAnimeFrameIndex >= this.eroAnimeWait) {
        this.eroAnimeFrameIndex = 0;
        this.eroAnimeIndex++;
        if (this.eroAnimeIndex >= this.eroAnime.length) {
          this.eroAnimeIndex = 0;
          if (this.eroOnce) {
            this.eroAnimeIndex = this.eroAnime.length - 1;
          }
        }
        this.drawEro(this.eroAnime[this.eroAnimeIndex]);
        if (this.eroSeIndex == this.eroAnimeIndex) {
          var dice = Math.floor(this.eroSeList.length * Math.random());
          var se = this.eroSeList[dice];
          if (typeof se == "object") {
            for (var i = 0; i < se.length; i++) {
              AudioManager.playSe({
                name: se[i],
                volume: 100,
                pitch: 100,
                pan: 0,
              });
            }
          } else {
            AudioManager.playSe({ name: se, volume: 100, pitch: 100, pan: 0 });
          }
        }
        if (this.eroGionIndex == this.eroAnimeIndex) {
          var dice = Math.floor(this.eroGionList.length * Math.random());
          var gion = this.eroGionList[dice];
          var xx = $gameVariables.value(41);
          var yy = $gameVariables.value(42);
          var scale = $gameVariables.value(43) || 100;
          if (typeof gion == "object") {
            for (var i = 0; i < se.length; i++) {
              //AudioManager.playSe({ name: se[i], volume: 100, pitch: 100, pan: 0 });
            }
          } else {
            var opacity = 255;
            xx += Math.randomInt(GION_RANDOM_X) - GION_RANDOM_X / 2;
            yy += Math.randomInt(30) - 15;
            var nextGion = nextGionId();
            $gameScreen.showPicture(
              nextGion,
              Nore.gionPrefix + gion,
              0,
              xx,
              yy,
              scale,
              scale,
              opacity,
              PIXI.BLEND_MODES.NORMAL
            );
            //AudioManager.playSe({ name: se, volume: 100, pitch: 100, pan: 0 });
          }
        }
        if (lastIndex != this.eroAnimeIndex) {
          this.updateAegi();
        }
      }
    }
  };
  Sprite_Picture.prototype.drawOmanko = function (file) {
    //p(file)
    var list = file.split("_omanko_");
    var base = list[0];
    var faceId = list[1];
    var s = new PIXI.Sprite();
    var actorId = parseInt(base.split("_")[0]);
    var actor = $gameActors.actor(actorId);
    var boteId = actor.boteId;
    // back
    this.drawEro2(s, base + "_back_01");
    if (actor.boteId > 0) {
      this.drawEro2(s, base + "_bote_0" + actor.boteId);
    } else {
      this.drawEro2(s, base + "_base_01");
    }
    // おまんこ
    var mankoId = $gameVariables.value(979);
    var mankoFile = "%1_manko_%2".format(base, mankoId.padZero(2));
    p(mankoFile);
    this.drawEro2(s, mankoFile);
    var kFile = "%1_manko_k_%2".format(base, mankoId.padZero(2));
    this.drawEro2(s, kFile, null, null, actor.mankoKuroImageAlpha());
    var kuroFile = "%1_kuro_01".format(base);
    this.drawEro2(s, kuroFile, null, null, actor.chikubiKuroImageAlpha());
    // アナル
    var analId = Math.max(1, $gameVariables.value(976));
    var analFile = "%1_anal_%2".format(base, analId.padZero(2));
    this.drawEro2(s, analFile);
    // 入れ墨
    if (actor.hasAcce(1080)) {
      var acceFile = "%1_irezumi_01".format(base);
      if (actor.boteId > 0) {
        acceFile = "%1_irezumi_02".format(base);
      }
      this.drawEro2(s, acceFile);
    }
    // へそピアス
    if (actor.hasAcce(1003) || actor.hasAcce(1004)) {
      var hesoFile = "%1_heso_%2".format(base, (boteId + 1).padZero(2));
      this.drawEro2(s, hesoFile);
    }
    // 精液
    /*
        const nakadashi = history.countNakadashi();
        $gameSwitches.setValue(88, false);
        if (nakadashi > 0) {
            $gameSwitches.setValue(88, true);
            if ($gameVariables.value(95) == 0) {

                let dice = Math.randomInt(3) + 1;
                $gameVariables.setValue(95, dice);
            }
            const seiekiId = $gameVariables.value(95);
            let seiekiFile = '%1_seieki%2'.format(base, seiekiId);
            this.drawEro2(s, seiekiFile);
        }
            */
    // ラビアピアス
    if (actor.hasAcce(1008)) {
      var labiaFile = "%1_labia_%2".format(base, mankoId.padZero(2));
      this.drawEro2(s, labiaFile);
    }
    // 乳首ピアス
    if (actor.hasAcce(1001) || actor.hasAcce(1002)) {
      var nippleId = 1;
      var nippleFile = "%1_nipple_%2".format(base, boteId.padZero(2));
      this.drawEro2(s, nippleFile);
    }
    // ボンテージ
    if (actor.outerId == "c") {
      var bontageFile = "%1_bontage_01".format(base);
      if (actor.actorId() == 4 && actor.boteId > 0) {
        bontageFile = "%1_bontage_02".format(base);
      }
      this.drawEro2(s, bontageFile);
    }
    // 首輪
    /*if (actor.hasAcce(1002) || actor.hasAcce(1003)) {
            let acce20File = '%1_acce02'.format(base);
            this.drawEro2(s, acce20File);

            }*/
    if ($gameVariables.value(974) > 0) {
      // ほっぺ
      var hoppeId = $gameVariables.value(974);
      var hoppeFile = "%1_hoppe_%2".format(base, hoppeId.padZero(2));
      this.drawEro2(s, hoppeFile);
    }
    // 顔
    var faceFormat = "%1_face_%2";
    if (actor.isBottomHightlight()) {
      faceFormat = "%1_face_%2_l";
    } else if (actor.isNoHightlight()) {
      faceFormat = "%1_face_%2_n";
    }
    var faceFile = faceFormat.format(base, faceId.padZero(2));
    this.drawEro2(s, faceFile);
    if ($gameVariables.value(975) > 0) {
      // 涙
      var namidaId = $gameVariables.value(975);
      var namidaOptionId = actor.namidaOptionId(faceId);
      var namidaFile = void 0;
      if (namidaOptionId > 0) {
        namidaFile = "%1_namida_%2_%3".format(
          base,
          namidaId.padZero(2),
          namidaOptionId.padZero(2)
        );
      } else {
        namidaFile = "%1_namida_%2".format(base, namidaId.padZero(2));
      }
      this.drawEro2(s, namidaFile);
    }
    // 目隠し
    if (actor.hasAcce(1020)) {
      var acce20File = "%1_acce20".format(base);
      this.drawEro2(s, acce20File);
    }
    // 首輪の鎖
    if (actor.hasAcce(1003)) {
      var acce20File = "%1_acce03".format(base);
      this.drawEro2(s, acce20File);
    }
    // 鼻フック
    if (actor.hasAcce(1038)) {
      var acce38File = "%1_acce38".format(base);
      this.drawEro2(s, acce38File);
    }
    // 出産マーク
    var babyList = actor.babyList();
    if (actor.hasAcce(1021)) {
      for (var i = 0; i < babyList.length; i++) {
        var baby = babyList[i];
        var index = i + 1;
        var file_1 = this.getSyusanAcceFile(base, actor, index, baby.isMale());
        //p(file)
        if (PIXI.utils.TextureCache[file_1 + ".png"]) {
          this.drawEro2(s, file_1);
        }
      }
    }
    // 口
    var kuchiId = actor.mankoKuchiId();
    if (kuchiId > 0) {
      var kuchiFile = "%1_kuchi_%2".format(base, kuchiId.padZero(2));
      p(kuchiFile);
      this.drawEro2(s, kuchiFile);
    }
    // 目隠し
    var mekakushiId = actor.mankoMekakushiId();
    if (mekakushiId > 0) {
      var kuchiFile = "%1_mekakushi_%2".format(base, mekakushiId.padZero(2));
      this.drawEro2(s, kuchiFile);
    }
    var renderer = Graphics.app.renderer;
    var renderTexture = $gameTemp.getActorBitmapBodyCache(this._pictureId);
    renderer.render(s, renderTexture);
    var sprite = new PIXI.Sprite(renderTexture);
    this.removeChildren();
    this._eroSprite = sprite;
    this.addChild(sprite);
  };
  Sprite_Picture.prototype.getSyusanAcceFile = function (
    baseId,
    actor,
    syusanCount,
    male
  ) {
    var boteId = actor.boteId;
    if (male) {
      if (boteId == 0) {
        return "%1_syusan_m_%2".format(baseId, syusanCount.padZero(2));
      } else {
        return "%1_syusan_m_%2_b".format(
          baseId,
          syusanCount.padZero(2),
          boteId
        );
      }
    } else {
      if (boteId == 0) {
        return "%1_syusan_f_%2".format(baseId, syusanCount.padZero(2));
      } else {
        return "%1_syusan_f_%2_b".format(
          baseId,
          syusanCount.padZero(2),
          boteId
        );
      }
    }
  };
  Sprite_Picture.prototype.updateAegi = function () {
    if (!this._aegiRemain) {
      this._aegiRemain = 120 + Math.randomInt(120);
    }
    this._aegiRemain--;
    if (this._aegiRemain == 0) {
      var aegi = $gameTemp.randomAegi();
      var opacity = 255;
      var xx = $gameVariables.value(54);
      var yy = $gameVariables.value(55);
      var scale = $gameVariables.value(56);
      xx += Math.randomInt(AEGI_RANDOM_X) - AEGI_RANDOM_X / 2;
      yy += Math.randomInt(30) - 15;
      var nextGion = nextAegiId();
      //p(aegi)
      $gameScreen.showPicture(
        nextGion,
        Nore.aegiPrefix + aegi,
        0,
        xx,
        yy,
        scale,
        scale,
        opacity,
        PIXI.BLEND_MODES.NORMAL
      );
    }
  };
  var gionId = 0;
  function nextGionId() {
    if (gionId == 0) {
      gionId++;
    } else {
      gionId = 0;
    }
    return Nore.GION_PIC_ID + gionId;
  }
  var aegiId = 0;
  function nextAegiId() {
    if (aegiId == 0) {
      aegiId++;
    } else {
      aegiId = 0;
    }
    return Nore.AEGI_PIC_ID + aegiId;
  }
  var _Scene_Map_updateMain = Scene_Map.prototype.updateMain;
  Scene_Map.prototype.updateMain = function () {
    _Scene_Map_updateMain.call(this);
    if ($gameSystem.isEroEvent()) {
      if (Input.isPressed("left")) {
        $gameSystem.downManAlpha();
      }
      if (Input.isPressed("right")) {
        $gameSystem.upManAlpha();
      }
    }
    var messageWindow = SceneManager._scene._messageWindow;
    if (!SceneManager._scene._messageWindow) {
      return;
    }
    if (Input.isTriggered("left")) {
      if (messageWindow.pause) {
        $gameSystem.downOuterAlpha();
      }
    }
    if (Input.isTriggered("right")) {
      if (messageWindow.pause) {
        $gameSystem.upOuterAlpha();
      }
    }
  };
})(Nore || (Nore = {}));
function setManColorFilter(manColorId, sprite) {
  if (manColorId == 1) {
    var filter = new PIXI.filters.ColorMatrixFilter();
    //filter.colorTone(0, 0, '0x412130', '0x000000', false);
    filter.vintage(true);
    sprite.filters = [filter];
  }
  if (manColorId == 2) {
    var filter = new PIXI.filters.ColorMatrixFilter();
    //filter.colorTone(0, 0, '0x412130', '0x000000', false);
    filter.sepia(false);
    sprite.filters = [filter];
    sprite.alpha = 0.5;
  }
  if (manColorId == 3) {
    var filter = new PIXI.filters.ColorMatrixFilter();
    //filter.colorTone(0, 0, '0x000000', '0x0000AA', true);
    filter.brightness(0.2, true);
    sprite.filters = [filter];
    sprite.alpha = 0.7;
  }
  if (manColorId == 4) {
    var filter = new PIXI.filters.ColorMatrixFilter();
    //filter.colorTone(0, 0, '0x000000', '0x0000AA', true);
    filter.technicolor(true);
    sprite.filters = [filter];
    sprite.alpha = 0.3;
  }
  if (manColorId == 5) {
    var filter = new PIXI.filters.ColorMatrixFilter();
    //filter.colorTone(0, 0, '0x000000', '0x0000AA', true);
    filter.night(0.2, true);
    sprite.filters = [filter];
    sprite.alpha = 0.3;
  }
  if (manColorId == 6) {
    var filter = new PIXI.filters.ColorMatrixFilter();
    //filter.colorTone(0, 0, '0x000000', '0x0000AA', true);
    filter.contrast(0.9, true);
    sprite.filters = [filter];
    sprite.alpha = 0.6;
  }
}