-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathMrTS_HpEqualsMaxHp.js
53 lines (49 loc) · 2 KB
/
MrTS_HpEqualsMaxHp.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
//=============================================================================
// MrTS_HpEqualsMaxHp.js
//=============================================================================
/*:
* @plugindesc Allows specific states to make actor's Max HP equal to HP.
* @author Mr. Trivel
*
* @param State List
* @desc List all State IDs separated by space that make actor's Max HP to be equal to HP.
* @default 12
*
* @help
* --------------------------------------------------------------------------------
* Terms of Use
* --------------------------------------------------------------------------------
* Don't remove the header or claim that you wrote this plugin.
* Credit Mr. Trivel if using this plugin in your project.
* Free for commercial and non-commercial projects.
* --------------------------------------------------------------------------------
* Version 1.0
* --------------------------------------------------------------------------------
*
* --------------------------------------------------------------------------------
* Version History
* --------------------------------------------------------------------------------
* 1.0 - Release
*/
(function() {
var parameters = PluginManager.parameters('MrTS_HpEqualsMaxHp');
var paramStateList = String(parameters['State List'] || "12");
var paramStateList = paramStateList.split(' ');
var paramStateIdList = [];
for (var i = 0; i < paramStateList.length; i++) {
paramStateIdList.push(Number(paramStateList[i]));
};
var _GameBattlerBase_param = Game_BattlerBase.prototype.param;
Game_BattlerBase.prototype.param = function(paramId) {
var value = _GameBattlerBase_param.call(this, paramId);
if (paramId === 0 && this.isHpEqualsMaxHpStateInflicted())
value = value.clamp(this.paramMin(paramId), this.hp <= 0 ? 1 : this.hp);
return value;
};
Game_BattlerBase.prototype.isHpEqualsMaxHpStateInflicted = function() {
for (var i = 0; i < paramStateIdList.length; i++) {
if (this.isStateAffected(paramStateIdList[i])) return true;
};
return false;
};
})();