code:
//=============================================================================
// Yanfly Engine Plugins - Battle Engine Extension - Visual HP Gauge
// YEP_X_VisualHpGauge.js
//=============================================================================

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

var Yanfly = Yanfly || {};
Yanfly.VHG = Yanfly.VHG || {};
Yanfly.VHG.version = 1.07

//=============================================================================
 /*:
 * @plugindesc v1.07 (Requires YEP_BattleEngineCore.js) Reveal HP Gauges
 * when a battler is selected or takes damage in battle.
 * @author Yanfly Engine Plugins
 *
 * @param ---General---
 * @default
 *
 * @param Display Actor
 * @parent ---General---
 * @type boolean
 * @on YES
 * @off NO
 * @desc Do you wish to display the HP Gauge for actors?
 * NO - false     YES - true
 * @default true
 *
 * @param Defeat First
 * @parent ---General---
 * @type boolean
 * @on YES
 * @off NO
 * @desc Enemies must be defeated first before showing the HP Gauge.
 * NO - false     YES - true
 * @default false
 *
 * @param Always Visible
 * @parent ---General---
 * @type boolean
 * @on YES
 * @off NO
 * @desc HP Gauge is always visible and doesn't fade away.
 * NO - false     YES - true
 * @default false
 *
 * @param ---Appearance---
 * @default
 *
 * @param Minimum Gauge Width
 * @parent ---Appearance---
 * @type number
 * @min 1
 * @desc This is the minimum width in pixels for HP Gauges.
 * @default 144
 *
 * @param Gauge Height
 * @parent ---Appearance---
 * @type number
 * @min 1
 * @desc This is the height in pixels for HP Gauges.
 * @default 18
 *
 * @param Back Color
 * @parent ---Appearance---
 * @desc This is the text color used for the back of HP Gauges.
 * @default 19
 *
 * @param HP Color 1
 * @parent ---Appearance---
 * @type number
 * @min 0
 * @max 31
 * @desc This is the text color used for the 1st part of HP Gauges.
 * @default 20
 *
 * @param HP Color 2
 * @parent ---Appearance---
 * @type number
 * @min 0
 * @max 31
 * @desc This is the text color used for the 2nd part of HP Gauges.
 * @default 21
 *
 * @param Gauge Duration
 * @parent ---Appearance---
 * @type number
 * @min 0
 * @desc This is the frames the HP gauge will continue to show after
 * it finishes draining or filling.
 * @default 30
 *
 * @param Gauge Position
 * @parent ---Appearance---
 * @type boolean
 * @on Above
 * @off Below
 * @desc Where do you wish to show the HP gauge?
 * BELOW - false     ABOVE - true
 * @default false
 *
 * @param Y Buffer
 * @parent ---Appearance---
 * @type number
 * @desc How much do you wish to shift the gauge Y position?
 * @default -16
 *
 * @param Use Thick Gauges
 * @parent ---Appearance---
 * @type boolean
 * @on Thick
 * @off Normal
 * @desc Use the thick gauges provided by this plugin?
 * Default - false     Thick - true
 * @default true
 *
 * @param ---Text Display---
 * @default
 *
 * @param Show HP
 * @parent ---Text Display---
 * @type boolean
 * @on YES
 * @off NO
 * @desc Show the actual 'HP' text.
 * NO - false     YES - true
 * @default false
 *
 * @param Show Value
 * @parent ---Text Display---
 * @type boolean
 * @on YES
 * @off NO
 * @desc Show the HP value.
 * NO - false     YES - true
 * @default false
 *
 * @param Show Max
 * @parent ---Text Display---
 * @type boolean
 * @on YES
 * @off NO
 * @desc Show the MaxHP value if value is shown?
 * NO - false     YES - true
 * @default false
 *
 * @help
 * ============================================================================
 * Introduction
 * ============================================================================
 *
 * This plugin requires YEP_BattleEngineCore.
 * Make sure this plugin is located under YEP_BattleEngineCore in the plugin
 * list.
 *
 * This plugin shows the HP Gauges of enemies as they're selected or while they
 * take damage. You can also opt for actors to show their HP Gauge as well.
 * Adjust the parameters to change the way you want the HP Gauges to appear.
 *
 * By default, enemies would need to be defeated first in order for the gauges
 * to show up. This can be changed within the parameter settings. However,
 * during battle test, the HP gauges are always shown unless the enemy has a
 * hidden HP gauge.
 *
 * ============================================================================
 * Notetags
 * ============================================================================
 *
 * Class and Enemy Notetags:
 *   <Hide HP Gauge>
 *   This HP gauge will always be hidden if this notetag is present.
 *
 *   <Show HP Gauge>
 *   This HP gauge will always be shown if this notetag is present while the
 *   target is selected or taking damage.
 *
 *   <HP Gauge Width: x>
 *   This will set the battler's HP Gauge width to x pixels. However, if this
 *   width is less than the minimum width, minimum width will take priority.
 *
 *   <HP Gauge Height: x>
 *   This set's the HP Gauge height to x pixels.
 *
 *   <HP Gauge Back Color: x>
 *   This changes the HP Gauge's back color to x text color.
 *
 *   <HP Gauge Color 1: x>
 *   This changes the HP Gauge's color 1 to x text color.
 *
 *   <HP Gauge Color 2: x>
 *   This changes the HP Gauge's color 2 to x text color.
 *
 * ============================================================================
 * Changelog
 * ============================================================================
 *
 * Version 1.07:
 * - Updated for RPG Maker MV version 1.5.0.
 *
 * Version 1.06:
 * - Compatibility update with State Categories.
 *
 * Version 1.05:
 * - Updated for RPG Maker MV version 1.1.0.
 *
 * Version 1.04:
 * - Optimization update.
 *
 * Version 1.03:
 * - Fixed a bug when Escape skill-effects are used on battlers.
 *
 * Version 1.02:
 * - Fixed a bug with gauge height not adjusting.
 *
 * Version 1.01b:
 * - Fixed a bug regarding dependancy checks.
 * - Fixed many bugs regarding stacking errors.
 *
 * Version 1.01:
 * - Rewrote the good majority of plugin to accomodate the following features:
 * ---'Always Visible' parameter.
 * ---'Gauge Position' parameter.
 * ---'Y Buffer' parameter.
 * ---'Use Thick Gauges' parameter.
 * ---'Show HP' parameter.
 * ---'Show Value' parameter.
 * ---'Show Max' parameter.
 *
 * Version 1.00:
 * - Finished Plugin!
 */
//=============================================================================

