/
MOG_BattleHudFixPatch.js
447 lines (421 loc) · 16.5 KB
/
MOG_BattleHudFixPatch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
/*
* --------------------------------------------------
* MOG_BattleHudFixPatch.js
* Ver.1.3.0
* Copyright (c) 2020 Munokura
* This software is released under the MIT license.
* http://opensource.org/licenses/mit-license.php
* --------------------------------------------------
*/
/*:
* @plugindesc MOG Battle Hud (v5.04)で見つかったバグを修正するパッチプラグイン
* @author munokura
*
* @help
* MOG Battle Hud (v5.04) のバグを修正するパッチプラグインです。
* プラグイン管理でMOG_BattleHudの下側に配置してください。
* また、他のMOGシリーズプラグインで戦闘中に動作するプラグインの下側に配置してください。
* この配置が合っていない場合、フロントビュー戦闘で全体アニメーションの位置が
* 正しく表示されない問題が解決しない場合があります。
*
* 修正箇所
*
* Face Frame Animation を有効にし、Face Zoom Animation を無効にした場合、
* Face Frame Animation が一部正常に動作しない問題を解消。
*
* States Mode が Line Mode の時、
* ステート表示の更新処理が適切に行われない問題の解消。
* ステート表示のターン数等を表示するプラグインで起こる問題の解消。
*
* HP,MPの最大値が戦闘中に上がった時、
* メーターの表示が適切に行われない問題の解消。
*
* v1.2.0
* フロントビュー戦闘で全体アニメーションの位置が正しく表示されない問題を解消。
* ※nekoma otobuki
*
* v1.3.0
* 戦闘を行った後のセーブデータに、
* 変更したプラグインパラメーターが反映されない問題を解消。
*
*/
(function () {
'use strict';
//==============================
// * Prepare
//==============================
var _alias_mog_bmhud_action_prepare = Game_Action.prototype.prepare
Game_Action.prototype.prepare = function () {
_alias_mog_bmhud_action_prepare.call(this);
if (this.subject().isActor() && (String(Moghunter.bhud_face_animated) === "true" || String(Moghunter.bhud_face_zoom) === "true")) {
this.subject()._bhud_face_data = [0, 70, 2, 70];
};
};
//==============================
// * Update Face
//==============================
Battle_Hud.prototype.update_face = function () {
if (!this._face) { return; }
if (!this._face.bitmap.isReady()) { return; }
if (this._face_data[4] && this._face_data[5] != this._battler._bhud_face_data[2]) {
this.refresh_face();
}
if (String(Moghunter.bhud_face_animated) === "true") {
this.update_face_animation();
}
if (String(Moghunter.bhud_face_shake) === "true") {
this.update_face_shake();
}
if (String(Moghunter.bhud_face_zoom) === "true") {
this.update_face_zoom();
}
if (this._face.breathEffect) {
this.updateFaceEffects();
}
};
//==============================
// * Create States 2
//==============================
const _Battle_Hud_create_states2 = Battle_Hud.prototype.create_states2;
Battle_Hud.prototype.create_states2 = function () {
this._states_data[2] = 0;
_Battle_Hud_create_states2.call(this);
};
//==============================
// * Update States 2
//==============================
const _Battle_Hud_update_states2 = Battle_Hud.prototype.update_states2;
Battle_Hud.prototype.update_states2 = function () {
this._states_data[2] += 1;
_Battle_Hud_update_states2.call(this);
};
//==============================
// * Need Refresh States 2
//==============================
const _Battle_Hud_need_refresh_states2 = Battle_Hud.prototype.need_refresh_states2;
Battle_Hud.prototype.need_refresh_states2 = function () {
if (this._states_data[2] > 60) {
return true;
}
_Battle_Hud_need_refresh_states2.call(this);
};
//==============================
// * Update HP
//==============================
Battle_Hud.prototype.update_hp = function () {
if (this._hp_meter_blue) {
if (this._hp_flow[0]) {
this.refresh_meter_flow(this._hp_meter_blue, this._battler.hp, this._battler.mhp, 0, this._hp_flow[1]);
var dif_meter = this.update_dif(this._hp_old_ani[0], this._battler.hp, 160);
if (this._hp_old_ani[0] != dif_meter) {
this._hp_old_ani[0] = dif_meter;
}
if (this._battler.mhp < this._hp_old_ani[0]) {
this.refresh_meter_flow(this._hp_meter_red, this._battler.mhp, this._battler.mhp, 1, this._hp_flow[1]);
} else {
this.refresh_meter_flow(this._hp_meter_red, this._hp_old_ani[0], this._battler.mhp, 1, this._hp_flow[1]);
}
this._hp_flow[1] += 1.5;
if (this._hp_flow[1] > this._hp_flow[3]) {
this._hp_flow[1] = 0;
}
} else {
if (this.need_refresh_parameter(0)) {
this.refresh_meter(this._hp_meter_blue, this._battler.hp, this._battler.mhp, 0);
this._hp_old = [this._battler.hp, this._battler.mhp];
}
var dif_meter = this.update_dif(this._hp_old_ani[0], this._battler.hp, 160);
if (this._hp_old_ani[0] != dif_meter) {
this._hp_old_ani[0] = dif_meter;
}
if (this._battler.mhp < this._hp_old_ani[0]) {
this.refresh_meter(this._hp_meter_red, this._battler.mhp, this._battler.mhp, 1);
} else {
this.refresh_meter(this._hp_meter_red, this._hp_old_ani[0], this._battler.mhp, 1);
}
}
}
if (this._hp_number) {
var dif_number = this.update_dif(this._hp_number_old, this._battler.hp, 30);
if (this._hp_number_old != dif_number) {
this._hp_number_old = dif_number;
this.refresh_number(this._hp_number, this._hp_number_old, this._hp_img_data, this._hp_img_data[4], this._hp_img_data[5], 0);
}
}
if (this._maxhp_number) {
if (this._maxhp_number_old != this._battler.mhp) {
this._maxhp_number_old = this._battler.mhp;
this.refresh_number(this._maxhp_number, this._maxhp_number_old, this._maxhp_img_data, this._maxhp_img_data[4], this._maxhp_img_data[5], 0);
}
}
};
//==============================
// * Update MP
//==============================
Battle_Hud.prototype.update_mp = function () {
if (this._mp_meter_blue) {
if (this._mp_flow[0]) {
this.refresh_meter_flow(this._mp_meter_blue, this._battler.mp, this._battler.mmp, 0, this._mp_flow[1]);
var dif_meter = this.update_dif(this._mp_old_ani[0], this._battler.mp, 160)
if (this._mp_old_ani[0] != dif_meter) {
this._mp_old_ani[0] = dif_meter;
}
if (this._battler.mmp < this._mp_old_ani[0]) {
this.refresh_meter_flow(this._mp_meter_red, this._battler.mmp, this._battler.mmp, 1, this._mp_flow[1]);
} else {
this.refresh_meter_flow(this._mp_meter_red, this._mp_old_ani[0], this._battler.mmp, 1, this._mp_flow[1]);
}
this._mp_flow[1] += 1.5;
if (this._mp_flow[1] > this._mp_flow[3]) {
this._mp_flow[1] = 0
}
} else {
if (this.need_refresh_parameter(1)) {
this.refresh_meter(this._mp_meter_blue, this._battler.mp, this._battler.mmp, 0);
this._mp_old = [this._battler.mp, this._battler.mmp];
}
var dif_meter = this.update_dif(this._mp_old_ani[0], this._battler.mp, 160);
if (this._mp_old_ani[0] != dif_meter) {
this._mp_old_ani[0] = dif_meter;
}
if (this._battler.mmp < this._mp_old_ani[0]) {
this.refresh_meter(this._mp_meter_red, this._battler.mmp, this._battler.mmp, 1);
} else {
this.refresh_meter(this._mp_meter_red, this._mp_old_ani[0], this._battler.mmp, 1);
}
}
if (this._mp_number) {
var dif_number = this.update_dif(this._mp_number_old, this._battler.mp, 30)
if (this._mp_number_old != dif_number) {
this._mp_number_old = dif_number;
this.refresh_number(this._mp_number, this._mp_number_old, this._mp_img_data, this._mp_img_data[4], this._mp_img_data[5], 1);
};
};
if (this._maxmp_number) {
if (this._maxmp_number_old != this._battler.mmp) {
this._maxmp_number_old = this._battler.mmp;
this.refresh_number(this._maxmp_number, this._maxmp_number_old, this._maxmp_img_data, this._maxmp_img_data[4], this._maxmp_img_data[5], 1);
}
}
}
};
//==============================
// ** create Hud Field ** fixed by nekoma otobuki
//==============================
Scene_Base.prototype.createHudField = function () {
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
var x = (Graphics.width - width) / 2;
var y = (Graphics.height - height) / 2;
this._hudField = new Sprite();
this._hudField.setFrame(x, y, width, height);
this._hudField.z = 10;
this.addChild(this._hudField);
};
//==============================
// ** update Battle Commands
//==============================
Window_ActorCommand.prototype.updateBattleCommands = function () {
if ($gameTemp._bhud_position_active) {
this.visible = this.active;
// if ($gameSystem._bhud_auto_com) { // セーブ対策
if ($gameTemp._bhud_auto_com) {
this.x = $gameTemp._bhud_position_active[0] + Moghunter.bhud_com_x;
if (this._com_mode === 0) {
this.y = $gameTemp._bhud_position_active[1] + Moghunter.bhud_com_y - this.height;
} else {
this.y = $gameTemp._bhud_position_active[1] + Moghunter.bhud_com_y
};
} else {
this.x = Moghunter.bhud_com_x;
this.y = Moghunter.bhud_com_y;
};
};
};
//==============================
// ** update Position S
//==============================
Window_ActorCommand.prototype.updatePosS = function () {
if ($gameTemp._bhud_position_active) {
this.visible = this.active;
// if ($gameSystem._bhud_auto_com) { // セーブ対策
if ($gameTemp._bhud_auto_com) {
if (this.xp != $gameTemp._bhud_position_active[0] || this.yp != $gameTemp._bhud_position_active[1]) {
this.xp = $gameTemp._bhud_position_active[0];
this.yp = $gameTemp._bhud_position_active[1];
this.org[0] = $gameTemp._bhud_position_active[0] + Moghunter.bhud_com_x;
if (this._com_mode === 0) {
this.org[1] = $gameTemp._bhud_position_active[1] + Moghunter.bhud_com_y - this.height;
} else {
this.org[1] = $gameTemp._bhud_position_active[1] + Moghunter.bhud_com_y;
};
this.org2 = [
this.org[0] + Moghunter.bhud_com_slideX,
this.org[1] + Moghunter.bhud_com_slideY
];
if (this._actorVis != this._actor) {
this.x = this.org2[0];
this.y = this.org2[1];
this._actorVis = this._actor;
};
};
this.slideWindow(this, false);
} else {
this.slideWindow(this, false);
};
};
};
//==============================
// ** update Position N
//==============================
Window_ActorCommand.prototype.updatePosN = function () {
if ($gameTemp._bhud_position_active) {
this.visible = this.active;
// if ($gameSystem._bhud_auto_com) { // セーブ対策
if ($gameTemp._bhud_auto_com) {
this.x = $gameTemp._bhud_position_active[0] + Moghunter.bhud_com_x;
if (this._com_mode === 0) {
this.y = $gameTemp._bhud_position_active[1] + Moghunter.bhud_com_y - this.height;
} else { this.y = $gameTemp._bhud_position_active[1] + Moghunter.bhud_com_y };
} else {
this.x = Moghunter.bhud_com_x;
this.y = Moghunter.bhud_com_y;
};
};
};
//==============================
// * Is Busy
//==============================
Spriteset_Battle.prototype.isBusy = function () {
// if ($gameSystem._bhudFaceBattler) { // セーブ対策
if ($gameTemp._bhudFaceBattler) {
return this.isAnimationPlaying() || this.isAnyoneMoving() || $gameTemp._bhudFaceAnime > 0;
};
if (Imported.YEP_BattleEngineCore) { return false };
return this.isAnimationPlaying() || this.isAnyoneMoving();
};
//==============================
// ** create Battle Hud
//==============================
Scene_Base.prototype.createBattleHud = function () {
if (String(Moghunter.bhud_screen_layout) === "true") { this.createBattleHudScreenLayout(); };
$gameTemp.refresh_Bhud = false;
$gameTemp._battleEnd = false;
// this._com_mode = Number($gameSystem._bhud_pos_mode) // セーブ対策
this._com_mode = Number($gameTemp._bhud_pos_mode)
this._battle_hud = [];
for (var i = 0; i < $gameParty.maxBattleMembers(); i++) {
this._battle_hud[i] = new Battle_Hud(i);
this._battle_hud[i].mz = 110;
this._hudField.addChild(this._battle_hud[i]);
};
};
// セーブ対策
//===========================================================================
// ** Game_System
//===========================================================================
//==============================
// * Initialize
//==============================
var _alias_mog_bhud_sys_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function () {
_alias_mog_bhud_sys_initialize.call(this);
// this._bhud_position = [];
// for (var i = 0; i < 8; i++) {
// this._bhud_position[i] = this.set_hudcp(Moghunter.bhud_custom_pos[i]);
// };
// this._bhud_auto_com = false;
// this._bhud_pos_mode = 0;
this._bhud_visible = true;
// this._bhudFaceBattler = String(Moghunter.bhud_face_visible) == "true" && !$dataSystem.optSideView ? true : false;
// if (String(Moghunter.bhud_pos_mode) == "true") { this._bhud_pos_mode = 1 };
// if (Number(Moghunter.bhud_auto_pos) == 0) { this._bhud_auto_com = true };
};
//===========================================================================
// ** Game_Temp
//===========================================================================
//==============================
// * Initialize
//==============================
var _alias_mog_bhud_temp_initialize = Game_Temp.prototype.initialize;
Game_Temp.prototype.initialize = function () {
_alias_mog_bhud_temp_initialize.call(this);
this._bhud_position = [];
this._bhud_position_active = null;
this._bhudFaceAnime = false;
this._battleEnd = false;
this._bhud_dp = false;
this._refreshBhud = false;
this._forceCreateBattleHud = false;
this._forceRemoveBattleHud = false;
this._bhud_position = [];
for (var i = 0; i < 8; i++) {
this._bhud_position[i] = this.set_hudcp(Moghunter.bhud_custom_pos[i]);
};
this._bhud_auto_com = false;
this._bhud_pos_mode = 0;
this._bhud_visible = true;
this._bhudFaceBattler = String(Moghunter.bhud_face_visible) == "true" && !$dataSystem.optSideView ? true : false;
if (String(Moghunter.bhud_pos_mode) == "true") { this._bhud_pos_mode = 1 };
if (Number(Moghunter.bhud_auto_pos) == 0) { this._bhud_auto_com = true };
};
//==============================
// * set Hudcp
//==============================
Game_Temp.prototype.set_hudcp = function (value) {
if (!value) { return null };
var s = value.split(',');
if (!s[0] || !s[1]) { return null };
return [Number(s[0]), Number(s[1])];
}
//===========================================================================
// ** Window Actor Command
//===========================================================================
//==============================
// * initialize
//==============================
var _alias_mog_bhud_wActCom_initialize = Window_ActorCommand.prototype.initialize;
Window_ActorCommand.prototype.initialize = function () {
_alias_mog_bhud_wActCom_initialize.call(this);
// this._com_mode = Number($gameSystem._bhud_pos_mode);
this._com_mode = Number($gameTemp._bhud_pos_mode);
this._force_hide_duration = 0;
this.org = [Moghunter.bhud_com_x, Moghunter.bhud_com_y];
this.org2 = [
this.org[0] + Moghunter.bhud_com_slideX,
this.org[1] + Moghunter.bhud_com_slideY
];
this.slide = Moghunter.bhud_com_slideX === 0 && Moghunter.bhud_com_slideY === 0 ? false : true;
this._actorVis != this._actor;
this.xp = -1;
this.yp = -1;
};
// ==============================
// * Set Hud Position
// ==============================
Battle_Hud.prototype.set_hud_position = function () {
this._hud_size = [this._layout.bitmap.width, this._layout.bitmap.height];
this._members_max = $gameParty.battleMembers().length;
var ps = [Number(Moghunter.bhud_space_x) * this._hud_id,
Number(Moghunter.bhud_space_y) * this._hud_id];
// if ($gameSystem._bhud_position[this._hud_id]) {
if ($gameTemp._bhud_position[this._hud_id]) {
// this._pos_x = $gameSystem._bhud_position[this._hud_id][0];
// this._pos_y = $gameSystem._bhud_position[this._hud_id][1];
this._pos_x = $gameTemp._bhud_position[this._hud_id][0];
this._pos_y = $gameTemp._bhud_position[this._hud_id][1];
} else {
if (Number($gameTemp._bhud_pos_mode) === 0) {
var spc = ((Graphics.boxWidth - 14) / this._members_max);
var px = (spc / 2) + (spc * this._hud_id);
this._pos_x = Moghunter.bhud_pos_x + px + ps[0];
this._pos_y = Moghunter.bhud_pos_y + ps[1];
} else {
var py = (this._hud_size[1] + 5) * this._hud_id;
this._pos_x = Moghunter.bhud_pos_x + ps[0];
this._pos_y = Moghunter.bhud_pos_y + py + ps[1];
};
};
$gameTemp._bhud_position[this._hud_id] = [this._pos_x, this._pos_y];
};
})();