code:
var __extends =
  (this && this.__extends) ||
  (function () {
    var extendStatics = function (d, b) {
      extendStatics =
        Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array &&
          function (d, b) {
            d.__proto__ = b;
          }) ||
        function (d, b) {
          for (var p in b)
            if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
        };
      return extendStatics(d, b);
    };
    return function (d, b) {
      if (typeof b !== "function" && b !== null)
        throw new TypeError(
          "Class extends value " + String(b) + " is not a constructor or null"
        );
      extendStatics(d, b);
      function __() {
        this.constructor = d;
      }
      d.prototype =
        b === null
          ? Object.create(b)
          : ((__.prototype = b.prototype), new __());
    };
  })();
/*:ja
 * @target MZ
 * @author ル
 *
 *
 *
 * @command upEro
 * @text エロステータスアップ
 * @des エロステータスアップ
 * @arg actorId
 * @type number
 * @arg type
 * @type string
 * @desc kiss, manko, chichi, cri, anal, sm
 * @arg value
 * @type number
 *
 * @command initActor4
 * @text マリナの初期状態設定
 */
var NAKADASHI_RAKUGAKI_MAX = 20;
var Nore;
(function (Nore) {
  var pluginName = "Nore_Actor";
  PluginManager.registerCommand(pluginName, "upEro", function (args) {
    var actorId = parseInt(args.actorId);
    var value = parseInt(args.value);
    var actor = $gameActors.actor(actorId);
    actor.upEroParam(args.type, value);
  });
  PluginManager.registerCommand(pluginName, "initActor4", function (args) {
    var actor = $gameActors.actor(4);
    actor.upEroParam(AvRequired.kiss, 84);
    actor.upEroParam(AvRequired.cri, 28);
    actor.upEroParam(AvRequired.anal, 0);
    actor.upEroParam(AvRequired.sm, 13);
    actor.upEroParam(AvRequired.chichi, 49);
    actor.ninshin(41);
    actor.lastBaby().syusan();
    actor.setBote(0);
    actor.upEro(EroType.nakadashi, 27);
    actor.upEro(EroType.acme, 2);
  });
})(Nore || (Nore = {}));
Game_Actors.prototype.mainActor = function () {
  if ($gameVariables.value(5) > 1) {
    return this.actor($gameVariables.value(5));
  }
  return this.actor(1);
};
Game_Actors.prototype.actor = function (actorId) {
  if ($dataActors[actorId]) {
    if (!this._data[actorId]) {
      this._data[actorId] = new Game_Actor2(actorId);
    }
    return this._data[actorId];
  }
  return null;
};
var BabyProgress;
(function (BabyProgress) {
  BabyProgress["jusei"] = "jusei";
  BabyProgress["bote"] = "bote";
  BabyProgress["syusan"] = "syusan";
})(BabyProgress || (BabyProgress = {}));
var Baby = /** @class */ (function () {
  function Baby(actorId, taneoyaId) {
    this._time = 0;
    this._type = 1;
    this._actorId = actorId;
    this._taneoyaId = taneoyaId;
    this._progress = BabyProgress.jusei;
    this._male = Math.randomInt(2) == 0;
    this._type = Math.randomInt(2) + 1;
  }
  Baby.prototype.progress = function () {
    return this._progress;
  };
  Baby.prototype.actorId = function () {
    return this._actorId;
  };
  Baby.prototype.taneoyaId = function () {
    return this._taneoyaId;
  };
  Baby.prototype.setBote = function () {
    this._progress = BabyProgress.bote;
  };
  Baby.prototype.syusan = function () {
    this._progress = BabyProgress.syusan;
    this._time = $gameSystem.playtime();
  };
  Baby.prototype.isSyusan = function () {
    return this._progress == BabyProgress.syusan;
  };
  Baby.prototype.isBote = function () {
    return this._progress == BabyProgress.bote;
  };
  Baby.prototype.isJusei = function () {
    return this._progress == BabyProgress.jusei;
  };
  Baby.prototype.isMale = function () {
    return this._male;
  };
  Baby.prototype.taneoyaName = function () {
    var taneoya = $gameActors.actor(this.taneoyaId());
    if (!taneoya) {
      console.error(this.taneoyaId() + " の種親が見つかりません");
      return "";
    }
    return taneoya.name();
  };
  Baby.prototype.babyImageId = function () {
    var imageIndex = this.imageIndex();
    if (this.isBlack()) {
      return "$baby_02_0" + imageIndex;
    }
    if (this.isMale()) {
      return "$baby_01_ma_0" + imageIndex;
    } else {
      return "$baby_01_fe_0" + imageIndex;
    }
  };
  Baby.prototype.isBlack = function () {
    var taneyaParam = MAN_PARAMS[this.taneoyaId()];
    if (!taneyaParam) {
      return;
    }
    return taneyaParam.type == "外人";
  };
  Baby.prototype.imageIndex = function () {
    return this._type || 1;
  };
  Baby.prototype.growth = function () {
    if ($gameSystem.playtime() - this._time >= 5000) {
      return 2;
    }
    if ($gameSystem.playtime() - this._time >= 2000) {
      return 1;
    }
    return 0;
  };
  Baby.prototype.update = function () {
    if (this.isSyusan()) {
      this._time++;
    }
  };
  Baby.prototype.loadImage = function () {
    //p('loadImage:' + this.babyImageId())
    ImageManager.loadCharacter(this.babyImageId());
  };
  return Baby;
})();
var BodyChangeLv = /** @class */ (function () {
  function BodyChangeLv(level, equipAcce) {
    this.level = level;
    this.equipAcce = equipAcce;
  }
  return BodyChangeLv;
})();
var Game_Actor2 = /** @class */ (function (_super) {
  __extends(Game_Actor2, _super);
  function Game_Actor2() {
    var _this = (_super !== null && _super.apply(this, arguments)) || this;
    _this._lastCostumeList = [];
    _this._abilityMap = {};
    _this._fan = 0;
    _this._popularity = 0;
    _this._babyList = [];
    _this._mankoKuroValue = 0;
    _this._mankoHenkeiValue = 0;
    _this._chikubiKuroValue = 0;
    _this._mankoFaceId = 0;
    _this._mankoHoppeId = 0;
    _this._mankoNamidaId = 0;
    return _this;
  }
  Game_Actor2.prototype.setup = function (actorId) {
    _super.prototype.setup.call(this, actorId);
    this.setupEroParams();
  };
  Game_Actor2.prototype.friendshipLevel = function (manId) {
    var f = this.friendship(manId);
    return this.friendshipLevelByValue(f);
  };
  Game_Actor2.prototype.friendshipLevelByValue = function (f) {
    if (f < 15) {
      return FriendshipLevel.E;
    }
    if (f < 30) {
      return FriendshipLevel.D;
    }
    if (f < 50) {
      return FriendshipLevel.C;
    }
    if (f < 75) {
      return FriendshipLevel.B;
    }
    if (f < 100) {
      return FriendshipLevel.A;
    }
    return FriendshipLevel.S;
  };
  Game_Actor2.prototype.maxFriendship = function (manId) {
    if ($gameSystem.isRecollection()) {
      return 100;
    }
    var n = this.countSyusanMan(manId);
    switch (n) {
      case 0:
        return 75;
      default:
        return 100;
    }
  };
  Game_Actor2.prototype.friendship = function (manId) {
    this._friendshipMap = this._friendshipMap || {};
    return Math.min(this._friendshipMap[manId] || 0, this.maxFriendship(manId));
  };
  Game_Actor2.prototype.addFriendship = function (manId, value, allowMax) {
    this._friendshipMap = this._friendshipMap || {};
    var current = this._friendshipMap[manId] || 0;
    this._friendshipMap[manId] = Math.min(
      current + value,
      this.maxFriendship(manId)
    );
    if (current < 100) {
      if (this._friendshipMap[manId] >= 100) {
        if (!allowMax) {
          // AV撮影などでは MAX にならない
          this._friendshipMap[manId] = 99;
          return false;
        }
        return true;
      }
    }
    return false;
  };
  Game_Actor2.prototype.isNonokaDousei = function (makeAv) {
    if (makeAv) {
      return false;
    }
    if ($gameSwitches.value(252)) {
      return false;
    }
    if (this.actorId() != 9) {
      return false;
    }
    if (this.dousei().manId() != 19) {
      return false;
    }
    return true;
  };
  Game_Actor2.prototype.canDousei = function (manId) {
    if ($gameSwitches.value(263)) {
      switch (this._actorId) {
        case 4:
        case 9:
        case 13:
        case 17:
          return true;
      }
    }
    var avList = $slg.avInfo().actorAvList(this.actorId());
    for (var _i = 0, avList_1 = avList; _i < avList_1.length; _i++) {
      var av = avList_1[_i];
      if (av.mainManId() == manId) {
        if (av.nakadashi() > 0) {
          return true;
        }
        // アナルは対象外
        /*if (av.anal() > 0) {
                    return true;
                }*/
      }
    }
    return false;
  };
  Game_Actor2.prototype.setBote = function (boteId) {
    if (this._boteId == boteId) {
      return;
    }
    this._boteId = boteId;
    this.setCacheChanged();
  };
  Game_Actor2.prototype.canContraception = function () {
    if (this.actorId() == 4) {
      // マリナはレンを産んだ分がある
      return this.countSyusan() >= 2;
    } else {
      return this.countSyusan() >= 1;
    }
  };
  Game_Actor2.prototype.ninshin = function (taneoyaId) {
    if (taneoyaId == 0) {
      console.error("種親が設定されていません");
      throw {};
    }
    if (this.lastBaby() && this.lastBaby().progress() != BabyProgress.syusan) {
      console.error("今は妊娠できません");
      return false;
    }
    var baby = new Baby(Math.trunc(this._actorId), taneoyaId);
    this._babyList.push(baby);
    return true;
  };
  Game_Actor2.prototype.lastBaby = function () {
    if (this._babyList.length == 0) {
      return null;
    }
    return this._babyList[this._babyList.length - 1];
  };
  Game_Actor2.prototype.setupEroParams = function () {
    this._paramMap = {};
    var params = MAN_PARAMS[this.actorId()];
    if (!params) {
      return;
    }
    this.upEroParam(AvRequired.kiss, params.kiss);
    this.upEroParam(AvRequired.chichi, params.chichi);
    this.upEroParam(AvRequired.cri, params.cri);
    this.upEroParam(AvRequired.manko, params.manko);
    this.upEroParam(AvRequired.anal, params.anal);
    this.upEroParam(AvRequired.sm, params.sm);
  };
  Game_Actor2.prototype.makeCurrentActorParam = function () {
    return new UpEroActorInfo(
      this.eroParam(AvRequired.kiss),
      this.eroParam(AvRequired.manko),
      this.eroParam(AvRequired.anal),
      this.eroParam(AvRequired.cri),
      this.eroParam(AvRequired.chichi),
      this.eroParam(AvRequired.sm)
    );
  };
  Game_Actor2.prototype.upEroParams = function (info) {
    this.upEroParam(AvRequired.kiss, info.kiss);
    this.upEroParam(AvRequired.manko, info.manko);
    this.upEroParam(AvRequired.anal, info.anal);
    this.upEroParam(AvRequired.cri, info.cri);
    this.upEroParam(AvRequired.chichi, info.chichi);
    this.upEroParam(AvRequired.sm, info.sm);
  };
  Game_Actor2.prototype.eroParamRate = function () {
    return 10;
  };
  Game_Actor2.prototype.saveBattle = function () {
    this._savedHp = this._hp;
  };
  Game_Actor2.prototype.restoreBattle = function () {
    this._hp = this._savedHp;
  };
  Game_Actor2.prototype.update = function () {
    this.updateHp();
    this.dousei().update();
    this.refresh();
  };
  Game_Actor2.prototype.updateHp = function () {
    var dousei = this.dousei();
    var upHp = 0;
    if (dousei.isEnabled() && dousei.isActive() && !dousei.isRest()) {
      upHp += 2;
      if ($slg.facilityInfo().findFacility(67)) {
        upHp += 1;
      }
    } else {
      upHp += 2;
      if ($slg.facilityInfo().findFacility(67)) {
        upHp += 1;
      }
    }
    if (this._speedUp) {
      upHp *= 5;
      this._speedUp = false;
      this._lastSpeedUp = true;
    }
    this._hp += upHp;
    if (this._hp > this.mhp) {
      this._hp = this.mhp;
    }
  };
  Game_Actor2.prototype.recoverHpByDay = function () {
    this._hp += 500;
    if (this._hp > this.mhp) {
      this._hp = this.mhp;
    }
  };
  Game_Actor2.prototype.fan = function () {
    return this._fan;
  };
  Game_Actor2.prototype.name = function () {
    if (this.actorId() == 77) {
      // 同棲相手
      var realActorId = $gameVariables.value(55);
      if (
        realActorId >= 1 &&
        realActorId != 77 &&
        $gameActors.actor(realActorId)
      ) {
        return $gameActors.actor(realActorId).name();
      }
    }
    if (this.actorId() == 78) {
      // AV男優
      var realActorId = $gameVariables.value(55);
      if (
        realActorId >= 1 &&
        realActorId != 78 &&
        $gameActors.actor(realActorId)
      ) {
        return $gameActors.actor(realActorId).name();
      }
    }
    switch (ConfigManager.language) {
      case "en":
        if (this.actor().meta["nameEn"]) {
          return this.actor().meta["nameEn"];
        }
        break;
      case "ch":
      case "jp":
        break;
    }
    return this.actor().name;
  };
  Game_Actor2.prototype.onMakeAv = function (manId) {
    this.addFriendship(manId, this.friendshipUpValue(manId), false);
  };
  Game_Actor2.prototype.friendshipUpValue = function (manId) {
    return 10;
  };
  Game_Actor2.prototype.rate = function () {
    return this.hpRate();
  };
  Game_Actor2.prototype.eroParam = function (param) {
    this._paramMap[param] = this._paramMap[param] || 0;
    return this._paramMap[param];
  };
  Game_Actor2.prototype.eroParam10 = function (param) {
    this._paramMap[param] = this._paramMap[param] || 0;
    return Math.floor(this._paramMap[param] / this.eroParamRate());
  };
  Game_Actor2.prototype.upEroParam = function (param, value) {
    //p('upEroParam:' + param + ' ' + value)
    this._paramMap[param] = this._paramMap[param] || 0;
    this._paramMap[param] += value;
  };
  Game_Actor2.prototype.eroAbility = function (ability) {
    this._abilityMap[ability] = this._abilityMap[ability] || 0;
    return this._abilityMap[ability];
  };
  Game_Actor2.prototype.posByActor = function () {
    switch (this.actorId()) {
      case 1:
        return 0;
      case 3:
        return 0;
      case 4:
        return 0;
      case 8:
        return -10;
      case 9:
        return -20;
      case 10:
        return -40;
      case 11:
        return -20;
      case 13:
        return -16;
      case 17:
        return -16;
    }
    return 0;
  };
  Game_Actor2.prototype.getFriendshipLevelText = function (level) {
    switch (level) {
      case FriendshipLevel.E:
        return "E";
      case FriendshipLevel.D:
        return "D";
      case FriendshipLevel.C:
        return "C";
      case FriendshipLevel.B:
        return "B";
      case FriendshipLevel.A:
        return "A";
      case FriendshipLevel.S:
        return "S";
    }
  };
  Game_Actor2.prototype.actorId = function () {
    return Math.trunc(_super.prototype.actorId.call(this));
  };
  Game_Actor2.prototype.saveCostume = function (slot) {
    this._lastCostumeList[slot] = new CostumeSaver(this.actorId());
  };
  Game_Actor2.prototype.restoreCostume = function (slot, includeAcce) {
    if (!this._lastCostumeList[slot]) {
      console.error("costume not found:" + slot);
      return false;
    }
    this._lastCostumeList[slot].restoreCostume(null, includeAcce);
    return true;
  };
  Game_Actor2.prototype.power = function () {
    var n = 0;
    n += this.mhp;
    n += this.atk * 10;
    return n;
  };
  Game_Actor2.prototype.atk2 = function () {
    return this.atk;
  };
  Game_Actor2.prototype.def2 = function () {
    return this.def;
  };
  Game_Actor2.prototype.dousei = function () {
    this._dousei = this._dousei || new Dousei(this.actorId());
    return this._dousei;
  };
  Game_Actor2.prototype.isJusei = function () {
    var lastBaby = this.lastBaby();
    if (!lastBaby) {
      return false;
    }
    return lastBaby.isJusei();
  };
  Game_Actor2.prototype.isNinshin = function () {
    if (this.boteId > 0) {
      return false;
    }
    for (var _i = 0, _a = $slg.timeGaugeEventList(); _i < _a.length; _i++) {
      var e = _a[_i];
      if (e.type() == TimeGaugeEventType.bote) {
        if (e.actorId() == this.actorId()) {
          return true;
        }
      }
    }
    return false;
  };
  Game_Actor2.prototype.isBote = function () {
    return this.boteId > 0;
  };
  Game_Actor2.prototype.calcNinshinTime = function () {
    if ($slg.facilityInfo().hasFacility(57)) {
      return 250;
    }
    return 800;
  };
  Game_Actor2.prototype.babyList = function () {
    return this._babyList;
  };
  Game_Actor2.prototype.countSyusan = function () {
    var result = 0;
    for (var _i = 0, _a = this.babyList(); _i < _a.length; _i++) {
      var baby = _a[_i];
      if (baby.isSyusan()) {
        result++;
      }
    }
    return result;
  };
  Game_Actor2.prototype.countSyusanMan = function (manId) {
    var result = 0;
    for (var _i = 0, _a = this.babyList(); _i < _a.length; _i++) {
      var baby = _a[_i];
      if (baby.isSyusan() && baby.taneoyaId() == manId) {
        result++;
      }
    }
    return result;
  };
  Game_Actor2.prototype.isKaijin = function () {
    return this.actorId() >= 101 && this.actorId() <= 140;
  };
  Game_Actor2.prototype.isZako = function () {
    return this.actorId() >= 187;
  };
  Game_Actor2.prototype.isLoli = function () {
    switch (this.actorId()) {
      case 8:
      case 10:
      case 11:
      case 17:
        return true;
    }
    return false;
  };
  Game_Actor2.prototype.isStudent = function () {
    switch (this.actorId()) {
      case 9:
      case 13:
        return true;
    }
    return false;
  };
  Game_Actor2.prototype.iconIndex = function () {
    switch (this.actorId()) {
      case 8:
        return 642; // センリ
      case 9:
        return 644; // ノノカ
      case 10:
        return 640; // カナミ
      case 11:
        return 641; // ミユ
      case 13:
        return 647; // サキ
      case 15:
        return 643; // リツコ
      case 17:
        return 648; // ココナ
      case 4:
        return 645; // マリナ
      case 5:
        return 646; // レン
      case 18:
        return 649; // ヨシオ
      case 26:
        return 650; // ミン
      case 20:
        return 651; // タロウ
      case 19:
        return 652; // ブスジマ
      case 16:
        return 654; // カスゾウ
      case 21:
        return 655; // オリバー
      case 21:
        return 655; //
      case 48:
        return 679; // クズオ
      case 49:
        return 680; // ガリオ
      case 22:
        return 678; // デブオ
      case 50:
        return 682; // 薬師丸 ヌマオ
      case 51:
        return 683; // シゲさん
      case 52:
        return 565; // 高橋 むなし
      case 53:
        return 685; // 織田ノッブ
      case 54:
        return 686; // 鈴木 ゴンゾウ
      case 55:
        return 687; // アナルのヤシチ
      case 58:
        return 560; // 盗撮以蔵
      case 59:
        return 561; // アナルじじい
      case 61:
        return 562; // 鉄橋下の帝王
      case 62:
        return 563; // 田吾作
      case 24:
        return 563; // 田吾作
      case 3:
        return 566; // ユヅキ
      case 57:
        return 567; // アンドレ
      case 56:
        return 568; // ゴンザレス
      case 1:
        return 569; // シン
      case 2:
        return 681; // タクオ
    }
    return -1;
  };
  Game_Actor2.prototype.onSyusan = function () {
    this._ninshinDamage = 0;
    this.dousei().setDouseiNinshin(false);
  };
  Game_Actor2.prototype.ninshinRate = function () {
    this._ninshinDamage = this._ninshinDamage || 0;
    return (100 - this._ninshinDamage) / 100;
  };
  Game_Actor2.prototype.ninshinDamage = function (
    n,
    manId,
    canNinshin,
    isDousei,
    friendshipMax
  ) {
    if (isDousei === void 0) {
      isDousei = false;
    }
    if (friendshipMax === void 0) {
      friendshipMax = false;
    }
    if (this.lastBaby() && !this.lastBaby().isSyusan()) {
      return false;
    }
    this._ninshinDamage = this._ninshinDamage || 0;
    this._ninshinDamage += n;
    if (canNinshin) {
      var juseiRate = this.juseiRate(friendshipMax);
      //p('juseiRate:' + juseiRate);
      if (Math.random() * 100 < juseiRate) {
        if (isDousei) {
          this.ninshin(manId);
        } else {
          Nore.ninshin(this, manId);
        }
        return true;
      }
    }
    return false;
  };
  Game_Actor2.prototype.juseiRate = function (friendshipMax) {
    if (this.lastBaby() && !this.lastBaby().isSyusan()) {
      return 0;
    }
    if (this.hpRate() < 1) {
      return 0;
    }
    if (Nore.isTaikenban()) {
      if ($gameSwitches.value(1038)) {
        return 0;
      }
    }
    if (this.isDebugJusei()) {
      return 100;
    }
    this._ninshinDamage = this._ninshinDamage || 0;
    if (!$gameSwitches.value(1038)) {
      this._ninshinDamage += 150;
    }
    var rate = this._ninshinDamage / 30 + 1;
    if ($slg.facilityInfo().hasFacility(56)) {
      rate *= 1.5;
    }
    if (friendshipMax) {
      rate *= 2;
    }
    if (rate >= 90) {
      return 90;
    }
    return rate;
  };
  Game_Actor2.prototype.isDebugJusei = function () {
    var sw = -1;
    switch (this._actorId) {
      case 9:
        sw = 961;
        break;
      case 4:
        sw = 962;
        break;
      case 13:
        sw = 963;
        break;
      case 17:
        sw = 964;
        break;
      case 11:
        sw = 965;
        break;
    }
    return $gameSwitches.value(sw);
  };
  Game_Actor2.prototype.speedUp = function () {
    this._speedUp = true;
  };
  Game_Actor2.prototype.clearLastSpeedUp = function () {
    this._lastSpeedUp = false;
  };
  Game_Actor2.prototype.isLastSpeedUp = function () {
    return this._lastSpeedUp;
  };
  Game_Actor2.prototype.mankoHenkeiValue = function () {
    var mankoEro = this.eroParam(AvRequired.manko);
    var syusanPoint = this.countSyusan() * 17;
    return mankoEro + syusanPoint;
  };
  Game_Actor2.prototype.mankoHenkei100Value = function () {
    var mankoEro = this.mankoHenkeiValue();
    var max = (MANKO_ID_LIST[5] * 100) / 90;
    return Math.min(Math.ceil((mankoEro / max) * 100), 100);
  };
  Game_Actor2.prototype.mankoHenkeiLv = function () {
    var acceMap = {
      1: 1122,
      2: 1123,
      3: 1124,
      4: 1125,
      5: 1126,
      6: 1127,
      7: 1128,
    };
    var acceBodyChange = this.calcAcceEquipLv(acceMap);
    if (acceBodyChange) {
      return acceBodyChange;
    }
    return this.realMankoHenkeiLv();
  };
  Game_Actor2.prototype.realMankoHenkeiLv = function () {
    var mankoEro = this.mankoHenkeiValue();
    return new BodyChangeLv(this.calcValueLv(MANKO_ID_LIST, mankoEro), false);
  };
  Game_Actor2.prototype.sikyuLv = function () {
    var n = this.countSyusan();
    switch (n) {
      case 0:
        return 1;
      case 1:
      case 2:
        return 2;
      case 3:
      case 4:
        return 3;
      case 5:
      case 6:
      case 7:
      case 8:
        return 4;
      case 9:
      case 10:
      case 11:
        return 5;
      case 12:
      case 13:
      case 14:
        return 6;
      default:
        return 7;
    }
  };
  Game_Actor2.prototype.analGaba100Value = function () {
    var analTotal = this.eroParam(AvRequired.anal);
    var max = (ANAL_ID_LIST[5] * 100) / 90;
    return Math.min(Math.ceil((analTotal / max) * 100), 100);
  };
  Game_Actor2.prototype.analGabaLv = function () {
    var acceMap = {
      1: 1142,
      3: 1143,
      5: 1144,
      6: 1145,
      7: 1146,
    };
    var acceBodyChange = this.calcAcceEquipLv(acceMap);
    if (acceBodyChange) {
      return acceBodyChange;
    }
    return this.realAnalGabaLv();
  };
  Game_Actor2.prototype.realAnalGabaLv = function () {
    var analTotal = this.eroParam(AvRequired.anal);
    return new BodyChangeLv(this.calcValueLv(ANAL_ID_LIST, analTotal), false);
  };
  Game_Actor2.prototype.mankoKuroLv = function () {
    return this.calcMankoKuroLv();
  };
  Game_Actor2.prototype.calcAcceEquipLv = function (acceMap) {
    for (var key in acceMap) {
      var value = acceMap[key];
      if (this.hasAcce(value)) {
        return new BodyChangeLv(parseInt(key), true);
      }
    }
    return null;
  };
  Game_Actor2.prototype.calcValueLv = function (list, value) {
    var result = 0;
    for (var i = 0; i < list.length; i++) {
      result++;
      var n = list[i];
      if (value <= n) {
        return result;
      }
    }
    return result;
  };
  Game_Actor2.prototype.calcMankoKuroLv = function () {
    var acceMap = {
      1: 1132,
      2: 1133,
      3: 1134,
      4: 1135,
      5: 1136,
      6: 1137,
      7: 1138,
    };
    var acceBodyChange = this.calcAcceEquipLv(acceMap);
    if (acceBodyChange) {
      return acceBodyChange;
    }
    return this.realMankoKuroLv();
  };
  Game_Actor2.prototype.realMankoKuroLv = function () {
    var value = this.mankoKuroValue();
    return new BodyChangeLv(this.calcValueLv(MANKO_ID_LIST, value), false);
  };
  Game_Actor2.prototype.depravityLv = function () {
    var value = this.depravity();
    return this.calcValueLv(DEPRAVITY_LIST, value);
  };
  Game_Actor2.prototype.reputationLv = function () {
    var value = this.reputation();
    return this.calcValueLv(REPUTATION_LIST, -value);
  };
  Game_Actor2.prototype.mankoKuroValue = function () {
    this._mankoKuroValue = this._mankoKuroValue || 0;
    var nakadashi = this.countEro(EroType.nakadashi);
    var syusanPoint = this.countSyusan() * 10;
    return this._mankoKuroValue + nakadashi * 3 + syusanPoint;
  };
  Game_Actor2.prototype.mankoKuro100Value = function () {
    var value = this.mankoKuroValue();
    var max = (MANKO_ID_LIST[5] * 100) / 90;
    return Math.min(Math.ceil((value / max) * 100), 100);
  };
  Game_Actor2.prototype.chikubiKuroValue = function () {
    this._chikubiKuroValue = this._chikubiKuroValue || 0;
    var chichi = this.eroParam(AvRequired.chichi);
    var syusanPoint = this.countSyusan() * 36;
    return this._chikubiKuroValue + chichi * 2 + syusanPoint;
  };
  Game_Actor2.prototype.chikubiKuro100Value = function () {
    var value = this.chikubiKuroValue();
    var max = (MANKO_ID_LIST[5] * 100) / 90;
    return Math.min(Math.ceil((value / max) * 100), 100);
  };
  Game_Actor2.prototype.chikubiKuroLv = function () {
    var acceMap = {
      1: 1152,
      2: 1153,
      3: 1154,
      4: 1155,
      5: 1156,
      6: 1157,
      7: 1158,
    };
    var acceBodyChange = this.calcAcceEquipLv(acceMap);
    if (acceBodyChange) {
      return acceBodyChange;
    }
    return this.realChikubiKuroLv();
  };
  Game_Actor2.prototype.realChikubiKuroLv = function () {
    var value = this.chikubiKuroValue();
    return new BodyChangeLv(this.calcValueLv(MANKO_ID_LIST, value), false);
  };
  Game_Actor2.prototype.abilityAcceList = function () {
    var result = [];
    var abilityAcceList = [1005, 1001, 1002, 1003, 1004, 1008];
    for (
      var _i = 0, abilityAcceList_1 = abilityAcceList;
      _i < abilityAcceList_1.length;
      _i++
    ) {
      var acceId = abilityAcceList_1[_i];
      if (this.hasAcce(acceId)) {
        result.push(acceId);
      }
    }
    return result;
  };
  Game_Actor2.prototype.mankoFaceId = function () {
    return this._mankoFaceId || 1;
  };
  Game_Actor2.prototype.setMankoFaceId = function (n) {
    this._mankoFaceId = n;
  };
  Game_Actor2.prototype.mankoHoppeId = function () {
    return this._mankoHoppeId || 0;
  };
  Game_Actor2.prototype.setMankoHoppeId = function (n) {
    this._mankoHoppeId = n;
  };
  Game_Actor2.prototype.mankoNamidaId = function () {
    return this._mankoNamidaId || 0;
  };
  Game_Actor2.prototype.namidaOptionId = function (faceId) {
    switch (this.actorId()) {
      case 13:
        return this.namidaOptionId13(faceId);
    }
    return 0;
  };
  Game_Actor2.prototype.namidaOptionId13 = function (faceId) {
    switch (parseInt(faceId)) {
      case 12:
      case 13:
      case 15:
        return 1;
    }
    return 0;
  };
  Game_Actor2.prototype.setMankoNamidaId = function (n) {
    this._mankoNamidaId = n;
  };
  Game_Actor2.prototype.mankoKuchiId = function () {
    if (this.hasAcce(1062)) {
      // 猿ぐつわ
      return 1;
    }
    if (this.hasAcce(1060)) {
      // ボールギャグ
      return 2;
    }
    if (this.hasAcce(1061)) {
      return 3;
    }
    return 0;
  };
  Game_Actor2.prototype.mankoMekakushiId = function () {
    if (this.hasAcce(1065)) {
      return 1;
    }
    return 0;
  };
  Game_Actor2.prototype.chikubiKuroImageAlpha = function () {
    var level = this.chikubiKuroLv().level;
    return (level - 1) / 6;
  };
  Game_Actor2.prototype.mankoKuroImageAlpha = function () {
    var level = this.mankoKuroLv().level;
    return (level - 1) / 6;
  };
  Game_Actor2.prototype.currentClass = function () {
    return $dataClasses[this.actor().classId];
  };
  Game_Actor2.prototype.isShowOutline = function () {
    if (this.showOutline) {
      return true;
    }
    switch (this.actorId()) {
      case 9:
        return $gameSwitches.value(401);
      case 10:
        return $gameSwitches.value(402);
      case 4:
        return $gameSwitches.value(403);
      case 5:
        return $gameSwitches.value(404);
      case 13:
        return $gameSwitches.value(405);
      case 17:
        return $gameSwitches.value(406);
      case 7:
        return $gameSwitches.value(407);
      case 6:
        return $gameSwitches.value(408);
    }
    return false;
  };
  Game_Actor2.prototype.outlineColor = function () {
    switch (this.actorId()) {
      case 9:
        return 0xffee66;
      case 10:
        return 0xee33dd;
      case 89:
        return 0xee33dd;
      case 4:
        return 0xffffff;
      case 5:
        return 0xffffff;
      case 13:
        return 0xaaaaff;
      case 17:
        return 0xff3333;
      case 7:
        return 0xee33dd;
      case 6:
        return 0x333333;
    }
    return 0;
  };
  Game_Actor2.prototype.isOverallCash = function () {
    // 全体キャッシュが必要なアクセ
    var cashAcce = [1060, 1061, 1062, 1063, 1064, 1065, 1065];
    for (var _i = 0, cashAcce_1 = cashAcce; _i < cashAcce_1.length; _i++) {
      var id = cashAcce_1[_i];
      if (this.acceMap[id]) {
        return true;
      }
    }
    return false;
  };
  return Game_Actor2;
})(Game_EroActor);
Sprite_Actor.prototype.setupDamagePopup = function () {
  if (this._battler.isDamagePopupRequested()) {
    if (this._battler.isSpriteVisible()) {
      this.createDamageSprite();
    }
    this._battler.clearDamagePopup();
    this._battler.clearResult();
  }
};
Sprite_Actor.prototype.updateBitmap = function () {
  Sprite_Battler.prototype.updateBitmap.call(this);
  var name = this._actor.battlerName();
  if (this._battlerName !== name) {
    this._battlerName = name;
  }
};
Sprite_Actor.prototype.createShadowSprite = function () {
  this._shadowSprite = new Sprite();
  this.addChild(this._shadowSprite);
};
Sprite_Actor.prototype.stepForward = function () {};
Sprite_Actor.prototype.stepBack = function () {};


