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
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
| ########################################################################################
# Resident Evil 2/3 Menu v. 2.0 by Alucard_2
#
########################################################################################
# Feito por Alucard_2
#
########################################################################################
# Créditos para Alucard_2(criador) e para br_lemes(que me ensinou RGSS2 um pouco mais)
#
#--------------------------------------------------------------------------------------
#
# IMPORTANTE: Ao colocar este script em outro forum/site/outros, favor dar os créditos!
#
########################################################################################
#####################
# Window_MenuStatus #
#####################
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# Inicialização do objeto
# x : coordenada X da janela
# y : coordenada Y da janela
#--------------------------------------------------------------------------
def initialize(x, y)
super(0, 112, 544, 248)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# Atualização
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = 1
draw_actor_state($game_party.members[0], x, y)
end
end
#--------------------------------------------------------------------------
# Atualização do cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # Sem cursor
self.cursor_rect.empty
elsif @index < @item_max # Padrão
self.cursor_rect.set(0, @index * 96, contents.width, 96)
elsif @index >= 100 # Si
self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
else # O todo
self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
end
end
#--------------------------------------------------------------------------
# Desenha a experiência
#--------------------------------------------------------------------------
def draw_exp_info(actor, x, y)
s1 = actor.exp_s
s2 = actor.next_rest_exp_s
s_next = sprintf(Vocab::ExpNext, Vocab::level)
self.contents.font.color = system_color
self.contents.draw_text(x, y + 24 * 0, 180, 24, Vocab::ExpTotal)
self.contents.draw_text(x, y + 24 * 2, 180, 24, s_next)
self.contents.font.color = normal_color
self.contents.draw_text(x, y + 24 * 1, 180, 24, s1, 2)
self.contents.draw_text(x, y + 24 * 3, 180, 24, s2, 2)
end
###################
# Window_exp_info #
###################
class Window_exp_info < Window_Selectable
#--------------------------------------------------------------------------
# Inicialização do objeto
# x : coordenada X da janela
# y : coordenada Y da janela
#--------------------------------------------------------------------------
def initialize(x, y)
super(0, 360, 544, 305)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# Atualização
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = 1
x = 104
y = actor.index * 96 + WLH / 2
draw_exp_info($game_party.members[0], 0, 0)
end
end
#--------------------------------------------------------------------------
# Atualização do cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # Sem cursor
self.cursor_rect.empty
elsif @index < @item_max # Padrão
self.cursor_rect.set(0, @index * 96, contents.width, 96)
elsif @index >= 100 # Si
self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
else # O todo
self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
end
end
################
# Window_Actor #
################
class Window_Actor < Window_Base
def initialize(x, y, width, height)
super(x, y, width, height)
refresh
end
def dispose
super
end
def update
super
end
def refresh
self.contents.clear
@item_max = 1
draw_actor_face($game_party.members[0], 0, 20, 92)
draw_actor_name($game_party.members[0], 15, 0)
end
end
###################
# Window_Actor_HP #
###################
class Window_Actor_HP < Window_Base
def initialize(x, y, width, height)
super(x, y, width, height)
refresh
end
def dispose
super
end
def update
super
end
def refresh
self.contents.clear
@item_max = 1
draw_actor_hp($game_party.members[0], 15, 0)
draw_state(80, 0)
end
end
###################
# Window_Actor_MP #
###################
class Window_Actor_MP < Window_Base
def initialize(x, y, width, height)
super(x, y, width, height)
refresh
end
def dispose
super
end
def update
super
end
def refresh
self.contents.clear
@item_max = 1
draw_actor_mp($game_party.members[0], 15, 0)
end
end
def draw_state(x, y)
@item_max = 1
draw_actor_state($game_party.members[0], 150, 0)
end
##############
# Scene_Menu #
##############
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# Inicialização do objeto
# menu_index : posição inicial do cursor
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# Inicialização do processo
#--------------------------------------------------------------------------
def start
super
create_command_window
@gold_window = Window_Gold.new(0, 360)
@status2_window = Window_Status.new($game_party.members[0])
@actor_window = Window_Actor.new(0, 0, 120, 140)
@hp_window = Window_Actor_HP.new(120, 56, 224, 56)
@mp_window = Window_Actor_MP.new(344, 56, 200, 56)
end
#--------------------------------------------------------------------------
# Fim do processo
#--------------------------------------------------------------------------
def terminate
super
@command_window.dispose
@gold_window.dispose
@actor_window.dispose
@hp_window.dispose
@mp_window.dispose
@status2_window.dispose
end
#--------------------------------------------------------------------------
# Atualização da tela
#--------------------------------------------------------------------------
def update
super
@command_window.update
@gold_window.update
@hp_window.update
@mp_window.update
@actor_window.update
@status2_window.update
if @command_window.active
update_command_selection
elsif @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# Criação da janela de comandos
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::equip
s2 = Vocab::skill
s3 = Vocab::item
s4 = Vocab::game_end
@command_window = Window_Command.new(160, [s1, s2, s3, s4])
@command_window.index = @menu_index
if $game_party.members.size == 0 # Se não houver membros na equipe
@command_window.draw_item(0, false) # Desabilita "Equipamentos"
@command_window.draw_item(1, false) # Desabilita "Habilidades"
@command_window.draw_item(2, false) # Desabilita "Itens"
end
end
#--------------------------------------------------------------------------
# Atualização da escolha de comando
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # Equipamentos
$scene = Scene_Equip.new
when 1 # Habilidades
$scene = Scene_Skill.new
when 2 # Salvar
$scene = Scene_Item.new
when 3 # Fim de Jogo
$scene = Scene_End.new
end
end
end
#--------------------------------------------------------------------------
# Início da seleção de herói
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# Fim da seleção de herói
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
#--------------------------------------------------------------------------
# Atualização da seleção de herói
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when 1 # Habilidades
$scene = Scene_Skill.new(@status_window.index)
when 2 # Equipamento
$scene = Scene_Equip.new(@status_window.index)
when 3 # Status
$scene = Scene_Status.new(@status_window.index)
end
end
end
end
###################
# Window_Actor_LV #
###################
class Window_Actor_LV < Window_Base
def initialize(x, y, width, height)
super(x, y, width, height)
refresh
end
def dispose
super
end
def update
super
end
def refresh
self.contents.clear
@item_max = 1
draw_actor_level($game_party.members[0], 20, 0)
end
end
#################
# Window_Status #
#################
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# Inicialização do objeto
# actor : herói
#--------------------------------------------------------------------------
def initialize(actor)
super(330, 112, 213, 248)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# Atualização
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = 1
draw_equipments(0, 0)
end
#--------------------------------------------------------------------------
# Exibição dos parâmetros
# x : exibe na coordenada X
# y : exibe na coordenada Y
#--------------------------------------------------------------------------
def draw_parameters(actor, x, y)
@item_max = 1
x = 0
y = 10
draw_actor_parameter($game_party.members[0], x, y, 0)
draw_actor_parameter($game_party.members[0], x, y+30, 1)
draw_actor_parameter($game_party.members[0], x, y+60, 2)
draw_actor_parameter($game_party.members[0], x, y+90, 3)
end
#--------------------------------------------------------------------------
# Exibição da experiência
# x : exibe na coordenada X
# y : exibe na coordenada Y
#--------------------------------------------------------------------------
def draw_exp_info(x, y)
@actor = $game_party.members[0]
s1 = @actor.exp_s
s2 = @actor.next_rest_exp_s
s_next = sprintf(Vocab::ExpNext, Vocab::level)
self.contents.font.color = system_color
self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)
self.contents.font.color = normal_color
self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2)
self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2)
end
#--------------------------------------------------------------------------
# Exibição de informações básicas
# x : exibe na coordenada X
# y : exibe na coordenada Y
#--------------------------------------------------------------------------
def draw_state(x, y)
@item_max = 1
x = 104
y = actor.index * 96 + WLH / 2
draw_actor_state($game_party.members[0], 10, 10)
end
#--------------------------------------------------------------------------
# Exibição dos equipamentos
# x : exibe na coordenada X
# y : exibe na coordenada Y
#--------------------------------------------------------------------------
def draw_equipments(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 24, Vocab::equip)
for i in 0..4
draw_item_name($game_party.members[0].equips[i], x + 16, y + WLH * (i + 1))
end
end
end
##################
# Window_Command #
##################
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# Variáveis públicas
#--------------------------------------------------------------------------
attr_reader :commands # Comandos
#--------------------------------------------------------------------------
# Inicialização do objeto
# width : largura da janela
# commands : array de comandos
# column_max : número de colunas (2 ou mais)
# row_max : número de linhas (0: número de comandos)
# spacing : espaçamento entre items localizados próximos
#--------------------------------------------------------------------------
def initialize(width, commands, column_max = 4, row_max = 0, spacing = 10)
if row_max == 0
row_max = (commands.size + column_max - 1) / column_max
end
super(240, 0, 300, row_max * WLH + 32, spacing)
@commands = commands
@item_max = commands.size
@column_max = column_max
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# Atualização
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# Desenho do item
# index : número (ID) do item
# enabled : espaço ativo. Quando translúcido significa falso
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index])
end
end
###############
# Scene_Equip #
###############
class Scene_Equip < Scene_Base
#--------------------------------------------------------------------------
# Constantes
#--------------------------------------------------------------------------
EQUIP_TYPE_MAX = 5 # Número máximo de equipamentos
#--------------------------------------------------------------------------
# Inicialização do objeto
# actor_index : index do herói
# equip_index : index dos equipamentos
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#--------------------------------------------------------------------------
# Inicialização do processo
#--------------------------------------------------------------------------
def start
super
@actor = $game_party.members[@actor_index]
create_item_windows
@equip_window = Window_Equip.new(120, 112, @actor)
@equip_window.help_window = @help_window
@equip_window.index = @equip_index
@hp_window = Window_Actor_HP.new(120, 56, 224, 56)
@mp_window = Window_Actor_MP.new(344, 56, 200, 56)
@actor_window = Window_Actor.new(0, 0, 120, 140)
@wrong_commands = Window_Wrong_Commands.new(240, 0, 300, 56)
end
#--------------------------------------------------------------------------
# Fim do processo
#--------------------------------------------------------------------------
def terminate
super
@actor_window.dispose
@equip_window.dispose
dispose_item_windows
@hp_window.dispose
@mp_window.dispose
@wrong_commands.dispose
end
#--------------------------------------------------------------------------
# Retornar à tela original
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(0)
end
#--------------------------------------------------------------------------
# Troca para a tela do próximo herói
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Equip.new(@actor_index, @equip_window.index)
end
#--------------------------------------------------------------------------
# Troca para a tela do herói anterior
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Equip.new(@actor_index, @equip_window.index)
end
#--------------------------------------------------------------------------
# Atualização da tela
#--------------------------------------------------------------------------
def update
super
@actor_window.update
update_equip_window
update_item_windows
@hp_window.update
@mp_window.update
@wrong_commands.update
if @equip_window.active
update_equip_selection
elsif @item_window.active
update_item_selection
end
end
#--------------------------------------------------------------------------
# Criação das janelas de itens
#--------------------------------------------------------------------------
def create_item_windows
@item_windows = []
for i in 0...EQUIP_TYPE_MAX
@item_windows[i] = Window_EquipItem.new(0, 264, 544, 152, @actor, i)
@item_windows[i].help_window = @help_window
@item_windows[i].visible = (@equip_index == i)
@item_windows[i].y = 264
@item_windows[i].height = 152
@item_windows[i].active = false
@item_windows[i].index = -1
end
end
#--------------------------------------------------------------------------
# Dispose das janelas de itens
#--------------------------------------------------------------------------
def dispose_item_windows
for window in @item_windows
window.dispose
end
end
#--------------------------------------------------------------------------
# Atualização das janelas de itens
#--------------------------------------------------------------------------
def update_item_windows
for i in 0...EQUIP_TYPE_MAX
@item_windows[i].visible = (@equip_window.index == i)
@item_windows[i].update
end
@item_window = @item_windows[@equip_window.index]
end
#--------------------------------------------------------------------------
# Atualização da janela de equipamentos
#--------------------------------------------------------------------------
def update_equip_window
@equip_window.update
end
#--------------------------------------------------------------------------
# Atualização da janela de status
#--------------------------------------------------------------------------
def update_status_window
if @equip_window.active
@status_window.set_new_parameters(nil, nil, nil, nil)
elsif @item_window.active
temp_actor = @actor.clone
temp_actor.change_equip(@equip_window.index, @item_window.item, true)
new_atk = temp_actor.atk
new_def = temp_actor.def
new_spi = temp_actor.spi
new_agi = temp_actor.agi
@status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
end
@status_window.update
end
#--------------------------------------------------------------------------
# Atualização da seleção de equipamentos
#--------------------------------------------------------------------------
def update_equip_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
if @actor.fix_equipment
Sound.play_buzzer
else
Sound.play_decision
@equip_window.active = false
@item_window.active = true
@item_window.index = 0
end
end
end
#--------------------------------------------------------------------------
# Atualização da seleção de itens
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
elsif Input.trigger?(Input::C)
Sound.play_equip
@actor.change_equip(@equip_window.index, @item_window.item)
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
@equip_window.refresh
for item_window in @item_windows
item_window.refresh
end
end
end
end
#########################
# Window_Wrong_Commands #
#########################
class Window_Wrong_Commands < Window_Base
def initialize(x, y, width, heigth)
super
refresh
end
def dispose
super
end
def update
super
end
#--------------------------------------------------------------------------
# Atualização
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(50, 0, self.width - 32, WLH, "Equipamentos")
end
end
class Window_Wrong_Commands_Skill < Window_Base
def initialize(x, y, width, height)
super
refresh
end
def dispose
super
end
def update
super
end
def refresh
self.contents.clear
self.contents.draw_text(50, 0, self.width - 32, WLH, "Habilidades")
end
end
class Window_Wrong_Commands_Itens < Window_Base
def initialize(x, y, width, height)
super
refresh
end
def dispose
super
end
def update
super
end
def refresh
self.contents.clear
self.contents.draw_text(50, 0, self.width - 32, WLH, "Inventário")
end
end
class Window_Wrong_Commands_Sair < Window_Base
def initialize(x, y, width, height)
super
refresh
end
def dispose
super
end
def update
super
end
def refresh
self.contents.clear
self.contents.draw_text(50, 0, self.width - 32, WLH, "Sair do Jogo")
end
end
##############
# Scene_Item #
##############
class Scene_Item < Scene_Base
#--------------------------------------------------------------------------
# Inicialização do processo
#--------------------------------------------------------------------------
def start
super
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.y = 360
@help_window.viewport = @viewport
@item_window = Window_Item.new(0, 112, 544, 248)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.active = false
@target_window = Window_MenuStatus.new(0, 0)
hide_target_window
@Window_Wrong_Commands_Itens = Window_Wrong_Commands_Itens.new(240, 0, 300, 56)
@hp_window = Window_Actor_HP.new(120, 56, 224, 56)
@mp_window = Window_Actor_MP.new(344, 56, 200, 56)
@actor_window = Window_Actor.new(0, 0, 120, 140)
end
#--------------------------------------------------------------------------
# Fim do processo
#--------------------------------------------------------------------------
def terminate
super
@viewport.dispose
@help_window.dispose
@item_window.dispose
@target_window.dispose
@Window_Wrong_Commands_Itens.dispose
@hp_window.dispose
@mp_window.dispose
@actor_window.dispose
end
#--------------------------------------------------------------------------
# Retornar à tela original
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(2)
end
#--------------------------------------------------------------------------
# Atualização da tela
#--------------------------------------------------------------------------
def update
super
@help_window.update
@item_window.update
@target_window.update
@Window_Wrong_Commands_Itens.update
@hp_window.update
@mp_window.update
@actor_window.update
if @item_window.active
update_item_selection
elsif @target_window.active
update_target_selection
end
end
#--------------------------------------------------------------------------
# Atualização da seleção de items
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
@item = @item_window.item
if @item != nil
$game_party.last_item_id = @item.id
end
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# Decisão de item
#--------------------------------------------------------------------------
def determine_item
if @item.for_friend?
show_target_window(@item_window.index % 2 == 0)
if @item.for_all?
@target_window.index = 99
else
if $game_party.last_target_index < @target_window.item_max
@target_window.index = $game_party.last_target_index
else
@target_window.index = 0
end
end
else
use_item_nontarget
end
end
#--------------------------------------------------------------------------
# Atualização da seleção de alvo
#--------------------------------------------------------------------------
def update_target_selection
if Input.trigger?(Input::B)
Sound.play_cancel
if $game_party.item_number(@item) == 0 # Se usar itens até 0
@item_window.refresh # Atualizar janela
end
hide_target_window
elsif Input.trigger?(Input::C)
if not $game_party.item_can_use?(@item)
Sound.play_buzzer
else
determine_target
end
end
end
#--------------------------------------------------------------------------
# Definição do alvo
# Se não houver efeito, tocar SE de erro.
#--------------------------------------------------------------------------
def determine_target
used = false
if @item.for_all?
for target in $game_party.members
target.item_effect(target, @item)
used = true unless target.skipped
end
else
$game_party.last_target_index = @target_window.index
target = $game_party.members[@target_window.index]
target.item_effect(target, @item)
used = true unless target.skipped
end
if used
use_item_nontarget
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# Exibição da janela de alvo
# right : alinhado à direita (falso se esquerda)
#--------------------------------------------------------------------------
def show_target_window(right)
@item_window.active = false
width_remain = 544 - @target_window.width
@target_window.x = right ? width_remain : 0
@target_window.visible = true
@target_window.active = true
if right
@viewport.rect.set(0, 0, width_remain, 416)
@viewport.ox = 0
else
@viewport.rect.set(@target_window.width, 0, width_remain, 416)
@viewport.ox = @target_window.width
end
end
#--------------------------------------------------------------------------
# Ocultar janela de alvo
#--------------------------------------------------------------------------
def hide_target_window
@item_window.active = true
@target_window.visible = false
@target_window.active = false
@viewport.rect.set(0, 0, 544, 416)
@viewport.ox = 0
end
#--------------------------------------------------------------------------
# Uso de item (sem alvo)
#--------------------------------------------------------------------------
def use_item_nontarget
Sound.play_use_item
$game_party.consume_item(@item)
@item_window.draw_item(@item_window.index)
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
elsif @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
end
end
end
###############
# Scene_Skill #
###############
class Scene_Skill < Scene_Base
#--------------------------------------------------------------------------
# Inicialização do objeto
# actor_index : índex do herói
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# Inicialização do processo
#--------------------------------------------------------------------------
def start
super
@actor = $game_party.members[@actor_index]
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.y = 360
@help_window.viewport = @viewport
@skill_window = Window_Skill.new(0, 112, 544, 248, @actor)
@skill_window.viewport = @viewport
@skill_window.help_window = @help_window
@target_window = Window_MenuStatus.new(0, 0)
@Window_Wrong_Commands_Skill = Window_Wrong_Commands_Skill.new(240, 0, 300, 56)
@hp_window = Window_Actor_HP.new(120, 56, 224, 56)
@mp_window = Window_Actor_MP.new(344, 56, 200, 56)
@actor_window = Window_Actor.new(0, 0, 120, 140)
hide_target_window
end
#--------------------------------------------------------------------------
# Fim do processo
#--------------------------------------------------------------------------
def terminate
super
@help_window.dispose
@skill_window.dispose
@target_window.dispose
@Window_Wrong_Commands_Skill.dispose
@hp_window.dispose
@mp_window.dispose
@actor_window.dispose
end
#--------------------------------------------------------------------------
# Retornar à tela original
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(1)
end
#--------------------------------------------------------------------------
# Troca para tela do próximo herói
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Skill.new(@actor_index)
end
#--------------------------------------------------------------------------
# Trocar para tela do herói anterior
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Skill.new(@actor_index)
end
#--------------------------------------------------------------------------
# Atualização da tela
#--------------------------------------------------------------------------
def update
super
@help_window.update
@skill_window.update
@target_window.update
@Window_Wrong_Commands_Skill.update
@hp_window.update
@mp_window.update
@actor_window.update
if @skill_window.active
update_skill_selection
elsif @target_window.active
update_target_selection
end
end
#--------------------------------------------------------------------------
# Atualização da seleção de habilidade
#--------------------------------------------------------------------------
def update_skill_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill != nil
@actor.last_skill_id = @skill.id
end
if @actor.skill_can_use?(@skill)
Sound.play_decision
determine_skill
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# Decisão de habilidade
#--------------------------------------------------------------------------
def determine_skill
if @skill.for_friend?
show_target_window(@skill_window.index % 2 == 0)
if @skill.for_all?
@target_window.index = 99
elsif @skill.for_user?
@target_window.index = @actor_index + 100
else
if $game_party.last_target_index < @target_window.item_max
@target_window.index = $game_party.last_target_index
else
@target_window.index = 0
end
end
else
use_skill_nontarget
end
end
#--------------------------------------------------------------------------
# Atualização da seleção de alvo
#--------------------------------------------------------------------------
def update_target_selection
if Input.trigger?(Input::B)
Sound.play_cancel
hide_target_window
elsif Input.trigger?(Input::C)
if not @actor.skill_can_use?(@skill)
Sound.play_buzzer
else
determine_target
end
end
end
#--------------------------------------------------------------------------
# Definição do alvo
# Se não houver efeito, tocar SE de erro.
#--------------------------------------------------------------------------
def determine_target
used = false
if @skill.for_all?
for target in $game_party.members
target.skill_effect(@actor, @skill)
used = true unless target.skipped
end
elsif @skill.for_user?
target = $game_party.members[@target_window.index - 100]
target.skill_effect(@actor, @skill)
used = true unless target.skipped
else
$game_party.last_target_index = @target_window.index
target = $game_party.members[@target_window.index]
target.skill_effect(@actor, @skill)
used = true unless target.skipped
end
if used
use_skill_nontarget
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# Exibição da janela de alvo
# right : alinhado à direita (falso se esquerda)
#--------------------------------------------------------------------------
def show_target_window(right)
@skill_window.active = false
width_remain = 544 - @target_window.width
@target_window.x = right ? width_remain : 0
@target_window.visible = true
@target_window.active = true
if right
@viewport.rect.set(0, 0, width_remain, 416)
@viewport.ox = 0
else
@viewport.rect.set(@target_window.width, 0, width_remain, 416)
@viewport.ox = @target_window.width
end
end
#--------------------------------------------------------------------------
# Ocultação da janela de alvo
#--------------------------------------------------------------------------
def hide_target_window
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
@viewport.rect.set(0, 0, 544, 416)
@viewport.ox = 0
end
#--------------------------------------------------------------------------
# Uso de habilidade (sem alvo)
#--------------------------------------------------------------------------
def use_skill_nontarget
Sound.play_use_skill
@actor.mp -= @actor.calc_mp_cost(@skill)
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
elsif @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
end
end
end
#############
# Scene_End #
#############
class Scene_End < Scene_Base
#--------------------------------------------------------------------------
# Inicialização do processo
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
@Window_Wrong_Commands_Sair = Window_Wrong_Commands_Sair.new(240, 0, 300, 56)
end
#--------------------------------------------------------------------------
# Processo pós-inicialização
#--------------------------------------------------------------------------
def post_start
super
open_command_window
end
#--------------------------------------------------------------------------
# Preparação para finalização
#--------------------------------------------------------------------------
def pre_terminate
super
close_command_window
end
#--------------------------------------------------------------------------
# Fim do processo
#--------------------------------------------------------------------------
def terminate
super
dispose_command_window
dispose_menu_background
@Window_Wrong_Commands_Sair.dispose
end
#--------------------------------------------------------------------------
# Retornar à tela original
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(3)
end
#--------------------------------------------------------------------------
# Atualização da tela
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
@Window_Wrong_Commands_Sair.update
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
case @command_window.index
when 0 # ?????
command_to_title
when 1 # ???????
command_shutdown
when 2 # ???
command_cancel
end
end
end
#--------------------------------------------------------------------------
# Atualização do background do menu
#--------------------------------------------------------------------------
def update_menu_background
super
@menuback_sprite.tone.set(0, 0, 0, 128)
end
#--------------------------------------------------------------------------
# Criação da janela de comandos
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::to_title
s2 = Vocab::shutdown
s3 = Vocab::cancel
@command_window = Window_Command.new(172, [s1, s2, s3])
@command_window.x = (544 - @command_window.width) / 2
@command_window.y = (416 - @command_window.height) / 2
@command_window.openness = 0
end
#--------------------------------------------------------------------------
# Dispose da janela de comandos
#--------------------------------------------------------------------------
def dispose_command_window
@command_window.dispose
end
#--------------------------------------------------------------------------
# Abre a janela de comandos
#--------------------------------------------------------------------------
def open_command_window
@command_window.open
begin
@command_window.update
Graphics.update
end until @command_window.openness == 255
end
#--------------------------------------------------------------------------
# Fecha a janela de comandos
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
begin
@command_window.update
Graphics.update
end until @command_window.openness == 0
end
#--------------------------------------------------------------------------
# Processo ao selecionar "Tela Título"
#--------------------------------------------------------------------------
def command_to_title
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
$scene = Scene_Title.new
close_command_window
Graphics.fadeout(60)
end
#--------------------------------------------------------------------------
# Processo ao selecionar "Sair"
#--------------------------------------------------------------------------
def command_shutdown
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
$scene = nil
end
#--------------------------------------------------------------------------
# Processo ao cancelar
#--------------------------------------------------------------------------
def command_cancel
Sound.play_decision
return_scene
end
end |