-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
RS_BattleTimerAbortControl.js
72 lines (62 loc) · 2.7 KB
/
RS_BattleTimerAbortControl.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
//================================================================
// RS_BattleTimerAbortControl.js
// ---------------------------------------------------------------
// The MIT License
// Copyright (c) 2018 biud436
// ---------------------------------------------------------------
// Free for commercial and non commercial use.
//================================================================
/*:
* @target MV
* @plugindesc This plugin allows you to be maintaining the battle even if the timer is less than 0 on battle.
* @author biud436
* @help
* ==================================================================
* Plugin Commands
* ==================================================================
* DisableBattleAbortInTimer : it doesn't abort the battle after the timer is zero.
* EnableBattleAbortInTimer : if the timer is same as 0, it will abort the battle.
* ==================================================================
* Version Log
* ==================================================================
* 2018.05.08 (v1.0.0) - First Release
*/
(() => {
//==================================================================
// Game_System (For Saving)
//==================================================================
const alias_Game_System_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function () {
alias_Game_System_initialize.call(this);
this._battleAbortInTimer = true;
};
Game_System.prototype.disableBattleAbortInTimer = function () {
this._battleAbortInTimer = false;
};
Game_System.prototype.enableBattleAbortInTimer = function () {
this._battleAbortInTimer = true;
};
Game_System.prototype.battleAbortInTimer = function () {
return this._battleAbortInTimer;
};
//==================================================================
// Game_Timer
//==================================================================
Game_Timer.prototype.onExpire = function () {
if ($gameSystem.battleAbortInTimer()) {
BattleManager.abort();
}
};
//==================================================================
// Plugin Command
//==================================================================
const aliasPluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
aliasPluginCommand.call(this, command, args);
if (command === 'DisableBattleAbortInTimer') {
$gameSystem.disableBattleAbortInTimer();
} else if (command === 'EnableBattleAbortInTimer') {
$gameSystem.enableBattleAbortInTimer();
}
};
})();