code:
//=============================================================================
// MOG_BattleResult.js
//=============================================================================

/*:
 * @plugindesc (v1.3) Modifica a tela de vítoria.
 * @author Moghunter
 *
 * @param Exp X-Axis
 * @desc Posição X-Axis da EXP.
 * @default 760
 *
 * @param Exp Y-Axis
 * @desc Posição Y-Axis da EXP.
 * @default 160
 *
 * @param Gold X-Axis
 * @desc Posição X-Axis do Gold.
 * @default 760
 *
 * @param Gold Y-Axis
 * @desc Posição Y-Axis do Gold.
 * @default 230
 *
 * @param Treasure X-Axis
 * @desc Posição X-Axis do tersouro.
 * @default 32
 *
 * @param Treasure Y-Axis
 * @desc Posição Y-Axis do tesouro.
 * @default 330
 *
 * @param Actor X-Axis
 * @desc Posição X-Axis do personagem.
 * @default 250
 *
 * @param Actor Y-Axis
 * @desc Posição Y-Axis do personagem.
 * @default 0
 *
 * @param Parameter Real X-Axis
 * @desc Posição X-Axis dos parâmetros.
 * @default 0
 *
 * @param Parameter Real Y-Axis
 * @desc Posição Y-Axis dos parâmetros.
 * @default 0
 *
 * @param Parameter 1 X-Axis
 * @desc Posição X-Axis dos parâmetros antes do level-up.
 * @default 550
 *
 * @param Parameter 1 Y-Axis
 * @desc Posição Y-Axis dos parâmetros antes do level-up.
 * @default 140
 *
 * @param Parameter 2 X-Axis
 * @desc Posição X-Axis dos parâmetros depois do level-up.
 * @default 700
 *
 * @param Parameter 2 Y-Axis
 * @desc Posição Y-Axis dos parâmetros depois do level-up.
 * @default 140
 *
 * @param New Skill X-Axis
 * @desc Posição X-Axis da nova habilidade.
 * @default 570
 *
 * @param New Skill Y-Axis
 * @desc Posição Y-Axis da nova habilidade.
 * @default 520
 *
 * @param Name X-Axis
 * @desc Posição X-Axis do nome do personagem.
 * @default 155
 *
 * @param Name Y-Axis
 * @desc Posição Y-Axis do nome do personagem.
 * @default 540
 *
 * @help
 * =============================================================================
 * +++ MOG - Battle Result (v1.3) +++
 * By Moghunter
 * https://atelierrgss.wordpress.com/
 * =============================================================================
 * Modifica a tela de vítoria.
 * =============================================================================
 * Serão necessários os arquivos. (img/system/)
 *
 * Result_A.png
 * Result_B.png
 * Result_C.png
 * Result_D.png
 * Result_E.png
 *
 * =============================================================================
 * ACTOR PICTURE
 * =============================================================================
 * As imagens deverão ser gravadas na pasta /img/picture/
 * Nomeie as imagens da seguinte forma.
 *
 * Actor_ ID
 *
 * Exemplo
 *
 * Actor_1.png
 * Actor_2.png
 * Actor_3.png
 * ...
 *
 * =============================================================================
 * HISTÓRICO
 * =============================================================================
 * (v1.3) - Correção na apresentação de itens quando o valor é maior que 24.
 * (v1.2) - Correção do plugin parameter não funcionar.
 * (v1.1) - Correção de não apresentar a janela de status na batalha seguinte.
 */

//=============================================================================
// ** PLUGIN PARAMETERS
//=============================================================================

　　var Imported = Imported || {};
　　Imported.MOG_BattleResult = true;
　　var Moghunter = Moghunter || {};
	Moghunter.parameters = PluginManager.parameters('MOG_BattleResult');
	Moghunter.bresult_exp_x = Number(Moghunter.parameters['Exp X-Axis'] || 760);
    Moghunter.bresult_exp_y = Number(Moghunter.parameters['Exp Y-Axis'] || 160);
	Moghunter.bresult_gold_x = Number(Moghunter.parameters['Gold X-Axis'] || 760);
    Moghunter.bresult_gold_y = Number(Moghunter.parameters['Gold Y-Axis'] || 230);
	Moghunter.bresult_treasure_x = Number(Moghunter.parameters['Treasure X-Axis'] || 32);
    Moghunter.bresult_treasure_y = Number(Moghunter.parameters['Treasure Y-Axis'] || 330);
	Moghunter.bresult_actor_x = Number(Moghunter.parameters['Actor X-Axis'] || 250);
    Moghunter.bresult_actor_y = Number(Moghunter.parameters['Actor Y-Axis'] || 0);
	Moghunter.bresult_par0_x = Number(Moghunter.parameters['Parameter Real X-Axis'] || 0);
    Moghunter.bresult_par0_y = Number(Moghunter.parameters['Parameter Real Y-Axis'] || 0);
	Moghunter.bresult_par1_x = Number(Moghunter.parameters['Parameter 1 X-Axis'] || 550);
    Moghunter.bresult_par1_y = Number(Moghunter.parameters['Parameter 1 Y-Axis'] || 140);
	Moghunter.bresult_par2_x = Number(Moghunter.parameters['Parameter 2 X-Axis'] || 700);
    Moghunter.bresult_par2_y = Number(Moghunter.parameters['Parameter 2 Y-Axis'] || 140);
	Moghunter.bresult_skill_x = Number(Moghunter.parameters['New Skill X-Axis'] || 570);
    Moghunter.bresult_skill_y = Number(Moghunter.parameters['New Skill Y-Axis'] || 520);
	Moghunter.bresult_name_x = Number(Moghunter.parameters['Name X-Axis'] || 155);
    Moghunter.bresult_name_y = Number(Moghunter.parameters['Name Y-Axis'] || 540);

//=============================================================================
// ** Game Temp
//=============================================================================

//==============================
// ** Initialize
//==============================
var _mog_bresult_gtemp_initialize = Game_Temp.prototype.initialize;
Game_Temp.prototype.initialize = function() {
    _mog_bresult_gtemp_initialize.call(this);
    this.battleResultClear()
};

//==============================
// ** battle Result Clear
//==============================
Game_Temp.prototype.battleResultClear = function() {
	this._bResult = [false,[],0,0,[]];
	this._battleEnd = false;
};

//=============================================================================
// ** Game Actor
//=============================================================================

//==============================
// ** display LevelUP
//==============================
var _mog_bresult_gact_displayLevelUp = Game_Actor.prototype.displayLevelUp;
Game_Actor.prototype.displayLevelUp = function(newSkills) {
	if ($gameTemp._bResult[0]) {
		$gameTemp._bResult[4] = newSkills;
		return;
	};
	_mog_bresult_gact_displayLevelUp.call(this,newSkills);
};

//=============================================================================
// ** BattleManager
//=============================================================================

//==============================
// ** setup
//==============================
var _mog_brt_bmngr_setup = BattleManager.setup;
BattleManager.setup = function(troopId, canEscape, canLose) {
	_mog_brt_bmngr_setup.call(this,troopId, canEscape, canLose);
	$gameTemp.battleResultClear();
};

//==============================
// ** process Victory
//==============================
BattleManager.processVictory = function() {
	if (Imported.MOG_BattleCry) {
	    var actor = this.randomActor();
        if (actor) {SoundManager.selectVoice(actor._v_victory)};
	};
	AudioManager.fadeOutBgm(1);
	$gameTemp._battleEnd = true;
	$gameTemp._battleResult = true;
	this.getResultData();
    $gameParty.removeBattleStates();
    $gameParty.performVictory();
	this.endBattle(0);
};

//==============================
// ** get Result Data
//==============================
BattleManager.getResultData = function() {
	 this.makeRewards();
     $gameTemp._bResult[0] = true;
	 $gameTemp._bResult[1] = this._rewards.exp;
	 $gameTemp._bResult[2] = this._rewards.gold;
	 $gameTemp._bResult[3] = this._rewards.items;
	 $gameTemp._bResult[4] = [];
};

//==============================
// ** Update
//==============================
var _mog_bresult_update = BattleManager.update;
BattleManager.update = function() {
	if ($gameTemp._bResult[0]) {return};
	_mog_bresult_update.call(this);
};

//=============================================================================
// ** Scene Battle
//=============================================================================

//==============================
// ** Terminate
//==============================
var _mog_bresult_terminate = Scene_Battle.prototype.terminate;
Scene_Battle.prototype.terminate = function() {
	_mog_bresult_terminate.call(this);
	$gameTemp._bResult =  [false,[],0,0,[]];
};

//==============================
// ** Update
//==============================
var _mog_bresult_sbat_update = Scene_Battle.prototype.update;
Scene_Battle.prototype.update = function() {
	_mog_bresult_sbat_update.call(this);
	if ($gameTemp._bResult[0]) {this.updateBResult()};
};

//==============================
// ** updateWindow Position
//==============================
var _mog_bresult_updateWindowPositions = Scene_Battle.prototype.updateWindowPositions;
Scene_Battle.prototype.updateWindowPositions = function() {
	_mog_bresult_updateWindowPositions.call(this);
	if ($gameTemp._battleEnd) {
		this._statusWindow.opacity -= 10;
	    this._statusWindow.contentsOpacity -= 10;
	};
};

//==============================
// ** Update BResult
//==============================
Scene_Battle.prototype.updateBResult = function() {
	if (!this._bresult) {this.createBResult()};
};

//==============================
// ** createBresult
//==============================
Scene_Battle.prototype.createBResult = function() {
	this._bresult = new BattleResult();
	this.addChild(this._bresult);
};

//=============================================================================
// * Battle Result
//=============================================================================
function BattleResult() {
    this.initialize.apply(this, arguments);
};

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

//==============================
// * Initialize
//==============================
BattleResult.prototype.initialize = function() {
    Sprite.prototype.initialize.call(this);
	if (BattleManager._spriteset && BattleManager._spriteset.combo_sprite_data) {
		BattleManager._spriteset.combo_sprite_data[0] = 1;
	};
	this._phase = 0;
	this._actorIndex = 0;
	this._skillIndex = 0;
	this.z = 50;
	this._actor = null;
	this._actopar = [];
	this._playME = 10;
	this.phaseAniClear();
	this._phaseAnime[0] = 1;
	this._phaseAnime[1] = 1;
	this._numbeData = [-1,-1];
	this.loadImages();
	this.createObjects();
};

//==============================
// * Phase Ani Clear
//==============================
BattleResult.prototype.phaseAniClear = function() {
	this._phaseAnime = [0,0,0];
};

//==============================
// * loadImages
//==============================
BattleResult.prototype.loadImages = function() {
	this._icon_img = ImageManager.loadSystem("IconSet");
	this._layout_img = ImageManager.loadSystem("Result_A");
	this._number_img1 = ImageManager.loadSystem("Result_B");
	this._number_img2 = ImageManager.loadSystem("Result_C");
	this._layout2_img = ImageManager.loadSystem("Result_D");
	this._vict_img = ImageManager.loadSystem("Result_E");
};

//==============================
// * Press Any Key
//==============================
BattleResult.prototype.pressAnyKey = function() {
    if (TouchInput.isTriggered()) {return true};
	if (TouchInput.isCancelled()) {return true};
	if (Input.isTriggered("ok")) {return true};
	if (Input.isTriggered("cancel")) {return true};
    return false;
};

