code:
var Remtairy = Remtairy || {};
Remtairy.Liquids = Remtairy.Liquids || {};

const LIQUID_PUSSY_WET_REQ = 25;

//=============================================================================
 /*:
 * @plugindesc Liquids
 * @author Remtairy
 *
 * @help
 * This is a private plugin.
 * Do not redistribute, use, or modify this plugin
 * without explicit written permission from Remtairy.
 *
 */
//=============================================================================

////////
// Tachie
///////////////

Game_Actor.prototype.getTachieWetId = function() {
	let maxId = this._maxTachieWetId;
	if(maxId == 0) return false;
	let liquid = this._liquidPussyJuice;
	let id = 0;
	if(liquid >= 200) {
		id = 3;
	}
	else if(liquid >= 80) {
		id = 2;
	}
	else if(liquid >= LIQUID_PUSSY_WET_REQ) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenWetExtension) id = '' + this._tachieSemenWetExtension + id;
	return id;
};

Game_Actor.prototype.getTachieWetPantiesId = function() {
	let maxId = this._maxTachieWetPantiesId;
	if(maxId == 0) return false;
	let liquid = this._liquidPussyJuice;
	var id = 0;
	if(liquid >= 200) {
		id = 3;
	}
	else if(liquid >= 80) {
		id = 2;
	}
	else if(liquid >= LIQUID_PUSSY_WET_REQ) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);

	return id;
};

Game_Actor.prototype.getTachieSemenRightArmId = function() {
	let maxId = this._maxTachieSemenRightArmId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeRightArm;
	if(liquid >= 35) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenRightArmExtension) id = '' + this._tachieSemenRightArmExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenLeftArmId = function() {
	let maxId = this._maxTachieSemenLeftArmId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeLeftArm;
	if(liquid >= 35) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenLeftArmExtension) id = '' + this._tachieSemenLeftArmExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenRightLegId = function() {
	let maxId = this._maxTachieSemenRightLegId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeRightLeg;
	if(liquid >= 35) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};
Game_Actor.prototype.getTachieSemenLeftLegId = function() {
	let maxId = this._maxTachieSemenLeftLegId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeLeftLeg;
	if(liquid >= 35) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};

Game_Actor.prototype.getTachieSemenBellyId = function() {
	let maxId = this._maxTachieSemenBellyId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeBoobs;
	if(liquid >= 85) {
		id = 3;
	}
	else if(liquid >= 55) {
		id = 2;
	}
	else if(liquid >= 18) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenBellyExtension) id = '' + this._tachieSemenBellyExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenBoobsId = function() {
	let maxId = this._maxTachieSemenBoobsId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeBoobs;
	if(liquid >= 70) {
		id = 3;
	}
	else if(liquid >= 30) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenBoobsExtension) id = '' + this._tachieSemenBoobsExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenRightBoobId = function() {
	let maxId = this._maxTachieSemenRightBoobId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeBoobs;
	if(liquid >= 70)
		id = 3;
	else if(liquid >= 30)
		id = 2;
	else if(liquid >= 1)
		id = 1;
	else return false;
	id = Math.min(id, maxId);
	if(this._hasTachieSemenRightBoobExtension) id = '' + this._tachieSemenRightBoobExtension + id;
	return id;
};
Game_Actor.prototype.getTachieSemenLeftBoobId = function() {
	let maxId = this._maxTachieSemenLeftBoobId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeBoobs;
	if(liquid >= 70)
		id = 3;
	else if(liquid >= 30)
		id = 2;
	else if(liquid >= 1)
		id = 1;
	else return false;
	id = Math.min(id, maxId);
	if(this._hasTachieSemenLeftBoobExtension) id = '' + this._tachieSemenLeftBoobExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenButtId = function() {
	let maxId = this._maxTachieSemenButtId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeButt;
	if(liquid >= 90) {
		id = 3;
	}
	else if(liquid >= 45) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenButtExtension) id = '' + this._tachieSemenButtExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenButtTopRightId = function() {
	let maxId = this._maxTachieSemenButtTopRightId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeButtTopRight;
	if(liquid >= 90) {
		id = 3;
	}
	else if(liquid >= 45) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};
Game_Actor.prototype.getTachieSemenButtBottomRightId = function() {
	let maxId = this._maxTachieSemenButtBottomRightId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeButtBottomRight;
	if(liquid >= 90) {
		id = 3;
	}
	else if(liquid >= 45) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};
Game_Actor.prototype.getTachieSemenButtTopLeftId = function() {
	let maxId = this._maxTachieSemenButtTopLeftId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeButtTopLeft;
	if(liquid >= 90) {
		id = 3;
	}
	else if(liquid >= 45) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};
Game_Actor.prototype.getTachieSemenButtBottomLeftId = function() {
	let maxId = this._maxTachieSemenButtBottomLeftId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeButtBottomLeft;
	if(liquid >= 90) {
		id = 3;
	}
	else if(liquid >= 45) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};

Game_Actor.prototype.getTachieSemenBackId = function() {
	let maxId = this._maxTachieSemenBackId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeButt;
	if(liquid >= 70) {
		id = 3;
	}
	else if(liquid >= 30) {
		id = 2;
	}
	else if(liquid >= 8) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenBackExtension) id = '' + this._tachieSemenBackExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenDeskId = function() {
	let maxId = this._maxTachieSemenDeskId;
	if(maxId == 0) return false;
	let liquid = this._liquidOnDesk;
	if(liquid >= 50) {
		id = 3;
	}
	else if(liquid >= 20) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};

Game_Actor.prototype.getTachieSemenFaceId = function() {
	let maxId = this._maxTachieSemenFaceId;
	if(maxId == 0) return false;
	let liquid = this._liquidBukkakeFace;
	if(liquid >= 60) {
		id = 3;
	}
	else if(liquid >= 25) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenFaceExtension) id = '' + this._tachieSemenFaceExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenMouthId = function() {
	let maxId = this._maxTachieSemenMouthId;
	if(maxId == 0) return false;
	let liquid = this._liquidSwallow;
	if(liquid >= 60) {
		id = 3;
	}
	else if(liquid >= 25) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenMouthExtension) id = '' + this._tachieSemenMouthExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenCockMouthId = function() {
	let maxId = this._maxTachieSemenCockMouthId;
	if(maxId == 0) return false;
	if(!this._cockMouthTarget) return false;
	let liquid = this._cockMouthTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenCockMouthExtension) id = '' + this._tachieSemenCockMouthExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenCockBoobsId = function() {
	let maxId = this._maxTachieSemenCockBoobsId;
	if(maxId == 0) return false;
	if(!this._cockBoobsTarget) return false;
	let liquid = this._cockBoobsTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};

Game_Actor.prototype.getTachieSemenCockRightArmId = function() {
	let maxId = this._maxTachieSemenCockRightArmId;
	if(maxId == 0) return false;
	if(!this._cockRightArmTarget) return false;
	let liquid = this._cockRightArmTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenCockRightArmExtension) id = '' + this._tachieSemenCockRightArmExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenCockLeftArmId = function() {
	let maxId = this._maxTachieSemenCockLeftArmId;
	if(maxId == 0) return false;
	if(!this._cockLeftArmTarget) return false;
	let liquid = this._cockLeftArmTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenCockLeftArmExtension) id = '' + this._tachieSemenCockLeftArmExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenCockPussyId = function() {
	let maxId = this._maxTachieSemenCockPussyId;
	if(maxId == 0) return false;
	if(!this._cockPussyTarget) return false;
	let liquid = this._cockPussyTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenCockPussyExtension) id = '' + this._tachieSemenCockPussyExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenCockAnalId = function() {
	let maxId = this._maxTachieSemenCockAnalId;
	if(maxId == 0) return false;
	if(!this._cockAnalTarget) return false;
	let liquid = this._cockAnalTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenCockAnalExtension) id = '' + this._tachieSemenCockAnalExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenCockFeetId = function() {
	let maxId = this._maxTachieSemenCockFeetId;
	if(maxId == 0) return false;
	if(!this._cockFeetTarget) return false;
	let liquid = this._cockFeetTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};

Game_Actor.prototype.getTachieSemenCockNormalId = function() {
	let maxId = this._maxTachieSemenCockNormalId;
	if(maxId == 0) return false;
	if(!this._cockNormalTarget) return false;
	let liquid = this._cockNormalTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40) {
		id = 3;
	}
	else if(liquid >= 15) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenCockNormalExtension) id = '' + this._tachieSemenCockNormalExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenFrontAId = function() {
	let maxId = this._maxTachieSemenFrontAId;
	if(maxId == 0) return false;
	if(!this._cockFrontATarget) return false;
	let liquid = this._cockFrontATarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40)
		id = 3;
	else if(liquid >= 15)
		id = 2;
	else if(liquid >= 1)
		id = 1;
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenFrontAExtension) id = '' + this._tachieSemenFrontAExtension + id;
	return id;
};
Game_Actor.prototype.getTachieSemenFrontBId = function() {
	let maxId = this._maxTachieSemenFrontBId;
	if(maxId == 0) return false;
	if(!this._cockFrontBTarget) return false;
	let liquid = this._cockFrontBTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40)
		id = 3;
	else if(liquid >= 15)
		id = 2;
	else if(liquid >= 1)
		id = 1;
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenFrontBExtension) id = '' + this._tachieSemenFrontBExtension + id;
	return id;
};
Game_Actor.prototype.getTachieSemenFrontCId = function() {
	let maxId = this._maxTachieSemenFrontCId;
	if(maxId == 0) return false;
	if(!this._cockFrontCTarget) return false;
	let liquid = this._cockFrontCTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40)
		id = 3;
	else if(liquid >= 15)
		id = 2;
	else if(liquid >= 1)
		id = 1;
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenFrontCExtension) id = '' + this._tachieSemenFrontCExtension + id;
	return id;
};
Game_Actor.prototype.getTachieSemenFrontDId = function() {
	let maxId = this._maxTachieSemenFrontDId;
	if(maxId == 0) return false;
	if(!this._cockFrontDTarget) return false;
	let liquid = this._cockFrontDTarget._enemyTempRecordTotalEjaculationCount;
	if(liquid >= 40)
		id = 3;
	else if(liquid >= 15)
		id = 2;
	else if(liquid >= 1)
		id = 1;
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenFrontDExtension) id = '' + this._tachieSemenFrontDExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenCrotchPantiesId = function() {
	let maxId = this._maxTachieSemenCrotchPantiesId;
	if(maxId == 0) return false;
	let liquid = this._liquidCreampiePussy;
	if(liquid >= 75) {
		id = 3;
	}
	else if(liquid >= 30) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};