code:
//=============================================================================
// Nore_AutoNewGame.js
//=============================================================================
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//=============================================================================
/*:ja
 * @target MZ
 * @plugindesc F6を押した時、自動で NewGame またはゲームロードを行います
 * @author ル
 * @url https://ci-en.dlsite.com/creator/276
 *
 * @param reloadKey
 * @desc 自動で NewGame またはゲームロードを行う時に使用するボタンです
 * @type select
 * @option F4 キー
 * @value 115
 * @option F6 キー
 * @value 117
 * @option F7 キー
 * @value 118
 * @option F9 キー
 * @value 120
 * @option F10 キー
 * @value 121
 * @option F11 キー
 * @value 122
 * @default 117
 *
 * @param showDevTools
 * @desc テストプレイ時、自動で開発ツールを開きます
 * @type boolean
 * @default false
 *
 * @param autoConvert
 * @desc 自動で Nore_TES のシナリオ変換を実行します
 * @type boolean
 * @default false
 *
 * @help
 * Ver 0.2.0
 *
 * New Game を選択した後に F6 を押すと、自動で New Game を開始します。
 *
 * Continue を選択した後に F6 を押すと、自動で最後にロードされたファイルを
 * 読み込んでゲームを開始します。
 *
 * Save を選択した後に F6 を押すと、自動でそのファイル読み込んでゲームを
 * 開始します。
 *
 *
 * この機能を使った再読み込みと、F5による再読み込みは挙動がやや異なります。
 * この機能を使った再読み込みではメモリは解放されません。
 * ご注意ください。
 *
 *
 *
 * プラグインコマンドはありません。
 *
 * ・利用規約
 * 作者に無断で改変、再配布が可能で、利用形態（商用、18禁利用等）
 * についても制限はありません。
 * このプラグインはもうあなたのものです。
 */