//==============================
// * Create Objects
//==============================
BattleResult.prototype.createObjects = function() {
	this.createVict();
	this.createLayout();
	this.createExp();
	this.createGold();
	this.createTreasures();
};

//==============================
// * Create Vict
//==============================
BattleResult.prototype.createVict = function() {
	this._vict = new Sprite(this._vict_img);
	this._vict.opacity = 0;
	this._vict.scale.x = 3.0;
	this._vict.scale.y = 3.0;
	this._vict.anchor.x = 0.5;
	this._vict.anchor.y = 0.5;
	this._vict.x = Graphics.boxWidth / 2;
	this._vict.y = Graphics.boxHeight / 2;
	this.addChild(this._vict);
};

//==============================
// * Create Layout
//==============================
BattleResult.prototype.createLayout = function() {
	this._layout = new Sprite(this._layout_img);
	this._layout.opacity = 0;
	this._layout.scale.x = 3.0;
	this._layout.anchor.x = 0.5;
	this._layout.x = Graphics.boxWidth / 2;
	this.addChild(this._layout);
};

//==============================
// * Create Exp
//==============================
BattleResult.prototype.createExp = function() {
    this._expNumber = [];
	this._expOld = 0;
	this._expOrg = [Moghunter.bresult_exp_x,Moghunter.bresult_exp_y];
	for (var i = 0; i < 8; i++) {
	   this._expNumber[i] = new Sprite(this._number_img1);
	   this._expNumber[i].visible = false;
	   this._expNumber[i].x = this._expOrg[0];
	   this._expNumber[i].y = this._expOrg[1];
	   this.addChild(this._expNumber[i]);
	};

};

//==============================
// * Create Gold
//==============================
BattleResult.prototype.createGold = function() {
    this._goldNumber = [];
    this._goldNumber = [];
	this._goldOld = 0;
	this._goldOrg = [Moghunter.bresult_gold_x,Moghunter.bresult_gold_y];
	for (var i = 0; i < 8; i++) {
	   this._goldNumber[i] = new Sprite(this._number_img1);
	   this._goldNumber[i].visible = false;
	   this._goldNumber[i].x = this._goldOrg[0];
	   this._goldNumber[i].y = this._goldOrg[1];
	   this.addChild(this._goldNumber[i]);
	};
};

//==============================
// * Add ICon
//==============================
BattleResult.prototype.addIcon = function(sprite,data) {
	var icon = new Sprite(this._icon_img);
	var w = Window_Base._iconWidth;
	var h = Window_Base._iconHeight;
	var sx = data.iconIndex % 16 * w;
	var sy = Math.floor(data.iconIndex / 16) * h;
    icon.setFrame(sx,sy,w,h);
    sprite.addChild(icon);
	var name = new Sprite(new Bitmap(160,32));
	name.bitmap.drawText(data.name,0,0,160,32);
	name.x = w + 4;
	sprite.addChild(name);
};

//==============================
// * Create Treasures
//==============================
BattleResult.prototype.createTreasures = function() {
	this._treasures = [];
	var x = Moghunter.bresult_treasure_x;
	var y = Moghunter.bresult_treasure_y;
	var s = 400;
	var w = 200;
	var h = 60;
	for (var i = 0; i < $gameTemp._bResult[3].length; i++) {
		  if (i > 23) {
			  break
		  }
	      this._treasures[i] = new Sprite();
		  this._treasures[i].opacity = 0;
		  this.addChild(this._treasures[i]);
		  var l = Math.floor(i / 3);
		  this._treasures[i].x = x + (w * i) - Math.floor(l * s);
		  this._treasures[i].y = y + (l * h);
		  this.addIcon(this._treasures[i],$gameTemp._bResult[3][i]);
	};
};

//==============================
// * getData
//==============================
BattleResult.prototype.getData = function() {
    this._numbeData[0] = this._number_img1.width / 10;
    this._numbeData[1] = this._number_img1.height;
};

//==============================
// * Update Dif
//==============================
BattleResult.prototype.update_dif = function(value,real_value,speed) {
	if (value == real_value) {return value};
	var dnspeed = 1 + (Math.abs(value - real_value) / speed);
	if (value > real_value) {value -= dnspeed;
	    if (value < real_value) {value = real_value};}
    else if (value < real_value) {value  += dnspeed;
    	if (value  > real_value) {value  = real_value};
    };
	return Math.floor(value);
};

//==============================
// * Refresh Number
//==============================
BattleResult.prototype.refresh_number = function(sprites,value,img_data,x,center) {
    numbers = Math.abs(value).toString().split("");
   	for (var i = 0; i < sprites.length ; i++) {sprites[i].visible = false;
	   if (i > numbers.length) {return};
	   var n = Number(numbers[i]);
	   sprites[i].setFrame(n * img_data[0], 0, img_data[0], img_data[1]);
	   sprites[i].visible = true;
	   if (center === 0) {
     	   var nx = -(img_data[0] * i) + (img_data[0] * numbers.length);
	   } else {
		   var nx = -(img_data[0] * i) + ((img_data[0] / 2) * numbers.length);
	   };
	   sprites[i].x = x - nx;
    };
};

//==============================
// * Update
//==============================
BattleResult.prototype.update = function() {
	Sprite.prototype.update.call(this);
	if (this._numbeData[0] === -1 && this._number_img1.isReady() && this._number_img2.isReady()) {this.getData()};
	if (this._numbeData[0] === -1) {return};
	if (this._phaseAnime[1] > 0) {this._phaseAnime[1] --;return};
	if (this._playME > 0) {this.updateME()};
    switch (this._phase) {
		case 0:
            this.updateStart();
            break;
        case 1:
            this.updateExp();
            break;
        case 2:
            this.updateGold();
            break;
        case 3:
            this.updateTreasure();
            break;
        case 4:
            this.updateLevel();
            break;
        case 5:
            this.updateEnd();
            break;
        };
};

//==============================
// * update ME
//==============================
BattleResult.prototype.updateME = function() {
	this._playME --
	if (this._playME === 0) {
		BattleManager.playVictoryMe();
		BattleManager.replayBgmAndBgs();
	};
};

//==============================
// * Update Start
//==============================
BattleResult.prototype.updateStart = function() {
	if (this._phaseAnime[0] > 0) {
        this.updateVictAnimation();
    } else {
        this.updateLayoutAnimation();
	};
};

//==============================
// * Update Layout Animation
//==============================
BattleResult.prototype.updateLayoutAnimation = function() {
	this._layout.opacity += 5;
	if (this._layout.scale.x > 1.00) {
		this._layout.scale.x -= 0.05;
		if (this._layout.scale.x < 1.00) {this._layout.scale.x = 1.00};
	} else {
		this.phaseAniClear();
		this._phase = 1;
	};
};

//==============================
// * Update Vict Animation
//==============================
BattleResult.prototype.updateVictAnimation = function() {
	   if (this._phaseAnime[0] === 1) {
		    if (this._vict.scale.x > 1.00) {
				this._vict.scale.x -= 0.05;
				this._vict.opacity += 15;
				if (this._vict.scale.x <= 1.00) {
					this._vict.scale.x = 1.00;
					this._vict.opacity = 255;
					this._phaseAnime[0] = 2;
					this._phaseAnime[1] = 5;
				};
			};
	   } else {
		    if (this._vict.scale.x < 3.00) {
				this._vict.scale.x += 0.05;
				this._vict.opacity -= 10;
				if (this._vict.scale.x >= 3.00) {
					this._vict.scale.x = 3.00;
					this._vict.opacity = 0;
					this._phaseAnime[0] = 0;
				};
			};
	   };
	   this._vict.scale.y = this._vict.scale.x;
};

//==============================
// * Update Exp
//==============================
BattleResult.prototype.updateExp = function() {
	 if (this.pressAnyKey() &&  $gameTemp._bResult[1] > 0) {
         this._expOld = $gameTemp._bResult[1] - 1;
	 };
	 var dif_number = this.update_dif(this._expOld,$gameTemp._bResult[1],15);
	 if (this._expOld != dif_number) {this._expOld = dif_number;
	 this.refresh_number(this._expNumber,this._expOld,this._numbeData,this._expOrg[0],0)};
	 if (this._expOld === $gameTemp._bResult[1]) {
		 this.phaseAniClear();
		 this._phase = 2;
		 SoundManager.playCursor();
	 };
};

//==============================
// * Update Gold
//==============================
BattleResult.prototype.updateGold = function() {
	 if (this.pressAnyKey() &&  $gameTemp._bResult[1] > 0) {
         this._goldOld = $gameTemp._bResult[2] - 1;
	 };
	 var dif_number = this.update_dif(this._goldOld,$gameTemp._bResult[2],15);
	 if (this._goldOld != dif_number) {this._goldOld = dif_number;
	 this.refresh_number(this._goldNumber,this._goldOld,this._numbeData,this._goldOrg[0],0)};
	 if (this._goldOld === $gameTemp._bResult[2]) {
		 BattleManager.gainGold();
		 this.phaseAniClear();
		 this._phase = 3;
		 SoundManager.playCursor();
	 };
};

//==============================
// * Update Treasure
//==============================
BattleResult.prototype.updateTreasure = function() {
	if (this._treasures.length > 0) {
		for (var i = 0; i < this._treasures.length; i++) {
			this._treasures[i].opacity += 10;
		};
		if (this._treasures[0].opacity >= 255 && this._phaseAnime[0] === 0) {
			this._phaseAnime[0] = 1;
		};
	} else {
	    this._phaseAnime[0] = 1;
	};
	if (this._phaseAnime[0] === 1 && this.pressAnyKey()) {
		BattleManager.gainDropItems();
		this.phaseAniClear();
		this._phase = 4;
	};
};

//==============================
// * Update Level
//==============================
BattleResult.prototype.updateLevel = function() {
	if (this._layout.opacity > 0) {this.updateFade()};
	if (!this._actor && this._actorIndex >= $gameParty.battleMembers().length) {
		this._phase = 5;
		SoundManager.playCursor();
	} else {
		if (this._actor) {
			this.updateLevelAnimation();
		} else {
			this.gainEXP();
		};
	};
};

//==============================
// * Create Level Sprites
//==============================
BattleResult.prototype.createLevelSprites = function() {
	this.disposeLevel();
	this._phaseAnime[0] = 0;
	this._phaseAnime[1] = 10;
	this.createActorSprite();
    this.createLevelLayout();
    this.createParameters();
    this.createActorName();
	this.playVoice();
};

//==============================
// * Play Voice
//==============================
BattleResult.prototype.playVoice = function() {
	if (Imported.MOG_BattleCry) {SoundManager.selectVoice(this._actor._v_levelup)};
};

//==============================
// * Create Level Layout
//==============================
BattleResult.prototype.createLevelLayout = function() {
	this._levelLayout = new Sprite(this._layout2_img);
	this._levelLayout.opacity = 0;
	this._levelLayout.anchor.x = 0.5;
	this._levelLayout.anchor.y = 0.5;
	this._levelLayout.x = Graphics.boxWidth / 2;
	this._levelLayout.y = Graphics.boxHeight / 2;
	this._levelLayout.scale.x = 3.0;
	this.addChild(this._levelLayout);
};

//==============================
// * Create Actor Name
//==============================
BattleResult.prototype.createActorName = function() {
	this._name = new Sprite(new Bitmap(140,32));
	this._name.opacity = 0;
	this._name.bitmap.drawText(this._actor._name,0,0,140,32);
	this._name.x = Moghunter.bresult_name_x;
	this._name.y = Moghunter.bresult_name_y;
	this.addChild(this._name);
};

