code:
//
//  ポップアップメッセージ ver1.02
//
// author yana
//

var Imported = Imported || {};
Imported['PopupMessage'] = 1.02;

if (!Imported.CommonPopupCore) {
	console.error('CommonPopupCoreを導入してください。')
}

/*:
 * @plugindesc ver1.02/メッセージの表示をポップアップに変更する制御文字_pum[delay,x,y,action]を追加します。
 * @author Yana
 *
 * @param Pop Message FontSize
 * @desc ポップアップメッセージのデフォルトフォントサイズです。
 * @default 28
 *
 * @param Pop Message Count
 * @desc ポップアップメッセージの表示時間です。
 * @default 120
 *
 * @help プラグインコマンドはありません。
 *
 * メッセージの表示のメッセージの中に_pum[delay,x,y,action,pattern]と記述することで、
 * メッセージをポップアップに変更します。
 * delayはディレイ値で、この値フレーム分待ってから、ポップアップを行います。
 * xは表示位置のX座標です。未指定の場合は、0が設定されます。
 * yは表示位置のY座標です。未指定の場合は、画面高さ-ポップアップの高さが設定されます。
 * actionはアクション形式です。1を指定すると、上から下にアクションします。
 * patternは動作パターンです。Normalで今まで通り、GrowUpでにょき、Stretchでうにょーんとなります。
 * ------------------------------------------------------
 * 利用規約：特になし。素材利用は自己責任でお願いします。
 * ------------------------------------------------------
 * このプラグインには「汎用ポップアップベース」のプラグインが必要です。
 * 汎用ポップアップベースより下に配置してください。
 * ------------------------------------------------------
 * 更新履歴:
 * ver1.02:
 * 動作パターンの設定を追加。
 * ver1.01:
 * 表示位置を調整する機能を追加。
 * ver1.00:
 * 公開
 */

(function() {
	var parameters = PluginManager.parameters('PopupMessage');
	var popMesFontSize = Number(parameters['Pop Message FontSize'] || 28);
	var popMesCount = Number(parameters['Pop Message Count'] || 120);
	var popMesSlide = Number(parameters['Pop Message Slide'] || 60);
	var popMesRegExp = /_PUM\[(\d+),?(\d+)?,?(\d+)?,?(\d+)?,?(.+?)?\]/gi;

	var _pMes_GInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
	Game_Interpreter.prototype.pluginCommand = function(command, args) {
		_pMes_GInterpreter_pluginCommand.call(this, command, args);
		if (command === 'PopupMessage') {
		}
	};

	var _pMes_GInterpreter_c101 = Game_Interpreter.prototype.command101;
	Game_Interpreter.prototype.command101 = function(){
		var texts = [];
		var pIndex = this._index;
		var param = {'delay':null};
		while (this.nextEventCode() === 401){
			this._index++;
			texts.push(this.currentCommand().parameters[0]);
		}
    	for(var i=0;i<texts.length;i++){
    		if (texts[i].match(popMesRegExp)){
    			var ary = [0,null,null,0];
        		text = texts[i].replace(popMesRegExp,function(){
        			ary[0] = Number(arguments[1]);
        			if (arguments[2]){ ary[1] = Number(arguments[2]) }
        			if (arguments[3]){ ary[2] = Number(arguments[3]) }
        			if (arguments[4]){ ary[3] = Number(arguments[4]) }
                    if (arguments[5]){ ary[4] = arguments[5] }
        			return '';
        		}.bind(this));
        		texts[i] = text;
        		CommonPopupManager.setPopupMessage(this._params, texts, ary);
        		return true;
    		}
    	}
		this._index = pIndex;
		var result = _pMes_GInterpreter_c101.call(this);
		return result;
	};

	var _pMes_GMessage_add = Game_Message.prototype.add;
	Game_Message.prototype.add = function(text){
		text = text.replace(popMesRegExp,'');
		_pMes_GMessage_add.call(this,text);
	};

	CommonPopupManager.setPopupMessage = function(params,texts,ary){
		this._readyPopup = this._readyPopup || [];
		var bitmap = ImageManager.loadFace(params[0]);
		this.bltCheck(bitmap);
		this._readyPopup.push([params, texts, ary, 'pMessage']);
	};

	var _pMes_CPManager_makeBitmap = CommonPopupManager.makeBitmap;
	CommonPopupManager.makeBitmap = function(arg){
		if (arg[3] === 'pMessage'){
			return ImageManager.loadFace(arg[0][0]);
		}else{
			return _pMes_CPManager_makeBitmap.call(this,arg);
		}
	};

	var _pMes_CPManager_startPopup = CommonPopupManager.startPopup;
	CommonPopupManager.startPopup = function(arg){
		if (arg[3] === 'pMessage'){
			this.startPopupMessage(arg[0],arg[1],arg[2]);
		}else{
			_pMes_CPManager_startPopup.call(this,arg);
		}
	};

	CommonPopupManager.startPopupMessage = function(params,texts,arg){
		var fontSize = popMesFontSize;
		var oneHeight = (fontSize + 8)
		var height = params[0] ? 144 : oneHeight * texts.length;
		var bitmap = new Bitmap(Graphics.boxWidth, height);
		var faceSize = params[0] === '' ? 0 : 144;
		var delay = arg[0];
		var x = arg[1];
		var y = arg[2];
		var action = arg[3];
        var pattern = arg[4];
		bitmap.fillRect(0, 0, bitmap.width / 2, bitmap.height, 'rgba(0,0,0,0.5)');
		bitmap.gradientFillRect(bitmap.width / 2, 0, bitmap.width / 2, bitmap.height, 'rgba(0,0,0,0.5)', 'rgba(0,0,0,0)');
		this.window().contents = bitmap;
		this.window().drawTextEx('\\FS[' + fontSize + ']', 0, 0);
		this.window().drawFace(params[0],params[1],0,0);
		var iFontSize = fontSize;
		for (var i = 0; i < texts.length; i++) {
			var text = '\\FS[' + iFontSize + ']' + texts[i]
			this.window().drawTextEx(text, 8 + faceSize, i * oneHeight);
			iFontSize = this.window().contents.fontSize;
		}
		var arg = this.setPopup([]);
		arg.bitmap = bitmap;
        if (pattern === 'GrowUp') {
            arg.x = 0;
            arg.y = Graphics.boxHeight;
            arg.moveX = 0;
            arg.anchorX = 0;
            arg.anchorY = 1.0;
            arg.pattern = -2;
        } else if (pattern === 'Stretch'){
            arg.x = 0;
            arg.y = Graphics.boxHeight - height;
            arg.moveX = 0;
            arg.anchorX = 0;
            arg.anchorY = 0;
            arg.pattern = -1;
        } else {
            arg.x = Graphics.boxWidth * -1;
            arg.y = Graphics.boxHeight - height;
            arg.moveX = Graphics.boxWidth;
            arg.anchorX = 0;
            arg.anchorY = 0;
        }
		if (x){ arg.x += x }
		if (y){ arg.y = y }
		if ($gameParty.inBattle()){ arg.y = Math.min(Graphics.boxHeight - 180,arg.y) }
		arg.moveY = 0;
		arg.count = popMesCount;
		arg.fixed = false;
		arg.slideCount = popMesSlide;
		if (action === 1){ arg.slideAction = 'Down' }
		arg.delay = delay;
		this._tempCommonSprites.setNullPos(arg);
	}
})();


code:
/*:
* @plugindesc (v1.0.6) This plugin allows you to align the text in the message system.
* @author biud436
* @help
* =============================================================================
* Usage
* -----------------------------------------------------------------------------
* That plugin is an addon, so it should be installed the plugin somewhere
* below 'YEP_MessageCore'.
*
* All text codes process before drawn the text.
* For each line you can set a different text alignment.
*
* \TA[0] - LEFT
* \TA[1] - CENTER
* \TA[2] - RIGHT
*
* When using Yanfly Message Core :
* - Do not use the text code like as 'px' and 'py'.
* - Do not use the wordwrapping.
*
* =============================================================================
* Change Log
* -----------------------------------------------------------------------------
* 2017.01.25 (v1.0.0) - First Release
* 2017.06.25 (v1.0.1) - Fixed an issue that resets a font setting at each line
* 2017.07.23 (v1.0.2) - Fixed a bug that the alignment is not processing in a newly line
* 2017.10.13 (v1.0.3) - Fixed the class name.
* 2018.05.09 (v1.0.4) - Added a variable that stores a last alignment value.
* 2018.07.09 (v1.0.5) :
* - Fixed the text padding for left, center, right alignment.
* - Now it is worked fine even without YEP Message Core.
* 2018.08.14 (v1.0.6) - Fixed the LF(line feed) and CR(carriage return)
*/

var Imported = Imported || {};
Imported.RS_MessageAlign = true;

(function() {

    //============================================================================
    // Game_Message
    //============================================================================

    var alias_Game_Message_clear = Game_Message.prototype.clear;
    Game_Message.prototype.clear = function() {
        alias_Game_Message_clear.call(this);
        this._align = [];
        this._alignLast = 0;
    };

    Game_Message.prototype.setAlign = function(n) {
        this._align = this._align || [];
        this._alignLast = n;
        this._align.push(n);
    };

    Game_Message.prototype.getAlign = function(n) {
        return this._align.shift() || this._alignLast;
    };

    //============================================================================
    // Window_Message
    //============================================================================

    var alias_Window_Message_convertEscapeCharacters = Window_Message.prototype.convertEscapeCharacters;
    Window_Message.prototype.convertEscapeCharacters = function(text) {
        text = alias_Window_Message_convertEscapeCharacters.call(this, text);
        text = text.replace(/\x1bTA\[(\d+)\]/gi, function() {
            $gameMessage.setAlign(Number(arguments[1] || 0));
            return "";
        }.bind(this));
        return text;
    };

    Window_Message.prototype.processAlign = function(textState) {
        textState = textState || this._textState;
        switch($gameMessage.getAlign()) {
            case 1:
            this.setAlignCenter(textState);
            break;
            case 2:
            this.setAlignRight(textState);
            break;
            default:
            this.setAlignLeft(textState);
        }
    }

    var alias_Window_Message_processNewLine = Window_Message.prototype.processNewLine;
    Window_Message.prototype.processNewLine = function(textState) {
        alias_Window_Message_processNewLine.call(this, textState);
        this.processAlign(textState);
    };

    if(!Imported.YEP_MessageCore) {

        Window_Message.prototype.saveFontSettings = function() {
            this._messageDesc = {};
            this._messageDesc.fontFace = this.contents.fontFace;
            this._messageDesc.fontSize = this.contents.fontSize;
            this._messageDesc.textColor = this.contents.textColor;
        };

        Window_Message.prototype.restoreFontSettings = function() {
            if(!this._messageDesc) return;
            this.contents.fontFace = this._messageDesc.fontFace;
            this.contents.fontSize = this._messageDesc.fontSize;
            this.contents.textColor = this._messageDesc.textColor;
            this._messageDesc = undefined;
        };

    }

    Window_Message.prototype.calcTextWidth = function(text) {

        var tempText = text; tempText = tempText.split(/[\r\n]+/);
        var textWidth;

        // This makes it easier to get the text width.
        // But it will be drawn the text many times inside invisible area.
        if(Imported.YEP_MessageCore) {

            textWidth = this.textWidthExCheck(tempText[0]);

        } else {

            this.saveFontSettings();
            textWidth = this.drawTextEx(tempText[0], 0, this.contents.height);
            this.restoreFontSettings();

        }

        return textWidth;

    };

    Window_Message.prototype.setAlignLeft = function(textState) {
        var padding = this.textPadding();
        textState.tx = this.calcTextWidth(textState.text.slice(textState.index));
        textState.x = ( this.newLineX() + padding );
        textState.left = textState.x;
    };

    Window_Message.prototype.setAlignCenter = function(textState) {
        var padding = this.textPadding();
        textState.tx = this.calcTextWidth(textState.text.slice(textState.index));
        textState.x = ( this.newLineX() + this.contentsWidth() + padding) / 2 - textState.tx / 2;
        textState.left = textState.x;
    };

    Window_Message.prototype.setAlignRight = function(textState) {
        var padding = this.textPadding();
        textState.tx = this.calcTextWidth(textState.text.slice(textState.index));
        textState.x = ( this.contentsWidth() - padding) - textState.tx;
        textState.left = textState.x;
    };

    var alias_Window_Message_startMessage_setAlignCenter = Window_Message.prototype.startMessage;
    Window_Message.prototype.startMessage = function() {
        alias_Window_Message_startMessage_setAlignCenter.call(this);
        this.processAlign();
    };

})();