Game_Actor.prototype.getTachieSemenCrotchId = function() {
	let maxId = this._maxTachieSemenCrotchId;
	if(maxId == 0) return false;
	let liquid = this._liquidCreampiePussy;
	if(liquid >= 75) {
		id = 3;
	}
	else if(liquid >= 30) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenCrotchExtension) id = '' + this._tachieSemenCrotchExtension + id;
	return id;
};

Game_Actor.prototype.getTachieSemenAnalId = function() {
	let maxId = this._maxTachieSemenAnalId;
	if(maxId == 0) return false;
	let liquid = this._liquidCreampieAnal;
	if(liquid >= 75) {
		id = 3;
	}
	else if(liquid >= 30) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	if(this._hasTachieSemenAnalExtension) id = '' + this._tachieSemenAnalExtension + id;
	return id;
};

Game_Actor.prototype.getTachieDroolMouthId = function() {
	let maxId = this._maxTachieDroolMouthId;
	if(maxId == 0) return false;
	let liquid = this._liquidDroolMouth;
	if(liquid >= 15) {
		id = 3;
	}
	else if(liquid >= 7) {
		id = 2;
	}
	else if(liquid >= 3) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};
Game_Actor.prototype.getTachieDroolFingersId = function() {
	let maxId = this._maxTachieDroolFingersId;
	if(maxId == 0) return false;
	let liquid = this._liquidDroolFingers;
	if(liquid >= 7) {
		id = 3;
	}
	else if(liquid >= 4) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};
Game_Actor.prototype.getTachieDroolNipplesId = function() {
	let maxId = this._maxTachieDroolNipplesId;
	if(maxId == 0) return false;
	let liquid = this._liquidDroolNipples;
	if(liquid >= 7) {
		id = 3;
	}
	else if(liquid >= 4) {
		id = 2;
	}
	else if(liquid >= 1) {
		id = 1;
	}
	else return false;

	id = Math.min(id, maxId);
	return id;
};

Game_Actor.prototype.setMaxTachieSemenBackId = function(value) { this._maxTachieSemenBackId = value; };
Game_Actor.prototype.setMaxTachieSemenDeskId = function(value) { this._maxTachieSemenDeskId = value; };
Game_Actor.prototype.setMaxTachieSemenBellyId = function(value) { this._maxTachieSemenBellyId = value; };
Game_Actor.prototype.setMaxTachieSemenBoobsId = function(value) { this._maxTachieSemenBoobsId = value; };
Game_Actor.prototype.setMaxTachieSemenLeftBoobId = function(value) { this._maxTachieSemenLeftBoobId = value; };
Game_Actor.prototype.setMaxTachieSemenRightBoobId = function(value) { this._maxTachieSemenRightBoobId = value; };
Game_Actor.prototype.setMaxTachieSemenButtId = function(value) { this._maxTachieSemenButtId = value; };
Game_Actor.prototype.setMaxTachieSemenButtTopRightId = function(value) { this._maxTachieSemenButtTopRightId = value; };
Game_Actor.prototype.setMaxTachieSemenButtBottomRightId = function(value) { this._maxTachieSemenButtBottomRightId = value; };
Game_Actor.prototype.setMaxTachieSemenButtTopLeftId = function(value) { this._maxTachieSemenButtTopLeftId = value; };
Game_Actor.prototype.setMaxTachieSemenButtBottomLeftId = function(value) { this._maxTachieSemenButtBottomLeftId = value; };
Game_Actor.prototype.setMaxTachieSemenAnalId = function(value) { this._maxTachieSemenAnalId = value; };
Game_Actor.prototype.setMaxTachieSemenCrotchId = function(value) { this._maxTachieSemenCrotchId = value; };
Game_Actor.prototype.setMaxTachieSemenCrotchPantiesId = function(value) { this._maxTachieSemenCrotchPantiesId = value; };
Game_Actor.prototype.setMaxTachieSemenFaceId = function(value) { this._maxTachieSemenFaceId = value; };
Game_Actor.prototype.setMaxTachieSemenMouthId = function(value) { this._maxTachieSemenMouthId = value; };
Game_Actor.prototype.setMaxTachieSemenLeftArmId = function(value) { this._maxTachieSemenLeftArmId = value; };
Game_Actor.prototype.setMaxTachieSemenRightArmId = function(value) { this._maxTachieSemenRightArmId = value; };
Game_Actor.prototype.setMaxTachieSemenLeftLegId = function(value) { this._maxTachieSemenLeftLegId = value; };
Game_Actor.prototype.setMaxTachieSemenRightLegId = function(value) { this._maxTachieSemenRightLegId = value; };
Game_Actor.prototype.setMaxTachieWetId = function(value) { this._maxTachieWetId = value; };
Game_Actor.prototype.setMaxTachieWetPantiesId = function(value) { this._maxTachieWetPantiesId = value; };

Game_Actor.prototype.setMaxTachieDroolMouthId = function(value) { this._maxTachieDroolMouthId = value; };
Game_Actor.prototype.setMaxTachieDroolFingersId = function(value) { this._maxTachieDroolFingersId = value; };
Game_Actor.prototype.setMaxTachieDroolNipplesId = function(value) { this._maxTachieDroolNipplesId = value; };

Game_Actor.prototype.setMaxTachieSemenCockMouthId = function(value) { this._maxTachieSemenCockMouthId = value; };
Game_Actor.prototype.setMaxTachieSemenCockBoobsId = function(value) { this._maxTachieSemenCockBoobsId = value; };
Game_Actor.prototype.setMaxTachieSemenCockRightArmId = function(value) { this._maxTachieSemenCockRightArmId = value; };
Game_Actor.prototype.setMaxTachieSemenCockLeftArmId = function(value) { this._maxTachieSemenCockLeftArmId = value; };
Game_Actor.prototype.setMaxTachieSemenCockPussyId = function(value) { this._maxTachieSemenCockPussyId = value; };
Game_Actor.prototype.setMaxTachieSemenCockAnalId = function(value) { this._maxTachieSemenCockAnalId = value; };
Game_Actor.prototype.setMaxTachieSemenCockFeetId = function(value) { this._maxTachieSemenCockFeetId = value; };
Game_Actor.prototype.setMaxTachieSemenCockNormalId = function(value) { this._maxTachieSemenCockNormalId = value; };

Game_Actor.prototype.setMaxTachieSemenFrontAId = function(value) { this._maxTachieSemenFrontAId = value; };
Game_Actor.prototype.setMaxTachieSemenFrontBId = function(value) { this._maxTachieSemenFrontBId = value; };
Game_Actor.prototype.setMaxTachieSemenFrontCId = function(value) { this._maxTachieSemenFrontCId = value; };
Game_Actor.prototype.setMaxTachieSemenFrontDId = function(value) { this._maxTachieSemenFrontDId = value; };

Game_Actor.prototype.setTachieSemenAnalExtension = function(value) {
	this._tachieSemenAnalExtension = value;
	this._hasTachieSemenAnalExtension = true;
};
Game_Actor.prototype.resetTachieSemenAnalExtension = function(value) { this._hasTachieSemenAnalExtension = false; };

Game_Actor.prototype.setTachieSemenBackExtension = function(value) {
	this._tachieSemenBackExtension = value;
	this._hasTachieSemenBackExtension = true;
};
Game_Actor.prototype.resetTachieSemenBackExtension = function(value) { this._hasTachieSemenBackExtension = false; };

Game_Actor.prototype.setTachieSemenBellyExtension = function(value) {
	this._tachieSemenBellyExtension = value;
	this._hasTachieSemenBellyExtension = true;
};
Game_Actor.prototype.resetTachieSemenBellyExtension = function(value) { this._hasTachieSemenBellyExtension = false; };

Game_Actor.prototype.setTachieSemenButtExtension = function(value) {
	this._tachieSemenButtExtension = value;
	this._hasTachieSemenButtExtension = true;
};
Game_Actor.prototype.resetTachieSemenButtExtension = function(value) { this._hasTachieSemenButtExtension = false; };

Game_Actor.prototype.setTachieSemenBoobsExtension = function(value) {
	this._tachieSemenBoobsExtension = value;
	this._hasTachieSemenBoobsExtension = true;
};
Game_Actor.prototype.resetTachieSemenBoobsExtension = function(value) { this._hasTachieSemenBoobsExtension = false; };

Game_Actor.prototype.setTachieSemenLeftBoobExtension = function(value) {
	this._tachieSemenLeftBoobExtension = value;
	this._hasTachieSemenLeftBoobExtension = true;
};
Game_Actor.prototype.resetTachieSemenLeftBoobExtension = function(value) { this._hasTachieSemenLeftBoobExtension = false; };