var Nore;
(function (Nore) {
  var AutoNewGame;
  (function (AutoNewGame) {
    var parameters = PluginManager.parameters("Nore_AutoNewGame");
    var OPEN_DEV_TOOLS = parameters["showDevTools"].toLowerCase() === "true";
    var AUTO_CONVERT = parameters["autoConvert"].toLowerCase() === "true";
    var RELOAD_KEY = parseInt(parameters["reloadKey"]);
    var _SceneManager_onKeyDown = SceneManager.onKeyDown;
    SceneManager.onKeyDown = function (event) {
      _SceneManager_onKeyDown.call(this, event);
      if (!event.ctrlKey && !event.altKey) {
        if (event.keyCode == RELOAD_KEY) {
          if (Utils.isNwjs()) {
            var gui = require("nw.gui");
            gui.App.clearCache();
            var win = require("nw.gui").Window.get();
            win.reload();
          }
        }
      }
    };
    var _Scene_Boot_prototype_create = Scene_Boot.prototype.create;
    Scene_Boot.prototype.create = function () {
      if (AUTO_CONVERT && Utils.isOptionValid("test")) {
        if (!Nore.Tes) {
          console.error(
            "Nore_AutoNewGame : autoConvert が ON になっていますが、Nore_Tes プラグインが見つかりません"
          );
        } else {
          Nore.Tes.loadScenarioFile = false;
        }
      }
      _Scene_Boot_prototype_create.call(this);
    };
    var _Scene_Boot_prototype_start = Scene_Boot.prototype.start;
    Scene_Boot.prototype.start = function () {
      var _this = this;
      _Scene_Boot_prototype_start.call(this);
      if (!Utils.isOptionValid("test")) {
        return;
      }
      if (AUTO_CONVERT) {
        if (!Nore.Tes) {
          console.error(
            "Nore_AutoNewGame : autoConvert が ON になっていますが、Nore_Tes プラグインが見つかりません"
          );
        } else {
          var converter = new Nore.Tes.Scenario_Converter();
          converter.convertAll();
        }
      }
      if (OPEN_DEV_TOOLS) {
        var win_1 = require("nw.gui").Window.get();
        win_1.showDevTools(null, function () {
          win_1.focus();
        });
      }
      var gameFileData = sessionStorage.getItem("noreGameFile");
      if (gameFileData != null) {
        if (gameFileData === "0") {
          DataManager.setupNewGame();
          SceneManager.goto(Scene_Map2);
        } else {
          ImageManager.clear();
          var savefileId = parseInt(gameFileData);
          DataManager.loadGame(savefileId)
            .then(function () {
              return _this.onLoadSuccess();
            })
            .catch(function () {
              return _this.onLoadFailure();
            });
        }
        return;
      } else {
        var noreCommonEventId = parseInt(
          sessionStorage.getItem("noreCommonEventId")
        );
        var norePlayerMap = parseInt(sessionStorage.getItem("norePlayerMap"));
        if (noreCommonEventId && norePlayerMap) {
          console.log("シーン回想実行。コモンイベントID: " + noreCommonEventId);
          DataManager.setupNewGame();
          $gamePlayer.setTransparent(true);
          $gameTemp.reserveCommonEvent(noreCommonEventId);
          $gamePlayer.reserveTransfer(norePlayerMap, 0, 0, 0, 0);
          SceneManager.goto(Scene_Map2);
          $gameSwitches.setValue(999, true);
          return;
        }
      }
    };
    Scene_Boot.prototype.onLoadSuccess = function () {
      this.fadeOutAll();
      this.reloadMapIfUpdated();
      SceneManager.goto(Scene_Map2);
      $gameSystem.onAfterLoad();
    };
    Scene_Boot.prototype.onLoadFailure = function () {
      console.error("ファイルロードができませんでした");
    };
    Scene_Boot.prototype.reloadMapIfUpdated = function () {
      if ($gameSystem.versionId() !== $dataSystem.versionId) {
        var mapId = $gameMap.mapId();
        var x = $gamePlayer.x;
        var y = $gamePlayer.y;
        $gamePlayer.reserveTransfer(mapId, x, y);
        $gamePlayer.requestMapReload();
      }
    };
    var _Scene_Title_commandNewGame = Scene_Title.prototype.commandNewGame;
    Scene_Title.prototype.commandNewGame = function () {
      _Scene_Title_commandNewGame.call(this);
      if ($gameTemp.isPlaytest()) {
        sessionStorage.setItem("noreGameFile", "0");
      }
    };
    var _Scene_Load_onLoadSuccess = Scene_Load.prototype.onLoadSuccess;
    Scene_Load.prototype.onLoadSuccess = function () {
      _Scene_Load_onLoadSuccess.call(this);
      if ($gameTemp.isPlaytest()) {
        sessionStorage.setItem("noreGameFile", this.savefileId());
      }
    };
    var _Scene_Save_onSaveSuccess = Scene_Save.prototype.onSaveSuccess;
    Scene_Save.prototype.onSaveSuccess = function () {
      _Scene_Save_onSaveSuccess.call(this);
      if ($gameTemp.isPlaytest()) {
        sessionStorage.setItem("noreGameFile", this.savefileId());
      }
    };
  })((AutoNewGame = Nore.AutoNewGame || (Nore.AutoNewGame = {})));
})(Nore || (Nore = {}));