repo_name: Rexhunk/karryn

license: unknown


code:
const REM_RESTORE_DIGIT_HUE = [10, 200, 10, 160];
const REM_RESTORE_DIGIT_DURATION = 280;
const REM_ENERGY_DIGIT_HUE = [255, 10, 10, 160];
const REM_ENERGY_DIGIT_DURATION = 280;
const REM_PLEASURE_DIGIT_HUE = [255, 70, 244, 160];
const REM_PLEASURE_DIGIT_DURATION = 280;

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

/////////
// Game Battler
////////////////

Game_Battler.prototype.startDamagePopup = function() {
    var result = this.result();
	if (result.hpAffected) {
      var copyResult = JsonEx.makeDeepCopy(result);
      copyResult.mpDamage = 0;
	  copyResult.tpDamage = 0;
      this._damagePopup.push(copyResult);
    }
    if (result.tpDamage !== 0) {
      var copyResult = JsonEx.makeDeepCopy(result);
      copyResult.hpAffected = false;
	  copyResult.mpDamage = 0;
      this._damagePopup.push(copyResult);
    }
    if (result.mpDamage !== 0) {
      var copyResult = JsonEx.makeDeepCopy(result);
      copyResult.hpAffected = false;
	   copyResult.tpDamage = 0;
      this._damagePopup.push(copyResult);
    }
};

///////////
// Sprite Damage
////////////////

//damage pop up push
Sprite_Damage.prototype.setup = function(target) {
    this._result = target.shiftDamagePopup();
	let result = this._result;
	let isSexualDamage = result.skillTypeEnemyPetting || result.skillTypeEnemySex || result.skillTypeEnemyBukkake || result.skillTypeEnemyTalk || result.skillTypeEnemySight;
	let isEnemySelfFeedback = target.isEnemy() && isSexualDamage;
	if(target.isActor() && isSexualDamage && !ConfigManager.remShowSexualDamagePopup) return;
	if(isEnemySelfFeedback) return;

	if (result.evaded) {
		this.createMiss();
	} else if (result.tpDamage !== 0 && result.mpDamage <= 0) {
		if(result.tpDamage < 0 && Math.round(target.getPercentOfOrgasmFromValue(-result.tpDamage)) !== 0) {
			let digitText = '';
			if(ConfigManager.displayPleasureAsPercent)
				digitText = target.getPercentOfOrgasmFromValue(-result.tpDamage);
			else
				digitText = -result.tpDamage;

			this.createDigits(2, digitText);
			if (result.critical) {
				this.setupPleasureEffect();
			}
		}
    } else if (result.hpAffected) {
		if(result.hpDamage < 0)
			this.createDigits(1, result.hpDamage);
		else if(result.hpDamage > 0 && target.hp > 0)
			this.createDigits(0, result.hpDamage);

		if (result.critical) {
			this.setupCriticalEffect();
		}
    } else if (result.mpDamage !== 0) {
		if(target.isActor()) {
			if(result.mpDamage < 0)
				this.createDigits(3, result.mpDamage);
			else if(result.mpDamage > 0) {
				this.createDigits(2, result.mpDamage);
				this.setupPleasureEffect();
			}
		}
    }
};

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

Sprite_Damage.prototype.setupRestoreEffect = function() {
    this._flashColor = REM_RESTORE_DIGIT_HUE.slice();
    this._flashDuration = REM_RESTORE_DIGIT_DURATION;
};
Sprite_Damage.prototype.setupEnergyEffect = function() {
    this._flashColor = REM_ENERGY_DIGIT_HUE.slice();
    this._flashDuration = REM_ENERGY_DIGIT_DURATION;
};
Sprite_Damage.prototype.setupPleasureEffect = function() {
    this._flashColor = REM_PLEASURE_DIGIT_HUE.slice();
    this._flashDuration = REM_PLEASURE_DIGIT_DURATION;
};

/////////
// BattleManager
/////////////////

BattleManager.actionDisplayAction = function() {
	if(this._targets) {
		this._logWindow.displayAction(this._subject, this._action.item(), this._targets[0]);
	}
	else
		this._logWindow.displayAction(this._subject, this._action.item());
    return false;
};

////////////
// Window BattleLog
/////////////////////

Window_BattleLog.prototype.displayAction = function(subject, item, target) {
    var numMethods = this._methods.length;
	var targetName = '';
	if(target) {
		targetName = target.displayName();
	}
    if (DataManager.isSkill(item)) {
		if(TextManager.isEnglish) {
			if(item.hasRemMessageEN[0]) {
				this.push('addText', item.remMessageEN[0].format(subject.displayName(),targetName));
			}
			else if (item.message1) {
				this.push('addText', subject.displayName() + item.message1.format(item.name));
			}
			if(item.hasRemMessageEN[1]) {
				this.push('addText', item.remMessageEN[1].format(subject.displayName(),targetName));
			}
			else if (item.message2) {
				this.push('addText', item.message2.format(item.name));
			}
		}
		else if(TextManager.isJapanese) {
			if(item.hasRemMessageJP[0]) {
				this.push('addText', item.remMessageJP[0].format(subject.displayName(),targetName));
			}
			else if (item.message1) {
				this.push('addText', subject.displayName() + item.message1.format(item.name));
			}
			if(item.hasRemMessageJP[1]) {
				this.push('addText', item.remMessageJP[1].format(subject.displayName(),targetName));
			}
			else if (item.message2) {
				this.push('addText', item.message2.format(item.name));
			}
		}
		else if(TextManager.isSChinese) {
			if(item.hasRemMessageSCH[0]) {
				this.push('addText', item.remMessageSCH[0].format(subject.displayName(),targetName));
			}
			else if (item.message1) {
				this.push('addText', subject.displayName() + item.message1.format(item.name));
			}
			if(item.hasRemMessageSCH[1]) {
				this.push('addText', item.remMessageSCH[1].format(subject.displayName(),targetName));
			}
			else if (item.message2) {
				this.push('addText', item.message2.format(item.name));
			}
		}
		else if(TextManager.isTChinese) {
			if(item.hasRemMessageTCH[0]) {
				this.push('addText', item.remMessageTCH[0].format(subject.displayName(),targetName));
			}
			else if (item.message1) {
				this.push('addText', subject.displayName() + item.message1.format(item.name));
			}
			if(item.hasRemMessageTCH[1]) {
				this.push('addText', item.remMessageTCH[1].format(subject.displayName(),targetName));
			}
			else if (item.message2) {
				this.push('addText', item.message2.format(item.name));
			}
		}
		else if(TextManager.isKorean) {
			if(item.hasRemMessageKR[0]) {
				this.push('addText', item.remMessageKR[0].format(subject.displayName(),targetName));
			}
			else if (item.message1) {
				this.push('addText', subject.displayName() + item.message1.format(item.name));
			}
			if(item.hasRemMessageKR[1]) {
				this.push('addText', item.remMessageKR[1].format(subject.displayName(),targetName));
			}
			else if (item.message2) {
				this.push('addText', item.message2.format(item.name));
			}
		}
    } else {
        this.push('addText', TextManager.useItem.format(subject.displayName(), item.name));
    }
    if (this._methods.length === numMethods) {
        this.push('wait');
    }
};

/////////
// Window Help
////////////

Window_Help.prototype.drawSpecialSelectionText = function(action) {
    var wx = 0;
    var wy = (this.contents.height - this.lineHeight()) / 2;
    var text = '';
    if (action.isForUser()) {
      text = TextManager.yanflyBattleCoreUser;
    } else if (action.isForRandom()) {
      BattleManager.startAllSelection();
      var fmt = TextManager.yanflyBattleCoreRandomTargets;
      if (action.isForOpponent() && action.numTargets() !== 1) {
        var target = TextManager.yanflyBattleCoreEnemies;
      } else if (action.isForOpponent() && action.numTargets() === 1) {
        var target = TextManager.yanflyBattleCoreEnemy;
      } else if (action.isForFriend() && action.numTargets() !== 1) {
        var target = TextManager.yanflyBattleCoreAllies;
      } else {
       var target = TextManager.yanflyBattleCoreAlly;
      }
      text = fmt.format(target, Yanfly.Util.toGroup(action.numTargets()));
    } else if (action.isForAll()) {
      BattleManager.startAllSelection();
      var fmt = TextManager.yanflyBattleCoreAllTargets;
      if (action.isForOpponent()) {
        var target = TextManager.yanflyBattleCoreEnemies;
      } else {
        var target = TextManager.yanflyBattleCoreAllies;
      }
      text = fmt.format(target);
    }
    this.drawText(text, wx, wy, REM_BHD_HELP_WIDTH, 'center');
};


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

//Prison level normal battle bgm
const BM_EB_BGM_NAME = "Battle1";
const BM_EB_BGM_VOLUME = 67;

//Level 1 Normal Battle BGM
const BM_PLVL1_NORMAL_BGM_NAME = "Battle1";
const BM_PLVL1_NORMAL_BGM_VOLUME = 62;
//Level 2 Normal Battle BGM
const BM_PLVL2_NORMAL_BGM_NAME = "Battle1";
const BM_PLVL2_NORMAL_BGM_VOLUME = 62;
//Level 3 Normal Battle BGM
const BM_PLVL3_NORMAL_BGM_NAME = "Battle5";
const BM_PLVL3_NORMAL_BGM_VOLUME = 67;
//Level 4 Normal Battle BGM
const BM_PLVL4_NORMAL_BGM_NAME = "Battle5";
const BM_PLVL4_NORMAL_BGM_VOLUME = 67;

//Prison level boss battle bgm
//Yasu Tutorial Battle
const BM_TUTORIAL_BGM_NAME = "S_Prologue2";
const BM_TUTORIAL_BGM_VOLUME = 80;
//Tonkin Battle
const BM_PLVL1_BOSS_BGM_NAME = "S_Prologue2";
const BM_PLVL1_BOSS_BGM_VOLUME = 80;
//Dr. Cargill Battle
const BM_PLVL2_BOSS_BGM_NAME = "Battle3";
const BM_PLVL2_BOSS_BGM_VOLUME = 85;
//Aron Battle -> アロン登場後
const BM_PLVL3_BOSS_START_BGM_NAME = "Battle3";
const BM_PLVL3_BOSS_START_BGM_VOLUME = 85;
const BM_PLVL3_BOSS_ARON_BGM_NAME = "Battle4";
const BM_PLVL3_BOSS_ARON_BGM_VOLUME = 80;

//enemy sex pose
const BM_ENEMY_SEX_BGM_NAME = "H_Gangbang1";
const BM_ENEMY_SEX_BGM_PAN = 0;
const BM_ENEMY_SEX_BGM_PITCH = 100;
const BM_ENEMY_SEX_BGM_VOLUME = 75;

//karryn sex pose
const BM_KARRYN_SEX_BGM_NAME = "H_Slut1";
const BM_KARRYN_SEX_BGM_PAN = 0;
const BM_KARRYN_SEX_BGM_PITCH = 100;
const BM_KARRYN_SEX_BGM_VOLUME = 80;

//waitress job
const BM_WAITRESS_JOB_BGM_NAME = "Job1";
const BM_WAITRESS_JOB_BGM_PAN = 0;
const BM_WAITRESS_JOB_BGM_PITCH = 100;
const BM_WAITRESS_JOB_BGM_VOLUME = 90;