//==============================
// * Create Actor Sprite
//==============================
BattleResult.prototype.createActorSprite = function() {
	var img = ImageManager.loadPicture("Actor_" + this._actor._actorId)
	this._spriteActor = new Sprite(img);
	this._spriteActor.opacity = 0;
	this._spriteActor.anchor.x = 0.5;
	this.addChild(this._spriteActor);
};

//==============================
// * Create Parameters
//==============================
BattleResult.prototype.createParameters = function() {
	var x = Moghunter.bresult_par1_x;
	var y = Moghunter.bresult_par1_y;
	this._par = new Sprite(new Bitmap(Graphics.boxWidth,Graphics.boxHeight));
	this._par.opacity = 0;
	this._par.bitmap.drawText(this._actopar[0],x,y,100,32);
	this._par.bitmap.drawText(this._actopar[1],x,y + 32 * 1,100,32);
	this._par.bitmap.drawText(this._actopar[2],x,y + 32 * 2,100,32);
	this._par.bitmap.drawText(this._actopar[3],x,y + 32 * 3,100,32);
	this._par.bitmap.drawText(this._actopar[4],x,y + 32 * 4,100,32);
	this._par.bitmap.drawText(this._actopar[5],x,y + 32 * 5,100,32);
	this._par.bitmap.drawText(this._actopar[6],x,y + 32 * 6,100,32);
	this._par.bitmap.drawText(this._actopar[7],x,y + 32 * 7,100,32);
	this._par.bitmap.drawText(this._actopar[8],x,y + 32 * 8,100,32);
	var x = Moghunter.bresult_par2_x;
	var y = Moghunter.bresult_par2_y;
	this._par.bitmap.drawText(this._actor._level,x,y,100,32);
	this._par.bitmap.drawText(this._actor.mhp,x,y + 32 * 1,100,32);
	this._par.bitmap.drawText(this._actor.mmp,x,y + 32 * 2,100,32);
	this._par.bitmap.drawText(this._actor.atk,x,y + 32 * 3,100,32);
	this._par.bitmap.drawText(this._actor.def,x,y + 32 * 4,100,32);
	this._par.bitmap.drawText(this._actor.mat,x,y + 32 * 5,100,32);
	this._par.bitmap.drawText(this._actor.mdf,x,y + 32 * 6,100,32);
	this._par.bitmap.drawText(this._actor.agi,x,y + 32 * 7,100,32);
	this._par.bitmap.drawText(this._actor.luk,x,y + 32 * 8,100,32);
	this.addChild(this._par);
};

//==============================
// * Refresh New Skill
//==============================
BattleResult.prototype.refreshNewSkill = function() {
	SoundManager.playUseSkill();
    this.removeChild(this._skill);
	this._skill = new Sprite();
	this._skill.x = Moghunter.bresult_skill_x;
	this._skill.y = Moghunter.bresult_skill_y;
	this._skill.opacity = 0;
	this.addChild(this._skill);
    this.addIcon(this._skill,$gameTemp._bResult[4][this._skillIndex]);
	this._skillIndex += 1;
	this._skillAnime = [0,0];
};

//==============================
// * dispose Level
//==============================
BattleResult.prototype.disposeLevel = function() {
	this.removeChild(this._spriteActor);
    this.removeChild(this._par);
	this.removeChild(this._levelLayout);
	this.removeChild(this._name);
	this.removeChild(this._skill);
	this._skill = null;
};

//==============================
// * Update Animation
//==============================
BattleResult.prototype.updateLevelAnimation = function() {
    this.updateLevelPosition();
    this._spriteActor.opacity += 10;
	this._levelLayout.opacity += 10;
	this._name.opacity  += 10;
	this._par.opacity += 10;
    if (this._skill) {this.updateSkillAnimation()};
	if (this.pressAnyKey()) {
		if (this._skillIndex >= $gameTemp._bResult[4].length) {
	        this.clearParData();
		} else {
			this.refreshNewSkill();
		};
	};
};

//==============================
// * Update Level Position
//==============================
BattleResult.prototype.updateLevelPosition = function() {
	if (this._phaseAnime[0] === 0) {
		this._phaseAnime[0] = 1;
		this._spriteActor.x = -this._spriteActor.width + Moghunter.bresult_actor_x;
		this._par.x = this._spriteActor.width + Moghunter.bresult_actor_x;
	};
	this._spriteActor.x = this.sprite_move_to(this._spriteActor.x,Moghunter.bresult_actor_x,20);
	this._spriteActor.y = Graphics.boxHeight - this._spriteActor.height + Moghunter.bresult_actor_y;
	if (this._levelLayout.scale.x > 1.00) {
		this._levelLayout.scale.x -= 0.05;
		if (this._levelLayout.scale.x < 1.00) {this._levelLayout.scale.x = 1.00};
	};
	this._par.x = this.sprite_move_to(this._par.x,Moghunter.bresult_par0_x,20);
	this._par.y = Moghunter.bresult_par0_y;
};

//==============================
// * Update Skill Animation
//==============================
BattleResult.prototype.updateSkillAnimation = function() {
	this._skill.opacity += 10;
	this._skillAnime[0] ++;
	if (this._skillAnime[0] < 20) {
		this._skill.y -= 2;
	} else if (this._skillAnime[0] < 40) {
		this._skill.y += 2;
	};
};

//==============================
// * Sprite Move To
//==============================
BattleResult.prototype.sprite_move_to = function(value,real_value,speed) {
	if (value == real_value) {return value};
	var dnspeed = 5 + (Math.abs(value - real_value) / speed);
	if (value > real_value) {value -= dnspeed;
	    if (value < real_value) {value = real_value};}
    else if (value < real_value) {value  += dnspeed;
    	if (value  > real_value) {value  = real_value};
    };
	return Math.floor(value);
};

//==============================
// * clear Par DAta
//==============================
BattleResult.prototype.clearParData = function() {
	this._actor = null;
	this.disposeLevel();
	this._skillIndex = 0;
	$gameTemp._bResult[4] = [];
};

//==============================
// * Gain EXP
//==============================
BattleResult.prototype.gainEXP = function() {
	 var actor = $gameParty.battleMembers()[this._actorIndex];
	 this._actopar = [actor._level,actor.mhp,actor.mmp,actor.atk,actor.def,actor.mat,actor.mdf,actor.agi,actor.luk];
	 var lvOld = actor._level
     actor.gainExp($gameTemp._bResult[1]);
     this._actorIndex += 1;
	 if (actor._level > lvOld) {
		 this._actor = actor;
		 this.createLevelSprites();
		 SoundManager.playCursor();
	 } else {
         this.clearParData();
	 };
};

//==============================
// * Update Fade
//==============================
BattleResult.prototype.updateFade = function() {
	this._layout.opacity -= 10;
	for (var i = 0; i < this._expNumber.length; i++) {
	   this._expNumber[i].opacity = this._layout.opacity;
	};
	for (var i = 0; i < this._goldNumber.length; i++) {
	   this._goldNumber[i].opacity = this._layout.opacity;
	};
	for (var i = 0; i < this._treasures.length; i++) {
     	this._treasures[i].opacity = this._layout.opacity;
    };
	if (this._phase === 5 && this._layout.opacity <= 0) {
       $gameTemp._bResult = [false,[],0,0,[]];;
	};
};

//==============================
// * Update End
//==============================
BattleResult.prototype.updateEnd = function() {
	if (this._layout.opacity <= 0) {
       $gameTemp._bResult = [false,[],0,0,[]];;
	} else {
	   this.updateFade();
	};
};

repo_name: dazed/translations

license: unknown


code:
//=============================================================================
// MOG_BossHP.js
//=============================================================================

/*:
 * @plugindesc (v2.4 *) Apresenta um medidor de HP para os chefes.
 * @author Moghunter
 *
 * @param Shake Effect
 * @desc Ativar o efeito tremer.
 * @default true
 * @type boolean
 *
 * @param HP Number Visible
 * @desc Apresentar o HP em numeros.
 * @default true
 * @type boolean
 *
 * @param Show Face
 * @desc Apresentar a face do inimigo.
 * @default true
 * @type boolean
 *
 * @param Slant Animation
 * @desc Ativar a animação de Flow no medidor de HP.
 * @default true
 * @type boolean
 *
 * @param Flow Speed
 * @desc Definição da velocidade da animação.
 * @default 4
 * @type number
 *
 * @param Name Font Size
 * @desc Definição do tamanho da fonte.
 * @default 18
 * @type number
 *
 * @param Layout X-Axis
 * @desc Posição X-Axis do layout.
 * @default 150
 *
 * @param Layout Y-Axis
 * @desc Posição Y-Axis do layout.
 * @default 10
 *
 * @param Name X-Axis
 * @desc Posição X-Axis do numero.
 * @default 36
 *
 * @param Name Y-Axis
 * @desc Posição Y-Axis do numero.
 * @default 23
 *
 * @param Face X-Axis
 * @desc Posição X-Axis da face.
 * @default -50
 *
 * @param Face Y-Axis
 * @desc Posição Y-Axis da face.
 * @default 10
 *
 * @param Meter X-Axis
 * @desc Posição X-Axis do medidor.
 * @default 22
 *
 * @param Meter Y-Axis
 * @desc Posição Y-Axis do medidor.
 * @default 28
 *
 * @param Number X-Axis
 * @desc Posição X-Axis do número.
 * @default 460
 *
 * @param Number Y-Axis
 * @desc Posição Y-Axis do número.
 * @default 32
 *
 * @param Number Percentage
 * @desc Apresentar o número em porcentagem.
 * @default false
 * @type boolean
 *
 * @param Show States
 * @desc Apresentar o ícones das codições.
 * @default true
 * @type boolean
 *
 * @param States Max
 * @desc Número maximo dos ícones visiveis.
 * @default 8
 * @type number
 *
 * @param States X-axis
 * @desc Posição X-Axis das codições.
 * @default 50
 *
 * @param States Y-axis
 * @desc Posição Y-Axis das codições.
 * @default -8
 *
 * @help
 * =============================================================================
 * +++ MOG - Boss HP Meter (v2.4) +++
 * By Moghunter
 * https://atelierrgss.wordpress.com/
 * =============================================================================
 * Apresenta um medidor de HP para os chefes.
 *
 * =============================================================================
 * - IMAGES
 * =============================================================================
 * Serão necessários os arquivos. (img/bosshp/)
 *
 * Boss_HP_A.png
 * Boss_HP_A.png
 * Boss_HP_C.png
 * Boss_HP_D.png
 *
 * =============================================================================
 * - ENEMIES NOTETAGS
 * =============================================================================
 * Use a Tag abaixo na caixa de notas para definir quais os inimigos terão o
 * medidor de chefe.
 *
 * Boss HP
 *
 * =============================================================================
 * - FACE NAME
 * =============================================================================
 * Nomeie as faces dos inimigos da seguinte maneira.
 *
 * Face_ + ID.png
 *
 * EG
 *
 * Face_1.png
 * Face_2.png
 * Face_3.png
 * ....
 *
 * =============================================================================
 * - PLUGIN COMMANDS
 * =============================================================================
 * Para definir a posição do medidor de HP use o seguinte comentário através do
 * comando PLUGIN COMMAND.
 *
 * boss_hp_position : X : Y
 *
 * X - Posição X-axis.
 * Y - Posição X-axis.
 *
 * -----------------------------------------------------------------------------
 * Para ocultar ou mostrar os numeros de HP use o seguinte comentário através do
 * comando PLUGIN COMMAND.
 *
 * boss_hp_number_hide
 * boss_hp_number_show
 *
 * ============================================================================
 * - WHAT'S  NEW (version 2.4)
 * ============================================================================
 * - (NEW) - Plugins parameters compatíveis com RM1.5+
 * - (BUG FIX) - Correção de não ocultar os ícones das condições.
 * - (BUG FIX) - Correção do plugin parameter da posição do nome X-Axis.
 *
 */

