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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
| ################################################################################
################################# CODE CRUSH ###################################
################################################################################
=begin
BP SYSTEM
--------------------------------------------------------------------------------
Script créés par Claimh.
Version - 2.1.0
--------------------------------------------------------------------------------
CARACTERISTIQUES
Ajoute un système de restriction par BP
Des BP sont nécessaires en plus des SP pour utiliser les capacités
Les BP ne peuvent être récupéré avec des objets, ils sont récupéré automatiquement
à la fin de chaque tour de façon similaire à Wild Arms
MODIFICATION
=end
#-------------------------------------------------------------------------------
module SysSkill_BP
# Usar o custo SP.
BATTLE_SP_USE = true
# Ativar a janela de BP.
WINDOW_BP_USE = true
# Ativar o valor do BP por ícones.
USE_BP_ICON = false
# Nome do arquivo BP.
BP_ICON = "036-Item05"
SKILL_BP = {
# Definição do custo de BP para cada habilidade.
#
# A => B
#----------------------------------
# A = ID du sort.
# B = BP nécéssaire.
#----------------------------------
1 => 2, 2 => 5, 3 =>7,
4 => 2, 5 => 5,
6 => 5,
7 => 2, 8 => 4, 9 => 6,
10 => 2, 11 => 4, 12 => 6,
13 => 2, 14 => 4, 15 => 6,
16 => 2, 17 => 4, 18 => 6,
19 => 2, 20 => 4, 21 => 6,
22 => 2, 23 => 4, 24 => 6,
25 => 2, 26 => 4, 27 => 6,
28 => 2, 29 => 4, 30 => 6,
31 => 3, 32 => 7,
33 => 1, 34 => 4,
35 => 1, 36 => 4,
37 => 1, 38 => 4,
39 => 1, 40 => 4,
41 => 1, 42 => 4,
43 => 1, 44 => 4,
45 => 1, 46 => 4,
47 => 1, 48 => 4,
49 => 1, 50 => 4,
51 => 1, 52 => 4,
53 => 3, 54 => 3, 55 => 3, 56 => 3,
57 => 2, 58 => 4, 59 => 6, 60 => 9,
61 => 2, 62 => 4, 63 => 6, 64 => 9,
65 => 2, 66 => 4, 67 => 6, 68 => 9,
69 => 2, 70 => 4, 71 => 6, 72 => 9,
73 => 2, 74 => 4, 75 => 6, 76 => 9,
77 => 2, 78 => 4, 79 => 6, 80 => 9
}
# Definição dos parí¢metros iniciais de BP para cada personagem.
ACT_BP = {
#------------------------------------------------------
# A => [B, C, D]
#------------------------------------------------------
# A = ID do personagem.
# B = Quantité de BP d'origine du personnage.
# C = Quantité de BP maximum du personnage.
# D = Quantité de BP récupéré quand un tour passe.
#------------------------------------------------------
1 => [5, 10, 3],
2 => [4, 9, 4],
3 => [2, 13, 3],
4 => [4, 9, 2],
5 => [2, 10, 4],
6 => [3, 10, 2],
7 => [4, 12, 3],
8 => [4, 15, 2]
}
# Definindo em que Level o personagem aumentará o valor inicial de BP.
ACT_INIT_BP_LVUP = {
#------------------------------------------------------
# A => [B,B,B,B,B,B],
#------------------------------------------------------
# A = ID do personagem.
# B = Level
1 => [5,10,15,25,30,40],
2 => [5,10,15,25,30,40],
3 => [5,10,15,25,30,40],
4 => [5,10,15,25,30,40],
5 => [5,10,15,25,30,40],
6 => [5,10,15,25,30,40],
7 => [5,10,15,25,30,40],
8 => [5,10,15,25,30,40]
}
# Definindo em que Level o personagem aumentará o valor maximo de BP.
ACT_MAX_BP_LVUP = {
#------------------------------------------------------
# A => [B,B,B,B,B,B],
#------------------------------------------------------
# A = ID do personagem.
# B = Level
1 => [5,10,15,25,30,40],
2 => [5,10,15,25,30,40],
3 => [5,10,15,25,30,40],
4 => [5,10,15,25,30,40],
5 => [5,10,15,25,30,40],
6 => [5,10,15,25,30,40],
7 => [5,10,15,25,30,40],
8 => [5,10,15,25,30,40]
}
# Definindo em que Level o personagem aumentará o valor de BP ganho por turno.
ACT_REST_BP_LVUP = {
#------------------------------------------------------
# A => [B,B,B,B,B,B],
#------------------------------------------------------
# A = ID do personagem.
# B = Level
1 => [5,10,15,25,30,40],
2 => [5,10,15,25,30,40],
3 => [5,10,15,25,30,40],
4 => [5,10,15,25,30,40],
5 => [5,10,15,25,30,40],
6 => [5,10,15,25,30,40],
7 => [5,10,15,25,30,40],
8 => [5,10,15,25,30,40]
}
end
#-------------------------------------------------------------------------------
class Game_Actor
attr_accessor :bp
attr_accessor :init_bp
attr_accessor :max_bp
attr_accessor :rest_bp
alias initialize_use_limit initialize
def initialize(actor_id)
initialize_use_limit(actor_id)
act_bp = SysSkill_BP::ACT_BP[actor_id]
@bp = act_bp[0]
@init_bp = act_bp[0]
@max_bp = act_bp[1]
@rest_bp = act_bp[2]
end
alias exp_bp= exp=
def exp=(exp)
cp_level = @level
self.exp_bp = exp
if cp_level < @level
counter_num = 1
elsif cp_level > @level
counter_num = -1
else
return
end
for lv_index in cp_level...@level
if SysSkill_BP::ACT_INIT_BP_LVUP[self.id].include?(lv_index)
@init_bp += counter_num
end
if SysSkill_BP::ACT_MAX_BP_LVUP[self.id].include?(lv_index)
@max_bp += counter_num
end
if SysSkill_BP::ACT_REST_BP_LVUP[self.id].include?(lv_index)
@rest_bp += counter_num
end
end
end
end
class Game_Battler
alias skill_limit_can_use? skill_can_use?
def skill_can_use?(skill_id)
ret = skill_limit_can_use?(skill_id)
if self.is_a?(Game_Actor) and $scene.is_a?(Scene_Battle)
bp = SysSkill_BP::SKILL_BP[skill_id]
skill_bp = ( bp == nil ? 1 : bp)
if ret
if self.bp < skill_bp
return false
end
else
if !SysSkill_BP::BATTLE_SP_USE
if $data_skills[skill_id].sp_cost > self.sp
cp_sp = $data_skills[skill_id].sp_cost.dup
$data_skills[skill_id].sp_cost = 0
ret_sp = skill_limit_can_use?(skill_id)
$data_skills[skill_id].sp_cost = cp_sp
if ret_sp
if self.bp < skill_bp
# if FlashSystem::FLASH_COST and self.flash_flg
# return true
# end
return false
end
end
end
end
end
end
return ret
end
end
class Scene_Battle
alias main_use_limit main
def main
for i in 0..$game_party.actors.size-1
actor = $game_party.actors[i]
actor.bp = actor.init_bp
end
main_use_limit
end
alias start_skill_select_limit start_skill_select
def start_skill_select
start_skill_select_limit
if SysSkill_BP::WINDOW_BP_USE
@actor_bp_window = Window_Battle_Point.new
@actor_bp_window.x = @actor_index * 160
@actor_bp_window.y = 300
@actor_bp_window.back_opacity =160
@actor_bp_window.set_actor_bp(@active_battler)
end
end
alias end_skill_select_limit end_skill_select
def end_skill_select
if SysSkill_BP::WINDOW_BP_USE
@actor_bp_window.dispose
@actor_bp_window = nil
end
end_skill_select_limit
end
alias make_skill_action_result_limit make_skill_action_result
def make_skill_action_result
make_skill_action_result_limit
if @active_battler.is_a?(Game_Actor)
bp = SysSkill_BP::SKILL_BP[@skill.id]
skill_bp = (bp==nil ? 1 : bp)
@active_battler.bp -= skill_bp
if !SysSkill_BP::BATTLE_SP_USE
@active_battler.sp += @skill.sp_cost
end
end
end
alias update_phase4_step6_limit update_phase4_step6
def update_phase4_step6
update_phase4_step6_limit
if @active_battler.is_a?(Game_Actor)
@active_battler.bp += @active_battler.rest_bp
if @active_battler.bp > @active_battler.max_bp
@active_battler.bp = @active_battler.max_bp
end
end
end
end
class Window_Base < Window
def draw_actor_bp(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "BP")
width = 144
if width - 32 >= 108
sp_x = x + width - 124
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.bp == 0 ? knockout_color :
actor.bp <= actor.max_bp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 36, 32, actor.bp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 36, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 48, y, 48, 32, actor.max_bp.to_s)
self.contents.font.color = knockout_color
self.contents.draw_text(sp_x + 72, y, 12, 32, "+", 1)
self.contents.draw_text(sp_x + 84, y, 48, 32, actor.rest_bp.to_s)
self.contents.font.color = normal_color
end
end
def draw_actor_bp_icon(actor, x, y)
bitmap = RPG::Cache.icon(SysSkill_BP::BP_ICON)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
for i in 0...actor.bp
self.contents.blt(x + cw - bitmap.width, y - ch + 30, bitmap, src_rect)
cw += bitmap.width
end
end
end
class Window_Battle_Point < Window_Base
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
end
def set_actor_bp(actor)
if SysSkill_BP::USE_BP_ICON
draw_actor_bp_icon(actor, 4, 0)
else
draw_actor_bp(actor, 4, 0)
end
end
end
#==============================================================================
# ? Window_Skill
#==============================================================================
class Window_Skill < Window_Selectable
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
if SysSkill_BP::BATTLE_SP_USE
self.contents.draw_text(x + 196, y, 48, 32, skill.sp_cost.to_s, 2)
end
bp = SysSkill_BP::SKILL_BP[skill.id]
skill_bp = (bp == nil ? 1 : bp)
self.contents.font.color = crisis_color
self.contents.draw_text(x + 232, y, 48, 32, skill_bp.to_s, 2)
end
end
#==============================================================================
# ? Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor_x = i * 160 + 4
draw_actor_name(actor, actor_x, 0)
if SysSkill_BP::BATTLE_SP_USE
draw_actor_hp(actor, actor_x, 30, 120)
draw_actor_sp(actor, actor_x, 50, 120)
else
draw_actor_hp(actor, actor_x, 32, 120)
end
if SysSkill_BP::BATTLE_SP_USE
bp_y = 70
else
bp_y = 64
end
if SysSkill_BP::USE_BP_ICON
draw_actor_bp_icon(actor, actor_x, bp_y)
else
draw_actor_bp(actor, actor_x, bp_y)
end
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
end |