function Window_EroStatus_kiroku() {
	this.initialize(...arguments);
}

(function () {
	Window_EroStatus_kiroku.prototype = Object.create(Window_Base.prototype);
	Window_EroStatus_kiroku.prototype.constructor = Window_EroStatus_kiroku;

	// padding0を適用させる
	Object.defineProperty(Window_EroStatus_kiroku.prototype, "padding", {
		get: function () {
			return 0;
		},
		set: function (value) {
			this._padding = 0;
			this._refreshAllParts();
		},
		configurable: true
	});

	Window_EroStatus_kiroku.prototype.initialize = function (rect) {
		Window_Base.prototype.initialize.call(this, rect);
		this._padding = 0;
		this._margin = 0;
		this.refresh();
	};

	Window_EroStatus_kiroku.prototype._refreshAllParts = function () {
		//this._refreshBack();
		//this._refreshFrame();
		this._refreshCursor();
		this._refreshArrows();
		this._refreshPauseSign();
	};

	Window_EroStatus_kiroku.prototype.refresh = function () {
		this.contents.clear();
		var actor = $gameParty.menuActor();
		var chara = actor.name() == "Shirayuki" ? "sira" : "yozu";

		var bitmap = ImageManager.loadSystem("erost_kiroku_frame");
		this.contents.blt(bitmap, 0, 0, 1280, 720, 0, -65);
		if (!bitmap.isReady()) {
			bitmap.addLoadListener(() => {
				this.refresh(); // 画像がロードされたら再描画
			});
			return;
		}
		this.contents.fontFace = "serif";
		this.contents.fontSize = 18;
		var sX = 24;
		var sY = 547;
		var lineX = 172;
		var lineX2 = 228;
		var sX2 = 622;

		this.changeTextColor("#FFFFFF");
		this.drawTextS("相手 ：", sX + lineX, sY, 200);
		this.drawTextS("種族 ：", sX + lineX + lineX2, sY, 200);

		this.drawTextS("相手 ：", sX + sX2 + lineX, sY, 200);
		this.drawTextS("種族 ：", sX + sX2 + lineX + lineX2, sY, 200);

		var ary = {
			sira: {
				switch: { virgin: 202, anal_virgin: 203 },
				vari: { virgin: 242, anal_virgin: 243 }
			},
			yozu: {
				switch: { virgin: 205, anal_virgin: 206 },
				vari: { virgin: 322, anal_virgin: 323 }
			}
		};

		if ($gameSwitches.value(ary[chara].switch.virgin)) {
			const d1 = CBR_eroRireki[$gameVariables.value(ary[chara].vari.virgin) - 1];
			this.drawTextS(d1.target, sX + lineX + 62, sY, 300);
			this.drawTextS(d1.job, sX + lineX + lineX2 + 62, sY, 300);
			this.drawTextExS(d1.text, sX, sY + 32, 300);
		}

		if ($gameSwitches.value(ary[chara].switch.anal_virgin)) {
			if ($gameVariables.value(ary[chara].vari.anal_virgin) != 0) {
				const d2 = CBR_eroRireki[$gameVariables.value(ary[chara].vari.anal_virgin) - 1];
				this.drawTextS(d2.target, sX + sX2 + lineX + 62, sY, 300);
				this.drawTextS(d2.job, sX + sX2 + lineX + lineX2 + 62, sY, 300);
				this.drawTextExS(d2.text, sX + sX2, sY + 32, 300);
			}
		}

		this.changeTextColor("#000000");
		this.drawTextS("処女喪失記録", sX, sY, 200);
		this.drawTextS("アナル処女喪失記録", sX + sX2, sY, 200);

		this.contents.fontSize = 20;

		var sY = 25;
		var lineY = 27;
		var sX = 330;
		var lineX = 314;
		var skip = 0;
		var w = 288;
		var sX2 = 144;

		var width = this.textWidth("エッチ経験");
		this.drawTextS("エッチ経験", sX - width / 2 + sX2, 0, width);

		var width = this.textWidth("経験相手");
		this.drawTextS("経験相手", sX - width / 2 + sX2 + lineX, 0, width);
		var width = this.textWidth("絶頂・射精");
		this.drawTextS("絶頂・射精", sX - width / 2 + sX2 + lineX, lineY * 4 + 2, width);
		var width = this.textWidth("エロシチュ");
		this.drawTextS("エロシチュ", sX - width / 2 + sX2 + lineX, lineY * 12 + 4, width);

		var width = this.textWidth("エロ商売");
		this.drawTextS("エロ商売", sX - width / 2 + sX2 + lineX * 2, 0, width);
		var width = this.textWidth("出産");
		this.drawTextS("出産", sX - width / 2 + sX2 + lineX * 2, lineY * 7 + 2, width);

		this.contents.fontSize = 18;
		this.changeTextColor("#FFFFFF");
		var list = [
			{ text: "セックス", sira: 262, yozu: 342 },
			{ text: "アナルセックス", sira: 263, yozu: 343 },
			{ text: "フェラチオ", sira: 264, yozu: 344 },
			{ text: "パイズリ", sira: 265, yozu: 345 },
			{ text: "手コキ", sira: 266, yozu: 346 },
			{ text: "クンニ", sira: 267, yozu: 347 },
			{ text: "キス", sira: 268, yozu: 348 },
			{ text: "乳揉み", sira: 269, yozu: 349 },
			{ text: "尻揉み", sira: 270, yozu: 350 },
			{ text: "手マン", sira: 271, yozu: 351 },
			{ text: "アナル弄り", sira: 272, yozu: 352 },
			{ text: "オナニー", sira: 273, yozu: 353 },
			{ text: "アナニー", sira: 274, yozu: 354 },
			{ text: "トイレ", sira: 275, yozu: 355 },
			{ text: "露出プレイ", sira: 276, yozu: 356 },
			{ text: "筆おろし", sira: 278, yozu: 358 },
			{ text: "レズエッチ", sira: 279, yozu: 359 },
			{ text: "近親相姦", sira: 280, yozu: 360 }
		];
		for (var i = 0; i < 18; i++) {
			//左上のコンテンツ
			this.drawTextS(list[i].text, sX, sY + lineY * i, 300);
			this.drawTextS(
				`${$gameVariables.value(list[i][chara]).clamp(0, 9999999)} ${list[i].unit ? list[i].unit : "回"}`,
				sX,
				sY + lineY * i,
				w,
				"right"
			);
		}

		var list = [
			{ text: "人間", sira: 259, yozu: 339, unit: "人" },
			{ text: "魔物", sira: 260, yozu: 340, unit: "匹" },
			{ text: "魔獣", sira: 261, yozu: 341, unit: "匹" },
			{ text: "s", sira: 0, yozu: 0 },
			{ text: "絶頂", sira: 281, yozu: 361 },
			{ text: "潮吹き", sira: 282, yozu: 362 },
			{ text: "ぶっかけ", sira: 283, yozu: 363, unit: "cc" },
			{ text: "膣内射精", sira: 284, yozu: 364, unit: "cc" },
			{ text: "アナル内射精", sira: 285, yozu: 365, unit: "cc" },
			{ text: "口内射精", sira: 286, yozu: 366, unit: "cc" },
			{ text: "母乳噴出", sira: 287, yozu: 367, unit: "cc" },
			{ text: "s", sira: 0, yozu: 0 },
			{ text: "人との性行為", sira: 288, yozu: 368 },
			{ text: "異種姦", sira: 289, yozu: 369 },
			{ text: "乱交", sira: 290, yozu: 370 },
			{ text: "レイプ", sira: 291, yozu: 371 },
			{ text: "セクハラ", sira: 292, yozu: 372 },
			{ text: "ご奉仕", sira: 293, yozu: 373 },
			{ text: "戦闘中エッチ", sira: 308, yozu: 388 }
		];
		skip = 0;
		for (var i = 0; i < 19; i++) {
			//左上のコンテンツ
			if (list[i].text == "s") {
				skip += 2;
				continue;
			}

			this.drawTextS(list[i].text, sX + lineX, sY + lineY * i + skip, 300);
			this.drawTextS(
				`${$gameVariables.value(list[i][chara]).clamp(0, 9999999)} ${list[i].unit ? list[i].unit : "回"}`,
				sX + lineX,
				sY + lineY * i + skip,
				w,
				"right"
			);
		}
		skip = 0;
		var list = [
			{ text: "風俗仕事", sira: 294, yozu: 374 },
			{ text: "風俗で稼いだ額", sira: 295, yozu: 375, unit: "円" },
			{ text: "売春", sira: 296, yozu: 376 },
			{ text: "売春で稼いだ額", sira: 297, yozu: 377, unit: "円" },
			{ text: "母乳販売", sira: 298, yozu: 378 },
			{ text: "母乳販売で稼いだ額", sira: 299, yozu: 379, unit: "円" },
			{ text: "s", sira: 0, yozu: 0 },
			{ text: "妊娠", sira: 300, yozu: 380 },
			{ text: "出産", sira: 301, yozu: 381 },
			{ text: "堕胎", sira: 302, yozu: 382 },
			{ text: "流産", sira: 303, yozu: 383 },
			{ text: "人間出産", sira: 304, yozu: 384, unit: "人" },
			{ text: "魔物出産", sira: 305, yozu: 385, unit: "匹" },
			{ text: "魔獣出産", sira: 306, yozu: 386, unit: "匹" },
			{ text: "産卵", sira: 307, yozu: 387 }
		];
		for (var i = 0; i < 15; i++) {
			//左上のコンテンツ
			if (list[i].text == "s") {
				skip += 2;
				continue;
			}

			this.drawTextS(list[i].text, sX + lineX * 2, sY + lineY * i + skip, 300);
			this.drawTextS(
				`${$gameVariables.value(list[i][chara]).clamp(0, 9999999)} ${list[i].unit ? list[i].unit : "回"}`,
				sX + lineX * 2,
				sY + lineY * i + skip,
				w,
				"right"
			);
		}
	};
})();
