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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
| Game_System.prototype.initialize = function() {
this.GFS_runActivate = false;
this.gaugesVisible = true;
_aliasGFS._gamSys_init.call(this);
};
Game_System.prototype.GFS_getHudX = function() {
return 16;
}
Game_System.prototype.GFS_getHudY = function() {
return 16;
}
// -> Character
Game_Character.prototype.initialize = function() {
_aliasGFS._gamChar_init.call(this);
this.GFS_waitDash = 0;
};
// -> Can move ?
Game_Player.prototype.canMove = function() {
return _aliasGFS._gamPlay_canMov.call(this);
}
Game_Player.prototype.GFS_isStaminaOk = function() {
if($gameParty.leader().mp <= Math.floor($gameParty.leader().mmp/5) || $gameParty.leader().mp < $gameParty.leader().hp /5)
return false;
return true;
}
//-> Dash Stamina
Game_Player.prototype.GFS_updateStamina = function() {
if(this.GFS_waitDash <= 0){
var _agi = Math.round($gameParty.leader().agi/10);
if($gameParty.leader().mp <= $gameParty.leader().mmp && $gamePlayer.isDashing())
$gameParty.leader().gainMp(Math.min(-5, -7 + _agi));
else
if(!$gamePlayer.isMoving())
$gameParty.leader().gainMp(Math.max(2, Math.round(_agi / 4)));
else
$gameParty.leader().gainMp(Math.max(1, Math.round(_agi / 4)));
this.GFS_waitDash = 10;
}else
this.GFS_waitDash--;
};
//-> can Run
Game_Map.prototype.isDashDisabled = function() {
if(!$gamePlayer.GFS_isStaminaOk() || !$gameSystem.GFS_runActivate)
return true;
return _aliasGFS._gamMap_isDashDis.call(this);
};
// -> Hud
Scene_Map.prototype.GFS_getAntilagTime = function(){
return 600; //lapse de temps entre chaque rafraichisssement du hud pour eviter le lag (en frames)
}
Scene_Map.prototype.start = function() {
_aliasGFS._scenMap_star.call(this);
this.GFS_createHUD();
};
Scene_Map.prototype.GFS_createHUD = function(id) {
this._Hud1 = new GFS_Hud();
this._Hud1.opacity = 0;
this.addChild(this._Hud1);
};
Scene_Map.prototype.GFS_updateHud = function(){
if(this.GFS_waitHud == this.GFS_getAntilagTime()){
this.updateHud
this.GFS_waitHud = 0;
}else
this.GFS_waitHud++;
};
// -> draw life + stamina
Window_Base.prototype.hudLifeFillPadding = function(x, y) {
return 0;
}
Window_Base.prototype.GFS_drawGiletFill = function(x, y, width) {
var _giletValue = $gamePlayer.GFS_getPlayerArmorValue();
var _x = x - _giletValue;
var _width = width + _giletValue * 2;
var height = 6 + _giletValue * 2;
var _y = y - _giletValue;
this.contents.fillRect(_x, _y, _width, height, this.textColor(9));
};
Window_Base.prototype.GFS_drawLife = function() {
var _w = this.hudUsableWidth();
var _x = this.hudBasePadding() + this.hudLifeFillPadding();
var _y = this.hudBasePadding() + this.getInHudPosX() + this.getInHudPosY();
if($gamePlayer.GFS_getPlayerArmorValue() > 0)
this.GFS_drawGiletFill(_x, _y , _w);
this.GFS_drawLifeFill(_x, _y, _w);
this.GFS_drawStaminaFill(_x, _y, _w);
}
Window_Base.prototype.GFS_drawLifeFill = function(x, y, width) {
var color1 = this.hpGaugeColor1();
var color2 = this.hpGaugeColor2();
this.drawGauge(x, y, width, $gameParty.leader().hpRate(), color1, color2);
};
Window_Base.prototype.GFS_drawStaminaFill = function(x, y, width) {
var _width = $gameParty.leader().hpRate() * width;
var rate = $gameParty.leader().mpRate();
var _y = this.lineHeight() - 32 + y;
var fillW = Math.floor(_width * rate);
var _x = _width - fillW + 6 + x;
var color1 = this.tpGaugeColor2();
var color2 = this.tpGaugeColor1();
this.contents.gradientFillRect(_x, _y, fillW, 6, color1, color2);
};
Window_Base.prototype.GFS_drawHealthFill = function(x, y, width, height, value) {
var _h = height || 6;
var _rate = width * (value / 100);
var color1 = this.GFS_getDynamicColor(_rate + 0.1);
var color2 = this.GFS_getDynamicColor(_rate);
var fillW = Math.floor(_rate);
this.contents.fillRect(x, y-4, width, _h, this.gaugeBackColor());
this.contents.gradientFillRect(x, y-4, fillW, _h, color1, color2);
};
Window_Base.prototype.GFS_getDynamicColor = function(rate) {
if(rate > 0.8)
n = 11;
else if(rate > 0.4)
n = 3;
else if(rate > 0.2)
n = 21;
else
n = 10;
return this.textColor(n);
};
//GS HUD
function GFS_Hud(){
this.initialize.apply(this, arguments);
};
GFS_Hud.prototype = Object.create(Window_Base.prototype);
GFS_Hud.prototype.initialize = function() {
this.GFS_x = this.getOutHudPosX();
this.GFS_y = this.getOutHudPosY();
this.GFS_xDest = this.getInHudPosX();
this.GFS_yDest = this.getInHudPosY();
this.GFS_content = 0;
this.GFS_totalWidth = 228;
Window_Base.prototype.initialize.call(this, this.getInHudPosX(), this.getInHudPosY(), 275, 226);
this._padding = 0;
this.GFS_refreshCounter = 0;
this.refresh();
this.GFS_cursor = 0;
this.minimapZoom = 7;
this.expVisu = 0;
this.loadHudColorBitmap();
};
// -> getter
Window_Base.prototype.getOutHudPosX = function() {
return $gameSystem.GFS_getHudX()-100;
};
Window_Base.prototype.getOutHudPosY = function() {
return $gameSystem.GFS_getHudY();
};
Window_Base.prototype.getInHudPosX = function() {
return $gameSystem.GFS_getHudX();
};
Window_Base.prototype.getInHudPosY = function() {
return $gameSystem.GFS_getHudY();
};
// GFS HUD
// -> Refresh
GFS_Hud.prototype.GFS_counterAntiLag = function() {
if(this.GFS_refreshCounter < 4){
this.GFS_refreshCounter++;
return false;
};
this.GFS_refreshCounter = 0;
return true;
};
GFS_Hud.prototype.refresh = function() {
if($gameSystem.GFS_HudNeedRefresh() && this.GFS_counterAntiLag()){
this.contents.clear();
if($gameSystem.GFS_hudVisible() > 0)
this.visible = true;
else
this.visible = false;
this.contents.fontSize = 12;
this.opacity = 0;
this.padding = 0;
this.changeTextColor(this.systemColor());
this.refreshHud();
};
};
GFS_Hud.prototype.refreshHud = function() {
this.refreshHudChange();
this.refreshPosition();
this.refreshHudType();
};
GFS_Hud.prototype.refreshHudChange = function() {
if(this.isHudOut()){
this.visible = true;
this.GFS_cursor = 0;
this.setMoveInHud();
$gameSystem.GFS_setHudVisible($gameSystem.GFS_getHudForcedContent(), true);
}else if(this.isHudIn()){
this.setMoveOutHud();
}
};
GFS_Hud.prototype.isHudOut = function() {
return this.GFS_x == this.getOutHudPosX() && this.GFS_y == this.getOutHudPosY();
};
GFS_Hud.prototype.isHudIn = function() {
return this.GFS_x == this.getInHudPosX() && this.GFS_y == this.getInHudPosY();
};
// -> Position
GFS_Hud.prototype.refreshPosition = function() {
var _spd = this.getHudMoveSpeed();
if(this.GFS_x < this.GFS_xDest){
this.GFS_x = Math.min(_spd + this.GFS_x, this.GFS_xDest);
}
if(this.GFS_y < this.GFS_yDest){
this.GFS_y = Math.min(_spd + this.GFS_y, this.GFS_yDest);
}
if(this.GFS_x > this.GFS_xDest){
this.GFS_x = Math.max(this.GFS_x - _spd, this.GFS_xDest);
}
if(this.GFS_y > this.GFS_yDest){
this.GFS_y = Math.max(this.GFS_y - _spd, this.GFS_yDest);
}
};
GFS_Hud.prototype.getHudMoveSpeed = function() {
return 50;
};
GFS_Hud.prototype.setMoveOutHud = function() {
this.GFS_xDest = this.getOutHudPosX();
this.GFS_yDest = this.getOutHudPosY();
};
GFS_Hud.prototype.setMoveInHud = function() {
this.GFS_xDest = this.getInHudPosX();
this.GFS_yDest = this.getInHudPosY();
};
GFS_Hud.prototype.refreshHudType = function() {
this.GFS_drawLayer();
this.refreshHpFil();
};
GFS_Hud.prototype.refreshHpFil = function() {
this.GFS_drawLife();
}; |