//=============================================================================
// ** PLUGIN PARAMETERS
//=============================================================================
　　var Imported = Imported || {};
　　Imported.MOG_BossHP = true;
　　var Moghunter = Moghunter || {};

  　Moghunter.parameters = PluginManager.parameters('MOG_BossHP');
	Moghunter.bosshp_flowAnimation = String(Moghunter.parameters['Slant Animation'] || "true");
	Moghunter.bosshp_flowAnimationSpeed = Number(Moghunter.parameters['Flow Speed'] || 4);
	Moghunter.bosshp_face = String(Moghunter.parameters['Show Face'] || "true");
    Moghunter.bosshp_faceX = Number(Moghunter.parameters['Face X-Axis'] || -50);
	Moghunter.bosshp_faceY = Number(Moghunter.parameters['Face Y-Axis'] || 10);
    Moghunter.bosshp_layout_x = Number(Moghunter.parameters['Layout X-Axis'] || 150);
    Moghunter.bosshp_layout_y = Number(Moghunter.parameters['Layout Y-Axis'] || 10)
    Moghunter.bosshp_meter_x = Number(Moghunter.parameters['Meter X-Axis'] || 22);
    Moghunter.bosshp_meter_y = Number(Moghunter.parameters['Meter Y-Axis'] || 28);
	Moghunter.bosshp_number_perMode = String(Moghunter.parameters['Number Percentage'] || "false");
    Moghunter.bosshp_number_x = Number(Moghunter.parameters['Number X-Axis'] || 460);
    Moghunter.bosshp_number_y = Number(Moghunter.parameters['Number Y-Axis'] || 32);
    Moghunter.bosshp_name_x = Number(Moghunter.parameters['Name X-Axis'] || 36);
    Moghunter.bosshp_name_y = Number(Moghunter.parameters['Name Y-Axis'] || 23);
	Moghunter.bosshp_font_size = Number(Moghunter.parameters['Name Font Size'] || 18);
	Moghunter.bosshp_shake_effect = String(Moghunter.parameters['Shake Effect'] || "true");
	Moghunter.bosshp_hp_number_visible = String(Moghunter.parameters['HP Number Visible'] || "true");
    Moghunter.bosshp_states = String(Moghunter.parameters['Show States'] || "true");
	Moghunter.bosshp_statesN = Number(Moghunter.parameters['States Max'] || 8);
    Moghunter.bosshp_statesX = Number(Moghunter.parameters['States X-axis'] || 50);
	Moghunter.bosshp_statesY = Number(Moghunter.parameters['States Y-axis'] || -8);

//=============================================================================
// ** ImageManager
//=============================================================================

//==============================
// * Boss Hp
//==============================
ImageManager.loadBossHp = function(filename) {
    return this.loadBitmap('img/bosshp/', filename, 0, true);
};

//=============================================================================
// ** Game_Temp
//=============================================================================

//==============================
// * Initialize
//==============================
var _mog_bosshp_temp_initialize = Game_Temp.prototype.initialize
Game_Temp.prototype.initialize = function() {
	_mog_bosshp_temp_initialize.call(this);
	this._battler_bhp_temp = [null,0,false,0];
	this._battler_bhp_refresh = false;
	this._battler_bhp_refresh2 = false
	this._battler_bhp_remove = false;
	this._forceCreateBossHud = false;
	this._forceRemoveBossHud = false;
};

//=============================================================================
// ** Game_System
//=============================================================================

//==============================
// * Initialize
//==============================
var _mog_bosshp_sys_initialize = Game_System.prototype.initialize
Game_System.prototype.initialize = function() {
	_mog_bosshp_sys_initialize.call(this);
	this._bosshp_data = [Moghunter.bosshp_layout_x,Moghunter.bosshp_layout_y,Moghunter.bosshp_hp_number_visible];
	this._battler_bhp_oldNumber = [0,0];
	this._chronoBossEnemy = null;
	this._chronoBossMapID = 0;
}

//==============================
// * Check Boss HP Enemies
//==============================
Game_System.prototype.checkBossHpEnemies = function() {
	var boss = null;
	if (Imported.MOG_ChronoEngine) {
		if ($gameSystem.isChronoMode()) {
			$gameMap.enemiesF().forEach(function(enemy) {
				 battler = enemy.battler()
				 if (battler._bosshp_meter) {boss = battler};
			},this);
		} else if ($gameSystem._chronoBossEnemy) {
		     boss = $gameSystem._chronoBossEnemy;
	    };
	} else {
		$gameTroop.members().forEach(function(enemy) {
				if (enemy._bosshp_meter && !enemy.isHidden()) {boss = enemy};
		},this);
	};
	return boss;
};

//=============================================================================
// ** Game_Interpreter
//=============================================================================

//==============================
// * PluginCommand
//==============================
var _mog_bosshp_ex_pluginCommand = Game_Interpreter.prototype.pluginCommand
Game_Interpreter.prototype.pluginCommand = function(command, args) {
	_mog_bosshp_ex_pluginCommand.call(this,command, args)
    this.setPluginCommandBossHP(command, args);
	return true;
};

//==============================
// * set Plugin Command Boss HP
//==============================
Game_Interpreter.prototype.setPluginCommandBossHP = function(command, args) {
	if (command == "boss_hp_position")  { $gameSystem._bosshp_data[0] = args[1];
	     $gameSystem._bosshp_data[1] = args[3];};
	if (command == "boss_hp_number_hide")  {$gameSystem._bosshp_data[2] = "false";};
	if (command == "boss_hp_number_show")  {$gameSystem._bosshp_data[2] = "true";};
	if (command == "boss_hp_erase")  {$gameTemp._battler_bhp_remove = "true";};
	if (Imported.MOG_ChronoEngine) {
		if (command == "boss_set_event_battler_id")  {
			for (var i = 0; i < $gameMap.allEnemiesOnMap().length; i++) {
				var ev = $gameMap.allEnemiesOnMap()[i];
				var battler = ev.battler();
				if (battler._bosshp_meter) {
				    $gameSystem._chronoBossEnemy = battler;
					$gameTemp._battler_bhp_refresh = true;
					if (Imported.MOG_ChronoEngine) {
					   $gameTemp._forceCreateBossHud = true;
					};
					break;
				};
			};
		};
	};
};

//=============================================================================
// ** BattleManager
//=============================================================================

//==============================
// * processVictory
//==============================
var _mog_bosshp_processVictory = BattleManager.processVictory;
BattleManager.processVictory = function() {
	 $gameTemp._battler_bhp_temp[2] = true
	 _mog_bosshp_processVictory.call(this);
};

//==============================
// * processAbort
//==============================
var _mog_bosshp_processAbort = BattleManager.processAbort;
BattleManager.processAbort = function() {
	 $gameTemp._battler_bhp_temp[2] = true
	_mog_bosshp_processAbort.call(this);
};

//==============================
// * processDefeat
//==============================
var _mog_bosshp_processDefeat = BattleManager.processDefeat;
BattleManager.processDefeat = function() {
	 $gameTemp._battler_bhp_temp[2] = true
	_mog_bosshp_processDefeat.call(this);
};

//=============================================================================
// ** Game Battler
//=============================================================================

//==============================
// * Notetags
//==============================
Game_Battler.prototype.notetags = function() {
	if (this.isEnemy()) {return this.enemy().note.split(/[\r\n]+/)};
	if (this.isActor()) {return this.actor().note.split(/[\r\n]+/)};
};

//==============================
// * Appear
//==============================
var _mog_bhp_gbat_appear = Game_BattlerBase.prototype.appear;
Game_BattlerBase.prototype.appear = function() {
    _mog_bhp_gbat_appear.call(this);
	$gameTemp._battler_bhp_refresh = true;
};

//=============================================================================
// ** Game BattlerBase
//=============================================================================

//==============================
// * Initialize
//==============================
var _mog_bossHP_gbat_initMembers = Game_BattlerBase.prototype.initMembers
Game_BattlerBase.prototype.initMembers = function() {
	_mog_bossHP_gbat_initMembers.call(this);
	this.need_refresh_bhud_states = false;
	this._nrsBoss = false;
};

//==============================
// * addNewState
//==============================
var _mog_bossHP_addNewState = Game_BattlerBase.prototype.addNewState
Game_BattlerBase.prototype.addNewState = function(stateId) {
    _mog_bossHP_addNewState.call(this,stateId);
	this._nrsBoss = true;
};

//==============================
// * eraseState
//==============================
var _mog_bossHP_eraseState = Game_BattlerBase.prototype.eraseState
Game_BattlerBase.prototype.eraseState = function(stateId) {
	_mog_bossHP_eraseState.call(this,stateId);
	this._nrsBoss = true;
};

//=============================================================================
// ** Game_Enemy
//=============================================================================

//==============================
// * initMembers
//==============================
var _alias_mog_bosshp_initMembers = Game_Enemy.prototype.initMembers;
Game_Enemy.prototype.initMembers = function() {
	_alias_mog_bosshp_initMembers.call(this);
	this._bosshp_meter = false;
};

//==============================
// * Setup
//==============================
var _alias_mog_bosshp_setup = Game_Enemy.prototype.setup;
Game_Enemy.prototype.setup = function(enemyId, x, y) {
	_alias_mog_bosshp_setup.call(this,enemyId, x, y);
    this.checkBossHPnoteTag();
};

//==============================
// * Setup
//==============================
Game_Enemy.prototype.checkBossHPnoteTag = function() {
	for (var i = 0; i < this.notetags().length; i++) {
		if (this.notetags()[i] == "Boss HP") {this._bosshp_meter = true};
	};
};

//==============================
// * transform
//==============================
var _mog_bosshp_enemy_transform = Game_Enemy.prototype.transform;
Game_Enemy.prototype.transform = function(enemyId) {
	_mog_bosshp_enemy_transform.call(this,enemyId)
    $gameTemp._battler_bhp_refresh = true;
	this.checkBossHPnoteTag();
};

//=============================================================================
// ** Game Action
//=============================================================================

//==============================
// * Apply
//==============================
var _alias_mog_bosshp_apply = Game_Action.prototype.apply;
Game_Action.prototype.apply = function(target) {
	 if (target.isEnemy() && target._bosshp_meter) {
		 $gameTemp._battler_bhp_temp[1] = target.hp;
	     var old_hp = target.hp; $gameTemp._battler_bhp_temp[3] = 0
	 };
	 _alias_mog_bosshp_apply.call(this,target);
	 if (target.isEnemy() && target._bosshp_meter) {
		 $gameTemp._battler_bhp_temp[0] = target;
	     if (old_hp > target.hp) {$gameTemp._battler_bhp_temp[3] = 60};
	 };
};

//=============================================================================
// ** Scene Map
//=============================================================================