Game_Actor.prototype.setTachieSemenRightBoobExtension = function(value) {
	this._tachieSemenRightBoobExtension = value;
	this._hasTachieSemenRightBoobExtension = true;
};
Game_Actor.prototype.resetTachieSemenRightBoobExtension = function(value) { this._hasTachieSemenRightBoobExtension = false; };

Game_Actor.prototype.setTachieSemenCrotchExtension = function(value) {
	this._tachieSemenCrotchExtension = value;
	this._hasTachieSemenCrotchExtension = true;
};
Game_Actor.prototype.resetTachieSemenCrotchExtension = function(value) { this._hasTachieSemenCrotchExtension = false; };

Game_Actor.prototype.setTachieSemenFaceExtension = function(value) {
	this._tachieSemenFaceExtension = value;
	this._hasTachieSemenFaceExtension = true;
};
Game_Actor.prototype.resetTachieSemenFaceExtension = function(value) { this._hasTachieSemenFaceExtension = false; };

Game_Actor.prototype.setTachieSemenMouthExtension = function(value) {
	this._tachieSemenMouthExtension = value;
	this._hasTachieSemenMouthExtension = true;
};
Game_Actor.prototype.resetTachieSemenMouthExtension = function(value) { this._hasTachieSemenMouthExtension = false; };

Game_Actor.prototype.setTachieSemenLeftArmExtension = function(value) {
	this._tachieSemenLeftArmExtension = value;
	this._hasTachieSemenLeftArmExtension = true;
};
Game_Actor.prototype.resetTachieSemenLeftArmExtension = function(value) { this._hasTachieSemenLeftArmExtension = false; };

Game_Actor.prototype.setTachieSemenCockLeftArmExtension = function(value) {
	this._tachieSemenCockLeftArmExtension = value;
	this._hasTachieSemenCockLeftArmExtension = true;
};
Game_Actor.prototype.resetTachieSemenCockLeftArmExtension = function(value) { this._hasTachieSemenCockLeftArmExtension = false; };

Game_Actor.prototype.setTachieSemenRightArmExtension = function(value) {
	this._tachieSemenRightArmExtension = value;
	this._hasTachieSemenRightArmExtension = true;
};
Game_Actor.prototype.resetTachieSemenRightArmExtension = function(value) { this._hasTachieSemenRightArmExtension = false; };

Game_Actor.prototype.setTachieSemenCockRightArmExtension = function(value) {
	this._tachieSemenCockRightArmExtension = value;
	this._hasTachieSemenCockRightArmExtension = true;
};
Game_Actor.prototype.resetTachieSemenCockRightArmExtension = function(value) { this._hasTachieSemenCockRightArmExtension = false; };

Game_Actor.prototype.setTachieSemenCockMouthExtension = function(value) {
	this._tachieSemenCockMouthExtension = value;
	this._hasTachieSemenCockMouthExtension = true;
};
Game_Actor.prototype.resetTachieSemenCockMouthExtension = function(value) { this._hasTachieSemenCockMouthExtension = false; };

Game_Actor.prototype.setTachieSemenCockPussyExtension = function(value) {
	this._tachieSemenCockPussyExtension = value;
	this._hasTachieSemenCockPussyExtension = true;
};
Game_Actor.prototype.resetTachieSemenCockPussyExtension = function(value) { this._hasTachieSemenCockPussyExtension = false; };

Game_Actor.prototype.setTachieSemenCockAnalExtension = function(value) {
	this._tachieSemenCockAnalExtension = value;
	this._hasTachieSemenCockAnalExtension = true;
};
Game_Actor.prototype.resetTachieSemenCockAnalExtension = function(value) { this._hasTachieSemenCockAnalExtension = false; };

Game_Actor.prototype.setTachieSemenCockNormalExtension = function(value) {
	this._tachieSemenCockNormalExtension = value;
	this._hasTachieSemenCockNormalExtension = true;
};
Game_Actor.prototype.resetTachieSemenCockNormalExtension = function(value) { this._hasTachieSemenCockNormalExtension = false; };

Game_Actor.prototype.setTachieSemenWetExtension = function(value) {
	this._tachieSemenWetExtension = value;
	this._hasTachieSemenWetExtension = true;
};
Game_Actor.prototype.resetTachieSemenWetExtension = function(value) { this._hasTachieSemenWetExtension = false; };

Game_Actor.prototype.setTachieSemenFrontAExtension = function(value) {
	this._tachieSemenFrontAExtension = value;
	this._hasTachieSemenFrontAExtension = true;
};
Game_Actor.prototype.resetTachieSemenFrontAExtension = function(value) { this._hasTachieSemenFrontAExtension = false; };

Game_Actor.prototype.setTachieSemenFrontBExtension = function(value) {
	this._tachieSemenFrontBExtension = value;
	this._hasTachieSemenFrontBExtension = true;
};
Game_Actor.prototype.resetTachieSemenFrontBExtension = function(value) { this._hasTachieSemenFrontBExtension = false; };

Game_Actor.prototype.setTachieSemenFrontCExtension = function(value) {
	this._tachieSemenFrontCExtension = value;
	this._hasTachieSemenFrontCExtension = true;
};
Game_Actor.prototype.resetTachieSemenFrontCExtension = function(value) { this._hasTachieSemenFrontCExtension = false; };

Game_Actor.prototype.setTachieSemenFrontDExtension = function(value) {
	this._tachieSemenFrontDExtension = value;
	this._hasTachieSemenFrontDExtension = true;
};
Game_Actor.prototype.resetTachieSemenFrontDExtension = function(value) { this._hasTachieSemenFrontDExtension = false; };

Game_Actor.prototype.setTachieSemenFrontEExtension = function(value) {
	this._tachieSemenFrontEExtension = value;
	this._hasTachieSemenFrontEExtension = true;
};
Game_Actor.prototype.resetTachieSemenFrontEExtension = function(value) { this._hasTachieSemenFrontEExtension = false; };

///////////
// Semen
////////////

Game_Actor.prototype.cleanUpLiquids = function() {
	this._liquidPussyJuice = 0;
	this._liquidSwallow = 0;
	this._liquidCreampiePussy = 0;
	this._liquidCreampieAnal = 0;
	this._liquidBukkakeFace = 0;
	this._liquidBukkakeBoobs = 0;
	this._liquidBukkakeButt = 0;
	this._liquidBukkakeButtTopRight = 0;
	this._liquidBukkakeButtTopLeft = 0;
	this._liquidBukkakeButtBottomRight = 0;
	this._liquidBukkakeButtBottomLeft = 0;
	this._liquidBukkakeLeftArm = 0;
	this._liquidBukkakeRightArm = 0;
	this._liquidBukkakeLeftLeg = 0;
	this._liquidBukkakeRightLeg = 0;
	this._liquidDroolMouth = 0;
	this._liquidDroolFingers = 0;
	this._liquidDroolNipples = 0;
	this._liquidOnDesk = 0;
	this.setCacheChanged();
};

Game_Actor.prototype.increaseLiquidPussyJuice = function(liquid) {
	this._liquidPussyJuice += liquid;
};

Game_Actor.prototype.increaseLiquidDroolMouth = function(liquid) {
	this._liquidDroolMouth += liquid;
};
Game_Actor.prototype.increaseLiquidDroolFingers = function(liquid) {
	this._liquidDroolFingers += liquid;
};
Game_Actor.prototype.increaseLiquidDroolNipples = function(liquid) {
	this._liquidDroolNipples += liquid;
};

