/*:
 * @target MZ
 * @plugindesc マップの色調を変更するヤツ、このスクリプトの配列にマップid入れてね
 * @author
 */
(function () {
	Scene_Map.prototype.start = function () {
		Scene_Message.prototype.start.call(this);
		SceneManager.clearStack();
		if (this._transfer) {
			this.fadeInForTransfer();
			this.onTransferEnd();
		} else if (this.needsFadeIn()) {
			this.startFadeIn(this.fadeSpeed(), false);
		}
		this.menuCalling = false;

		//mapIdなど定義部分
		//夜効果
		var Night = [34, 58, 76, 144];
		var NightRoom = [35, 36, 37, 38, 39, 40, 41, 42, 43, 258];

		var NightEff = Night.indexOf($gameMap._mapId);
		var NightRoomEff = NightRoom.indexOf($gameMap._mapId);
		//色調などの定義
		if (NightEff !== -1) {
			$gameScreen.startTint([-68, -68, 0, 68], 0);
		} else if (NightRoomEff !== -1) {
			$gameScreen.startTint([-100, -100, 0, 0], 0);
		} else {
			$gameScreen.clearTone();
		}
	};

	Game_Screen.prototype.startTint = function (tone, duration) {
		//mapIdなど定義部分
		var Night = [34, 58, 76, 144]; //夜効果
		var NightRoom = [35, 36, 37, 38, 39, 40, 41, 42, 43]; //消灯効果

		var NightEff = Night.indexOf($gameMap._mapId);
		var NightRoomEff = NightRoom.indexOf($gameMap._mapId);

		var toneFlag = false;

		if (tone[0] == 0 && tone[1] == 0 && tone[2] == 0 && tone[3] == 0) {
			if (NightEff !== -1) {
				this._toneTarget = [-68, -68, 0, 68];
				toneFlag = true;
			} else if (NightRoomEff !== -1) {
				this._toneTarget = [-100, -100, 0, 0];
				toneFlag = true;
			}
		}
		if (!toneFlag) {
			this._toneTarget = tone.clone();
		}
		this._toneDuration = duration;
		if (this._toneDuration === 0) {
			this._tone = this._toneTarget.clone();
		}
	};
})();