if (Imported.YEP_BattleEngineCore) {

//=============================================================================
// Parameter Variables
//=============================================================================

Yanfly.Parameters = PluginManager.parameters('YEP_X_VisualHpGauge');
Yanfly.Param = Yanfly.Param || {};

Yanfly.Param.VHGDisplayActor = String(Yanfly.Parameters['Display Actor']);
Yanfly.Param.VHGDefeatFirst = String(Yanfly.Parameters['Defeat First']);
Yanfly.Param.VHGAlwaysShow = eval(String(Yanfly.Parameters['Always Visible']));

Yanfly.Param.VHGMinHpWidth = Number(Yanfly.Parameters['Minimum Gauge Width']);
Yanfly.Param.VHGGaugeHeight = Number(Yanfly.Parameters['Gauge Height']);
Yanfly.Param.VHGBackColor = Number(Yanfly.Parameters['Back Color']);
Yanfly.Param.VHGHpColor1 = Number(Yanfly.Parameters['HP Color 1']);
Yanfly.Param.VHGHpColor2 = Number(Yanfly.Parameters['HP Color 2']);
Yanfly.Param.VHGGaugeDuration = Number(Yanfly.Parameters['Gauge Duration']);
Yanfly.Param.VHGGaugePos = eval(String(Yanfly.Parameters['Gauge Position']));
Yanfly.Param.VHGBufferY = Number(Yanfly.Parameters['Y Buffer']);
Yanfly.Param.VHGThick = eval(String(Yanfly.Parameters['Use Thick Gauges']));

Yanfly.Param.VHGShowHP = eval(String(Yanfly.Parameters['Show HP']));
Yanfly.Param.VHGShowValue = eval(String(Yanfly.Parameters['Show Value']));
Yanfly.Param.VHGShowMax = eval(String(Yanfly.Parameters['Show Max']));

//=============================================================================
// DataManager
//=============================================================================

Yanfly.VHG.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
  if (!Yanfly.VHG.DataManager_isDatabaseLoaded.call(this)) return false;
  if (!Yanfly._loaded_YEP_X_VisualHpGauge) {
  	this.processVHGNotetags($dataClasses);
  	this.processVHGNotetags($dataEnemies);
    Yanfly._loaded_YEP_X_VisualHpGauge = true;
  }
	return true;
};

DataManager.processVHGNotetags = function(group) {
	for (var n = 1; n < group.length; n++) {
		var obj = group[n];
		var notedata = obj.note.split(/[\r\n]+/);

		obj.hideHpGauge = false;
		obj.showHpGauge = false;
		obj.hpGaugeWidth = 0;
		obj.hpGaugeHeight = Yanfly.Param.VHGGaugeHeight;
		obj.hpGaugeBackColor = Yanfly.Param.VHGBackColor;
		obj.hpGaugeColor1 = Yanfly.Param.VHGHpColor1;
		obj.hpGaugeColor2 = Yanfly.Param.VHGHpColor2;

		for (var i = 0; i < notedata.length; i++) {
			var line = notedata[i];
			if (line.match(/<(?:HIDE HP GAUGE)>/i)) {
				obj.hideHpGauge = true;
			} else if (line.match(/<(?:SHOW HP GAUGE)>/i)) {
				obj.showHpGauge = true;
			} else if (line.match(/<(?:HP GAUGE WIDTH):[ ](\d+)>/i)) {
				obj.hpGaugeWidth = parseInt(RegExp.$1);
			} else if (line.match(/<(?:HP GAUGE HEIGHT):[ ](\d+)>/i)) {
				obj.hpGaugeHeight = parseInt(RegExp.$1);
			} else if (line.match(/<(?:HP GAUGE BACK COLOR):[ ](\d+)>/i)) {
				obj.hpGaugeBackColor = parseInt(RegExp.$1);
			} else if (line.match(/<(?:HP GAUGE COLOR 1):[ ](\d+)>/i)) {
				obj.hpGaugeColor1 = parseInt(RegExp.$1);
			} else if (line.match(/<(?:HP GAUGE COLOR 2):[ ](\d+)>/i)) {
				obj.hpGaugeColor2 = parseInt(RegExp.$1);
			}
		}
	}
};

//=============================================================================
// Game_System
//=============================================================================

Yanfly.VHG.Game_System_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
    Yanfly.VHG.Game_System_initialize.call(this);
		this.initShownHpGauge();
};

Game_System.prototype.initShownHpGauge = function() {
    this._shownHpGauge = [];
};

Game_System.prototype.showHpGaugeEnemy = function(id) {
    if (this._shownHpGauge === undefined) this.initShownHpGauge();
		if (!eval(Yanfly.Param.VHGDefeatFirst)) return true;
		return this._shownHpGauge.contains(id);
};

Game_System.prototype.addHpGaugeEnemy = function(id) {
    if (this._shownHpGauge === undefined) this.initShownHpGauge();
		if (this._shownHpGauge.contains(id)) return;
		this._shownHpGauge.push(id);
};

//=============================================================================
// Game_BattlerBase
//=============================================================================

Yanfly.VHG.Game_BattlerBase_die = Game_BattlerBase.prototype.die;
Game_BattlerBase.prototype.die = function() {
  Yanfly.VHG.Game_BattlerBase_die.call(this);
  if (!this.isEnemy()) return;
  if (eval(Yanfly.Param.VHGDefeatFirst)) {
    if (!$gameSystem.showHpGaugeEnemy(this._enemyId)) this._noHpGauge = true;
  }
  $gameSystem.addHpGaugeEnemy(this._enemyId);
};

//=============================================================================
// Game_Battler
//=============================================================================

Game_Battler.prototype.hpGaugeVisible = function() {
		if (this._noHpGauge) return false;
    if (this.isHidden()) return false;
		return true;
};

Game_Battler.prototype.hpGaugeWidth = function() {
		var width = Math.max(this.spriteWidth(),	Yanfly.Param.VHGMinHpWidth);
		return (width & 1) ? width + 1 : width;
};

Game_Battler.prototype.hpGaugeHeight = function() {
		return Yanfly.Param.VHGGaugeHeight;
};

Game_Battler.prototype.hpGaugeBackColor = function() {
		return Yanfly.Param.VHGBackColor;
};

Game_Battler.prototype.hpGaugeColor1 = function() {
		return Yanfly.Param.VHGHpColor1;
};

Game_Battler.prototype.hpGaugeColor2 = function() {
		return Yanfly.Param.VHGHpColor2;
};

//=============================================================================
// Game_Actor
//=============================================================================

Game_Actor.prototype.hpGaugeVisible = function() {
    if (this.isHidden()) return false;
		if (this.currentClass().showHpGauge) return true;
		if (!eval(Yanfly.Param.VHGDisplayActor)) return false;
		if (this.currentClass().hideHpGauge) return false;
		return Game_Battler.prototype.hpGaugeVisible.call(this);
};

