-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAPHO_RandomGameOver.js
175 lines (175 loc) · 5.64 KB
/
APHO_RandomGameOver.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
//==========================================
// APHO_RandomGameOver.js
//==========================================
/*:
* @title Random Game Over
* @author Apho
* @plugindesc v1.1 Allows for randomising the defeat ME, Game Over image, and Game Over ME, and having hue and pitch variances for them.
*
* @param DefeatMEList
* @text Defeat ME list
* @type file[]
* @dir audio/me
* @require 1
* @desc Pool of MEs for when the player falls in battle.
* @default ["Defeat1", "Defeat2"]
*
* @param DefeatVolume
* @text Defeat volume
* @type number
* @desc Volume of the Defeat ME.
* @default 90
*
* @param DefeatPitchMin
* @text Defeat minimum pitch
* @type number
* @desc Minimum pitch of the Defeat ME.
* @default 100
*
* @param DefeatPitchMax
* @text Defeat maximum pitch
* @type number
* @desc Maximum pitch of the Defeat ME.
* @default 120
*
* @param ImageList
* @text Game Over image list
* @type file[]
* @dir img/gameover
* @require 1
* @desc Pool of images for the Game Over screen.
*
* @param HueMin
* @text Minimum hue
* @type number
* @desc Minimum hue adjustment for the gameover image.
* @min -360
* @default -180
*
* @param HueMax
* @text Maximum hue
* @type number
* @desc Maximum hue adjustment for the gameover image.
* @min -360
* @default 180
*
* @param OverlayList
* @text Game Over overlay list
* @type file[]
* @dir img/gameover
* @desc (Optional)Pool of images to be overlayed over the Game Over screen
*
* @param OverlayHueMin
* @text Minimum hue (Overlay)
* @type number
* @desc Minimum hue adjustment for the gameover overlay.
* @min -360
* @default 0
*
* @param OverlayHueMax
* @text Maximum hue (Overlay)
* @type number
* @desc Maximum hue adjustment for the gameover overlay.
* @min -360
* @default 0
*
* @param GameOverMEList
* @text Game Over ME list
* @type file[]
* @dir audio/me
* @require 1
* @desc Pool of MEs for the Game Over screen.
* @default ["GameOver1", "GameOver2"]
*
* @param GameOverVolume
* @text Game Over volume
* @type number
* @desc Volume of the Game Over ME.
* @default 90
*
* @param GameOverPitchMin
* @text Game Over minimum pitch
* @type number
* @desc Minimum pitch of the Game Over ME.
* @default 100
*
* @param GameOverPitchMax
* @text Game Over maximum pitch
* @type number
* @desc Maximum pitch of the Game Over ME.
* @default 120
*
* @help
* This plugin allows the developer to randomise the defeat ME, Game Over image,
* and Game Over ME.
* Hue and pitch variances may also be set.
* You will need to create a 'gameover' folder in your img directory for the
* gameover images.
* You may also add an optional overlay over the Game Over image.
*
* TERMS OF USE
* - Free for commercial and non-commercial use, as long as I get a free copy
* of the game.
* - Edits allowed for personal use.
* - Do not repost or claim as your own, even if edited.
*
* VERSION HISTORY
* v1.1 - 2023/6/30 - Added optional overlay for the Game Over image.
* v1.0 - 2023/6/28 - Initial release.
*/
(function(){
var parameters = PluginManager.parameters('APHO_RandomGameOver');
var ImageList = JSON.parse(parameters['ImageList']);
var HueRange = Math.max(parseInt(parameters['HueMax']) - parseInt(parameters['HueMin']), 0);
if(parameters['OverlayList'] != '' && parameters['OverlayList'] != '[]')
{
var OverlayList = JSON.parse(parameters['OverlayList']);
var OverlayHueRange = Math.max(parseInt(parameters['OverlayHueMax']) - parseInt(parameters['OverlayHueMin']), 0);
}
var DefeatMEList = JSON.parse(parameters['DefeatMEList']);
var DefeatPitchRange = Math.max(parseInt(parameters['DefeatPitchMax']) - parseInt(parameters['DefeatPitchMin']), 0);
var DefeatVolume = parseInt(parameters['DefeatVolume']);
var GameOverMEList = JSON.parse(parameters['GameOverMEList']);
var GameOverPitchRange = Math.max(parseInt(parameters['GameOverPitchMax']) - parseInt(parameters['GameOverPitchMin']), 0);
var GameOverVolume = parseInt(parameters['GameOverVolume']);
BattleManager.playDefeatMe = function()
{
let Pitch = parseInt(parameters['DefeatPitchMin']) + Math.randomInt(DefeatPitchRange + 1);
let ME =
{
name: DefeatMEList[Math.randomInt(DefeatMEList.length)],
volume: DefeatVolume,
pitch: Pitch,
pan: 0
}
AudioManager.playMe(ME);
};
Scene_Gameover.prototype.createBackground = function()
{
let Hue = parseInt(parameters['HueMin']) + Math.randomInt(HueRange + 1);
let Image = ImageList[Math.randomInt(ImageList.length)];
this._backSprite = new Sprite(ImageManager.loadBitmap('img/gameover/', Image, Hue, false));
this.addChild(this._backSprite);
if(parameters['OverlayList'] != '' && parameters['OverlayList'] != '[]')
{
let OverlayHue = parseInt(parameters['OverlayHueMin']) + Math.randomInt(OverlayHueRange + 1);
let Overlay = OverlayList[Math.randomInt(OverlayList.length)];
this._overlay = new Sprite(ImageManager.loadBitmap('img/gameover/', Overlay, OverlayHue, false));
this.addChild(this._overlay);
}
};
Scene_Gameover.prototype.playGameoverMusic = function()
{
AudioManager.stopBgm();
AudioManager.stopBgs();
let Pitch = parseInt(parameters['GameOverPitchMin']) + Math.randomInt(GameOverPitchRange + 1);
let ME =
{
name: GameOverMEList[Math.randomInt(GameOverMEList.length)],
volume: GameOverVolume,
pitch: Pitch,
pan: 0
}
AudioManager.playMe(ME);
};
})();