//==============================
// * Terminate
//==============================
var _mog_bossHP_smap_terminate = Scene_Map.prototype.terminate;
Scene_Map.prototype.terminate = function() {
	if (Imported.MOG_ChronoEngine && this._spriteset._bosshp_sprites) {
		this.chronoCheckBossHPTerminate()
	};
    _mog_bossHP_smap_terminate.call(this);
};

//==============================
// * chrono Check Boss HP Term
//==============================
Scene_Map.prototype.chronoCheckBossHPTerminate = function() {
	$gameSystem._chronoBossEnemy = null;
	$gameSystem._chronoBossMapID = $gameMap._mapId;
	var battler = this._spriteset._bosshp_sprites._battler;
	if (!battler.isDead()) {
	    $gameSystem._chronoBossEnemy = battler;
		$gameSystem._battler_bhp_oldNumber[0] = this._spriteset._bosshp_sprites._hp_data[2];
		$gameSystem._battler_bhp_oldNumber[1] = this._spriteset._bosshp_sprites._hp_data[6];
		$gameTemp._forceCreateBossHud2 = true;
	};
};

//=============================================================================
// ** Spriteset_Base
//=============================================================================

//==============================
// * Initialize
//==============================
var _mog_bossHPCN_sprBase_initialize = Sprite_Base.prototype.initialize;
Sprite_Base.prototype.initialize = function() {
   _mog_bossHPCN_sprBase_initialize.call(this);
   if ($gameSystem._chronoBossMapID != $gameMap._mapId) {;
       $gameSystem._chronoBossEnemy = null;
	   $gameSystem._chronoBossMapID = $gameMap._mapId;
   };
};

//=============================================================================
// ** Scene Base
//=============================================================================

//==============================
// ** create Hud Field
//==============================
Scene_Base.prototype.createHudField = function() {
	this._hudField = new Sprite();
	this._hudField.z = 10;
	this.addChild(this._hudField);
};

//==============================
// ** sort MZ
//==============================
Scene_Base.prototype.sortMz = function() {
   this._hudField.children.sort(function(a, b){return a.mz-b.mz});
};

//==============================
// * Create Boss HP Sprites
//==============================
Scene_Base.prototype.createBossHPGauge = function() {
	$gameTemp._battler_bhp_refresh = false;
	var init_battler = $gameSystem.checkBossHpEnemies();
	this.removeBossHPGauge();
	if (init_battler) {
		if (!this._bosshp_sprites) {
			 this.removeBossHPGauge();
			 this._bosshp_sprites = new Sprite_BossHP(init_battler);
			 this._bosshp_sprites.mz = 130;
			 this._hudField.addChild(this._bosshp_sprites);
		};
	};
	this.sortMz();
};

//==============================
// ** remove Boss HP Gauge
//==============================
Scene_Base.prototype.removeBossHPGauge = function() {
	$gameTemp._battler_bhp_remove = false;
	if (!this._bosshp_sprites) {return};
	this._hudField.removeChild(this._bosshp_sprites);
    this._bosshp_sprites = null;
};

//=============================================================================
// ** Scene Battle
//=============================================================================

//==============================
// ** create Spriteset
//==============================
var _mog_bossHP_sbattle_createSpriteset = Scene_Battle.prototype.createSpriteset;
Scene_Battle.prototype.createSpriteset = function() {
	_mog_bossHP_sbattle_createSpriteset.call(this);
	if (!this._hudField) {this.createHudField()};
    this.createBossHPGauge();
	this.sortMz();
};

//==============================
// ** update
//==============================
var _mog_bossHP_sbattle_update = Scene_Battle.prototype.update;
Scene_Battle.prototype.update = function() {
	_mog_bossHP_sbattle_update.call(this);
    if ($gameTemp._forceCreateBossHud) {this.recreateBossHP()};
};

//==============================
// ** recreate Boss HP
//==============================
Scene_Battle.prototype.recreateBossHP = function() {
	$gameTemp._forceCreateBossHud = false;
    this.createBossHPGauge();
};

//=============================================================================
// ** SpriteSet Base
//=============================================================================

//==============================
// ** create Hud Field
//==============================
Spriteset_Base.prototype.createHudField = function() {
	this._hudField = new Sprite();
	this._hudField.z = 10;
	this.addChild(this._hudField);
};

//==============================
// ** sort MZ
//==============================
Spriteset_Base.prototype.sortMz = function() {
   this._hudField.children.sort(function(a, b){return a.mz-b.mz});
};

//==============================
// * Create Boss HP Sprites
//==============================
Spriteset_Base.prototype.createBossHPGauge = function() {
	$gameTemp._battler_bhp_refresh = false;
	var init_battler = $gameSystem.checkBossHpEnemies();
	this.removeBossHPGauge();
	if (init_battler) {
		if (!this._bosshp_sprites) {
			 this.removeBossHPGauge();
			 this._bosshp_sprites = new Sprite_BossHP(init_battler);
			 this._bosshp_sprites.mz = 130;
			 this._hudField.addChild(this._bosshp_sprites);
		};
	};
	this.sortMz();
};

//==============================
// ** remove Boss HP Gauge
//==============================
Spriteset_Base.prototype.removeBossHPGauge = function() {
	$gameTemp._battler_bhp_remove = false;
	if (!this._bosshp_sprites) {return};
	this._hudField.removeChild(this._bosshp_sprites);
    this._bosshp_sprites = null;
};

//==============================
// * force Create BossHud
//==============================
Spriteset_Base.prototype.forceCreateBossHud = function() {
    $gameTemp._forceCreateBossHud = false;
	$gameTemp._forceCreateBossHud2 = false;
	this.removeBossHPGauge();
	this.createBossHPGauge();
	$gameSystem._chronoBossEnemy = null;
};

//==============================
// * force remove BossHud
//==============================
Spriteset_Base.prototype.forceRemoveBossHud = function() {
    $gameTemp._forceRemoveBossHud = false;
	this.removeBossHPGauge();
	$gameSystem._chronoBossEnemy = null;
};

//=============================================================================
// ** SpriteSet Map
//=============================================================================

//==============================
// ** create Lower Layer
//==============================
var _mog_BossHP_sprMap_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;
Spriteset_Map.prototype.createLowerLayer = function() {
    _mog_BossHP_sprMap_createLowerLayer.call(this);
	if (!this._hudField) {this.createHudField()};
	if (Imported.MOG_ChronoEngine) {
	   if ($gameTemp._forceCreateBossHud2) {this.forceCreateBossHud()};
	    this.sortMz();
	};
};

//==============================
// ** Update
//==============================
var _mog_bossHP_Sprmap_update = Spriteset_Map.prototype.update;
Spriteset_Map.prototype.update = function() {
	_mog_bossHP_Sprmap_update.call(this);
	if ($gameTemp._forceCreateBossHud) {this.forceCreateBossHud()};
	if ($gameTemp._forceRemoveBossHud) {this.forceRemoveBossHud()};
};

//=============================================================================
// ** Sprite_BossHP
//=============================================================================
function Sprite_BossHP() {
    this.initialize.apply(this, arguments);
}

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

//==============================
// * Initialize
//==============================
Sprite_BossHP.prototype.initialize = function(init_battler) {
    Sprite.prototype.initialize.call(this);
	this._init = true;
	this.opacity = 0;
	$gameTemp._battler_bhp_temp = [init_battler,init_battler.hp,false,0];
	this._flowAnimation = String(Moghunter.bosshp_flowAnimation) === "true" ? true : false;
	this._battler = init_battler;
	this._hp_data = [-1,-1,0,0,0,0,0,0,0,Number($gameSystem._bosshp_data[0]),Number($gameSystem._bosshp_data[1]),false,true];
	this._hp_perMode = String(Moghunter.bosshp_number_perMode) === "true" ? true : false;
    this.createSprites();
	if (String(Moghunter.bosshp_shake_effect) === "true") {this._hp_data[11] = true};
	if (String($gameSystem._bosshp_data[2]) != "true") {this._hp_data[12] = false};
};

//==============================
// * create Sprites
//==============================
Sprite_BossHP.prototype.createSprites = function() {
	this.x = this._hp_data[9];
	this.y = this._hp_data[10];
    this.createLayout();
    this.createHPMeter();
	if (String(Moghunter.bosshp_face) === "true") {this.createFace()};
	this.createHPNumber();
	if (String(Moghunter.bosshp_states) === "true") {this.createStates()};
    this.createName();
};

//==============================
// * createLayout
//==============================
Sprite_BossHP.prototype.createLayout = function() {
	this._layout = new Sprite(ImageManager.loadBossHp("Boss_HP_A"));
	this.addChild(this._layout);
};

//==============================
// * create States
//==============================
Sprite_BossHP.prototype.createStates = function() {
	this._states_data = [0,0,0];
	this._stateIcons = [];
	this._stateImg = ImageManager.loadSystem("IconSet");
	this._state_icon = new Sprite();
	this._state_icon.x = Number(Moghunter.bosshp_statesX);
	this._state_icon.y = Number(Moghunter.bosshp_statesY);
	this._state_icon.visible = false;
	this.addChild(this._state_icon);
	this.refreshStates();
};

//==============================
// * refresh States
//==============================
Sprite_BossHP.prototype.refreshStates = function() {
	this._state_icon.visible = false;
	this._battler._nrsBoss = false;
	for (i = 0; i < this._stateIcons.length; i++){
		this._state_icon.removeChild(this._stateIcons[i]);
	};
	this._stateIcons = [];
	if (this._battler.allIcons().length == 0 || this._battler.isDead()) {return};
	this._state_icon.visible = true;
	var w = Window_Base._iconWidth;
	var icons = this._battler.allIcons().slice(0,w);
	var m = Math.min(Math.max(this._battler.allIcons().length,0),Moghunter.bosshp_statesN);
	for (i = 0; i < m; i++){
		 this._stateIcons[i] = new Sprite(this._stateImg);
	     var sx = icons[i] % 16 * w;
		 var sy = Math.floor(icons[i] / 16) * w;
		 this._stateIcons[i].setFrame(sx, sy, w, w);
	     this._stateIcons[i].x = ((w + 4) * i);
		 this._state_icon.addChild(this._stateIcons[i]);
	};
};

//==============================
// * Update States
//==============================
Sprite_BossHP.prototype.updateStates = function() {
	if (this._battler._nrsBoss) {this.refreshStates()};
};

//==============================
// * create Face
//==============================
Sprite_BossHP.prototype.createFace = function() {
     this._face = new Sprite();
	 this.addChild(this._face);
	 this.refreshFace();
	 this.updateFace();
};

//==============================
// * update Face
//==============================
Sprite_BossHP.prototype.updateFace = function() {
	 this._face.x = Moghunter.bosshp_faceX;
	 this._face.y = Moghunter.bosshp_faceY;
	 this._face.visible = this._layout.visible;
};

//==============================
// * refresh Face
//==============================
Sprite_BossHP.prototype.refreshFace = function() {
    this._face.bitmap = ImageManager.loadBossHp("Face_" + String(this._battler._enemyId));
};

//==============================
// * create HP Meter
//==============================
Sprite_BossHP.prototype.createHPMeter = function() {
	this._hp_meter_red = new Sprite(ImageManager.loadBossHp("Boss_HP_B"));
	this._hp_meter_red.x = Moghunter.bosshp_meter_x;
	this._hp_meter_red.y = Moghunter.bosshp_meter_y;
	this._hp_meter_redFlow = [-1,0,0,0];
	this._hp_meter_red.setFrame(0,0,1,1);
	this.addChild(this._hp_meter_red);
	this._hp_meter_blue = new Sprite(ImageManager.loadBossHp("Boss_HP_B"));
	this._hp_meter_blue.x = this._hp_meter_red.x;
	this._hp_meter_blue.y = this._hp_meter_red.y;
	this._hp_meter_blueFlow = [-1,0,0,0];
	this._hp_meter_blue.setFrame(0,0,1,1);
	this.addChild(this._hp_meter_blue);
};

