var Imported = Imported || {};
Imported.PrettySleekGauges = true;
/*:
* @plugindesc Sleek Gauges! Look at them go, so shiny, so cool. And they're even better when you can change what they look like and use them in battles!
* @author Vlue Au'Vier (sleek), Rocketmancer (pretty), mjshi (pretty sleek)
*
* @param Bar Shape
* @desc Use any combination of | / . < > ( ) \ Ex. // (> or /|
* @default //
*
* @param HP Bar Shape
* @parent Bar Shape
* @desc Leave blank to use default. Use any combination of | / . < > ( ) \ Ex. // (> or /|
* @default
*
* @param MP Bar Shape
* @parent Bar Shape
* @desc Leave blank to use default. Use any combination of | / . < > ( ) \ Ex. // (> or /|
* @default
*
* @param TP Bar Shape
* @parent Bar Shape
* @desc Leave blank to use default. Use any combination of | / . < > ( ) \ Ex. // (> or /|
* @default
*
* @param EXP Bar Shape
* @parent Bar Shape
* @desc Leave blank to use default. Use any combination of | / . < > ( ) \ Ex. // (> or /|
* @default ||
*
* @param Gauge Height
* @desc Default height of the gauges
* @type number
* @default 8
*
* @param Outline Color
* @desc Hex color.
* @default #FFFFFF
*
* @param Enemy Gauges
*
* @param Enemy HP Gauge
* @parent Enemy Gauges
*
* @param Enemy MP Gauge
* @parent Enemy Gauges
*
* @param Show Enemy HP Gauges
* @parent Enemy HP Gauge
* @type select
* @default show over
* @desc Shows the enemy hp bar over/under animations.
* (show under/show over/don't show)
* @option show over
* @option show under
* @option don't show
*
* @param Show Enemy HP Text
* @parent Enemy HP Gauge
* @desc Show the word "HP"?
* (true/false)
* @default false
* @type boolean
*
* @param HP Text Y Offset
* @parent Enemy HP Gauge
* @desc Y offset of the enemy hp gauges
* @type number
* @min -100000000000000000000000
* @default 0
*
* @param Show Enemy HP Value
* @parent Enemy HP Gauge
* @desc Show how much HP the enemy has left?
* (true/false)
* @default true
* @type boolean
*
* @param Show Up Top
* @parent Enemy HP Gauge
* @desc Show the enemy hp gauges above the enemy?
* (true/false)
* @type boolean
* @default true
*
* @param Bar Width
* @parent Enemy HP Gauge
* @desc Width of the Enemy HP gauge
* @type number
* @default 120
*
* @param HP Gauge X Offset
* @parent Enemy HP Gauge
* @desc X offset of the enemy hp gauges
* @type number
* @min -100000000000000000000000
* @default 0
*
* @param HP Gauge Y Offset
* @parent Enemy HP Gauge
* @desc Y offset of the enemy hp gauges
* @type number
* @min -100000000000000000000000
* @default 0
*
* @param Image Height Multiplier
* @parent Enemy HP Gauge
* @desc How far up the image to place the HP bar, in a decimal percentage.
* @type number
* @decimals 2
* @default 0.9
*
* @param State Positioning
* @parent Enemy Gauges
* @desc Since our HP gauge covers parts of it.
*
* @param State X Offset
* @parent State Positioning
* @desc X offset of the enemy states
* @type number
* @min -100000000000000000000000
* @default 0
*
* @param State Y Offset
* @parent State Positioning
* @desc Y offset of the enemy states
* @type number
* @min -100000000000000000000000
* @default 30
*
* @param State Height Multiplier
* @parent State Positioning
* @desc How far up the image to place the state icons, in a decimal percentage.
* @type number
* @decimals 2
* @default 0.9
*
* @param Show Enemy MP
* @parent Enemy MP Gauge
* @type boolean
* @desc Show a tiny MP gauge?
* (true/false)
* @default true
*
* @param Show MP Bar When MMP is 0
* @parent Enemy MP Gauge
* @type boolean
* @desc Show the MP bar when the enemy's max mp is 0?
* (true/false)
* @default false
*
* @param Tiny Gauge Height
* @parent Enemy MP Gauge
* @type number
* @desc Height of the tiny gauge
* @default 2
*
* @param Tiny Gauge X Offset
* @parent Enemy MP Gauge
* @type number
* @min -100000000000000000000000
* @desc X Offset of the tiny gauge
* @default 0
*
* @param Tiny Gauge Y Offset
* @parent Enemy MP Gauge
* @type number
* @min -100000000000000000000000
* @desc Y Offset of the tiny gauge
* @default 0
*
* @param Tiny Gauge Width Adjust
* @parent Enemy MP Gauge
* @type number
* @min -100000000000000000000000
* @desc Adjust the width of the tiny gauge
* @default 0
*
* @param Animated Numbers
* @desc Whether or not numbers count down/up
* (true/false)
* @type boolean
* @default true
*
* @param Animated Gauge
* @desc Whether or not the gauge is animated
* (true/false)
* @type boolean
* @default true
*
* @param Extras
*
* @param Critical HP Change
* @desc HP text becomes red when HP is critically low
* (true/false)
* @type boolean
* @parent Extras
* @default true
*
* @param Critical MP Change
* @desc MP text becomes red when MP is critically low
* (true/false)
* @type boolean
* @parent Extras
* @default true
*
* @param Critical TP Change
* @desc TP text becomes red when TP is critically low
* (true/false)
* @type boolean
* @parent Extras
* @default false
*
* @param Show EXP Bar
* @parent Extras
* @desc Show the EXP bar?
* (true/false)
* @default true
* @type boolean
*
* @param Status Icon XY Offset
* @parent Extras
* @desc Manually control where status icons are placed. Leave blank if you don't have out of battle statuses. Format: X, Y
* @default
*
* @param
* @help
* ----------------------------------------------------------------------------
* Pretty Sleek Gauges v1.02b
* ----------------------------------------------------------------------------
* Free to use in any project with credit to:
* Vlue (original plugin)
* Rocketmancer (Prettier Gauges)
* mjshi (merging, edits, and enemy HP bars)
* ----------------------------------------------------------------------------
* Extra Notetags:
* If there's just that ONE enemy (looking at you, Slime) that has its
* face covered up by the HP bar, you can use these notetags:
*
* <HPBarXOffset:#>
* <HPBarYOffset:#>
*
* to manually put it in its place.
* The # can be positive or negative. So in that slime example, with the
* default settings, having a <HPBarYOffset:-20> there fixes the issue.
*
* Also, for bosses, you can hide the HP or MP bar via these:
* <HideEnemyHPBar>
* <HideEnemyMPBar>
*
* ----------------------------------------------------------------------------
* Original Plugin By Vlue
*
* Facebook: https://www.facebook.com/DaimoniousTailsGames/
* Website: http://daimonioustails.weebly.com/
* ----------------------------------------------------------------------------
* Merged with Prettier Gauges/Custom Gauges by Rocketmancer
* https://forums.rpgmakerweb.com/index.php?threads/prettier-gauges.47077/
* ----------------------------------------------------------------------------
* Changes from the forum version:
* - merged a couple functions
* - added support for \ style gauges
* - fixed issue with overfilling the gauge
* - added support for enemy HP gauges
* - added support for individual HP gauge offsets
* - added support for EXP gauges and individual bar styles
* ----------------------------------------------------------------------------
* > Is something broken? Go to http://mjshi.weebly.com/contact.html and I'll
* try my best to help you!
*
*/
function Special_Gauge() {
this.initialize.apply(this, arguments);
}
(function() {
var parameters = PluginManager.parameters('PrettySleekGauges');
var defaultHeight = Number(parameters['Gauge Height'] || 8);
var defaultTinyHeight = Number(parameters['Tiny Gauge Height'] || 2);
var animatedNumbers = (parameters['Animated Numbers'] || "true") === "true";
var animatedGauges = (parameters['Animated Gauges'] || "true") === "true";
var gaugeOutColor = parameters['Outline Color'] || "#FFFFFF";
var barTypeLeft = String(parameters['Bar Shape']).substring(0,1);
var barTypeRight = String(parameters['Bar Shape']).substring(1,2);
var saveBarTypeLeft = barTypeLeft;
var saveBarTypeRight = barTypeRight;
var hpBarTypeLeft = (parameters['HP Bar Shape'].length === 2) ? String(parameters['HP Bar Shape']).substring(0,1) : false;
var hpBarTypeRight = (parameters['HP Bar Shape'].length === 2) ? String(parameters['HP Bar Shape']).substring(1,2) : false;
var mpBarTypeLeft = (parameters['MP Bar Shape'].length === 2) ? String(parameters['MP Bar Shape']).substring(0,1) : false;
var mpBarTypeRight = (parameters['MP Bar Shape'].length === 2) ? String(parameters['MP Bar Shape']).substring(1,2) : false;
var tpBarTypeLeft = (parameters['TP Bar Shape'].length === 2) ? String(parameters['TP Bar Shape']).substring(0,1) : false;
var tpBarTypeRight = (parameters['TP Bar Shape'].length === 2) ? String(parameters['TP Bar Shape']).substring(1,2) : false;
var expBarTypeLeft = (parameters['EXP Bar Shape'].length === 2) ? String(parameters['EXP Bar Shape']).substring(0,1) : false;
var expBarTypeRight = (parameters['EXP Bar Shape'].length === 2) ? String(parameters['EXP Bar Shape']).substring(1,2) : false;
var showEnemyHP = (parameters['Show Enemy HP Gauges']).startsWith("show");
var showOver = (parameters['Show Enemy HP Gauges']).endsWith("over");
var showUpTop = (parameters['Show Up Top'] || "true") === "true";
var EHPXOffset = parseInt(parameters['HP Gauge X Offset']) || 0;
var EHPYOffset = parseInt(parameters['HP Gauge Y Offset']) || 0;
var EHPbarWidth = parseInt(parameters['Bar Width']) || 120;
var showEHPHP = (parameters['Show Enemy HP Text'] || "false") === "true";
var textYOffset = parseInt(parameters['HP Text Y Offset']) || 0;
var showEHPText = (parameters['Show Enemy HP Value'] || "true") === "true";
var EHPYMultiplier = parseInt(parameters['Image Height Multiplier']) || 0.9;
var EHPStateXOffset = parseInt(parameters['State X Offset']) || 0;
var EHPStateYOffset = parseInt(parameters['State Y Offset']) || 30;
var shouldDrawEnemyMP = (parameters['Show Enemy MP'] || "true") === "true";
var drawEnemyMPWhenNoMP = (parameters['Show MP Bar When MMP is 0'] || "true") === "true";
var defaultTinyHeight = parseInt(parameters['Tiny Gauge Height']) || 2;
var tinyWidthAdjust = parseInt(parameters['Tiny Gauge Width Adjust']) || 0;
var tinyGaugeXOffset = parseInt(parameters['Tiny Gauge X Offset']) || 0;
var tinyGaugeYOffset = parseInt(parameters['Tiny Gauge Y Offset']) || 0;
// var shouldDrawEnemyTP = (parameters['Show Enemy TP'] || "true") === "true";
var criticalHP = (parameters['Critical HP Change'] || "true") === "true";
var criticalMP = (parameters['Critical MP Change'] || "true") === "true";
var criticalTP = (parameters['Critical TP Change'] || "false") === "true";
var showEXP = (parameters['Show EXP Bar'] || "true") === "true";
var statusXY = (parameters['Status Icon XY Offset'] || "true").split(", ").map(Number);
//=============================================================================
// Sleek Gauges
//=============================================================================
Window_Base.prototype.drawAnimatedGauge = function(x, y, width, rate, c1, c2, criticalColor) {
if (this._gauges == null) this._gauges = {};
var gkey = this.makeGaugeKey(x, y)
if (this._gauges[gkey]) {
this._gauges[gkey].setRate(rate);
} else {
this._gauges[gkey] = new Special_Gauge(x, y, width, rate, c1, c2, this, defaultHeight, criticalColor);
}
}
var windowBaseUpdate = Window_Base.prototype.update;
Window_Base.prototype.update = function() {
windowBaseUpdate.call(this);
if (this._gauges) for(var bar in this._gauges) this._gauges[bar].update();
}
//=============================================================================
// Pretty Gauges
//=============================================================================
Bitmap.prototype.drawTrap = function(x, y, width, height, color1, color2, shouldFill) {
var context = this._context;
var grad = context.createLinearGradient(x, y, x + width, y);
var startCoords = [];
if (typeof color2 === 'boolean') {
shouldFill = color2;
color2 = undefined;
}
if (color2 === undefined) color2 = color1;