Game_Actor.prototype.hpGaugeWidth = function() {
		if (this.currentClass().hpGaugeWidth > 0) {
			var width = this.currentClass().hpGaugeWidth;
		} else {
			var width = this.spriteWidth();
		}
		width = Math.max(width,	Yanfly.Param.VHGMinHpWidth);
		return (width & 1) ? width + 1 : width;
};

Game_Actor.prototype.hpGaugeHeight = function() {
		return this.currentClass().hpGaugeHeight;
};

Game_Actor.prototype.hpGaugeBackColor = function() {
		return this.currentClass().hpGaugeBackColor;
};

Game_Actor.prototype.hpGaugeColor1 = function() {
		return this.currentClass().hpGaugeColor1;
};

Game_Actor.prototype.hpGaugeColor2 = function() {
		return this.currentClass().hpGaugeColor2;
};

//=============================================================================
// Game_Enemy
//=============================================================================

Game_Enemy.prototype.hpGaugeVisible = function() {
    if (this.isHidden()) return false;
		if (this.enemy().hideHpGauge) return false;
    if (BattleManager.isBattleTest()) return true;
		if (this.enemy().showHpGauge) return true;
		if (!$gameSystem.showHpGaugeEnemy(this._enemyId)) return false;
		return Game_Battler.prototype.hpGaugeVisible.call(this);
};

Yanfly.VHG.Game_Enemy_revive = Game_Enemy.prototype.revive;
Game_Enemy.prototype.revive = function() {
    if (this._hp === 0) this._noHpGauge = false;
		Yanfly.VHG.Game_Enemy_revive.call(this);
};

Game_Enemy.prototype.hpGaugeWidth = function() {
		if (this.enemy().hpGaugeWidth > 0) {
			var width = this.enemy().hpGaugeWidth;
		} else {
			var width = this.spriteWidth() / 2;
		}
		width = Math.max(width,	Yanfly.Param.VHGMinHpWidth);
		return (width & 1) ? width + 1 : width;
};

Game_Enemy.prototype.hpGaugeHeight = function() {
		return this.enemy().hpGaugeHeight;
};

Game_Enemy.prototype.hpGaugeBackColor = function() {
		return this.enemy().hpGaugeBackColor;
};

Game_Enemy.prototype.hpGaugeColor1 = function() {
		return this.enemy().hpGaugeColor1;
};

Game_Enemy.prototype.hpGaugeColor2 = function() {
		return this.enemy().hpGaugeColor2;
};

//=============================================================================
// Sprite_Battler
//=============================================================================

Yanfly.VHG.Sprite_Battler_update = Sprite_Battler.prototype.update;
Sprite_Battler.prototype.update = function() {
    Yanfly.VHG.Sprite_Battler_update.call(this);
	if(this._battler) {
		this.createVisualHpGaugeWindow();
		this.createVisualPleasureGaugeWindow();
		this.createVisualEnergyGaugeWindow();
	}
};

Sprite_Battler.prototype.createVisualHpGaugeWindow = function() {
		if (this._createdVisualHpGaugeWindow) return;
		if (!this._battler) return;
		if (this.checkVisualATBGauge()) {
			if (!this._visualATBWindow) return;
			if (!this.parent.parent.children.contains(this._visualATBWindow)) return;
		}
		this._createdVisualHpGaugeWindow = true;
    this._visualHpGauge = new Window_VisualHPGauge();
    this._visualHpGauge.setBattler(this._battler);
    this.parent.parent.addChild(this._visualHpGauge);
	//this._visualStaminaGauge = new Window_VisualStaminaGauge();
    //this._visualStaminaGauge.setBattler(this._battler);
    //this.parent.parent.addChild(this._visualStaminaGauge);
};

Sprite_Battler.prototype.checkVisualATBGauge = function() {
    if (!Imported.YEP_X_BattleSysATB) return false;
    if (!BattleManager.isATB()) return false;
    if (!Imported.YEP_X_VisualATBGauge) return false;
    return this._battler.isEnemy();
};

Yanfly.VHG.Sprite_Battler_setBattler = Sprite_Battler.prototype.setBattler;
Sprite_Battler.prototype.setBattler = function(battler) {
    Yanfly.VHG.Sprite_Battler_setBattler.call(this, battler);
    if (this._visualHpGauge) this._visualHpGauge.setBattler(battler);
	if (this._visualStaminaGauge) this._visualStaminaGauge.setBattler(battler);
	if (this._visualSPGauge) this._visualSPGauge.setBattler(battler);
};

//=============================================================================
// Window_VisualHPGauge
//=============================================================================

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

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

Window_VisualHPGauge.prototype.initialize = function() {
    this._opacitySpeed = 255 / Yanfly.Param.VHGGaugeDuration;
    this._dropSpeed = 0;
    this._visibleCounter = 0;
    Window_Base.prototype.initialize.call(this, 0, 0, 1, 1);
    this._battler = null;
    this._requestRefresh = false;
    this._currentHpValue = 0;
    this._displayedValue = 0;
    this.contentsOpacity = 0;
    this.opacity = 0;
};

Window_VisualHPGauge.prototype.setBattler = function(battler) {
    if (this._battler === battler) return;
    this._battler = battler;
    this._currentHpValue = this._battler ? this._battler.hp : 0;
    this._displayedValue = this._battler ? this._battler.hp : 0;
};

Window_VisualHPGauge.prototype.update = function() {
    Window_Base.prototype.update.call(this);
    if (!this._battler) return;
    this.updateWindowAspects();
};

Window_VisualHPGauge.prototype.updateWindowAspects = function() {
    this.updateWindowSize();
    this.updateWindowPosition();
    this.updateOpacity();
    this.updateHpPosition();
    this.updateRefresh();
};

Window_VisualHPGauge.prototype.updateWindowSize = function() {
    var spriteWidth = this._battler.hpGaugeWidth();
    var width = spriteWidth + this.standardPadding() * 2;
    width = Math.min(width, Graphics.boxWidth + this.standardPadding() * 2);
    var height = Math.max(this.lineHeight(), this.gaugeHeight() + 4);
    height += this.standardPadding() * 2;
    if (width === this.width && height === this.height) return;
    this.width = width;
    this.height = height;
    this.createContents();
    this._requestRefresh = true;
    this.makeWindowBoundaries();
};

Window_VisualHPGauge.prototype.makeWindowBoundaries = function() {
    if (!this._requestRefresh) return;
    this._minX = -1 * this.standardPadding();
    this._maxX = Graphics.boxWidth - this.width + this.standardPadding();
    this._minY = -1 * this.standardPadding();
    this._maxY = Graphics.boxHeight - this.height + this.standardPadding();
    this._maxY -= SceneManager._scene._statusWindow.height;
};

