1479 lines
44 KiB
JavaScript
1479 lines
44 KiB
JavaScript
//=============================================================================
|
||
// TMPlugin - マップHPゲージ
|
||
// バージョン: 1.4.4
|
||
// 最終更新日: 2019/11/04
|
||
// 配布元 : https://hikimoki.sakura.ne.jp/
|
||
//-----------------------------------------------------------------------------
|
||
// Copyright (c) 2016 tomoaky
|
||
// Released under the MIT license.
|
||
// http://opensource.org/licenses/mit-license.php
|
||
//=============================================================================
|
||
|
||
/*:
|
||
* @target MZ
|
||
* @plugindesc マップシーンに顔グラフィックとHPゲージを表示します。
|
||
* 必要に応じてMPや変数などをゲージで表示することもできます。
|
||
*
|
||
* @author tomoaky (https://hikimoki.sakura.ne.jp/)
|
||
*
|
||
* @param gaugeWindowX
|
||
* @type number
|
||
* @min -1000
|
||
* @desc HPゲージウィンドウのX座標
|
||
* 初期値: 0
|
||
* @default 0
|
||
*
|
||
* @param gaugeWindowY
|
||
* @type number
|
||
* @min -1000
|
||
* @desc HPゲージウィンドウのY座標
|
||
* 初期値: 0
|
||
* @default 0
|
||
*
|
||
* @param gaugeWindowWidth
|
||
* @type number
|
||
* @desc HPゲージウィンドウの幅
|
||
* 初期値: 288
|
||
* @default 288
|
||
*
|
||
* @param gaugeWindowHeight
|
||
* @type number
|
||
* @desc HPゲージウィンドウの高さ
|
||
* 初期値: 64
|
||
* @default 64
|
||
*
|
||
* @param gaugeA
|
||
* @type struct<Gauge>
|
||
* @desc ゲージAのパラメータ
|
||
* @default {"type":"HP","x":"12","y":"12","width":"144","height":"36","fontSize":"28","param":"0","max":"0","name":"AP","color":"#ff60c0 #ffa0e0"}
|
||
*
|
||
* @param gaugeB
|
||
* @type struct<Gauge>
|
||
* @desc ゲージBのパラメータ
|
||
* @default {"type":"","x":"12","y":"12","width":"144","height":"36","fontSize":"28","param":"0","max":"0","name":"AP","color":"#ff60c0 #ffa0e0"}
|
||
*
|
||
* @param gaugeC
|
||
* @type struct<Gauge>
|
||
* @desc ゲージCのパラメータ
|
||
* @default {"type":"","x":"12","y":"12","width":"144","height":"36","fontSize":"28","param":"0","max":"0","name":"AP","color":"#ff60c0 #ffa0e0"}
|
||
*
|
||
* @param gaugeD
|
||
* @type struct<Gauge>
|
||
* @desc ゲージDのパラメータ
|
||
* @default {"type":"","x":"12","y":"12","width":"144","height":"36","fontSize":"28","param":"0","max":"0","name":"AP","color":"#ff60c0 #ffa0e0"}
|
||
*
|
||
* @param faceOffsetX
|
||
* @type number
|
||
* @min -1000
|
||
* @desc 顔グラフィックのX座標補正値
|
||
* 初期値: -4 ( -1000 で顔グラフィックを使用しない)
|
||
* @default -4
|
||
*
|
||
* @param faceOffsetY
|
||
* @type number
|
||
* @min -1000
|
||
* @desc 顔グラフィックのY座標補正値
|
||
* 初期値: -4
|
||
* @default -4
|
||
*
|
||
* @param stateIconMax
|
||
* @type number
|
||
* @desc ステートアイコンを表示する個数
|
||
* 初期値: 4
|
||
* @default 4
|
||
*
|
||
* @param stateIconX
|
||
* @type number
|
||
* @min -1000
|
||
* @desc ステートアイコンのX座標
|
||
* 初期値: 156
|
||
* @default 156
|
||
*
|
||
* @param stateIconY
|
||
* @type number
|
||
* @min -1000
|
||
* @desc ステートアイコンのY座標
|
||
* 初期値: 24
|
||
* @default 24
|
||
*
|
||
* @param stateIconScale
|
||
* @type number
|
||
* @desc ステートアイコンの拡大率( % )
|
||
* 初期値: 100
|
||
* @default 100
|
||
*
|
||
* @param stateIconOpacity
|
||
* @type number
|
||
* @desc ステートアイコンの不透明度( 0 ~ 255 )
|
||
* 初期値: 255
|
||
* @default 255
|
||
*
|
||
* @param goldWidth
|
||
* @type number
|
||
* @desc 所持金表示の幅
|
||
* 初期値: 0 ( 0 で非表示 )
|
||
* @default 0
|
||
*
|
||
* @param goldX
|
||
* @type number
|
||
* @min -9999
|
||
* @desc 所持金表示のX座標
|
||
* 初期値: 12
|
||
* @default 12
|
||
*
|
||
* @param goldY
|
||
* @type number
|
||
* @min -1000
|
||
* @desc 所持金表示のY座標
|
||
* 初期値: 12
|
||
* @default 12
|
||
*
|
||
* @param mapWidth
|
||
* @type number
|
||
* @desc マップ名表示の幅
|
||
* 初期値: 0 ( 0 で非表示 )
|
||
* @default 0
|
||
*
|
||
* @param mapX
|
||
* @type number
|
||
* @min -9999
|
||
* @desc マップ名表示のX座標
|
||
* 初期値: 12
|
||
* @default 12
|
||
*
|
||
* @param mapY
|
||
* @type number
|
||
* @min -1000
|
||
* @desc マップ名表示のY座標
|
||
* 初期値: 12
|
||
* @default 12
|
||
*
|
||
* @param vnMax
|
||
* @type boolean
|
||
* @desc ゲージタイプ VN の最大値を表示するかどうか
|
||
* 初期値: OFF ( true = ON 表示 / false = OFF 非表示 )
|
||
* @default false
|
||
*
|
||
* @param shakeTime
|
||
* @type number
|
||
* @desc ダメージを受けたときにウィンドウを揺らす時間(フレーム)
|
||
* 初期値: 20 ( 0 で揺らさない )
|
||
* @default 20
|
||
*
|
||
* @param startVisible
|
||
* @type boolean
|
||
* @desc ゲーム開始時の表示状態
|
||
* 初期値: ON( true = ON 表示 / false = OFF 非表示 )
|
||
* @default true
|
||
*
|
||
* @param windowOpacity
|
||
* @type number
|
||
* @desc HPゲージウィンドウの不透明度
|
||
* 初期値: 255
|
||
* @default 255
|
||
*
|
||
* @param collideOpacity
|
||
* @type number
|
||
* @max 255
|
||
* @desc プレイヤーと重なったときの不透明度
|
||
* 初期値: 128( 0 ~ 255 )
|
||
* @default 128
|
||
*
|
||
* @param messageBusyHide
|
||
* @type boolean
|
||
* @desc メッセージウィンドウ表示中はHPゲージウィンドウを隠す
|
||
* 初期値: ON ( true = ON 隠す / false = OFF 隠さない )
|
||
* @default true
|
||
*
|
||
* @param eventBusyHide
|
||
* @type boolean
|
||
* @desc イベント起動中はHPゲージウィンドウを隠す
|
||
* 初期値: ON( true = ON 隠す / false = OFF 隠さない )
|
||
* @default true
|
||
*
|
||
* @param useBattleScene
|
||
* @type boolean
|
||
* @desc 戦闘シーンでもHPゲージウィンドウを表示する。
|
||
* 初期値: OFF( true = ON 表示 / false = OFF 非表示 )
|
||
* @default false
|
||
*
|
||
* @param gaugeWindowBattleX
|
||
* @type number
|
||
* @min -1000
|
||
* @desc 戦闘シーンのHPゲージウィンドウのX座標
|
||
* 初期値: 0
|
||
* @default 0
|
||
*
|
||
* @param gaugeWindowBattleY
|
||
* @type number
|
||
* @min -1000
|
||
* @desc 戦闘シーンのHPゲージウィンドウのY座標
|
||
* 初期値: 0
|
||
* @default 0
|
||
*
|
||
* @command showHpGauge
|
||
* @text キャラ灯り設定
|
||
* @command showHpGauge
|
||
* @text キャラ灯り設定
|
||
* @desc
|
||
* @arg character
|
||
* @text 対象キャラクター
|
||
* @desc -1:プレイヤー, 0:このイベント, 1..:イベントID
|
||
* @type number
|
||
* @min -1
|
||
* @max 999
|
||
* @default 0
|
||
* @arg radius
|
||
* @text 半径
|
||
* @desc 1 = 1マス
|
||
* @type number
|
||
* @min 0
|
||
* @max 99
|
||
* @default 1
|
||
* @arg colorIndex
|
||
* @text 色番号
|
||
* @desc プラグインパラメータ[Light Colors]で指定 / 0:消去
|
||
* @type number
|
||
* @min 0
|
||
* @max 99
|
||
* @default 1
|
||
* @arg amplitude
|
||
* @text 明滅の振れ幅
|
||
* @desc 0~100
|
||
* @type number
|
||
* @min 0
|
||
* @max 100
|
||
* @default 0
|
||
* @help
|
||
* TMPlugin - マップHPゲージ ver1.4.4
|
||
*
|
||
* 使い方:
|
||
*
|
||
* ※本プラグインは「桜御前」用にカスタマイズして使用しています。
|
||
*
|
||
* プラグインパラメータをいじってお好みのHPゲージを表示してください。
|
||
*
|
||
* このプラグインは RPGツクールMV Version 1.6.2 で動作確認をしています。
|
||
*
|
||
* このプラグインはMITライセンスのもとに配布しています、商用利用、
|
||
* 改造、再配布など、自由にお使いいただけます。
|
||
*
|
||
*
|
||
* プラグインコマンド:
|
||
*
|
||
* @command showHpGauge
|
||
* @text HPゲージウィンドウを表示します。
|
||
* @desc プラグインパラメータ startVisible が 0 の場合、
|
||
* このコマンドが実行されるまでHPゲージは表示されません。
|
||
* @arg gaugeType
|
||
* @type string
|
||
*
|
||
* @command hideHpGauge
|
||
* @text HPゲージウィンドウを隠します。
|
||
* @desc showHpGauge コマンドが実行されるまで表示されないままです。
|
||
* @arg gaugeType
|
||
* @type string
|
||
*
|
||
* @command moveHpGaugeWindow 100 200
|
||
* @text HPゲージウィンドウの位置を移動します。
|
||
* @desc X座標 = 100 / Y座標 = 200 の位置へ移動します。
|
||
* @arg x
|
||
* @type number
|
||
* @arg y
|
||
* @type number
|
||
*
|
||
* @command clearGaugeWindow
|
||
* @text リフレッシュ
|
||
* @desc HPゲージをリフレッシュします。
|
||
*
|
||
* プラグインパラメータ補足:
|
||
*
|
||
* gaugeA ~ gaugeD
|
||
*
|
||
* param
|
||
* ゲージのタイプが VN の場合に、ゲージの現在値として扱う
|
||
* ゲーム変数番号を設定してください。
|
||
*
|
||
* max
|
||
* ゲージのタイプが VN の場合に、ゲージの最大値として扱う
|
||
* ゲーム変数番号を指定してください。
|
||
* このパラメータに設定した番号のゲーム変数に値を代入することで、
|
||
* 初めて最大値として機能します。
|
||
* この設定はゲージの長さにのみ影響します、変数の値が最大値を
|
||
* 超えなくなるような機能はありません。
|
||
*
|
||
* windowOpacity / collideOpacity
|
||
* windowOpacity はウィンドウフレーム及び背景に影響し、collideOpacity
|
||
* はゲージや顔グラフィックにも影響します。
|
||
* windowOpacity の値が collideOpacity よりも低い場合、プレイヤーと
|
||
* 重なった際の不透明度として windowOpacity の値が適用されます。
|
||
* ただし、ゲージと顔グラフィックに関しては通常どおり collideOpacity の
|
||
* 値が適用されます。
|
||
*
|
||
* faceOffsetX
|
||
* この値を -1000 に設定すると顔グラフィックが非表示となります。
|
||
*
|
||
* vnMax
|
||
* 値が true なら最大値も表示しますが、現在値と最大値を表示するための
|
||
* スペースが足りない(ゲージの長さが短い)場合は vnMax の設定に関わらず
|
||
* 強制的に現在値のみの表示になります。
|
||
*/
|
||
/*~struct~Gauge:
|
||
*
|
||
* @param type
|
||
* @type select
|
||
* @option なし
|
||
* @value
|
||
* @option HP
|
||
* @option MP
|
||
* @option TP
|
||
* @option LV
|
||
* @option VN
|
||
* @desc ゲージのタイプ(HP / MP / TP / LV / VN)
|
||
* 初期値: HP
|
||
* @default HP
|
||
*
|
||
* @param x
|
||
* @type number
|
||
* @min -1000
|
||
* @desc ゲージのX座標(ウィンドウ内の左端が 0 )
|
||
* 初期値: 12
|
||
* @default 12
|
||
*
|
||
* @param y
|
||
* @type number
|
||
* @min -1000
|
||
* @desc ゲージのY座標(ウィンドウ内の上端が 0 )
|
||
* 初期値: 12
|
||
* @default 12
|
||
*
|
||
* @param width
|
||
* @type number
|
||
* @desc ゲージの長さ
|
||
* 初期値: 144
|
||
* @default 144
|
||
*
|
||
* @param height
|
||
* @type number
|
||
* @desc ゲージの表示領域(数値とゲージ合わせて)の高さ
|
||
* 初期値: 36
|
||
* @default 36
|
||
*
|
||
* @param fontSize
|
||
* @type number
|
||
* @desc フォントサイズ
|
||
* 初期値: 28
|
||
* @default 28
|
||
*
|
||
* @param param
|
||
* @type variable
|
||
* @desc ゲージのタイプが VN のときに現在値とするゲーム変数番号
|
||
* 初期値: 0
|
||
* @default 0
|
||
*
|
||
* @param max
|
||
* @type variable
|
||
* @desc ゲージのタイプが VN のときに最大値とするゲーム変数番号
|
||
* 初期値: 0
|
||
* @default 0
|
||
*
|
||
* @param name
|
||
* @type string
|
||
* @desc ゲージのタイプが VN のときに表示するパラメータ名
|
||
* 初期値: AP
|
||
* @default AP
|
||
*
|
||
* @param color
|
||
* @type string
|
||
* @desc ゲージのタイプが LV / VN のときのゲージカラー
|
||
* 初期値: #ff60c0 #ffa0e0
|
||
* @default #ff60c0 #ffa0e0
|
||
*
|
||
*/
|
||
|
||
var Imported = Imported || {};
|
||
Imported.TMMapHpGauge_Custom = true;
|
||
|
||
(function () {
|
||
const pluginName = "TMMapHpGauge_Custom";
|
||
var parameters = PluginManager.parameters("TMMapHpGauge_Custom");
|
||
var gaugeWindowX = +(parameters["gaugeWindowX"] || 0);
|
||
var gaugeWindowY = +(parameters["gaugeWindowY"] || 0);
|
||
var gaugeWindowWidth = +(parameters["gaugeWindowWidth"] || 288);
|
||
var gaugeWindowHeight = +(parameters["gaugeWindowHeight"] || 64);
|
||
var gauges = [];
|
||
["A", "B", "C", "D"].forEach(function (code, i) {
|
||
gauges[i] = JSON.parse(parameters["gauge" + code]);
|
||
gauges[i].x = +gauges[i].x;
|
||
gauges[i].y = +gauges[i].y;
|
||
gauges[i].width = +gauges[i].width;
|
||
gauges[i].height = +gauges[i].height;
|
||
gauges[i].fontSize = +gauges[i].fontSize;
|
||
gauges[i].param = +gauges[i].param;
|
||
gauges[i].max = +gauges[i].max;
|
||
gauges[i].color = gauges[i].color.split(" ");
|
||
});
|
||
var faceOffsetX = +(parameters["faceOffsetX"] || -4);
|
||
var faceOffsetY = +(parameters["faceOffsetY"] || -4);
|
||
var stateIconMax = +(parameters["stateIconMax"] || 4);
|
||
var stateIconX = +(parameters["stateIconX"] || 156);
|
||
var stateIconY = +(parameters["stateIconY"] || 24);
|
||
var stateIconScale = +(parameters["stateIconScale"] || 100);
|
||
var stateIconOpacity = +(parameters["stateIconOpacity"] || 255);
|
||
var goldWidth = +(parameters["goldWidth"] || 0);
|
||
var goldX = +(parameters["goldX"] || 0);
|
||
var goldY = +(parameters["goldY"] || 0);
|
||
var mapWidth = +(parameters["mapWidth"] || 0);
|
||
var mapX = +(parameters["mapX"] || 0);
|
||
var mapY = +(parameters["mapY"] || 0);
|
||
var vnMax = JSON.parse(parameters["vnMax"] || "false");
|
||
var shakeTime = +(parameters["shakeTime"] || 20);
|
||
var collideOpacity = +(parameters["collideOpacity"] || 128);
|
||
var startVisible = JSON.parse(parameters["startVisible"] || "true");
|
||
var windowOpacity = +(parameters["windowOpacity"] || 255);
|
||
var messageBusyHide = JSON.parse(parameters["messageBusyHide"] || "true");
|
||
var eventBusyHide = JSON.parse(parameters["eventBusyHide"] || "true");
|
||
var useBattleScene = JSON.parse(parameters["useBattleScene"] || "false");
|
||
var gaugeWindowBattleX = +(parameters["gaugeWindowBattleX"] || 0);
|
||
var gaugeWindowBattleY = +(parameters["gaugeWindowBattleY"] || 0);
|
||
|
||
var _iconWidth = ImageManager.iconWidth;
|
||
var _iconHeight = ImageManager.iconHeight;
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Game_System
|
||
//
|
||
|
||
Game_System.prototype.isVisibleMapHpGauge = function () {
|
||
if (this._visibleMapHpGauge == null) this._visibleMapHpGauge = startVisible;
|
||
return this._visibleMapHpGauge;
|
||
};
|
||
|
||
Game_System.prototype.setVisibleMapHpGauge = function (flag) {
|
||
this._visibleMapHpGauge = flag;
|
||
};
|
||
|
||
Game_System.prototype.isVisibleMapHpGauges = function (gaugeId) {
|
||
if (this._visibleMapHpGauges == null) {
|
||
this._visibleMapHpGauges = [];
|
||
for (var i = 0; i < gauges.length; i++) {
|
||
this._visibleMapHpGauges[i] = gauges[i].type !== "";
|
||
}
|
||
}
|
||
return this._visibleMapHpGauges[gaugeId];
|
||
};
|
||
|
||
Game_System.prototype.setVisibleMapHpGauges = function (gaugeId, flag) {
|
||
this._visibleMapHpGauges[gaugeId] = flag;
|
||
};
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Game_Interpreter
|
||
//
|
||
PluginManager.registerCommand(pluginName, "showHpGauge", (args) => {
|
||
if (args[0]) {
|
||
var gaugeId = ["A", "B", "C", "D"].indexOf(args.gaugeType);
|
||
$gameSystem.setVisibleMapHpGauges(gaugeId, true);
|
||
} else {
|
||
$gameSystem.setVisibleMapHpGauge(true);
|
||
}
|
||
});
|
||
PluginManager.registerCommand(pluginName, "hideHpGauge", (args) => {
|
||
if (args[0]) {
|
||
var gaugeId = ["A", "B", "C", "D"].indexOf(args.gaugeType);
|
||
$gameSystem.setVisibleMapHpGauges(gaugeId, false);
|
||
} else {
|
||
$gameSystem.setVisibleMapHpGauge(false);
|
||
}
|
||
});
|
||
PluginManager.registerCommand(pluginName, "moveHpGaugeWindow", (args) => {
|
||
$gameSystem._mapHpGaugeWindowX = +args.x;
|
||
$gameSystem._mapHpGaugeWindowY = +args.y;
|
||
if (SceneManager._scene._mapHpGaugeWindow) {
|
||
SceneManager._scene._mapHpGaugeWindow.x = +args.x;
|
||
SceneManager._scene._mapHpGaugeWindow.y = +args.y;
|
||
SceneManager._scene._mapHpGaugeWindow._baseX = +args.x;
|
||
}
|
||
});
|
||
/**
|
||
* PluginCommand Add
|
||
*/
|
||
PluginManager.registerCommand(pluginName, "clearGaugeWindow", (args) => {
|
||
var scn = SceneManager._scene;
|
||
if (scn._mapHpGaugeWindow) {
|
||
scn._mapHpGaugeWindow.refresh();
|
||
}
|
||
//Window_MapHpGauge.prototype.update();
|
||
//Window_MapHpGauge.prototype.close();
|
||
//Window_MapHpGauge.prototype.open();
|
||
//Window_MapHpGauge.prototype.clear;
|
||
});
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Sprite_Gauge_MapHpGauge
|
||
//
|
||
function Sprite_Gauge_MapHpGauge() {
|
||
this.initialize.apply(this, arguments);
|
||
}
|
||
Sprite_Gauge_MapHpGauge.prototype = Object.create(Sprite_Gauge.prototype);
|
||
Sprite_Gauge_MapHpGauge.prototype.constructor = Sprite_Gauge_MapHpGauge;
|
||
Sprite_Gauge.prototype.initialize = function (width, height) {
|
||
//not Sprite_Gauge initialized
|
||
Sprite.prototype.initialize.call(this);
|
||
this.initMembers();
|
||
this._bitmapWidth = width;
|
||
this._bitmapHeight = height;
|
||
this.createBitmap();
|
||
};
|
||
|
||
Sprite_Gauge_MapHpGauge.prototype.bitmapWidth = function () {
|
||
return this._bitmapWidth;
|
||
};
|
||
|
||
Sprite_Gauge_MapHpGauge.prototype.bitmapHeight = function () {
|
||
return this._bitmapHeight;
|
||
};
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Window_MapHpGauge
|
||
//
|
||
|
||
function Window_MapHpGauge() {
|
||
this.initialize.apply(this, arguments);
|
||
}
|
||
|
||
Window_MapHpGauge.prototype = Object.create(Window_StatusBase.prototype);
|
||
Window_MapHpGauge.prototype.constructor = Window_MapHpGauge;
|
||
|
||
Window_MapHpGauge.prototype.initialize = function () {
|
||
if (SceneManager.isNextScene(Scene_Battle)) {
|
||
var x = gaugeWindowBattleX;
|
||
var y = gaugeWindowBattleY;
|
||
} else {
|
||
var x =
|
||
$gameSystem._mapHpGaugeWindowX != null
|
||
? $gameSystem._mapHpGaugeWindowX
|
||
: gaugeWindowX;
|
||
var y =
|
||
$gameSystem._mapHpGaugeWindowY != null
|
||
? $gameSystem._mapHpGaugeWindowY
|
||
: gaugeWindowY;
|
||
}
|
||
var wight = gaugeWindowWidth;
|
||
var height = gaugeWindowHeight;
|
||
Window_StatusBase.prototype.initialize.call(
|
||
this,
|
||
new Rectangle(x, y, wight, height)
|
||
);
|
||
this.contentsBack = ImageManager.loadSystem("UI_MapHPGauge");
|
||
this.openness = $gameSystem.isVisibleMapHpGauge() ? 255 : 0;
|
||
this.opacity = windowOpacity;
|
||
this._gaugeParams = [];
|
||
this._gaugeVisible = [];
|
||
for (var i = 0; i < gauges.length; i++) {
|
||
this._gaugeParams.push({ param: -1, max: -1 });
|
||
this._gaugeVisible[i] = $gameSystem.isVisibleMapHpGauges(i);
|
||
}
|
||
this._icons = [];
|
||
this._gold = 0;
|
||
this._mapName = "";
|
||
this._actorId = -1;
|
||
this._faceName = "";
|
||
this._faceIndex = "";
|
||
this._shakeDuration = 0;
|
||
this._baseX = x;
|
||
this._needFaceRefresh = false;
|
||
this._hideCount = 0;
|
||
//this._haveitems = [];
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.lineHeight = function () {
|
||
return this._lineHeight || 36;
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.standardPadding = function () {
|
||
return 0;
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.setShake = function (power) {
|
||
this._shakeDuration = power;
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.update = function () {
|
||
Window_StatusBase.prototype.update.call(this);
|
||
if (this.updateVisibility()) {
|
||
this.open();
|
||
if (this.isNeedRefresh()) {
|
||
var actor = $gameParty.leader();
|
||
for (var i = 0; i < gauges.length; i++) {
|
||
this._gaugeVisible[i] = $gameSystem.isVisibleMapHpGauges(i);
|
||
var gauge = gauges[i];
|
||
if (gauge.type === "HP") {
|
||
this._gaugeParams[i].param = actor.hp;
|
||
this._gaugeParams[i].max = actor.mhp;
|
||
} else if (gauge.type === "MP") {
|
||
this._gaugeParams[i].param = actor.mp;
|
||
this._gaugeParams[i].max = actor.mmp;
|
||
} else if (gauge.type === "TP") {
|
||
this._gaugeParams[i].param = actor.tp;
|
||
this._gaugeParams[i].max = actor.maxTp();
|
||
} else if (gauge.type === "LV") {
|
||
this._gaugeParams[i].param = actor.currentExp();
|
||
this._gaugeParams[i].max = actor.nextLevelExp();
|
||
this._gaugeParams[i].subParam = actor.level;
|
||
} else if (gauge.type === "VN") {
|
||
this._gaugeParams[i].param = $gameVariables.value(gauge.param);
|
||
this._gaugeParams[i].max = $gameVariables.value(gauge.max);
|
||
}
|
||
}
|
||
this._icons = actor.stateIcons().concat(actor.buffIcons());
|
||
this._gold = $gameParty.gold();
|
||
this._mapName = $gameMap.displayName();
|
||
this._actorId = actor.actorId();
|
||
this._faceName = actor.faceName();
|
||
this._faceIndex = actor.faceIndex();
|
||
this.refresh();
|
||
}
|
||
this.updateShake();
|
||
this.updateOpacity();
|
||
} else {
|
||
this.close();
|
||
}
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.updateVisibility = function () {
|
||
if (!$gameSystem.isVisibleMapHpGauge()) {
|
||
return false;
|
||
}
|
||
if ($gameTemp.isBacklogActive) {
|
||
return false;
|
||
}
|
||
if ($gameParty.inBattle()) {
|
||
return true;
|
||
}
|
||
if (
|
||
(eventBusyHide && $gameMap.isEventRunning()) ||
|
||
(messageBusyHide && $gameMessage.isBusy())
|
||
) {
|
||
this._hideCount++;
|
||
} else {
|
||
this._hideCount = 0;
|
||
}
|
||
return this._hideCount < 10 && $gameParty.leader();
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.isNeedRefresh = function () {
|
||
var actor = $gameParty.leader();
|
||
if (actor) {
|
||
var result = false;
|
||
if (this._actorId !== actor.actorId()) {
|
||
this.setShake(1);
|
||
return true;
|
||
}
|
||
for (var i = 0; i < gauges.length; i++) {
|
||
if (this._gaugeVisible[i] !== $gameSystem.isVisibleMapHpGauges(i)) {
|
||
result = true;
|
||
}
|
||
var gauge = gauges[i];
|
||
var gaugeParam = this._gaugeParams[i];
|
||
if (gauge.type === "HP") {
|
||
if (gaugeParam.param !== actor.hp || gaugeParam.max !== actor.mhp) {
|
||
if (gaugeParam.param > actor.hp) {
|
||
this.setShake(shakeTime);
|
||
}
|
||
result = true;
|
||
}
|
||
} else if (gauge.type === "MP") {
|
||
if (gaugeParam.param !== actor.mp || gaugeParam.max !== actor.mmp) {
|
||
result = true;
|
||
}
|
||
} else if (gauge.type === "TP") {
|
||
if (
|
||
gaugeParam.param !== actor.tp ||
|
||
gaugeParam.max !== actor.maxTp()
|
||
) {
|
||
result = true;
|
||
}
|
||
} else if (gauge.type === "LV") {
|
||
if (
|
||
gaugeParam.param !== actor.currentExp() ||
|
||
gaugeParam.max !== actor.nextLevelExp() ||
|
||
gaugeParam.subParam !== actor.level
|
||
) {
|
||
result = true;
|
||
}
|
||
} else if (gauge.type === "VN") {
|
||
if (
|
||
gaugeParam.param !== $gameVariables.value(gauge.param) ||
|
||
gaugeParam.max !== $gameVariables.value(gauge.max)
|
||
) {
|
||
result = true;
|
||
}
|
||
}
|
||
}
|
||
if (stateIconMax > 0) {
|
||
var icons = actor.stateIcons().concat(actor.buffIcons());
|
||
if (this._icons.toString() !== icons.toString()) {
|
||
result = true;
|
||
}
|
||
}
|
||
if (goldWidth > 0 && this._gold !== $gameParty.gold()) {
|
||
result = true;
|
||
}
|
||
if (mapWidth > 0 && this._mapName !== $gameMap.displayName()) {
|
||
result = true;
|
||
}
|
||
}
|
||
if (this._needFaceRefresh) {
|
||
this.refreshFace();
|
||
if (!this._needFaceRefresh) {
|
||
result = true;
|
||
}
|
||
}
|
||
return result;
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.updateShake = function () {
|
||
if (this._shakeDuration > 0) {
|
||
this._shakeDuration--;
|
||
this.x = this._baseX;
|
||
if (this._shakeDuration > 0) {
|
||
this.x += Math.floor(
|
||
Math.sin(((this._shakeDuration % 10) * Math.PI) / 5) * 8
|
||
);
|
||
}
|
||
}
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.updateOpacity = function () {
|
||
if (
|
||
this.x < $gamePlayer.screenX() - 24 &&
|
||
this.x + gaugeWindowWidth > $gamePlayer.screenX() - 24 &&
|
||
this.y < $gamePlayer.screenY() - 24 &&
|
||
this.y + gaugeWindowHeight > $gamePlayer.screenY() - 24
|
||
) {
|
||
this.opacity = Math.min(collideOpacity, windowOpacity);
|
||
this.contentsOpacity = collideOpacity;
|
||
} else {
|
||
this.opacity = windowOpacity;
|
||
this.contentsOpacity = 255;
|
||
}
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.refresh = function () {
|
||
this.contents.clear();
|
||
var actor = $gameParty.leader();
|
||
if (actor) {
|
||
this.refreshFace();
|
||
for (var i = 0; i < gauges.length; i++) {
|
||
if (!$gameSystem.isVisibleMapHpGauges(i)) {
|
||
continue;
|
||
}
|
||
var gauge = gauges[i];
|
||
this._lineHeight = gauge.height;
|
||
this.contents.fontSize = gauge.fontSize;
|
||
if (gauge.type === "HP") {
|
||
this.placeGauge(
|
||
actor,
|
||
"hp",
|
||
gauge.x,
|
||
gauge.y,
|
||
gauge.width,
|
||
gauge.height
|
||
);
|
||
//this.drawActorHp(actor, gauge.x, gauge.y, gauge.width);
|
||
} else if (gauge.type === "MP") {
|
||
this.placeGauge(
|
||
actor,
|
||
"mp",
|
||
gauge.x,
|
||
gauge.y,
|
||
gauge.width,
|
||
gauge.height
|
||
);
|
||
//this.drawActorMp(actor, gauge.x, gauge.y, gauge.width);
|
||
} else if (gauge.type === "TP") {
|
||
this.placeGauge(
|
||
actor,
|
||
"tp",
|
||
gauge.x,
|
||
gauge.y,
|
||
gauge.width,
|
||
gauge.height
|
||
);
|
||
//this.drawActorTp(actor, gauge.x, gauge.y, gauge.width);
|
||
} else if (gauge.type === "LV") {
|
||
//241013
|
||
if (actor.isMaxLevel()) {
|
||
this.drawTextEx(
|
||
$dataSystemTexts.MapLv + $gameParty.highestLevel(),
|
||
gauge.x,
|
||
gauge.y,
|
||
40
|
||
);
|
||
this.drawTextEx(
|
||
$dataSystemTexts.MapExp + "---",
|
||
gauge.x + 90,
|
||
gauge.y,
|
||
100
|
||
);
|
||
} else {
|
||
this.drawTextEx(
|
||
$dataSystemTexts.MapLv + $gameParty.highestLevel(),
|
||
gauge.x,
|
||
gauge.y,
|
||
40
|
||
);
|
||
this.drawTextEx(
|
||
$dataSystemTexts.MapExp +
|
||
$gameParty.members()[0].nextRequiredExp(),
|
||
gauge.x + 90,
|
||
gauge.y,
|
||
100
|
||
);
|
||
}
|
||
|
||
//var icon = this.drawIcon(238, gauge.x, gauge.y);;
|
||
//this.placeGauge(actor, "lv", gauge.x, gauge.y+48, gauge.width, gauge.height);
|
||
//this.drawLvGauge(actor, gauge);
|
||
} else if (gauge.type === "VN") {
|
||
if ($gameParty._actors.includes(1)) {
|
||
//桜
|
||
let sic = $gameVariables.value(39);
|
||
this.drawTextEx(
|
||
$dataSystemTexts.mind_less_o + sic,
|
||
gauge.x + 190,
|
||
gauge.y + 28,
|
||
40
|
||
);
|
||
//this.drawTextEx("\\I[219]\\}\\}心病 \\{\\{" + sic, gauge.x + 190, gauge.y + 28,40);
|
||
this.drawMapHstate(gauge.x, gauge.y, this.width, this._lineHeight);
|
||
} else if ($gameParty._actors.includes(2)) {
|
||
//鈴音
|
||
this.drawTextEx(
|
||
$dataSystemTexts.mind_less_s,
|
||
gauge.x + 190,
|
||
gauge.y + 28,
|
||
40
|
||
);
|
||
this.drawTextEx($dataSystemTexts.h_state_s, gauge.x, gauge.y, 200);
|
||
} else if ($gameParty._actors.includes(6)) {
|
||
//愚譜
|
||
this.drawTextEx(
|
||
$dataSystemTexts.mind_less_g,
|
||
gauge.x + 190,
|
||
gauge.y + 28,
|
||
40
|
||
);
|
||
this.drawTextEx($dataSystemTexts.h_state_g, gauge.x, gauge.y, 200);
|
||
} else if ($gameParty._actors.includes(25)) {
|
||
//あなた
|
||
this.drawTextEx(
|
||
$dataSystemTexts.mind_less_g,
|
||
gauge.x + 190,
|
||
gauge.y + 28,
|
||
40
|
||
);
|
||
this.drawTextEx($dataSystemTexts.h_state_s, gauge.x, gauge.y, 200);
|
||
}
|
||
//this.placeGauge(actor, "vn", gauge.x, gauge.y, gauge.width, gauge.height);
|
||
//this.drawVnGauge(this._gaugeParams[i], gauge);
|
||
}
|
||
}
|
||
|
||
let iconColumns = 4;
|
||
for (var i = 0; i < stateIconMax; i++) {
|
||
if (!this._icons[i]) break;
|
||
let x =
|
||
stateIconX +
|
||
(i % iconColumns) * Math.floor((_iconWidth * stateIconScale) / 100);
|
||
let y =
|
||
stateIconY +
|
||
Math.floor(i / iconColumns) *
|
||
Math.floor((_iconHeight * stateIconScale) / 100);
|
||
this.drawIcon(this._icons[i], x, y);
|
||
}
|
||
if (goldWidth > 0) {
|
||
this.drawCurrencyValue(
|
||
this._gold,
|
||
TextManager.currencyUnit,
|
||
gauge.x + 31,
|
||
goldY,
|
||
goldWidth
|
||
);
|
||
//this.drawCurrencyValue(this._gold, TextManager.currencyUnit, goldX, goldY, goldWidth);
|
||
}
|
||
if (mapWidth > 0) {
|
||
this.drawShortcut(mapX - 60, mapY - 55);
|
||
this.drawTextEx(
|
||
$dataSystemTexts.map_now,
|
||
mapX - 60,
|
||
mapY - 30,
|
||
mapWidth
|
||
);
|
||
this.drawText(this._mapName, mapX, mapY - 30, mapWidth);
|
||
this.drawPurpose(73, mapX - 60, mapY);
|
||
}
|
||
|
||
//this._haveitems = $gameParty.numItems($dataItems[197]);
|
||
this.drawMapItem(0, this.height - 55, this.width, this._lineHeight);
|
||
this.drawSPsystem(0, this.height - 85, this.width, this._lineHeight);
|
||
//this.drawAmulet(0,this.height - 85,this.width,this._lineHeight);
|
||
this._lineHeight = 36;
|
||
}
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.drawPurpose = function (sw, x, y) {
|
||
//const showPurpose = $gameSwitches.value(sw);
|
||
//if(!showPurpose) { return; }
|
||
|
||
let varId = 15; //目標テキスト取得に用いる変数番号
|
||
if (!$dataPurpose) {
|
||
return;
|
||
}
|
||
|
||
const varVal = $gameVariables.value(varId);
|
||
let purposeText = "---";
|
||
let len = $dataPurpose.length;
|
||
for (let i = 0; i < len; i++) {
|
||
let data = $dataPurpose[i];
|
||
if (!data) {
|
||
continue;
|
||
}
|
||
if (data.val <= varVal) {
|
||
purposeText = data.purposeText;
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
let word = purposeText.length;
|
||
let wordmax = 25;
|
||
let wx = 0;
|
||
if (word >= wordmax) {
|
||
wx = word - wordmax;
|
||
}
|
||
|
||
var actor = $gameParty.leader();
|
||
if (actor._actorId <= 7) {
|
||
this.drawTextEx("\\}" + purposeText + "\\{", x - wx * 16, y, 10);
|
||
} else {
|
||
this.drawTextEx(
|
||
"\\}" + $dataSystemTexts.map_spactor + "\\{",
|
||
x - wx * 16,
|
||
y,
|
||
10
|
||
);
|
||
}
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.drawShortcut = function (x, y) {
|
||
let wx = 100;
|
||
if (!$gameSwitches.value(13)) {
|
||
this.drawTextEx($dataSystemTexts.short_equip, x, y);
|
||
} else this.drawTextEx("\\c[7]" + $dataSystemTexts.short_equip, x, y);
|
||
|
||
if (!$gameSwitches.value(9)) {
|
||
this.drawTextEx("\\c[7]" + $dataSystemTexts.short_quest, x + wx, y);
|
||
} else this.drawTextEx($dataSystemTexts.short_quest, x + wx, y);
|
||
|
||
if ($gameSwitches.value(12)) {
|
||
this.drawTextEx("\\c[7]" + $dataSystemTexts.short_fast, x + wx * 2, y);
|
||
} else this.drawTextEx($dataSystemTexts.short_fast, x + wx * 2, y);
|
||
|
||
this.drawTextEx($dataSystemTexts.short_backlog, x + wx * 3, y);
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.drawMapItem = function (x, y, width, height) {
|
||
// マップのメタ情報から<dungenitem>が設定されているかを確認
|
||
var meta = $dataMap.meta;
|
||
let numbers = [];
|
||
let sx = x;
|
||
let space = 30;
|
||
|
||
//ギャラリー
|
||
if (meta.dungenitem == "gallary") {
|
||
this.drawIcon(`${$dataItems[197].iconIndex}`, sx, y, width, height);
|
||
this.drawText(
|
||
$gameParty.numItems($dataItems[197]),
|
||
sx + space,
|
||
y - 5,
|
||
width,
|
||
height
|
||
);
|
||
return;
|
||
}
|
||
|
||
//共通表示
|
||
this.drawIcon(`${$dataItems[401].iconIndex}`, sx, y, width, height);
|
||
this.drawText(
|
||
$gameParty.numItems($dataItems[401]),
|
||
sx + space,
|
||
y - 5,
|
||
width,
|
||
height
|
||
);
|
||
sx += 80;
|
||
|
||
this.drawIcon(`${$dataItems[402].iconIndex}`, sx, y, width, height);
|
||
this.drawText(
|
||
$gameParty.numItems($dataItems[402]),
|
||
sx + space,
|
||
y - 5,
|
||
width,
|
||
height
|
||
);
|
||
sx += 80;
|
||
|
||
this.drawIcon(`${$dataItems[405].iconIndex}`, sx, y, width, height);
|
||
this.drawText(
|
||
$gameParty.numItems($dataItems[405]),
|
||
sx + space,
|
||
y - 5,
|
||
width,
|
||
height
|
||
);
|
||
sx += 100;
|
||
|
||
if (!meta.dungenitem) {
|
||
return;
|
||
}
|
||
|
||
if (meta.dungenitem == "kemono") {
|
||
for (let i = 0; i < 5; i++) {
|
||
numbers.push($gameParty.numItems($dataItems[410 + i]));
|
||
}
|
||
for (let i = 0; i < numbers.length; i++) {
|
||
this.drawIcon(
|
||
`${$dataItems[410 + i].iconIndex}`,
|
||
sx + i * 80,
|
||
y,
|
||
width,
|
||
height
|
||
);
|
||
this.drawText(numbers[i], sx + space + i * 80, y - 5, width, height);
|
||
}
|
||
}
|
||
|
||
if (meta.dungenitem == "saino") {
|
||
for (let i = 0; i < 5; i++) {
|
||
numbers.push($gameParty.numItems($dataItems[418 + i]));
|
||
}
|
||
for (let i = 0; i < numbers.length; i++) {
|
||
this.drawIcon(
|
||
`${$dataItems[418 + i].iconIndex}`,
|
||
sx + i * 80,
|
||
y,
|
||
width,
|
||
height
|
||
);
|
||
this.drawText(numbers[i], sx + space + i * 80, y - 5, width, height);
|
||
}
|
||
}
|
||
if (meta.dungenitem == "osore") {
|
||
for (let i = 0; i < 5; i++) {
|
||
numbers.push($gameParty.numItems($dataItems[426 + i]));
|
||
}
|
||
for (let i = 0; i < numbers.length; i++) {
|
||
this.drawIcon(
|
||
`${$dataItems[426 + i].iconIndex}`,
|
||
sx + i * 80,
|
||
y,
|
||
width,
|
||
height
|
||
);
|
||
this.drawText(numbers[i], sx + space + i * 80, y - 5, width, height);
|
||
}
|
||
}
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.drawMapHstate = function (x, y, width, height) {
|
||
var tHlv = $gameVariables.value(25);
|
||
var defsize = this.contents.fontSize;
|
||
|
||
this.contents.fontSize = 20;
|
||
//total lv
|
||
this.drawIcon(238, x, y, width, height);
|
||
this.drawText(`${tHlv}`, x + 32, y - 5, width, height);
|
||
|
||
//detial lv
|
||
var Hlv = [];
|
||
var Hexp = [];
|
||
for (let i = 0; i < 4; i++) {
|
||
Hlv.push($gameVariables.value(56 + i));
|
||
Hexp.push($gameVariables.value(21 + i));
|
||
this.drawIcon(220 + i, x + 60 + i * 60, y, width, height);
|
||
this.drawText(`${Hlv[i]}`, x + 90 + i * 60, y - 5, width, height);
|
||
this.contents.fontSize = 16;
|
||
this.drawText(
|
||
`${Hexp[i]}`,
|
||
x + 60 + i * 60,
|
||
y + 5,
|
||
width,
|
||
height,
|
||
"center"
|
||
);
|
||
this.contents.fontSize = defsize;
|
||
}
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.drawSPsystem = function (x, y, width, height) {
|
||
const leader = $gameParty.leader();
|
||
if (!leader) return; //leader不在
|
||
|
||
//瞬殺・呼び寄せ・自動採集・追加アイテム
|
||
var DungenDeath = [
|
||
{ ic: 64, sw: $gameSwitches.value(221), txt: $dataSystemTexts.map_ke }, //kemono
|
||
{ ic: 64, sw: $gameSwitches.value(222), txt: $dataSystemTexts.map_sa }, //saino
|
||
{ ic: 64, sw: $gameSwitches.value(223), txt: $dataSystemTexts.map_os }, //osore
|
||
{ ic: 64, sw: $gameSwitches.value(224), txt: $dataSystemTexts.map_all }, //all
|
||
{ ic: 80, sw: $gameSwitches.value(226), txt: $dataSystemTexts.map_call }, //call1
|
||
{
|
||
ic: 80,
|
||
sw: $gameSwitches.value(227),
|
||
txt: $dataSystemTexts.map_call_s,
|
||
}, //call2
|
||
{
|
||
ic: 69,
|
||
sw: $gameSwitches.value(229),
|
||
txt: $dataSystemTexts.map_autocollect,
|
||
}, //auto
|
||
|
||
{ ic: 237, sw: $gameSwitches.value(25), txt: $dataSystemTexts.map_yabu }, //yabu
|
||
{ ic: 238, sw: $gameSwitches.value(49), txt: $dataSystemTexts.map_upg }, //upg
|
||
{
|
||
ic: 287,
|
||
sw: $gameSwitches.value(231),
|
||
txt: $dataSystemTexts.map_yamada,
|
||
}, //yamada
|
||
];
|
||
|
||
let ii = 0;
|
||
let iisp = 0;
|
||
DungenDeath.forEach((elm, index, _) => {
|
||
var wx = 110;
|
||
var sx = ii * wx;
|
||
|
||
if (elm.sw) {
|
||
if (index < 7) {
|
||
this.drawIcon(elm.ic, sx + x, y, width, height);
|
||
this.drawTextEx(
|
||
"\\}" + elm.txt + "\\{",
|
||
sx + x + 32,
|
||
y - 5,
|
||
width,
|
||
height
|
||
);
|
||
ii++;
|
||
} else {
|
||
sx = iisp * wx * 1.1;
|
||
this.drawIcon(elm.ic, sx + x, y - 35, width, height);
|
||
this.drawTextEx(
|
||
"\\}" + elm.txt + "\\{",
|
||
sx + x + 32,
|
||
y - 40,
|
||
width,
|
||
height
|
||
);
|
||
iisp++;
|
||
}
|
||
}
|
||
}, this);
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.drawAmulet = function (x, y, width, height) {
|
||
const leader = $gameParty.leader();
|
||
if (!leader) return; //leader不在
|
||
|
||
const equips = leader.equips();
|
||
if (equips?.length < 7) return; //アクセサリなし
|
||
|
||
var amulet1 = equips[6]?.id ?? 0;
|
||
var amulet2 = equips[7]?.id ?? 0;
|
||
|
||
const arr = [amulet1, amulet2];
|
||
let ii = 0;
|
||
const textArr = [
|
||
$dataSystemTexts.map_ke,
|
||
$dataSystemTexts.map_sa,
|
||
$dataSystemTexts.map_os,
|
||
$dataSystemTexts.map_all,
|
||
$dataSystemTexts.map_call,
|
||
$dataSystemTexts.map_call_s,
|
||
];
|
||
[51, 52, 53, 54, 55, 56].forEach((elm, index) => {
|
||
var wx = 120;
|
||
var sx = ii * wx;
|
||
if (arr.indexOf(elm) >= 0) {
|
||
this.drawIcon(
|
||
`${$dataArmors[elm].iconIndex}`,
|
||
sx + x,
|
||
y,
|
||
width,
|
||
height
|
||
);
|
||
this.drawTextEx(
|
||
"\\}" + textArr[index] + "\\{",
|
||
sx + x + 32,
|
||
y - 5,
|
||
width,
|
||
height
|
||
);
|
||
ii++;
|
||
}
|
||
}, this);
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.placeGauge = function (
|
||
actor,
|
||
type,
|
||
x,
|
||
y,
|
||
width,
|
||
height
|
||
) {
|
||
const key = "actor%1-gauge-%2".format(actor.actorId(), type);
|
||
const sprite = this.createInnerSprite(
|
||
key,
|
||
Sprite_Gauge_MapHpGauge,
|
||
width,
|
||
height
|
||
);
|
||
sprite.setup(actor, type);
|
||
sprite.move(x, y);
|
||
sprite.show();
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.createInnerSprite = function (
|
||
key,
|
||
spriteClass,
|
||
width,
|
||
height
|
||
) {
|
||
const dict = this._additionalSprites;
|
||
if (dict[key]) {
|
||
return dict[key];
|
||
} else {
|
||
const sprite = new spriteClass(width, height);
|
||
dict[key] = sprite;
|
||
this.addInnerChild(sprite);
|
||
return sprite;
|
||
}
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.drawIcon = function (iconIndex, x, y) {
|
||
var bitmap = ImageManager.loadSystem("IconSet");
|
||
var pw = _iconWidth;
|
||
var ph = _iconHeight;
|
||
var sx = (iconIndex % 16) * pw;
|
||
var sy = Math.floor(iconIndex / 16) * ph;
|
||
var dw = Math.floor((pw * stateIconScale) / 100);
|
||
var dh = Math.floor((ph * stateIconScale) / 100);
|
||
var lastPaintOpacity = this.contents.paintOpacity;
|
||
this.contents.paintOpacity = stateIconOpacity;
|
||
this.contents.blt(bitmap, sx, sy, pw, ph, x, y, dw, dh);
|
||
this.contents.paintOpacity = lastPaintOpacity;
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.drawLvGauge = function (actor, gauge) {
|
||
if (actor.isMaxLevel()) {
|
||
var value1 = "-------";
|
||
var value2 = "-------";
|
||
var rate = 1;
|
||
} else {
|
||
var n = actor.currentLevelExp();
|
||
var value1 = actor.currentExp() - n;
|
||
var value2 = actor.nextLevelExp() - n;
|
||
var rate = value1 / value2;
|
||
}
|
||
/*
|
||
this.drawGauge(gauge.x, gauge.y, gauge.width, rate, gauge.color[0], gauge.color[1]);
|
||
this.changeTextColor(this.systemColor());
|
||
this.drawText(TextManager.levelA, gauge.x, gauge.y, 44);
|
||
var color = this.normalColor();
|
||
this.changeTextColor(color);
|
||
var width = this.textWidth(TextManager.levelA) + 4;
|
||
this.drawText(actor.level, gauge.x + width, gauge.y, 44)
|
||
width = gauge.width - width - this.textWidth('' + actor.level);
|
||
this.drawCurrentAndMax(value1, value2, gauge.x + gauge.width - width, gauge.y, width, color, color);
|
||
*/
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.drawVnGauge = function (params, gauge) {
|
||
/*
|
||
var rate = params.max === 0 ? 0 : params.param / params.max;
|
||
this.drawGauge(gauge.x, gauge.y, gauge.width, rate, gauge.color[0], gauge.color[1]);
|
||
this.changeTextColor(this.systemColor());
|
||
this.drawText(gauge.name, gauge.x, gauge.y, this.textWidth(gauge.name));
|
||
this.changeTextColor(this.normalColor());
|
||
if (vnMax) {
|
||
this.drawVnCurrentAndMax(gauge.name, params.param, params.max, gauge.x, gauge.y, gauge.width);
|
||
} else {
|
||
this.drawText(params.param, gauge.x + gauge.width - 64, gauge.y, 64, 'right');
|
||
}
|
||
*/
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.drawVnCurrentAndMax = function (
|
||
name,
|
||
current,
|
||
max,
|
||
x,
|
||
y,
|
||
width
|
||
) {
|
||
var labelWidth = this.textWidth(name);
|
||
var valueWidth = this.textWidth("0" + max);
|
||
var slashWidth = this.textWidth("/");
|
||
var x1 = x + width - valueWidth;
|
||
var x2 = x1 - slashWidth;
|
||
var x3 = x2 - valueWidth;
|
||
this.changeTextColor(this.normalColor());
|
||
if (x3 >= x + labelWidth) {
|
||
this.drawText(current, x3, y, valueWidth, "right");
|
||
this.drawText("/", x2, y, slashWidth, "right");
|
||
this.drawText(max, x1, y, valueWidth, "right");
|
||
} else {
|
||
this.drawText(current, x1, y, valueWidth, "right");
|
||
}
|
||
};
|
||
|
||
Window_Base.prototype.drawScaledFace = function (
|
||
faceName,
|
||
faceIndex,
|
||
x,
|
||
y,
|
||
width,
|
||
height,
|
||
scaleX,
|
||
scaleY
|
||
) {
|
||
scaleX = scaleX || 1;
|
||
scaleY = scaleY || 1;
|
||
|
||
const bitmap = ImageManager.loadFace(faceName);
|
||
const pw = ImageManager.faceWidth;
|
||
const ph = ImageManager.faceHeight;
|
||
const sw = Math.min(width || pw, pw);
|
||
const sh = Math.min(height || ph, ph);
|
||
const dx = Math.floor(x + Math.max(width - pw, 0) / 2);
|
||
const dy = Math.floor(y + Math.max(height - ph, 0) / 2);
|
||
const sx = (faceIndex % 4) * pw + (pw - sw) / 2;
|
||
const sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2;
|
||
//this.contents.blt(bitmap, sx, sy, sw, sh, dx, dy, sw * scaleX, sh * scaleY);
|
||
|
||
//円形表示を追加
|
||
bitmap.addLoadListener(() => {
|
||
const tempCanvas = document.createElement("canvas");
|
||
tempCanvas.width = sw;
|
||
tempCanvas.height = sh;
|
||
const context = tempCanvas.getContext("2d");
|
||
context.beginPath();
|
||
context.arc(sw / 2, sh / 2, Math.min(sw / 2, sh / 2), 0, 2 * Math.PI);
|
||
context.closePath();
|
||
context.clip();
|
||
context.drawImage(bitmap.canvas, sx, sy, sw, sh, 0, 0, sw, sh);
|
||
this.contents.context.drawImage(
|
||
tempCanvas,
|
||
0,
|
||
0,
|
||
sw,
|
||
sh,
|
||
dx,
|
||
dy,
|
||
sw * scaleX,
|
||
sh * scaleY
|
||
);
|
||
this.contents.baseTexture.update();
|
||
});
|
||
};
|
||
|
||
Window_MapHpGauge.prototype.refreshFace = function () {
|
||
if (faceOffsetX === -9999) {
|
||
return;
|
||
}
|
||
var actor = $gameParty.leader();
|
||
var bitmap = ImageManager.loadFace(actor.faceName());
|
||
this._needFaceRefresh = bitmap.width === 0;
|
||
if (!this._needFaceRefresh) {
|
||
var x = faceOffsetX;
|
||
var y = faceOffsetY;
|
||
var height = Math.min(gaugeWindowHeight, 144);
|
||
var scaleX = 0.7;
|
||
var scaleY = 0.7;
|
||
this.drawScaledFace(
|
||
actor.faceName(),
|
||
actor.faceIndex(),
|
||
x,
|
||
y,
|
||
144,
|
||
height,
|
||
scaleX,
|
||
scaleY
|
||
);
|
||
}
|
||
};
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Window_MapName
|
||
//
|
||
var Window_MapName_prototype_refresh = Window_MapName.prototype.refresh;
|
||
Window_MapName.prototype.refresh = function () {
|
||
if (mapWidth <= 0) {
|
||
Window_MapName_prototype_refresh.call(this);
|
||
}
|
||
};
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Scene_Base
|
||
//
|
||
|
||
Scene_Base.prototype.createMapHpGaugeWindow = function () {
|
||
this._mapHpGaugeWindow = new Window_MapHpGauge();
|
||
this.addChild(this._mapHpGaugeWindow);
|
||
};
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Scene_Map
|
||
//
|
||
|
||
var _Scene_Map_createDisplayObjects =
|
||
Scene_Map.prototype.createDisplayObjects;
|
||
Scene_Map.prototype.createDisplayObjects = function () {
|
||
_Scene_Map_createDisplayObjects.call(this);
|
||
this.createMapHpGaugeWindow();
|
||
};
|
||
|
||
var _Scene_Map_terminate = Scene_Map.prototype.terminate;
|
||
Scene_Map.prototype.terminate = function () {
|
||
if (!SceneManager.isNextScene(Scene_Battle)) this._mapHpGaugeWindow.hide();
|
||
_Scene_Map_terminate.call(this);
|
||
this.removeChild(this._mapHpGaugeWindow);
|
||
};
|
||
|
||
var _Scene_Map_launchBattle = Scene_Map.prototype.launchBattle;
|
||
Scene_Map.prototype.launchBattle = function () {
|
||
this._mapHpGaugeWindow.hide();
|
||
_Scene_Map_launchBattle.call(this);
|
||
};
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Scene_Battle
|
||
//
|
||
|
||
var _Scene_Battle_createDisplayObjects =
|
||
Scene_Battle.prototype.createDisplayObjects;
|
||
Scene_Battle.prototype.createDisplayObjects = function () {
|
||
_Scene_Battle_createDisplayObjects.call(this);
|
||
if (useBattleScene) {
|
||
this.createMapHpGaugeWindow();
|
||
}
|
||
};
|
||
|
||
var _Scene_Battle_terminate = Scene_Battle.prototype.terminate;
|
||
Scene_Battle.prototype.terminate = function () {
|
||
_Scene_Battle_terminate.call(this);
|
||
if (this._mapHpGaugeWindow) {
|
||
this.removeChild(this._mapHpGaugeWindow);
|
||
}
|
||
};
|
||
})();
|