paradise-succubus-ac/www/js/plugins/kz_StatusWindow.js
2026-06-24 05:29:56 -05:00

307 lines
No EOL
11 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*:ja
* @plugindesc ステータスシーンの自由設置
* @author 剣崎宗二
*
*
* @param Status Window X
* @desc ステータスウインドウのX-1の場合はデフォルト動作)。
* @type number
* @min -1
* @default -1
*
* @param Status Window Y
* @desc ステータスウインドウのY-1の場合はデフォルト動作)。
* @type number
* @min -1
* @default -1
*
* @param Status Window Width
* @desc ステータスウインドウの横幅(-1の場合はデフォルト動作)。
* @type number
* @min -1
* @default 300
*
* @param Status Window Height
* @desc ステータスウインドウの縦幅(-1の場合はデフォルト動作)。
* @type number
* @min -1
* @default 600
*
* @param Status Window Padding
* @desc ステータスウィンドウの外周、余白サイズ。
* @type number
* @min 0
* @default 18
*
* @param State X
* @desc ステートアイコンエリアの相対座標のX。
* @type number
* @default 0
*
* @param State Y
* @desc ステートアイコンエリアの相対座標のY。
* @type number
* @default 0
*
* @param State Width
* @desc ステートアイコンエリアの横幅。マイナス値の場合アイコンは表示されない。
* @type number
* @min -1
* @default 144
*
* @param Actor Icon X
* @desc アクターアイコンのX。Yとどちらかがマイナスだった場合、表示されない。
* @type number
* @min -1
* @default -1
*
* @param Actor Icon Y
* @desc アクターアイコンのY。Xとどちらかがマイナスだった場合、表示されない
* @type number
* @min -1
* @default -1
*
* @param Background PNG
* @desc ウィンドウの背景ファイル。Systemフォルダ内。この欄が空白でデフォルト状態。
* @type string
* @default
*
* @param Display Text
* @desc 表示するテキスト。,区切りで 内容,x,y,横幅,文字サイズ,文字色ID,アウトライン色ID,フォント名 。値がなければデフォルト。
* @type string[]
* @default ["a.name(),10,10,30","a.mhp,40,10,30,38,10,,10"]
*
* @param Display Picture
* @desc 表示するピクチャ、複数指定可でpicturesフォルダ内。,区切りで ピクチャ名,x,y 。
* @type string[]
* @default ["a.actor().meta.stand_picture,10,10,30"]
*
* @param Display Gauge
* @desc 表示するゲージ。,区切りで 変動値,最大値,x,y,ゲージ幅,実体色ID,背景色ID。
* @type string[]
* @default ["a.mp,a.mmp,10,40,70,20,21"]
*
* @param Display Icon
* @desc 表示するアイコン。,区切りで アイコンID,x,y。
* @type string[]
* @default ["4,0,0"]
*
*
*
* @help このプラグインには、プラグインコマンドはありません。
*
* ■使用する画像は全て任意の名前が使えます。
*  各パラメータにある配置箇所に注意して下さい。
*
* ■表示テキスト、及びゲージの現在値/最大値には a.hp や a.atk などの他、
*  変数やメモの値といった様々なデータが記載できます。
*
* その他パラメータ(a.○○の一例、何方も名称は''の直テキスト入力で)
* xparam) cev    会心回避率
*       mev    魔法回避率
*       mrf    魔法反射率
*       cnt    反撃率
*       hrg HP再生率
*       mrg MP再生率
*       trg TP再生率
*
* sparam) tgr 狙われ率
*       grd 防御効果率
*       rec 回復効果率
*       pha 薬の知識
*       mcr MP消費率
*       tcr TPチャージ率
*      pdr 物理ダメージ率
*       mdr 魔法ダメージ率
*      fdr 床ダメージ率
*       exr 経験獲得率
*
* ■Display TextとDisplay GaugeにあるIDとはwindow.pngのカラーパレット
* インデックスです。変更する場合は0から数えて記載して下さい。 
*
* ■フォントを変えた場合、一度の読み込みでは表示されない可能性があります。
* 他のフォントロード系プラグインなどでカバーする事を推奨します。
*
* ■読み取るメモについて(●.meta.○)
* ●の箇所で場所を指定 a.actor()    =アクター
*            a.currentClass() =クラス   など
* ○は値の名前なので分かりやすい名前にしてください。
*
*
*
*/
(function () {
var parameters = PluginManager.parameters('kz_StatusWindow');
var _wX = Number(parameters['Status Window X'] || -1);
var _wY = Number(parameters['Status Window Y'] || -1);
var _wWidth = Number(parameters['Status Window Width'] || -1);
var _wHeight = Number(parameters['Status Window Height'] || -1);
var _wPadding = Number(parameters['Status Window Padding'] || 0);
var _wBackground = String(parameters['Background PNG'] || '');
var _faceX = Number(parameters['Actor Icon X'] || -1);
var _faceY = Number(parameters['Actor Icon Y'] || -1);
var _stateX = Number(parameters['State X'] || 0);
var _stateY = Number(parameters['State Y'] || 0);
var _stateWidth = Number(parameters['State Width'] || 144);
var _dTextArray = eval(parameters['Display Text']) || [];
var _dPicArray = eval(parameters['Display Picture']) || [];
var _dGaugeArray = eval(parameters['Display Gauge']) || [];
var _dIconArray = eval(parameters['Display Icon']) || [];
var kz_Window_Status_prototype_initialize = Window_Status.prototype.initialize;
Window_Status.prototype.initialize = function () {
kz_Window_Status_prototype_initialize.call(this);
var fx = _wX >= 0 ? _wX : 0;
var fy = _wY >= 0 ? _wY : 0;
var fw = _wWidth >= 0 ? _wWidth : this.width;
var fh = _wHeight >= 0 ? _wHeight : this.height;
this.move(fx, fy, fw, fh);
if (_wBackground != '') {
this.setBackgroundType(2);
this.createBackSprite();
}
this.reserveStatusImages();
};
Window_Status.prototype.createBackSprite = function () {
this._backSprite = new Sprite();
this._backSprite.bitmap = ImageManager.loadSystem(_wBackground);
this.addChildToBack(this._backSprite);
};
Window_Status.prototype.refresh = function () {
this.contents.clear();
if (this._actor) {
this.drawFullStatus(this._actor);
}
};
Window_Status.prototype.drawFullStatus = function (actor) {
if (!actor) return;
this.drawStatusPicture(actor);
if (_faceX >= 0 && _faceY >= 0) {
this.drawActorFace(actor, _faceX, _faceY, Window_Base._faceWidth, Window_Base._faceHeight);
}
this.drawStatusGauge(actor);
this.drawStatusState(actor);
this.drawStatusText(actor);
this.drawStatusIcons(actor);
};
Window_Status.prototype.drawStatusState = function (actor) {
if (_stateWidth < 0) return;
var a = actor;
var x = _stateX;
var y = _stateY;
var width = _stateWidth;
this.drawActorIcons(a, x, y, width);
};
Window_Status.prototype.drawStatusIcons = function (actor) {
var a = actor;
_dIconArray.forEach(function (line) {
var dataArray = line.split(',');
var value = eval(dataArray[0]);
var x = Number(dataArray[1]);
var y = Number(dataArray[2]);
this.drawIcon(value, x, y);
}, this);
};
Window_Status.prototype.drawStatusText = function (actor) {
var a = actor;
_dTextArray.forEach(function (line) {
var dataArray = line.split(',');
var value = eval(dataArray[0]);
var x = Number(dataArray[1]);
var y = Number(dataArray[2]);
var width = Number(dataArray[3]);
var fontSize = Number(dataArray[4]);
var textColor = Number(dataArray[5]);
var outlineColor = Number(dataArray[6]);
var fontFace = dataArray[7];
var currentOutlineColor = this.contents.outlineColor;
if (fontFace) { this.contents.fontFace = fontFace; }
if (textColor >= 0) { this.changeTextColor(this.textColor(textColor)); }
if (outlineColor >= 0) { this.contents.outlineColor = this.textColor(outlineColor); }
if (fontSize >= 0) { this.contents.fontSize = fontSize; }
this.forbidResetFont = true;
this.drawTextEx(String(value), x, y);
this.forbidResetFont = false;
this.resetFontSettings();
this.contents.outlineColor = currentOutlineColor;
}, this);
};
Window_Status.prototype.drawStatusPicture = function (actor) {
var a = actor;
_dPicArray.forEach(function (line) {
var dataArray = line.split(',');
var value = eval(dataArray[0]);
var bitmap = ImageManager.loadPicture(value);
var x = Number(dataArray[1]);
var y = Number(dataArray[2]);
var pw = bitmap.width;
var ph = bitmap.height;
this.contents.blt(bitmap, 0, 0, pw, ph, x, y);
}, this);
};
Window_Status.prototype.drawStatusGauge = function (actor) {
var a = actor;
_dGaugeArray.forEach(function (line) {
var dataArray = line.split(',');
var minValue = Number(eval(dataArray[0]));
var maxValue = Number(eval(dataArray[1]));
var x = Number(dataArray[2]);
var y = Number(dataArray[3]);
var width = Number(dataArray[4]);
var rate = minValue / maxValue;
var color1 = this.textColor(Number(dataArray[5]));
var color2 = this.textColor(Number(dataArray[6]));
this.drawGauge(x, y, width, rate, color1, color2);
}, this);
};
Window_Status.prototype.standardPadding = function () {
return _wPadding;
};
Window_Status.prototype.reserveStatusImages = function() {
$gameParty.members().forEach(function(a) {
_dPicArray.forEach(function (line) {
var dataArray = line.split(',');
var value = eval(dataArray[0]);
ImageManager.reservePicture(value);
}, this);
}, this);
};
Window_Status.prototype.resetFontSettings = function() {
if (this.forbidResetFont) return;
this.contents.fontFace = this.standardFontFace();
this.contents.fontSize = this.standardFontSize();
this.resetTextColor();
};
})();