Window_VisualHPGauge.prototype.updateWindowPosition = function() {
    if (!this._battler) return;
    var battler = this._battler;
	//this.x = battler.spritePosX();
    this.x = battler.spritePosX() + this.standardPadding() + ENEMY_NAME_TEXT_X;
    //this.x -= Math.ceil(this.width / 2);
	this.x -= Math.ceil(this.width);
    this.x = this.x.clamp(this._minX, this._maxX);
    this.y = battler.spritePosY() + ENEMY_NAME_Y_VARIABLE;
    if (Yanfly.Param.VHGGaugePos) {
      this.y -= battler.spriteHeight();
    } else {
      this.y -= this.standardPadding();
    }
    //this.y = this.y.clamp(this._minY, this._maxY);
    this.y += Yanfly.Param.VHGBufferY;
};

Window_VisualHPGauge.prototype.updateOpacity = function() {
    if (this.isShowWindow()) {
      this.contentsOpacity += 32;
    } else {
      this.contentsOpacity -= 32;
    }
};

Window_VisualHPGauge.prototype.isShowWindow = function() {
    if (!this._battler.isAppeared()) return false;
    if (!this._battler.hpGaugeVisible()) return false;
    if (Yanfly.Param.VHGAlwaysShow && !this._battler.isDead()) return true;
    if (this._currentHpValue !== this._displayedValue) return true;
    if (this._battler.isSelected()) return true;
    --this._visibleCounter;
    return this._visibleCounter > 0;
};

Window_VisualHPGauge.prototype.updateHpPosition = function() {
    if (!this._battler) return;
    if (this._currentHpValue !== this._battler.hp) {
      this._visibleCounter = Yanfly.Param.VHGGaugeDuration;
      this._currentHpValue = this._battler.hp;
      var difference = Math.abs(this._displayedValue - this._battler.hp);
      this._dropSpeed = Math.ceil(difference / Yanfly.Param.VHGGaugeDuration);
    }
    this.updateDisplayCounter();
};

Window_VisualHPGauge.prototype.updateDisplayCounter = function() {
    if (this._battler._barrierAltered) {
      this._battler._barrierAltered = false;
    } else if (this._currentHpValue === this._displayedValue) {
      return;
    }
    var d = this._dropSpeed;
    var c = this._currentHpValue;
    if (this._displayedValue > this._currentHpValue) {
      this._displayedValue = Math.max(this._displayedValue - d, c);
    } else if (this._displayedValue < this._currentHpValue) {
      this._displayedValue = Math.min(this._displayedValue + d, c);
    }
    this._requestRefresh = true;
};

Window_VisualHPGauge.prototype.updateRefresh = function() {
    if (this._requestRefresh) this.refresh();
};

Window_VisualHPGauge.prototype.refresh = function() {
    this.contents.clear();
    if (!this._battler) return;
    this._requestRefresh = false;
    var wy = this.contents.height - this.lineHeight();
    var ww = this.contents.width;
    this.drawActorHp(this._battler, 0, wy, ww);
};

Window_VisualHPGauge.prototype.gaugeBackColor = function() {
    return this.textColor(this._battler.hpGaugeBackColor());
};

Window_VisualHPGauge.prototype.hpGaugeColor1 = function() {
    return this.textColor(this._battler.hpGaugeColor1());
};

Window_VisualHPGauge.prototype.hpGaugeColor2 = function() {
    return this.textColor(this._battler.hpGaugeColor2());
};

Window_VisualHPGauge.prototype.drawActorHp = function(actor, x, y, width) {
    width = width || 186;
    var color1 = this.hpGaugeColor1();
    var color2 = this.hpGaugeColor2();
    var rate = this._displayedValue / actor.mhp;
	//console.log(actor);
	//console.log(this._displayedValue);
	//console.log(actor.mhp);
    if (Imported.YEP_AbsorptionBarrier && actor.barrierPoints() > 0) {
      ww = this.drawBarrierGauge(actor, x, y, width);
    } else {
      this.drawGauge(x, y, width, rate, color1, color2);
    }
    if (Yanfly.Param.VHGShowHP) {
      this.changeTextColor(this.systemColor());
      this.drawText(TextManager.hpA, x, y, 44);
    }
    if (Yanfly.Param.VHGShowValue) {
      var val = this._displayedValue
      var max = actor.mhp;
      var w = width;
      var color = this.hpColor(actor);
      this.drawCurrentAndMax(val, max, x, y, w, color, this.normalColor());
    }
};

Window_VisualHPGauge.prototype.drawCurrentAndMax = function(current, max, x, y,
                                                   width, color1, color2) {
    if (Yanfly.Param.VHGShowMax) {
      Window_Base.prototype.drawCurrentAndMax.call(this, current, max,
        x, y, width, color1, color2);
    } else {
      var align = Yanfly.Param.VHGShowHP ? 'right' : 'center';
      var text = Yanfly.Util.toGroup(current);
      this.changeTextColor(color1);
      this.drawText(text, x, y, width, align);
    }
};

Window_VisualHPGauge.prototype.gaugeHeight = function() {
    if (!this._battler) return Window_Base.prototype.gaugeHeight.call(this);
    return this._battler.hpGaugeHeight();
};

if (Imported.YEP_CoreEngine && Yanfly.Param.VHGThick) {

Window_VisualHPGauge.prototype.drawGauge =
function(dx, dy, dw, rate, color1, color2) {
    var color3 = this.gaugeBackColor();
    var fillW = Math.floor(dw * rate).clamp(0, dw);
    var gaugeH = this.gaugeHeight();
    var gaugeY = dy + this.lineHeight() - gaugeH - 2;
    if (eval(Yanfly.Param.GaugeOutline)) {
      color3.paintOpacity = this.translucentOpacity();
      this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
      dx += 2;
      gaugeY += 2;
      fillW = Math.max(0, fillW - 4);
      gaugeH -= 4;
    } else {
      var fillW = Math.floor(dw * rate);
      var gaugeY = dy + this.lineHeight() - gaugeH - 2;
      this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
    }
    this.contents.gradientFillRect(dx, gaugeY, fillW, gaugeH, color1, color2);
};

} // Imported.YEP_CoreEngine

//=============================================================================
// Utilities
//=============================================================================

Yanfly.Util = Yanfly.Util || {};

if (!Yanfly.Util.toGroup) {
    Yanfly.Util.toGroup = function(inVal) {
        return inVal;
    }
};

//=============================================================================
// End of File
//=============================================================================
};


code:
//=============================================================================
// Yanfly Engine Plugins - Battle Engine Core Extension - Weak Enemy Poses
// YEP_X_WeakEnemyPoses.js
//=============================================================================

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

var Yanfly = Yanfly || {};
Yanfly.WEPose = Yanfly.WEPose || {};
Yanfly.WEPose.version = 1.03;