//==============================
// * create HP Number
//==============================
Sprite_BossHP.prototype.createHPNumber = function() {
	this._hp_number = [];
	this._hp_number_data = []
	this._hp_number_img = ImageManager.loadBossHp("Boss_HP_C");
	for (var i = 0; i < 6; i++) {
		 this._hp_number[i] = new Sprite(this._hp_number_img);
		 this._hp_number[i].visible = false;
		 this._hp_number[i].x = Moghunter.bosshp_number_x;
		 this._hp_number[i].y = Moghunter.bosshp_number_y;
		 this._hp_number_data[i] = 0;
		 this.addChild(this._hp_number[i]);
	};
	if (this._hp_perMode) {this.createPerc()};
};

//==============================
// * create Per
//==============================
Sprite_BossHP.prototype.createPerc = function() {
     this._perSprite = new Sprite(ImageManager.loadBossHp("Boss_HP_D"));
	 this.addChild(this._perSprite);
};

//==============================
// * create Name
//==============================
Sprite_BossHP.prototype.createName = function() {
	this._name = new Sprite(new Bitmap(300,48));
	this.addChild(this._name);
	this._name.bitmap.fontSize = Moghunter.bosshp_font_size;
	this.refresh_name();
	this._name.x = Moghunter.bosshp_name_x;
	this._name.y = Moghunter.bosshp_name_y;
};

//==============================
// * get Sprite Data
//==============================
Sprite_BossHP.prototype.getSpriteData = function() {
	    this._hp_meter_blueFlow[0] = this._flowAnimation ? (this._hp_meter_blue.bitmap.width / 3) : this._hp_meter_blue.bitmap.width;
		this._hp_meter_blueFlow[1] = this._hp_meter_blue.bitmap.height;
		this._hp_meter_blueFlow[2] = this._hp_meter_blueFlow[0] * 2;
		this._hp_meter_blueFlow[3] = 0;
	    this._hp_meter_redFlow[0] = this._flowAnimation ? (this._hp_meter_red.bitmap.width / 3) : this._hp_meter_red.bitmap.width;
		this._hp_meter_redFlow[1] = this._hp_meter_red.bitmap.height;
		this._hp_meter_redFlow[2] = this._hp_meter_redFlow[0] * 2;
		this._hp_meter_redFlow[3] = 0;
};

//==============================
// * Update
//==============================
Sprite_BossHP.prototype.update = function() {
    Sprite.prototype.update.call(this);
	if (this._hp_meter_blueFlow[0] === -1) {
	    if (this._layout.bitmap.isReady()) {
			this.getSpriteData();
		} else {
			return
		};
    };
	if (this._flowAnimation) {this.updateFlowAnimation()};
	if ($gameTemp._battler_bhp_temp[3] != 0) {this.refreshShake()};
	if (this.need_onSkillCancelites()) {this.onSkillCancelites(5)} else {this.onSkillCancelites(-5)};
	if ($gameTemp._battler_bhp_temp[0] != this._battler) {this.refresh_all();	};
	if (this._flowAnimation) {
	    this.refresh_blue_meter();
	} else if (this._hp_data[0] != this._battler.hp || this._hp_data[1] != this._battler.mhp) {
		this.refresh_blue_meter();
	};
	if (this._hp_data[2] != this._battler.hp) {this.refresh_red_meter();};
	if (this._hp_data[6] != this._battler.hp) {this.update_hp_number();};
	if (this._hp_data[11]) {this.update_shake_effect();};
	if (this._face) {this.updateFace()};

	if (this._state_icon) {this.updateStates()};
	this._init = false;
};

//==============================
// * refresh Shake
//==============================
Sprite_BossHP.prototype.refreshShake = function() {
	this._hp_data[7] = $gameTemp._battler_bhp_temp[3];
	$gameTemp._battler_bhp_temp[3] = 0;
};

//==============================
// * Update Flow Animation
//==============================
Sprite_BossHP.prototype.updateFlowAnimation = function() {
    this._hp_meter_blueFlow[3] += Moghunter.bosshp_flowAnimationSpeed;
	if (this._hp_meter_blueFlow[3] > this._hp_meter_blueFlow[2]) {
		this._hp_meter_blueFlow[3] = 0;
	};
    this._hp_meter_redFlow[3] += Moghunter.bosshp_flowAnimationSpeed;
	if (this._hp_meter_redFlow[3] > this._hp_meter_redFlow[2]) {
		this._hp_meter_redFlow[3] = 0;
	};
};

//==============================
// * Update Shake Effect
//==============================
Sprite_BossHP.prototype.update_shake_effect = function() {
    if (this._hp_data[7] <= 0) {return;};
	this._hp_data[7] -= 1;
	this.y = -3 + this._hp_data[10] + Math.floor(Math.random() * 6);
	if (this._hp_data[7] <= 0) {this.y = this._hp_data[10]};
};

//==============================
// * Update HP Number
//==============================
Sprite_BossHP.prototype.update_hp_number = function() {
	  if (!this._hp_data[12]) {return};
	  if (this._init && $gameSystem._battler_bhp_oldNumber[1] != 0) {
		  this._hp_data[6] = $gameSystem._battler_bhp_oldNumber[1];
		  $gameSystem._battler_bhp_oldNumber[1] = 0;
	  };
      var nspd = 1 + Math.floor((Math.abs(this._hp_data[6] - this._battler.hp) / 30))
      if (this._hp_data[6] < this._battler.hp) {
		  this._hp_data[6] += nspd;
		  if (this._hp_data[6] > this._battler.hp) {this._hp_data[6] = this._battler.hp};
	  }
	  else if (this._hp_data[6] > this._battler.hp) {
		  this._hp_data[6] -= nspd;
		  if (this._hp_data[6] < this._battler.hp) {this._hp_data[6] = this._battler.hp};
	  };
	  this.refresh_hp_number();
};

//==============================
// * Refresh HP Number
//==============================
Sprite_BossHP.prototype.refresh_hp_number = function() {
   var w = this._hp_number_img.width / 10;
   var h = this._hp_number_img.height;
   if (this._hp_perMode) {
       var value = Math.floor((this._hp_data[6] / this._battler.mhp) * 100);
   } else {
       var value = this._hp_data[6];
   };
   this._hp_data[4] = Math.abs(value).toString().split("");
   if (this._hp_data[4].length > this._hp_number.length) {return};
   if (this._hp_data[4].length != this._hp_data[5]) {
	   for (var i = 0; i < 6; i++) {this._hp_number[i].visible = false};this._hp_data[5] = this._hp_data[4].length};
   for (var i = 0; i < this._hp_data[4].length; i++) {
	   var n = Number(this._hp_data[4][i]);
	   this._hp_number[i].setFrame(n * w, 0, w, h);
	   this._hp_number[i].visible = true;
	   var nx = -(w * i) + (w * this._hp_data[4].length)
	   this._hp_number[i].x = Moghunter.bosshp_number_x - nx;
   };
   if (this._perSprite) {
		this._perSprite.x = Moghunter.bosshp_number_x + 4;
		this._perSprite.y = Moghunter.bosshp_number_y;
   };
};

//==============================
// * Refresh Name
//==============================
Sprite_BossHP.prototype.refresh_name = function() {
	this._name.bitmap.clear();
	this._name.bitmap.drawText(this._battler.enemy().name, 0, 0, this._name.bitmap.width, this._name.bitmap.height,0);
};

//==============================
// * Need Fade Sprites
//==============================
Sprite_BossHP.prototype.need_onSkillCancelites = function() {
	if ($gameMessage.isBusy()) {return true} ;
	if ($gameTemp._battler_bhp_temp[2]) {return true} ;
	if (!this._battler) {return true} ;
	if (this._battler.isDead()) {return true};
	return false;
};

//==============================
// * Fade Sprites
//==============================
Sprite_BossHP.prototype.onSkillCancelites = function(value) {
	if (this._init) {
		this.opacity = 255;
	    return;
	};
	this.opacity -= value;
};

//==============================
// * Refresh All
//==============================
Sprite_BossHP.prototype.refresh_all = function() {
	 this._battler = $gameTemp._battler_bhp_temp[0];
	 this._hp_data[2] = $gameTemp._battler_bhp_temp[1];
	 this._hp_data[6] = $gameTemp._battler_bhp_temp[1];
	 this.refresh_hp_number();
	 this.refresh_blue_meter();
	 this.refresh_red_meter();
	 this.refresh_name();
	 if (this._face) {this.refreshFace()};
	 if (this._state_icon) {this.refreshStates()};
};

//==============================
// * Refresh Blue Meter
//==============================
Sprite_BossHP.prototype.refresh_blue_meter = function() {
	 this._hp_data[0] = this._battler.hp;
	 this._hp_data[1] = this._battler.mhp;
     this.y = this._hp_data[10]
	 var meter_rate = this._hp_meter_blueFlow[0] * this._battler.hp / this._battler.mhp;
	 this._hp_meter_blue.setFrame(this._hp_meter_blueFlow[3], 0, meter_rate, this._hp_meter_blue.bitmap.height / 2);
};

//==============================
// * Refresh Red Meter
//==============================
Sprite_BossHP.prototype.refresh_red_meter = function() {
	  if (this._init) {
		  if ($gameSystem._battler_bhp_oldNumber[0] != 0) {
		      this._hp_data[2] = $gameSystem._battler_bhp_oldNumber[0];
		      $gameSystem._battler_bhp_oldNumber[0] = 0;
		  } else {
			this._hp_data[2] = this._battler.mhp;
		  };
	 };
	  var dnspeed = 1 + (Math.abs(this._hp_data[2] - this._battler.hp) / 160);
	  if (this._hp_data[2] > this._battler.hp) {this._hp_data[2] -= dnspeed;
		  if (this._hp_data[2] < this._battler.hp) {this._hp_data[2] = this._battler.hp};}
	  else if (this._hp_data[2] < this._battler.hp) {this._hp_data[2]  += dnspeed;
		  if (this._hp_data[2]  > this._battler.hp) {this._hp_data[2]  = this._battler.hp};
	  };
	 var meter_rate = this._hp_meter_redFlow[0] * this._hp_data[2] / this._battler.mhp;
	 this._hp_meter_red.setFrame(this._hp_meter_redFlow[3], this._hp_meter_red.bitmap.height / 2, meter_rate, this._hp_meter_red.bitmap.height / 2);
};


code:
//=============================================================================
// MOG_CharParticles.js
//=============================================================================

