-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrgss2.rb
1279 lines (1241 loc) · 26.3 KB
/
rgss2.rb
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
# encoding: utf-8
# rgss2.rb
# author: dice2000
# original author: aoitaku
# https://gist.github.com/aoitaku/7822424
#
# 本プログラムはRPGツクールVX 正規ユーザーが
# RPGツクールVXでの利用を目的とする場合においてのみ
# 使用できます。
#
require 'jsonable'
class Color
include Jsonable
attr_accessor :red, :green, :blue, :alpha
def initialize(data)
@red, @green, @blue, @alpha = *data
end
def _dump(limit)
[@red, @green, @blue, @alpha].pack("EEEE")
end
def self._load(obj)
Color.new(obj.unpack("EEEE"))
end
end
class Table
include Jsonable
def initialize(data)
@num_of_dimensions,
@xsize, @ysize, @zsize,
@num_of_elements,
*@elements = *data
if @num_of_dimensions > 1
if @xsize > 1
@elements = @elements.each_slice(@xsize).to_a
else
@elements = @elements.map{|element|[element]}
end
end
if @num_of_dimensions > 2
if @ysize > 1
@elements = @elements.each_slice(@ysize).to_a
else
@elements = @elements.map{|element|[element]}
end
end
end
def _dump(limit)
[@num_of_dimensions,
@xsize, @ysize, @zsize,
@num_of_elements,
*@elements.flatten].pack("VVVVVv*")
end
def self._load(obj)
Table.new(obj.unpack("VVVVVv*"))
end
end
class Tone
include Jsonable
attr_accessor :red, :green, :blue, :gray
def initialize(data)
@red, @green, @blue, @gray = *data
end
def _dump(limit)
[@red, @green, @blue, @gray].pack("EEEE")
end
def self._load(obj)
Tone.new(obj.unpack("EEEE"))
end
end
#
# ここまでは元ファイルと定義が同一
#
module RPG
def self.unpack_str(str)
tmp_ary = str.unpack("U*")
str = ""
tmp_ary.each{ |c|
str += c.chr("UTF-8")
}
return str
end
end
#
# RGSS2
#
# RPG::Actor:アクターのデータクラス。
#
class RPG::Actor
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
@character_name = RPG::unpack_str(@character_name)
@face_name = RPG::unpack_str(@face_name)
end
def initialize
@id = 0
@name = ""
@class_id = 1
@initial_level = 1
@exp_basis = 25
@exp_inflation = 35
@character_name = ""
@character_index = 0
@face_name = ""
@face_index = 0
@parameters = nil
#@parameters = Table.new(6,100)
#for i in 1..99
# @parameters[0,i] = 400+i*50
# @parameters[1,i] = 80+i*10
# @parameters[2,i] = 15+i*5/4
# @parameters[3,i] = 15+i*5/4
# @parameters[4,i] = 20+i*5/2
# @parameters[5,i] = 20+i*5/2
#end
@weapon_id = 0
@armor1_id = 0
@armor2_id = 0
@armor3_id = 0
@armor4_id = 0
@two_swords_style = false
@fix_equipment = false
@auto_battle = false
@super_guard = false
@pharmacology = false
@critical_bonus = false
end
attr_accessor :id
attr_accessor :name
attr_accessor :class_id
attr_accessor :initial_level
attr_accessor :exp_basis
attr_accessor :exp_inflation
attr_accessor :character_name
attr_accessor :character_index
attr_accessor :face_name
attr_accessor :face_index
attr_accessor :parameters
attr_accessor :weapon_id
attr_accessor :armor1_id
attr_accessor :armor2_id
attr_accessor :armor3_id
attr_accessor :armor4_id
attr_accessor :two_swords_style
attr_accessor :fix_equipment
attr_accessor :auto_battle
attr_accessor :super_guard
attr_accessor :pharmacology
attr_accessor :critical_bonus
end
#
# RPG::Animation:アニメーションのデータクラス。
#
class RPG::Animation
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
@animation1_name = RPG::unpack_str(@animation1_name)
@animation2_name = RPG::unpack_str(@animation2_name)
end
def initialize
@id = 0
@name = ""
@animation1_name = ""
@animation1_hue = 0
@animation2_name = ""
@animation2_hue = 0
@position = 1
@frame_max = 1
@frames = [RPG::Animation::Frame.new]
@timings = []
end
attr_accessor :id
attr_accessor :name
attr_accessor :animation1_name
attr_accessor :animation1_hue
attr_accessor :animation2_name
attr_accessor :animation2_hue
attr_accessor :position
attr_accessor :frame_max
attr_accessor :frames
attr_accessor :timings
end
class RPG::Animation::Frame
include Jsonable
def initialize
@cell_max = 0
@cell_data = Table.new([0, 0])
end
attr_accessor :cell_max
attr_accessor :cell_data
end
class RPG::Animation::Timing
include Jsonable
def initialize
@frame = 0
@se = RPG::SE.new("", 80)
@flash_scope = 0
@flash_color = Color.new([255,255,255,255])
@flash_duration = 5
end
attr_accessor :frame
attr_accessor :se
attr_accessor :flash_scope
attr_accessor :flash_color
attr_accessor :flash_duration
end
class RPG::Area
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
end
def initialize
@id = 0
@name = ""
@map_id = 0
@rect = Rect.new(0,0,0,0)
@encounter_list = []
@order = 0
end
attr_accessor :id
attr_accessor :name
attr_accessor :map_id
attr_accessor :rect
attr_accessor :encounter_list
attr_accessor :order
end
class RPG::BaseItem
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
@description = RPG::unpack_str(@description)
@note = RPG::unpack_str(@note)
end
def initialize
@id = 0
@name = ""
@icon_index = 0
@description = ""
@note = ""
end
attr_accessor :id
attr_accessor :name
attr_accessor :icon_index
attr_accessor :description
attr_accessor :note
end
class RPG::Armor < RPG::BaseItem
include Jsonable
def initialize
super
@kind = 0
@price = 0
@eva = 0
@atk = 0
@def = 0
@spi = 0
@agi = 0
@prevent_critical = false
@half_mp_cost = false
@double_exp_gain = false
@auto_hp_recover = false
@element_set = []
@state_set = []
end
attr_accessor :kind
attr_accessor :price
attr_accessor :eva
attr_accessor :atk
attr_accessor :def
attr_accessor :spi
attr_accessor :agi
attr_accessor :prevent_critical
attr_accessor :half_mp_cost
attr_accessor :double_exp_gain
attr_accessor :auto_hp_recover
attr_accessor :element_set
attr_accessor :state_set
end
class RPG::Weapon < RPG::BaseItem
include Jsonable
def initialize
super
@animation_id = 0
@price = 0
@hit = 95
@atk = 0
@def = 0
@spi = 0
@agi = 0
@two_handed = false
@fast_attack = false
@dual_attack = false
@critical_bonus = false
@element_set = []
@state_set = []
end
attr_accessor :animation_id
attr_accessor :price
attr_accessor :hit
attr_accessor :atk
attr_accessor :def
attr_accessor :spi
attr_accessor :agi
attr_accessor :two_handed
attr_accessor :fast_attack
attr_accessor :dual_attack
attr_accessor :critical_bonus
attr_accessor :element_set
attr_accessor :state_set
end
class RPG::UsableItem < RPG::BaseItem
include Jsonable
def initialize
super
@scope = 0
@occasion = 0
@speed = 0
@animation_id = 0
@common_event_id = 0
@base_damage = 0
@variance = 20
@atk_f = 0
@spi_f = 0
@physical_attack = false
@damage_to_mp = false
@absorb_damage = false
@ignore_defense = false
@element_set = []
@plus_state_set = []
@minus_state_set = []
end
def for_opponent?
return [1, 2, 3, 4, 5, 6].include?(@scope)
end
def for_friend?
return [7, 8, 9, 10, 11].include?(@scope)
end
def for_dead_friend?
return [9, 10].include?(@scope)
end
def for_user?
return [11].include?(@scope)
end
def for_one?
return [1, 3, 4, 7, 9, 11].include?(@scope)
end
def for_two?
return [5].include?(@scope)
end
def for_three?
return [6].include?(@scope)
end
def for_random?
return [4, 5, 6].include?(@scope)
end
def for_all?
return [2, 8, 10].include?(@scope)
end
def dual?
return [3].include?(@scope)
end
def need_selection?
return [1, 3, 7, 9].include?(@scope)
end
def battle_ok?
return [0, 1].include?(@occasion)
end
def menu_ok?
return [0, 2].include?(@occasion)
end
attr_accessor :scope
attr_accessor :occasion
attr_accessor :speed
attr_accessor :animation_id
attr_accessor :common_event_id
attr_accessor :base_damage
attr_accessor :variance
attr_accessor :atk_f
attr_accessor :spi_f
attr_accessor :physical_attack
attr_accessor :damage_to_mp
attr_accessor :absorb_damage
attr_accessor :ignore_defense
attr_accessor :element_set
attr_accessor :plus_state_set
attr_accessor :minus_state_set
end
class RPG::Item < RPG::UsableItem
include Jsonable
def initialize
super
@scope = 7
@price = 0
@consumable = true
@hp_recovery_rate = 0
@hp_recovery = 0
@mp_recovery_rate = 0
@mp_recovery = 0
@parameter_type = 0
@parameter_points = 0
end
attr_accessor :price
attr_accessor :consumable
attr_accessor :hp_recovery_rate
attr_accessor :hp_recovery
attr_accessor :mp_recovery_rate
attr_accessor :mp_recovery
attr_accessor :parameter_type
attr_accessor :parameter_points
end
class RPG::Skill < RPG::UsableItem
include Jsonable
def unpack_names
super
@message1 = RPG::unpack_str(@message1)
@message2 = RPG::unpack_str(@message2)
end
def initialize
super
@scope = 1
@mp_cost = 0
@hit = 100
@message1 = ""
@message2 = ""
end
attr_accessor :mp_cost
attr_accessor :hit
attr_accessor :message1
attr_accessor :message2
end
class RPG::AudioFile
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
end
def initialize(name = "", volume = 100, pitch = 100)
@name = name
@volume = volume
@pitch = pitch
end
attr_accessor :name
attr_accessor :volume
attr_accessor :pitch
end
class RPG::BGM < RPG::AudioFile
@@last = RPG::BGM.new
def play
if @name.empty?
Audio.bgm_stop
@@last = RPG::BGM.new
else
Audio.bgm_play("Audio/BGM/" + @name, @volume, @pitch)
@@last = self
end
end
def self.stop
Audio.bgm_stop
@@last = RPG::BGM.new
end
def self.fade(time)
Audio.bgm_fade(time)
@@last = RPG::BGM.new
end
def self.last
@@last
end
end
class RPG::BGS < RPG::AudioFile
@@last = RPG::BGS.new
def play
if @name.empty?
Audio.bgs_stop
@@last = RPG::BGS.new
else
Audio.bgs_play("Audio/BGS/" + @name, @volume, @pitch)
@@last = self
end
end
def self.stop
Audio.bgs_stop
@@last = RPG::BGS.new
end
def self.fade(time)
Audio.bgs_fade(time)
@@last = RPG::BGS.new
end
def self.last
@@last
end
end
class RPG::ME < RPG::AudioFile
def play
if @name.empty?
Audio.me_stop
else
Audio.me_play("Audio/ME/" + @name, @volume, @pitch)
end
end
def self.stop
Audio.me_stop
end
def self.fade(time)
Audio.me_fade(time)
end
end
class RPG::SE < RPG::AudioFile
def play
unless @name.empty?
Audio.se_play("Audio/SE/" + @name, @volume, @pitch)
end
end
def self.stop
Audio.se_stop
end
end
class RPG::Class
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
@skill_name = RPG::unpack_str(@skill_name)
end
def initialize
@id = 0
@name = ""
@position = 0
@weapon_set = []
@armor_set = []
@element_ranks = Table.new(1)
@state_ranks = Table.new(1)
@learnings = []
@skill_name_valid = false
@skill_name = ""
end
attr_accessor :id
attr_accessor :name
attr_accessor :position
attr_accessor :weapon_set
attr_accessor :armor_set
attr_accessor :element_ranks
attr_accessor :state_ranks
attr_accessor :learnings
attr_accessor :skill_name_valid
attr_accessor :skill_name
end
class RPG::Class::Learning
include Jsonable
def initialize
@level = 1
@skill_id = 1
end
attr_accessor :level
attr_accessor :skill_id
end
class RPG::CommonEvent
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
@list.each{ |i| i.unpack_names }
end
def initialize
@id = 0
@name = ""
@trigger = 0
@switch_id = 1
@list = [RPG::EventCommand.new]
end
attr_accessor :id
attr_accessor :name
attr_accessor :trigger
attr_accessor :switch_id
attr_accessor :list
end
class RPG::Enemy
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
@battler_name = RPG::unpack_str(@battler_name)
@note = RPG::unpack_str(@note)
end
def initialize
@id = 0
@name = ""
@battler_name = ""
@battler_hue = 0
@maxhp = 10
@maxmp = 10
@atk = 10
@def = 10
@spi = 10
@agi = 10
@hit = 95
@eva = 5
@exp = 0
@gold = 0
@drop_item1 = RPG::Enemy::DropItem.new
@drop_item2 = RPG::Enemy::DropItem.new
@levitate = false
@has_critical = false
@element_ranks = Table.new(1)
@state_ranks = Table.new(1)
@actions = [RPG::Enemy::Action.new]
@note = ""
end
attr_accessor :id
attr_accessor :name
attr_accessor :battler_name
attr_accessor :battler_hue
attr_accessor :maxhp
attr_accessor :maxmp
attr_accessor :atk
attr_accessor :def
attr_accessor :spi
attr_accessor :agi
attr_accessor :hit
attr_accessor :eva
attr_accessor :exp
attr_accessor :gold
attr_accessor :drop_item1
attr_accessor :drop_item2
attr_accessor :levitate
attr_accessor :has_critical
attr_accessor :element_ranks
attr_accessor :state_ranks
attr_accessor :actions
attr_accessor :note
end
class RPG::Enemy::Action
include Jsonable
def initialize
@kind = 0
@basic = 0
@skill_id = 1
@condition_type = 0
@condition_param1 = 0
@condition_param2 = 0
@rating = 5
end
def skill?
return @kind == 1
end
attr_accessor :kind
attr_accessor :basic
attr_accessor :skill_id
attr_accessor :condition_type
attr_accessor :condition_param1
attr_accessor :condition_param2
attr_accessor :rating
end
class RPG::Enemy::DropItem
include Jsonable
def initialize
@kind = 0
@item_id = 1
@weapon_id = 1
@armor_id = 1
@denominator = 1
end
attr_accessor :kind
attr_accessor :item_id
attr_accessor :weapon_id
attr_accessor :armor_id
attr_accessor :denominator
end
class RPG::Event
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
@pages.each{ |i| i.unpack_names }
end
def initialize(x = 0, y = 0)
@id = 0
@name = ""
@x = x
@y = y
@pages = [RPG::Event::Page.new]
end
attr_accessor :id
attr_accessor :name
attr_accessor :x
attr_accessor :y
attr_accessor :pages
end
class RPG::Event::Page
include Jsonable
def unpack_names
@graphic.unpack_names
@list.each{ |i| i.unpack_names }
end
def initialize
@condition = RPG::Event::Page::Condition.new
@graphic = RPG::Event::Page::Graphic.new
@move_type = 0
@move_speed = 3
@move_frequency = 3
@move_route = RPG::MoveRoute.new
@walk_anime = true
@step_anime = false
@direction_fix = false
@through = false
@priority_type = 0
@trigger = 0
@list = [RPG::EventCommand.new]
end
attr_accessor :condition
attr_accessor :graphic
attr_accessor :move_type
attr_accessor :move_speed
attr_accessor :move_frequency
attr_accessor :move_route
attr_accessor :walk_anime
attr_accessor :step_anime
attr_accessor :direction_fix
attr_accessor :through
attr_accessor :priority_type
attr_accessor :trigger
attr_accessor :list
end
class RPG::Event::Page::Condition
include Jsonable
def initialize
@switch1_valid = false
@switch2_valid = false
@variable_valid = false
@self_switch_valid = false
@item_valid = false
@actor_valid = false
@switch1_id = 1
@switch2_id = 1
@variable_id = 1
@variable_value = 0
@self_switch_ch = "A"
@item_id = 1
@actor_id = 1
end
attr_accessor :switch1_valid
attr_accessor :switch2_valid
attr_accessor :variable_valid
attr_accessor :self_switch_valid
attr_accessor :item_valid
attr_accessor :actor_valid
attr_accessor :switch1_id
attr_accessor :switch2_id
attr_accessor :variable_id
attr_accessor :variable_value
attr_accessor :self_switch_ch
attr_accessor :item_id
attr_accessor :actor_id
end
class RPG::Event::Page::Graphic
include Jsonable
def unpack_names
@character_name = RPG::unpack_str(@character_name)
end
def initialize
@tile_id = 0
@character_name = ""
@character_index = 0
@direction = 2
@pattern = 0
end
attr_accessor :tile_id
attr_accessor :character_name
attr_accessor :character_index
attr_accessor :direction
attr_accessor :pattern
end
class RPG::EventCommand
include Jsonable
def unpack_names
tmp = []
tmp = @parameters.dup
@parameters = []
tmp.each{|i|
if i.is_a?(String)
@parameters << RPG::unpack_str(i).dup
else
@parameters << i
end
}
end
def initialize(code = 0, indent = 0, parameters = [])
@code = code
@indent = indent
@parameters = parameters
end
attr_accessor :code
attr_accessor :indent
attr_accessor :parameters
end
class RPG::Map
include Jsonable
def unpack_names
@bgm.unpack_names
@bgs.unpack_names
@parallax_name = RPG::unpack_str(@parallax_name)
if @events != {}
@events.each_value{|v|
v.unpack_names
}
end
end
def initialize(width = 17, height = 13)
@width = width
@height = height
@scroll_type = 0
@autoplay_bgm = false
@bgm = RPG::BGM.new
@autoplay_bgs = false
@bgs = RPG::BGS.new("", 80)
@disable_dashing = false
@encounter_list = []
@encounter_step = 30
@parallax_name = ""
@parallax_loop_x = false
@parallax_loop_y = false
@parallax_sx = 0
@parallax_sy = 0
@parallax_show = false
@data = Table.new([width, height, 3])
@events = {}
end
attr_accessor :width
attr_accessor :height
attr_accessor :scroll_type
attr_accessor :autoplay_bgm
attr_accessor :bgm
attr_accessor :autoplay_bgs
attr_accessor :bgs
attr_accessor :disable_dashing
attr_accessor :encounter_list
attr_accessor :encounter_step
attr_accessor :parallax_name
attr_accessor :parallax_loop_x
attr_accessor :parallax_loop_y
attr_accessor :parallax_sx
attr_accessor :parallax_sy
attr_accessor :parallax_show
attr_accessor :data
attr_accessor :events
end
class RPG::MapInfo
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
end
def initialize
@name = ""
@parent_id = 0
@order = 0
@expanded = false
@scroll_x = 0
@scroll_y = 0
end
attr_accessor :name
attr_accessor :parent_id
attr_accessor :order
attr_accessor :expanded
attr_accessor :scroll_x
attr_accessor :scroll_y
end
class RPG::MoveCommand
include Jsonable
def initialize(code = 0, parameters = [])
@code = code
@parameters = parameters
end
attr_accessor :code
attr_accessor :parameters
end
class RPG::MoveRoute
include Jsonable
def initialize
@repeat = true
@skippable = false
@wait = false
@list = [RPG::MoveCommand.new]
end
attr_accessor :repeat
attr_accessor :skippable
attr_accessor :wait
attr_accessor :list
end
class RPG::State
include Jsonable
def unpack_names
@name = RPG::unpack_str(@name)
@message1 = RPG::unpack_str(@message1)
@message2 = RPG::unpack_str(@message2)
@message3 = RPG::unpack_str(@message3)
@message4 = RPG::unpack_str(@message4)
@note = RPG::unpack_str(@note)
end
def initialize
@id = 0
@name = ""
@icon_index = 0
@restriction = 0
@priority = 5
@atk_rate = 100
@def_rate = 100
@spi_rate = 100
@agi_rate = 100
@nonresistance = false
@offset_by_opposite = false
@slip_damage = false
@reduce_hit_ratio = false
@battle_only = true
@release_by_damage = false
@hold_turn = 0
@auto_release_prob = 0
@message1 = ""
@message2 = ""
@message3 = ""
@message4 = ""
@element_set = []
@state_set = []
@note = ""
end
attr_accessor :id
attr_accessor :name
attr_accessor :icon_index
attr_accessor :restriction
attr_accessor :priority
attr_accessor :atk_rate
attr_accessor :def_rate
attr_accessor :spi_rate
attr_accessor :agi_rate
attr_accessor :nonresistance
attr_accessor :offset_by_opposite
attr_accessor :slip_damage
attr_accessor :reduce_hit_ratio
attr_accessor :battle_only
attr_accessor :release_by_damage
attr_accessor :hold_turn
attr_accessor :auto_release_prob
attr_accessor :message1
attr_accessor :message2
attr_accessor :message3
attr_accessor :message4
attr_accessor :element_set
attr_accessor :state_set
attr_accessor :note
end
class RPG::System
include Jsonable
def unpack_names
@game_title = RPG::unpack_str(@game_title)
@battler_name = RPG::unpack_str(@battler_name)
tmp = []
tmp = @elements.dup
@elements = []
tmp.each{|i|
@elements << RPG::unpack_str(i).dup if i != nil
}
tmp = []
tmp = @switches.dup
@switches = []
tmp.each{|i|
@switches << RPG::unpack_str(i).dup if i != nil
}
tmp = []
tmp = @variables.dup
@variables = []
tmp.each{|i|
@variables << RPG::unpack_str(i).dup if i != nil
}
@terms.unpack_names
end