//=============================================================================
 /*:
 * @plugindesc v1.03 (Requires YEP_BattleEngineCore.js) Allow enemies to
 * have different battler images when they're weakened.
 * @author Yanfly Engine Plugins
 *
 * @help
 * ============================================================================
 * Introduction
 * ============================================================================
 *
 * This plugin requires YEP_BattleEngineCore. Make sure this plugin is located
 * under YEP_BattleEngineCore in the plugin list.
 *
 * Non-animated enemies often appear lifeless. They maintain one appearance
 * throughout the whole battle and do not change it under any circumstances.
 * This plugin allows you to set different images for enemies when they are
 * under certain health percentages as well as other conditions.
 *
 * ============================================================================
 * Notetags
 * ============================================================================
 *
 * Insert the following notetags into the database entries' noteboxes to alter
 * the weak pose data.
 *
 * Enemy Notetags:
 *
 *   <x% Health Pose: filename>
 *   - At x% HP or lower, the enemy will use 'filename' for its battler image
 *   instead of its default one. The filename is case sensitive and must not
 *   include the file extension. Insert multiple of these notetags to give the
 *   enemy various poses across different health values.
 *   * NOTE: This applies only to static enemies and NOT animated enemies.
 *
 *   <x% Health Pose: filename, hue>
 *   - At x% HP or lower, the enemy will use 'filename' for its battler image
 *   instead of its default one and a different hue instead of its default. The
 *   filename is case sensitive and must not include the file extension. The
 *   hue must be a value between 0 and 360. Insert multiple of these notetags
 *   to give the enemy various poses across different health values.
 *   * NOTE: This applies only to static enemies and NOT animated enemies.
 *
 * State Notetags:
 *
 *   <Force Enemy Pose: filename>
 *   - When an enemy is afflicted with this state, the enemy would take on this
 *   battler image as long as that state is the highest priority state with a
 *   forced enemy pose. Replace 'filename' with the battler image to be used.
 *   The filename is case sensitive and must not include the file extension.
 *   * NOTE: This applies only to static enemies and NOT animated enemies.
 *
 *   <Force Enemy Pose: filename, hue>
 *   - When an enemy is afflicted with this state, the enemy would take on this
 *   battler image as long as that state is the highest priority state with a
 *   forced enemy pose. Replace 'filename' with the battler image to be used.
 *   The filename is case sensitive and must not include the file extension.
 *   The hue must be a value between 0 and 360.
 *   * NOTE: This applies only to static enemies and NOT animated enemies.
 *
 * ============================================================================
 * Lunatic Mode - Custom Enemy Poses
 * ============================================================================
 *
 * For those with JavaScript experience, you can alter the pose used for an
 * enemy (static only, not animated) using these Lunatic Mode notetags:
 *
 * Enemy Notetags:
 *
 *   <Custom Enemy Pose>
 *    if (user.mpRate() >= 0.50) {
 *      name = 'Scorpion';
 *      hue = 180;
 *    } else {
 *      name = 'Spider';
 *    }
 *   </Custom Enemy Pose>
 *   - The 'name' variable will refer to the filename used for the battler
 *   image. The filename is case sensitive and must not include the file
 *   extension. If the 'hue' variable is used, then that hue will be forced.
 *   Otherwise, it will use the default hue of the enemy. The hue must be a
 *   value between 0 and 360.
 *   * NOTE: This applies only to static enemies and NOT animated enemies.
 *
 * State Notetags:
 *
 *   <Custom Enemy Pose>
 *    if (user.mpRate() >= 0.50) {
 *      name = 'Scorpion';
 *      hue = 180;
 *    } else {
 *      name = 'Spider';
 *    }
 *   </Custom Enemy Pose>
 *   - When an enemy is afflicted with this state, the enemy would take on the
 *   'name' image as long as that state is the highest priority state with a
 *   forced enemy pose. The filename is case sensitive and must not include the
 *   file extension. If the 'hue' variable is used, then that hue will be
 *   forced. Otherwise, it will use the default hue of the enemy. The hue must
 *   be a value between 0 and 360.
 *   * NOTE: This applies only to static enemies and NOT animated enemies.
 *
 * For the other variable to use:
 *
 *   defaultBattlerName
 *   - This will be the default battler's name.
 *
 *   defaultBattlerHue
 *   - This will be the default battler's hue.
 *
 * ============================================================================
 * Changelog
 * ============================================================================
 *
 * Version 1.03:
 * - Bypass the isDevToolsOpen() error when bad code is inserted into a script
 * call or custom Lunatic Mode code segment due to updating to MV 1.6.1.
 *
 * Version 1.02:
 * - Updated for RPG Maker MV version 1.5.0.
 *
 * Version 1.01:
 * - Lunatic Mode fail safes added.
 *
 * Version 1.00:
 * - Finished Plugin!
 */
//=============================================================================

if (Imported.YEP_BattleEngineCore) {

//=============================================================================
// DataManager
//=============================================================================

Yanfly.WEPose.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
  if (!Yanfly.WEPose.DataManager_isDatabaseLoaded.call(this)) return false;

  if (!Yanfly._loaded_YEP_X_WeakEnemyPoses) {
    this.processWEPoseNotetags1($dataEnemies);
    this.processWEPoseNotetags2($dataStates);
    Yanfly._loaded_YEP_X_WeakEnemyPoses = true;
  }

  return true;
};

DataManager.processWEPoseNotetags1 = function(group) {
  for (var n = 1; n < group.length; n++) {
    var obj = group[n];
    var notedata = obj.note.split(/[\r\n]+/);

    obj.weakPosesRate = [1.0];
    obj.weakPosesData = {
      1.0: [obj.battlerName, obj.battlerHue],
    };
    var evalMode = 'none';
    obj.weakPoseEval = '';

    for (var i = 0; i < notedata.length; i++) {
      var line = notedata[i];
      if (line.match(/<(\d+)([%％])[ ]HEALTH POSE:[ ](.*),[ ](\d+)>/i)) {
        var rate = parseFloat(RegExp.$1) * 0.01;
        var data = [String(RegExp.$3), parseInt(RegExp.$4).clamp(0, 360)];
        obj.weakPosesRate.push(rate);
        obj.weakPosesData[rate] = data;
      } else if (line.match(/<(\d+)([%％])[ ]HEALTH POSE:[ ](.*)>/i)) {
        var rate = parseFloat(RegExp.$1) * 0.01;
        var data = [String(RegExp.$3), -1];
        obj.weakPosesRate.push(rate);
        obj.weakPosesData[rate] = data;
      } else if (line.match(/<CUSTOM ENEMY POSE>/i)) {
        var evalMode = 'custom enemy pose';
      } else if (line.match(/<\/CUSTOM ENEMY POSE>/i)) {
        var evalMode = 'none';
      } else if (evalMode === 'custom enemy pose') {
        obj.weakPoseEval += line + '\n';
      }
    }

    this.sortObjectWeakPoses(obj);
  }
};

