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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
| #==============================================================================
# â– Scene_Map
#------------------------------------------------------------------------------
#  It is the class which processes the title picture
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# â— Refer setup to Scene Map
#--------------------------------------------------------------------------
alias scene_map_main main
alias scene_map_update update
#--------------------------------------------------------------------------
# â— Refers to Main
#--------------------------------------------------------------------------
def main
@on_map_diplay = Window_Mapstats.new
$ABS.display = Sprite.new
$ABS.display.bitmap = Bitmap.new(88, 48)
scene_map_main
$ABS.display.dispose
@on_map_diplay.dispose
end
#--------------------------------------------------------------------------
# â— Refers to Update
#--------------------------------------------------------------------------
def update
@on_map_diplay.update
$ABS.update
if Input.trigger?(Input::L)
# Player Attack
if $ABS.player_defending == false
$ABS.player_melee_preconditions
end
end
if Input.press?(Input::R)
# Player Shield Active
$ABS.player_defending= true
else
# Player Sheild Disactive
$ABS.player_defending = false
end
if Input.trigger?(Input::X)
# Player Skill Hot Key 1
$ABS.player_skill_preconditions(1)
end
if Input.trigger?(Input::Y)
# Player Skill Hot Key 2
$ABS.player_skill_preconditions(2)
end
if Input.trigger?(Input::Z)
# Player Skill Hot Key 3
$ABS.player_skill_preconditions(3)
end
scene_map_update
end
end
#==============================================================================
# Window_Base
#------------------------------------------------------------------------------
# Adds Draw line function, Draw Hp, Draw Sp, Draw Exp,
# Adds Draw Actors Battler, Refines Draw Text Actors Level
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# â— The drawing of HP
# actor : actor
# x : Ahead drawing X coordinate
# y : Ahead drawing Y-coordinate
# width : Width ahead drawing
#--------------------------------------------------------------------------
def draw_actor_hp_text(actor, x, y, width = 144)
# Character string "HP" It draws
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
# Calculates is a space which draws MaxHP
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
# Drawing HP
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 40, 32, actor.hp.to_s, 2)
# Drawing MaxHP
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 40, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 52, y, 48, 32, actor.maxhp.to_s)
end
end
#--------------------------------------------------------------------------
# â— The drawing of SP
# actor : actor
# x : Ahead drawing X coordinate
# y : Ahead drawing Y-coordinate
# width : Width ahead drawing
#--------------------------------------------------------------------------
def draw_actor_sp_text(actor, x, y, width = 144)
# Character string "sP" It draws
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
# Calculates is a space which draws MaxSP
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
# Drawing HP
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 40, 32, actor.sp.to_s, 2)
# Drawing MaxHP
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 40, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 52, y, 48, 32, actor.maxsp.to_s)
end
end
#--------------------------------------------------------------------------
# â— Draws Actors Hp meter
#--------------------------------------------------------------------------
def draw_actor_hp_bar(actor, x, y, width = 100, height = 10, bar_color = Color.new(255, 0, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.hp / actor.maxhp
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Draws Actors Sp meter
#--------------------------------------------------------------------------
def draw_actor_sp_bar(actor, x, y, width = 100, height = 10, bar_color = Color.new(0, 0, 255, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.sp / actor.maxsp
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Draws Actors Exp meter
#--------------------------------------------------------------------------
def draw_actor_exp_bar(actor, x, y, width = 100, height = 10, bar_color = Color.new(255, 255, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
if actor.level == 99
w = 0
else
w = width * actor.exp / actor.next_exp_s.to_f
end
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Draws Actors Str meter
#--------------------------------------------------------------------------
def draw_actor_str_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(255, 0, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.str / 999
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Draws Actors Dex meter
#--------------------------------------------------------------------------
def draw_actor_dex_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(0, 255, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.dex / 999
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Draws Actors Agi meter
#--------------------------------------------------------------------------
def draw_actor_agi_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(0, 0, 255, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.agi / 999
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Draws Actors Int meter
#--------------------------------------------------------------------------
def draw_actor_int_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(180, 100, 200, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.int / 999
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Draws Dash Power bar
#--------------------------------------------------------------------------
def draw_dash_bar(x, y, width = 50, height = 10)
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
case $ABS.dash_level
when 0 .. 1
bar_color = Color.new(255, 0, 0, 255)
when 2 .. 3
bar_color = Color.new(255, 255, 0, 255)
else
bar_color = Color.new(0, 255, 0, 255)
end
w = width * $ABS.dash_level / 5
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Draws Actors Battler
#--------------------------------------------------------------------------
def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(actor.character_name, actor.character_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
end
#==============================================================================
# â– On Map Display
#------------------------------------------------------------------------------
# Displayes curent player stats to the window
#=============================================================================
class Window_Mapstats < Window_Base
#--------------------------------------------------------------------------
# â— Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 400, 640, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $fontsize
self.back_opacity = 125
# self.opacity = 0
update
end
#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def refresh
self.contents.clear
actor = $game_party.actors[$ABS.active_actor]
draw_actor_graphic(actor, 10, 45) # draws the actor graphic
draw_actor_name(actor, 30, -5) #draws the actors name
draw_actor_level(actor, 30, 15) #draws the actor level
draw_actor_hp_text(actor, 110, -5) #draws the actors hp
draw_actor_hp_bar(actor, 260, 5) #draws the actors hp bar
draw_actor_sp_text(actor,110, 15) #draws the actors sp
draw_actor_sp_bar(actor, 260, 27) #draws the actors sp bar
draw_dash_bar(375, 27) #draws the dash level bar
self.contents.draw_text(377, -5, 120, 32, "Dash")
end
#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def update
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# â– Scene_Title
#------------------------------------------------------------------------------
#  It is the class which processes the title picture
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# â— Refer setup to Scene Title
#--------------------------------------------------------------------------
alias scene_title_update update
#--------------------------------------------------------------------------
# â— Loads Event names
#--------------------------------------------------------------------------
def update
$ABS = Action_Battle_System.new
scene_title_update
end
end
#==============================================================================
# â– Game_Map
#------------------------------------------------------------------------------
#  Add defenision of the names to Game Map Class
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# â— Refer setup to Game Map
#--------------------------------------------------------------------------
attr_accessor :map
alias game_map_setup setup
#--------------------------------------------------------------------------
# â— Refers the Map Setup
#--------------------------------------------------------------------------
def setup(map_id)
game_map_setup(map_id)
$ABS.enemy_setup
end
end
#==============================================================================
# â– Game_Character
#------------------------------------------------------------------------------
#  Add move_type to the accessor adderse
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# â— Open instance variable
#--------------------------------------------------------------------------
attr_accessor :move_type
attr_accessor :move_speed
attr_accessor :move_frequency
attr_accessor :character_name
end
#==============================================================================
# â– Scene_Skill
#------------------------------------------------------------------------------
#  It is the class which processes the skill picture.
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# â— Object initialization
# actor_index : Actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# â— Main processing
#--------------------------------------------------------------------------
def main
# Acquiring the actor
@actor = $game_party.actors[@actor_index]
# Drawing up the help window, the status window and the skill window
@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)
# Help window association
@skill_window.help_window = @help_window
# Target window compilation (invisibility non actively setting)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# Skill Hot Key Window
@shk_window = Window_Command.new(250, ["Skill Assigned to Hot Key"])
@shk_window.visible = false
@shk_window.active = false
@shk_window.x = 200
@shk_window.y = 250
@shk_window.z = 1500
# Transition execution
Graphics.transition
# Main loop
loop do
# Renewing the game picture
Graphics.update
# Updating the information of input
Input.update
# Frame renewal
update
# When the picture changes, discontinuing the loop
if $scene != self
break
end
end
# Transition preparation
Graphics.freeze
# Releasing the window
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
@shk_window.dispose
end
#--------------------------------------------------------------------------
# â— Frame renewal
#--------------------------------------------------------------------------
def update
# Renewing the windows
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
@shk_window.update
# When the skill window is active: Update_skill is called
if @skill_window.active
update_skill
return
end
# When the target window is active: Update_target is called
if @target_window.active
update_target
return
end
# When the skill_hot_key window is active: Update_shk is called
if @shk_window.active
update_shk
return
end
end
#--------------------------------------------------------------------------
# â— When frame renewal (the skill window is active)
#--------------------------------------------------------------------------
def update_skill
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Change to menu screen
$scene = Scene_Menu.new(1)
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# Acquiring the data which presently is selected in the skill window
@skill = @skill_window.skill
# When you cannot use,
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# When the effective range takes part,
if @skill.scope >= 3
# Active conversion target window
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Setting cursor position the effective range (the single unit/the whole) according to
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
# When the effective range is other than taking part,
else
# When common event ID is effective,
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# When using the skill performing SE
$game_system.se_play(@skill.menu_se)
#SP consumption
@actor.sp -= @skill.sp_cost
# Rewriting the contents of each window
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# Change to map picture
$scene = Scene_Map.new
return
end
end
return
end
# When X button is pushed,
if Input.trigger?(Input::X)
# Performing decision SE
$game_system.se_play($data_system.decision_se)
@skill_window.active = false
@shk_window.active = true
@shk_window.visible = true
$ABS.skill_hot_key[1] = @skill_window.skill.id
end
#The Y when button is pushed,
if Input.trigger?(Input::Y)
# Performing decision SE
$game_system.se_play($data_system.decision_se)
@skill_window.active = false
@shk_window.active = true
@shk_window.visible = true
$ABS.skill_hot_key[2] = @skill_window.skill.id
end
# The Z when button is pushed,
if Input.trigger?(Input::Z)
# Performing decision SE
$game_system.se_play($data_system.decision_se)
@skill_window.active = false
@shk_window.active = true
@shk_window.visible = true
$ABS.skill_hot_key[3] = @skill_window.skill.id
end
# The R when button is pushed,
if Input.trigger?(Input::R)
# Performing cursor SE
$game_system.se_play($data_system.cursor_se)
# To the following actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Change to another skill picture
$scene = Scene_Skill.new(@actor_index)
return
end
#The L when button is pushed,
if Input.trigger?(Input::L)
# Performing cursor SE
$game_system.se_play($data_system.cursor_se)
# To actor before
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Change to another skill picture
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# â— When frame renewal (the shk window is active)
#--------------------------------------------------------------------------
def update_shk
# The C when button is pushed,
if Input.trigger?(Input::C)
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Reset Skill hot key window
@shk_window.active = false
@shk_window.visible = false
@skill_window.active = true
#Change to menu screen
$scene = Scene_Skill.new(@actor_index)
return
end
end
end |