//waitress sex
const BM_WAITRESS_SEX_BGM_NAME = "H_Job1";
const BM_WAITRESS_SEX_BGM_PAN = 0;
const BM_WAITRESS_SEX_BGM_PITCH = 100;
const BM_WAITRESS_SEX_BGM_VOLUME = 80;

//receptionist job
const BM_RECEPTIONIST_JOB_BGM_NAME = "Job1";
const BM_RECEPTIONIST_JOB_BGM_PAN = 0;
const BM_RECEPTIONIST_JOB_BGM_PITCH = 100;
const BM_RECEPTIONIST_JOB_BGM_VOLUME = 90;

const BM_RECEPTIONIST_SEX_BGM_NAME = "H_Job1";
const BM_RECEPTIONIST_SEX_BGM_PAN = 0;
const BM_RECEPTIONIST_SEX_BGM_PITCH = 100;
const BM_RECEPTIONIST_SEX_BGM_VOLUME = 80;

//glory hole
const BM_GLORY_START_BGM_NAME = "M_Sofa1";
const BM_GLORY_START_BGM_PAN = 0;
const BM_GLORY_START_BGM_PITCH = 100;
const BM_GLORY_START_BGM_VOLUME = 80;

const BM_GLORY_SEX_BGM_NAME = "H_Slut1";
const BM_GLORY_SEX_BGM_PAN = 0;
const BM_GLORY_SEX_BGM_PITCH = 100;
const BM_GLORY_SEX_BGM_VOLUME = 80;

//down pose - stamina
const BM_DOWN_STAMINA_BGM_NAME = "Down1";
const BM_DOWN_STAMINA_BGM_PAN = 0;
const BM_DOWN_STAMINA_BGM_PITCH = 100;
const BM_DOWN_STAMINA_BGM_VOLUME = 80;

const BM_DOWN_STAMINA_BGM_PITCH_CHANGE = -32; //unused
const BM_DOWN_STAMINA_BGM_VOLUME_CHANGE = 0; //unused

//down pose - other
const BM_DOWN_OTHER_BGM_NAME = "Down1";
const BM_DOWN_OTHER_BGM_PAN = 0;
const BM_DOWN_OTHER_BGM_PITCH = 70;
const BM_DOWN_OTHER_BGM_VOLUME = 80;

//defeated lvl 1 - normal
const BM_DEFEATED_LV1_NORMAL_BGM_NAME = "H_Defeated1";
const BM_DEFEATED_LV1_NORMAL_BGM_PAN = 0;
const BM_DEFEATED_LV1_NORMAL_BGM_PITCH = 100;
const BM_DEFEATED_LV1_NORMAL_BGM_VOLUME = 70;

//defeated lvl 1 - slutty
const BM_DEFEATED_LV1_SLUTTY_BGM_NAME = "H_Slut2";
const BM_DEFEATED_LV1_SLUTTY_BGM_PAN = 0;
const BM_DEFEATED_LV1_SLUTTY_BGM_PITCH = 100;
const BM_DEFEATED_LV1_SLUTTY_BGM_VOLUME = 80;

//defeated lvl 2 - normal
const BM_DEFEATED_LV2_NORMAL_BGM_NAME = "H_Defeated1";
const BM_DEFEATED_LV2_NORMAL_BGM_PAN = 0;
const BM_DEFEATED_LV2_NORMAL_BGM_PITCH = 100;
const BM_DEFEATED_LV2_NORMAL_BGM_VOLUME = 70;

//defeated lvl 2 - slutty
const BM_DEFEATED_LV2_SLUTTY_BGM_NAME = "H_Slut2";
const BM_DEFEATED_LV2_SLUTTY_BGM_PAN = 0;
const BM_DEFEATED_LV2_SLUTTY_BGM_PITCH = 100;
const BM_DEFEATED_LV2_SLUTTY_BGM_VOLUME = 80;

//defeated guard - normal
const BM_DEFEATED_GUARD_NORMAL_BGM_NAME = "H_Defeated1";
const BM_DEFEATED_GUARD_NORMAL_BGM_PAN = 0;
const BM_DEFEATED_GUARD_NORMAL_BGM_PITCH = 100;
const BM_DEFEATED_GUARD_NORMAL_BGM_VOLUME = 70;

//defeated guard - slutty
const BM_DEFEATED_GUARD_SLUTTY_BGM_NAME = "H_Slut2";
const BM_DEFEATED_GUARD_SLUTTY_BGM_PAN = 0;
const BM_DEFEATED_GUARD_SLUTTY_BGM_PITCH = 100;
const BM_DEFEATED_GUARD_SLUTTY_BGM_VOLUME = 80;

//masturbation battle bgm
const BM_MAS_BGM_NAME = "M_Sofa1";
const BM_MAS_BGM_VOLUME = 80;

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

///////////
///////////////
// Battle Manager
////////////////
/////////////

//Cast Animation
BattleManager.actionCastAnimation = function() {
  if(!this._action.isAttack() && !this._action.isGuard() &&
  this._action.isSkill()) {
    if(this._action.item().castAnimation > 0 && (!this._subject._tagDontDrawImage && !Karryn.isInShowEnemyImageOnlyDuringValidSelectionPose())) {
      var ani = $dataAnimations[this._action.item().castAnimation]
      this._logWindow.showAnimation(this._subject, [this._subject],
        this._action.item().castAnimation);
    }
  }
  return true;
};

//Can Escape
BattleManager.canEscape = function() {
    return (this._canEscape && $gameActors.actor(ACTOR_KARRYN_ID).canEscape());
};

// Also called in pre battle common event
BattleManager.setBMAllowTachieUpdate = function(allow) {
	$gameParty._allowTachieUpdate = allow;
	if(this.isTachieUpdateAllowed()) {
		var group = $gameParty.members();
		for(var i = 0; i < group.length; i++) {
			var actor = group[i];
			if(!actor) { continue; }
			actor.setCacheChanged();
		}
	}
};

BattleManager.isTachieUpdateAllowed = function() {
	return $gameParty._allowTachieUpdate;
};

BattleManager.setEnemySneakAttackBattle = function() {
	$gameSwitches.setValue(SWITCH_ENEMY_SNEAK_ATTACK_ID, true);
};

////////
// Battle BGM
//////////////

Remtairy.BM.BattleManager_initMembers = BattleManager.initMembers;
BattleManager.initMembers = function() {
    Remtairy.BM.BattleManager_initMembers.call(this);
	this._playingSpecialBgm = false;
	this._playingDownBgmChange = false;
	this._normalBgm = null;
};

BattleManager.playBattleBgm = function() {
	let bgmName = BM_EB_BGM_NAME;
	let bgmVolume = BM_EB_BGM_VOLUME;
	let bgmPan = 0;
	let bgmPitch = 100;
	let mapId = $gameMap._mapId;

	if(Karryn.isInMasturbationPose()) {
		bgmName = BM_MAS_BGM_NAME;
		bgmVolume = BM_MAS_BGM_VOLUME;
	}
	else if(Karryn.isInDefeatedPose()) {
		let useSluttyDefeatedVersion = Karryn.getReactionScore() >= VAR_DEF_RS_LV3_REQ;

		if(Karryn.isInDefeatedLevel1Pose()) {
			if(useSluttyDefeatedVersion) {
				bgmName = BM_DEFEATED_LV1_SLUTTY_BGM_NAME;
				bgmPitch = BM_DEFEATED_LV1_SLUTTY_BGM_PITCH;
				bgmPan = BM_DEFEATED_LV1_SLUTTY_BGM_PAN;
				bgmVolume = BM_DEFEATED_LV1_SLUTTY_BGM_VOLUME;
			}
			else {
				bgmName = BM_DEFEATED_LV1_NORMAL_BGM_NAME;
				bgmPitch = BM_DEFEATED_LV1_NORMAL_BGM_PITCH;
				bgmPan = BM_DEFEATED_LV1_NORMAL_BGM_PAN;
				bgmVolume = BM_DEFEATED_LV1_NORMAL_BGM_VOLUME;
			}
		}
		else if(Karryn.isInDefeatedLevel2Pose()) {
			if(useSluttyDefeatedVersion) {
				bgmName = BM_DEFEATED_LV2_SLUTTY_BGM_NAME;
				bgmPitch = BM_DEFEATED_LV2_SLUTTY_BGM_PITCH;
				bgmPan = BM_DEFEATED_LV2_SLUTTY_BGM_PAN;
				bgmVolume = BM_DEFEATED_LV2_SLUTTY_BGM_VOLUME;
			}
			else {
				bgmName = BM_DEFEATED_LV2_NORMAL_BGM_NAME;
				bgmPitch = BM_DEFEATED_LV2_NORMAL_BGM_PITCH;
				bgmPan = BM_DEFEATED_LV2_NORMAL_BGM_PAN;
				bgmVolume = BM_DEFEATED_LV2_NORMAL_BGM_VOLUME;
			}
		}
		else if(Karryn.isInDefeatedGuardPose()) {
			if(useSluttyDefeatedVersion) {
				bgmName = BM_DEFEATED_GUARD_SLUTTY_BGM_NAME;
				bgmPitch = BM_DEFEATED_GUARD_SLUTTY_BGM_PITCH;
				bgmPan = BM_DEFEATED_GUARD_SLUTTY_BGM_PAN;
				bgmVolume = BM_DEFEATED_GUARD_SLUTTY_BGM_VOLUME;
			}
			else {
				bgmName = BM_DEFEATED_GUARD_NORMAL_BGM_NAME;
				bgmPitch = BM_DEFEATED_GUARD_NORMAL_BGM_PITCH;
				bgmPan = BM_DEFEATED_GUARD_NORMAL_BGM_PAN;
				bgmVolume = BM_DEFEATED_GUARD_NORMAL_BGM_VOLUME;
			}
		}
		else {
			bgmName = BM_ENEMY_SEX_BGM_NAME;
			bgmVolume = BM_ENEMY_SEX_BGM_VOLUME;
		}
	}
	else if(Karryn.isInWaitressServingPose()) {
		bgmName = BM_WAITRESS_JOB_BGM_NAME;
		bgmPitch = BM_WAITRESS_JOB_BGM_PITCH;
		bgmPan = BM_WAITRESS_JOB_BGM_PAN;
		bgmVolume = BM_WAITRESS_JOB_BGM_VOLUME;
	}
	else if(Karryn.isInWaitressSexPose()) {
		bgmName = BM_WAITRESS_SEX_BGM_NAME;
		bgmPitch = BM_WAITRESS_SEX_BGM_PITCH;
		bgmPan = BM_WAITRESS_SEX_BGM_PAN;
		bgmVolume = BM_WAITRESS_SEX_BGM_VOLUME;
	}
	else if(Karryn.isInReceptionistPose()) {
		bgmName = BM_RECEPTIONIST_JOB_BGM_NAME;
		bgmPitch = BM_RECEPTIONIST_JOB_BGM_PITCH;
		bgmPan = BM_RECEPTIONIST_JOB_BGM_PAN;
		bgmVolume = BM_RECEPTIONIST_JOB_BGM_VOLUME;
	}
	else if($gameParty.isInGloryBattle) {
		bgmName = BM_GLORY_START_BGM_NAME;
		bgmPitch = BM_GLORY_START_BGM_PITCH;
		bgmPan = BM_GLORY_START_BGM_PAN;
		bgmVolume = BM_GLORY_START_BGM_VOLUME;
	}

	else {
		if(mapId === MAP_ID_KARRYN_OFFICE && $gameVariables.value(VARIABLE_PROLOGUE_PROGRESS_ID) === 5 && !$gameSwitches.value(SWITCH_PROLOGUE_ENDED)) {
			bgmName = BM_TUTORIAL_BGM_NAME;
			bgmVolume = BM_TUTORIAL_BGM_VOLUME;
		}
		else if(Prison.currentlyPrisonLevelOne()) {
			bgmName = BM_PLVL1_NORMAL_BGM_NAME;
			bgmVolume = BM_PLVL1_NORMAL_BGM_VOLUME;

			if(mapId === MAP_ID_RECEPTION && ($gameTroop._troopId === 67 || $gameTroop._troopId === 68)) {
				bgmName = BM_PLVL1_BOSS_BGM_NAME;
				bgmVolume = BM_PLVL1_BOSS_BGM_VOLUME;
			}
		}
		else if(Prison.currentlyPrisonLevelTwo()) {
			bgmName = BM_PLVL2_NORMAL_BGM_NAME;
			bgmVolume = BM_PLVL2_NORMAL_BGM_VOLUME;

			if(mapId === MAP_ID_OFFICE_FLOODED && $gameTroop._troopId === 91) {
				bgmName = BM_PLVL2_BOSS_BGM_NAME;
				bgmVolume = BM_PLVL2_BOSS_BGM_VOLUME;
			}
		}
		else if(Prison.currentlyPrisonLevelThree()) {
			bgmName = BM_PLVL3_NORMAL_BGM_NAME;
			bgmVolume = BM_PLVL3_NORMAL_BGM_VOLUME;

			if(mapId === MAP_ID_COMMON_AREA_NORTH_EAST) {
				if($gameTroop._troopId === 142 && $gameTroop._aronAppeared) {
					bgmName = BM_PLVL3_BOSS_ARON_BGM_NAME;
					bgmVolume = BM_PLVL3_BOSS_ARON_BGM_VOLUME;
				}
				else if($gameTroop._troopId === 141 || ($gameTroop._troopId === 142 && !$gameTroop._aronAppeared)){
					bgmName = BM_PLVL3_BOSS_START_BGM_NAME;
					bgmVolume = BM_PLVL3_BOSS_START_BGM_VOLUME;

				}
			}

		}
		else if(Prison.currentlyPrisonLevelFour()) {
			bgmName = BM_PLVL4_NORMAL_BGM_NAME;
			bgmVolume = BM_PLVL4_NORMAL_BGM_VOLUME;

		}
	}

	AudioManager.playBgm({name:bgmName, pan:bgmPan, pitch:bgmPitch, pos:0, volume:bgmVolume});
    AudioManager.stopBgs();
};