DataManager.sortObjectWeakPoses = function(obj) {
  obj.weakPosesRate.sort(function(a, b) { return b - a; });
};

DataManager.processWEPoseNotetags2 = function(group) {
  for (var n = 1; n < group.length; n++) {
    var obj = group[n];
    var notedata = obj.note.split(/[\r\n]+/);

    obj.forceEnemyPose = undefined;
    obj.forceEnemyHue = -1;
    var evalMode = 'none';
    obj.forceEnemyPoseEval = '';

    for (var i = 0; i < notedata.length; i++) {
      var line = notedata[i];
      if (line.match(/<FORCE ENEMY POSE:[ ](.*),[ ](\d+)>/i)) {
        obj.forceEnemyPose = String(RegExp.$1);
        obj.forceEnemyHue = parseInt(RegExp.$2).clamp(0, 360);
      } else if (line.match(/<FORCE ENEMY POSE:[ ](.*)>/i)) {
        obj.forceEnemyPose = String(RegExp.$1);
      } else if (line.match(/<CUSTOM ENEMY POSE>/i)) {
        var evalMode = 'custom enemy pose';
      } else if (line.match(/<\/CUSTOM ENEMY POSE>/i)) {
        var evalMode = 'none';
      } else if (evalMode === 'custom enemy pose') {
        obj.forceEnemyPoseEval += line + '\n';
      }
    }
  }
};

//=============================================================================
// Game_Battler
//=============================================================================

Yanfly.WEPose.Game_Battler_refresh = Game_Battler.prototype.refresh;
Game_Battler.prototype.refresh = function() {
  Yanfly.WEPose.Game_Battler_refresh.call(this);
  if (this.isEnemy()) this.clearWeakPoseData();
};

//=============================================================================
// Game_Enemy
//=============================================================================

Yanfly.WEPose.Game_Enemy_initMembers = Game_Enemy.prototype.initMembers;
Game_Enemy.prototype.initMembers = function() {
  Yanfly.WEPose.Game_Enemy_initMembers.call(this);
  this.clearWeakPoseData();
};

Game_Enemy.prototype.clearWeakPoseData = function() {
  this._weakPoseBattlerName = undefined;
  this._weakPoseBattlerHue = undefined;
};

Yanfly.WEPose.Game_Enemy_battlerName = Game_Enemy.prototype.battlerName;
Game_Enemy.prototype.battlerName = function() {
  if (this._weakPoseBattlerName !== undefined) {
    return this._weakPoseBattlerName;
  }
  this._weakPoseBattlerName = Yanfly.WEPose.Game_Enemy_battlerName.call(this);
  this._weakPoseBattlerHue = -1;
  this.makeEnemyWeakPoseData();
  this.makeEnemyWeakPoseEval();
  this.makeStateWeakPoseData();
  this.makeStateWeakPoseEval();
  return this._weakPoseBattlerName;
};

Yanfly.WEPose.Game_Enemy_battlerHue = Game_Enemy.prototype.battlerHue;
Game_Enemy.prototype.battlerHue = function() {
  if (this._weakPoseBattlerHue !== undefined) {
    if (this._weakPoseBattlerHue < 0) {
      return Yanfly.WEPose.Game_Enemy_battlerHue.call(this);
    } else {
      return this._weakPoseBattlerHue;
    }
  }
  return Yanfly.WEPose.Game_Enemy_battlerHue.call(this);
};

Game_Enemy.prototype.makeEnemyWeakPoseData = function() {
  var hpRate = this.hpRate();
  var data = this.enemy().weakPosesData;
  var rates = this.enemy().weakPosesRate;
  var length = rates.length;
  for (var i = 0; i < length; ++i) {
    var rate = rates[i];
    if (hpRate <= rate) {
      this._weakPoseBattlerName = data[rate][0];
      this._weakPoseBattlerHue = data[rate][1];
    } else {
      break;
    }
  }
};

Game_Enemy.prototype.makeEnemyWeakPoseEval = function() {
  var code = this.enemy().weakPoseEval;
  if (code === '') return;
  var hpRate = this.hpRate();
  var defaultBattlerName = Yanfly.WEPose.Game_Enemy_battlerHue.call(this);
  var defaultBattlerHue = Yanfly.WEPose.Game_Enemy_battlerHue.call(this);
  var name = this._weakPoseBattlerName;
  var hue = this._weakPoseBattlerHue;
  var a = this;
  var user = this;
  var subject = this;
  var b = this;
  var target = this;
  var s = $gameSwitches._data;
  var v = $gameVariables._data;
  try {
    eval(code);
  } catch (e) {
    Yanfly.Util.displayError(e, code, 'WEAK POSE EVAL ERROR');
  }
  this._weakPoseBattlerName = name;
  this._weakPoseBattlerHue = hue;
};

Game_Enemy.prototype.makeStateWeakPoseData = function() {
  var hpRate = this.hpRate();
  var states = this.states();
  var length = states.length;
  for (var i = 0; i < length; ++i) {
    var state = states[i];
    if (state && state.forceEnemyPose !== undefined) {
      this._weakPoseBattlerName = state.forceEnemyPose;
      this._weakPoseBattlerHue = state.forceEnemyHue;
      break;
    }
  }
};

Game_Enemy.prototype.makeStateWeakPoseEval = function() {
  var hpRate = this.hpRate();
  var states = this.states();
  var length = states.length;
  for (var i = 0; i < length; ++i) {
    var state = states[i];
    if (state && state.forceEnemyPoseEval !== '') {
      var code = state.forceEnemyPoseEval;
      var defaultBattlerName = Yanfly.WEPose.Game_Enemy_battlerHue.call(this);
      var defaultBattlerHue = Yanfly.WEPose.Game_Enemy_battlerHue.call(this);
      var name = this._weakPoseBattlerName;
      var hue = this._weakPoseBattlerHue;
      var a = this;
      var user = this;
      var subject = this;
      var b = this;
      var target = this;
      var s = $gameSwitches._data;
      var v = $gameVariables._data;
      try {
        eval(code);
      } catch (e) {
        Yanfly.Util.displayError(e, code, 'WEAK POSE STATE EVAL ERROR');
      }
      this._weakPoseBattlerName = name;
      this._weakPoseBattlerHue = hue;
      break;
    }
  }
};

//=============================================================================
// Utilities
//=============================================================================

Yanfly.Util = Yanfly.Util || {};

