/
sharedStats.js
135 lines (129 loc) · 3.99 KB
/
sharedStats.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
//=============================================================================
// sharedStat.js
//=============================================================================
/*:ja
* @plugindesc HP/MP/TPをPT内で共有させるプラグイン
* @author 剣崎宗二
*
* @help
* プラグインコマンドで有効化します。
* SharedStat [パラメーター名] [数値、或いはoff]
* 最終パラメータがoffの場合は通常のシステムに戻ります。
* 数値の場合はそのパラメーターの最大値及び現在値がその数値となります。
*
* 使用例:
* SharedStat hp 300
* 共有HPを300に設定します。
*
* SharedStat mp off
* MPの共有を解除します。
*
*/
(function () {
var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'SharedStat') {
var target = args[1] != 'off';
switch (args[0]) {
case 'hp':
$gameSystem.useSharedHp = target;
if (!isNaN(Number(args[1]))) {
$gameSystem.sharedHp = Number(args[1]);
$gameSystem.sharedMhp = Number(args[1]);
}
break;
case 'mp':
$gameSystem.useSharedMp = target;
if (!isNaN(Number(args[1]))) {
$gameSystem.sharedMp = Number(args[1]);
$gameSystem.sharedMmp = Number(args[1]);
}
break;
case 'tp':
$gameSystem.useSharedTp = target;
if (!isNaN(Number(args[1]))) {
$gameSystem.sharedTp = Number(args[1]);
}
break;
}
}
};
})();
Object.defineProperties(Game_BattlerBase.prototype, {
_hp: {
get: function () {
if ($gameSystem.useSharedHp && this.isActor()) {
return $gameSystem.sharedHp;
}
else {
return this._trueHp;
}
},
set: function (val) {
if ($gameSystem.useSharedHp && this.isActor()) {
$gameSystem.sharedHp = val;
}
else {
this._trueHp = val;
}
}, configurable: true
},
mhp: {
get: function () {
if ($gameSystem.useSharedHp && this.isActor()) {
return $gameSystem.sharedMhp;
}
else {
return this.param(0);
}
}, configurable: true
},
_mp: {
get: function () {
if ($gameSystem.useSharedMp && this.isActor()) {
return $gameSystem.sharedMp;
}
else {
return this._trueMp;
}
},
set: function (val) {
if ($gameSystem.useSharedMp && this.isActor()) {
$gameSystem.sharedMp = val;
}
else {
this._trueMp = val;
}
}, configurable: true
},
mmp: {
get: function () {
if ($gameSystem.useSharedMp && this.isActor()) {
return $gameSystem.sharedMmp;
}
else {
return this.param(1);
}
}, configurable: true
},
_tp: {
get: function () {
if ($gameSystem.useSharedTp && this.isActor()) {
return $gameSystem.sharedTp;
}
else {
return this._trueTp;
}
},
set: function (val) {
if ($gameSystem.useSharedTp && this.isActor()) {
$gameSystem.sharedTp = val;
}
else {
this._trueTp = val;
}
}, configurable: true
},
});