Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide whitespace changes
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Text styles
Change appearance
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled diff
Created
8 years ago
Diff never expires
Clear
Export
Share
Explain
178 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
200 lines
Copy
557 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
638 lines
Copy
//=============================================================================
//=============================================================================
Copy
Copied
Copy
Copied
//
sleekgauges
.js
//
PrettySleekGauges
.js
//=============================================================================
//=============================================================================
/*:
/*:
Copy
Copied
Copy
Copied
* @plugindesc Sleek Gauges! Look at them go, so shiny, so cool.
* @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 where they go!
* @author Vlue Au'Vier
* @author Vlue Au'Vier
(sleek), Rocketmancer (pretty), mjshi (pretty sleek)
*
* @param Bar Shape
* @desc Use any combination of | / . < > ( ) \ Ex. // (> or /|
* @default //
*
*
* @param Gauge Height
* @param Gauge Height
* @desc Default height of the gauges
* @desc Default height of the gauges
Copy
Copied
Copy
Copied
* @type number
* @default 8
* @default 8
*
*
Copy
Copied
Copy
Copied
* @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 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 X Offset
* @parent Enemy HP Gauge
* @desc X offset of the enemy hp gauges
* @type number
* @min -100000000000000000000000
* @default 0
*
* @param 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
* @param Animated Numbers
* @desc Whether or not numbers count down/up
* @desc Whether or not numbers count down/up
Copy
Copied
Copy
Copied
* (true/false)
* @type boolean
* @default true
* @default true
*
*
* @param Animated Gauge
* @param Animated Gauge
* @desc Whether or not the gauge is animated
* @desc Whether or not the gauge is animated
Copy
Copied
Copy
Copied
* (true/false)
* @type boolean
* @default true
* @default true
*
*
Copy
Copied
Copy
Copied
* @param Gauge Style
* @help
* @desc Visual style of the gauge (Available: normal)
* ----------------------------------------------------------------------------
* @default normal
* Pretty Sleek Gauges v1.0
*
* ----------------------------------------------------------------------------
* @param Gauge Slide Style
* Free to use in any project with credit to:
* @desc Animation style of the gauge (Available: slide)
* Vlue (original plugin)
*
@default slide
* Rocketmancer (Prettier Gauges)
*
* mjshi (merging, edits, and enemy HP bars)
*
@help Sleek Gauges v0.1
*
----------------------------------------------------------------------------
*
Facebook: https://www.
face
book.com/DaimoniousTailsGames/
*
Extra Notetags:
* Website: http://daimonioustails.weebly.com/
*
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:
*
*
Copy
Copied
Copy
Copied
* Gauge Styles:
* <HPBarXOffset:#>
* normal - normal gauge
* <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.
* ----------------------------------------------------------------------------
* Original Plugin By Vlue
*
*
Copy
Copied
Copy
Copied
* Gauge Slide Styles:
* Facebook: https://www.facebook.com/DaimoniousTailsGames/
* slide - gauges gradually approach their values
* 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
* ----------------------------------------------------------------------------
* > Is something broken? Go to http://mjshi.weebly.com/contact.html and I'll
* try my best to help you!
*
*
*/
*/
Copy
Copied
Copy
Copied
(function() {
(function() {
var parameters = PluginManager.parameters('
sleekgauges
');
var defaultHeight = Number(parameters['Gauge Height'] || 8);
var parameters = PluginManager.parameters('
PrettySleekGauges
');
var animatedNumbers = (parameters['Animated Numbers'] || "true"
).toLowerCase()
== "true";
var defaultHeight = Number(parameters['Gauge Height'] || 8);
var animatedGauges = (parameters['Animated Gauges'] || "true")
.toLowerCase() == "true";
var defaultTinyHeight = Number(parameters['Tiny Gauge Height'] || 2);
var gaugeStyle = parameters['Gauge Style'] || "normal";
var animatedNumbers = (parameters['Animated Numbers'] || "true"
) =
== "true";
var gaugeSlideStyle =
parameters['
Gauge
Slide Style'] || "slide";
var animatedGauges = (parameters['Animated Gauges'] || "true")
=== "true";
var gaugeOutColor = parameters['Outline Color'] || "#FFFFFF";
Window_Base.prototype.drawGauge = function(x, y, width, rate, c1, c2) {
var barTypeLeft = String(parameters['Bar Shape']).substring(0,1);
var barTypeRight = String(parameters['Bar Shape']).substring(1,2);
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['X Offset']) || 0;
var EHPYOffset = parseInt(parameters['Y Offset']) || 0;
var EHPbarWidth = parseInt(parameters['Bar Width']) || 120;
var showEHPHP = (parameters['Show Enemy HP Text'] || "false") === "true";
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";
//=============================================================================
// Sleek Gauges
//=============================================================================
Window_Base.prototype.drawGauge = function(x, y, width, rate, c1, c2) {
if(this._gauges == null) { this._gauges = {} };
if(this._gauges == null) { this._gauges = {} };
var gkey = this.makeGaugeKey(x, y)
var gkey = this.makeGaugeKey(x, y)
if(this._gauges[gkey]) {
if(this._gauges[gkey]) {
this._gauges[gkey].setRate(rate);
this._gauges[gkey].setRate(rate);
} else {
} else {
Copy
Copied
Copy
Copied
this._gauges[gkey] = new Special_Gauge(x, y, width, rate, c1, c2, this, defaultHeight)
this._gauges[gkey] = new Special_Gauge(x, y, width, rate, c1, c2, this, defaultHeight)
;
}
}
Copy
Copied
Copy
Copied
}
}
var windowBaseUpdate = Window_Base.prototype.update;
Window_Base.prototype.update = function() {
var windowBaseUpdate = Window_Base.prototype.update;
windowBaseUpdate.call(this);
Window_Base.prototype.update = function() {
if
(this._gauges) {
windowBaseUpdate.call(this);
for(var bar in this._gauges) {
if
(this._gauges) {
this._gauges[bar].update();
for(var bar in this._gauges) {
}
this._gauges[bar].update();
}
}
}
}
Window_Base.prototype.makeGaugeKey = function(x, y) {
}
return "k" + x + "-" + y;
}
Window_Base.prototype.makeGaugeKey = function(x, y) {
Window_Base.prototype.drawActorHp = function(actor, x, y, width) {
return "k" + x + "-" + y;
width = width || 186;
}
this.drawGauge(x, y, width, actor.hpRate(), this.hpGaugeColor1(), this.hpGaugeColor2());
this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.hpA, actor.hp, actor.mhp);
Window_Base.prototype.drawActorHp = function(actor, x, y, width) {
}
width = width || 186;
Window_Base.prototype.drawActorMp = function(actor, x, y, width) {
this.drawGauge(x, y, width, actor.hpRate(), this.hpGaugeColor1(), this.hpGaugeColor2());
width = width || 186;
this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.hpA, actor.hp, actor.mhp);
this.drawGauge(x, y, width, actor.mpRate(), this.mpGaugeColor1(), this.mpGaugeColor2());
}
this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.mpA, actor.mp, actor.mmp);
}
Window_Base.prototype.drawActorMp = function(actor, x, y, width) {
Window_Base.prototype.drawActorTp = function(actor, x, y, width) {
width = width || 186;
width = width || 186;
this.drawGauge(x, y, width, actor.mpRate(), this.mpGaugeColor1(), this.mpGaugeColor2());
this.drawGauge(x, y, width, actor.tpRate(), this.tpGaugeColor1(), this.tpGaugeColor2());
this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.mpA, actor.mp, actor.mmp);
this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.tpA, actor.tp, 100);
}
}
Window_Base.prototype.drawActorTp = function(actor, x, y, width) {
width = width || 186;
function Special_Gauge() {
this.drawGauge(x, y, width, actor.tpRate(), this.tpGaugeColor1(), this.tpGaugeColor2());
this.initialize.apply(this, arguments);
this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.tpA, actor.tp, 100);
}
}
Special_Gauge.prototype.constructor = Special_Gauge;
Special_Gauge.prototype.initialize = function(x, y, w, r, c1, c2, basewindow, h) {
function Special_Gauge() {
this._x = x;
this.initialize.apply(this, arguments);
this._y = y;
}
this._width = w;
this._curRate = this._maxRate = r;
Special_Gauge.prototype.constructor = Special_Gauge;
this._vocab = false;
Special_Gauge.prototype.initialize = function(x, y, w, r, c1, c2, basewindow, h) {
this._color = [c1, c2];
this._x = x;
this._window = basewindow
this._y = y;
this._speed = 0;
this._width = w;
this._speedRate = 0;
this._curRate = this._maxRate = r;
this._height = h;
this._vocab = false;
this._fallSprites = [];
this._color = [c1, c2];
this.refresh();
this._window = basewindow
}
this._speed = 0;
Special_Gauge.prototype.update = function() {
this._speedRate = 0;
this.updateFallSprites();
this._height = h;
this._fallSprites = [];
if
(this._curRate != this._maxRate) {
this._showEHPHP = true;
if
(this._curRate > this._maxRate) {
this._showEHPText = true;
this._curRate -= this._speedRate;
this.refresh();
this._curVal -= this._speed;
}
} else {
this._curRate += this._speedRate;
Special_Gauge.prototype.setTextVisibility = function(hpText, hpNum) {
this._curVal += this._speed;
this._showEHPHP = hpText;
}
this._showEHPText = hpNum;
if
(Math.abs(this._curRate - this._maxRate) < this._speedRate) {
}
this._curRate = this._maxRate;
this._curVal = this._setVal;
Special_Gauge.prototype.update = function() {
}
this.updateFallSprites();
if
(!animatedNumbers) {
this._curVal = this._setVal;
if
(this._curRate != this._maxRate) {
}
if
(this._curRate > this._maxRate) {
if
(!animatedGauges) {
this._curRate -= this._speedRate;
this._curRate = this._maxRate;
this._curVal -= this._speed;
}
} else {
}
this._curRate += this._speedRate;
this._curVal += this._speed;
this.refresh();
}
if
(Math.abs(this._curRate - this._maxRate) < this._speedRate) {
}
this._curRate = this._maxRate;
Special_Gauge.prototype.updateFallSprites = function() {
this._curVal = this._setVal;
//TODO: Add in this part!
}
}
if
(!animatedNumbers) {
Special_Gauge.prototype.refresh = function() {
this._curVal = this._setVal;
if
(this._vocab) {
}
this._window.contents.clearRect(this._x, this._y, this._width+2, this._window.lineHeight());
if
(!animatedGauges) {
} else {
this._curRate = this._maxRate;
var gy = this._y + this._window.lineHeight() - this._height - 1;
}
this._window.contents.clearRect(this._x, gy, this._width, this._height);
}
}
this.drawGauge();
this.refresh();
this.drawText();
}
}
Special_Gauge.prototype.setRate = function(rate) {
if
(rate != this._maxRate) {
Special_Gauge.prototype.updateFallSprites = function() {
this._maxRate = rate;
//TODO: Add in this part!
this._speedRate = Math.abs(this._curRate - this._maxRate) / 60;
}
//TODO: More Falling Sprite Stuff
}
Special_Gauge.prototype.refresh = function() {
}
if
(this._vocab) {
Special_Gauge.prototype.setExtra = function(text, val, max) {
this._window.contents.clearRect(this._x, this._y, this._width+2, this._window.lineHeight());
this._vocab = true;
} else {
this._text = text;
var gy = this._y + this._window.lineHeight() - this._height - 1;
this._maxVal = max;
this._window.contents.clearRect(this._x, gy, this._width, this._height);
if
(val != this._setVal) {
}
this._speed = Math.max(0, Math.abs(this._curVal - val) / 60);
this.drawGauge();
}
this.drawText();
this._setVal = val;
}
if
(this._curVal == null) {
this._curVal = val;
Special_Gauge.prototype.setRate = function(rate) {
}
if
(rate != this._maxRate) {
}
this._maxRate = rate;
Special_Gauge.prototype.drawGauge = function() {
this._speedRate = Math.abs(this._curRate - this._maxRate) / 60;
var fill_w = Math.round((this._width - 2) * this._curRate);
//TODO: More Falling Sprite Stuff
var fill_ww = Math.round((this._width - 2) * this._maxRate);
}
var gy = this._y + this._window.lineHeight() - this._height - 1;
}
this._window.contents.
fillRect
(this._x, gy, this._width
, this._height, this._window.gaugeBackColor()
);
if(gaugeSlideStyle == "fancy") {
Special_Gauge.prototype.setExtra = function(text, val, max) {
//TODO: Add me
this._vocab = true;
} else if(gaugeSlideStyle == "fall") {
this._text = text;
//TODO: Add me
this._maxVal = max;
} else {
if
(val != this._setVal) {
this._window.contents.
gradientFillRect
(this._x
+ 1, Math.round(gy + 1)
, fill_w, this._height
- 2
, this._color[0], this._color[1]
);
this._speed = Math.max(0, Math.abs(this._curVal - val) / 60);
}
}
//TODO: Add Special Gauge Styles
this._setVal = val;
}
if
(this._curVal == null) {
Special_Gauge.prototype.drawText = function() {
this._curVal = val;
if
(this._vocab) {
}
this._window.changeTextColor(this._window.systemColor());
}
this._window.drawText(this._text, this._x + 1, this._y, 30);
if
(this._curVal < this._maxVal / 10) {
Special_Gauge.prototype.drawGauge = function() {
this._window.changeTextColor(this._window.deathColor());
var fill_w = Math.round((this._width - 2) * this._curRate);
} else if
(this._curVal < this._maxVal / 4) {
var fill_ww = Math.round((this._width - 2) * this._maxRate);
this._window.changeTextColor(this._window.crisisColor());
var gy = this._y + this._window.lineHeight() - this._height - 1;
} else {
this._window.changeTextColor(this._window.normalColor());
this._window.contents.
drawTrap
(this._x, gy, this._width
- 2
, this._height, this._window.gaugeBackColor()
, true);
}
this._window.contents.
drawTrap
(this._x
, gy
, fill_w, this._height
, this._color[0], this._color[1]
, "atop"
);
var xr = this._x + this._width;
this._window.contents.drawTrap(this._x, gy, this._width - 2, this._height, gaugeOutColor);
if
(this._width < 186) {
}
this._window.drawText(Math.round(this._curVal), xr - 40, this._y, 40, "right");
} else {
Special_Gauge.prototype.drawText = function() {
this._window.drawText(Math.round(this._curVal), xr - 92, this._y, 42, "right");
if
(this._vocab) {
this._window.changeTextColor(this._window.normalColor());
if (this._showEHPHP) {
this._window.drawText("/", xr - 52, this._y, 12, "right");
this._window.changeTextColor(this._window.systemColor());
this._window.drawText(this._maxVal, xr - 42, this._y, 40, "right");
this._window.drawText(this._text, this._x + 1, this._y, 30);
}
}
}
}
if (this._showEHPText) {
if
(this._curVal < this._maxVal / 10) {
})();
this._window.changeTextColor(this._window.deathColor());
} else if
(this._curVal < this._maxVal / 4) {
this._window.changeTextColor(this._window.crisisColor());
} else {
this._window.changeTextColor(this._window.normalColor());
}
var xr = this._x + this._width;
if
(this._width < 186) {
this._window.drawText(Math.round(this._curVal), xr - 40, this._y, 40, "right");
} else {
this._window.drawText(Math.round(this._curVal), xr - 92, this._y, 42, "right");
this._window.changeTextColor(this._window.normalColor());
this._window.drawText("/", xr - 52, this._y, 12, "right");
this._window.drawText(this._maxVal, xr - 42, this._y, 40, "right");
}
}
}
}
//=============================================================================
// 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;
if (shouldFill === undefined) shouldFill = false;
if (shouldFill === "atop") {
context.globalCompositeOperation = 'source-atop';
} else {
context.globalCompositeOperation = 'source-over';
}
grad.addColorStop(0, color1);
grad.addColorStop(1, color2);
context.save();
context.beginPath();
switch (barTypeLeft) {
case "|":
startCoords = [x, y + height]
context.moveTo(x, y + height)
context.lineTo(x, y)
break;
case "/":
startCoords = [x, y + height]
context.moveTo(x, y + height)
context.lineTo(x + height, y)
break;
case "<":
startCoords = [x + height/2, y + height]
context.moveTo(x + height/2, y + height)
context.lineTo(x, y + height/2)
context.lineTo(x + height/2, y)
break;
case "(":
startCoords = [x + height, y + height]
context.moveTo(x + height, y + height);
context.bezierCurveTo(x, y + height, x, y, x + height, y);
break;
case ".":
startCoords = [x, y + height]
context.moveTo(x, y + height)
break;
case "\\":
startCoords = [x + height, y + height]
context.moveTo(x + height, y + height)
context.lineTo(x, y)
break;
}
switch (barTypeRight) {
case "|":
context.lineTo(x + width, y)
context.lineTo(x + width, y + height)
break;
case "/":
context.lineTo(x + width, y)
context.lineTo(x + width - height, y + height)
break;
case ">":
context.lineTo(x + width - height/2, y)
context.lineTo(x + width, y + height/2)
context.lineTo(x + width - height/2, y + height)
break;
case ")":
context.lineTo(x + width - height, y);
context.bezierCurveTo(x + width, y, x + width, y + height, x + width - height, y + height);
break;
case ".":
context.lineTo(x + width, y + height)
break;
case "\\":
context.lineTo(x + width - height, y)
context.lineTo(x + width, y + height)
break;
}
context.lineTo(startCoords[0], startCoords[1])
if (shouldFill) {
context.fillStyle = grad;
context.fill();
} else {
context.strokeStyle = grad;
context.stroke();
}
context.restore();
this._setDirty();
}
//=============================================================================
// EnemyGauges
//=============================================================================
if (showEnemyHP) {
function Window_EnemyHPBars() {
this.initialize.apply(this, arguments);
};
Window_EnemyHPBars.prototype = Object.create(Window_Base.prototype);
Window_EnemyHPBars.prototype.constructor = Window_EnemyHPBars;
Window_EnemyHPBars.prototype.initialize = function(sprites) {
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Graphics.boxHeight);
this.opacity = 0;
this._enemySprites = sprites.slice().reverse();
};
Window_EnemyHPBars.prototype.standardPadding = function() {
return 0;
};
Window_EnemyHPBars.prototype.drawActorHp = function(actor, x, y, width) {
width = width || 186;
if (this._gauges && this._gauges[this.makeGaugeKey(x, y)] && this._gauges[this.makeGaugeKey(x, y)]._curVal === 0) {
this.contents.clearRect(x - defaultHeight, y, width + defaultHeight, this.lineHeight() + defaultHeight);
return;
}
this.drawGauge(x, y, width, actor.hpRate(), this.hpGaugeColor1(), this.hpGaugeColor2());
this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.hpA, actor.hp, actor.mhp);
this._gauges[this.makeGaugeKey(x, y)].setTextVisibility(showEHPHP, showEHPText);
if (shouldDrawEnemyMP && (drawEnemyMPWhenNoMP || actor.mmp > 0)) {
this.drawTinyGauge(x + tinyGaugeXOffset, y + 1 + tinyGaugeYOffset, width + tinyWidthAdjust, actor.mpRate(), this.mpGaugeColor1(), this.mpGaugeColor2());
this._gauges[this.makeTGaugeKey(x + tinyGaugeXOffset, y + 1 + tinyGaugeYOffset)].setExtra(TextManager.mpA, actor.mp, actor.mmp);
// y += defaultTinyHeight;
}
// Maybe this'll be useful someday
// if (shouldDrawEnemyTP && actor.mtp > 0) {
// this.drawTinyGauge(x + tinyGaugeXOffset, y + 1 + defaultTinyHeight, width, actor.tpRate(), this.tpGaugeColor1(), this.tpGaugeColor2());
// this._gauges[this.makeTGaugeKey(x + tinyGaugeXOffset, y + 1 + defaultTinyHeight)].setExtra(TextManager.tpA, actor.tp, actor.mtp);
// }
}
Window_EnemyHPBars.prototype.makeTGaugeKey = function(x, y) {
return "tk" + x + "-" + y;
}
Window_EnemyHPBars.prototype.drawTinyGauge = function(x, y, width, rate, c1, c2) {
if(this._gauges == null) { this._gauges = {} };
var gkey = this.makeTGaugeKey(x, y)
if(this._gauges[gkey]) {
this._gauges[gkey].setRate(rate);
} else {
this._gauges[gkey] = new Line_Gauge(x, y, width, rate, c1, c2, this, defaultTinyHeight);
}
}
Window_EnemyHPBars.prototype.update = function() {
Window_Base.prototype.update.call(this);
var width = EHPbarWidth, x, y;
for (var i = 0; i < $gameTroop._enemies.length; i++) {
if (!this._enemySprites[i].height || !this._enemySprites[i].width) continue;
x = $gameTroop._enemies[i].screenX() - (width + this.textPadding())/2 + EHPXOffset + (parseInt($dataEnemies[$gameTroop._enemies[i]._enemyId].meta.HPBarXOffset) || 0);
y = $gameTroop._enemies[i].screenY() - this.lineHeight() + EHPYOffset + (parseInt($dataEnemies[$gameTroop._enemies[i]._enemyId].meta.HPBarYOffset) || 0);
if (showUpTop) y -= this._enemySprites[i].height * EHPYMultiplier;
this.drawActorHp($gameTroop._enemies[i], x, y, width);
}
}
function Line_Gauge() {
this.initialize.apply(this, arguments);
}
Line_Gauge.prototype = Object.create(Special_Gauge.prototype);
Line_Gauge.prototype.constructor = Line_Gauge;
Line_Gauge.prototype.refresh = function() {
this._window.contents.clearRect(this._x, this.y, this._width, this._height);
this.drawGauge();
}
Line_Gauge.prototype.drawGauge = function() {
var fill_w = Math.round((this._width - 2 - defaultHeight) * this._curRate);
var fill_ww = Math.round((this._width - 2) * this._maxRate);
var gy = this._y + this._window.lineHeight() - this._height;
this._window.contents.fillRect(this._x - 1, gy, this._width - defaultHeight, this._height + 2, gaugeOutColor);
this._window.contents.fillRect(this._x, gy + 1, this._width - 2 - defaultHeight, this._height, this._window.gaugeBackColor());
this._window.contents.gradientFillRect(this._x, gy + 1, fill_w, this._height, this._color[0], this._color[1]);
}
Line_Gauge.prototype.drawText = function() {};
if (showOver) {
var alias_Scene_Battle_createSpriteset = Scene_Battle.prototype.createSpriteset;
Scene_Battle.prototype.createSpriteset = function() {
alias_Scene_Battle_createSpriteset.call(this);
this._enemyHPBarWindow = new Window_EnemyHPBars(this._spriteset._enemySprites);
this.addChild(this._enemyHPBarWindow);
};
} else {
var alias_Spriteset_Battle_createEnemies = Spriteset_Battle.prototype.createEnemies;
Spriteset_Battle.prototype.createEnemies = function() {
alias_Spriteset_Battle_createEnemies.call(this);
this._enemyHPBarWindow = new Window_EnemyHPBars(this._enemySprites);
this._enemyHPBarWindow.z = 2;
this._battleField.addChild(this._enemyHPBarWindow);
};
}
Sprite_Enemy.prototype.updateStateSprite = function() {
this._stateIconSprite.y = -Math.round((this.bitmap.height + EHPStateYOffset) * 0.9);
if (this._stateIconSprite.y < 20 - this.y) {
this._stateIconSprite.y = 20 - this.y;
}
this._stateIconSprite.y += (parseInt($dataEnemies[this._enemy._enemyId].meta.HPBarYOffset) || 0);
this._stateIconSprite.x = EHPStateXOffset + (parseInt($dataEnemies[this._enemy._enemyId].meta.HPBarXOffset) || 0);
};
} // End Enemy HP bars
})();
Saved diffs
Original text
Open file
//============================================================================= // sleekgauges.js //============================================================================= /*: * @plugindesc Sleek Gauges! Look at them go, so shiny, so cool. * @author Vlue Au'Vier * * @param Gauge Height * @desc Default height of the gauges * @default 8 * * @param Animated Numbers * @desc Whether or not numbers count down/up * @default true * * @param Animated Gauge * @desc Whether or not the gauge is animated * @default true * * @param Gauge Style * @desc Visual style of the gauge (Available: normal) * @default normal * * @param Gauge Slide Style * @desc Animation style of the gauge (Available: slide) * @default slide * * @help Sleek Gauges v0.1 * Facebook: https://www.facebook.com/DaimoniousTailsGames/ * Website: http://daimonioustails.weebly.com/ * * Gauge Styles: * normal - normal gauge * * Gauge Slide Styles: * slide - gauges gradually approach their values * */ (function() { var parameters = PluginManager.parameters('sleekgauges'); var defaultHeight = Number(parameters['Gauge Height'] || 8); var animatedNumbers = (parameters['Animated Numbers'] || "true").toLowerCase() == "true"; var animatedGauges = (parameters['Animated Gauges'] || "true").toLowerCase() == "true"; var gaugeStyle = parameters['Gauge Style'] || "normal"; var gaugeSlideStyle = parameters['Gauge Slide Style'] || "slide"; Window_Base.prototype.drawGauge = function(x, y, width, rate, c1, c2) { 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) } } 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(); } } } Window_Base.prototype.makeGaugeKey = function(x, y) { return "k" + x + "-" + y; } Window_Base.prototype.drawActorHp = function(actor, x, y, width) { width = width || 186; this.drawGauge(x, y, width, actor.hpRate(), this.hpGaugeColor1(), this.hpGaugeColor2()); this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.hpA, actor.hp, actor.mhp); } Window_Base.prototype.drawActorMp = function(actor, x, y, width) { width = width || 186; this.drawGauge(x, y, width, actor.mpRate(), this.mpGaugeColor1(), this.mpGaugeColor2()); this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.mpA, actor.mp, actor.mmp); } Window_Base.prototype.drawActorTp = function(actor, x, y, width) { width = width || 186; this.drawGauge(x, y, width, actor.tpRate(), this.tpGaugeColor1(), this.tpGaugeColor2()); this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.tpA, actor.tp, 100); } function Special_Gauge() { this.initialize.apply(this, arguments); } Special_Gauge.prototype.constructor = Special_Gauge; Special_Gauge.prototype.initialize = function(x, y, w, r, c1, c2, basewindow, h) { this._x = x; this._y = y; this._width = w; this._curRate = this._maxRate = r; this._vocab = false; this._color = [c1, c2]; this._window = basewindow this._speed = 0; this._speedRate = 0; this._height = h; this._fallSprites = []; this.refresh(); } Special_Gauge.prototype.update = function() { this.updateFallSprites(); if(this._curRate != this._maxRate) { if(this._curRate > this._maxRate) { this._curRate -= this._speedRate; this._curVal -= this._speed; } else { this._curRate += this._speedRate; this._curVal += this._speed; } if(Math.abs(this._curRate - this._maxRate) < this._speedRate) { this._curRate = this._maxRate; this._curVal = this._setVal; } if(!animatedNumbers) { this._curVal = this._setVal; } if(!animatedGauges) { this._curRate = this._maxRate; } } this.refresh(); } Special_Gauge.prototype.updateFallSprites = function() { //TODO: Add in this part! } Special_Gauge.prototype.refresh = function() { if(this._vocab) { this._window.contents.clearRect(this._x, this._y, this._width+2, this._window.lineHeight()); } else { var gy = this._y + this._window.lineHeight() - this._height - 1; this._window.contents.clearRect(this._x, gy, this._width, this._height); } this.drawGauge(); this.drawText(); } Special_Gauge.prototype.setRate = function(rate) { if(rate != this._maxRate) { this._maxRate = rate; this._speedRate = Math.abs(this._curRate - this._maxRate) / 60; //TODO: More Falling Sprite Stuff } } Special_Gauge.prototype.setExtra = function(text, val, max) { this._vocab = true; this._text = text; this._maxVal = max; if(val != this._setVal) { this._speed = Math.max(0, Math.abs(this._curVal - val) / 60); } this._setVal = val; if(this._curVal == null) { this._curVal = val; } } Special_Gauge.prototype.drawGauge = function() { var fill_w = Math.round((this._width - 2) * this._curRate); var fill_ww = Math.round((this._width - 2) * this._maxRate); var gy = this._y + this._window.lineHeight() - this._height - 1; this._window.contents.fillRect(this._x, gy, this._width, this._height, this._window.gaugeBackColor()); if(gaugeSlideStyle == "fancy") { //TODO: Add me } else if(gaugeSlideStyle == "fall") { //TODO: Add me } else { this._window.contents.gradientFillRect(this._x + 1, Math.round(gy + 1), fill_w, this._height - 2, this._color[0], this._color[1]); } //TODO: Add Special Gauge Styles } Special_Gauge.prototype.drawText = function() { if(this._vocab) { this._window.changeTextColor(this._window.systemColor()); this._window.drawText(this._text, this._x + 1, this._y, 30); if(this._curVal < this._maxVal / 10) { this._window.changeTextColor(this._window.deathColor()); } else if(this._curVal < this._maxVal / 4) { this._window.changeTextColor(this._window.crisisColor()); } else { this._window.changeTextColor(this._window.normalColor()); } var xr = this._x + this._width; if(this._width < 186) { this._window.drawText(Math.round(this._curVal), xr - 40, this._y, 40, "right"); } else { this._window.drawText(Math.round(this._curVal), xr - 92, this._y, 42, "right"); this._window.changeTextColor(this._window.normalColor()); this._window.drawText("/", xr - 52, this._y, 12, "right"); this._window.drawText(this._maxVal, xr - 42, this._y, 40, "right"); } } } })();
Changed text
Open file
//============================================================================= // PrettySleekGauges.js //============================================================================= /*: * @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 where they go! * @author Vlue Au'Vier (sleek), Rocketmancer (pretty), mjshi (pretty sleek) * * @param Bar Shape * @desc 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 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 X Offset * @parent Enemy HP Gauge * @desc X offset of the enemy hp gauges * @type number * @min -100000000000000000000000 * @default 0 * * @param 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 * * @help * ---------------------------------------------------------------------------- * Pretty Sleek Gauges v1.0 * ---------------------------------------------------------------------------- * 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. * ---------------------------------------------------------------------------- * 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 * ---------------------------------------------------------------------------- * > Is something broken? Go to http://mjshi.weebly.com/contact.html and I'll * try my best to help you! * */ (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 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['X Offset']) || 0; var EHPYOffset = parseInt(parameters['Y Offset']) || 0; var EHPbarWidth = parseInt(parameters['Bar Width']) || 120; var showEHPHP = (parameters['Show Enemy HP Text'] || "false") === "true"; 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"; //============================================================================= // Sleek Gauges //============================================================================= Window_Base.prototype.drawGauge = function(x, y, width, rate, c1, c2) { 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); } } 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(); } } } Window_Base.prototype.makeGaugeKey = function(x, y) { return "k" + x + "-" + y; } Window_Base.prototype.drawActorHp = function(actor, x, y, width) { width = width || 186; this.drawGauge(x, y, width, actor.hpRate(), this.hpGaugeColor1(), this.hpGaugeColor2()); this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.hpA, actor.hp, actor.mhp); } Window_Base.prototype.drawActorMp = function(actor, x, y, width) { width = width || 186; this.drawGauge(x, y, width, actor.mpRate(), this.mpGaugeColor1(), this.mpGaugeColor2()); this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.mpA, actor.mp, actor.mmp); } Window_Base.prototype.drawActorTp = function(actor, x, y, width) { width = width || 186; this.drawGauge(x, y, width, actor.tpRate(), this.tpGaugeColor1(), this.tpGaugeColor2()); this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.tpA, actor.tp, 100); } function Special_Gauge() { this.initialize.apply(this, arguments); } Special_Gauge.prototype.constructor = Special_Gauge; Special_Gauge.prototype.initialize = function(x, y, w, r, c1, c2, basewindow, h) { this._x = x; this._y = y; this._width = w; this._curRate = this._maxRate = r; this._vocab = false; this._color = [c1, c2]; this._window = basewindow this._speed = 0; this._speedRate = 0; this._height = h; this._fallSprites = []; this._showEHPHP = true; this._showEHPText = true; this.refresh(); } Special_Gauge.prototype.setTextVisibility = function(hpText, hpNum) { this._showEHPHP = hpText; this._showEHPText = hpNum; } Special_Gauge.prototype.update = function() { this.updateFallSprites(); if (this._curRate != this._maxRate) { if (this._curRate > this._maxRate) { this._curRate -= this._speedRate; this._curVal -= this._speed; } else { this._curRate += this._speedRate; this._curVal += this._speed; } if (Math.abs(this._curRate - this._maxRate) < this._speedRate) { this._curRate = this._maxRate; this._curVal = this._setVal; } if (!animatedNumbers) { this._curVal = this._setVal; } if (!animatedGauges) { this._curRate = this._maxRate; } } this.refresh(); } Special_Gauge.prototype.updateFallSprites = function() { //TODO: Add in this part! } Special_Gauge.prototype.refresh = function() { if (this._vocab) { this._window.contents.clearRect(this._x, this._y, this._width+2, this._window.lineHeight()); } else { var gy = this._y + this._window.lineHeight() - this._height - 1; this._window.contents.clearRect(this._x, gy, this._width, this._height); } this.drawGauge(); this.drawText(); } Special_Gauge.prototype.setRate = function(rate) { if (rate != this._maxRate) { this._maxRate = rate; this._speedRate = Math.abs(this._curRate - this._maxRate) / 60; //TODO: More Falling Sprite Stuff } } Special_Gauge.prototype.setExtra = function(text, val, max) { this._vocab = true; this._text = text; this._maxVal = max; if (val != this._setVal) { this._speed = Math.max(0, Math.abs(this._curVal - val) / 60); } this._setVal = val; if (this._curVal == null) { this._curVal = val; } } Special_Gauge.prototype.drawGauge = function() { var fill_w = Math.round((this._width - 2) * this._curRate); var fill_ww = Math.round((this._width - 2) * this._maxRate); var gy = this._y + this._window.lineHeight() - this._height - 1; this._window.contents.drawTrap(this._x, gy, this._width - 2, this._height, this._window.gaugeBackColor(), true); this._window.contents.drawTrap(this._x, gy, fill_w, this._height, this._color[0], this._color[1], "atop"); this._window.contents.drawTrap(this._x, gy, this._width - 2, this._height, gaugeOutColor); } Special_Gauge.prototype.drawText = function() { if (this._vocab) { if (this._showEHPHP) { this._window.changeTextColor(this._window.systemColor()); this._window.drawText(this._text, this._x + 1, this._y, 30); } if (this._showEHPText) { if (this._curVal < this._maxVal / 10) { this._window.changeTextColor(this._window.deathColor()); } else if (this._curVal < this._maxVal / 4) { this._window.changeTextColor(this._window.crisisColor()); } else { this._window.changeTextColor(this._window.normalColor()); } var xr = this._x + this._width; if (this._width < 186) { this._window.drawText(Math.round(this._curVal), xr - 40, this._y, 40, "right"); } else { this._window.drawText(Math.round(this._curVal), xr - 92, this._y, 42, "right"); this._window.changeTextColor(this._window.normalColor()); this._window.drawText("/", xr - 52, this._y, 12, "right"); this._window.drawText(this._maxVal, xr - 42, this._y, 40, "right"); } } } } //============================================================================= // 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; if (shouldFill === undefined) shouldFill = false; if (shouldFill === "atop") { context.globalCompositeOperation = 'source-atop'; } else { context.globalCompositeOperation = 'source-over'; } grad.addColorStop(0, color1); grad.addColorStop(1, color2); context.save(); context.beginPath(); switch (barTypeLeft) { case "|": startCoords = [x, y + height] context.moveTo(x, y + height) context.lineTo(x, y) break; case "/": startCoords = [x, y + height] context.moveTo(x, y + height) context.lineTo(x + height, y) break; case "<": startCoords = [x + height/2, y + height] context.moveTo(x + height/2, y + height) context.lineTo(x, y + height/2) context.lineTo(x + height/2, y) break; case "(": startCoords = [x + height, y + height] context.moveTo(x + height, y + height); context.bezierCurveTo(x, y + height, x, y, x + height, y); break; case ".": startCoords = [x, y + height] context.moveTo(x, y + height) break; case "\\": startCoords = [x + height, y + height] context.moveTo(x + height, y + height) context.lineTo(x, y) break; } switch (barTypeRight) { case "|": context.lineTo(x + width, y) context.lineTo(x + width, y + height) break; case "/": context.lineTo(x + width, y) context.lineTo(x + width - height, y + height) break; case ">": context.lineTo(x + width - height/2, y) context.lineTo(x + width, y + height/2) context.lineTo(x + width - height/2, y + height) break; case ")": context.lineTo(x + width - height, y); context.bezierCurveTo(x + width, y, x + width, y + height, x + width - height, y + height); break; case ".": context.lineTo(x + width, y + height) break; case "\\": context.lineTo(x + width - height, y) context.lineTo(x + width, y + height) break; } context.lineTo(startCoords[0], startCoords[1]) if (shouldFill) { context.fillStyle = grad; context.fill(); } else { context.strokeStyle = grad; context.stroke(); } context.restore(); this._setDirty(); } //============================================================================= // EnemyGauges //============================================================================= if (showEnemyHP) { function Window_EnemyHPBars() { this.initialize.apply(this, arguments); }; Window_EnemyHPBars.prototype = Object.create(Window_Base.prototype); Window_EnemyHPBars.prototype.constructor = Window_EnemyHPBars; Window_EnemyHPBars.prototype.initialize = function(sprites) { Window_Base.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Graphics.boxHeight); this.opacity = 0; this._enemySprites = sprites.slice().reverse(); }; Window_EnemyHPBars.prototype.standardPadding = function() { return 0; }; Window_EnemyHPBars.prototype.drawActorHp = function(actor, x, y, width) { width = width || 186; if (this._gauges && this._gauges[this.makeGaugeKey(x, y)] && this._gauges[this.makeGaugeKey(x, y)]._curVal === 0) { this.contents.clearRect(x - defaultHeight, y, width + defaultHeight, this.lineHeight() + defaultHeight); return; } this.drawGauge(x, y, width, actor.hpRate(), this.hpGaugeColor1(), this.hpGaugeColor2()); this._gauges[this.makeGaugeKey(x, y)].setExtra(TextManager.hpA, actor.hp, actor.mhp); this._gauges[this.makeGaugeKey(x, y)].setTextVisibility(showEHPHP, showEHPText); if (shouldDrawEnemyMP && (drawEnemyMPWhenNoMP || actor.mmp > 0)) { this.drawTinyGauge(x + tinyGaugeXOffset, y + 1 + tinyGaugeYOffset, width + tinyWidthAdjust, actor.mpRate(), this.mpGaugeColor1(), this.mpGaugeColor2()); this._gauges[this.makeTGaugeKey(x + tinyGaugeXOffset, y + 1 + tinyGaugeYOffset)].setExtra(TextManager.mpA, actor.mp, actor.mmp); // y += defaultTinyHeight; } // Maybe this'll be useful someday // if (shouldDrawEnemyTP && actor.mtp > 0) { // this.drawTinyGauge(x + tinyGaugeXOffset, y + 1 + defaultTinyHeight, width, actor.tpRate(), this.tpGaugeColor1(), this.tpGaugeColor2()); // this._gauges[this.makeTGaugeKey(x + tinyGaugeXOffset, y + 1 + defaultTinyHeight)].setExtra(TextManager.tpA, actor.tp, actor.mtp); // } } Window_EnemyHPBars.prototype.makeTGaugeKey = function(x, y) { return "tk" + x + "-" + y; } Window_EnemyHPBars.prototype.drawTinyGauge = function(x, y, width, rate, c1, c2) { if(this._gauges == null) { this._gauges = {} }; var gkey = this.makeTGaugeKey(x, y) if(this._gauges[gkey]) { this._gauges[gkey].setRate(rate); } else { this._gauges[gkey] = new Line_Gauge(x, y, width, rate, c1, c2, this, defaultTinyHeight); } } Window_EnemyHPBars.prototype.update = function() { Window_Base.prototype.update.call(this); var width = EHPbarWidth, x, y; for (var i = 0; i < $gameTroop._enemies.length; i++) { if (!this._enemySprites[i].height || !this._enemySprites[i].width) continue; x = $gameTroop._enemies[i].screenX() - (width + this.textPadding())/2 + EHPXOffset + (parseInt($dataEnemies[$gameTroop._enemies[i]._enemyId].meta.HPBarXOffset) || 0); y = $gameTroop._enemies[i].screenY() - this.lineHeight() + EHPYOffset + (parseInt($dataEnemies[$gameTroop._enemies[i]._enemyId].meta.HPBarYOffset) || 0); if (showUpTop) y -= this._enemySprites[i].height * EHPYMultiplier; this.drawActorHp($gameTroop._enemies[i], x, y, width); } } function Line_Gauge() { this.initialize.apply(this, arguments); } Line_Gauge.prototype = Object.create(Special_Gauge.prototype); Line_Gauge.prototype.constructor = Line_Gauge; Line_Gauge.prototype.refresh = function() { this._window.contents.clearRect(this._x, this.y, this._width, this._height); this.drawGauge(); } Line_Gauge.prototype.drawGauge = function() { var fill_w = Math.round((this._width - 2 - defaultHeight) * this._curRate); var fill_ww = Math.round((this._width - 2) * this._maxRate); var gy = this._y + this._window.lineHeight() - this._height; this._window.contents.fillRect(this._x - 1, gy, this._width - defaultHeight, this._height + 2, gaugeOutColor); this._window.contents.fillRect(this._x, gy + 1, this._width - 2 - defaultHeight, this._height, this._window.gaugeBackColor()); this._window.contents.gradientFillRect(this._x, gy + 1, fill_w, this._height, this._color[0], this._color[1]); } Line_Gauge.prototype.drawText = function() {}; if (showOver) { var alias_Scene_Battle_createSpriteset = Scene_Battle.prototype.createSpriteset; Scene_Battle.prototype.createSpriteset = function() { alias_Scene_Battle_createSpriteset.call(this); this._enemyHPBarWindow = new Window_EnemyHPBars(this._spriteset._enemySprites); this.addChild(this._enemyHPBarWindow); }; } else { var alias_Spriteset_Battle_createEnemies = Spriteset_Battle.prototype.createEnemies; Spriteset_Battle.prototype.createEnemies = function() { alias_Spriteset_Battle_createEnemies.call(this); this._enemyHPBarWindow = new Window_EnemyHPBars(this._enemySprites); this._enemyHPBarWindow.z = 2; this._battleField.addChild(this._enemyHPBarWindow); }; } Sprite_Enemy.prototype.updateStateSprite = function() { this._stateIconSprite.y = -Math.round((this.bitmap.height + EHPStateYOffset) * 0.9); if (this._stateIconSprite.y < 20 - this.y) { this._stateIconSprite.y = 20 - this.y; } this._stateIconSprite.y += (parseInt($dataEnemies[this._enemy._enemyId].meta.HPBarYOffset) || 0); this._stateIconSprite.x = EHPStateXOffset + (parseInt($dataEnemies[this._enemy._enemyId].meta.HPBarXOffset) || 0); }; } // End Enemy HP bars })();
Find difference