/
MAT_BattlestartendFade.js
143 lines (125 loc) · 4.47 KB
/
MAT_BattlestartendFade.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
//=============================================================================
// MAT_BattlestartendFade.js
// ----------------------------------------------------------------------------
// Copyright (c) 2020 mattuup
// This software is released under the MIT license.
// http://opensource.org/licenses/mit-license.php
//=============================================================================
/*:ja
* @plugindesc ver1.00 戦闘始終のフェードインの制御
* @author mattuup
* @target MZ
* @base PluginCommonBase
* @orderAfter PluginCommonBase
* @url https://github.com/mattuup/RPGMakerMZ
*
* @param Notstartfadesw
* @desc このIDのスイッチがオンの時
* 戦闘開始時にフェードインしません。
* @type switch
* @default 10
*
* @param Notendfadesw
* @desc このIDのスイッチがオンの時
* 戦闘終了時にフェードインしません。
* @type switch
* @default 10
*
* @param Notstartplaysw
* @desc このIDのスイッチがオンの時
* 戦闘開始時に戦闘BGMの演奏を開始しません。
* @type switch
* @default 12
*
* @param Notreplaysw
* @desc このIDのスイッチがオンの時
* 戦闘終了時に戦闘前のBGM等を再開しません。
* @type switch
* @default 12
*
*
* @help
*
* RPGで笑顔を・・・
*
* このヘルプとパラメータの説明をよくお読みになってからお使いください。
*
* 利用規約はMITライセンスの通り。
* (BattlestartFade.jsとBattleendFade.js再録)
*
* フェードインしたいときは普通に
* イベントコマンド「画面のフェードイン」を使ってください。
*
* Notstartfadeswが有効な時
* 戦闘開始時メッセージを自動でとばします。
* また、同時にフェードアウト中はステータスウインドウを閉じます。
*
* Notstartplayswが有効な時
* 戦闘開始前、audioを止めません。
*
*/
var Imported = Imported || {};
Imported[PluginManagerEx.findPluginName(document.currentScript)] = true;
(() => {
'use strict';
const script = document.currentScript;
const param = PluginManagerEx.createParameter(script);
const fadetime = 24;
DataManager.isNotstartfadesw = function() {
return param.Notstartfadesw > 0 && $gameSwitches.value(param.Notstartfadesw);
};
DataManager.isNotstartplaysw = function() {
return param.Notstartplaysw > 0 && $gameSwitches.value(param.Notstartplaysw);
};
const _BattleManager_playBattleBgm = BattleManager.playBattleBgm;
BattleManager.playBattleBgm = function() {
if(DataManager.isNotstartplaysw()){
return;
}
_BattleManager_playBattleBgm.call(this);
};
const _Scene_Map_stopAudioOnBattleStart = Scene_Map.prototype.stopAudioOnBattleStart;
Scene_Map.prototype.stopAudioOnBattleStart = function() {
if(DataManager.isNotstartplaysw()){
return;
}
_Scene_Map_stopAudioOnBattleStart.call(this);
};
const _Scene_Battle_createSpriteset = Scene_Battle.prototype.createSpriteset;
Scene_Battle.prototype.createSpriteset = function() {
if(DataManager.isNotstartfadesw()){
$gameScreen._brightness = 0;
}
_Scene_Battle_createSpriteset.call(this);
};
const _Scene_Battle_shouldOpenStatusWindow = Scene_Battle.prototype.shouldOpenStatusWindow;
Scene_Battle.prototype.shouldOpenStatusWindow = function() {
const def = _Scene_Battle_shouldOpenStatusWindow.call(this);
const forcefade = (DataManager.isNotstartfadesw() && $gameScreen.brightness() <= 0);
if(forcefade){
this._statusWindow.close();
}
return def && !forcefade;
};
const _BattleManager_displayStartMessages = BattleManager.displayStartMessages;
BattleManager.displayStartMessages = function() {
if(DataManager.isNotstartfadesw()){
return;
}
_BattleManager_displayStartMessages.call(this);
};
const _BattleManager_replayBgmAndBgs = BattleManager.replayBgmAndBgs;
BattleManager.replayBgmAndBgs = function() {
if(param.Notreplaysw > 0 && $gameSwitches.value(param.Notreplaysw)){
return;
}
_BattleManager_replayBgmAndBgs.call(this);
};
const _BattleManager_updateBattleEnd = BattleManager.updateBattleEnd;
BattleManager.updateBattleEnd = function() {
if(param.Notendfadesw > 0 && $gameSwitches.value(param.Notendfadesw)){
$gameScreen.startFadeOut(fadetime);
}
_BattleManager_updateBattleEnd.call(this);
};
})();