-
Notifications
You must be signed in to change notification settings - Fork 0
/
bentelk_DifferentStats.js
105 lines (86 loc) · 3.38 KB
/
bentelk_DifferentStats.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
/*:
* @plugindesc Shows the stats I happen to be interested in on the Status and Equip screens.
* @author Ben Hendel-Doying
*
* @help This plugin is not designed with customizability in mind; it was
* designed for a particular game I was making. If you'd like to show
* different stats, some extra work on your part will be required.
*
* Requires RPG Maker MV 1.6.1+ (due to use of ES6 functions and syntax).
*/
(function() {
// attack, speed, luck
const relevantParameters = [ 2, 6, 7 ];
const relevantXParameters = [ 1, 2, 6, 7 ];
const xParameterLabels = [
'Hit',
'Dodge',
'Crit Hit',
'Crit Dodge',
'Magic Dodge',
'Magic Reflect',
'Counterattack',
'Health Regen',
'Magic Regen',
'Rage Regen',
];
Window_Status.prototype.drawParameters = function(x, y) {
const lineHeight = this.lineHeight();
let i = 0;
relevantParameters.forEach((paramId) => {
let y2 = y + lineHeight * i;
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(paramId), x, y2, 160);
this.resetTextColor();
this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
i++;
});
relevantXParameters.forEach(xParamId => {
let y2 = y + lineHeight * i;
this.changeTextColor(this.systemColor());
this.drawText(xParameterLabels[xParamId], x, y2, 160);
this.resetTextColor();
this.drawText((this._actor.xparam(xParamId) * 100).toFixed(0) + '%', x + 160, y2, 60, 'right');
i++;
});
};
Window_EquipStatus.prototype.refresh = function() {
let lineHeight = this.lineHeight();
this.contents.clear();
if (this._actor) {
this.drawActorName(this._actor, this.textPadding(), 0);
this.drawItem(0, lineHeight * 1, 'Health', function() { return this.mhp; });
this.drawItem(0, lineHeight * 2, 'Magic', function() { return this.mmp; });
let i = 3;
let _this = this;
relevantParameters.forEach(function(paramId) { // want scope for paramId
_this.drawItem(0, lineHeight * i, TextManager.param(paramId), function() { return this.param(paramId); });
i++;
});
}
};
Window_EquipStatus.prototype.numVisibleRows = function() {
return relevantParameters.length + 3;
};
Window_EquipStatus.prototype.drawItem = function(x, y, label, getter) {
this.changeTextColor(this.systemColor());
this.drawText(label, x + this.textPadding(), y, 120);
let oldValue = getter.call(this._actor);
if (this._actor) {
this.drawCurrentParam(x + 140, y, oldValue);
}
this.drawRightArrow(x + 188, y);
if (this._tempActor) {
this.drawNewParam(x + 222, y, oldValue, getter.call(this._tempActor));
}
};
Window_EquipStatus.prototype.drawCurrentParam = function(x, y, value) {
this.resetTextColor();
this.drawText(value, x, y, 48, 'right');
};
Window_EquipStatus.prototype.drawNewParam = function(x, y, oldValue, newValue) {
let diffvalue = newValue - oldValue;
this.changeTextColor(this.paramchangeTextColor(diffvalue));
this.drawText(newValue, x, y, 48, 'right');
};
})();