Yanfly.Util.displayError = function(e, code, message) {
  console.log(message);
  console.log(code || 'NON-EXISTENT');
  console.error(e);
  if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") return;
  if (Utils.isNwjs() && Utils.isOptionValid('test')) {
    if (!require('nw.gui').Window.get().isDevToolsOpen()) {
      require('nw.gui').Window.get().showDevTools();
    }
  }
};

//=============================================================================
// End of File
//=============================================================================
}; // Imported.YEP_BattleEngineCore

repo_name: voidljb/karryn

license: unknown


code:
//=============================================================================
// メッセージボックス中央揃い・右揃いプラグイン
// aligncenter.js
// Copyright (c) 2018 村人Ａ
//=============================================================================

/*:ja
 * @plugindesc メッセージボックスの文字を中央揃い、右揃いにするプラグインです。
 * @author 村人A
 *
 * @help
 *
 * メッセージ内で指定の行の冒頭で「\#」で中央揃い、[\_]で右揃いにします。
 * ex)メッセージ入力時
 *
 * ここはデフォルト（左揃い）
 * \#ここは中央ぞろい
 * \_ここは右揃い
 * ここはデフォルト（左揃い）
 *
 * となります。
 *
 * 拡大・縮小文字を揃えたい場合はや「\#」や「\_」の前に指定特殊文字「\{」や「\}」を
 * 入力してください。
 * ex)メッセージ入力時
 *
 * ここはデフォルト（左揃い）
 * \{\#ここは一段階大きな文字を中央ぞろい
 * \}}\_ここは一段階小さい文字を右揃い
 * ここは一段階小さい文字を左揃い
 *
 */