repo_name: onms/dead

license: unknown


code:
/*:ja
 * @target MZ
 * @author ル
 *
 * @command makeAv
 * @text AVを作成
 * @des AVを作成
 * @arg actorId
 * @type number
 * @text actorId
 * @desc actorId
 * @arg itemId
 * @type number
 * @text itemId
 * @desc itemId
 *
 * @command recordAv
 * @text AVのコモンイベント実行
 * @des AVのコモンイベント実行
 *
 * @command mainActorVar55
 * @text 変数55にメイン男優IDを入れる
 *
 */
var Nore;
(function (Nore) {
  var pluginName = "Nore_Av";
  PluginManager.registerCommand(pluginName, "makeAv", function (args) {
    $gameAvJacketList.clear();
    var actorId = parseInt(args.actorId);
    var itemId = parseInt(args.itemId);
    var av = new Av(actorId, itemId);
    av.make(99);
    $gameTemp.av = av;
    $gameParty.setMenuActorId(actorId);
    var avInfo = $slg.avInfo();
    avInfo.addAv(av);
  });
  PluginManager.registerCommand(pluginName, "recordAv", function (args) {
    var avItemId = $gameVariables.value(24);
    var item = $dataItems[avItemId];
    if (!item) {
      console.error("Avアイテムが存在しません:" + avItemId);
      return;
    }
    var commonEventId = parseInt(item.meta["common"]);
    var actorId = parseInt(item.meta["actorId"]);
    if (isNaN(commonEventId)) {
      console.error("コモンイベントが存在しません:" + avItemId);
      return;
    }
    p("recordAv commonEvent:" + commonEventId);
    $gameTemp.inRecordAv = true;
    //$gameTemp.reserveCommonEvent(commonEventId);
    //$gameMap._interpreter.setupReservedCommonEvent()
    var commonEvent = $dataCommonEvents[commonEventId];
    $gameSwitches.setValue(18, true);
    $gameMap._interpreter.setupChild(commonEvent.list, 0);
  });
  PluginManager.registerCommand(pluginName, "mainActorVar55", function (args) {
    if (!$gameTemp.av) {
      console.error("Avが存在しません");
      return;
    }
    $gameVariables.setValue(55, $gameTemp.av.mainManId());
  });
  var AvParamInfo = /** @class */ (function () {
    function AvParamInfo(_type, _iconIndex) {
      this._type = _type;
      this._iconIndex = _iconIndex;
    }
    AvParamInfo.prototype.type = function () {
      return this._type;
    };
    AvParamInfo.prototype.iconIndex = function () {
      return this._iconIndex;
    };
    AvParamInfo.prototype.name = function () {
      return getAvParamType(this._type);
    };
    return AvParamInfo;
  })();
  Nore.AvParamInfo = AvParamInfo;
  var AvParamManager = /** @class */ (function () {
    function AvParamManager() {
      this._paramArray = [];
      this._paramArray.push(new AvParamInfo(AvRequired.kiss, Icon.kiss));
      this._paramArray.push(new AvParamInfo(AvRequired.chichi, Icon.chichi));
      this._paramArray.push(new AvParamInfo(AvRequired.cri, Icon.cri));
      this._paramArray.push(new AvParamInfo(AvRequired.manko, Icon.manko));
      this._paramArray.push(new AvParamInfo(AvRequired.anal, Icon.anal));
      this._paramArray.push(new AvParamInfo(AvRequired.sm, Icon.sm));
    }
    AvParamManager.prototype.findIconIndex = function (type) {
      for (var _i = 0, _a = this._paramArray; _i < _a.length; _i++) {
        var data = _a[_i];
        if (data.type() == type) {
          return data.iconIndex();
        }
      }
      return 1;
    };
    AvParamManager.prototype.list = function () {
      return this._paramArray.concat();
    };
    return AvParamManager;
  })();
  Nore.$avParamManager = new AvParamManager();
})(Nore || (Nore = {}));
var SHOTA_SW = 254;
var AvInfo = /** @class */ (function () {
  function AvInfo() {
    this._resultEvent = [];
    this._avList = [];
  }
  AvInfo.prototype.allList = function () {
    return this._avList;
  };
  AvInfo.prototype.pushResultAv = function (avId, id) {
    this._resultEvent.push(avId);
    //$gameSwitches.setValue(7, true);
    $gameVariables.setValue(8, this.findAv(avId).reward());
    $gameParty.addCommonEvent(211, id);
  };
  AvInfo.prototype.nextResultAv = function () {
    if (this._resultEvent.length == 0) {
      return null;
    }
    var avId = this._resultEvent.shift();
    return this.findAv(avId);
  };
  AvInfo.prototype.addAv = function (av) {
    this._avList.push(av);
  };
  AvInfo.prototype.avReward = function () {
    var n = 0;
    for (var _i = 0, _a = this._avList; _i < _a.length; _i++) {
      var av = _a[_i];
      n += av.reward();
    }
    return n;
  };
  AvInfo.prototype.onReward = function () {
    for (var _i = 0, _a = this._avList; _i < _a.length; _i++) {
      var av = _a[_i];
      av.onReward(av.reward());
    }
  };
  AvInfo.prototype.makeAvList = function (actor) {
    switch (actor.actorId()) {
      case 8:
        return this.makeActor8AvList();
      case 9:
        return this.makeActor9AvList();
    }
    return [];
  };
  AvInfo.prototype.makeActor8AvList = function () {
    var result = [];
    if (!this.hasAv(101)) {
      result.push(new Av(8, 101));
    } else {
      if (!this.hasAv(102) && !this.hasAv(103)) {
        result.push(new Av(8, 102));
        result.push(new Av(8, 103));
      }
    }
    return result;
  };
  AvInfo.prototype.makeActor9AvList = function () {
    var result = [];
    if (!this.hasAv(121)) {
      result.push(new Av(9, 121));
      return result;
    }
    if (!this.hasAv(122)) {
      result.push(new Av(9, 122));
    }
    var actor = $gameActors.actor(9);
    if (actor.boteId >= 1) {
      result.push(new Av(9, 124));
    }
    return result;
  };
  AvInfo.prototype.hasAv = function (itemId) {
    for (var _i = 0, _a = this._avList; _i < _a.length; _i++) {
      var av = _a[_i];
      if (av.itemId() == itemId) {
        return true;
      }
    }
    return false;
  };
  AvInfo.prototype.currentAvList = function () {
    return this._avList;
  };
  AvInfo.prototype.totalAvCount = function () {
    return this._avList.length;
  };
  AvInfo.prototype.actorAvList = function (actorId) {
    var result = [];
    for (var _i = 0, _a = this._avList; _i < _a.length; _i++) {
      var av = _a[_i];
      if (av.actorId() == actorId) {
        result.push(av);
      }
      if (actorId == 8) {
        if (av.actorId() == 5) {
          // センリとレンのイベント
          result.push(av);
        }
      }
    }
    return result;
  };
  AvInfo.prototype.actorLastShowResultAv = function (actorId) {
    for (var i = 0; i < this._avList.length; i++) {
      var index = this._avList.length - i - 1;
      var av = this._avList[index];
      if (av.actorId() == actorId) {
        if (av.isShowResult()) {
          return av;
        }
      }
    }
    return null;
  };
  AvInfo.prototype.actorLastAv = function (actorId) {
    for (var i = 0; i < this._avList.length; i++) {
      var index = this._avList.length - i - 1;
      var av = this._avList[index];
      if (av.actorId() == actorId) {
        return av;
      }
    }
    return null;
  };
  AvInfo.prototype.actorAvCount = function (actorId) {
    var result = 0;
    for (var _i = 0, _a = this._avList; _i < _a.length; _i++) {
      var av = _a[_i];
      if (av.actorId() == actorId) {
        result++;
      }
    }
    return result;
  };
  AvInfo.prototype.findAv = function (avId) {
    for (var _i = 0, _a = this._avList; _i < _a.length; _i++) {
      var av = _a[_i];
      if (av.id() == avId) {
        return av;
      }
    }
    console.error("IDが" + avId + "のAVが見つかりません");
    return null;
  };
  AvInfo.prototype.findAvByItemId = function (itemId) {
    for (var _i = 0, _a = this._avList; _i < _a.length; _i++) {
      var av = _a[_i];
      if (av.itemId() == itemId) {
        return av;
      }
    }
    console.error("item IDが" + itemId + "のAVが見つかりません");
    return null;
  };
  AvInfo.prototype.countAv = function (itemId) {
    var n = 0;
    for (var _i = 0, _a = this._avList; _i < _a.length; _i++) {
      var av = _a[_i];
      if (av.itemId() == itemId) {
        n++;
      }
    }
    return n;
  };
  AvInfo.prototype.lastAv = function (itemId) {
    var n = 0;
    for (var i = 0; i < this._avList.length; i++) {
      var av = this._avList[this._avList.length - 1 - i];
      if (av.itemId() == itemId) {
        return av;
      }
    }
    return null;
  };
  AvInfo.prototype.noPhotoTexture = function () {
    return PIXI.utils.TextureCache["no_photo" + ".png"];
  };
  AvInfo.prototype.findBeforeAv = function (av) {
    for (var i = 0; i < this._avList.length; i++) {
      var a = this._avList[this._avList.length - 1 - i];
      if (av.itemId() == a.itemId()) {
        if (av != a) {
          return a;
        }
      }
    }
    return null;
  };
  AvInfo.prototype.finishedAvCount = function () {
    var n = 0;
    for (var _i = 0, _a = this._avList; _i < _a.length; _i++) {
      var av = _a[_i];
      if (av.isDone()) {
        n++;
      }
    }
    return n;
  };
  return AvInfo;
})();
var Av = /** @class */ (function () {
  function Av(actorId, itemId) {
    this._elapsedCount = 0;
    this._totalReward = 0;
    this._review = new AvReview();
    this._screenShotList = [];
    this._id = $slg.nextAvId();
    this._actorId = actorId;
    this._itemId = itemId;
    this._mainManId = this.eroParam().mainMan;
    this._nakadashi = this.eroParam().nakadashi;
    this._anal = this.eroParam().anal;
    this._fela = this.eroParam().fela;
    this._subMan1Id = 0;
    this._subMan2Id = 0;
    this._imageIndex = 1;
    this._showResult = false;
    this._avCount = $slg.avInfo().countAv(this._itemId) + 1;
  }
  Av.prototype.id = function () {
    return this._id;
  };
  Av.prototype.avCount = function () {
    return this._avCount;
  };
  Av.prototype.avCountTotal = function () {
    var list = $slg.avInfo().actorAvList(this._actorId);
    return list.indexOf(this) + 1;
  };
  Av.prototype.make = function (beforeAvDay) {
    this.calcFan(beforeAvDay);
    this.makeReview();
    this.calcSales();
    this.calcPlusFan();
    this.calcReward();
  };
  Av.prototype.reviewList = function () {
    return this._review.reviewList();
  };
  Av.prototype.calcFan = function (beforeAvDay) {
    var fan = $slg.fan();
    fan *= this.fanRepeatRate();
    this._fan = Math.round(fan);
  };
  Av.prototype.calcPlusFan = function () {
    var firstFan = 100 + Math.randomInt(260);
    this._plusFan = Math.round(
      firstFan * this.newFanRate() * this.facilityFanBonus()
    );
  };
  Av.prototype.plusFan = function () {
    return this._plusFan;
  };
  Av.prototype.newFanRate = function () {
    switch (this.popularityLevel()) {
      case 0:
        return 0.09;
      case 1:
        return 0.1;
      case 2:
        return 0.12;
      case 3:
        return 0.14;
      case 4:
        return 0.16;
      case 5:
        return 0.21;
      case 6:
        return 0.25;
      default:
        return 0.3;
    }
  };
  Av.prototype.facilityFanBonus = function () {
    if ($slg.facilityInfo().hasFacility(62)) {
      return 1.1;
    }
    return 1;
  };
  Av.prototype.popularityLevel = function () {
    var avCount = Math.floor($slg.avInfo().totalAvCount() / 3);
    return avCount;
  };
  Av.prototype.fanRepeatRate = function () {
    return 0.8;
  };
  Av.prototype.fan = function () {
    return this._fan;
  };
  Av.prototype.sales = function () {
    return this._sales;
  };
  Av.prototype.realSales = function () {
    return this._sales * 20 + this.salesOnesPlace();
  };
  Av.prototype.makeReview = function () {
    this._review = new AvReview();
    this._review.makeReview(this);
  };
  Av.prototype.hpCost = function () {
    var hp = this.item().meta["hp"];
    if (isNaN(hp)) {
      console.error("AVにHPが見つかりません");
      return 10;
    }
    hp *= this.hpDebuff();
    if (hp >= 9999) {
      hp = 9999;
    }
    if (this.isSyusan() && $slg.facilityInfo().hasFacility(69)) {
      hp = Math.floor(hp / 3);
    } else if (this.isSyusan() && $slg.facilityInfo().hasFacility(68)) {
      hp = Math.floor((hp / 3) * 2);
    }
    return hp;
  };
  Av.prototype.hpDebuff = function () {
    return 1;
    /*const count = $slg.avInfo().countAv(this.itemId());
        switch (count) {
            case 0: return 1;
            case 1: return 1.5;
            default: return 2;
        }*/
  };
  Av.prototype.setUpEroInfo = function (upEroInfo) {
    this._upEroInfo = upEroInfo;
  };
  Av.prototype.upEroInfo = function () {
    return this._upEroInfo;
  };
  Av.prototype.calcReward = function () {
    var base = this.rewardBase();
    var bonus = 1;
    if ($gameSwitches.value(SHOTA_SW)) {
      bonus = 1.05;
    }
    this._reward = Math.round(((base * this.sales()) / 100) * bonus);
    p("reward:" + this._reward);
    $gameVariables.setValue(8, this._reward);
  };
  Av.prototype.rewardBase = function () {
    return 26;
  };
  Av.prototype.gainReward = function () {
    $gameParty.gainGold(this._reward);
  };
  Av.prototype.calcSales = function () {
    var base = 500;
    var rate = this.calcPopularityRate(this.popularityLevel());
    var paramRate = this.paramRate();
    var difficultyRate = this.difficultyRate();
    var countDebuff = this.countDebuff();
    this._salesParamRate = paramRate;
    this._salesPopuRate = rate;
    this._salesDifficultyRate = difficultyRate;
    this._countDebuff = countDebuff;
    var skillBonusRate = this.skillBonusRate();
    p(
      "popuRate:" +
        rate +
        " paramRate:" +
        paramRate +
        " difficultyRate:" +
        difficultyRate +
        " countDebuff:" +
        countDebuff +
        " skillBonusRate:" +
        skillBonusRate
    );
    this._sales = Math.round(
      base * rate * paramRate * difficultyRate * countDebuff + this._fan / 2.5
    );
    p("sales:" + this._sales);
  };
  Av.prototype.countDebuff = function () {
    if (!this.isSyusan()) {
      return 1;
    }
    var count = $slg.avInfo().countAv(this.itemId());
    switch (count) {
      case 0:
        return 1;
      case 1:
        return 0.5;
      default:
        return 0.3;
    }
  };
  Av.prototype.difficultyRate = function () {
    var list = this.avParamList();
    var qualify = 0;
    for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
      var param = list_1[_i];
      qualify += param.value();
    }
    qualify /= list.length;
    if (qualify <= 30) {
      return 0.5;
    }
    if (qualify <= 40) {
      return 0.6;
    }
    if (qualify <= 50) {
      return 0.7;
    }
    if (qualify <= 60) {
      return 0.8;
    }
    if (qualify <= 70) {
      return 0.9;
    }
    if (qualify <= 80) {
      return 1;
    }
    if (qualify <= 90) {
      return 1.1;
    }
    if (qualify <= 100) {
      return 1.2;
    }
    if (qualify <= 110) {
      return 1.3;
    }
    return 1.4;
  };
  Av.prototype.paramRate = function () {
    var list = this.avParamList();
    var qualify = 0;
    var value = 0;
    for (var _i = 0, list_2 = list; _i < list_2.length; _i++) {
      var param = list_2[_i];
      qualify += param.value();
      value += param.total();
    }
    return (value / qualify - 1) / 3 + 1;
  };
  Av.prototype.calcPopularityRate = function (level) {
    switch (level) {
      case 0:
        return 1;
      case 1:
        return 1.1;
      case 2:
        return 1.2;
      case 3:
        return 1.4;
      case 4:
        return 1.6;
      case 5:
        return 1.9;
      case 6:
        return 2.2;
      case 7:
        return 2.6;
      case 8:
        return 3.0;
      case 9:
        return 3.5;
      case 10:
        return 4.0;
    }
    return 4;
  };
  Av.prototype.actorId = function () {
    return this._actorId;
  };
  Av.prototype.actor = function () {
    return $gameActors.actor(this.actorId());
  };
  Av.prototype.reward = function () {
    return Math.round(
      ((this._reward * this.currentRewardRate()) / 100) * $slg.avRewardRate()
    );
  };
  Av.prototype.currentRewardRate = function () {
    return this.rewardRate(this._elapsedCount);
  };
  Av.prototype.isDone = function () {
    return this._done;
  };
  Av.prototype.cost = function () {
    return 0;
  };
  Av.prototype.energyCost = function () {
    return this.item().price;
  };
  Av.prototype.isShowMan = function () {
    return this.item().meta["showMan"] != null;
  };
  Av.prototype.item = function () {
    return $dataItems[this._itemId];
  };
  Av.prototype.onReward = function (n) {
    this._totalReward += n;
    this._elapsedCount++;
  };
  Av.prototype.name = function () {
    switch (ConfigManager.language) {
      case "en":
        if (this.item().meta["nameEn"]) {
          return this.item().meta["nameEn"];
        }
        break;
      case "ch":
      case "jp":
        break;
    }
    if (this._avCount > 1) {
      return TextManager.avCount.format(this.item().name, this._avCount);
    }
    return this.item().name;
  };
  Av.prototype.jacketTitle = function () {
    if (this._avJacket) {
      return this._avJacket.title();
    }
    return this.name();
  };
  Av.prototype.jacketSubTitle = function () {
    if (this._avJacket) {
      return this._avJacket.subTitle();
    }
    return "";
  };
  Av.prototype.itemId = function () {
    return this._itemId;
  };
  Av.prototype.rewardRate = function (elapsedDay) {
    switch (elapsedDay) {
      case 0:
        return 100;
    }
    var rate = 100 - elapsedDay * 4 - 20;
    if (rate < 0) {
      return 0;
    }
    return rate;
  };
  Av.prototype.totalReward = function () {
    return this._totalReward;
  };
  Av.prototype.param = function (requiredType) {
    var n = 0;
    switch (requiredType) {
      case AvRequired.manko:
        n = this.chitsuParam();
        break;
      case AvRequired.chichi:
        n = this.chichiParam();
        break;
      case AvRequired.cri:
        n = this.criParam();
        break;
      case AvRequired.anal:
        n = this.analParam();
        break;
      case AvRequired.kiss:
        n = this.kissParam();
        break;
      case AvRequired.sm:
        n = this.smParam();
        break;
    }
    return Math.floor(n / 10);
  };
  Av.prototype.chitsuParam = function () {
    var actor = this.actor();
    return actor.eroParam(AvRequired.manko);
  };
  Av.prototype.analParam = function () {
    var actor = this.actor();
    return actor.eroParam(AvRequired.anal);
  };
  Av.prototype.chichiParam = function () {
    var actor = this.actor();
    return actor.eroParam(AvRequired.chichi);
  };
  Av.prototype.criParam = function () {
    var actor = this.actor();
    return actor.eroParam(AvRequired.cri);
  };
  Av.prototype.kissParam = function () {
    var actor = this.actor();
    return actor.eroParam(AvRequired.kiss);
  };
  Av.prototype.smParam = function () {
    var actor = this.actor();
    return actor.eroParam(AvRequired.sm);
  };
  Av.prototype.requiredSkills = function () {
    var list = [];
    if ($gameSystem.difficulty() == Difficulty.easy) {
      return list;
    }
    var eroParam = this.eroParam();
    this.addSkill(list, this.findSkill(eroParam.skill1));
    this.addSkill(list, this.findSkill(eroParam.skill2));
    this.addSkill(list, this.findSkill(eroParam.skill3));
    return list;
  };
  Av.prototype.effectiveSkills = function () {
    var list = [];
    var eroParam = this.eroParam();
    this.addSkill(list, this.findSkill(eroParam.skill4));
    this.addSkill(list, this.findSkill(eroParam.skill5));
    this.addSkill(list, this.findSkill(eroParam.skill6));
    return list;
  };
  Av.prototype.addSkill = function (list, item) {
    if (item) {
      list.push(item);
    }
  };
  Av.prototype.findSkill = function (name) {
    if (name == "") {
      return null;
    }
    for (var i = 11; i < 40; i++) {
      var item = $dataSkills[i];
      if (item.name == name) {
        return item;
      }
    }
    console.error(name + "が見つかりません");
    return null;
  };
  Av.prototype.requiredManko = function () {
    var param = this.eroParam();
    if (param.av1 == AvRequired.manko) {
      return param.av1_param;
    }
    if (param.av2 == AvRequired.manko) {
      return param.av2_param;
    }
    if (param.av3 == AvRequired.manko) {
      return param.av3_param;
    }
    return 0;
  };
  Av.prototype.requiredCri = function () {
    var param = this.eroParam();
    if (param.av1 == AvRequired.cri) {
      return param.av1_param;
    }
    if (param.av2 == AvRequired.cri) {
      return param.av2_param;
    }
    if (param.av3 == AvRequired.cri) {
      return param.av3_param;
    }
    return 0;
  };
  Av.prototype.eroParam = function () {
    var key = this._actorId + "_" + this._itemId;
    var param = ERO_PARAMS[key];
    if (!param) {
      console.error("key " + key + " のエロパラメーターが見つかりません");
    }
    return param;
  };
  Av.prototype.containsType = function (type) {
    if (this.av1() == type) {
      return true;
    }
    if (this.av2() == type) {
      return true;
    }
    if (this.av3() == type) {
      return true;
    }
    return false;
  };
  Av.prototype.avParamList = function () {
    var result = [];
    var param = this.eroParam();
    var rate = this.avParamRate() * $gameSystem.difficultyAvParamRate();
    if (param.av1_param > 0) {
      var av1 = this.av1();
      result.push(
        new AvParam(
          av1,
          param.av1_param,
          this.param(av1),
          this.countManParam(av1),
          rate
        )
      );
    }
    if (param.av2_param > 0) {
      var av2 = this.av2();
      result.push(
        new AvParam(
          av2,
          param.av2_param,
          this.param(av2),
          this.countManParam(av2),
          rate
        )
      );
    }
    if (param.av3_param > 0) {
      var av3 = this.av3();
      result.push(
        new AvParam(
          av3,
          param.av3_param,
          this.param(av3),
          this.countManParam(av3),
          rate
        )
      );
    }
    result = result.sort(function (a, b) {
      return a.sortType() - b.sortType();
    });
    return result;
  };
  Av.prototype.avParamRate = function () {
    if (this.isSyusan()) {
      return 1;
    }
    if (this.isGeneralAv()) {
      return 1;
    }
    switch (this.avCount()) {
      case 1:
        return 1;
      case 2:
        return 1.2;
    }
    return 1.2;
  };
  Av.prototype.isGeneralAv = function () {
    switch (this._itemId) {
      case 153:
      case 186:
      case 288:
      case 319:
        return true;
    }
    return false;
  };
  Av.prototype.av1 = function () {
    var param = this.eroParam();
    return this.toAvRequired(param.av1);
  };
  Av.prototype.av2 = function () {
    var param = this.eroParam();
    return this.toAvRequired(param.av2);
  };
  Av.prototype.av3 = function () {
    var param = this.eroParam();
    return this.toAvRequired(param.av3);
  };
  Av.prototype.toAvRequired = function (required) {
    switch (required) {
      case AvRequired.manko:
        return AvRequired.manko;
      case AvRequired.chichi:
        return AvRequired.chichi;
      case AvRequired.cri:
        return AvRequired.cri;
      case AvRequired.anal:
        return AvRequired.anal;
      case AvRequired.kiss:
        return AvRequired.kiss;
      case AvRequired.sm:
        return AvRequired.sm;
    }
  };
  Av.prototype.mainMan = function () {
    if (this.mainManId()) {
      return $gameActors.actor(this.mainManId());
    }
    return null;
  };
  Av.prototype.subMan1 = function () {
    if (this.subMan1Id()) {
      return $gameActors.actor(this.subMan1Id());
    }
    return null;
  };
  Av.prototype.subMan2 = function () {
    if (this.subMan2Id()) {
      return $gameActors.actor(this.subMan2Id());
    }
    return null;
  };
  Av.prototype.mainManId = function () {
    return this._mainManId;
  };
  Av.prototype.subMan1Id = function () {
    return this._subMan1Id;
  };
  Av.prototype.subMan2Id = function () {
    return this._subMan2Id;
  };
  Av.prototype.isMainManFixed = function () {
    return this.eroParam().mainMan > 0;
  };
  Av.prototype.mainManName = function () {
    var mainManId = this.mainManId();
    if (mainManId == 0) {
      return "";
    }
    return $gameActors.actor(mainManId).name();
  };
  Av.prototype.mainManIconIndex = function () {
    var mainManId = this.mainManId();
    if (mainManId == 0) {
      return -1;
    }
    return $gameActors.actor(mainManId).iconIndex();
  };
  Av.prototype.subMan1Name = function () {
    if (this._subMan1Id == 0) {
      return "";
    }
    return $gameActors.actor(this._subMan1Id).name();
  };
  Av.prototype.subMan1IconIndex = function () {
    if (this._subMan1Id == 0) {
      return -1;
    }
    return $gameActors.actor(this._subMan1Id).iconIndex();
  };
  Av.prototype.subMan2Name = function () {
    if (this._subMan2Id == 0) {
      return "";
    }
    return $gameActors.actor(this._subMan2Id).name();
  };
  Av.prototype.subMan2IconIndex = function () {
    if (this._subMan2Id == 0) {
      return -1;
    }
    return $gameActors.actor(this._subMan2Id).iconIndex();
  };
  Av.prototype.setMainMan = function (n) {
    this.resetMan(n);
    this._mainManId = n;
  };
  Av.prototype.setSubMan1 = function (n) {
    this.resetMan(n);
    this._subMan1Id = n;
  };
  Av.prototype.setSubMan2 = function (n) {
    this.resetMan(n);
    this._subMan2Id = n;
  };
  Av.prototype.resetMan = function (n) {
    if (this._mainManId == n) {
      this._mainManId = 0;
    }
    if (this._subMan1Id == n) {
      this._subMan1Id = 0;
    }
    if (this._subMan2Id == n) {
      this._subMan2Id = 0;
    }
  };
  Av.prototype.countManParam = function (param) {
    var n = 0;
    if (this._mainManId > 0) {
      var mainMan = $gameActors.actor(this._mainManId);
      n += mainMan.eroParam(param);
    }
    if (this._subMan1Id > 0) {
      var subMan1 = $gameActors.actor(this._subMan1Id);
      n += Math.floor(subMan1.eroParam(param) / 2);
    }
    if (this._subMan2Id > 0) {
      var subMan2 = $gameActors.actor(this._subMan2Id);
      n += Math.floor(subMan2.eroParam(param) / 2);
    }
    return n;
  };
  Av.prototype.isEnabled = function () {
    if (this._mainManId == 0) {
      return false;
    }
    if (!this.isEnabledParam()) {
      return false;
    }
    if (!this.isEnabledSkill()) {
      return false;
    }
    return true;
  };
  Av.prototype.isEnabledParam = function () {
    var list = this.avParamList();
    for (var i = 0; i < list.length; i++) {
      var avParam = list[i];
      var param = this.param(avParam.requiredType());
      var requiredValue = avParam.value();
      if (param + avParam.plus() < requiredValue) {
        return false;
      }
    }
    return true;
  };
  Av.prototype.isEnabledSkill = function () {
    var allSkills = this.allSkills();
    var skills = this.requiredSkills();
    for (var _i = 0, skills_1 = skills; _i < skills_1.length; _i++) {
      var skill = skills_1[_i];
      if (!allSkills.contains(skill)) {
        return false;
      }
    }
    return true;
  };
  Av.prototype.isDisplayMode = function () {
    return this._itemId == 1;
  };
  Av.prototype.isMatchParam = function (type) {
    if (this.isDisplayMode()) {
      return true;
    }
    var list = this.avParamList();
    for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
      var param = list_3[_i];
      if (param.requiredType() == type) {
        return true;
      }
    }
    return false;
  };
  Av.prototype.done = function () {
    this._done = true;
  };
  Av.prototype.allSkills = function () {
    var result = [];
    var main = this.mainMan();
    if (main) {
      var manParam = MAN_PARAMS[main.actorId()];
      this.addSkill(result, this.findSkill(manParam.skill1));
      this.addSkill(result, this.findSkill(manParam.skill2));
      this.addSkill(result, this.findSkill(manParam.skill3));
    }
    var sub1 = this.subMan1();
    if (sub1) {
      var manParam = MAN_PARAMS[sub1.actorId()];
      this.addSkill(result, this.findSkill(manParam.skill1));
      this.addSkill(result, this.findSkill(manParam.skill2));
      this.addSkill(result, this.findSkill(manParam.skill3));
    }
    var sub2 = this.subMan2();
    if (sub2) {
      var manParam = MAN_PARAMS[sub2.actorId()];
      this.addSkill(result, this.findSkill(manParam.skill1));
      this.addSkill(result, this.findSkill(manParam.skill2));
      this.addSkill(result, this.findSkill(manParam.skill3));
    }
    return result;
  };
  Av.prototype.isRequiredSkill = function (skill) {
    if (this.isDisplayMode()) {
      return true;
    }
    return this.requiredSkills().contains(skill);
  };
  Av.prototype.isEffectiveSkill = function (skill) {
    return this.effectiveSkills().contains(skill);
  };
  Av.prototype.containsMan = function (actorId) {
    if (this._mainManId == actorId) {
      return true;
    }
    if (this._subMan1Id == actorId) {
      return true;
    }
    if (this._subMan2Id == actorId) {
      return true;
    }
    return false;
  };
  Av.prototype.showResult = function () {
    this._showResult = true;
  };
  Av.prototype.isShowResult = function () {
    return this._showResult;
  };
  Av.prototype.screenShot = function () {
    if (!this._avJacket) {
      return null;
    }
    return this._avJacket.screenShot();
  };
  Av.prototype.setAvJacket = function (jacket) {
    this._avJacket = jacket;
  };
  Av.prototype.avJacket = function () {
    return this._avJacket;
  };
  Av.prototype.defaultJacket = function () {
    var ss;
    if (this.actor().boteId > 0) {
      ss = this.item().meta["ssBote"];
      if (!ss) {
        ss = this.defaultJacketSs();
      }
    } else {
      ss = this.defaultJacketSs();
    }
    if (!ss) {
      console.error(this.itemId() + "のssデータが存在しません");
    }
    var list = JsonEx.parse(ss);
    var result = [];
    for (var _i = 0, list_4 = list; _i < list_4.length; _i++) {
      var s = list_4[_i];
      result.push(s + ".png");
    }
    return new AvScreenShot(result);
  };
  Av.prototype.defaultJacketSs = function () {
    if ($gameSwitches.value(51)) {
      var ss = this.item().meta["ss1"];
      if (ss) {
        return ss;
      }
    }
    return this.item().meta["ss"];
  };
  Av.prototype.defaultJacket2 = function () {
    var ss;
    if (this.actor().boteId > 0) {
      ss = this.item().meta["ssBote2"];
      if (!ss) {
        ss = this.item().meta["ss2"];
      }
    } else {
      ss = this.item().meta["ss2"];
    }
    if (!ss) {
      return null;
    }
    var list = JsonEx.parse(ss);
    var result = [];
    for (var _i = 0, list_5 = list; _i < list_5.length; _i++) {
      var s = list_5[_i];
      result.push(s + ".png");
    }
    return new AvScreenShot(result);
  };
  Av.prototype.nakadashi = function () {
    return this._nakadashi;
  };
  Av.prototype.anal = function () {
    return this._anal;
  };
  Av.prototype.isFela = function () {
    return this._fela > 0;
  };
  Av.prototype.isSyusan = function () {
    return this.item().meta["syusan"] != null;
  };
  Av.prototype.auto = function () {
    if (!this.isMainManFixed()) {
    }
  };
  Av.prototype.isBote = function () {
    var avActor = this._avJacket.avActor();
    if (!avActor) {
      return false;
    }
    return avActor.cos().boteId() > 0;
  };
  Av.prototype.screenShotList = function () {
    return this._screenShotList;
  };
  Av.prototype.setScreenShotList = function (list) {
    this._screenShotList = list;
  };
  Av.prototype.commonEventId = function () {
    var commonEventId = parseInt(this.item().meta["common"]);
    return commonEventId;
  };
  Av.prototype.skillBonusRate = function () {
    var bonus = 0;
    var skills = this.effectiveSkills();
    var allSkills = this.allSkills();
    for (var _i = 0, skills_2 = skills; _i < skills_2.length; _i++) {
      var skill = skills_2[_i];
      if (allSkills.contains(skill)) {
        bonus += 15;
      }
    }
    return bonus;
  };
  Av.prototype.salesOnesPlace = function () {
    if (this._onesPlace === undefined) {
      this._onesPlace = Math.randomInt(10);
    }
    return this._onesPlace;
  };
  Av.prototype.isNinshin = function () {};
  Av.prototype.canContraception = function () {
    if (this.nakadashi() == 0) {
      // 避妊の必要なし
      return false;
    }
    return true;
  };
  Av.prototype.setContraception = function (b) {
    this._contraception = b;
  };
  Av.prototype.isContraception = function () {
    return this._contraception;
  };
  Av.prototype.taii = function () {
    var param = this.eroParam();
    return param.taii;
  };
  Av.prototype.finishSale = function () {
    this._finishSale = true;
  };
  Av.prototype.isFinishSale = function () {
    return this._finishSale;
  };
  Av.prototype.isFavorite = function () {
    return this._favorite;
  };
  Av.prototype.setFavorite = function (b) {
    this._favorite = b;
  };
  Av.prototype.setAuto = function () {
    this._auto = true;
  };
  Av.prototype.isAuto = function () {
    return this._auto;
  };
  return Av;
})();
var AvParam = /** @class */ (function () {
  function AvParam(required, value, woman, plus, rate) {
    this._required = required;
    this._value = value;
    this._woman = woman;
    this._plus = plus;
    this._rate = rate;
  }
  AvParam.prototype.requiredType = function () {
    return this._required;
  };
  AvParam.prototype.value = function () {
    return Math.round(this._value * this._rate);
  };
  AvParam.prototype.woman = function () {
    return this._woman;
  };
  AvParam.prototype.name = function () {
    return getAvParamType(this._required);
  };
  AvParam.prototype.iconIndex = function () {
    return Nore.$avParamManager.findIconIndex(this._required);
  };
  AvParam.prototype.plus = function () {
    return this._plus;
  };
  AvParam.prototype.total = function () {
    return this.plus() + this.woman();
  };
  AvParam.prototype.sortType = function () {
    switch (this._required) {
      case AvRequired.kiss:
        return 0;
      case AvRequired.chichi:
        return 1;
      case AvRequired.cri:
        return 2;
      case AvRequired.manko:
        return 3;
      case AvRequired.anal:
        return 4;
      case AvRequired.sm:
        return 5;
    }
  };
  return AvParam;
})();


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 REFRESH_ACTOR_LIST_SW = 258;
var Window_AvCharList = /** @class */ (function (_super) {
  __extends(Window_AvCharList, _super);
  function Window_AvCharList() {
    var _this = this;
    var r = new Rectangle(0, 44, 293, 756);
    _this = _super.call(this, r) || this;
    _this.backOpacity = 255;
    _this.frameVisible = false;
    _this._margin = 0;
    _this.padding = 0;
    _this.createContents();
    _this.refreshAll();
    return _this;
  }
  Window_AvCharList.prototype.refreshAll = function () {
    this._windowContentsSprite.removeChildren();
    this._douseiSpriteList = [];
    this._faceSpriteList = [];
    this.makeItems();
    this.refresh();
    this.createActorFaceSprites();
    this.createBorder();
    $gameTemp.douseiMapChanged = false;
    this.refreshTutoArrow();
  };
  Window_AvCharList.prototype.refreshTutoArrow = function () {
    if (this._tutoArrow) {
      this.removeChild(this._tutoArrow);
      this._tutoArrow = null;
    }
    if ($gameTutorial.nextTarget() == TextManager.target_2_8) {
      if (ConfigManager.simpleMenu) {
        this.drawArrow(305, 158);
      } else {
        this.drawArrow(214, 154);
      }
    }
  };
  Window_AvCharList.prototype.drawArrow = function (x, y) {
    var baseTexture2 = Nore.getSystemBaseTexture("0213_sys");
    var texture = new PIXI.Texture(baseTexture2);
    var sprite = new PIXI.Sprite(texture);
    sprite.x = x;
    sprite.y = y;
    sprite.rotation = (90 / 180) * Math.PI;
    this._tutoArrow = sprite;
    this.addChild(sprite);
  };
  Window_AvCharList.prototype.createBorder = function () {
    var g = new PIXI.Graphics();
    g.beginFill(0x4d38d1, 1);
    var hh = 756;
    g.drawRect(0, 0, 1, hh);
    g.endFill();
    g.x = 292;
    this._windowContentsSprite.addChild(g);
  };
  Window_AvCharList.prototype.createActorFaceSprites = function () {
    for (var i = 0; i < this._data.length; i++) {
      var actor = this._data[i];
      if (!actor) {
        return;
      }
      this.createActorFaceSprite(actor, i);
    }
  };
  Window_AvCharList.prototype.createActorFaceSprite = function (actor, index) {
    var rect = this.itemRect(index);
    var s = new Sprite_SlgActorFace(actor);
    s.y = rect.y - 50;
    s.x = -80;
    this._windowContentsSprite.addChild(s);
    s.refresh();
    this._faceSpriteList.push(s);
  };
  Window_AvCharList.prototype.update = function () {
    _super.prototype.update.call(this);
    if (
      this.isStageChanged() ||
      this.douseiMapChanged() ||
      $gameSwitches.value(REFRESH_ACTOR_LIST_SW)
    ) {
      this.refreshAll();
    }
    this.updateFaceVisible();
    this.updateVisible();
    this.updateOpacity();
    this.updateAvButtonEnabled();
  };
  Window_AvCharList.prototype.updateAvButtonEnabled = function () {
    if (!this._avButtonList) {
      return;
    }
    for (var i = 0; i < this._data.length; i++) {
      var actor = this._data[i];
      var button = this._avButtonList[actor.actorId()];
      if (!button) {
        continue;
      }
      if (actor.hpRate() == 1) {
        button.enable();
      }
    }
  };
  Window_AvCharList.prototype.itemWidth = function () {
    return 292;
  };
  Window_AvCharList.prototype.douseiMapChanged = function () {
    return $gameTemp.douseiMapChanged;
  };
  Window_AvCharList.prototype.updateOpacity = function () {
    if (!$gameSwitches.value(53)) {
      this.alpha = 1;
      return;
    }
    if ($gameScreen.picture(1)) {
      this.alpha = 1 - $gameScreen.picture(1).opacity() / 255;
    } else {
      this.alpha = 1;
    }
  };
  Window_AvCharList.prototype.updateVisible = function () {
    if ($gameSystem.isRecollection()) {
      this.visible = false;
      return;
    }
    if ($gameSwitches.value(42)) {
      this.visible = false;
    } else {
      this.visible = true;
    }
    $gameSwitches.setValue(43, this.visible);
  };
  Window_AvCharList.prototype.updateFaceVisible = function () {
    for (var i = 0; i < this._data.length; i++) {
      var actor = this._data[i];
      var f = this._faceSpriteList[i];
      if (!f) {
        return;
      }
      if (!actor) {
        f.visible = false;
        continue;
      }
      if (actor.dousei().isEnabled() && actor.dousei().manId() > 0) {
        f.visible = false;
      } else {
        f.visible = true;
      }
    }
  };
  Window_AvCharList.prototype.isStageChanged = function () {
    return this._lastStage != $slg.stage();
  };
  Window_AvCharList.prototype.refresh = function () {
    this._avButtonList = [];
    $gameSwitches.setValue(REFRESH_ACTOR_LIST_SW, false);
    this._windowContentsSprite.removeChildren();
    this._windowContentsSprite.x = 0;
    this._windowContentsSprite.y = 0;
    _super.prototype.refresh.call(this);
  };
  Window_AvCharList.prototype.maxItems = function () {
    if (!this._data) {
      return 0;
    }
    return 7;
  };
  Window_AvCharList.prototype.maxCols = function () {
    return 1;
  };
  Window_AvCharList.prototype.itemHeight = function () {
    return 108;
  };
  Window_AvCharList.prototype.makeItems = function () {
    this._lastStage = $slg.stage();
    this._data = [];
    var idList = $gameParty.getActorIdList();
    for (var _i = 0, idList_1 = idList; _i < idList_1.length; _i++) {
      var id = idList_1[_i];
      this._data.push($gameActors.actor(id));
    }
  };
  Window_AvCharList.prototype.drawItemBackground = function (index) {
    var rect = this.itemRect(index);
    var dark = new PIXI.Graphics();
    dark.beginFill(0x161420, 1);
    var hh = 756 / 7;
    dark.drawRect(0, 0, this.itemWidth(), hh);
    dark.x = 0;
    dark.y = rect.y + 0;
    dark.endFill();
    this._windowContentsSprite.addChild(dark);
    var actor = this._data[index];
    if (!actor) {
      return;
    }
    var baseTexture = Nore.getSystemBaseTexture("main");
    {
      var r = new Rectangle(0, 210, 290, 103);
      if ($gameTemp.isIdleMode()) {
        r.y += 190;
      }
      var texture = new PIXI.Texture(baseTexture, r);
      var s = new PIXI.Sprite(texture);
      s.y = rect.y + 0;
      this._windowContentsSprite.addChild(s);
    }
  };
  Window_AvCharList.prototype.drawItem = function (index) {
    var actor = this._data[index];
    if (!actor) {
      return;
    }
    var rect = this.itemRect(index);
    this.createButtons(actor.actorId(), rect);
    this.createDouseiSprite(actor.actorId(), rect);
    this.createHpGauge(actor.actorId(), rect);
    this.createNinshinInfo(actor.actorId(), rect);
    this.createDouseiIdle(actor.actorId(), rect);
  };
  Window_AvCharList.prototype.createDouseiSprite = function (actorId, rect) {
    var dousei = $gameActors.actor(actorId).dousei();
    if (!dousei.isEnabled()) {
      return;
    }
    var s = new Sprite_Dousei(dousei, rect.y - 18);
    s.x = 0;
    this._windowContentsSprite.addChild(s);
    this._douseiSpriteList.push(s);
  };
  Window_AvCharList.prototype.createHpGauge = function (actorId, rect) {
    if ($gameTemp.isIdleMode()) {
      return;
    }
    var actor = $gameActors.actor(actorId);
    var gauge = new Nore.Sprite_ActorHp(actor);
    gauge.x = rect.x + 152;
    gauge.y = rect.y + 55;
    this._windowContentsSprite.addChild(gauge);
  };
  Window_AvCharList.prototype.createNinshinInfo = function (actorId, rect) {
    var actor = $gameActors.actor(actorId);
    var infoSprite = new Nore.Sprite_ActorNinshinInfo(actor);
    infoSprite.x = rect.x - 5;
    infoSprite.y = rect.y + 81;
    this._windowContentsSprite.addChild(infoSprite);
  };
  Window_AvCharList.prototype.createButtons = function (actorId, rect) {
    var actor = $gameActors.actor(actorId);
    if ($gameTemp.isIdleMode()) {
      if (actor.dousei().isEnabled()) {
        var button2 = new Sprite_OverableButton("down2");
        button2.x = rect.x + 239;
        button2.y = rect.y + 9;
        this._windowContentsSprite.addChild(button2);
        button2.setClickHandler(this.onDousei.bind(this, actorId));
      }
      return;
    }
    var button = new Sprite_OverableButton("down");
    var left = rect.x + 239;
    var yy = rect.y + 1;
    var interval = 47;
    button.x = left;
    button.y = yy;
    this._windowContentsSprite.addChild(button);
    button.setClickHandler(this.onStatus.bind(this, actorId));
    var button3 = new Sprite_OverableButton("av", false, actor.hpRate() < 1);
    button3.x = left - interval;
    button3.y = yy;
    this._windowContentsSprite.addChild(button3);
    button3.setClickHandler(this.onRecord.bind(this, actorId));
    this._avButtonList[actorId] = button3;
    if (actor.dousei().isEnabled()) {
      var button2 = new Sprite_OverableButton("down2");
      button2.x = left - interval * 2;
      button2.y = yy;
      this._windowContentsSprite.addChild(button2);
      button2.setClickHandler(this.onDousei.bind(this, actorId));
    }
  };
  Window_AvCharList.prototype.createDouseiIdle = function (actorId, rect) {
    if (!$gameTemp.isIdleMode()) {
      return;
    }
    var s = new Sprite_DouseiIdle(actorId);
    s.x = 140;
    s.y = rect.y;
    this._windowContentsSprite.addChild(s);
  };
  Window_AvCharList.prototype.onStatus = function (actorId) {
    if ($gameMap.isEventRunning()) {
      return;
    }
    SoundManager.playOk();
    $gameParty.setMenuActorId(actorId);
    $gameTemp.lastSelectedEroStatusIndex = -1;
    SceneManager.push(Nore.Scene_EroStatus);
  };
  Window_AvCharList.prototype.onRecord = function (actorId) {
    if ($gameMap.isEventRunning()) {
      return;
    }
    SoundManager.playOk();
    var actor = $gameActors.actor(actorId);
    if (actor.dousei().isDouseiNinshin()) {
      $gameParty.addCommonEvent(498, -1);
      return;
    }
    if ($slg.hasLastSaleTimeGaugeEvent(actorId)) {
      $gameParty.addCommonEvent(491, -1);
      return;
    }
    $gameParty.setMenuActorId(actorId);
    SceneManager.push(Scene_AvTree);
  };
  Window_AvCharList.prototype.onDousei = function (actorId) {
    if ($gameMap.isEventRunning()) {
      return;
    }
    SoundManager.playOk();
    var actor = $gameActors.actor(actorId);
    $gameParty.setMenuActorId(actorId);
    if (actor.dousei().isTaikenbanNg()) {
      $gameParty.addCommonEvent(492, -1);
      return;
    }
    if (actor.dousei().isDouseiNinshin()) {
      $gameParty.addCommonEvent(496, -1);
      return;
    }
    SceneManager.push(Nore.Scene_Dousei);
  };
  return Window_AvCharList;
})(Window_Selectable);
Game_Interpreter.prototype.getPosX = function (posId) {
  switch (posId) {
    case Nore.Tachie.LEFT_POS:
      if ($gameSwitches.value(43)) {
        return Nore.Tachie.LEFT_POS_X + 220;
      } else {
        return Nore.Tachie.LEFT_POS_X;
      }
    case Nore.Tachie.RIGHT_POS:
      if ($gameSwitches.value(43)) {
        return Nore.Tachie.RIGHT_POS_X + 50;
      } else {
        return Nore.Tachie.RIGHT_POS_X;
      }
    case Nore.Tachie.CENTER_POS:
      if ($gameSwitches.value(43)) {
        return Nore.Tachie.CENTER_POS_X + 120;
      } else {
        return Nore.Tachie.CENTER_POS_X;
      }
    case Nore.Tachie.CENTER2_POS:
      return Nore.Tachie.CENTER_POS_X - 120;
    case Nore.Tachie.CENTER3_POS:
      if ($gameSwitches.value(43)) {
        return Nore.Tachie.CENTER_POS_X - 60;
      } else {
        return Nore.Tachie.CENTER_POS_X - 110;
      }
    default:
      console.error("posId  が不正です:" + posId);
  }
};
var Sprite_SlgActorFace = /** @class */ (function (_super) {
  __extends(Sprite_SlgActorFace, _super);
  function Sprite_SlgActorFace(actor) {
    var _this = _super.call(this) || this;
    _this._actor = actor;
    return _this;
  }
  Sprite_SlgActorFace.prototype.refresh = function () {
    this.removeChildren();
    var rect = new Rectangle(0, 52, 220, 92);
    var actor = JsonEx.makeDeepCopy(this._actor);
    var acceHoppe = actor.getAcceHoppeId();
    actor.setHoppeId(acceHoppe);
    actor.setDefaultHoppeId(acceHoppe);
    this.drawTachieActor(
      actor,
      this,
      this.posX(),
      this.posY() - 160,
      rect,
      actor.getDefaultFaceId(),
      0.5
    );
  };
  Sprite_SlgActorFace.prototype.faceId = function () {
    var actorId = this._actor.actorId();
    switch (actorId) {
      case 8:
        return 1;
      case 10:
        return 1;
      case 11:
        return 2;
      case 17:
        return this.faceId17();
    }
    return 4;
  };
  Sprite_SlgActorFace.prototype.faceId17 = function () {
    var avCount = $slg.avInfo().actorAvCount(this._actor.actorId());
    switch (avCount) {
      case 0:
        return 8;
      case 1:
        return 13;
    }
    return 4;
  };
  Sprite_SlgActorFace.prototype.posX = function () {
    switch (this._actor.actorId()) {
      case 4:
        return 15;
      case 8:
        return 25;
      case 9:
        return 10;
      case 10:
        return -10;
      case 11:
        return 10;
      case 13:
        return 15;
      case 17:
        return 15;
    }
    return 0;
  };
  Sprite_SlgActorFace.prototype.posY = function () {
    switch (this._actor.actorId()) {
      case 4:
        return 50;
      case 9:
        return 60;
      case 10:
        return -25;
      case 11:
        return -25;
      case 13:
        return 55;
      case 17:
        return 22;
    }
    return 0;
  };
  return Sprite_SlgActorFace;
})(Sprite);