/*:
 * @plugindesc (v1.1) Adiciona o sistema de partículas nos characters.
 * @author Moghunter
 *
 *
 * @help
 * =============================================================================
 * +++ MOG - Char Particles (v1.1) +++
 * By Moghunter
 * https://mogplugins.wordpress.com
 * =============================================================================
 * Adiciona o sistema de partículas nos sprites dos characters.
 *
 * =============================================================================
 * PLUGIN COMMAND
 * =============================================================================
 * Para ativar o efeito das partículas use esse comando através do Plugin Command.
 *
 * particles_event_id : EVENT_ID : MODE : POWER : BLEND : X : Y : POSITION : FILENAME
 *
 * EVENT_ID = ID do evento do mapa.
 * MODE - Tipo de animação;
 *      0 - Normal
 *      1 - Random
 * BLEND - Tipo de Blend
 *      0 - Normal
 *      1 - Add
 * X - Velocidade da partícula na horizontal.
 * Y - Velocidade do partícula na vertical.
 * POSITION - Posição.
 *           0 - Abaixo.
 *           1 - Centro.
 *           2 - Acima.
 * FILE NAME - Definição do nome do arquivo.
 *      (As imagens devem ser gravadas na pasta /img/charparticles/)
 *
 * =============================================================================
 * EVENT COMMENT
 * =============================================================================
 * Para ativar o efeito das partículas use esse comentário.
 *
 * particles : MODE : POWER : BLEND : X : Y : POSITION : FILENAME
 *
 * MODE - Tipo de animação;
 *      0 - Normal
 *      1 - Random
 * BLEND - Tipo de Blend
 *      0 - Normal
 *      1 - Add
 * X - Velocidade da partícula na horizontal.
 * Y - Velocidade do partícula na vertical.
 * POSITION - Posição.
 *           0 - Abaixo.
 *           1 - Centro.
 *           2 - Acima.
 * FILE NAME - Definição do nome do arquivo.
 *      (As imagens devem ser gravadas na pasta /img/charparticles/)
 *
 * =============================================================================
 * HISTÓRICO
 * =============================================================================
 * (v1.1) - Compatibilidade com Pixi v4.
 */

//=============================================================================
// ** PLUGIN PARAMETERS
//=============================================================================
　　var Imported = Imported || {};
　　Imported.MOG_CharParticles = true;
　　var Moghunter = Moghunter || {};

  　Moghunter.parameters = PluginManager.parameters('MOG_CharParticles');

//=============================================================================
// ** ImageManager
//=============================================================================

//==============================
// * Char Particles
//==============================
ImageManager.loadCharParticles = function(filename) {
    return this.loadBitmap('img/charparticles/', filename, 0, true);
};

//=============================================================================
// ** Game Character Base
//=============================================================================

//==============================
// * Initialize
//==============================
var _mog_chaParticles_gchar_initMembers = Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function() {
	_mog_chaParticles_gchar_initMembers.call(this);
	this._particles = [false,[],false,0,0,0,0,0,0,""];
};

//=============================================================================
// ** Game_Interpreter
//=============================================================================

//==============================
// * PluginCommand
//==============================
var _mog_chaParticles_pluginCommand = Game_Interpreter.prototype.pluginCommand
Game_Interpreter.prototype.pluginCommand = function(command, args) {
	_mog_chaParticles_pluginCommand.call(this,command, args)
    this.checkEventsCharParticles(command, args);
	return true;
};

//==============================
// * checkEventsCharParticles
//==============================
Game_Interpreter.prototype.checkEventsCharParticles = function(command, args) {
	var event_id = 0;
	if (command === "particles_event_id")  {
		event_id = Number(args[1]);
		m = Number(args[3]);
		p = Number(args[5]);
		b = Number(args[7]);
		x = Number(args[9]);
		y = Number(args[11]);
		a = Number(args[13]);
		i = String(args[15]);
	};
	if (event_id > 0) {
		$gameMap.events().forEach(function(event) {
		if (event.eventId() === event_id) {
			event._particles = [true,[],true,m,p,b,x,y,a,i];
		};
		}, this);
	};
};

//=============================================================================
// ** Game Event
//=============================================================================

//==============================
// * Setup Page
//==============================
var _mog_charparticles_gevent_setupPage = Game_Event.prototype.setupPage;
Game_Event.prototype.setupPage = function() {
	_mog_charparticles_gevent_setupPage.call(this);
    this.checkCharParticles();
};

//==============================
// * Check Char Particles
//==============================
Game_Event.prototype.checkCharParticles = function() {
	var oldR = this._particles[0];
	this._particles = [false,[],false,0,0,0,0,0,0,""];
	if (!this._erased && this.page()) {this.list().forEach(function(l) {
	       if (l.code === 108) {
     		   var args = l.parameters[0].split(': ')
			   if (args[0].toLowerCase() == "particles "){
					m = Number(args[1]);
					p = Number(args[2]);
					b = Number(args[3]);
					x = Number(args[4]);
					y = Number(args[5]);
					a = Number(args[6]);
					i = String(args[7]);
                    this._particles = [true,[],true,m,p,b,x,y,a,i];
			   };
			};
	}, this);};
	if (oldR && !this._particles[0]) {this._particles = [true,[],true,-1,0,0,0,0,0,""]};
};

//=============================================================================
// ** Sprite Character
//=============================================================================

//==============================
// * Update
//==============================
var _mog_chaParticles_update = Sprite_Character.prototype.update;
Sprite_Character.prototype.update = function() {
	_mog_chaParticles_update.call(this);
	if (this.canUpdateParticles()) {this.updateParticlesEffect()};
};

//==============================
// * can Update Particles
//==============================
Sprite_Character.prototype.canUpdateParticles = function() {
   if (!this._character) {return false};
   if (!this._character._particles[0]) {return false};
   if (!this.bitmap) {return false};
   if (!this.bitmap.isReady()) {return false};
   return true;
};

//==============================
// * Update Particles Effect
//==============================
Sprite_Character.prototype.updateParticlesEffect = function() {
	if (!this._particlesField) {this.createParticlesField()};
	if (!this._particlesSprites || this._character._particles[2]) {this.createParticlesSprites()};
	if (this._particlesSprites) {
		for (var i = 0; i < this._particlesSprites.length; i++) {
			this.updateParticlesSprites(this._particlesSprites[i],i);
		};
	};
};

//==============================
// * create Particles Field
//==============================
Sprite_Character.prototype.createParticlesField = function() {
     this._particlesField = new Sprite();
	 this.addChild(this._particlesField);
};

//==============================
// * remove Particles Sprites
//==============================
Sprite_Character.prototype.removeParticlesSprites = function() {
     for (var i = 0; i < this._particlesSprites.length; i++) {
		  this._particlesField.removeChild(this._particlesSprites[i]);
		  this._particlesSprites[i].bitmap = null;
		  this._particlesSprites[i] = null;
		  this._character._particles[1][i] = null;
	 };
	 this._particlesSprites = null;
};

//==============================
// * dispose Particles
//==============================
Sprite_Character.prototype.disposeParticles = function() {
	if (this._particlesSprites) {this.removeParticlesSprites()};
	this.removeChild(this._particlesSprites);
	this._particlesSprites = null;
	this._character._particles = [false,[],false,0,0,0,0,0,0,""];
};

//==============================
// * create Particles Sprites
//==============================
Sprite_Character.prototype.createParticlesSprites = function() {
	this._character._particles[2] = false;
	if (this._particlesSprites) {this.removeParticlesSprites()};
	this._particlesType = this._character._particles[3];
    if (this._character._particles[3] < 0) {this.disposeParticles();return};
	this._particlesSprites = [];
	this._particlesImage = ImageManager.loadCharParticles(this._character._particles[9]);
	this._particleSX = this._character._particles[6];
	this._particleSY = this._character._particles[7];
	this._particlesPos = this._character._particles[8];
	var maxw = Math.min(Math.max(this._character._particles[4],1),999);
	var blendMode = Math.min(Math.max(this._character._particles[5],0),1);
	for (var i = 0; i < maxw; i++) {
		 this._particlesSprites[i] = new Sprite(this._particlesImage);
		 this._particlesSprites[i].anchor.x = 0.5;
		 this._particlesSprites[i].anchor.y = 0.5;
		 this._particlesSprites[i].blendMode = blendMode;
		 this._particlesField.addChild(this._particlesSprites[i]);
		 this._particlesSprites[i].an = [Math.randomInt((maxw / 2) + 20),0,0];
		 if (!this._character._particles[1][i]) {
			this._character._particles[1][i] = [];
            this.setParticlesAnimation(this._particlesSprites[i])
		 } else {
			this.loadParticlesData(i);
		 };
	};
};

//==============================
// * set Particles Animation
//==============================
Sprite_Character.prototype.setParticlesAnimation = function(sprite) {
	var xi = this._particleSX;
	var yi = this._particleSY;
    if (this._particlesType === 0) {
        var sx = (Math.random() * xi) + (0.1 * xi);
	    var sy = (Math.random() * yi) + (0.1 * yi);
	} else {
		var d = Math.randomInt(2);
		var x = (Math.random() * Math.abs(xi)) + 0.3;
		var sx = d === 0 ? x : -x;
		var d = Math.randomInt(2);
		var y = (Math.random() * Math.abs(yi)) + 0.3;
		var sy = d === 0 ? y : -y;
	};
    var pw = this.patternWidth();
    var ph = this.patternHeight();
	sprite.x = Math.randomInt(pw) - (pw / 2)
	if (this._particlesPos === 0) {
	    sprite.y = Math.randomInt((ph / 2)) - (ph / 2);
	} else if (this._particlesPos === 1) {
	    sprite.y = Math.randomInt((ph / 2)) - (ph);
    } else {
		sprite.y = Math.randomInt((ph / 2)) - (ph + (ph / 2));
	};
    sprite.sx = sx;
	sprite.sy = sy;
	sprite.op = (Math.random() * 10) + 5.0;
	sprite.sc = 0;
	sprite.rt = 0;
	sprite.visible = false;
	sprite.opacity = 255;
	this.charParticlesZoom(sprite);
};

//==============================
// * Random Zoom
//==============================
Sprite_Character.prototype.charParticlesZoom = function(sprite) {
	var pz = ((Math.random() * 0.5) * 1);
	sprite.scale = new PIXI.Point(0.5 + Number(pz), 0.5 + Number(pz));
};

//==============================
// * Load Particles Data
//==============================
Sprite_Character.prototype.loadParticlesData = function(i) {
	this._particlesSprites[i].x = this._character._particles[1][i].x;
	this._particlesSprites[i].y = this._character._particles[1][i].y;
	this._particlesSprites[i].scale.x = this._character._particles[1][i].scaleX;
	this._particlesSprites[i].scale.y = this._character._particles[1][i].scaleY;
	this._particlesSprites[i].sc = this._character._particles[1][i].sc;
	this._particlesSprites[i].rotation = this._character._particles[1][i].rotation;
	this._particlesSprites[i].opacity = this._character._particles[1][i].opacity;
	this._particlesSprites[i].sx = this._character._particles[1][i].sx;
	this._particlesSprites[i].sy = this._character._particles[1][i].sy;
	this._particlesSprites[i].op = this._character._particles[1][i].op;
	this._particlesSprites[i].rt = this._character._particles[1][i].rt;
	this._particlesSprites[i].an = this._character._particles[1][i].an;
	this._particlesSprites[i].blendMode = this._character._particles[1][i].blendMode;
};

//==============================
// * Update Particles Sprites
//==============================
Sprite_Character.prototype.updateParticlesSprites = function(sprite,index) {
	if (sprite.an[0] > 0) {sprite.an[0]--;
	    sprite.visible = false;
    	return;
	};
	sprite.visible = true;
    sprite.x += sprite.sx;
	sprite.y += sprite.sy;
	sprite.opacity -= sprite.op;
	sprite.scale.x += sprite.sc;
	sprite.scale.y += sprite.sc;
	sprite.rotation += sprite.rt;
	if (this.charPartNeedReset(sprite)) {this.setParticlesAnimation(sprite)};
};