BattleManager.playNormalBgm = function() {
    if(this._playingSpecialBgm) {
        AudioManager.replayBgm(this._normalBgm);
		AudioManager.stopBgs();
		this._playingSpecialBgm = false;
	}
	else if(this._playingDownBgmChange) {
		let updateBgm = AudioManager.saveBgm();
		updateBgm.pitch = updateBgm.pitch - BM_DOWN_STAMINA_BGM_PITCH_CHANGE;
		updateBgm.volume = updateBgm.volume - BM_DOWN_STAMINA_BGM_VOLUME_CHANGE;
		AudioManager.playBgm(updateBgm, updateBgm.pos);
		this._playingDownBgmChange = false;
	}
};

//unused
BattleManager.playDownStaminaBgmChange = function() {
    if(!this._playingSpecialBgm && !this._playingDownBgmChange) {
        let updateBgm = AudioManager.saveBgm();
		updateBgm.pitch = updateBgm.pitch + BM_DOWN_STAMINA_BGM_PITCH_CHANGE;
		updateBgm.volume = updateBgm.volume + BM_DOWN_STAMINA_BGM_VOLUME_CHANGE;
		AudioManager.playBgm(updateBgm, updateBgm.pos);

		this._playingDownBgmChange = true;
	}
};

BattleManager.playSpecialBgm_EnemySex = function() {
	if(!this._playingSpecialBgm) {
		this._normalBgm = AudioManager.saveBgm();
		if(this._playingDownBgmChange) {
			this._normalBgm.pitch = this._normalBgm.pitch - BM_DOWN_STAMINA_BGM_PITCH_CHANGE;
			this._normalBgm.volume = this._normalBgm.volume - BM_DOWN_STAMINA_BGM_VOLUME_CHANGE;
			this._playingDownBgmChange = false;
		}
	}
    AudioManager.playBgm({name:BM_ENEMY_SEX_BGM_NAME, pan:BM_ENEMY_SEX_BGM_PAN, pitch:BM_ENEMY_SEX_BGM_PITCH, pos:0, volume: BM_ENEMY_SEX_BGM_VOLUME});
	AudioManager.stopBgs();
	this._playingSpecialBgm = true;
};

BattleManager.playSpecialBgm_KarrynSex = function() {
	if(!this._playingSpecialBgm) {
		this._normalBgm = AudioManager.saveBgm();
		if(this._playingDownBgmChange) {
			this._normalBgm.pitch = this._normalBgm.pitch - BM_DOWN_STAMINA_BGM_PITCH_CHANGE;
			this._normalBgm.volume = this._normalBgm.volume - BM_DOWN_STAMINA_BGM_VOLUME_CHANGE;
			this._playingDownBgmChange = false;
		}
	}
    AudioManager.playBgm({name:BM_KARRYN_SEX_BGM_NAME, pan:BM_KARRYN_SEX_BGM_PAN, pitch:BM_KARRYN_SEX_BGM_PITCH, pos:0, volume: BM_KARRYN_SEX_BGM_VOLUME});
	AudioManager.stopBgs();
	this._playingSpecialBgm = true;
};

BattleManager.playSpecialBgm_DownStamina = function() {
	if(!this._playingSpecialBgm) {
		this._normalBgm = AudioManager.saveBgm();
		if(this._playingDownBgmChange) {
			this._normalBgm.pitch = this._normalBgm.pitch - BM_DOWN_STAMINA_BGM_PITCH_CHANGE;
			this._normalBgm.volume = this._normalBgm.volume - BM_DOWN_STAMINA_BGM_VOLUME_CHANGE;
			this._playingDownBgmChange = false;
		}
	}
    AudioManager.playBgm({name:BM_DOWN_STAMINA_BGM_NAME, pan:BM_DOWN_STAMINA_BGM_PAN, pitch:BM_DOWN_STAMINA_BGM_PITCH, pos:0, volume: BM_DOWN_STAMINA_BGM_VOLUME});
	AudioManager.stopBgs();
	this._playingSpecialBgm = true;
};

BattleManager.playSpecialBgm_DownOther = function() {
	if(!this._playingSpecialBgm) {
		this._normalBgm = AudioManager.saveBgm();
		if(this._playingDownBgmChange) {
			this._normalBgm.pitch = this._normalBgm.pitch - BM_DOWN_STAMINA_BGM_PITCH_CHANGE;
			this._normalBgm.volume = this._normalBgm.volume - BM_DOWN_STAMINA_BGM_VOLUME_CHANGE;
			this._playingDownBgmChange = false;
		}
	}
    AudioManager.playBgm({name:BM_DOWN_OTHER_BGM_NAME, pan:BM_DOWN_OTHER_BGM_PAN, pitch:BM_DOWN_OTHER_BGM_PITCH, pos:0, volume: BM_DOWN_OTHER_BGM_VOLUME});
	AudioManager.stopBgs();
	this._playingSpecialBgm = true;
};

BattleManager.playSpecialBgm_WaitressSex = function() {
	if(!this._playingSpecialBgm) {
		this._normalBgm = AudioManager.saveBgm();
		if(this._playingDownBgmChange) {
			//this._normalBgm.pitch = this._normalBgm.pitch - BM_DOWN_STAMINA_BGM_PITCH_CHANGE;
			//this._normalBgm.volume = this._normalBgm.volume - BM_DOWN_STAMINA_BGM_VOLUME_CHANGE;
			this._playingDownBgmChange = false;
		}
	}
    AudioManager.playBgm({name:BM_WAITRESS_SEX_BGM_NAME, pan:BM_WAITRESS_SEX_BGM_PAN, pitch:BM_WAITRESS_SEX_BGM_PITCH, pos:0, volume: BM_WAITRESS_SEX_BGM_VOLUME});
	AudioManager.stopBgs();
	this._playingSpecialBgm = true;
};

BattleManager.playSpecialBgm_ReceptionistSex = function() {
	if(!this._playingSpecialBgm) {
		this._normalBgm = AudioManager.saveBgm();
		if(this._playingDownBgmChange) {
			//this._normalBgm.pitch = this._normalBgm.pitch - BM_DOWN_STAMINA_BGM_PITCH_CHANGE;
			//this._normalBgm.volume = this._normalBgm.volume - BM_DOWN_STAMINA_BGM_VOLUME_CHANGE;
			this._playingDownBgmChange = false;
		}
	}
    AudioManager.playBgm({name:BM_RECEPTIONIST_SEX_BGM_NAME, pan:BM_RECEPTIONIST_SEX_BGM_PAN, pitch:BM_RECEPTIONIST_SEX_BGM_PITCH, pos:0, volume: BM_RECEPTIONIST_SEX_BGM_VOLUME});
	AudioManager.stopBgs();
	this._playingSpecialBgm = true;
};

BattleManager.playSpecialBgm_GlorySex = function() {
	if(!this._playingSpecialBgm) {
		this._normalBgm = AudioManager.saveBgm();
		if(this._playingDownBgmChange) {
			//this._normalBgm.pitch = this._normalBgm.pitch - BM_DOWN_STAMINA_BGM_PITCH_CHANGE;
			//this._normalBgm.volume = this._normalBgm.volume - BM_DOWN_STAMINA_BGM_VOLUME_CHANGE;
			this._playingDownBgmChange = false;
		}
	}
    AudioManager.playBgm({name:BM_GLORY_SEX_BGM_NAME, pan:BM_GLORY_SEX_BGM_PAN, pitch:BM_GLORY_SEX_BGM_PITCH, pos:0, volume: BM_GLORY_SEX_BGM_VOLUME});
	AudioManager.stopBgs();
	this._playingSpecialBgm = true;
};

BattleManager.playBossBgm_AronAppears = function() {
    AudioManager.playBgm({name:BM_PLVL3_BOSS_ARON_BGM_NAME, pan:0, pitch:100, pos:0, volume: BM_PLVL3_BOSS_ARON_BGM_VOLUME});
	AudioManager.stopBgs();
};

///////////
// Pull Out Enemy
/////////////////

BattleManager.pullOutAllEnemies = function() {
	let actor = $gameActors.actor(ACTOR_KARRYN_ID);
	actor.setAllowTachieUpdate(false);
	//every alive & dead enemy call pullout
	let enemies = $gameTroop.aliveMembers();
	for (let i = 0; i < enemies.length; ++i) {
		this.pullOutEnemy(enemies[i]);
    }
	enemies = $gameTroop.deadMembers();
	for (let i = 0; i < enemies.length; ++i) {
		this.pullOutEnemy(enemies[i]);
    }

	actor.setPostSexPose();
	actor.setAllowTachieUpdate(true);
};

BattleManager.pullOutEnemy = function(enemy) {
	if(!enemy.isInAPose()) return;
	let actor = enemy.getPoseSkillTarget();

	//Karryn first needs to uninsert ungrope untoy everything the enemy is doing
	//actor.setAllowTachieUpdate(false);
	this.removeEnemyPettedStatus(enemy, actor);
	this.removeEnemyToyStatus(enemy, actor);
	this.removeEnemyPenisStatus(enemy, actor);

	//enemy's using body slot needs to be reset
	enemy.resetUsingBodySlot();
	//set enemy pose status to none
	enemy.resetPoseStatus();
	//reset all self sex targets
	enemy.resetAllTargetsForSex();
	//reset custom enemy sprite
	enemy.setCustomEnemySprite(false);
	//remove all sex pose states
	enemy.removeAllSexPoseStates();
	//reset orgasm skills
	enemy.resetOrgasmSkills();
	//reset can be kissed
	enemy.setCanBeKissed(true);

	//actor.setAllowTachieUpdate(true);
};

