-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTMMaxLevel.js
99 lines (88 loc) · 2.95 KB
/
TMMaxLevel.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
//=============================================================================
// TMVplugin - レベル上限操作
// 作者: tomoaky (http://hikimoki.sakura.ne.jp/)
// Version: 1.0
// 最終更新日: 2015/12/29
//=============================================================================
/*:
* @plugindesc v1.0.1 レベル上限をゲーム中に増やすことができます。
*
* @author tomoaky (http://hikimoki.sakura.ne.jp/)
*
* @param maxMaxLevel
* @text レベル上限
* @type number
* @min 1
* @max 99
* @desc 加算値込みのレベル上限
* 初期値: 99
* @default 99
*
* @help
* プラグインコマンド:
* gainMaxLevel 1 5
* # アクター1番のレベル上限を5増やす
* getMaxLevel 2 10
* # アクター2番のレベル上限を変数10番に代入
* getMaxLevelPlus 2 3
* # アクター2番のレベル上限(加算値)を変数3番に代入
*
* v1.0.1 プラグインパラメーターの調整と、ヘルプの誤字を修正 by ムノクラ
*/
var Imported = Imported || {};
Imported.TMMaxLevel = true;
(function () {
var parameters = PluginManager.parameters('TMMaxLevel');
var maxMaxLevel = parameters['maxMaxLevel'];
//-----------------------------------------------------------------------------
// Game_Interpreter
//
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'gainMaxLevel') {
var actor = $gameActors.actor(args[0]);
if (actor) {
actor.gainMaxLevel(Number(args[1]));
}
} else
if (command === 'getMaxLevel') {
var actor = $gameActors.actor(args[0]);
if (actor) {
$gameVariables.setValue(args[1], actor.maxLevel())
}
}
if (command === 'getMaxLevelPlus') {
var actor = $gameActors.actor(args[0]);
if (actor) {
if (actor._maxLevelPlus === undefined) {
actor.gainMaxLevel(0);
}
$gameVariables.setValue(args[1], actor._maxLevelPlus)
}
}
};
//-----------------------------------------------------------------------------
// Game_Actor
//
var _Game_Actor_initMembers = Game_Actor.prototype.initMembers;
Game_Actor.prototype.initMembers = function () {
_Game_Actor_initMembers.call(this);
this._maxLevelPlus = 0;
};
var _Game_Actor_maxLevel = Game_Actor.prototype.maxLevel;
Game_Actor.prototype.maxLevel = function () {
if (this._maxLevelPlus === undefined) {
this._maxLevelPlus = 0;
}
return _Game_Actor_maxLevel.call(this) + this._maxLevelPlus;
};
Game_Actor.prototype.gainMaxLevel = function (n) {
if (this._maxLevelPlus === undefined) {
this._maxLevelPlus = 0;
}
this._maxLevelPlus += n;
var m = maxMaxLevel - this.actor().maxLevel;
this._maxLevelPlus = this._maxLevelPlus.clamp(0, m);
};
})();