//=============================================================================
// O_Recollect.js
//=============================================================================

/*:ja
 * @plugindesc 回想画面
 * @author 
 *
 * @param 回想モード スイッチID
 * @desc 回想でのイベント実行中を表すスイッチID
 * @default 4
 * @type switch
 *
 * @param CGモード スイッチID
 * @desc 回想でのCG閲覧を表すスイッチID
 * @default 5
 * @type switch
 *
 *
 * @help
 * プラグインコマンド
 *
 * OpenRecollect
 *   回想画面を開く
 *
 * EndRecollect
 *   回想一覧に戻る
 * 
*/


(function() {
    'use strict';
	
	var parameters = PluginManager.parameters('O_Recollect');
    var recorectModeFlgID = Number(parameters['回想モード スイッチID'] || 4);
	var recorectCGModeFlgID = Number(parameters['CGモード スイッチID'] || 5);
	
	var $playing_event_index = 0 //実行中の回想Indexを保持する変数 回想完了後の表示用

//***** タイトル画面にメニューを追加
	var _Scene_Title_createCommandWindow =Scene_Title.prototype.createCommandWindow;
	Scene_Title.prototype.createCommandWindow = function() {
		_Scene_Title_createCommandWindow.call(this);
		this._commandWindow.setHandler('recollection', this.commandRecollection.bind(this));
	};
	
	Scene_Title.prototype.commandRecollection = function() {
		this._commandWindow.close();
		ConfigManager.syncOpenedEvent();
		SceneManager.push(Scene_Recollection);
	}
	
	var _Window_TitleCommand_makeCommandList = Window_TitleCommand.prototype.makeCommandList;
	Window_TitleCommand.prototype.makeCommandList = function() {
		_Window_TitleCommand_makeCommandList.call(this);
		this.addCommand("Scene Reminiscence", 'recollection', true);
	};
	
//***** タイトルに戻る際にゲームデータをリセット
	var _Game_Interpreter_prototype_command354 = Game_Interpreter.prototype.command354;
	Game_Interpreter.prototype.command354 = function() {		
		DataManager.setupNewGame();
		return _Game_Interpreter_prototype_command354.call(this);
	};
	
	var _Scene_GameEnd_prototype_commandToTitle = Scene_GameEnd.prototype.commandToTitle;
	Scene_GameEnd.prototype.commandToTitle = function() {
		DataManager.setupNewGame();
		_Scene_GameEnd_prototype_commandToTitle.call(this);
	};
	
	var _Scene_Gameover_prototype_gotoTitle = Scene_Gameover.prototype.gotoTitle;
	Scene_Gameover.prototype.gotoTitle = function() {
		DataManager.setupNewGame();
		_Scene_Gameover_prototype_gotoTitle.call(this);
	};

//***** 回想シーンの定義
	function Scene_Recollection() {
		this.initialize.apply(this, arguments);
	}

	Scene_Recollection.prototype = Object.create(Scene_MenuBase.prototype);
	Scene_Recollection.prototype.constructor = Scene_Recollection;
	
	Scene_Recollection.prototype.initialize = function() {
		Scene_MenuBase.prototype.initialize.call(this);			
	};
	
	Scene_Recollection.prototype.create = function() {
		Scene_MenuBase.prototype.create.call(this);
		
		this.createHelpWindow();
		this.createEventWindow();
		this.createConfirmWindow();
		//this.createCGViewWindow();
		
		this.activateList();
	};
	
	Scene_Recollection.prototype.start = function(){
		AudioManager.fadeOutBgm(1);
		Scene_Base.prototype.start.call(this);
		//AudioManager.playBgm({"name":"2000_peace","pan": 0,"pitch" : 80,"volume": 70});
		this._listWindow.refresh();//←必須
		
		$gameSwitches._data[recorectModeFlgID] = true;//回想モードフラグをON
	};
	
	Scene_Recollection.prototype.createEventWindow = function() {
		this._listWindow = new Window_EventList(0, 0, Graphics.boxWidth, Graphics.boxHeight-this._helpWindow.height);
		this._listWindow.setHelpWindow(this._helpWindow);
		this._listWindow.setHandler('ok',     this.onListOk.bind(this));
		this._listWindow.setHandler('cancel', this.backTitle.bind(this));
		this.addWindow(this._listWindow);
		
		this._helpWindow.y=this._listWindow.height;
	};
	
	Scene_Recollection.prototype.createConfirmWindow = function() {
        this._confirmWindow = new Window_EventPlayModeConfirm(this._listWindow);
        this._confirmWindow.setHandler('cancel', this.activateList.bind(this));
        this._confirmWindow.setHandler('paly_event', this.playEvent.bind(this,0));
        this._confirmWindow.setHandler('view_cg', this.playEvent.bind(this,1));
        this.addChild(this._confirmWindow);
    };
	
	/*
	Scene_Recollection.prototype.createCGViewWindow = function(){
		// CG参照用ダミーコマンド
		this._CGView_window = new Window_Command_CGView(0, 0);
		this._CGView_window.deactivate();
		this._CGView_window.visible = false;
		this._CGView_window.setHandler('ok', this.commandCGViewOk.bind(this));
		this._CGView_window.setHandler('cancel', this.commandCGViewCancel.bind(this));
		this._CGView_window.addCommand('next', 'ok');
		this.addWindow(this._CGView_window);
	};
	*/
	
	Scene_Recollection.prototype.onListOk = function() {
		if(this._listWindow.isEnabled()){
			$playing_event_index=this._listWindow.index();
			this.activateConfirm();
		}else{
			this.activateList();	
		}	
	};
	
	//スタート画面に戻る
	Scene_Recollection.prototype.backTitle = function() {
		this._listWindow.deselect();		
		$gameSwitches._data[recorectModeFlgID] = false;//回想モードフラグをOFF
	
		SceneManager.goto(Scene_Title);
	};
	
	Scene_Recollection.prototype.activateList = function() {
		this._confirmWindow.hide();
		this._confirmWindow.deactivate();
		this._listWindow.activate();
		this._listWindow.select($playing_event_index);
	};
	
	Scene_Recollection.prototype.activateConfirm = function() {
		this._listWindow.deactivate();
		
		this._confirmWindow.updatePlacement();
        this._confirmWindow.select(0);
        this._confirmWindow.show();
        this._confirmWindow.activate();
		
	};
	
	//イベント再生の開始
	Scene_Recollection.prototype.playEvent = function(cg_mode) {
		//AudioManager.fadeOutBgm(1);
		$gameScreen.startFadeOut(1);
		
		$gameSwitches._data[3] = true;//イベント実行中フラグ
		
		//$gameTemp.reserveCommonEvent(this._listWindow.selectedEventID());
		$gameTemp.reserveCommonEvent(50);//コモンイベント５０を実行
		$gameSwitches._data[this._listWindow.selectedEventID()] = true;
		//CGモード
		if(cg_mode){
			$gameSwitches._data[recorectCGModeFlgID] = true;
		}
		//this._listWindow.deselect();
		$gamePlayer.reserveTransfer(28, 0, 0, 0);//マップID
		SceneManager.goto(Scene_Map);
		
		
	};
	
	
//*****  Window_EventList
	function Window_EventList() {
		this.initialize.apply(this, arguments);
	};
		
	Window_EventList.prototype = Object.create(Window_Selectable.prototype);
	Window_EventList.prototype.constructor = Window_EventList;
	
	Window_EventList.prototype.initialize = function(x, y, width, height) {
		Window_Selectable.prototype.initialize.call(this, x, y, width, height);
		this._thumb=ImageManager.loadPicture('e_thumb');
		this._imgWidth=170;
		this._imgHeight=96;
		this._paddingWidth=20;
		this._paddingHeight=8;
				
		this._cols=5;
		this._rows=4;
		
		this._index = $playing_event_index;
		
		this.initListData();
		
		this.resetPlayEventFlg();//直前の回想の実行フラグが立ってるなら倒す
		
		this.refresh();
		this.resetScroll();
	};
	
	
	Window_EventList.prototype.resetPlayEventFlg = function (){
		if($gameSwitches._data[this.selectedEventID()]){
			$gameSwitches._data[this.selectedEventID()] = false;
		}
	};
	
	/*
	Window_EventList.prototype.getSelectedEventData = function (){
		return this.eventData[this._index];
	};*/
	
	Window_EventList.prototype.maxItems = function() {
		return this.eventData.length;
	};
	Window_EventList.prototype.maxCols = function() {
		return this._cols;
	};
	Window_EventList.prototype.itemHeight = function() {
		var clientHeight = this.height - this.padding * 2;
		return Math.floor(clientHeight / this.numVisibleRows());
	};
				
	Window_EventList.prototype.numVisibleRows = function() {
		return this._rows;
	};
	
	//****!!! ↓ isCurrentItemEnabled とセットで実装する事
	Window_EventList.prototype.isEnabled = function(index) {
		return $gameSwitches.value(this.selectedEventID(index) + 1);
	};
	Window_EventList.prototype.isCurrentItemEnabled = function() {
		return this.isEnabled(this._index);
	};
	
	
	Window_EventList.prototype.drawItem = function(index) {
		
		var rect = this.itemRect(index);
		
		var sx = 0;
		var sy = 0;
		
		var dx =rect.x+Math.round((this.itemWidth() - this._imgWidth)/2);
		var dy =rect.y+Math.round((this.itemHeight() - this._imgHeight)/2);
		
		var sh = this._imgHeight;
		
		if(this.isEnabled(index)){	
			
			var thumb_index = (this.selectedEventID(index) - 99) / 2; 
			//開放済みならサムネ座標の計算
			var row = Math.ceil(thumb_index / this._cols);
			var col = thumb_index - ((row - 1) * this._cols);
		
			sx = this._imgWidth * (col-1);
			sy = this._imgHeight * row;
		}
		
		this.contents.blt(this._thumb
						  ,sx,sy
						  ,this._imgWidth,sh
						  ,dx,dy
						  );
		
	};
	
	Window_EventList.prototype.selectedEventID = function(index) {
		if(index == undefined){
			return this.eventData[this._index];
		}else{
			return this.eventData[index];
		}
		
	};
	
	Window_EventList.prototype.updateHelp = function() {
		var id = this.selectedEventID();

		var tmp_text = $gameSwitches.name(id);
		if(tmp_text != ""){
			tmp_text = '【'+tmp_text+'】:';//
		}
		var help_text={'description':tmp_text+this.getHelpText(id)};
		this._helpWindow.setItem(help_text);
	};
	
	/*
	Window_EventList.prototype.refresh = function() {
		this.contents.clear();
		this.drawAllItems();
	};*/
	
	Window_EventList.prototype.initListData = function (){
		this.eventData = [];
		this.eventData.push(101);//脇見せ
		this.eventData.push(103);//パンチラ
		this.eventData.push(105);//カンチョー
		this.eventData.push(109);//カンチョー
		this.eventData.push(139);//いたずらっ子更生
		this.eventData.push(145);//オナニー中毒
		this.eventData.push(107);//穴におちたら１
		this.eventData.push(143);//穴におちたら２
		this.eventData.push(191);//売春：農民
		this.eventData.push(111);//見える男		
		this.eventData.push(115);//姫は成長中
		this.eventData.push(117);//パンツ交換
		this.eventData.push(185);//売春：下着マニア
		this.eventData.push(119);//ナンダーラの教え
		this.eventData.push(141);//ナンダーラの教え2
		this.eventData.push(121);//縄使い
		this.eventData.push(131);//縄使い2
		this.eventData.push(159);//縄使い3
		this.eventData.push(123);//病気の妹1
		this.eventData.push(149);//病気の妹2
		this.eventData.push(189);//売春：困り顔の男
		this.eventData.push(129);//マジックショー2
		this.eventData.push(157);//脱童貞会
		this.eventData.push(181);//ピエロとの勝負
		this.eventData.push(183);//釣り人との勝負
		this.eventData.push(127);//壁穴
		this.eventData.push(153);//壁穴２
		this.eventData.push(135);//泥酔
		this.eventData.push(151);//泥酔２
		this.eventData.push(137);//温泉輪姦
		this.eventData.push(155);//温泉ヘルス
		this.eventData.push(177);//温泉ソープ
		this.eventData.push(161);//娼館１
		this.eventData.push(163);//娼館２
		this.eventData.push(171);//娼館３
		this.eventData.push(165);//下級兵士の尋問
		this.eventData.push(167);//売春:神父
		this.eventData.push(169);//売春:ヨシオとマサコ
		this.eventData.push(173);//売春:鎧マニア
		this.eventData.push(187);//売春：パパタ
		this.eventData.push(193);//売春：不良
		this.eventData.push(195);//売春：村長
		this.eventData.push(179);//多忙な酒場店主
		this.eventData.push(175);//売春:賢者ペネロ
		
		this.eventData.push(113);//トカゲの丸焼き
		this.eventData.push(125);//マジックショー1
		this.eventData.push(133);//赤いピエロ発見
		this.eventData.push(147);//Ｍ男
		
		
		
		
	};
	
	Window_EventList.prototype.getHelpText = function(id){
		switch(id){
		case 101:
			return "After resting at the tent in Kaltaka Forest Central, talk to the \r\nvillage chief nearby.";
			break;
		case 103:
			return "Talk to the naughty kid in the centre of Weys village.";
			break;
		case 105:
			return "Talk to the boy in the North-Eastern part of Weys village, some time \r\nafter completing the \""+$gameSwitches.name(id - 2)+"\" event.";
			break;
		case 109:
			return "Touch the heart symbol in the North-Eastern part of Weys village, \r\nsome time after completing the \""+$gameSwitches.name(id - 4)+"\" event.";
			break;
		case 107:
			return "Drop into the hole in the South-Eastern part of Weys village.";
			break;
		case 111:
			return "Talk to the man in the back alley, in the South-Eastern part of Weys \r\nvillage.";
			break;
		case 113:
			return "Help the wandering chef in Nourwess village to find his cat.";
			break;
		case 115:
			return "Touch the heart symbol in the South-Eastern part of Nourwess.";
			break;
		case 117:
			return "Talk to the underwear expert in the North of Nourwess village.";
			break;
		case 119:
			return "Have the monk that is buried in the North-Eastern part of \r\nNourwess village \r\nteach you a new skill.";
			break;
		case 121:
			return "Talk to the rope user in front of the tent in Nourwess village.";
			break;
		case 123:
			return "Talk to the worried man in the South-Eastern part of Easton.";
			break;
		case 125:
			return "Talk to the bunny girl inside Easton theatre. \""+$gameSwitches.name(121)+"\" event \r\nrequired.";
			break;
		case 129:
			return "Talk to the red clown in Easton theatre, some time after completing \r\nthe \""+$gameSwitches.name(id - 4)+"\" event.";
			break;
		case 127:
			return "Check the back of the building in front of the Easton tavern, \r\nwait a while, \r\nthen check it again.";
			break;
		case 131:
			return "Clear the event \""+$gameSwitches.name(129)+"\", then talk to the rope user in \r\nNourwess after talking to the clown at the entrance to Easton theatre.";
			break;
		case 133:
			return "Clear the event \""+$gameSwitches.name(131)+"\", then talk to the clown at the \r\nentrance to Easton theatre.";
			break;
		case 135:
			return "Clear the event \""+$gameVariables.name(119)+"\", then talk to the \r\nplayboys in Easton tavern.";
			break;
		case 137:
			return "Visit the hot spring in Arlima village.";
			break;
		case 139:
			return "Clear the event \""+$gameSwitches.name(109)+"\", then, while \"Sexually Liberal\", \r\ntouch the heart symbol in the North-Eastern part of Weys village.";
			break;
		case 141:
			return "After clearing Hierkoll Tower, bring the Elixir of Nandala \r\nto the monk in the Northern part of Arlima village.";
			break;
		case 143:
			return "Clear Hierkoll Tower and the event \""+$gameSwitches.name(107)+"\", talk to \r\nthe fortune teller in Arlima while \"Sexually Liberal\",then check the hole in Weys village.";
			break;
		case 145:
			return "Clear Hierkoll Tower and the event \""+$gameSwitches.name(139)+"\", then touch the \r\nheart mark in the North-Eastern part of Weys village.";
			break;
		case 147:
			return "Clear Hierkoll Tower, then talk to the man behind the general store in \r\nArlima village.";
			break;
		case 149:
			return "Clear Hierkoll Tower and the event \""+$gameSwitches.name(123)+"\", then talk \r\nto the worried man in the South-Eastern part of Easton while \"Sexually Liberal\".";
			break;
		case 151:
			return "Clear Hierkoll Tower and the event \""+$gameSwitches.name(135)+"\", then \r\ntalk to the playboys in Easton tavern while \"Sexually Liberal\".";
			break;
		case 153:
			return "Clear the event \""+$gameSwitches.name(143)+"\" \""+$gameSwitches.name(149)+"\" \r\n\""+$gameSwitches.name(145)+"\" \""+$gameSwitches.name(151)+"\", then check a hole in the wall in Easton.";
			//return "Clear the event \""+$gameSwitches.name(127)+"\" \""+$gameSwitches.name(145)+"\" \r\n\""+$gameSwitches.name(143)+"\" \""+$gameSwitches.name(149)+"\" \""+$gameSwitches.name(151)+"\", then check behind the building in front of the Easton tavern.";
			break;
		case 155:
			return "Clear the event \""+$gameSwitches.name(137)+"\", then visit the hot springs \r\nin Arlima village while \"Perverted\".";
			break;
		case 157:
			return "Clear the event \""+$gameSwitches.name(133)+"\", then talk to the clown at the \r\nentrance to Easton theatre while \"Perverted\".";
			break;
			
		case 159:
			return "Clear the event \""+$gameSwitches.name(131)+"\", then talk to the rope user in front of the \r\ntent in Nourwess village as a \"Prostitute\".";
			break;	
		
		case 161:
			return "Talk to Horn the peddler in front of the Sas-Emerlin brothel while \r\n\"Perverted\", then talk to the Brothel manager.";
			break;
			
		case 163:
			return "Clear the event \""+$gameSwitches.name(161)+"\", then talk to the brothel owner in the \r\nNorth-Eastern part of Sas-Emerlin.";
			break;
			
		case 165:
			return "Check the door of the knight barracks in the North-Western part \r\nof Sas-Emerlin while \"Perverted\".";
			break;	
		
		case 167:
			return "Talk to the priest in the South-Western part of Sas-Emerlin as a \r\n\"Prostitute\".";
			break;	
		
		case 169:
			return "Talk to the couple in the Northern part of Sas-Emerlin as a \r\n\"Prostitute\".";
			break;
			
		case 171:
			return "Clear the event \""+$gameSwitches.name(163)+"\", then talk to the brothel owner in the \r\nNorth-Eastern part of Sas-Emerlin.";
			break;
		
		case 173:
			return "Check the armor that appears outside the Sas-Emerlin inn as a \r\n\"Prostitute\".";
			break;
		
		case 175:
			return "After saving Penerro the sage, talk to him as a \"Prostitute\".";
			break;
			
		case 177:
			return "Clear the event \""+$gameSwitches.name(155)+"\", then enter the hot springs \r\nin Arlima village as a \"Prostitute\".";
			break;
		
		case 179:
			return "Clear the event \""+$gameVariables.name(119)+"\", then talk to the barkeep \r\nof Easton tavern as a \"Prostitute\".";
			break;
		
		case 181:
			return "Clear the event \""+$gameSwitches.name(157)+"\", then talk to the clown in \r\nEaston theatre as a \"Prostitute.\"";
			break;
			
		case 183:
			return "Clear the event \""+$gameSwitches.name(181)+"\", then talk to the \r\nangler near Easton theatre.";
			break;
		
		case 185:
			return "Clear the event \""+$gameSwitches.name(117)+"\", then talk to the underwear \r\nexpert in the Northern part of Nourwess village as a \"Prostitute\".";
			break;
		
		case 187:
			return "Clear the event \""+$gameVariables.name(108)+"\", then talk to Papata in Weys \r\nvillage as a \"Prostitute\".";
			break;
			
		case 189:
			return "Clear the event \""+$gameSwitches.name(149)+"\", then talk to the worried \r\nman in the South-Eastern part of Easton as a \"Prostitute\".";
			break;
		
		case 191:
			return "Clear the event \""+$gameSwitches.name(143)+"\", then talk to the farmer \r\nin the South-Eastern part of Weys village as a \"Prostitute\".";
			break;
		
		case 193:
			return "Clear the event \""+$gameVariables.name(110)+"\", then talk to the misfits in \r\nthe North-Western part of Weys village as a \"Prostitute\".";
			break;
			
		case 195:
			return "Clear the event \""+$gameSwitches.name(193)+"\", then talk to Mathias in the \r\nNorth-Western part of Weys village.";
			break;
			
		default:
			return "";
			break;
		}
	};
	
	Window_EventList.prototype.getConfirmPos = function() {
		var row = Math.ceil((this._index + 1) / this._cols);
		var col = (this._index + 1) - ((row-1) * this._cols);
		
		row -= this.topRow();
		var res = [];
        res.x = 32 + ((col - 1) * (this._imgWidth + this._paddingWidth + 10));
		res.y = 74 + ((row - 1) * (this._imgHeight + this._paddingHeight + 4));
		
		return res;
    };

	
	
//**** 再生モード確認ウィンドウ
    function Window_EventPlayModeConfirm() {
        this.initialize.apply(this, arguments);
    };

    Window_EventPlayModeConfirm.prototype             = Object.create(Window_Command.prototype);
    Window_EventPlayModeConfirm.prototype.constructor = Window_EventPlayModeConfirm;
	
    Window_EventPlayModeConfirm.prototype.initialize = function(listWindow) {
        this._listWindow = listWindow;
        Window_Command.prototype.initialize.call(this, 0, 0);
    };

    Window_EventPlayModeConfirm.prototype.windowWidth = function() {
        return 160;
    };

    Window_EventPlayModeConfirm.prototype.updatePlacement = function() {
		var pos =  this._listWindow.getConfirmPos();
        this.x = pos.x;
        this.y = pos.y;
		
		/*
		this._list[2].enabled = false;
		this.refresh();
		*/
    };

    Window_EventPlayModeConfirm.prototype.makeCommandList = function() {
        this.addCommand('Scene Play', 'paly_event');
        this.addCommand('View CG'  , 'view_cg');
		this.addCommand('Cancel'  , 'cancel');
    };
	

//*****エロステータス更新
	Game_Interpreter.prototype.UpdateEroStatus = function(eventID){
		switch(eventID){
		case 127://壁穴1  
			this.setFirstEro(eventID);
			this.addExperPeople();
			this.addSexCount(); //中出し1回
			break;
		case 129://マジックショー
			this.setFirstEro(eventID);
			this.addExperPeople();
			this.addSexCount(2);
			break;
		case 131://縄使い２
			this.addExperPeople();
			this.addSexCount();
			this.addOrgasm(2);
			break;
		case 135://泥酔
			this.setFirstEro(eventID);
			this.addExperPeople(3);
			this.addSexCount(14);//外出し 複数回
			break;
		case 137://温泉
			this.setFirstEro(eventID);
			this.addExperPeople(7);
			this.addSexCount(11); //外出し 複数回
			break;
		case 139://いたずらっ子更生
			this.addOrgasm(1);//アナルでイッた
			//１回射精させた
			break;
		case 143://穴落ち２
			this.addExperPeople();
			this.addSexCount(6);
			break;
		case 145://オナニー中毒
			//子供とアナルセックス アナル中出し１回
			break;
		case 149://病気の妹
			this.addOrgasm(1);//クンニされて一回イッた。
			break;
		case 151://泥酔２
			//フェラチオ１回。
			this.addSexCount(4);//中出し４回
			this.addOrgasm(3);
			break;
		case 153://壁穴３
			this.addExperPeople(15);
			this.addSexCount(24);
			this.addOrgasm(12);
			break;
		case 155://温泉ヘルス
			//パイズリ　一発
			//フェラチオ 一発
			break;
		case 157://脱童貞集会
			this.addExperPeople(5);
			this.addSexCount(7);
			this.addOrgasm(6);
			break;
		case 159://縄使い３
			this.addSexCount(5);
			this.addOrgasm(33);
			break;
		case 161://娼館１
			this.addExperPeople(1);
			this.addSexCount(6);
			this.addOrgasm(24);
			break;
		case 163://娼館２
			this.addExperPeople(6);
			this.addSexCount(16);
			this.addOrgasm(21);
			break;
		case 171://娼館３
			this.addExperPeople(12);
			this.addSexCount(35);
			this.addOrgasm(63);
			break;
			
		case 165://下級兵士の尋問
			this.addExperPeople(1);
			this.addSexCount(10);
			this.addOrgasm(38);
			this.addSexFriend(1);//セフレが増えた
			break;
		case 167://売春：神父
			this.addExperPeople(1);
			this.addSexCount(1);
			this.addOrgasm(2);
			break;
		case 169://売春：マサオとヨシコ
			this.addExperPeople(1);
			this.addSexCount(6);
			this.addOrgasm(6);
			break;
		case 173://売春：鎧マニア
			this.addExperPeople(1);
			this.addSexCount(3);
			this.addOrgasm(12);
			break;
		case 175://売春：賢者ペネロ
			this.addExperPeople(1);
			this.addSexCount(1);
			this.addOrgasm(11);
			break;
		case 177://温泉ソープ
			this.addExperPeople(4);
			this.addSexCount(2);
			this.addOrgasm(4);
			break;
		case 179://多忙な酒場店主
			this.addExperPeople(1);
			this.addSexCount(1);
			this.addOrgasm(1);
			break;
		case 181://ピエロとの勝負
			this.addSexCount(1);
			this.addOrgasm(2);
			break;
		case 183://釣り人との勝負
			this.addExperPeople(1);
			this.addSexCount(1);
			this.addOrgasm(2);
			break;
		case 185://売春：下着マニア
			this.addExperPeople(1);
			this.addSexCount(5);
			this.addOrgasm(11);
			break;
		case 187://売春：パパタ
			this.addExperPeople(1);
			this.addSexCount(1);
			this.addOrgasm(1);
			break;
		case 189://売春：困り顔の男
			this.addExperPeople(1);
			this.addSexCount(1);
			this.addOrgasm(1);
			break;
		case 191://売春：農民
			this.addSexCount(18);
			this.addOrgasm(45);
			break;
		case 193://売春：不良
			this.addExperPeople(2);
			this.addSexCount(10);
			this.addOrgasm(18);
			break;
		case 195://売春：村長
			this.addExperPeople(1);
			this.addSexCount(3);
			this.addOrgasm(25);
			break;
		};
	};
	
	//初めての相手
	Game_Interpreter.prototype.setFirstEro = function (eventID){
		var varID = 15;
		if($gameVariables.value(varID) <= 0){
			$gameVariables._data[varID] = eventID;
		}
	};
	//経験人数 加算
	Game_Interpreter.prototype.addExperPeople = function (add){
		this.addEroStatus(16,add);
	};
	//中出し回数 加算
	Game_Interpreter.prototype.addSexCount = function (add){
		this.addEroStatus(17,add);
	};
	//絶頂回数
	Game_Interpreter.prototype.addOrgasm = function (add){
		this.addEroStatus(18,add);
	};
	//セフレの人数
	Game_Interpreter.prototype.addSexFriend = function (add){
		this.addEroStatus(19,add);	
	};

	Game_Interpreter.prototype.addEroStatus = function (varID,add){
		if(add == undefined){
			add = 1;
		}
		$gameVariables._data[varID] += add;
	};
	
	
//*****プラグインコマンドの定義
	var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
	Game_Interpreter.prototype.pluginCommand = function(command, args) {
		_Game_Interpreter_pluginCommand.call(this, command, args);
		switch (command) {
		case 'EndRecollect':		  	
			$gameSwitches._data[3] = false;//イベント実行フラグ
			$gameSwitches._data[recorectCGModeFlgID] = false;
			$gameScreen.erasePicture(100);//コピーライト表示消去
			$gamePlayer.setTransparent(true);
			SceneManager.goto(Scene_Recollection);
			//$gameScreen.startFadeIn(1);
			break;
		case 'OpenRecollect':		  
			SceneManager.push(Scene_Recollection);
			break;
			
		case 'UpdateEroStatus':	//エロステータスの更新
			this.UpdateEroStatus($gameVariables.value(Number(args[0])));
			break;
		}
	};
	
})();