//==============================
// * char Par Need Reset
//==============================
Sprite_Character.prototype.charPartNeedReset = function(sprite) {
	if (Imported.MOG_CharShatterEffects && this._character._shatter[0]) {return false};
	if (sprite.opacity <= 0) {return true};
	return false
};

//==============================
// * Save Particles Data
//==============================
Sprite_Character.prototype.saveParticlesData = function(sprite,index) {
	this._character._particles[1] = [];
	for (var i = 0; i < this._particlesSprites.length; i++) {
		var sprite = this._particlesSprites[i]
		this._character._particles[1][i] = {};
		this._character._particles[1][i].x = sprite.x;
		this._character._particles[1][i].y = sprite.y;
		this._character._particles[1][i].scaleX = sprite.scale.x;
		this._character._particles[1][i].scaleY = sprite.scale.y;
		this._character._particles[1][i].opacity = sprite.opacity;
		this._character._particles[1][i].sx = sprite.sx;
		this._character._particles[1][i].sy = sprite.sy;
		this._character._particles[1][i].op = sprite.op;
		this._character._particles[1][i].sc = sprite.sc;
		this._character._particles[1][i].rotation = sprite.rotation;
		this._character._particles[1][i].rt = sprite.rt;
		this._character._particles[1][i].an = sprite.an;
		this._character._particles[1][i].blendMode = sprite.blendMode;
	};
};

//=============================================================================
// ** Scene Map
//=============================================================================

//==============================
// * Terminate
//==============================
var _mog_chaParticles_scMap_terminate = Scene_Map.prototype.terminate;
Scene_Map.prototype.terminate = function() {
	if (this._spriteset) {this._spriteset.recordParticlesData()};
    _mog_chaParticles_scMap_terminate.call(this);
};

//=============================================================================
// ** Spriteset Map
//=============================================================================

//==============================
// * Record Particles Data
//==============================
Spriteset_Map.prototype.recordParticlesData = function() {
    for (var i = 0; i < this._characterSprites.length; i++) {
        var sprite = this._characterSprites[i];
        if (sprite._particlesSprites) {sprite.saveParticlesData()
		} else {sprite._character._particles = [false,[],false,0,0,0,0,0,0,""]};
    }
};


code:
//=============================================================================
// MOG_MenuBackground.js
//=============================================================================
/*:
 * @plugindesc (v1.2) O plugin permite mudar a imagem de fundo do menu.
 * @author Moghunter
 *
 * @param Disable Scenes
 * @desc Definição das cenas que terão o efeito desativado.
 * Scene_Name1 , Scene_Name2 , Scene_Name3 ...
 * @default Scene_Test1,Scene_Test2,Scene_Test3
 *
 * @param Default FileName
 * @desc Definição do nome de arquivo.
 * @default Pic_1
 *
 * @param Unique Backgrounds
 * @desc Cada cena terá uma imagem diferente.
 * @default false
 *
 * @param Sufix FileName
 * @desc Definição do sufixo nos background únicos.
 * @default _back
 *
 * @param Window Opacity
 * @desc Definição da transparência da janela.
 * @default 30
 *
 * @param Scroll X-Axis
 * @desc Definição da velocidade de deslize na horizontal.
 * @default 0
 *
 * @param Scroll Y-Axis
 * @desc Definição da velocidade de deslize na vertical.
 * @default 0
 *
 * @help
 * =============================================================================
 * +++ MOG - Menu Background (v1.2) +++
 * By Moghunter
 * https://atelierrgss.wordpress.com/
 * =============================================================================
 * O plugin permite mudar a imagem de fundo do menu.
 * É possivel ativar uma imagem diferente para cada cena ou desativar a imagem
 * de fundo em cenas especificas.
 * =============================================================================
 * As imagens do background deverão ficar na pasta /img/pictures/
 * =============================================================================
 * No caso da opção Unique Backgrounds estiver ativada cada imagem de fundo
 * deverá seguir essa nomeação.
 *
 * SCENE_NAME + _back.png
 *
 * Exemplo.
 *
 * Scene_Menu_back.png
 * Scene_Item_back.png
 * Scene_Skill_back.png
 * etc...
 *
 * =============================================================================
 * PLUGIN COMMAND
 * =============================================================================
 * Para mudar a imagem de fundo durante o jogo use o comando abaixo.
 *
 * backgroundName : FILE_NAME
 *
 * =============================================================================
 * HISTÓRICO
 * =============================================================================
 * v1.2 - Compatibilidade com MOG_PictureGalery.
 * v1.1 - Melhoria na codificação.
 */

//=============================================================================
// ** PLUGIN PARAMETERS
//=============================================================================
　　var Imported = Imported || {};
　　Imported.MOG_MenuBackground = true;
　　var Moghunter = Moghunter || {};

  　Moghunter.parameters = PluginManager.parameters('MOG_MenuBackground');
    Moghunter.mback_fileName = String(Moghunter.parameters['Default FileName'] || "Pic_1");
	Moghunter.mback_sufixName = String(Moghunter.parameters['Sufix FileName'] || "_back");
    Moghunter.mback_selfback = String(Moghunter.parameters['Unique Backgrounds'] || "false");
	Moghunter.mback_skipscenes = Object(Moghunter.parameters['Disable Scenes'] || []);
	Moghunter.mback_ox = Number(Moghunter.parameters['Scroll X-Axis'] || 0);
	Moghunter.mback_oy = Number(Moghunter.parameters['Scroll Y-Axis'] || 0);
	Moghunter.mback_opacity = Number(Moghunter.parameters['Window Opacity'] || 30);
	SceneManager._mback             = false;

//=============================================================================
// ** Game_Interpreter
//=============================================================================

//==============================
// * PluginCommand
//==============================
var _mog_menuback_pluginCommand = Game_Interpreter.prototype.pluginCommand
Game_Interpreter.prototype.pluginCommand = function(command, args) {
	_mog_menuback_pluginCommand.call(this,command, args)
	if (command === "backgroundName")  {$gameSystem._backgroundName = String(args[1])};
	return true;
};

//=============================================================================
// ** Game System
//=============================================================================

//==============================
// * Initialize
//==============================
var _mog_picture_gsys_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
	_mog_picture_gsys_initialize.call(this);
	this._backgroundName = String(Moghunter.mback_fileName)
};

//==============================
// * Get Par Array
//==============================
Game_System.prototype.get_par_array = function(object,value,type) {
	if (value.length === 0) {return};
	var s = value.split(',');
	if (type === 0){
		for (var i = 0; i < s.length; i++) {object.push(String(s[i]));	};
	} else {
	    for (var i = 0; i < s.length; i++) {object.push(Number(s[i]));	};
   };
};

//=============================================================================
// ** Window Base
//=============================================================================

//==============================
// * Update
//==============================
var _alias_mog_mback_wbase_update = Window_Base.prototype.update;
Window_Base.prototype.update = function() {
	_alias_mog_mback_wbase_update.call(this);
    if (this.needUpdateBackOpacity()) {this.updateBackgroundOpacity()};
};

//==============================
// * Need Update Back Opacity
//==============================
Window_Base.prototype.needUpdateBackOpacity = function() {
   if (!SceneManager._mback) {return false};
   return true;
};

//==============================
// * Update
//==============================
Window_Base.prototype.updateBackgroundOpacity = function() {
    this.opacity = Moghunter.mback_opacity;
};

if (Imported.MOG_TimeSystem) {
	//==============================
	// * Update
	//==============================
	var _alias_mog_mback_time_status_update = Window_Time_Status.prototype.update;
	Window_Time_Status.prototype.update = function() {
		_alias_mog_mback_time_status_update.call(this);
		if (SceneManager._mback) {this.contentsOpacity = 255;this.opacity = Moghunter.mback_opacity}
	};
};

//=============================================================================
// ** Scene MenuBase
//=============================================================================

//==============================
// * Skip Mbackground
//==============================
Scene_MenuBase.prototype.skip_mbackground = function() {
	if (!SceneManager._scene) {return false};
	this._mb_skip_scenes = [];
	$gameSystem.get_par_array(this._mb_skip_scenes, Moghunter.mback_skipscenes, 0);
   	for (var i = 0; i < this._mb_skip_scenes.length; i++) {
		if (this._mb_skip_scenes[i] === SceneManager._scene.constructor.name) {return true};
	};
    return false;
};

//==============================
// * create Background
//==============================
var _alias_mog_mback_scbase_createBackground = Scene_MenuBase.prototype.createBackground;
Scene_MenuBase.prototype.createBackground = function() {
	_alias_mog_mback_scbase_createBackground.call(this);
	SceneManager._mback = false;
	if (!this.skip_mbackground()) {this.create_mbackground()};
};

//==============================
// * Skip Mbackground
//==============================
var _alias_mog_mback_scmb_terminate = Scene_MenuBase.prototype.terminate;
Scene_MenuBase.prototype.terminate = function() {
	_alias_mog_mback_scmb_terminate.call(this);
	SceneManager._mback = false;
};

//==============================
// * Set Background Img
//==============================
Scene_MenuBase.prototype.set_background_img = function() {
	if (this._self_background && SceneManager._scene) {return SceneManager._scene.constructor.name + String(Moghunter.mback_sufixName)}
	return $gameSystem._backgroundName;
};

//==============================
// * Create Mbackground
//==============================
Scene_MenuBase.prototype.create_mbackground = function() {
    this._self_background = false;
	SceneManager._mback = true;
	if (String(Moghunter.mback_selfback) === "true") {this._self_background = true};
    this._backgroundSpriteNew = new TilingSprite();
	this._backgroundSpriteNew.move(0, 0, Graphics.width, Graphics.height);
    this.addChild(this._backgroundSpriteNew);
	this.refreshBackgroundName();
};

//==============================
// * Update
//==============================
var _mog_mback_scbase_update = Scene_MenuBase.prototype.update;
Scene_MenuBase.prototype.update = function() {
	_mog_mback_scbase_update.call(this);
	if (this._backgroundSpriteNew) {this.update_mbackground()};
};

//==============================
// * Refresh Background Name
//==============================
Scene_MenuBase.prototype.refreshBackgroundName = function() {
	this._backGroundName = $gameSystem._backgroundName;
	this._backgroundSpriteNew.bitmap = null;
	this._backImg = ImageManager.loadPicture(this.set_background_img());
};

//==============================
// * Refresh Background Bitmap
//==============================
Scene_MenuBase.prototype.refreshBackgroundBitmap = function() {
    this._backgroundSpriteNew.bitmap = this._backImg;
	this._backgroundSpriteNew.scale.x = Graphics.boxWidth / this._backImg.width;
	this._backgroundSpriteNew.scale.y = Graphics.boxHeight / this._backImg.height;
	this._backgroundSpriteNew.move(0, 0, this._backImg.width, this._backImg.height);
};

//==============================
// * Update MBackground
//==============================
Scene_MenuBase.prototype.update_mbackground = function() {
	if ($gameSystem._backgroundName != this._backGroundName) {this.refreshBackgroundName()};
	if (!this._backgroundSpriteNew.bitmap && this._backImg.isReady()) {this.refreshBackgroundBitmap()};
	this._backgroundSpriteNew.origin.x += Moghunter.mback_ox;
	this._backgroundSpriteNew.origin.y += Moghunter.mback_oy;
	if (this._backgroundSprite) {this._backgroundSprite.opacity = 0};
};