BattleManager.removeEnemyPettedStatus = function(enemy, actor) {
	if(enemy.isUsingBodySlotAnus(MOUTH_ID)) {
		actor.setMouthRimming(false);
		actor.disableRimjobPoseSkills();
	}
	if(enemy.isUsingBodySlotPenis(CLIT_ID)) {
		actor.setPussyCunni(false);
	}
	actor.setKissedChange(false, this);
};
BattleManager.removeEnemyToyStatus = function(enemy, actor) {

};
BattleManager.removeEnemyPenisStatus = function(enemy, actor) {
	if(enemy.isUsingBodySlotPenis(MOUTH_ID)) {
		actor.disableBlowjobPoseSkills();
		actor.setMouthInserted(false);
	}
	if(enemy.isUsingBodySlotPenis(RIGHT_HAND_ID)) {
		actor.disableRightHandjobPoseSkills();
		actor.setRightHandInserted(false);
	}
	if(enemy.isUsingBodySlotPenis(LEFT_HAND_ID)) {
		actor.disableLeftHandjobPoseSkills();
		actor.setLeftHandInserted(false);
	}
	if(enemy.isUsingBodySlotPenis(BOOBS_ID)) {
		actor.disableTittyFuckPoseSkills();
		actor.setBoobsInserted(false);
	}
	if(enemy.isUsingBodySlotPenis(PUSSY_ID)) {
		actor.disablePussySexPoseSkills();
		actor.setPussyInserted(false);
	}
	if(enemy.isUsingBodySlotPenis(ANAL_ID)) {
		actor.disableAnalSexPoseSkills();
		actor.setAnalInserted(false);
	}
	if(enemy.isUsingBodySlotPenis(FEET_ID)) {
		actor.disableFootjobPoseSkills();
		actor.setFeetInserted(false);
	}

	if(enemy.isUsingBodySlotPenis(OTHER_1_ID)) {
		actor.setOther1Inserted(false);
	}
	if(enemy.isUsingBodySlotPenis(OTHER_2_ID)) {
		actor.setOther2Inserted(false);
	}
	if(enemy.isUsingBodySlotPenis(OTHER_3_ID)) {
		actor.setOther3Inserted(false);
	}
	if(enemy.isUsingBodySlotPenis(OTHER_4_ID)) {
		actor.setOther4Inserted(false);
	}
};

/////////
// Swap Master
////////////

BattleManager.swappedPoseMaster = function(leavingMaster) {
	let poseMasterSkillID = leavingMaster.getPoseMasterSkillID();

	if(poseMasterSkillID === SKILL_ENEMY_POSESTART_STANDINGHJ_ID || poseMasterSkillID === SKILL_ENEMY_POSESTART_FOOTJOB_ID || poseMasterSkillID === SKILL_ENEMY_POSESTART_SLIMEPILEDRIVER_ID)
		return false;

	let target = $gameActors.actor(ACTOR_KARRYN_ID);
	let eligibleMasters = this.eligibleEnemyReplacementMasters(leavingMaster);
	let success = false;

	if(eligibleMasters.length > 0) {
		let ran = Math.randomInt(eligibleMasters.length);
		let newMaster = eligibleMasters[ran];
		target._dontResetSexPose = true;
		this.pullOutEnemy(leavingMaster);
		this.pullOutEnemy(newMaster);
		newMaster.useAISkill(poseMasterSkillID, target);
		newMaster.setUsedSkillThisTurn(true);
		success = true;
	}

	return success
};

BattleManager.eligibleEnemyReplacementMasters  = function(leavingMaster) {
	let poseMasterSkillID = leavingMaster.getPoseMasterSkillID();
	let target = $gameActors.actor(ACTOR_KARRYN_ID);
	let enemies = $gameTroop.aliveMembers();
	let eligibleMasters = [];
	for (let i = 0; i < enemies.length; ++i) {
		let enemy = enemies[i];

		if(!enemy.usedSkillThisTurn() && enemy._aiPoseStartSkills && enemy.isErect
		&& enemy._aiPoseStartSkills.includes(poseMasterSkillID)) {
			eligibleMasters.push(enemy);
		}
    }
	return eligibleMasters;
};

/////////////
// End of All Turns
/////////////////

BattleManager.updateTurn = function() {
    $gameParty.requestMotionRefresh();
    if (!this._subject) {
        this._subject = this.getNextSubject();
    }
	if (!this._subject) {
       //this.preEndTurnManagement();
    }
    if (this._subject) {
        this.processTurn();
    } else {
		//this.setBMAllowTachieUpdate(true);
		//this.preEndTurnManagement();
        this.endTurn();
		this.refreshAllBattlerPoses();
    }
};

Remtairy.BM.BattleManager_invokeAction = BattleManager.invokeAction;
BattleManager.invokeAction = function(subject, target) {
	Remtairy.BM.BattleManager_invokeAction.call(this, subject, target);

	if(target.isActor()) {
		subject.checkForOrgasm();
		target.checkForOrgasm();
	}
	else {
		target.checkForOrgasm();
		subject.checkForOrgasm();
	}
};

// End of Turn Functions
//Unused
BattleManager.preEndTurnManagement = function() {
	this.checkForEnemiesOrgasm();
	this.checkForPartyOrgasm();
	this.refreshAllBattlerPoses();
};

//Enemies
//Unused
BattleManager.checkForEnemiesOrgasm = function() {
	let group = $gameTroop.aliveMembers();
	for(let i = 0; i < group.length; i++) {
		let enemy = group[i];
		if(!enemy) continue;
		if(enemy.reachedOrgasmPoint()) {
			this.setBMAllowTachieUpdate(false);
			enemy.orgasm();
		}
	}
};

//Party
//Unused
BattleManager.checkForPartyOrgasm = function() {
	var group = $gameParty.members();
	for(var i = 0; i < group.length; i++) {
		var actor = group[i];
		if(!actor) { continue; }
		if(actor.reachedOrgasmPoint()) {
			this.setBMAllowTachieUpdate(false);
			actor.orgasm();
		}
	}
};

BattleManager.removeImmortalStateFromEveryone = function() {
	let group = $gameTroop.aliveMembers();
	for(let i = 0; i < group.length; i++) {
		group[i].removeImmortal();
	}
	group = $gameParty.aliveMembers();
	for(let i = 0; i < group.length; i++) {
		group[i].removeImmortal();
	}
};

/////////
// End Of Every Action
////////////

Remtairy.BM.BattleManager_endAction = BattleManager.endAction;
BattleManager.endAction = function() {
    Remtairy.BM.BattleManager_endAction.call(this);
	this.refreshAllBattlerPoses();
	//this.resetAllSpriteBattlerPos();
};

BattleManager.refreshAllBattlerPoses = function() {
	for(var i = 0; i < $gameParty.members().length; i++) {
		if(!$gameParty.members()[i]) { continue; }
		$gameParty.members()[i].refreshPose();
	}
};

//unused
BattleManager.resetAllSpriteBattlerPos = function() {
	for(var i = 0; i < $gameParty.members().length; i++) {
		if(!$gameParty.members()[i]) { continue; }
		$gameParty.members()[i].resetSpriteBattlerPos();
	}
};

////////
// Battle Start
////////////

// Display Start Messages
Remtairy.BM.BattleManager_displayStartMessages = BattleManager.displayStartMessages;
BattleManager.displayStartMessages = function() {
	Remtairy.BM.BattleManager_displayStartMessages.call(this);

	let actor = $gameActors.actor(ACTOR_KARRYN_ID);
	if(actor._startOfInvasionBattle) {
		BattleManager._logWindow.push('addText', TextManager.invasionBattleStart);
		BattleManager.actionRemLines(KARRYN_LINE_INVASION_BATTLE_START);
		actor._startOfInvasionBattle = false;
	}

};

//////////
///////////////
// Game Action
/////////////////
///////////

Game_Action.prototype.isActorAttackSkill = function() {
    if (this.isSkill()) {
        return this.item().hasTag(TAG_ACTOR_ATTACK_SKILL);
    } else {
        return false;
    }
};

Game_Action.prototype.isActorSexSkill = function() {
    if (this.isSkill()) {
        return this.item().hasTag(TAG_ACTOR_SEX_SKILL);
    } else {
        return false;
    }
};

Game_Action.prototype.isKickSkill = function() {
    if (this.isSkill()) {
        return this.item().hasTag(TAG_KICK_SKILL);
    } else {
        return false;
    }
};

Game_Action.prototype.isActorCombatStanceSkill = function() {
    if (this.isSkill()) {
        let skillId = this._item._itemId;

		//for testing empty attack skillIds
		//console.log(skillId);

		return skillId === SKILL_CAUTIOUS_STANCE_ID || skillId === SKILL_DEFENSIVE_STANCE_ID || skillId === SKILL_COUNTER_STANCE_ID;
    } else {
        return false;
    }
};

Game_Action.prototype.isActorSexStanceSkill = function() {
    if (this.isSkill()) {
        let skillId = this._item._itemId;
		return skillId === SKILL_ENDURE_PLEASURE_ID || skillId === SKILL_WAIT_OUT_PLEASURE_ID || skillId === SKILL_OPEN_PLEASURE_ID;

    } else {
        return false;
    }
};

Game_Action.prototype.isActorWillpowerSkill = function() {
    if (this.isSkill()) {
        let skillId = this._item._itemId;
		return (skillId >= WILLPOWER_SKILL_START && skillId <= WILLPOWER_SKILL_END);
    } else {
        return false;
    }
};

Game_Action.prototype.isEnemyAttackSkill = function() {
    if (this.isSkill()) {
        return this.item().hasTag(TAG_ENEMY_ATTACK_SKILL);
    } else {
        return false;
    }
};

Game_Action.prototype.isEndMentalPhaseSkill = function() {
    if (this.isSkill()) {
        let skillId = this._item._itemId;
		return skillId === SKILL_END_MENTAL_PHASE_ID;
    } else {
        return false;
    }
};

Game_Action.prototype.targetsForOpponents = function() {
    let targets = [];
    let unit = this.opponentsUnit();

    if(this.isForRandom()) {
        for (let i = 0; i < this.numTargets(); i++) {
            targets.push(unit.randomTarget());
        }
    } else if (this.isForOne()) {
        if(this._targetIndex < 0) {
            targets.push(unit.randomTarget());
        }
		else if(this.isActorSexSkill()) {
			targets.push(unit.members()[this._targetIndex]);
		}
		else {
            targets.push(unit.smoothTarget(this._targetIndex));
        }
    } else {
        targets = unit.aliveMembers();
    }
    return targets;
};

Game_Action.prototype.executeMpDamage = function(target, value) {
    if (!this.isMpRecover()) {
        value = Math.min(target.mp, value);
    }
    if (value !== 0 || this.item().hasTag(TAG_FEMALE_ORGASM_SKILL)) {
        this.makeSuccess(target);
    }
    target.gainMp(-value);
    this.gainDrainedMp(value);
};

//////////
// Game Actor
////////////

Game_Actor.prototype.clearBattleSkillsFlags = function() {
	this.resetEnergyCosts();
	this.resetWillpowerCosts();
	this._isCurrentlyUsingSkewer = false;
};

Remtairy.BM.Game_Actor_performAction = Game_Actor.prototype.performAction;
Game_Actor.prototype.performAction = function(action) {
	Remtairy.BM.Game_Actor_performAction.call(this, action);

};

///////////////////
//////////////////////
// Battle Results
///////////////////////
/////////////////////

BattleManager.initVictoryData = function() {
    this._victoryPhase = false;
	this._victoryType = -1;
    this._victoryCheerWait = 0;
    this._victoryStep = 0;
};

BattleManager.onStartOfConBat = function() {
	var group = $gameParty.members();
	for(var i = 0; i < group.length; i++) {
		var actor = group[i];
		if(!actor) { continue; }
		actor.onStartOfConBat();
	}
};

BattleManager.displayEscapeSuccessMessage = function() {
	return;
};

BattleManager.processVictory = function() {
	if(this.isConsBattle()) {
		$gameSwitches.setValue(SWITCH_HIDE_STATE_ICONS_ID, true);
	    this.prepareConBat();
		this.onStartOfConBat();
		return;
	}
	this.getDataRewardsCB();

    $gameParty.performVictory();
    if (this.isVictoryPhase()) return;
    if (this._windowLayer) this._windowLayer.x = 0;
    $gameParty.removeBattleStates();
    this._victoryPhase = true;
	this._victoryType = 0;
    if(!$gameSystem.skipVictoryAftermath()) {
		if(!$gameSystem.skipVictoryMusic() && !Karryn.isInJobPose())
			this.playVictoryMe();
		//$gameParty.gainOrderFromVictory();
		this.processNormalVictory();
    }
};

