//=============================================================================
/*:
* @plugindesc v1.03 (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
* @desc Do you wish to display the HP Gauge for actors?
* NO - false YES - true
* @default true
*
* @param Defeat First
* @desc Enemies must be defeated first before showing the HP Gauge.
* NO - false YES - true
* @default false
*
* @param Always Visible
* @desc HP Gauge is always visible and doesn't fade away.
* NO - false YES - true
* @default false
*
* @param ---Appearance---
* @default
*
* @param Minimum Gauge Width
* @desc This is the minimum width in pixels for HP Gauges.
* @default 144
*
* @param Gauge Height
* @desc This is the height in pixels for HP Gauges.
* @default 18
*
* @param Back Color
* @desc This is the text color used for the back of HP Gauges.
* @default 19
*
* @param HP Color 1
* @desc This is the text color used for the 1st part of HP Gauges.
* @default 20
*
* @param HP Color 2
* @desc This is the text color used for the 2nd part of HP Gauges.
* @default 21
*
* @param Gauge Duration
* @desc This is the frames the HP gauge will continue to show after
* it finishes draining or filling.
* @default 30
*
* @param Gauge Position
* @desc Where do you wish to show the HP gauge?
* BELOW - false ABOVE - true
* @default false
*
* @param Y Buffer
* @desc How much do you wish to shift the gauge Y position?
* @default -16
*
* @param Use Thick Gauges
* @desc Use the thick gauges provided by this plugin?
* Default - false Thick - true
* @default true
*
* @param ---Text Display---
* @default
*
* @param Show HP
* @desc Show the actual 'HP' text.
* NO - false YES - true
* @default false
*
* @param Show Value
* @desc Show the HP value.
* NO - false YES - true
* @default false
*
* @param Show Max
* @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.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!
*/
//=============================================================================
DataManager.processVHGNotetags = function(group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
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);
};
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();
};
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;
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);
}
};
//=============================================================================
// End of File
//=============================================================================
};
[/pre]