(function() {
	var _Window_Base_initialize = Window_Base.prototype.initialize;
	Window_Base.prototype.initialize = function(x, y, width, height) {
		_Window_Base_initialize.call(this, x, y, width, height);
		this.villaA_paddingleft = 0;
		this.villaA_procLine = 0;
	}

	Window_Base.prototype.obtainEscapeCode = function(textState) {
		textState.index++;
		var regExp = /^[\$\.\|\^!><\{\}\\\#\_]|^[A-Z]+/i;
		var arr = regExp.exec(textState.text.slice(textState.index));
		if (arr) {
			textState.index += arr[0].length;
			return arr[0].toUpperCase();
		} else {
			return '';
		}
	};

	Window_Message.prototype.processEscapeCharacter = function(code, textState) {
		switch (code) {
		case '$':
			this._goldWindow.open();
			break;
		case '.':
			this.startWait(15);
			break;
		case '|':
			this.startWait(60);
			break;
		case '!':
			this.startPause();
			break;
		case '>':
			this._lineShowFast = true;
			break;
		case '<':
			this._lineShowFast = false;
			break;
		case '^':
			this._pauseSkip = true;
			break;
		case '\#':
			var linelenght = textState.text.split(/\r\n|\r|\n/)
			this.villaA_paddingleft = (this.width - this.textWidth(linelenght[this.villaA_procLine]) - this.newLineX())/2;
			break;
		case '\_':
			var linelenght = textState.text.split(/\r\n|\r|\n/)
			this.villaA_paddingleft = this.width - this.textWidth(linelenght[this.villaA_procLine]) - 20 - this.newLineX();
			break;
		default:
			Window_Base.prototype.processEscapeCharacter.call(this, code, textState);
			break;
		}
	};

	Window_Base.prototype.processCharacter = function(textState) {
		switch (textState.text[textState.index]) {
		case '\n':
			this.processNewLine(textState);
			this.villaA_procLine++;
			break;
		case '\f':
			this.processNewPage(textState);
			break;
		case '\x1b':
			this.processEscapeCharacter(this.obtainEscapeCode(textState), textState);
			break;
		default:
			this.processNormalCharacter(textState);
			break;
		}
	};

	/*
	Window_Base.prototype.processNormalCharacter = function(textState) {
		var c = textState.text[textState.index++];
		var w = this.textWidth(c);
		this.contents.drawText(c, textState.x+this.villaA_paddingleft, textState.y, w * 2, textState.height);
		textState.x += w;
	};
	*/

	var _Window_Base_processNewLine = Window_Base.prototype.processNewLine
	Window_Base.prototype.processNewLine = function(textState) {
		_Window_Base_processNewLine.call(this, textState);
		this.villaA_paddingleft = 0;

	};

	var _Window_Message_startMessage = Window_Message.prototype.startMessage
	Window_Message.prototype.startMessage = function() {
			_Window_Message_startMessage.call(this);
			this.villaA_procLine = 0;
	};

	var _Window_Message_clearFlags = Window_Message.prototype.clearFlags
	Window_Message.prototype.clearFlags = function() {
	_Window_Message_clearFlags.call(this);
	this.villaA_paddingleft = 0;
	};
})();


code:
//==============================================================================
// dsShowBattleCommand.js
// Copyright (c) 2016 Douraku
// Released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//==============================================================================

/*:
 * @plugindesc 戦闘中のコマンド表示制御プラグイン ver1.00
 * @author 道楽
 *
 * @param Show Attack Command
 * @desc 攻撃コマンドを表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Guard Command
 * @desc 防御コマンドを表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Item Command
 * @desc アイテムコマンドを表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 01
 * @desc スキルタイプ01を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 02
 * @desc スキルタイプ02を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 03
 * @desc スキルタイプ03を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 04
 * @desc スキルタイプ04を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 05
 * @desc スキルタイプ05を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 06
 * @desc スキルタイプ06を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 07
 * @desc スキルタイプ07を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 08
 * @desc スキルタイプ08を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 09
 * @desc スキルタイプ09を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 10
 * @desc スキルタイプ10を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 11
 * @desc スキルタイプ11を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 12
 * @desc スキルタイプ12を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 13
 * @desc スキルタイプ13を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 14
 * @desc スキルタイプ14を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 15
 * @desc スキルタイプ15を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 16
 * @desc スキルタイプ16を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 17
 * @desc スキルタイプ17を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 18
 * @desc スキルタイプ18を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 19
 * @desc スキルタイプ19を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 20
 * @desc スキルタイプ20を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 21
 * @desc スキルタイプ21を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 22
 * @desc スキルタイプ22を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 23
 * @desc スキルタイプ23を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 24
 * @desc スキルタイプ24を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 25
 * @desc スキルタイプ25を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 26
 * @desc スキルタイプ26を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 27
 * @desc スキルタイプ27を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 28
 * @desc スキルタイプ28を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 29
 * @desc スキルタイプ29を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 *
 * @param Show Skill Type 30
 * @desc スキルタイプ30を表示するか
 * (true なら表示する / false なら表示しない)
 * @default true
 */

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

var dsShowBattleCommand = {};

(function(ns) {

	ns.Param = (function() {
		var ret = {};
		var parameters = PluginManager.parameters('dsShowBattleCommand');
		ret.ShowAttackCommand = Boolean(parameters['Show Attack Command'] === 'true' || false);
		ret.ShowGuardCommand = Boolean(parameters['Show Guard Command'] === 'true' || false);
		ret.ShowItemCommand = Boolean(parameters['Show Item Command'] === 'true' || false);
		ret.ShowSkillTypeMax = 1 + 30;
		ret.ShowSkillType = [];
		for ( var ii = 1; ii < ret.ShowSkillTypeMax; ii++ )
		{
			var paramName = 'Show Skill Type ' + ('00'+ii).slice(-2);
			ret.ShowSkillType[ii] = Boolean(parameters[paramName] === 'true' || false);
		}
		return ret;
	})();

	//--------------------------------------------------------------------------
	/** Window_ActorCommand */
	var _Window_ActorCommand_addAttackCommand = Window_ActorCommand.prototype.addAttackCommand;
	Window_ActorCommand.prototype.addAttackCommand = function()
	{
		if ( ns.Param.ShowAttackCommand )
		{
			_Window_ActorCommand_addAttackCommand.call(this);
		}
	};

	Window_ActorCommand.prototype.addSkillCommands = function()
	{
		var skillTypes = this._actor.addedSkillTypes();
		skillTypes.sort(function(a, b) {
			return a - b;
		});
		skillTypes.forEach(function(stypeId) {
			if ( this.isShowSkillType(stypeId) )
			{
				var name = $dataSystem.skillTypes[stypeId];
				this.addCommand(name, 'skill', true, stypeId);
			}
		}, this);
	};

	var _Window_ActorCommand_addGuardCommand = Window_ActorCommand.prototype.addGuardCommand;
	Window_ActorCommand.prototype.addGuardCommand = function()
	{
		if ( ns.Param.ShowGuardCommand )
		{
			_Window_ActorCommand_addGuardCommand.call(this);
		}
	};

	var _Window_ActorCommand_addItemCommand = Window_ActorCommand.prototype.addItemCommand;
	Window_ActorCommand.prototype.addItemCommand = function()
	{
		if ( ns.Param.ShowItemCommand )
		{
			_Window_ActorCommand_addItemCommand.call(this);
		}
	};

	Window_ActorCommand.prototype.isShowSkillType = function(stypeId)
	{
		if ( stypeId < ns.Param.ShowSkillTypeMax )
		{
			return ns.Param.ShowSkillType[stypeId];
		}
		return true;
	};

})(dsShowBattleCommand);


code:
//////
// Window BattleLog
///////////////////

//selfanimation code

/*
Remtairy.Misc.Window_BattleLog_showNormalAnimation = Window_BattleLog.prototype.showNormalAnimation;
Window_BattleLog.prototype.showNormalAnimation = function(targets, animationId, mirror) {
	if(BattleManager._action.item().hasTag("SelfAnimationSkill")) {
		Remtairy.Misc.Window_BattleLog_showNormalAnimation.call(this, [BattleManager._subject], animationId, mirror);
	}
	else
	Remtairy.Misc.Window_BattleLog_showNormalAnimation.call(this, targets, animationId, mirror);
};

*/

////stuff from saba battle

		//Remtairy Begin
		/*var _Game_Actor_performDamage = Game_Actor.prototype.performDamage;
		  Game_Actor.prototype.performDamage = function() {
			_Game_Actor_performDamage.call(this);
			this.setFaceId(2);
			this.preloadTachie();
		};*/

		/*var Scene_Battle = Scene_Battle.prototype.update;
		Scene_Battle.prototype.update = function() {
			var active = this.isActive();
			$gameTimer.update(active);
			$gameScreen.update();
			this.updateStatusWindow();
			this.updateWindowPositions();
			if (active && !this.isBusy()) {
				this.updateBattleProcess();
			}
			Scene_Base.prototype.update.call(this);
		};*/
		//Remtairy End

//=============================================================================
// バトル表情
//=============================================================================

  /*var _Game_Actor_performDamage = Game_Actor.prototype.performDamage;
  Game_Actor.prototype.performDamage = function() {
    _Game_Actor_performDamage.call(this);
     //$gameScreen.showPicture(2,'battle_face_damage',0,0,636,100,100,255,0);
	//Saba.tachieActorCommnad(this.actor(), "face", 2);
	this.setFaceId(2);
	this.preloadTachie();
	//$gameScreen.update();
	//SceneManager._scene.update();
	//$gameScreen.startFadeOut(55);
	//Saba.BattleTachie.updateTachie();
	//this.setCacheChanged();
};*/

 /* var _Game_Actor_performAction = Game_Actor.prototype.performAction;
  Game_Actor.prototype.performAction = function(action) {
    _Game_Actor_performAction.call(this, action);
    if (action.isAttack()) {
     $gameScreen.showPicture(2,'battle_face_attack',0,0,636,100,100,255,0);
    } else if (action.isMagicSkill() && action.isHpRecover()) {
     $gameScreen.showPicture(2,'battle_face_heal',0,0,636,100,100,255,0);
    } else if (action.isMagicSkill() && action.isForFriend()) {
     $gameScreen.showPicture(2,'battle_face_buff',0,0,636,100,100,255,0);
    } else if (action.isMagicSkill()) {
     $gameScreen.showPicture(2,'battle_face_skill',0,0,636,100,100,255,0);
    } else if (action.isSkill() && !action.isGuard()) {
     $gameScreen.showPicture(2,'battle_face_skill',0,0,636,100,100,255,0);
    }
  };

  var _BattleManager_processVictory = BattleManager.processVictory;
  BattleManager.processVictory = function() {
   $gameScreen.showPicture(3,'battle_face_win',0,0,636,100,100,255,0);
    _BattleManager_processVictory.call(this);
  };

  var _BattleManager_endTurn = BattleManager.endTurn;
  BattleManager.endTurn = function() {
     $gameScreen.erasePicture(2);
    _BattleManager_endTurn.call(this);
  };

  var _Game_Actor_performCollapse = Game_Actor.prototype.performCollapse;
  Game_Actor.prototype.performCollapse = function() {
    _Game_Actor_performCollapse.call(this);
     $gameScreen.showPicture(3,'battle_face_lose',0,0,636,100,100,255,0);
};

*/

//spriteactor position stuff
			var spc = ((Graphics.boxWidth - 14) / maxSize);
			var px = (((Graphics.boxWidth - 14) / maxSize) / 2) + (((Graphics.boxWidth - 14) / maxSize) * index);
			this._pos_x = Moghunter.bhud_pos_x + (((Graphics.boxWidth - 14) / partySize) / 2) + (((Graphics.boxWidth - 14) / partySize) * index);
			this._pos_y = Moghunter.bhud_pos_y;

			x = (index+1) * 360 - 140
			y = 640