BattleManager.processNormalVictory = function() {
    this.makeRewards();
	this.makeExpResults();
	//$gameParty.calculateParamLvlsGained();
	//$gameParty.calculateMainLvlsGained();
	$gameParty.applyEndOfBattleSpecial();
	$gameParty.applyFatigueResults();
	$gameParty.applyOrderResults();
	$gameParty.checkForNewPassives();
    this.startVictoryPhase();
};

BattleManager.makeRewards = function() {
    this._rewards = {};
    this._rewards.exp = $gameTroop.expTotal();
    this._rewards.items = $gameTroop.makeDropItems();

	//Gold stuff
	this._rewards.gold = 0;
	//Gold bounty
	if($gameParty._fullGoldRewardsFlag) {
		this._rewards.gold = $gameTroop.goldTotal();
	}
	//Half gold
	if($gameParty._halfGoldRewardsFlag)
		this._rewards.gold = $gameTroop.goldTotal() * 0.5;
	//Extra gold
	if($gameParty._extraGoldReward > 0)
		this._rewards.gold += $gameParty._extraGoldReward;
	if(this._rewards.gold > 0)
		this._rewards.gold += Math.random() * this._rewards.gold * 0.1;
	this._rewards.gold = Math.round(this._rewards.gold);
};

BattleManager.makeExpResults = function() {
	let actor = $gameActors.actor(ACTOR_KARRYN_ID);
	//let total = this._rewards.exp;
	//total += Math.round(actor._totalParamExpGained);
	//this._rewards.exp = total;
	this._rewards.exp = 0;
};

///////////
// check Battle End
/////////////////

BattleManager.checkBattleEnd = function() {
	if (this._phase === 'actionList') return false;
    if (this._phase === 'actionTargetList') return false;
    if (this._phase === 'action') return false;
    if (this._phase === 'phaseChange') return false;
    if ($gameTroop.isEventRunning()) return false;

    if(this._phase) {
		if(Karryn.isInJobPose()) {
			return this.checkBattleEndJobs();
		}

		if(Karryn.isInDefeatedPose() && (!ConfigManager.shorterDefeatBattles || Prison.hardMode())) {
			if($gameTroop.isAllDead()) {
				if(Karryn.hasNoStamina() && Karryn.hasNoEnergy()) {
					this.processDefeat();
					return true;
				}
				this.processVictory();
				return true;
			}
			return false;
		}

        if (this.checkAbort()) {
            return true;
        }
		else if ($gameParty.isAllDead()) {
            this.processDefeat();
            return true;
        } else if ($gameTroop.isAllDead()) {
            this.processVictory();
            return true;
        }
    }
    return false;
};

BattleManager.checkBattleEndJobs = function() {
	let actor = $gameActors.actor(ACTOR_KARRYN_ID);
	if(Karryn.isInWaitressServingPose()) {
		if($gameParty.waitressBattle_getCurrentTimeInSeconds() >= $gameParty._waitressBattle_timeLimit) {
			this.processVictory();
            return true;
		}
		else if($gameParty.isAllDead()) {
            this.processDefeat();
            return true;
		}
	}
	else if(Karryn.isInReceptionistPose()) {
		if($gameParty.receptionistBattle_getCurrentTimeInSeconds() >= $gameParty._receptionistBattle_timeLimit) {
			this.processVictory();
            return true;
		}
		else if($gameParty.isAllDead()) {
            this.processDefeat();
            return true;
		}
	}
	else if(Karryn.isInWaitressSexPose()) {
		if ($gameParty.isAllDead()) {
            this.processDefeat();
            return true;
        } else if ($gameTroop.isAllOutOfEjaculationStock()) {
			if(actor._karrynMugContent === ALCOHOL_TYPE_SEMEN && actor._karrynMugAmount > 0)
				return false
			else {
				this.processVictory();
				return true;
			}
        }
	}
	else if($gameParty.isInGloryBattle) {
		if($gameParty.isAllDead() || actor._gloryBattle_badExit) {
            this.processDefeat();
            return true;
        }
		else if(actor._gloryBattle_safeExit) {
			this.processVictory();
				return true;
		}
	}

	return false;
};

//////////
// Process Victory Finish
// Process Abort
// Process Defeat
/////////////

BattleManager.processVictoryFinish = function() {
    $gameParty.clearVictoryData();
    this.endBattle(this._victoryType);
	AudioManager.stopBgm();
    this.replayBgmAndBgs();
	this._victoryType = -1;
    this._victoryPhase = false;
};

BattleManager.processAbort = function() {
    $gameParty.removeBattleStates();
	$gameParty.addRecordEscaped();
	$gameParty.increaseFatigueGain(PRISON_FATIGUE_FROM_ESCAPING);
	Karryn.turnOnJustEscapedFlag();
	this._phase = 'rem abort';
	this._victoryPhase = true;
	this._victoryType = 1;
    if(!$gameSystem.skipVictoryAftermath()) {
		this.processNormalVictory();
    }
};

BattleManager.processDefeat = function() {
	if(!Karryn.isInMasturbationPose()) {
		$gameParty.addRecordDefeated();
		$gameParty.setDefeatedSwitchesOn();
		//$gameParty._halfGoldRewardsFlag = true;
		this.playDefeatMe();
	}
	this._phase = 'rem defeat';
	this._victoryPhase = true;
	this._victoryType = 2;
    if(!$gameSystem.skipVictoryAftermath()) {
		//$gameParty.gainOrderFromDefeat();
		this.processNormalVictory();
    }
};

//////////
// Game Interpreter
//////////////

Game_Interpreter.prototype.command339 = function() {
    this.iterateBattler(this._params[0], this._params[1], function(battler) {
        if (!battler.isDeathStateAffected() || battler.isInNeverDeadPose()) {
            battler.forceAction(this._params[2], this._params[3]);
            BattleManager.forceAction(battler);
            this.setWaitMode('action');
        }
    }.bind(this));
    return true;
};


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

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

Game_Actor.prototype.getBattlePoseOffetArray = function () {
	let poseName = this.poseName;
	let offsetArray = [ 0, 0 ];
	let x_offset = 0;
	let y_offset = 0;
	//ここから

	if(poseName == POSE_DOWN_ORGASM) {
        x_offset = 70;
        y_offset = 0;
    }
	else if(poseName == POSE_KICK) {
        x_offset = 100;
        y_offset = 0;
    }
	else if(poseName == POSE_MAP && $gameParty.isInWaitressBattle) {
		x_offset = 230;
        y_offset = 0;

	}

	//ここまで
	offsetArray[0] = x_offset;
	offsetArray[1] = y_offset;
	return offsetArray;
};


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

const VAR_NO_ENERGY_STAMINA_DAMAGE = 0.3;
const VAR_AP_PER_END = 10;
const VAR_OP_PER_END = 30;

const VAR_STANCE_STRONG_HIT = 0.15;
const VAR_STANCE_WEAK_HIT = -0.1;
const VAR_STANCE_STRONG_DMG = 1.25;
const VAR_STANCE_WEAK_DMG = 0.85;

const VAR_CRITICAL_DAMAGE_MIN_MULTIPLER = 1.33;
const VAR_HIGHER_DEX_MAX_CRIT_MULTI = 25; //unused

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

var STANCE_NONE = 1;
var STANCE_SLASH = 2;
var STANCE_PIERCE = 3;
var STANCE_BLUNT = 4;
var STANCE_RANDOM = 5;

///////
//////////////////
// Game Battlerbase
///////////////////
//////////////

Remtairy.Battler.Game_BattlerBase_initMembers = Game_BattlerBase.prototype.initMembers;
Game_BattlerBase.prototype.initMembers = function() {
	Remtairy.Battler.Game_BattlerBase_initMembers.call(this);
	this._fatigue = 0;
    this._will = 0;
	this._stench = 0;
	this._didNothing = false;
	this._didNothingCount = 1;
	this._arousalBasePoint = 0;
	this._orgasmBasePoint = 0;
	this._baseTalkLvl = 0;
	this._baseSightLvl = 0;
	this._basePettingLvl = 0;
	this._baseToyLvl = 0;
	this._baseSemenLvl = 0;
	this._baseStripLvl = 0;
	this._baseKissLvl = 1;
	this._baseHandjobLvl = 1;
	this._baseBlowjobLvl = 1;
	this._baseFootjobLvl = 1;
	this._baseRimjobLvl = 1;
	this._baseTittyFuckLvl = 1;
	this._basePussySexLvl = 1;
	this._baseAnalSexLvl = 1;
	this._baseMasturbateLvl = 1;
	this._baseMasochismLvl = 1;
	this._baseSadismLvl = 1;
	this._wantedPoints = 0;
	this._enemyTurnCount = 0;
	this.resetGotHitBySkillType();
	this.changeStanceToNone();
	this.orgasmLockOff();
	this._performingCollapse = false;
};