Game_Actor.prototype.increaseLiquidSwallow = function(semen) {
	this._liquidSwallow += semen;
};
Game_Actor.prototype.increaseLiquidCreampiePussy = function(semen) {
	this._liquidCreampiePussy += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidCreampieAnal = function(semen) {
	this._liquidCreampieAnal += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidBukkakeFace = function(semen) {
	this._liquidBukkakeFace += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidBukkakeBoobs = function(semen) {
	this._liquidBukkakeBoobs += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidBukkakeButt = function(semen) {
	this._liquidBukkakeButt += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidBukkakeButtTopRight = function(semen) {
	this._liquidBukkakeButtTopRight += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidBukkakeButtTopLeft = function(semen) {
	this._liquidBukkakeButtTopLeft += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidBukkakeButtBottomRight = function(semen) {
	this._liquidBukkakeButtBottomRight += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidBukkakeButtBottomLeft = function(semen) {
	this._liquidBukkakeButtBottomLeft += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidBukkakeRightArm = function(semen) {
	this._liquidBukkakeRightArm += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidBukkakeLeftArm = function(semen) {
	this._liquidBukkakeLeftArm += semen;
	//this.setCacheChanged();
};

Game_Actor.prototype.increaseLiquidBukkakeRightLeg = function(semen) {
	this._liquidBukkakeRightLeg += semen;
	//this.setCacheChanged();
};
Game_Actor.prototype.increaseLiquidBukkakeLeftLeg = function(semen) {
	this._liquidBukkakeLeftLeg += semen;
	//this.setCacheChanged();
};

Game_Actor.prototype.increaseLiquidOnDesk = function(semen) {
	this._liquidOnDesk += semen;
	//this.setCacheChanged();
};

Game_Actor.prototype.getCurrentBukkakeTotal = function() {
	let total = this._liquidBukkakeFace + this._liquidBukkakeBoobs + this._liquidBukkakeLeftArm + this._liquidBukkakeRightArm + this._liquidBukkakeLeftLeg + this._liquidBukkakeRightLeg + this._liquidBukkakeButt;

	if(this.isInDefeatedLevel2Pose()) {
		total += this._liquidBukkakeButtTopRight + this._liquidBukkakeButtTopLeft + this._liquidBukkakeButtBottomRight + this._liquidBukkakeButtBottomLeft;
	}

	return total;
};

///////////
// Pussy Juice
///////////////

Game_Actor.prototype.setUpPussyJuice = function() {
	if(!DEBUG_MODE) return;
	if(this.reachedOrgasmPoint()) {
		this.increaseLiquidPussyJuice(this.passivePussyJuiceDrip() * 3);
	}
	else if(this.isAroused()) {
		this.increaseLiquidPussyJuice(this.passivePussyJuiceDrip());
	}
};

Game_Actor.prototype.regenPussyJuice = function() {
	if(this.isAroused() && DEBUG_MODE) {
		let drip = this.passivePussyJuiceDrip();
		if(!this.isWet && this.isHorny) drip *= 2;
		this.increaseLiquidPussyJuice(drip);
		this.addToActorPussyDripRecord(drip);
	}
};

repo_name: Rexhunk/karryn

license: unknown


code:
var Remtairy = Remtairy || {};
Remtairy.Map = Remtairy.Map || {};

////////////
// Map BGM
///////////

//EB / Outside BGM
const MAP_EB_BGM_NAME = 'Field1';
const MAP_EB_BGM_VOLUME = 80;

//Karryn's Office & Guard Quarters BGM
const MAP_OFFICE_BGM_NAME = 'S_Prologue1';
const MAP_OFFICE_BGM_VOLUME = 80;

//Mess Hall
const MAP_MESS_HALL_BGM_NAME = 'Prison_Others1';
const MAP_MESS_HALL_BGM_VOLUME = 90;

//Yard
const MAP_YARD_BGM_NAME = 'Prison_Others1';
const MAP_YARD_BGM_VOLUME = 50;

//Infirmary
const MAP_INFIRMARY_BGM_NAME = 'S_Prologue1';
const MAP_INFIRMARY_BGM_VOLUME = 80;

//Level 1 is Anarchy BGM
const MAP_LEVEL_ONE_ANARCHY_BGM_NAME = 'Prison_Anarchy1';
const MAP_LEVEL_ONE_ANARCHY_BGM_VOLUME = 80;

//Level 1 is Subjugated BGM
const MAP_LEVEL_ONE_SUBJUGATED_BGM_NAME = 'Prison_Subjugated1';
const MAP_LEVEL_ONE_SUBJUGATED_BGM_VOLUME = 80;

//Level 1 is Rioting BGM
const MAP_LEVEL_ONE_RIOTING_BGM_NAME = 'Prison_Riot1';
const MAP_LEVEL_ONE_RIOTING_BGM_VOLUME = 80;

//Level 2 is Anarchy BGM
const MAP_LEVEL_TWO_ANARCHY_BGM_NAME = 'Prison_Anarchy2';
const MAP_LEVEL_TWO_ANARCHY_BGM_VOLUME = 80;

//Level 2 is Subjugated BGM
const MAP_LEVEL_TWO_SUBJUGATED_BGM_NAME = 'Prison_Subjugated1';
const MAP_LEVEL_TWO_SUBJUGATED_BGM_VOLUME = 80;

//Level 2 is Rioting BGM
const MAP_LEVEL_TWO_RIOTING_BGM_NAME = 'Prison_Riot1';
const MAP_LEVEL_TWO_RIOTING_BGM_VOLUME = 80;

//Level 2
const MAP_LEVEL_TWO_STORE_BGM_NAME = 'Prison_Others1';
const MAP_LEVEL_TWO_STORE_BGM_VOLUME = 90;

//Level 3 is Anarchy BGM
const MAP_LEVEL_THREE_ANARCHY_BGM_NAME = 'Prison_Anarchy3';
const MAP_LEVEL_THREE_ANARCHY_BGM_VOLUME = 75;

//Level 3 is Subjugated BGM
const MAP_LEVEL_THREE_SUBJUGATED_BGM_NAME = 'Prison_Subjugated1';
const MAP_LEVEL_THREE_SUBJUGATED_BGM_VOLUME = 80;

//Level 3 is Rioting BGM
const MAP_LEVEL_THREE_RIOTING_BGM_NAME = 'Prison_Riot1';
const MAP_LEVEL_THREE_RIOTING_BGM_VOLUME = 80;

//Bar BGM
const MAP_BAR_BGM_NAME = 'Bar1';
const MAP_BAR_BGM_VOLUME = 75;

//Map Borders
const MAP_LOWER_BORDERS_NORMAL = "MapBorders_Normal";
const MAP_LOWER_BORDERS_CHAT = "MapBorders_Chat";
const MAP_BORDERS_UPPER = "MapBorders_Upper";

//Map Backgrounds
const MAP_BORDER_BACKGROUND_DEFAULT = "MapBorders_Bg";
const MAP_BORDER_BACKGROUND_OUTSIDE = "MapBorders_Bg_Outside";
const MAP_BORDER_BACKGROUND_BAR = "MapBorders_Bg_Bar";
const MAP_BORDER_BACKGROUND_EB = "MapBorders_Bg_Eb";
const MAP_BORDER_BACKGROUND_BASEMENT1 = "MapBorders_Bg_Basement1";

//Map Chat
const MAP_CHAT_TEXT_WINDOW_X = 0;
const MAP_CHAT_TEXT_WINDOW_Y = 660;
const MAP_CHAT_TEXT_WINDOW_WIDTH = 1010;
const MAP_CHAT_TEXT_WINDOW_FONT_SIZE = 28;
const MAP_CHAT_TEXT_WINDOW_LINES = 3;
const MAP_CHAT_TEXT_WINDOW_HEIGHT_PADDING = 20;

const MAP_CHAT_TEXT_TRANSPARENT_WINDOW_HEIGHT_PADDING = 40;

const MAP_NAME_WINDOW_FONT_SIZE = 26;
const MAP_NAME_WINDOW_FONT_HEIGHT_PADDING = -4;
const MAP_NAME_WINDOW_FONT_WIDTH_PADDING = 10;

//Autosave
const MAP_AUTOSAVE_X = 1150;
const MAP_AUTOSAVE_Y = 765;
const MAP_AUTOSAVE_ICON_ID = 282;

const MAP_INFO_DAY_NUMBERS = "MapBorders_DayNumbers";
const MAP_INFO_DAY_X = 65;
const MAP_INFO_DAY_Y = 721;

const MAP_INFO_STAT_NUMBERS = "MapBorders_OrderNumbers"; //obsolete
const MAP_INFO_ORDER_X = 552; //obsolete
const MAP_INFO_ORDER_Y = 781; //obsolete
const MAP_INFO_CONTROL_X = 677; //obsolete
const MAP_INFO_CONTROL_Y = 781; //obsolete
const MAP_INFO_FATIGUE_X = 802; //obsolete
const MAP_INFO_FATIGUE_Y = 781; //obsolete
const MAP_INFO_PLEASURE_X = 927; //obsolete
const MAP_INFO_PLEASURE_Y = 781; //obsolete

const MAP_INFO_CONTROL_SYMBOL_FONT_SIZE = 18; //obsolete
const MAP_INFO_CONTROL_SYMBOL_X = 648; //obsolete
const MAP_INFO_CONTROL_SYMBOL_Y = 744; //obsolete
const MAP_INFO_SYMBOL_PERCENT_FONT_SIZE = 12; //obsolete
const MAP_INFO_FATIGUE_PERCENT_X = 796.5; //obsolete
const MAP_INFO_FATIGUE_PERCENT_Y = 745; //obsolete
const MAP_INFO_PLEASURE_PERCENT_X = 920.5; //obsolete
const MAP_INFO_PLEASURE_PERCENT_Y = 745; //obsolete

const MAP_INFO_BOTTOM_NUMBER_FONT_SIZE = 15;
const MAP_INFO_BOTTOM_NUMBER_Y = 745;
const MAP_INFO_BOTTOM_ORDER_X = 523;
const MAP_INFO_CONTROL_ORDER_X = 649;
const MAP_INFO_FATIGUE_ORDER_X = 777;
const MAP_INFO_PLEASURE_ORDER_X = 902;

const MAP_INFO_MAP_NAME_FONT_SIZE = 30;
const MAP_INFO_MAP_NAME_WIDTH = 700;
const MAP_INFO_MAP_NAME_X = 130;
const MAP_INFO_MAP_NAME_Y = -18;

const MAP_INFO_LEVEL_FONT_SIZE = 22;
const MAP_INFO_LEVEL_WIDTH = 150;
const MAP_INFO_LEVEL_1_X = 270;
const MAP_INFO_LEVEL_1_Y = 637;
const MAP_INFO_LEVEL_2_X = 275;
const MAP_INFO_LEVEL_2_Y = 664;
const MAP_INFO_LEVEL_3_X = 280;
const MAP_INFO_LEVEL_3_Y = 691;
const MAP_INFO_LEVEL_4_X = 285;
const MAP_INFO_LEVEL_4_Y = 718;
const MAP_INFO_LEVEL_5_X = 295;
const MAP_INFO_LEVEL_5_Y = 745;

const MAP_INFO_Y_CONSTANT = 30;

//=============================================================================
 /*:
 * @plugindesc Map
 * @author Remtairy
 *
 * @help
 * This is a private plugin.
 * Do not redistribute, use, or modify this plugin
 * without explicit written permission from Remtairy.
 *
 */
//=============================================================================

const MAP_ID_TESTING = 1;
const MAP_ID_MODE_SELECT = 35;

const MAP_ID_OUTSIDE = 17;
const MAP_ID_YARD = 24;

const MAP_ID_KARRYN_OFFICE = 21;
const MAP_ID_EB_HALLWAY = 18;
const MAP_ID_EB_MESS_HALL = 22;
const MAP_ID_EB_INFIRMARY = 23;
const MAP_ID_EB_GUARD_QUARTERS = 20;

const MAP_ID_VISITOR_CENTER = 4;
const MAP_ID_VISITOR_CENTER_BROKEN = 29;
const MAP_ID_VISITOR_ROOM = 6;
const MAP_ID_VISITOR_ROOM_BROKEN = 30;
const MAP_ID_LVL1_STAIRS_TO_LVL3 = 12;
const MAP_ID_LVL1_STAIRS_TO_LVL2 = 5;
const MAP_ID_BAR = 7;
const MAP_ID_BAR_BROKEN = 31;
const MAP_ID_BAR_STORAGE = 8;
const MAP_ID_LVL1_HALLWAY = 15;
const MAP_ID_WORKSHOP = 10;
const MAP_ID_LVL1_GUARD_STATION = 9;
const MAP_ID_DISH_WASHING = 11;
const MAP_ID_RECEPTION = 13;
const MAP_ID_LAUNDRY = 14;

const MAP_ID_LVL2_STAIRS_TO_LVL1 = 38;
const MAP_ID_LVL2_GUARD_STATION = 45;
const MAP_ID_LVL2_HALLWAY_FLOODED = 39;
const MAP_ID_LVL2_HALLWAY = 52;
const MAP_ID_STORE_FIXED = 40;
const MAP_ID_STORE_BROKEN = 49;
const MAP_ID_READING_ROOM = 41;
const MAP_ID_CLASSROOM = 42;
const MAP_ID_BATHROOM_BROKEN = 50;
const MAP_ID_BATHROOM_FIXED = 43;
const MAP_ID_STAFF_LOUNGE = 44;
const MAP_ID_RESEARCH = 46;
const MAP_ID_MEETING_ROOM = 47;
const MAP_ID_OFFICE_FIXED = 48;
const MAP_ID_OFFICE_FLOODED = 51;
const MAP_ID_OFFICE_BROKEN = 53;

const MAP_ID_LVL3_STAIRS_TO_LVL1_LVL4 = 36;
const MAP_ID_COMMON_AREA_SOUTH_EAST = 37;
const MAP_ID_CELL_BLOCK_SOUTH = 54;
const MAP_ID_SHOWER_BLOCK_SOUTH = 55;
const MAP_ID_GYM = 56;
const MAP_ID_SHOWER_BLOCK_NORTH = 62;
const MAP_ID_LVL3_GUARD_STATION = 60;
const MAP_ID_LVL3_DEFEAT_SOLITARY_CELL = 61;
const MAP_ID_CELL_BLOCK_NORTH_WEST = 58;
const MAP_ID_CELL_BLOCK_NORTH_EAST = 57;
const MAP_ID_COMMON_AREA_NORTH_EAST = 59;

const MAP_ID_LVL4_GUARD_STATION = 999;

/////////
// Scene Map
///////////////

Remtairy.Map.Scene_Map_createAllWindows = Scene_Map.prototype.createAllWindows;
Scene_Map.prototype.createAllWindows = function() {
	this.createMapInfoWindow();
    Remtairy.Map.Scene_Map_createAllWindows.call(this);
	this.createRemUpperBorders();

};

Remtairy.Map.Game_Player_clearTransferInfo = Game_Player.prototype.clearTransferInfo;
Game_Player.prototype.clearTransferInfo = function() {
    Remtairy.Map.Game_Player_clearTransferInfo.call(this);
	$gameActors.actor(ACTOR_KARRYN_ID)._cacheChanged = true;
	$gameActors.actor(ACTOR_KARRYN_ID)._dirty = true;
};

Scene_Map.prototype.createMapInfoWindow = function() {
	$gameScreen.setMapInfoRefreshNeeded();
    this._MapInfoWindow = new Window_MapInfo(0, -MAP_INFO_Y_CONSTANT);
    this.addWindow(this._MapInfoWindow);
};

Scene_Map.prototype.createRemUpperBorders = function() {
	var name = $gameScreen.getRemUpperBordersName();
	if(name) {
		this._upperRemBorders = new Sprite(ImageManager.loadSystem(name));
		this._remUpperBordersName = name;
		this.addChild(this._upperRemBorders);
	}
};

Scene_Map.prototype.updateRemUpperBorders = function() {
	if(this._remUpperBordersName != $gameScreen.getRemUpperBordersName() || $gameScreen._remUpperBordersRefreshNeeded) {
		this.removeRemUpperBorders();
		this.createRemUpperBorders();
	}
};

Scene_Map.prototype.removeRemUpperBorders = function() {
	this._baseSprite.removeChild(this._upperRemBorders);
};

Scene_Map.prototype.launchBattle = function() {
    BattleManager.saveBgmAndBgs();
    this.stopAudioOnBattleStart();
	if(Karryn.isInMasturbationPose()) {
		this._encounterEffectDuration = 0;
	}
	else {
		SoundManager.playBattleStart();
		this.startEncounterEffect();
	}
    this._mapNameWindow.hide();
	if(this._MapInfoWindow) this._MapInfoWindow.hide();
};

Remtairy.Map.Scene_Map_fadeInForTransfer = Scene_Map.prototype.fadeInForTransfer;
Scene_Map.prototype.fadeInForTransfer = function() {
	Remtairy.Map.Scene_Map_fadeInForTransfer.call(this);
	$gameScreen.changeMapBordersBackgroundOnTransfer();
	$gameParty.changeCurrentPrisonOnTransfer();
	$gameParty.changeEdictPointsOnTransfer();
	Karryn.emoteMasterManager();
	this.changeBGMOnTransfer();
	StorageManager.performAutosave();
};

Scene_Map.prototype.updateEncounterEffect = function() {
	if(Karryn.isInMasturbationPose() && this._encounterEffectDuration > 0) {
		this._encounterEffectDuration = 0;
	}
	else {
		if (this._encounterEffectDuration > 0) {
			this._encounterEffectDuration--;
			var speed = this.encounterEffectSpeed();
			var n = speed - this._encounterEffectDuration;
			var p = n / speed;
			var q = ((p - 1) * 20 * p + 5) * p + 1;
			var zoomX = $gamePlayer.screenX();
			var zoomY = $gamePlayer.screenY() - 24;
			if (n === 2) {
				$gameScreen.setZoom(zoomX, zoomY, 1);
				this.snapForBattleBackground();
				this.startFlashForEncounter(speed / 2);
			}
			$gameScreen.setZoom(zoomX, zoomY, q);
			if (n === Math.floor(speed / 6)) {
				this.startFlashForEncounter(speed / 2);
			}
			if (n === Math.floor(speed / 2)) {
				BattleManager.playBattleBgm();
				this.startFadeOut(this.fadeSpeed());
			}
		}
	}
};

Scene_Map.prototype.changeBGMOnTransfer = function() {
	let bgmName = false;
	let bgmVolume = MAP_EB_BGM_VOLUME;
	let mapId = $gameMap._mapId;

	if(Prison.currentlyOutsidePrison()) {
		if(mapId === MAP_ID_OUTSIDE || mapId === MAP_ID_EB_HALLWAY) {
			bgmName = MAP_EB_BGM_NAME;
			bgmVolume = MAP_EB_BGM_VOLUME;
		}
		else if(mapId === MAP_ID_KARRYN_OFFICE || mapId === MAP_ID_EB_GUARD_QUARTERS) {
			bgmName = MAP_OFFICE_BGM_NAME;
			bgmVolume = MAP_OFFICE_BGM_VOLUME;
		}
		else if(mapId === MAP_ID_YARD) {
			bgmName = MAP_YARD_BGM_NAME;
			bgmVolume = MAP_YARD_BGM_VOLUME;
		}
		else if(mapId === MAP_ID_EB_MESS_HALL) {
			bgmName = MAP_MESS_HALL_BGM_NAME;
			bgmVolume = MAP_MESS_HALL_BGM_VOLUME;
		}
		else if(mapId === MAP_ID_EB_INFIRMARY) {
			bgmName = MAP_INFIRMARY_BGM_NAME;
			bgmVolume = MAP_INFIRMARY_BGM_VOLUME;
		}

	}
	else if(Prison.currentlyPrisonLevelOne()) {
		if(mapId === MAP_ID_BAR || mapId === MAP_ID_BAR_BROKEN || mapId === MAP_ID_BAR_STORAGE) {
			if(Prison.prisonLevelOneIsAnarchy()) {
				bgmName = MAP_LEVEL_ONE_ANARCHY_BGM_NAME;
				bgmVolume = MAP_LEVEL_ONE_ANARCHY_BGM_VOLUME;
			}
			else {
				bgmName = MAP_BAR_BGM_NAME;
				bgmVolume = MAP_BAR_BGM_VOLUME;
			}
		}
		else if(mapId === MAP_ID_LVL1_STAIRS_TO_LVL2 || mapId === MAP_ID_LVL1_STAIRS_TO_LVL3) {
			bgmName = false;
		}
		else if(Prison.prisonLevelOneIsSubjugated()) {
			bgmName = MAP_LEVEL_ONE_SUBJUGATED_BGM_NAME;
			bgmVolume = MAP_LEVEL_ONE_SUBJUGATED_BGM_VOLUME;
		}
		else if(Prison.prisonLevelOneIsAnarchy()) {
			bgmName = MAP_LEVEL_ONE_ANARCHY_BGM_NAME;
			bgmVolume = MAP_LEVEL_ONE_ANARCHY_BGM_VOLUME;
		}
		else {
			if(mapId === MAP_ID_WORKSHOP || mapId === MAP_ID_DISH_WASHING || mapId === MAP_ID_RECEPTION || mapId === MAP_ID_LAUNDRY || mapId === MAP_ID_LVL1_HALLWAY || mapId === MAP_ID_LVL1_GUARD_STATION) {
				bgmName = MAP_LEVEL_ONE_RIOTING_BGM_NAME;
				bgmVolume = MAP_LEVEL_ONE_RIOTING_BGM_VOLUME;
			}
			else {
				bgmName = MAP_LEVEL_ONE_SUBJUGATED_BGM_NAME;
				bgmVolume = MAP_LEVEL_ONE_SUBJUGATED_BGM_VOLUME;
			}
		}

	}
	else if(Prison.currentlyPrisonLevelTwo()) {
		if(mapId === MAP_ID_LVL2_STAIRS_TO_LVL1) {
			bgmName = false;
		}
		else if(Prison.prisonLevelTwoIsAnarchy()) {
			bgmName = MAP_LEVEL_TWO_ANARCHY_BGM_NAME;
			bgmVolume = MAP_LEVEL_TWO_ANARCHY_BGM_VOLUME;
		}
		else if(mapId === MAP_ID_STORE_FIXED) {
			bgmName = MAP_LEVEL_TWO_STORE_BGM_NAME;
			bgmVolume = MAP_LEVEL_TWO_STORE_BGM_VOLUME;
		}
		else if(Prison.prisonLevelTwoIsSubjugated()) {
			bgmName = MAP_LEVEL_TWO_SUBJUGATED_BGM_NAME;
			bgmVolume = MAP_LEVEL_TWO_SUBJUGATED_BGM_VOLUME;
		}
		else {
			if(mapId === MAP_ID_READING_ROOM || mapId === MAP_ID_CLASSROOM || mapId === MAP_ID_STAFF_LOUNGE || mapId === MAP_ID_RESEARCH || mapId === MAP_ID_MEETING_ROOM || mapId === MAP_ID_LVL2_HALLWAY || mapId === MAP_ID_LVL2_GUARD_STATION) {
				bgmName = MAP_LEVEL_TWO_RIOTING_BGM_NAME;
				bgmVolume = MAP_LEVEL_TWO_RIOTING_BGM_VOLUME;
			}
			else {
				bgmName = MAP_LEVEL_TWO_SUBJUGATED_BGM_NAME;
				bgmVolume = MAP_LEVEL_TWO_SUBJUGATED_BGM_VOLUME;
			}
		}

	}
	else if(Prison.currentlyPrisonLevelThree()) {
		if(mapId === MAP_ID_LVL3_STAIRS_TO_LVL1_LVL4) {
			bgmName = false;
		}
		else if(Prison.prisonLevelThreeIsAnarchy() || Prison.prisonLevelThreeIsUnknown()) {
			bgmName = MAP_LEVEL_THREE_ANARCHY_BGM_NAME;
			bgmVolume = MAP_LEVEL_THREE_ANARCHY_BGM_VOLUME;
		}
		else if(Prison.prisonLevelThreeIsSubjugated()) {
			bgmName = MAP_LEVEL_THREE_SUBJUGATED_BGM_NAME;
			bgmVolume = MAP_LEVEL_THREE_SUBJUGATED_BGM_VOLUME;
		}
		else {
			bgmName = MAP_LEVEL_THREE_SUBJUGATED_BGM_NAME;
			bgmVolume = MAP_LEVEL_THREE_SUBJUGATED_BGM_VOLUME;
		}
	}

	if(bgmName)
		AudioManager.playBgm({name:bgmName, pan:0, pitch:100, pos:0, volume:bgmVolume});
	else
		AudioManager.stopBgm();
};

/////////
// Scene Load
//////////////

Remtairy.Map.Scene_Load_onLoadSuccess = Scene_Load.prototype.onLoadSuccess;
Scene_Load.prototype.onLoadSuccess = function() {
    Remtairy.Map.Scene_Load_onLoadSuccess.call(this);
	$gameScreen.setMapInfoRefreshNeeded();
};

//////////////
// Spriteset Map
///////////////////

Remtairy.Map.Spriteset_Map_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;
Spriteset_Map.prototype.createLowerLayer = function() {
    Remtairy.Map.Spriteset_Map_createLowerLayer.call(this);
	this.createRemLowerBorders();
};

Spriteset_Map.prototype.createRemLowerBorders = function() {
	let name = $gameScreen.getRemLowerBordersName();
	if(name) {
		let bg = $gameScreen.getMapBordersBackgroundName();
		this._remBordersBackground = new Sprite(ImageManager.loadSystem(bg));
		this._remBordersBackgroundName = bg;
		this._baseSprite.addChild(this._remBordersBackground);

		if(name == MAP_LOWER_BORDERS_NORMAL) {
			if(TextManager.isEnglish) name += "_EN";
			else if(TextManager.isJapanese) name += "_JP";
		}

		this._lowerRemBorders = new Sprite(ImageManager.loadSystem(name));
		this._remLowerBordersName = name;
		this._baseSprite.addChild(this._lowerRemBorders);
	}
};

Remtairy.Map.Spriteset_Map_update = Spriteset_Map.prototype.update;
Spriteset_Map.prototype.update = function() {
    Remtairy.Map.Spriteset_Map_update.call(this);
    this.updateRemLowerBorders();
};

Spriteset_Map.prototype.updateRemLowerBorders = function() {
	if(this._remLowerBordersName != $gameScreen.getRemLowerBordersName() ||
	this._remBordersBackgroundName != $gameScreen.getMapBordersBackgroundName() ||
	$gameScreen._remLowerBordersRefreshNeeded) {
		this.removeRemLowerBorders();
		this.createRemLowerBorders();
	}
};

Spriteset_Map.prototype.removeRemLowerBorders = function() {
	this._baseSprite.removeChild(this._remBordersBackground);
	this._baseSprite.removeChild(this._lowerRemBorders);
};

/////////
// Sprite RemNumber
///////////////////

function Sprite_RemNumber() {
    this.initialize.apply(this, arguments);
}

Sprite_RemNumber.prototype = Object.create(Sprite.prototype);
Sprite_RemNumber.prototype.constructor = Sprite_RemNumber;

Sprite_RemNumber.prototype.initialize = function(bitmapName) {
    Sprite.prototype.initialize.call(this);
    this._numberBitmap = ImageManager.loadSystem(bitmapName);
};

Sprite_RemNumber.prototype.digitWidth = function() {
    return this._numberBitmap ? this._numberBitmap.width / 10 : 0;
};

Sprite_RemNumber.prototype.digitHeight = function() {
    return this._numberBitmap ? this._numberBitmap.height : 0;
};

Sprite_RemNumber.prototype.setNumber = function(value) {
    var string = Math.abs(value).toString();
    var row = 0;
    var w = this.digitWidth();
    var h = this.digitHeight();
    for (var i = 0; i < string.length; i++) {
        var sprite = this.createChildSprite();
        var n = Number(string[i]);
        sprite.setFrame(n * w, row * h, w, h);
        sprite.x = (i - (string.length - 1) / 2) * w;
    }

};

Sprite_RemNumber.prototype.createChildSprite = function() {
    var sprite = new Sprite();
    sprite.bitmap = this._numberBitmap;
    this.addChild(sprite);
    return sprite;
};

//////////
// Game Screen
/////////////

Game_Screen.prototype.setMapBordersBackgroundName = function(bgName) {
    $gameParty._remLowerBordersBackground = bgName;
};
Game_Screen.prototype.getMapBordersBackgroundName = function() {
    return $gameParty._remLowerBordersBackground;
};
Game_Screen.prototype.setMapBordersBackgroundDefault = function() {
    this.setMapBordersBackgroundName(MAP_BORDER_BACKGROUND_DEFAULT);
	this._remLowerBordersRefreshNeeded = true;
};
Game_Screen.prototype.setMapBordersBackgroundOutside = function() {
	this.setMapBordersBackgroundName(MAP_BORDER_BACKGROUND_OUTSIDE);
	this._remLowerBordersRefreshNeeded = true;
};
Game_Screen.prototype.setMapBordersBackgroundBar = function() {
	this.setMapBordersBackgroundName(MAP_BORDER_BACKGROUND_BAR);
	this._remLowerBordersRefreshNeeded = true;
};
Game_Screen.prototype.setMapBordersBackgroundEB = function() {
	this.setMapBordersBackgroundName(MAP_BORDER_BACKGROUND_EB);
	this._remLowerBordersRefreshNeeded = true;
};
Game_Screen.prototype.setMapBordersBackgroundBasement1 = function() {
	this.setMapBordersBackgroundName(MAP_BORDER_BACKGROUND_BASEMENT1);
	this._remLowerBordersRefreshNeeded = true;
};

Game_Screen.prototype.changeMapBordersBackgroundOnTransfer = function() {
	let mapId = $gameMap._mapId;

    if(mapId === MAP_ID_OUTSIDE || mapId === MAP_ID_YARD) {
		this.setMapBordersBackgroundOutside();
	}
	else if(mapId === MAP_ID_BAR || mapId === MAP_ID_BAR_BROKEN || mapId === MAP_ID_BAR_STORAGE) {
		this.setMapBordersBackgroundBar();
	}
	else if(mapId === MAP_ID_KARRYN_OFFICE || mapId === MAP_ID_EB_HALLWAY || mapId === MAP_ID_EB_MESS_HALL || mapId === MAP_ID_EB_INFIRMARY || mapId === MAP_ID_EB_GUARD_QUARTERS ) {
		this.setMapBordersBackgroundEB();
	}
	else if(mapId === MAP_ID_LVL1_STAIRS_TO_LVL3 || mapId === MAP_ID_LVL1_STAIRS_TO_LVL2) {
		this.setMapBordersBackgroundDefault();
	}
	else if(mapId === MAP_ID_LVL3_STAIRS_TO_LVL1_LVL4 || Prison.currentlyPrisonLevelThree()) {
		this.setMapBordersBackgroundBasement1();
	}
	else
		this.setMapBordersBackgroundDefault();

};

Game_Screen.prototype.getRemLowerBordersName = function() {
    /*var name = this._remLowerBorders;
	if(name == MAP_LOWER_BORDERS_NORMAL) {
		if(TextManager.isEnglish) name += "_EN";
		else if(TextManager.isJapanese) name += "_JP";
	}
	return name;*/
	return this._remLowerBorders;
};
Game_Screen.prototype.getRemUpperBordersName = function() {
    return this._remUpperBorders;
};

Game_Screen.prototype.setRemLowerBordersNormal = function() {
    this._remLowerBorders = MAP_LOWER_BORDERS_NORMAL;
	this._remLowerBordersRefreshNeeded = true;
};
Game_Screen.prototype.setRemLowerBordersChat = function() {
    this._remLowerBorders = MAP_LOWER_BORDERS_CHAT;
	this._remLowerBordersRefreshNeeded = true;
};
Game_Screen.prototype.setRemLowerBordersNone = function() {
    this._remLowerBorders = false;
	this._remLowerBordersRefreshNeeded = true;
	this.setMapInfoRefreshNeeded();
};

Game_Screen.prototype.isMapMode = function() {
    return this._remLowerBorders == MAP_LOWER_BORDERS_NORMAL && !$gameParty.inBattle();
};
Game_Screen.prototype.isChatMode = function() {
    return this._remLowerBorders == MAP_LOWER_BORDERS_CHAT || TESTING_CHAT_BOX;
};
Game_Screen.prototype.isCinematicMode = function() {
    return this._remLowerBorders == false;
};

Game_Screen.prototype.setRemUpperBordersNormal = function() {
    this._remUpperBorders = MAP_BORDERS_UPPER;
	this._remUpperBordersRefreshNeeded = true;
};
Game_Screen.prototype.setRemUpperBordersNone = function() {
    this._remUpperBorders = false;
	this._remUpperBordersRefreshNeeded = true;
};

Game_Screen.prototype.showMapInfo = function() {
    this._showMapInfo = true;
	this.setMapInfoRefreshNeeded();
};
Game_Screen.prototype.hideMapInfo = function() {
    this._showMapInfo = false;
	this.setMapInfoRefreshNeeded();
};
Game_Screen.prototype.displayMapInfo = function() {
    return this._showMapInfo;
};

Game_Screen.prototype.setMapInfoRefreshNeeded = function() {
    this._mapInfoRefreshNeeded = true;
};

/////////
// Window MapInfo
//////////////////

function Window_MapInfo() {
    this.initialize.apply(this, arguments);
}

Window_MapInfo.prototype = Object.create(Window_Base.prototype);
Window_MapInfo.prototype.constructor = Window_MapInfo;

Window_MapInfo.prototype.initialize = function(x, y) {
	var width = Graphics.boxWidth;
	var height = Graphics.boxHeight + MAP_INFO_Y_CONSTANT * 2;
    Window_Base.prototype.initialize.call(this, x, y, width, height);
	this.setBackgroundType(255);
	this.createRemUpperBorders();
    this.redrawMapInfo();
};

Window_MapInfo.prototype.open = function() {
    this.redrawMapInfo();
    Window_Base.prototype.open.call(this);
};

Window_MapInfo.prototype.update = function() {
    Window_Base.prototype.update.call(this);

	if($gameScreen._remUpperBordersRefreshNeeded) {
		this.checkRemUpperBorders();
		this.redrawMapInfo();
	}
	else if($gameScreen._mapInfoRefreshNeeded) {
		this.redrawMapInfo();
	}

	if(!$gameScreen.displayMapInfo()) this.removeMapInfo();
};

Window_MapInfo.prototype.checkRemUpperBorders = function() {
    if(this._remUpperBordersName != $gameScreen.getRemUpperBordersName() || $gameScreen._remUpperBordersRefreshNeeded) {
		this.removeRemUpperBorders();
		this.createRemUpperBorders();
		$gameScreen._remUpperBordersRefreshNeeded = false;
	}
};

Window_MapInfo.prototype.removeRemUpperBorders = function() {
	this.removeChild(this._upperRemBorders);
};

Window_MapInfo.prototype.createRemUpperBorders = function() {
	var name = $gameScreen.getRemUpperBordersName();
	if(name) {
		this._upperRemBorders = new Sprite(ImageManager.loadSystem(name));
		this._remUpperBordersName = name;
		this.addChild(this._upperRemBorders);
	}
};

Window_MapInfo.prototype.removeMapInfo = function() {
	this.contents.clear();
	this.resetTextColor();
	if(this._dayNumbers) {
		this.removeChild(this._dayNumbers);
		this._dayNumbers = false;
	}
	if(this._orderNumbers) {
		this.removeChild(this._orderNumbers);
		this._orderNumbers = false;
	}
	if(this._controlNumbers) {
		this.removeChild(this._controlNumbers);
		this._controlNumbers = false;
	}
	if(this._fatigueNumbers) {
		this.removeChild(this._fatigueNumbers);
		this._fatigueNumbers = false;
	}
	if(this._pleasureNumbers) {
		this.removeChild(this._pleasureNumbers);
		this._pleasureNumbers = false;
	}
};

Window_MapInfo.prototype.redrawMapInfo = function() {
	this.removeMapInfo();

	if(!$gameScreen.displayMapInfo()) return;

	//Map Name
	this.drawMapName();

	if($gameScreen.isChatMode()) {
		$gameScreen._mapInfoRefreshNeeded = false;
		return;
	}

	//Prison Levels
	this.drawPrisonLevels();

	//Date
	this._dayNumbers = new Sprite_RemNumber(MAP_INFO_DAY_NUMBERS);
	this._dayNumbers.x = MAP_INFO_DAY_X;
	this._dayNumbers.y = MAP_INFO_DAY_Y + MAP_INFO_Y_CONSTANT;
	this._dayNumbers.setNumber(Prison.date);
	this.addChild(this._dayNumbers);

	/*
	//Order
	var prisonOrder = Prison.order;
	this._orderNumbers = new Sprite_RemNumber(MAP_INFO_STAT_NUMBERS);
	if(Prison.HighOrder()) {

	}
	else if(Prison.MedOrder()) {
		this._orderNumbers.setColor(255,255,0,250);
	}
	else if(Prison.LowOrder()) {
		this._orderNumbers.setColor(255,155,75,250);
	}
	else if(Prison.VeryLowOrder()) {
		this._orderNumbers.setColor(255,75,85,250);
	}
	else if(Prison.NearNoOrder()) {
		this._orderNumbers.setColor(255,55,15,250);
	}
	this._orderNumbers.x = MAP_INFO_ORDER_X;
	this._orderNumbers.y = MAP_INFO_ORDER_Y + MAP_INFO_Y_CONSTANT;
	this._orderNumbers.setNumber(prisonOrder);
	this.addChild(this._orderNumbers);

	//Control
	var prisonControl = Prison.orderChange;
	this._controlNumbers = new Sprite_RemNumber(MAP_INFO_STAT_NUMBERS);
	if(prisonControl <= -10)
		this._controlNumbers.setColor(255,55,15,250);
	else if(prisonControl <= -5)
		this._controlNumbers.setColor(255,155,75,250);
	else if(prisonControl < 0)
		this._controlNumbers.setColor(255,255,0,250);
	else if(prisonControl > 0)
		this._controlNumbers.setColor(100,255,25,250);
	this._controlNumbers.x = MAP_INFO_CONTROL_X;
	this._controlNumbers.y = MAP_INFO_CONTROL_Y + MAP_INFO_Y_CONSTANT;
	this._controlNumbers.setNumber(Math.abs(prisonControl));
	this.addChild(this._controlNumbers);

	//Fatigue
	var fatigueLevel = Karryn.getFatigueLevel();
	this._fatigueNumbers = new Sprite_RemNumber(MAP_INFO_STAT_NUMBERS);
	if(fatigueLevel >= 4)
		this._fatigueNumbers.setColor(255,55,15,250);
	else if(fatigueLevel === 3)
		this._fatigueNumbers.setColor(255,75,85,250);
	else if(fatigueLevel > 0)
		this._fatigueNumbers.setColor(255,155,75,250);
	this._fatigueNumbers.x = MAP_INFO_FATIGUE_X;
	this._fatigueNumbers.y = MAP_INFO_FATIGUE_Y + MAP_INFO_Y_CONSTANT;
	this._fatigueNumbers.setNumber(Karryn.fatigue);
	this.addChild(this._fatigueNumbers);

	//Pleasure
	var pleasurePercent = Karryn.currentPercentOfOrgasm();
	this._pleasureNumbers = new Sprite_RemNumber(MAP_INFO_STAT_NUMBERS);
	if(Karryn.isAroused()) {
		if(pleasurePercent > 75)
			this._pleasureNumbers.setColor(244,66,226,250);
		else
			this._pleasureNumbers.setColor(244,66,226,150);
	}
	this._pleasureNumbers.x = MAP_INFO_PLEASURE_X;
	this._pleasureNumbers.y = MAP_INFO_PLEASURE_Y + MAP_INFO_Y_CONSTANT;
	this._pleasureNumbers.setNumber(pleasurePercent);
	this.addChild(this._pleasureNumbers);
	*/

	//Numbers
	this.contents.fontSize = MAP_INFO_CONTROL_SYMBOL_FONT_SIZE;
	//this.contents.fontSize = MAP_INFO_CONTROL_SYMBOL_FONT_SIZE;

	let prisonOrder = Prison.order;
	let orderX = MAP_INFO_BOTTOM_ORDER_X;
	if(Prison.HighOrder()) {
		this.resetTextColor();
	}
	else if(Prison.MedOrder()) {
		this.changeTextColor(this.textColor(17));
	}
	else if(Prison.LowOrder()) {
		this.changeTextColor(this.textColor(2));
	}
	else if(Prison.VeryLowOrder()) {
		this.changeTextColor(this.textColor(10));
	}
	else if(Prison.NearNoOrder()) {
		this.changeTextColor(this.textColor(30));
	}

	if(prisonOrder <= 9) orderX += 10;
	else if(prisonOrder <= 99) orderX += 5;
	this.drawText(prisonOrder, orderX, MAP_INFO_BOTTOM_NUMBER_Y + MAP_INFO_Y_CONSTANT, 100);

	let prisonControl = Prison.orderChange;
	let controlX = MAP_INFO_CONTROL_ORDER_X;
	if(prisonControl < 0) {
		if(prisonControl <= -100) controlX -= 10;
		else if(prisonControl <= -10) controlX -= 5;

		if(prisonControl <= -10)
			this.changeTextColor(this.textColor(18));
		else if(prisonControl <= -5)
			this.changeTextColor(this.textColor(2));
		else
			this.changeTextColor(this.textColor(3));
		this.drawText("-" + Math.abs(prisonControl), controlX, MAP_INFO_BOTTOM_NUMBER_Y + MAP_INFO_Y_CONSTANT, 100);
	}
	else if(prisonControl > 0) {
		if(prisonControl >= 100) controlX -= 10;
		else if(prisonControl >= 10) controlX -= 5;

		this.changeTextColor(this.textColor(11));
		this.drawText("+" + Math.abs(prisonControl), controlX, MAP_INFO_BOTTOM_NUMBER_Y + MAP_INFO_Y_CONSTANT, 100);
	}
	else {
		controlX += 8;
		this.drawText(Math.abs(prisonControl), controlX, MAP_INFO_BOTTOM_NUMBER_Y + MAP_INFO_Y_CONSTANT, 100);
	}

	//this.contents.fontSize = MAP_INFO_SYMBOL_PERCENT_FONT_SIZE;

	let fatigueLevel = Karryn.getFatigueLevel();
	let fatigueX = MAP_INFO_FATIGUE_ORDER_X;
	if(fatigueLevel >= 4)
		this.changeTextColor(this.textColor(18));
	else if(fatigueLevel === 3)
		this.changeTextColor(this.textColor(10));
	else if(fatigueLevel > 0)
		this.changeTextColor(this.textColor(2));
	else
		this.resetTextColor();

	if(Karryn.fatigue >= 100) fatigueX -= 10;
	else if(Karryn.fatigue >= 10) fatigueX -= 5;
	this.drawText("" + Karryn.fatigue + "%", fatigueX, MAP_INFO_BOTTOM_NUMBER_Y + MAP_INFO_Y_CONSTANT, 100);

	let pleasurePercent = Karryn.currentPercentOfOrgasm();
	let pleasureX = MAP_INFO_PLEASURE_ORDER_X;
	if(Karryn.isAroused()) {
		if(pleasurePercent > 75)
			this.changeTextColor(this.textColor(5));
		else
			this.changeTextColor(this.textColor(27));
	}
	else
		this.resetTextColor();
	if(pleasurePercent >= 1000) pleasureX -= 15;
	else if(pleasurePercent >= 100) pleasureX -= 10;
	else if(pleasurePercent >= 10) pleasureX -= 5;
	this.drawText("" + pleasurePercent + "%", pleasureX, MAP_INFO_PLEASURE_PERCENT_Y + MAP_INFO_Y_CONSTANT, 100);

	$gameScreen._mapInfoRefreshNeeded = false;
};

Window_MapInfo.prototype.drawPrisonLevels = function() {
	let x = this.textPadding();
    let width = MAP_INFO_LEVEL_WIDTH;
	this.contents.fontSize = MAP_INFO_LEVEL_FONT_SIZE;

	if(Prison.prisonLevelOneIsRioting())
		this.changeTextColor(this.textColor(18));
	else if(Prison.prisonLevelOneIsUnknown())
		this.changeTextColor(this.textColor(7));
	else if(Prison.prisonLevelOneIsSubjugated())
		this.changeTextColor(this.textColor(29));
	else
		this.resetTextColor();

	let levelOneText = Prison.prisonLevelOneStatusText();
	this.drawText(levelOneText, MAP_INFO_LEVEL_1_X, MAP_INFO_LEVEL_1_Y + MAP_INFO_Y_CONSTANT, width);

	if(Prison.prisonLevelTwoIsRioting())
		this.changeTextColor(this.textColor(18));
	else if(Prison.prisonLevelTwoIsUnknown())
		this.changeTextColor(this.textColor(7));
	else if(Prison.prisonLevelTwoIsSubjugated())
		this.changeTextColor(this.textColor(29));
	else
		this.resetTextColor();

	let levelTwoText = Prison.prisonLevelTwoStatusText();
	this.drawText(levelTwoText, MAP_INFO_LEVEL_2_X, MAP_INFO_LEVEL_2_Y + MAP_INFO_Y_CONSTANT, width);

	if(Prison.prisonLevelThreeIsRioting())
		this.changeTextColor(this.textColor(18));
	else if(Prison.prisonLevelThreeIsUnknown())
		this.changeTextColor(this.textColor(7));
	else if(Prison.prisonLevelThreeIsSubjugated())
		this.changeTextColor(this.textColor(29));
	else
		this.resetTextColor();

	let levelThreeText = Prison.prisonLevelThreeStatusText();
	this.drawText(levelThreeText, MAP_INFO_LEVEL_3_X, MAP_INFO_LEVEL_3_Y + MAP_INFO_Y_CONSTANT, width);

	if(Prison.prisonLevelFourIsRioting())
		this.changeTextColor(this.textColor(18));
	else if(Prison.prisonLevelFourIsUnknown())
		this.changeTextColor(this.textColor(7));
	else if(Prison.prisonLevelFourIsSubjugated())
		this.changeTextColor(this.textColor(29));
	else
		this.resetTextColor();

	let levelFourText = Prison.prisonLevelFourStatusText();
	this.drawText(levelFourText, MAP_INFO_LEVEL_4_X, MAP_INFO_LEVEL_4_Y + MAP_INFO_Y_CONSTANT, width);

	if(Prison.prisonLevelFiveIsRioting())
		this.changeTextColor(this.textColor(18));
	else if(Prison.prisonLevelFiveIsUnknown())
		this.changeTextColor(this.textColor(7));
	else if(Prison.prisonLevelFiveIsSubjugated())
		this.changeTextColor(this.textColor(29));
	else
		this.resetTextColor();

	let levelFiveText = Prison.prisonLevelFiveStatusText();
	this.drawText(levelFiveText, MAP_INFO_LEVEL_5_X, MAP_INFO_LEVEL_5_Y + MAP_INFO_Y_CONSTANT, width);

};

Window_MapInfo.prototype.drawMapName = function() {
	let width = MAP_INFO_MAP_NAME_WIDTH;
	this.contents.fontSize = MAP_INFO_MAP_NAME_FONT_SIZE;
	let x = MAP_INFO_MAP_NAME_X;
	let y = MAP_INFO_MAP_NAME_Y + MAP_INFO_Y_CONSTANT;

	let mapNameText = '' + Prison.getCurrentPrisonLevelName();
	let mapNameArray = DataManager.getMapLocationDisplayNameRem();

	if(TextManager.isEnglish) mapNameText += mapNameArray[RemLanguageEN];
	else if(TextManager.isJapanese) mapNameText += mapNameArray[RemLanguageJP];
	else if(TextManager.isSChinese) mapNameText += mapNameArray[RemLanguageSCH];
	else if(TextManager.isTChinese) mapNameText += mapNameArray[RemLanguageTCH];
	else if(TextManager.isKorean) mapNameText += mapNameArray[RemLanguageKR];
    this.drawText(mapNameText, x, y, width, 'center');
};

//////////
// Window Message
/////////////////

Window_Message.prototype.windowWidth = function() {
	if($gameScreen.isChatMode()) return MAP_CHAT_TEXT_WINDOW_WIDTH;
    else return $gameSystem.messageWidth();
};

Remtairy.Map.Window_Message_adjustWindowSettings = Window_Message.prototype.adjustWindowSettings;
Window_Message.prototype.adjustWindowSettings = function() {
	if($gameScreen.isChatMode()) {
		this.x = MAP_CHAT_TEXT_WINDOW_X;
		this.y = MAP_CHAT_TEXT_WINDOW_Y;
		this.width = this.windowWidth();
		this.height = Math.min(this.windowHeight(), Graphics.boxHeight);
		if (Math.abs(Graphics.boxHeight - this.height) < this.lineHeight()) {
			this.height = Graphics.boxHeight;
		}
		this.createContents();
	}
	else
		Remtairy.Map.Window_Message_adjustWindowSettings.call(this);
};

//Moved to YEP_MessageCore
/*
Window_Message.prototype.startMessage = function() {
	this._nameWindow.deactivate();
    this._textState = {};
    this._textState.index = 0;
    this._textState.text = this.convertEscapeCharacters($gameMessage.allText());
    this.newPage(this._textState);
    this.updatePlacement();
    this.updateBackground();
	if(this._positionType === 2 && this._background === 1) {
		this._textState.y = MAP_CHAT_TEXT_TRANSPARENT_WINDOW_HEIGHT_PADDING;
	}
    this.open();
};*/

//////////
// Window EventMiniLabel
/////////////////

Remtairy.Map.Window_EventMiniLabel_showMiniLabel = Window_EventMiniLabel.prototype.showMiniLabel;
Window_EventMiniLabel.prototype.showMiniLabel = function() {
    if($gameScreen.isChatMode() || $gameScreen.isCinematicMode()) return false;
    return Remtairy.Map.Window_EventMiniLabel_showMiniLabel.call(this);
};