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
| # Ability Menu by Arttroy (advised and corrected by Estheone)
# Contact on http://www.rpg-maker.fr/index.php?page=membre&id=22277
#
# Instructions :
#
# * Modification of skills obtained and their level :
#
# Line 90 :
# @ability_new_skills_id = [[3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
#
# The id of skills matches that of the database, modify it as you want
#
# Modification of the level when skill will be obtained
#
# Line 91 :
# @ability_new_skills_level = [[3, 6, 10], [3, 10, 30], [3, 10, 30], [3, 10, 30]]
#
# You can modify the level of category when skill will be obtained.
#
# These two lines are matching together, if you want to add a skill you must also modify the line for the level
#
# * Modification of the actor parameters :
#
# Line 92 :
# @augmentation = [0, 0, 0, 0, 0, 0, 0, 0]
#
# Read this like :
# @augmentation = [HP, MP, Atk, Def, Mgi, M.def, Agi, Luk]
# You will have to modify the values of the method addedstats_calculation (Line 123)
#
# @augmentation[2] = Random.new.rand(3..8)
#
# You can modify the values of random. At the same time modify the display values
# from the line 677 (def refresh of the Scene_Ability).
#
#
# If you want to modify the parameter growth
# you will have to change the display of contents for the adds. I advise not to do this if you
# don't know how to do this.
#
#
# Do not forget to insert images in the folder Pictures
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# The instance of this class is referenced by $game_temp.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :ability_index # Index for ability menu
#--------------------------------------------------------------------------
# * Aliasing method initialize
#--------------------------------------------------------------------------
alias ability_initialize initialize
def initialize
@ability_index = 0
ability_initialize
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
attr_reader :ability_level # for ability level
attr_reader :ability_points # for new skill by levelling ability
attr_reader :ability_new_skills_id # for new skill by levelling ability
attr_reader :ability_new_skills_level # required level for new skills
attr_reader :augmentation # for added stats by levelling ability
#--------------------------------------------------------------------------
# * Aliasing method setup(actor_id)
#--------------------------------------------------------------------------
alias ability_setup setup
def setup(actor_id)
@ability_level = [0, 0, 0, 0]
@ability_points = 0
@ability_new_skills_id = [[3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
@ability_new_skills_level = [[3, 6, 10], [3, 10, 30], [3, 10, 30], [3, 10, 30]]
@augmentation = [0, 0, 0, 0, 0, 0, 0, 0]
ability_setup(actor_id)
end
#--------------------------------------------------------------------------
# * Check if ability_level is equal to skill_level - 1
#--------------------------------------------------------------------------
def check_ability_skills_learning(n)
level = @ability_level[n]
for i in 0...@ability_new_skills_id[n].size
required_level = @ability_new_skills_level[n][i]
learn_skill(@ability_new_skills_id[n][i]) if level >= required_level
end
end
#--------------------------------------------------------------------------
# * Ability Maximum Level
#--------------------------------------------------------------------------
def ability_max_level
return 60
end
#--------------------------------------------------------------------------
# * Determine Maximum Level
#--------------------------------------------------------------------------
def ability_max_level?
@ability_level >= ability_max_level
end
#--------------------------------------------------------------------------
# * Calculate Stats Augmentation
#--------------------------------------------------------------------------
def addedstats_calculation
case $game_temp.ability_index
when 0
if @ability_level[0].between?(0, 30)
@augmentation[2] = Random.new.rand(3..8)
@augmentation[3] = Random.new.rand(3..8)
@augmentation[0] = Random.new.rand(50..100)
elsif @ability_level[0].between?(31, 60)
@augmentation[2] = Random.new.rand(15..20)
@augmentation[3] = Random.new.rand(15..20)
@augmentation[0] = Random.new.rand(150..250)
end
when 1
if @ability_level[1].between?(0, 30)
@augmentation[4] = Random.new.rand(3..8)
@augmentation[0] = Random.new.rand(25..50)
@augmentation[1] = Random.new.rand(25..75)
elsif @ability_level[1].between?(31, 60)
@augmentation[4] = Random.new.rand(15..20)
@augmentation[0] = Random.new.rand(75..100)
@augmentation[1] = Random.new.rand(100..150)
end
when 2
if @ability_level[2].between?(0, 30)
@augmentation[4] = Random.new.rand(3..8)
@augmentation[5] = Random.new.rand(3..8)
@augmentation[1] = Random.new.rand(50..100)
elsif @ability_level[2].between?(31, 60)
@augmentation[4] = Random.new.rand(15..20)
@augmentation[5] = Random.new.rand(15..20)
@augmentation[1] = Random.new.rand(100..150)
end
when 3
if @ability_level[3].between?(0, 30)
@augmentation[4] = Random.new.rand(3..8)
@augmentation[5] = Random.new.rand(3..8)
@augmentation[1] = Random.new.rand(25..50)
elsif @ability_level[3].between?(31, 60)
@augmentation[4] = Random.new.rand(15..20)
@augmentation[5] = Random.new.rand(15..20)
@augmentation[1] = Random.new.rand(75..125)
end
end
end
#--------------------------------------------------------------------------
# * Add Stats Augmentation
#--------------------------------------------------------------------------
def stats_augmentation
case $game_temp.ability_index
when 0
add_param(2, @augmentation[2])
add_param(3, @augmentation[3])
add_param(0, @augmentation[0])
when 1
add_param(4, @augmentation[4])
add_param(0, @augmentation[0])
add_param(1, @augmentation[1])
when 2
add_param(4, @augmentation[4])
add_param(5, @augmentation[5])
add_param(1, @augmentation[1])
when 3
add_param(4, @augmentation[4])
add_param(5, @augmentation[5])
add_param(1, @augmentation[1])
end
end
#--------------------------------------------------------------------------
# * Ability Points Down
#--------------------------------------------------------------------------
def abilitypoints_down
@ability_points -= 1
end
#--------------------------------------------------------------------------
# * Aliasing method Level Up
#--------------------------------------------------------------------------
alias ability_level_up level_up
def level_up
@ability_points += 1
ability_level_up
end
end
#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
# This command window appears on the menu screen.
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# * Overwrite method Adding Original Commands
#--------------------------------------------------------------------------
def add_original_commands
add_command("Ability", :ability, main_commands_enabled)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Overwrite method Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_MenuCommand.new
@command_window.set_handler(:item, method(:command_item))
@command_window.set_handler(:skill, method(:command_personal))
@command_window.set_handler(:equip, method(:command_personal))
@command_window.set_handler(:status, method(:command_personal))
@command_window.set_handler(:ability, method(:command_ability))
@command_window.set_handler(:formation, method(:command_formation))
@command_window.set_handler(:save, method(:command_save))
@command_window.set_handler(:game_end, method(:command_game_end))
@command_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# * [Ability] Command
#--------------------------------------------------------------------------
def command_ability
@status_window.select_last
@status_window.activate
@status_window.set_handler(:ok, method(:on_ability_ok))
@status_window.set_handler(:cancel, method(:on_ability_cancel))
end
#--------------------------------------------------------------------------
# * Ability [OK]
#--------------------------------------------------------------------------
def on_ability_ok
if @status_window.pending_index >= 0
@status_window.pending_index = @status_window.index
end
@status_window.activate
SceneManager.call(Scene_Ability)
end
#--------------------------------------------------------------------------
# * Ability [Cancel]
#--------------------------------------------------------------------------
def on_ability_cancel
if @status_window.pending_index >= 0
@status_window.pending_index = -1
@status_window.activate
else
@status_window.unselect
@command_window.activate
end
end
end
#===============================================================================
# ** Scene_Ability
#-------------------------------------------------------------------------------
# This class perform the Ability system
#===============================================================================
class Scene_Ability < Scene_MenuBase
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
$game_temp.ability_index = 0
create_abilitystatus_window
create_category_windows
create_adds_windows
create_command_window
create_choices_windows
create_addedstats_window
create_showskill_window
create_images
@abilitymessage_window.visible = false
@addedstats_window.visible = false
refresh
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
@crystal_sprites.each(&:dispose)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if @command_window.active
if Input.trigger?(:LEFT)
Sound.play_cursor
$game_temp.ability_index = ($game_temp.ability_index-1)%4
case $game_temp.ability_index
when 0
if @showskill_mgib_window.height = 120
@showskill_mgib_window.height = 20
@showskill_mgib_window.y = 384
@showskill_mgib_window.opacity = 0
@showskill_mgib_window.back_opacity = 0
@mgib_adds_window.visible = true
end
when 1
if @showskill_mgin_window.height = 120
@showskill_mgin_window.height = 20
@showskill_mgin_window.y = 384
@showskill_mgin_window.opacity = 0
@showskill_mgin_window.back_opacity = 0
@mgin_adds_window.visible = true
end
when 2
if @showskill_mgic_window.height = 120
@showskill_mgic_window.height = 20
@showskill_mgic_window.y = 384
@showskill_mgic_window.opacity = 0
@showskill_mgic_window.back_opacity = 0
@mgic_adds_window.visible = true
end
when 3
if @showskill_atk_window.height = 120
@showskill_atk_window.height = 20
@showskill_atk_window.y = 384
@showskill_atk_window.opacity = 0
@showskill_atk_window.back_opacity = 0
@atk_adds_window.visible = true
end
end
elsif Input.trigger?(:RIGHT)
Sound.play_cursor
$game_temp.ability_index = ($game_temp.ability_index+1)%4
case $game_temp.ability_index
when 0
if @showskill_mgic_window.height = 120
@showskill_mgic_window.height = 20
@showskill_mgic_window.y = 384
@showskill_mgic_window.opacity = 0
@showskill_mgic_window.back_opacity = 0
@mgic_adds_window.visible = true
end
when 1
if @showskill_atk_window.height = 120
@showskill_atk_window.height = 20
@showskill_atk_window.y = 384
@showskill_atk_window.opacity = 0
@showskill_atk_window.back_opacity = 0
@atk_adds_window.visible = true
end
when 2
if @showskill_mgib_window.height = 120
@showskill_mgib_window.height = 20
@showskill_mgib_window.y = 384
@showskill_mgib_window.opacity = 0
@showskill_mgib_window.back_opacity = 0
@mgib_adds_window.visible = true
end
when 3
if @showskill_mgin_window.height = 120
@showskill_mgin_window.height = 20
@showskill_mgin_window.y = 384
@showskill_mgin_window.opacity = 0
@showskill_mgin_window.back_opacity = 0
@mgin_adds_window.visible = true
end
end
elsif Input.trigger?(:DOWN)
case $game_temp.ability_index
when 0
@showskill_atk_window.refresh
@showskill_atk_window.height = 120
@showskill_atk_window.y = 290
@showskill_atk_window.opacity = 255
@showskill_atk_window.back_opacity = 190
@atk_adds_window.visible = false
when 1
@showskill_mgib_window.refresh
@showskill_mgib_window.height = 120
@showskill_mgib_window.y = 290
@showskill_mgib_window.opacity = 255
@showskill_mgib_window.back_opacity = 190
@mgib_adds_window.visible = false
when 2
@showskill_mgin_window.refresh
@showskill_mgin_window.height = 120
@showskill_mgin_window.y = 290
@showskill_mgin_window.opacity = 255
@showskill_mgin_window.back_opacity = 190
@mgin_adds_window.visible = false
when 3
@showskill_mgic_window.refresh
@showskill_mgic_window.height = 120
@showskill_mgic_window.y = 290
@showskill_mgic_window.opacity = 255
@showskill_mgic_window.back_opacity = 190
@mgic_adds_window.visible = false
end
elsif Input.trigger?(:UP)
case $game_temp.ability_index
when 0
if @showskill_atk_window.height = 120
@showskill_atk_window.height = 20
@showskill_atk_window.y = 384
@showskill_atk_window.opacity = 0
@showskill_atk_window.back_opacity = 0
@atk_adds_window.visible = true
end
when 1
if @showskill_mgib_window.height = 120
@showskill_mgib_window.height = 20
@showskill_mgib_window.y = 384
@showskill_mgib_window.opacity = 0
@showskill_mgib_window.back_opacity = 0
@mgib_adds_window.visible = true
end
when 2
if @showskill_mgin_window.height = 120
@showskill_mgin_window.height = 20
@showskill_mgin_window.y = 384
@showskill_mgin_window.opacity = 0
@showskill_mgin_window.back_opacity = 0
@mgin_adds_window.visible = true
end
when 3
if @showskill_mgic_window.height = 120
@showskill_mgic_window.height = 20
@showskill_mgic_window.y = 384
@showskill_mgic_window.opacity = 0
@showskill_mgic_window.back_opacity = 0
@mgic_adds_window.visible = true
end
end
elsif Input.trigger?(:C)
if @actor.ability_points != 0
@abilitymessage_window.visible = true
@actor.addedstats_calculation
@addedstats_window.refresh
@addedstats_window.visible = true
@command_window.active = false
@abilitychoices_window.start
else
Sound.play_buzzer
end
end
end
4.times do |i|
j = $game_temp.ability_index == i ? 1 : 0
bitmap_name = @actor.ability_level[i] == 0 ? @crystal_pictures[j] : @crystal_pictures[i*2+2+j]
@crystal_sprites[i].bitmap = Cache.picture(bitmap_name)
end
pattern = (Graphics.frame_count/5)%6
sprite = @crystal_sprites[$game_temp.ability_index]
w, h = sprite.bitmap.width/6, sprite.bitmap.height
sprite.src_rect.set(w*pattern, 0, w, h)
end
#--------------------------------------------------------------------------
# * Ability Status Window creation
#--------------------------------------------------------------------------
def create_abilitystatus_window
@abilitystatus_window = Window_AbilityStatus.new
@abilitystatus_window.actor = @actor
end
#--------------------------------------------------------------------------
# * Ability Category Window creation
#--------------------------------------------------------------------------
def create_category_windows
@atk_category_window = Window_AbilityCategory.new
@atk_category_window.x = 60
@atk_category_window.contents.draw_text(4, 0, 60, 20, "ATK")
@mgib_category_window = Window_AbilityCategory.new
@mgib_category_window.x = 180
@mgib_category_window.contents.draw_text(2, 0, 60, 20, "MGIB")
@mgin_category_window = Window_AbilityCategory.new
@mgin_category_window.x = 300
@mgin_category_window.contents.draw_text(2, 0, 60, 20, "MGIN")
@mgic_category_window = Window_AbilityCategory.new
@mgic_category_window.x = 420
@mgic_category_window.contents.draw_text(2, 0, 60, 20, "MGIC")
end
#--------------------------------------------------------------------------
# * Ability Status Window creation
#--------------------------------------------------------------------------
def create_adds_windows
@atk_adds_window = Window_AbilityAdds.new(40, 290)
@atk_adds_window.actor = @actor
@atk_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[0].to_s, 1)
@mgib_adds_window = Window_AbilityAdds.new(160, 290)
@mgib_adds_window.actor = @actor
@mgib_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[1].to_s, 1)
@mgin_adds_window = Window_AbilityAdds.new(280, 290)
@mgin_adds_window.actor = @actor
@mgin_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[2].to_s, 1)
@mgic_adds_window = Window_AbilityAdds.new(400, 290)
@mgic_adds_window.actor = @actor
@mgic_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[3].to_s, 1)
end
#--------------------------------------------------------------------------
# * Ability Command Window creation
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_Ability_Command.new
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:pagedown, method(:next_actor))
@command_window.set_handler(:pageup, method(:prev_actor))
end
#--------------------------------------------------------------------------
# * Ability Choices Windows creation
#--------------------------------------------------------------------------
def create_choices_windows
@abilitymessage_window = Window_Ability_Confirmation.new
@abilitychoices_window = Window_Ability_ChoiceList.new
@abilitychoices_window.set_handler(:oui, method(:add_ability_points))
@abilitychoices_window.set_handler(:non, method(:return_category))
@abilitychoices_window.set_handler(:cancel, method(:return_category))
end
def create_addedstats_window
@addedstats_window = Window_Ability_AddedStats.new
@addedstats_window.actor = @actor
end
def create_showskill_window
@showskill_atk_window = Window_AbilitySkillList.new(40, 384, 0)
@showskill_atk_window.actor = @actor
@showskill_atk_window.opacity = 0
@showskill_atk_window.back_opacity = 0
@showskill_mgib_window = Window_AbilitySkillList.new(160, 384, 1)
@showskill_mgib_window.actor = @actor
@showskill_mgib_window.opacity = 0
@showskill_mgib_window.back_opacity = 0
@showskill_mgin_window = Window_AbilitySkillList.new(280, 384, 2)
@showskill_mgin_window.actor = @actor
@showskill_mgin_window.opacity = 0
@showskill_mgin_window.back_opacity = 0
@showskill_mgic_window = Window_AbilitySkillList.new(400, 384, 3)
@showskill_mgic_window.actor = @actor
@showskill_mgic_window.opacity = 0
@showskill_mgic_window.back_opacity = 0
end
#--------------------------------------------------------------------------
# * Change Actors
#--------------------------------------------------------------------------
def on_actor_change
@abilitystatus_window.actor = @actor
@addedstats_window.actor = @actor
@atk_adds_window.actor = @actor
@mgib_adds_window.actor = @actor
@mgin_adds_window.actor = @actor
@mgic_adds_window.actor = @actor
@showskill_atk_window.actor = @actor
@showskill_mgib_window.actor = @actor
@showskill_mgin_window.actor = @actor
@showskill_mgic_window.actor = @actor
@command_window.activate
refresh
end
#--------------------------------------------------------------------------
# * Add Ability Points
#--------------------------------------------------------------------------
def add_ability_points
if @actor.ability_points == 0
Sound.play_buzzer
else
case $game_temp.ability_index
when 0
@actor.ability_level[0] += 1
@actor.abilitypoints_down
@actor.stats_augmentation
@actor.check_ability_skills_learning(0)
@atk_adds_window.refresh
when 1
@actor.ability_level[1] += 1
@actor.abilitypoints_down
@actor.stats_augmentation
@actor.check_ability_skills_learning(1)
@mgib_adds_window.refresh
when 2
@actor.ability_level[2] += 1
@actor.abilitypoints_down
@actor.stats_augmentation
@actor.check_ability_skills_learning(2)
@mgin_adds_window.refresh
when 3
@actor.ability_level[3] += 1
@actor.abilitypoints_down
@actor.stats_augmentation
@actor.check_ability_skills_learning(3)
@mgic_adds_window.refresh
end
Sound.play_cursor
end
refresh
@abilitystatus_window.refresh
@abilitymessage_window.visible = false
@addedstats_window.visible = false
@addedstats_window.refresh
@abilitychoices_window.deactivate
@abilitychoices_window.openness = 0
@command_window.activate
end
#--------------------------------------------------------------------------
# * Return to category choice
#--------------------------------------------------------------------------
def return_category
Sound.play_cancel
@abilitymessage_window.visible = false
@addedstats_window.visible = false
@addedstats_window.refresh
@abilitychoices_window.openness = 0
@abilitychoices_window.deactivate
@command_window.activate
end
#--------------------------------------------------------------------------
# * Images creation
#--------------------------------------------------------------------------
def create_images
@crystal_sprites = []
4.times do |i|
@crystal_sprites[i] = Sprite.new
@crystal_sprites[i].x = 60+120*i
@crystal_sprites[i].y = 130
end
@crystal_pictures = ["Crystal", "Glowing_Crystal", "Red_Crystal", "Glowing_Red_Crystal", "White_Crystal", "Glowing_White_Crystal",
"Blue_Crystal", "Glowing_Blue_Crystal", "Green_Crystal", "Glowing_Green_Crystal"]
update
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@command_window.index = 0
@command_window.refresh
@atk_adds_window.refresh
@mgib_adds_window.refresh
@mgin_adds_window.refresh
@mgic_adds_window.refresh
@atk_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[0].to_s, 1)
@atk_adds_window.contents.draw_text(0, 30, 40, 14, "ATK")
@atk_adds_window.contents.draw_text(0, 42, 40, 14, "DEF")
@atk_adds_window.contents.draw_text(0, 54, 40, 14, "HP")
if @actor.ability_level[0].between?(0, 30)
@atk_adds_window.contents.draw_text(2, 30, 60, 14, "+ 3/8", 2)
@atk_adds_window.contents.draw_text(2, 42, 60, 14, "+ 3/8", 2)
@atk_adds_window.contents.draw_text(10, 54, 60, 14, "+ 50/100", 2)
elsif @actor.ability_level[0].between?(31, 60)
@atk_adds_window.contents.draw_text(2, 30, 60, 14, "+ 15/20", 2)
@atk_adds_window.contents.draw_text(2, 42, 60, 14, "+ 15/20", 2)
@atk_adds_window.contents.draw_text(10, 54, 60, 14, "+ 150/250", 2)
end
@mgib_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[1].to_s, 1)
@mgib_adds_window.contents.draw_text(0, 30, 40, 14, "MAG")
@mgib_adds_window.contents.draw_text(0, 42, 40, 14, "HP")
@mgib_adds_window.contents.draw_text(0, 54, 40, 14, "MP")
if @actor.ability_level[1].between?(0, 30)
@mgib_adds_window.contents.draw_text(2, 30, 60, 14, "+ 3/8", 2)
@mgib_adds_window.contents.draw_text(10, 42, 60, 14, "+ 25/50", 2)
@mgib_adds_window.contents.draw_text(10, 54, 60, 14, "+ 50/75", 2)
elsif @actor.ability_level[1].between?(31, 60)
@mgib_adds_window.contents.draw_text(2, 30, 60, 14, "+ 15/20", 2)
@mgib_adds_window.contents.draw_text(10, 42, 60, 14, "+ 75/100", 2)
@mgib_adds_window.contents.draw_text(10, 54, 60, 14, "+ 100/150", 2)
end
@mgin_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[2].to_s, 1)
@mgin_adds_window.contents.draw_text(0, 30, 40, 14, "MGI")
@mgin_adds_window.contents.draw_text(0, 42, 40, 14, "MDF")
@mgin_adds_window.contents.draw_text(0, 54, 40, 14, "MP")
if @actor.ability_level[2].between?(0, 30)
@mgin_adds_window.contents.draw_text(2, 30, 60, 14, "+ 3/8", 2)
@mgin_adds_window.contents.draw_text(2, 42, 60, 14, "+ 3/8", 2)
@mgin_adds_window.contents.draw_text(10, 54, 60, 14, "+ 50/100", 2)
elsif @actor.ability_level[2].between?(31, 60)
@mgin_adds_window.contents.draw_text(2, 30, 60, 14, "+ 15/20", 2)
@mgin_adds_window.contents.draw_text(2, 42, 60, 14, "+ 15/20", 2)
@mgin_adds_window.contents.draw_text(10, 54, 60, 14, "+ 150/250", 2)
end
@mgic_adds_window.contents.draw_text(30, 0, 40, 20, @actor.ability_level[3].to_s, 1)
@mgic_adds_window.contents.draw_text(0, 30, 40, 14, "MGI")
@mgic_adds_window.contents.draw_text(0, 42, 40, 14, "MDF")
@mgic_adds_window.contents.draw_text(0, 54, 40, 14, "MP")
if @actor.ability_level[3].between?(0, 30)
@mgic_adds_window.contents.draw_text(2, 30, 60, 14, "+ 3/8", 2)
@mgic_adds_window.contents.draw_text(2, 42, 60, 14, "+ 3/8", 2)
@mgic_adds_window.contents.draw_text(10, 54, 60, 14, "+ 50/100", 2)
elsif @actor.ability_level[3].between?(31, 60)
@mgic_adds_window.contents.draw_text(2, 30, 60, 14, "+ 15/20", 2)
@mgic_adds_window.contents.draw_text(2, 42, 60, 14, "+ 15/20", 2)
@mgic_adds_window.contents.draw_text(10, 54, 60, 14, "+ 150/250", 2)
end
end
end
#===============================================================================
# ** Window_AbilityStatus
#-------------------------------------------------------------------------------
# This class perform the status window for the Ability system
#===============================================================================
class Window_AbilityStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(22, 6, 500, 120)
self.contents.font.size = 16
@actor = nil
@temp_actor = nil
refresh
end
#--------------------------------------------------------------------------
# * Get Number of Lines to Show
#--------------------------------------------------------------------------
def visible_line_number
return 4
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_actor_face(@actor, 0, 0) if @actor
draw_actor_name(@actor, 104, 0) if @actor
draw_actor_hp(@actor, 104, 20, width = 60) if @actor
draw_actor_mp(@actor, 212, 20, width = 60) if @actor
draw_item(100, 38, 0)
draw_ability_points(@actor, 0, 0) if @actor
draw_actor_accessory(@actor, 0, 0) if @actor
end
#--------------------------------------------------------------------------
# * Set Temporary Actor After Equipment Change
#--------------------------------------------------------------------------
def set_temp_actor(temp_actor)
return if @temp_actor == temp_actor
@temp_actor = temp_actor
refresh
end
#--------------------------------------------------------------------------
# * Draw Max Value in Fractional Format
# max : Maximum value
# color1 : Color of maximum value
#--------------------------------------------------------------------------
def draw_max_values(x, y, width, max, color1)
xr = x + width
if width < 96
draw_text(xr - 40, y, 42, line_height, max, 2)
else
draw_text(xr - 42, y, 42, line_height, max, 2)
end
end
#--------------------------------------------------------------------------
# * Draw HP
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 124)
contents.font.size = 17
draw_text(x, y, 30, line_height, Vocab::hp_a)
draw_max_values(x + 12, y, width, actor.mhp, normal_color)
end
#--------------------------------------------------------------------------
# * Draw MP
#--------------------------------------------------------------------------
def draw_actor_mp(actor, x, y, width = 124)
contents.font.size = 17
draw_text(x, y, 30, line_height, Vocab::mp_a)
draw_max_values(x + 22, y, width, actor.mmp, normal_color)
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(x, y, param_id)
draw_param_name(x + 4, y, 2)
draw_current_param(x + 46, y, 2) if @actor
draw_param_name(x + 4, y + 18, 3)
draw_current_param(x + 46, y + 18, 3) if @actor
draw_param_name(x + 4, y + 36, 6)
draw_current_param(x + 46, y + 36, 6) if @actor
draw_param_name(x + 112, y, 4)
draw_current_param(x + 164, y, 4) if @actor
draw_param_name(x + 112, y + 18, 5)
draw_current_param(x + 164, y + 18, 5) if @actor
draw_param_name(x + 112, y + 36, 7)
draw_current_param(x + 164, y + 36, 7) if @actor
end
#--------------------------------------------------------------------------
# * Draw Parameter Name
#--------------------------------------------------------------------------
def draw_param_name(x, y, param_id)
contents.font.size = 17
change_color(normal_color)
draw_text(x, y, 80, line_height, Vocab::param(param_id))
end
#--------------------------------------------------------------------------
# * Draw Current Parameter
#--------------------------------------------------------------------------
def draw_current_param(x, y, param_id)
contents.font.size = 17
change_color(normal_color)
draw_text(x, y, 32, line_height, @actor.param(param_id), 2)
end
#--------------------------------------------------------------------------
# * Draw actor ability points
#--------------------------------------------------------------------------
def draw_ability_points(actor, x, y)
contents.font.size = 20
draw_text(356, 4, 100, 20, " Ability Points :")
draw_text(374, 24, 40, 20, actor.ability_points.to_s, 1)
end
#--------------------------------------------------------------------------
# * Draw actor accessory
#--------------------------------------------------------------------------
def draw_actor_accessory(actor, x, y)
contents.font.size = 20
draw_text(346, 50, 120, line_height, " Equipped Accessory : ")
draw_item_name(actor.equips[4], 322, 72)
end
#--------------------------------------------------------------------------
# * Draw Item Name
# enabled : Enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, enabled = true, width = 172)
return unless item
contents.font.size = 17
change_color(normal_color, enabled)
draw_text(x, y, width, line_height, item.name)
end
end
#===============================================================================
# ** Window_AbilityCategory
#-------------------------------------------------------------------------------
# This class handle the category_name for the Ability system
#===============================================================================
class Window_AbilityCategory < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 240, 60, 40)
self.contents.font.size = 19
end
end
#===============================================================================
# ** Window_AbilityAdds
#-------------------------------------------------------------------------------
# This class handle the lvl, stats & skill added by the Ability system
#===============================================================================
class Window_AbilityAdds < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 100, 120)
self.contents.font.size = 17
@actor = nil
@temp_actor = nil
refresh
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(22, 0, 100, 20, "Nv.")
self.contents.draw_text(4, 14, 100, 20, "Nv suivant:")
self.contents.draw_text(14, 66, 100, 20, "Skills:")
end
#--------------------------------------------------------------------------
# * Set Temporary Actor After Equipment Change
#--------------------------------------------------------------------------
def set_temp_actor(temp_actor)
return if @temp_actor == temp_actor
@temp_actor = temp_actor
refresh
end
end
#==============================================================================
# ** Window_Ability_Command
#------------------------------------------------------------------------------
# This class perform the Command Window for the Ability System
#==============================================================================
class Window_Ability_Command < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(115, 295)
self.contents.font.size = 20
self.opacity = 0
self.back_opacity = 0
cursor_rect.empty
refresh
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 150
end
#--------------------------------------------------------------------------
# * Processing When OK Button Is Pressed
#--------------------------------------------------------------------------
def process_ok
end
#--------------------------------------------------------------------------
# * Processing When Cancel Button Is Pressed
#--------------------------------------------------------------------------
def process_cancel
Sound.play_cancel
Input.update
deactivate
call_cancel_handler
cursor_rect.empty
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
clear_command_list
make_command_list
cursor_rect.empty
self.arrows_visible = false
super
end
end
#==============================================================================
# ** Window_Ability_Confirmation
#------------------------------------------------------------------------------
# This class perform the Confirmation Window for the Ability System
#==============================================================================
class Window_Ability_Confirmation < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(118,126,300,120)
self.contents.font.size = 23
self.z = 500
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
draw_text(28, 28, 230, 24, " Ajouter un point à cette catégorie ?")
end
end
#==============================================================================
# ** Window_Ability_ChoiceList
#------------------------------------------------------------------------------
# This window is used for showing choices on Ability Confirmation Window
#==============================================================================
class Window_Ability_ChoiceList < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(196, 190)
self.opacity = 0
self.back_opacity = 0
self.z = 501
self.openness = 0
deactivate
end
#--------------------------------------------------------------------------
# * Start Input Processing
#--------------------------------------------------------------------------
def start
update_placement
refresh
select(0)
open
activate
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# * Update Window Position
#--------------------------------------------------------------------------
def update_placement
self.width = 160
self.height = 80
end
#--------------------------------------------------------------------------
# * Get Maximum Width of Choices
#--------------------------------------------------------------------------
def max_choice_width
$game_message.choices.collect {|s| text_size(s).width }.max
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
add_command("Oui", :oui)
add_command("Non", :non)
end
#--------------------------------------------------------------------------
# * Processing When OK Button Is Pressed
#--------------------------------------------------------------------------
def process_ok
if current_item_enabled?
Input.update
deactivate
call_ok_handler
else
Sound.play_buzzer
end
end
end
#===============================================================================
# ** Window_AbilityAddedStats
#-------------------------------------------------------------------------------
# This class perform the window for the Added Stats of the Ability system
#===============================================================================
class Window_Ability_AddedStats < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(22, 6, 500, 120)
self.contents.font.size = 17
self.opacity = 0
self.back_opacity = 0
@actor = nil
@temp_actor = nil
refresh
end
#--------------------------------------------------------------------------
# * Get Number of Lines to Show
#--------------------------------------------------------------------------
def visible_line_number
return 4
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_added_stats(@actor, 180, 20) if @actor
end
#--------------------------------------------------------------------------
# * Set Temporary Actor After Equipment Change
#--------------------------------------------------------------------------
def set_temp_actor(temp_actor)
return if @temp_actor == temp_actor
@temp_actor = temp_actor
refresh
end
#--------------------------------------------------------------------------
# * Draw Plus
#--------------------------------------------------------------------------
def draw_plus(x, y)
draw_text(x, y, 22, line_height, "+", 1)
end
#--------------------------------------------------------------------------
# * Draw Added Stats
#--------------------------------------------------------------------------
def draw_added_stats(actor, x, y)
case $game_temp.ability_index
when 0
change_color(hp_gauge_color1)
3.times do |i|
draw_plus(172, 20 + 18 * i)
end
draw_text(x, y, 30, line_height, actor.augmentation[0].to_s, 1)
draw_text(x, y + 18, 30, line_height, actor.augmentation[2].to_s, 1)
draw_text(x, y + 36, 30, line_height, actor.augmentation[3].to_s, 1)
when 1
change_color(normal_color)
2.times do |i|
draw_plus(290, 20 + 18 * i)
end
draw_plus(172, 20)
draw_text(x + 118, y + 18, 30, line_height, actor.augmentation[4].to_s, 1)
draw_text(x, y, 30, line_height, actor.augmentation[0].to_s, 1)
draw_text(x + 118, y, 30, line_height, actor.augmentation[1].to_s, 1)
when 2
change_color(mp_cost_color)
3.times do |i|
draw_plus(290, 20 + 18 * i)
end
draw_text(x + 118, y + 18, 30, line_height, actor.augmentation[4].to_s, 1)
draw_text(x + 118, y + 36, 30, line_height, actor.augmentation[5].to_s, 1)
draw_text(x + 118, y, 30, line_height, actor.augmentation[1].to_s, 1)
when 3
change_color(power_up_color)
3.times do |i|
draw_plus(290, 20 + 18 * i)
end
draw_text(x + 118, y + 18, 30, line_height, actor.augmentation[4].to_s, 1)
draw_text(x + 118, y + 36, 30, line_height, actor.augmentation[5].to_s, 1)
draw_text(x + 118, y, 30, line_height, actor.augmentation[1].to_s, 1)
end
end
end
#==============================================================================
# ** Window_AbilitySkillList
#------------------------------------------------------------------------------
# This window is for displaying a list of available skills on the skill window.
#==============================================================================
class Window_AbilitySkillList < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, index)
super(x, y, 100, 20)
self.contents.font.size = 12
@actor = nil
@temp_actor = nil
@index = index
refresh
end
#--------------------------------------------------------------------------
# * Get Number of Lines to Show
#--------------------------------------------------------------------------
def visible_line_number
return 3
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
return unless @actor
for i in 0...@actor.ability_new_skills_id[@index].size
if @actor.ability_level[@index] == @actor.ability_new_skills_level[@index][i]-1
text = $data_skills[@actor.ability_new_skills_id[@index][i]].name
self.contents.draw_text(2, 0, 92, 20, text)
end
end
end
#--------------------------------------------------------------------------
# * Set Temporary Actor After Equipment Change
#--------------------------------------------------------------------------
def set_temp_actor(temp_actor)
return if @temp_actor == temp_actor
@temp_actor = temp_actor
refresh
end
end |