//Define Property
Object.defineProperty(Game_BattlerBase.prototype, "isKarryn", {
	get: function () { return false; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "isHorny", {
	get: function () { return this.isStateAffected(STATE_HORNY_ID); }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "isAngry", {
	get: function () {
		return this.isStateAffected(STATE_ANGRY_ID) || this.isStateAffected(STATE_SLIME_ANGRY_ID) || this.isStateAffected(STATE_ORC_ANGRY_ID);
	}, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "isConfident", {
	get: function () { return this.isStateAffected(STATE_CONFIDENT_ID); }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "isOffBalance", {
	get: function () { return this.isStateAffected(STATE_OFFBALANCE_ID); }, configurable: true
});

Object.defineProperty(Game_BattlerBase.prototype, "isGuarding", {
	get: function () { return this.isStateAffected(STATE_GUARD_ID); }, configurable: true
});

Object.defineProperty(Game_BattlerBase.prototype, "str", {
	get: function () { return this.atk; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "end", {
	get: function () { return this.def; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "dex", {
	get: function () { return this.mat; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "mind", {
	get: function () { return this.mdf; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "charm", {
	get: function () { return this.luk; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "stamina", {
	get: function () { return this._hp; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "maxstamina", {
	get: function () { return this.mhp; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "realMaxStamina", {
	get: function () { return Math.round(this.mhp * (1 / this.fatigueMultipler())); }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "energy", {
	get: function () { return this._mp; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "maxenergy", {
	get: function () { return this.mmp; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "realMaxEnergy", {
	get: function () { return Math.round(this.mmp * (1 / this.fatigueMultipler())); }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "will", {
	get: function () { return this._will; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "maxwill", {
	get: function () { return this.maxWill(); }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "pleasure", {
	get: function () { return this.tp; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "wpatk", {
	get: function () { return Math.round(this.mcr); }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "wpdef", {
	get: function () { return Math.round(this.grd); }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "esc", {
	get: function () { return this.pha; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "wsc", {
	get: function () { return this.pdr; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "ssc", {
	get: function () { return this.mdr; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "asc", {
	get: function () { return this.fdr; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "graze", {
	get: function () { return this.mev; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "staminaregen", {
	get: function () { return this.hrg; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "energyregen", {
	get: function () { return this.mrg; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "willregen", {
	get: function () { return this.tcr; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "stench", {
	get: function () { return this._stench; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "didNothingCount", {
	get: function () { return this._didNothingCount; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "fatigue", {
	get: function () { return this._fatigue; }, configurable: true
});
Object.defineProperty(Game_BattlerBase.prototype, "isErect", {
	get: function () { return this.isAroused() && DEBUG_MODE; }, configurable: true
});

//Getters
Game_BattlerBase.prototype.talkLvl = function() {
	return this._baseTalkLvl;
};
Game_BattlerBase.prototype.sightLvl = function() {
	return this._baseSightLvl;
};
Game_BattlerBase.prototype.pettingLvl = function() {
	return this._basePettingLvl;
};
Game_BattlerBase.prototype.toyLvl = function() {
	return this._baseToyLvl;
};
Game_BattlerBase.prototype.semenLvl = function() {
	return this._baseSemenLvl;
};
Game_BattlerBase.prototype.stripLvl = function() {
	return this._baseStripLvl;
};

Game_BattlerBase.prototype.kissLvl = function() {
	return this._baseKissLvl;
};
Game_BattlerBase.prototype.handjobLvl = function() {
	return this._baseHandjobLvl;
};
Game_BattlerBase.prototype.blowjobLvl = function() {
	return this._baseBlowjobLvl;
};
Game_BattlerBase.prototype.rimjobLvl = function() {
	return this._baseRimjobLvl;
};
Game_BattlerBase.prototype.footjobLvl = function() {
	return this._baseFootjobLvl;
};
Game_BattlerBase.prototype.tittyFuckLvl = function() {
	return this._baseTittyFuckLvl;
};
Game_BattlerBase.prototype.pussySexLvl = function() {
	return this._basePussySexLvl;
};
Game_BattlerBase.prototype.analSexLvl = function() {
	return this._baseAnalSexLvl;
};
Game_BattlerBase.prototype.masturbateLvl = function() {
	return this._baseMasturbateLvl;
};
Game_BattlerBase.prototype.masochismLvl = function() {
	return this._baseMasochismLvl;
};
Game_BattlerBase.prototype.sadismLvl = function() {
	return this._baseSadismLvl;
};

///////
// Display Name
/////////////

Game_BattlerBase.prototype.displayName = function() {
	return this.name();
};

//////
// Param
////////

//Modified to ignore cache for charm for karryn
Game_BattlerBase.prototype.param = function(paramId) {
	this._baseParamCache = this._baseParamCache || [];
	if (this._baseParamCache[paramId] && (this.isActor() && paramId != PARAM_CHARM_ID)) return this._baseParamCache[paramId];
	var base = this.paramBase(paramId);
	var plus = this.paramPlus(paramId);
	var paramRate = this.paramRate(paramId);
	var buffRate = this.paramBuffRate(paramId);
	var flat = this.paramFlat(paramId);
	var minValue = this.paramMin(paramId);
	var maxValue = Math.max(minValue, this.paramMax(paramId));
	var a = this;
	var user = this;
	var subject = this;
	var b = this;
	var target = this;
	var s = $gameSwitches._data;
	var v = $gameVariables._data;
	var code = Yanfly.Param.BPCFormula[paramId];
	try {
	var value = eval(code);
	} catch (e) {
	var value = 0;
	Yanfly.Util.displayError(e, code, 'CUSTOM PARAM FORMULA ERROR');
	}
	value = Math.round(value.clamp(minValue, maxValue));
	this._baseParamCache[paramId] = value;
	return this._baseParamCache[paramId];
};

/////
// Stamina
//////////

Game_BattlerBase.prototype.hasNoStamina = function() {
	return this.stamina === 0;
};

Game_BattlerBase.prototype.hasLessThanOneFourthStamina = function() {
	return this.stamina <= this.maxstamina * 0.25;
};

Game_BattlerBase.prototype.hasLessThanOneThirdStamina = function() {
	return this.stamina <= this.maxstamina * 0.33;
};

Game_BattlerBase.prototype.hasLessThanHalfStamina = function() {
	return this.stamina <= this.maxstamina * 0.5;
};

//returns whole numbers, divide by 100 for percent
Game_BattlerBase.prototype.currentPercentOfStamina = function() {
	let value = Math.floor(this.stamina * 100 / this.maxstamina);
	if(value >= 100) value = 100;
	return value;
};

//MaxHundred = don't return more than 100
Game_BattlerBase.prototype.getPercentOfStaminaFromValue = function(value, maxHundred) {
	let percent = Math.floor(value * 100 / this.maxstamina);
	if(maxHundred) percent = Math.min(100, percent);
	return percent;
};

//returns whole numbers, divide by 100 for percent
Game_BattlerBase.prototype.currentPercentOfStamina_realMax = function() {
	let value = Math.floor(this.stamina * 100 / this.realMaxStamina);
	if(value >= 100) value = 100;
	return value;
};

//////
// Fatigue
///////////

Game_BattlerBase.prototype.setFatigue = function(value) {
	this._fatigue = Math.max(Math.round(value), 0);
	$gameScreen.setMapInfoRefreshNeeded();
};

Game_BattlerBase.prototype.gainFatigue = function(value) {
	this.setFatigue(this.fatigue + value);
};

Game_BattlerBase.prototype.recoverFatigue = function(value) {
	this.setFatigue(this.fatigue - value);
};

//Used for max stamina and max energy formulas
Game_BattlerBase.prototype.fatigueMultipler = function() {
    var value = (100 - this.fatigue) / 100;

	return Math.max(value,0.01);
};

////////
// Speed

Game_BattlerBase.prototype.bonusActionSpeed = function() {
    return 0;
};

//////
// Will
//////
Game_BattlerBase.prototype.gainWill = function(value) {
    this.setWill(this.will + value);
};

Game_BattlerBase.prototype.setWill = function(will) {
    this._will = Math.round(will);
	this._will = this._will.clamp(0, this.maxwill);
};

//////////////
// Weapon Attack Weapon Defense
///////////////////

Game_BattlerBase.prototype.moddedWeaponAttack = function() {
    let moddedWpAtk = this.wpatk;

	return moddedWpAtk;
};

Game_BattlerBase.prototype.moddedWeaponDefense = function() {
    let moddedWpDef = this.wpdef;

	if(this.isGuarding) moddedWpDef *= 2;

	return moddedWpDef;
};

//////
// Critical
/////////

////////
// Critical Chance
// Critical Rate

Game_BattlerBase.prototype.criticalChanceFormula = function(target) {
	let value = this.cri - target.cev;
	//if(this.dex > target.dex && this.dex > target.end) {
		//let diff = this.dex - Math.max(target.dex, target.end);
		//value += 0.01 * Math.min(diff, VAR_HIGHER_DEX_MAX_CRIT_MULTI); }
	value *= this.criticalChanceRate();
	value += this.criticalChanceBonus();
	return value;
};

Game_BattlerBase.prototype.criticalChanceRate = function() {
    let rate = 1;

	return rate;
};

Game_BattlerBase.prototype.criticalChanceBonus = function() {
    let bonus = 0;

	return bonus;
};

// Critical Damage
Game_BattlerBase.prototype.criticalDamageFormula = function(target, bonus) {
	let damageMultipler = 0;
	if(target)
		damageMultipler = Math.max(VAR_CRITICAL_DAMAGE_MIN_MULTIPLER, VAR_CRITICAL_DAMAGE_MIN_MULTIPLER + bonus + this.atk/200 - target.atk/200);
	else
		damageMultipler = VAR_CRITICAL_DAMAGE_MIN_MULTIPLER + bonus + this.atk/200;

	damageMultipler = (damageMultipler + this.criticalDamageBonus()) * this.criticalDamageRate();

	//console.log(damageMultipler);

	return damageMultipler;
};
Game_BattlerBase.prototype.criticalDamageRate = function() {
	let rate = 1;
	return rate;
};
Game_BattlerBase.prototype.criticalDamageBonus = function() {
    let bonus = 0;

	return bonus;
};

////////
// Stance
////////////

Game_BattlerBase.prototype.getStance = function() {
    return this._stance;
};
Game_BattlerBase.prototype.isSlashStance = function() {
    return this.getStance() === STANCE_SLASH;
};
Game_BattlerBase.prototype.isPierceStance = function() {
    return this.getStance() === STANCE_PIERCE;
};
Game_BattlerBase.prototype.isBluntStance = function() {
    return this.getStance() === STANCE_BLUNT;
};
Game_BattlerBase.prototype.isNoneStance = function() {
    return this.getStance() === STANCE_NONE;
};

Game_BattlerBase.prototype.setStance = function(stance) {
    this._stance = stance;
};
Game_BattlerBase.prototype.changeStanceToSlash = function() {
    this.setStance(STANCE_SLASH);
};
Game_BattlerBase.prototype.changeStanceToPierce = function() {
    this.setStance(STANCE_PIERCE);
};
Game_BattlerBase.prototype.changeStanceToBlunt = function() {
    this.setStance(STANCE_BLUNT);
};
Game_BattlerBase.prototype.changeStanceToNone = function() {
    this.setStance(STANCE_NONE);
};

Game_BattlerBase.prototype.changeStanceBySkill = function(item) {
	if(item.damage.type !== 1) return;

	let elementId = item.damage.elementId;
	if(elementId === ELEMENT_SLASH_ID)
		this.changeStanceToSlash();
	else if(elementId === ELEMENT_PIERCE_ID)
		this.changeStanceToPierce();
	else if(elementId === ELEMENT_BLUNT_ID)
		this.changeStanceToBlunt();
};

Game_BattlerBase.prototype.isInStrongStanceAgainstTarget = function(target) {
	if(this.isNoneStance()) return false;

	if(this.isSlashStance()) {
		if(target.isBluntStance() || target.isNoneStance()) {
			return true;
		}
	}
	else if(this.isPierceStance()) {
		if(target.isSlashStance() || target.isNoneStance()) {
			return true;
		}
	}
	else if(this.isBluntStance()) {
		if(target.isPierceStance() || target.isNoneStance()) {
			return true;
		}
	}

	return false;
};

Game_BattlerBase.prototype.isInSameStanceAsTarget = function(target) {
	return this.getStance() === target.getStance();
};

/////////////
// Stance Triangle
// Slash > Blunt > Pierce > Slash
// Adv: +15 hit, +25% damage Bad: -10 hit, -15% damage
// Used in hit accuracy formula
Game_BattlerBase.prototype.stanceHitAdv = function(target, item) {
	var elementId = item.damage.elementId;
	if(elementId !== ELEMENT_SLASH_ID && elementId !== ELEMENT_PIERCE_ID && elementId !== ELEMENT_BLUNT_ID && elementId !== STANCE_NONE) return 0;

	var neutral = this.isInSameStanceAsTarget(target);
	var strong = this.isInStrongStanceAgainstTarget(target);
	var weak = (!neutral && !strong);

	if(strong) return VAR_STANCE_STRONG_HIT;
	else if(weak) return VAR_STANCE_WEAK_HIT;
	else return 0;
};

Game_BattlerBase.prototype.stanceDmgAdv = function(target, elementId) {
	//var elementId = item.damage.elementId;
	if(elementId !== ELEMENT_SLASH_ID && elementId !== ELEMENT_PIERCE_ID && elementId !== ELEMENT_BLUNT_ID && elementId !== STANCE_NONE) {
		return 1;
	}

	let neutral = this.isInSameStanceAsTarget(target);
	let strong = this.isInStrongStanceAgainstTarget(target);
	let weak = (!neutral && !strong);

	if(strong) return VAR_STANCE_STRONG_DMG;
	else if(weak) return VAR_STANCE_WEAK_DMG;
	else return 1;
};

Game_BattlerBase.prototype.stanceBonusRate = function(elementId) {
	let bonusRate = 1;

	if(elementId === ELEMENT_SLASH_ID && this.isStateAffected(STATE_BONUS_SLASH_DMG_ID)) bonusRate += 0.5;
	else if (elementId === ELEMENT_PIERCE_ID && this.isStateAffected(STATE_BONUS_PIERCE_DMG_ID)) bonusRate += 0.5;
	else if (elementId === ELEMENT_BLUNT_ID && this.isStateAffected(STATE_BONUS_BLUNT_DMG_ID)) bonusRate += 0.5;

	return bonusRate;
};

/////
// Stench
//////////

Game_BattlerBase.prototype.setStench = function(stench) {
    this._stench = Math.max(Math.round(stench),0);
};
Game_BattlerBase.prototype.increaseStench = function(value) {
    this.setStench(this.stench + value);
};

/////////
// Slammed Cleaved Skewered
////////////

Game_BattlerBase.prototype.isSlammed = function() {
	return this.isStateAffected(STATE_SLAMMED_ID);
};
Game_BattlerBase.prototype.isCleaved = function() {
	return this.isStateAffected(STATE_CLEAVED_ID);
};
Game_BattlerBase.prototype.isSkewered = function() {
	return this.isStateAffected(STATE_SKEWERED_ID);
};

//////
// Do Nothing Skill
////////////

Game_BattlerBase.prototype.doNothing = function() {
	this._didNothing = true;
	this._enemyTurnCount++;
};
Game_BattlerBase.prototype.resetDidNothingCount = function() {
	this._didNothingCount = 0;
};

Game_BattlerBase.prototype.checkIfDidNothing = function() {
	if(this._didNothing) {
		this._didNothingCount++;
		this._didNothing = false;
	}
	else this.resetDidNothingCount();
};

/////////////
// Evade Reduction

Game_BattlerBase.prototype.resetEvadeReductionStage = function() {
	this._evadeReductionStage = 0;
};
Game_BattlerBase.prototype.increaseEvadeReductionStage = function() {
	this._evadeReductionStage = Math.min(2, this._evadeReductionStage + 1);
};
Game_BattlerBase.prototype.decreaseEvadeReductionStage = function() {
	this._evadeReductionStage = Math.max(0, this._evadeReductionStage - 1);
};
Game_BattlerBase.prototype.evadeReductionStageXParamRate = function() {
	let rate = 1;
	let eachStageEffect = 0.34;
	if(Prison.easyMode()) eachStageEffect = 0.45;
	rate -= eachStageEffect * this._evadeReductionStage;
	return rate;
};

////////////
// Overblow Protection

Game_BattlerBase.prototype.overblowProtectionRate = function() {
	let op = 1;
	return op;
};
Game_BattlerBase.prototype.hasOverblowProtection = function() {
	return this.overblowProtectionRate() < 1;
};

/////////////
// Use AI Skill
//////////////

Game_BattlerBase.prototype.useAISkill = function(skillId, target) {
	if(!target) {
		target = this._targetIndex;
	}
	if(!target) {
		console.log('useAISkill error: skill: ' + skillId + ' target: ' + target);
		return;
	}
	BattleManager.queueForceAction(this, skillId, target);
};

//////
// Pleasure
////////////

Game_BattlerBase.prototype.arousalPoint = function() {
	let value = this._arousalBasePoint + this.end * VAR_AP_PER_END;
	return value;
};
Game_BattlerBase.prototype.orgasmPoint = function() {
	let value = this._orgasmBasePoint + this.end * VAR_OP_PER_END;
	return value;
};

Game_BattlerBase.prototype.isAroused = function() {
	if(!DEBUG_MODE) return false;
	return this.pleasure >= this.arousalPoint();
};

//Generic Battlerbase version
Game_BattlerBase.prototype.setPleasure = function(value) {
	this.setTp(value);
};

Game_BattlerBase.prototype.gainPleasure = function(value) {
	//if(this.isHorny) value = Math.round(value * 1.1);
	this._result.tpDamage = -value;
	this.setPleasure(this.pleasure + value);
};

Game_BattlerBase.prototype.setPleasureToArousalPoint = function() {
	this.setPleasure(this.arousalPoint());
};
Game_BattlerBase.prototype.setPleasureToOrgasmPoint = function() {
	this.setPleasure(this.orgasmPoint());
};

Game_BattlerBase.prototype.increaseArousalPoint = function(value) {
	this._arousalBasePoint += value;
};
Game_BattlerBase.prototype.increaseOrgasmPoint = function(value) {
	this._orgasmBasePoint += value;
};

Game_BattlerBase.prototype.reachedOrgasmPoint = function() {
	if(!DEBUG_MODE) return false;
	return this.pleasure >= this.orgasmPoint();
};

Game_BattlerBase.prototype.isTwoThirdsWayToOrgasm = function() {
	return this.currentPercentOfOrgasm(true) >= 66;
};

Game_BattlerBase.prototype.getPercentOfOrgasmFromValue = function(value) {
	let percent = Math.floor(value * 100 / this.orgasmPoint());
	return percent;
};

//whole value, inputting 2 is equal to 2%
Game_BattlerBase.prototype.getValueOfOrgasmFromPercent = function(percent) {
	let value = Math.floor(percent * 0.01 * this.orgasmPoint());
	return value;
};

//oneMax = return max of 100
//returns whole numbers, divide by 100 for percent
Game_BattlerBase.prototype.currentPercentOfOrgasm = function(oneMax) {
	let value = Math.floor(this.pleasure * 100 / this.orgasmPoint());
	if(value >= 100 && oneMax) value = 100;
	return value;
};

//oneMax = return max of 100
Game_BattlerBase.prototype.currentPercentOfArousal = function(oneMax) {
	let value = Math.floor(this.pleasure * 100 / this.arousalPoint());
	if(value > 100 && oneMax) value = 100;
	return value;
};

// Just Got Hit By Skill

Game_BattlerBase.prototype.resetGotHitBySkillType = function() {
	this._justGotHitBySkillType = 0;
};
Game_BattlerBase.prototype.justGotHitBySkillType = function(skillType) {
	this._justGotHitBySkillType = skillType;
};
Game_BattlerBase.prototype.didLastGetHitBySkillType = function(skillType) {
	if(skillType === JUST_SKILLTYPE_ENEMY_TOY_PLAY) {
		return this._justGotHitBySkillType === JUST_SKILLTYPE_ENEMY_TOY_PLAY_CLIT || this._justGotHitBySkillType === JUST_SKILLTYPE_ENEMY_TOY_PLAY_PUSSY || this._justGotHitBySkillType === JUST_SKILLTYPE_ENEMY_TOY_PLAY_ANAL;
	}

	return this._justGotHitBySkillType === skillType;
};

Game_BattlerBase.prototype.masochismSensitivity = function() {
	return 0;
};

//////////
// Horny
/////////

Game_BattlerBase.prototype.addHornyState = function() {

};
Game_BattlerBase.prototype.getHornyStateTurns = function() {
	return this.stateTurns(STATE_HORNY_ID);
};
Game_BattlerBase.prototype.increaseHornyStateTurns = function(value) {
	if(!this.isHorny) return;
	this.setStateTurns(STATE_HORNY_ID, this.getHornyStateTurns() + value);
};

//////////
// Stun Till End of Turn

Game_BattlerBase.prototype.addStunTillEndOfTurnState = function() {
	this.addState(STATE_STUN_TILL_TURN_END_ID);
};

///////////
///////////////
// Game Battler
//////////////
////////////

///////
// Regenerate
///////
/*
Game_Battler.prototype.regenerateHp = function() {
	if(this.stamina === 0) return;
	if(this.energy !== 0) {
		var value = Math.floor(this.maxstamina * this.staminaregen);
		if (value !== 0) {
			this.gainHp(value);
		}
	}
	else {
		if(this.isActor()) {
			var value = Math.floor(this.maxstamina * VAR_NO_ENERGY_STAMINA_DAMAGE);
		}
		else {
			var value = Math.floor(this.stamina);
		}
		this.gainHp(-value);
	}
};

Game_Battler.prototype.regenerateMp = function() {
	var value = Math.floor(this.maxenergy * this.energyregen);
	if (value !== 0) {
		this.gainMp(value);
	}
	if(this.isActor()) {
		this.regenerateWill();
		this.regenerateDesires();
		this.regenPussyJuice();
	}
	//regenerateTp aka pleasure is after this function
};

Game_Battler.prototype.regenerateWill = function() {
	var value = Math.floor(this.maxwill * this.willregen);
	if (value !== 0) {
		this.gainWill(value);
	}
};
*/
Game_Battler.prototype.regenerateDesires = function() {
	//Non Actors don't have desire bars.
	return;
};

//In Special Formulas Plugin
Game_Battler.prototype.willRegenMultipler = function() {
	return 1;
};

Game_Battler.prototype.setWillToMax = function() {
	this.setWill(this.maxwill);
};

/////////////
// Check For Orgasm
////////////////

Game_Battler.prototype.checkForOrgasm = function() {
	if(this.reachedOrgasmPoint() && !this.orgasmLocked()) {
		this.orgasm();
	}
	//this.resetGotHitBySkillType();
};

Game_Battler.prototype.orgasmLocked = function() {
	return this._orgasmLock || this.isStateAffected(STATE_JUST_JOINED_ID);
};

Game_Battler.prototype.orgasmLockOn = function() {
	this._orgasmLock = true;
};
Game_Battler.prototype.orgasmLockOff = function() {
	this._orgasmLock = false;
};

/////////////
// Elemental Weakness
/////////////////

Game_Battler.prototype.weaknessToKiss = function() {
	var value = this.elementRate(ELEMENT_KISS_WEAK_ID);
	return value;
};
Game_Battler.prototype.weaknessToPetting = function() {
	var value = this.elementRate(ELEMENT_PETTING_WEAK_ID);
	return value;
};
Game_Battler.prototype.weaknessToHandjob = function() {
	var value = this.elementRate(ELEMENT_HANDJOB_WEAK_ID);
	return value;
};
Game_Battler.prototype.weaknessToBlowjob = function() {
	var value = this.elementRate(ELEMENT_BLOWJOB_WEAK_ID);
	return value;
};
Game_Battler.prototype.weaknessToRimjob = function() {
	var value = this.elementRate(ELEMENT_RIMJOB_WEAK_ID);
	return value;
};
Game_Battler.prototype.weaknessToFootjob = function() {
	var value = this.elementRate(ELEMENT_FOOTJOB_WEAK_ID);
	return value;
};
Game_Battler.prototype.weaknessToTittyFuck = function() {
	var value = this.elementRate(ELEMENT_TITTYFUCK_WEAK_ID);
	return value;
};
Game_Battler.prototype.weaknessToPussy = function() {
	var value = this.elementRate(ELEMENT_PUSSY_WEAK_ID);
	return value;
};
Game_Battler.prototype.weaknessToAnal = function() {
	var value = this.elementRate(ELEMENT_ANAL_WEAK_ID);
	return value;
};

//////////
// Is there an XXX opponent
// For future, maybe separate functions for active battlers vs onlookers, etc
///////////

Game_Battler.prototype.isThereAnErectOpponent = function() {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isErect) {
			return true;
		}
	}
	return false;
};

Game_Battler.prototype.isThereValidTargetForKiss = function(actorskill) {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isValidTargetForKiss(this, actorskill)) {
			return true;
		}
	}
	return false;
};

Game_Battler.prototype.isThereValidTargetForCockStare = function() {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isValidTargetForCockStare(this)) {
			return true;
		}
	}
	return false;
};

Game_Battler.prototype.isThereValidTargetForCockPetting = function() {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isValidTargetForCockPetting(this)) {
			return true;
		}
	}
	return false;
};

Game_Battler.prototype.isThereValidTargetForHandjob = function(actorskill) {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isValidTargetForHandjob(this, actorskill)) {
			return true;
		}
	}
	return false;
};

Game_Battler.prototype.isThereValidTargetForBlowjob = function(actorskill) {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isValidTargetForBlowjob(this, actorskill)) {
			return true;
		}
	}
	return false;
};

Game_Battler.prototype.isThereValidTargetForRimjob = function(actorskill) {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isValidTargetForRimjob(this, actorskill)) {
			return true;
		}
	}
	return false;
};

Game_Battler.prototype.isThereValidTargetForFootjob = function(actorskill) {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isValidTargetForFootjob(this, actorskill)) {
			return true;
		}
	}
	return false;
};

Game_Battler.prototype.isThereValidTargetForTittyFuck = function(actorskill) {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isValidTargetForTittyFuck(this, actorskill)) {
			return true;
		}
	}
	return false;
};

Game_Battler.prototype.isThereValidTargetForPussySex = function(actorskill) {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isValidTargetForPussySex(this, actorskill)) {
			return true;
		}
	}
	return false;
};

Game_Battler.prototype.isThereValidTargetForAnalSex = function(actorskill) {
	let group = this.opponentsUnit().aliveMembers();
	for (let i = 0; i < group.length; ++i) {
        let opponent = group[i];
        if (opponent && opponent.isValidTargetForAnalSex(this, actorskill)) {
			return true;
		}
	}
	return false;
};