R3EXS 1.0.5 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +2 -2
- data/CHANGELOG.md +12 -0
- data/README.md +260 -260
- data/README_EN.md +260 -260
- data/bin/R3EXS +9 -19
- data/ext/R3EXS/R3EXS.c +601 -0
- data/ext/R3EXS/extconf.rb +3 -0
- data/lib/R3EXS/RGSS3.rb +1478 -1456
- data/lib/R3EXS/RGSS3_R3EXS.rb +504 -281
- data/lib/R3EXS/ast.rb +45 -41
- data/lib/R3EXS/error.rb +94 -75
- data/lib/R3EXS/extract_strings.rb +75 -79
- data/lib/R3EXS/inject_strings.rb +36 -44
- data/lib/R3EXS/json_rvdata2.rb +114 -104
- data/lib/R3EXS/rvdata2_json.rb +49 -18
- data/lib/R3EXS/utils.rb +1083 -970
- data/lib/R3EXS/version.rb +1 -1
- data/lib/R3EXS.rb +2 -1
- metadata +13 -14
- data/ext/rgss3a_rvdata2/extconf.rb +0 -3
- data/ext/rgss3a_rvdata2/rgss3a_rvdata2.c +0 -616
data/lib/R3EXS/RGSS3.rb
CHANGED
@@ -1,1457 +1,1479 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# RPG Maker VX Ace Color 类
|
4
|
-
class Color
|
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
|
-
# @return [
|
104
|
-
def
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
# 设置
|
109
|
-
#
|
110
|
-
# @param value [Float] 新的
|
111
|
-
#
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
#
|
118
|
-
#
|
119
|
-
|
120
|
-
|
121
|
-
#
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
# blue
|
127
|
-
#
|
128
|
-
# @
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
#
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
#
|
149
|
-
#
|
150
|
-
# @return [
|
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
|
-
when
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
#
|
202
|
-
#
|
203
|
-
#
|
204
|
-
# @return [
|
205
|
-
def
|
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
|
-
# @return [
|
245
|
-
def
|
246
|
-
|
247
|
-
end
|
248
|
-
|
249
|
-
# red
|
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
|
-
# @param
|
338
|
-
# @param
|
339
|
-
# @
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
#
|
354
|
-
#
|
355
|
-
#
|
356
|
-
# @return [
|
357
|
-
def
|
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
|
-
attr_accessor :
|
458
|
-
attr_accessor :
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
attr_accessor :
|
469
|
-
attr_accessor :
|
470
|
-
attr_accessor :
|
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
|
-
attr_accessor :
|
525
|
-
attr_accessor :
|
526
|
-
attr_accessor :
|
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
|
-
attr_accessor :
|
557
|
-
attr_accessor :
|
558
|
-
attr_accessor :
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
@
|
574
|
-
@
|
575
|
-
@
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
attr_accessor :
|
581
|
-
attr_accessor :
|
582
|
-
attr_accessor :
|
583
|
-
attr_accessor :
|
584
|
-
attr_accessor :
|
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
|
-
attr_accessor :
|
657
|
-
attr_accessor :
|
658
|
-
attr_accessor :
|
659
|
-
attr_accessor :
|
660
|
-
attr_accessor :
|
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
|
-
def
|
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
|
-
attr_accessor :
|
800
|
-
attr_accessor :
|
801
|
-
attr_accessor :
|
802
|
-
attr_accessor :
|
803
|
-
attr_accessor :
|
804
|
-
attr_accessor :
|
805
|
-
attr_accessor :
|
806
|
-
end
|
807
|
-
|
808
|
-
class
|
809
|
-
def initialize
|
810
|
-
super
|
811
|
-
@scope
|
812
|
-
@
|
813
|
-
@
|
814
|
-
@
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
@
|
819
|
-
end
|
820
|
-
|
821
|
-
attr_accessor :
|
822
|
-
attr_accessor :
|
823
|
-
attr_accessor :
|
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
|
-
@features.push(RPG::BaseItem::Feature.new(
|
884
|
-
end
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
attr_accessor :
|
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
|
-
attr_accessor :
|
940
|
-
attr_accessor :
|
941
|
-
attr_accessor :
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
end
|
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
|
-
attr_accessor :
|
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
|
-
attr_accessor :
|
1100
|
-
attr_accessor :
|
1101
|
-
attr_accessor :
|
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
|
-
attr_accessor :
|
1131
|
-
attr_accessor :
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
@
|
1145
|
-
@
|
1146
|
-
end
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
attr_accessor :
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
@
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
attr_accessor :
|
1184
|
-
attr_accessor :
|
1185
|
-
attr_accessor :
|
1186
|
-
attr_accessor :
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
@
|
1193
|
-
@
|
1194
|
-
@
|
1195
|
-
@
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
@
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
attr_accessor :
|
1207
|
-
attr_accessor :
|
1208
|
-
attr_accessor :
|
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
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
attr_accessor :
|
1281
|
-
attr_accessor :
|
1282
|
-
attr_accessor :
|
1283
|
-
attr_accessor :
|
1284
|
-
attr_accessor :
|
1285
|
-
attr_accessor :
|
1286
|
-
attr_accessor :
|
1287
|
-
attr_accessor :
|
1288
|
-
attr_accessor :
|
1289
|
-
attr_accessor :
|
1290
|
-
attr_accessor :
|
1291
|
-
attr_accessor :
|
1292
|
-
attr_accessor :
|
1293
|
-
attr_accessor :
|
1294
|
-
attr_accessor :
|
1295
|
-
attr_accessor :
|
1296
|
-
attr_accessor :
|
1297
|
-
attr_accessor :
|
1298
|
-
attr_accessor :
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
attr_accessor :
|
1312
|
-
attr_accessor :
|
1313
|
-
attr_accessor :
|
1314
|
-
attr_accessor :
|
1315
|
-
attr_accessor :
|
1316
|
-
attr_accessor :
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
attr_accessor :
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
end
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
end
|
1435
|
-
|
1436
|
-
def self.
|
1437
|
-
Audio.
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# RPG Maker VX Ace Color 类
|
4
|
+
class Color
|
5
|
+
|
6
|
+
# red 通道的值
|
7
|
+
#
|
8
|
+
# @return [Integer]
|
9
|
+
attr_reader :red
|
10
|
+
|
11
|
+
# green 通道的值
|
12
|
+
#
|
13
|
+
# @return [Integer]
|
14
|
+
attr_reader :green
|
15
|
+
|
16
|
+
# blue 通道的值
|
17
|
+
#
|
18
|
+
# @return [Integer]
|
19
|
+
attr_reader :blue
|
20
|
+
|
21
|
+
# alpha 通道的值
|
22
|
+
#
|
23
|
+
# @return [Integer]
|
24
|
+
attr_reader :alpha
|
25
|
+
|
26
|
+
# 初始化时接受以下几种参数情况:
|
27
|
+
# - 无参数时,默认 (0, 0, 0, 0)
|
28
|
+
# - 3 个参数时,默认为 (red, green, blue, 255)
|
29
|
+
# - 4 个参数时,指定 (red, green, blue, alpha)
|
30
|
+
#
|
31
|
+
# @param args [Array<Integer>] red, green, blue, alpha
|
32
|
+
# - red: 红色通道的值 (0-255)
|
33
|
+
# - green: 绿色通道的值 (0-255)
|
34
|
+
# - blue: 蓝色通道的值 (0-255)
|
35
|
+
# - alpha: 可选,透明度通道的值 (0-255),默认为 255
|
36
|
+
#
|
37
|
+
# @return [Color]
|
38
|
+
def initialize(*args)
|
39
|
+
case args.length
|
40
|
+
when 0 # 无参数
|
41
|
+
set(0, 0, 0, 0)
|
42
|
+
when 3 # 3 个参数, alpha 默认为 255
|
43
|
+
set(*args)
|
44
|
+
when 4 # 4 个参数, 分别为 red, green, blue, alpha
|
45
|
+
set(*args)
|
46
|
+
else
|
47
|
+
raise ArgumentError, "Invalid arguments for initialize method"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# 设置 Color 对象的值
|
52
|
+
# - 无参数时,默认 (0, 0, 0, 0)
|
53
|
+
# - 3 个参数时,默认为 (red, green, blue, 255)
|
54
|
+
# - 4 个参数时,指定 (red, green, blue, alpha)
|
55
|
+
#
|
56
|
+
# @param args [Array<Integer>] red, green, blue, alpha
|
57
|
+
# - red: 红色通道的值 (0-255)
|
58
|
+
# - green: 绿色通道的值 (0-255)
|
59
|
+
# - blue: 蓝色通道的值 (0-255)
|
60
|
+
# - alpha: 可选,透明度通道的值 (0-255),默认为 255
|
61
|
+
#
|
62
|
+
# @return [void]
|
63
|
+
def set(*args)
|
64
|
+
case args.length
|
65
|
+
when 1 # 一个参数, 为 Color 对象
|
66
|
+
if args[0].is_a?(Color)
|
67
|
+
other_color = args[0]
|
68
|
+
self.red = other_color.red
|
69
|
+
self.green = other_color.green
|
70
|
+
self.blue = other_color.blue
|
71
|
+
self.alpha = other_color.alpha
|
72
|
+
else
|
73
|
+
raise ArgumentError, "Invalid arguments for set method"
|
74
|
+
end
|
75
|
+
when 3 # 三个参数, 分别为 red, green, blue (alpha 默认为 255)
|
76
|
+
self.red = args[0]
|
77
|
+
self.green = args[1]
|
78
|
+
self.blue = args[2]
|
79
|
+
self.alpha = 255.0
|
80
|
+
when 4 # 四个参数, 分别为 red, green, blue, alpha
|
81
|
+
self.red = args[0]
|
82
|
+
self.green = args[1]
|
83
|
+
self.blue = args[2]
|
84
|
+
self.alpha = args[3]
|
85
|
+
else
|
86
|
+
raise ArgumentError, "Invalid arguments for set method"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# 序列化 Color 对象
|
91
|
+
#
|
92
|
+
# @param level [Integer] 序列化的级别
|
93
|
+
#
|
94
|
+
# @return [String]
|
95
|
+
def _dump(level)
|
96
|
+
[@red, @green, @blue, @alpha].pack('D4')
|
97
|
+
end
|
98
|
+
|
99
|
+
# 反序列化 Color 对象
|
100
|
+
#
|
101
|
+
# @param obj [String] 序列化后的字符串
|
102
|
+
#
|
103
|
+
# @return [Color]
|
104
|
+
def Color._load(obj)
|
105
|
+
new(*obj.unpack('D4'))
|
106
|
+
end
|
107
|
+
|
108
|
+
# 设置 red 通道的值,限制在 0 到 255 之间
|
109
|
+
#
|
110
|
+
# @param value [Float] 新的 red 通道值
|
111
|
+
#
|
112
|
+
# @return [void]
|
113
|
+
def red=(value)
|
114
|
+
@red = [[value, 0.0].max, 255.0].min.to_i
|
115
|
+
end
|
116
|
+
|
117
|
+
# 设置 green 通道的值,限制在 0 到 255 之间
|
118
|
+
#
|
119
|
+
# @param value [Float] 新的 green 通道值
|
120
|
+
#
|
121
|
+
# @return [void]
|
122
|
+
def green=(value)
|
123
|
+
@green = [[value, 0.0].max, 255.0].min.to_i
|
124
|
+
end
|
125
|
+
|
126
|
+
# 设置 blue 通道的值,限制在 0 到 255 之间
|
127
|
+
#
|
128
|
+
# @param value [Float] 新的 blue 通道值
|
129
|
+
#
|
130
|
+
# @return [void]
|
131
|
+
def blue=(value)
|
132
|
+
@blue = [[value, 0.0].max, 255.0].min.to_i
|
133
|
+
end
|
134
|
+
|
135
|
+
# 设置 alpha 通道的值,限制在 0 到 255 之间
|
136
|
+
#
|
137
|
+
# @param value [Float] 新的 alpha 通道值
|
138
|
+
#
|
139
|
+
# @return [void]
|
140
|
+
def alpha=(value)
|
141
|
+
@alpha = [[value, 0.0].max, 255.0].min
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# RPG Maker VX Ace Tone 类
|
146
|
+
class Tone
|
147
|
+
|
148
|
+
# red 通道的值
|
149
|
+
#
|
150
|
+
# @return [Integer]
|
151
|
+
attr_reader :red
|
152
|
+
|
153
|
+
# green 通道的值
|
154
|
+
#
|
155
|
+
# @return [Integer]
|
156
|
+
attr_reader :green
|
157
|
+
|
158
|
+
# blue 通道的值
|
159
|
+
#
|
160
|
+
# @return [Integer]
|
161
|
+
attr_reader :blue
|
162
|
+
|
163
|
+
# gray 通道的值
|
164
|
+
#
|
165
|
+
# @return [Integer]
|
166
|
+
attr_reader :gray
|
167
|
+
|
168
|
+
# 初始化时接受以下几种参数情况:
|
169
|
+
# - 无参数时,默认 (0, 0, 0, 0)
|
170
|
+
# - 3 个参数时,默认为 (red, green, blue, 0)
|
171
|
+
# - 4 个参数时,指定 (red, green, blue, gray)
|
172
|
+
#
|
173
|
+
# @param args [Array<Integer>] red, green, blue, gray
|
174
|
+
# - red: 红色通道的值 (-255-255)
|
175
|
+
# - green: 绿色通道的值 (-255-255)
|
176
|
+
# - blue: 蓝色通道的值 (-255-255)
|
177
|
+
# - gray: 可选,灰度通道的值 (0-255),默认为 0
|
178
|
+
#
|
179
|
+
# @return [Tone]
|
180
|
+
def initialize(*args)
|
181
|
+
case args.length
|
182
|
+
when 0 # 无参数
|
183
|
+
set(0, 0, 0, 0)
|
184
|
+
when 3 # 3 个参数, gray 默认为 0
|
185
|
+
set(*args)
|
186
|
+
when 4 # 4 个参数, 分别为 red, green, blue, gray
|
187
|
+
set(*args)
|
188
|
+
else
|
189
|
+
raise ArgumentError, "Invalid arguments for initialize method"
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# 设置 Tone 对象的值
|
194
|
+
# - 无参数时,默认 (0, 0, 0, 0)
|
195
|
+
# - 3 个参数时,默认为 (red, green, blue, 0)
|
196
|
+
# - 4 个参数时,指定 (red, green, blue, gray)
|
197
|
+
#
|
198
|
+
# @param args [Array<Integer>] red, green, blue, gray
|
199
|
+
# - red: 红色通道的值 (-255-255)
|
200
|
+
# - green: 绿色通道的值 (-255-255)
|
201
|
+
# - blue: 蓝色通道的值 (-255-255)
|
202
|
+
# - gray: 可选,透明度通道的值 (0-255),默认为 0
|
203
|
+
#
|
204
|
+
# @return [void]
|
205
|
+
def set(*args)
|
206
|
+
case args.length
|
207
|
+
when 1 # 一个参数, 为 Tone 对象
|
208
|
+
if args[0].is_a?(Tone)
|
209
|
+
self.red = args[0].red
|
210
|
+
self.green = args[0].green
|
211
|
+
self.blue = args[0].blue
|
212
|
+
self.gray = args[0].gray
|
213
|
+
else
|
214
|
+
raise ArgumentError, "Invalid arguments for set method"
|
215
|
+
end
|
216
|
+
when 3 # 三个参数, 分别为 red, green, blue (gray 默认为 0)
|
217
|
+
self.red = args[0]
|
218
|
+
self.green = args[1]
|
219
|
+
self.blue = args[2]
|
220
|
+
self.gray = 0.0
|
221
|
+
when 4 # 四个参数, 分别为 red, green, blue, gray
|
222
|
+
self.red = args[0]
|
223
|
+
self.green = args[1]
|
224
|
+
self.blue = args[2]
|
225
|
+
self.gray = args[3]
|
226
|
+
else
|
227
|
+
raise ArgumentError, "Invalid arguments for set method"
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
# 序列化 Tone 对象
|
232
|
+
#
|
233
|
+
# @param level [Integer] 序列化的级别
|
234
|
+
#
|
235
|
+
# @return [String]
|
236
|
+
def _dump(level)
|
237
|
+
[@red, @green, @blue, @gray].pack('D4')
|
238
|
+
end
|
239
|
+
|
240
|
+
# 反序列化 Tone 对象
|
241
|
+
#
|
242
|
+
# @param obj [String] 序列化后的字符串
|
243
|
+
#
|
244
|
+
# @return [Tone]
|
245
|
+
def Tone._load(obj)
|
246
|
+
new(*obj.unpack('D4'))
|
247
|
+
end
|
248
|
+
|
249
|
+
# 设置 red 通道的值,限制在 -255 到 255 之间
|
250
|
+
#
|
251
|
+
# @param value [Float] 新的 red 通道值
|
252
|
+
#
|
253
|
+
# @return [void]
|
254
|
+
def red=(value)
|
255
|
+
@red = [[value, -255.0].max, 255.0].min.to_i
|
256
|
+
end
|
257
|
+
|
258
|
+
# 设置 green 通道的值,限制在 -255 到 255 之间
|
259
|
+
#
|
260
|
+
# @param value [Float] 新的 green 通道值
|
261
|
+
#
|
262
|
+
# @return [void]
|
263
|
+
def green=(value)
|
264
|
+
@green = [[value, -255.0].max, 255.0].min.to_i
|
265
|
+
end
|
266
|
+
|
267
|
+
# 设置 blue 通道的值,限制在 -255 到 255 之间
|
268
|
+
#
|
269
|
+
# @param value [Float] 新的 blue 通道值
|
270
|
+
#
|
271
|
+
# @return [void]
|
272
|
+
def blue=(value)
|
273
|
+
@blue = [[value, -255.0].max, 255.0].min.to_i
|
274
|
+
end
|
275
|
+
|
276
|
+
# 设置 alpha 通道的值,限制在 0 到 255 之间
|
277
|
+
#
|
278
|
+
# @param value [Float] 新的 alpha 通道值
|
279
|
+
#
|
280
|
+
# @return [void]
|
281
|
+
def gray=(value)
|
282
|
+
@gray = [[value, 0.0].max, 255.0].min.to_i
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
# RPG Maker VX Ace Table 类
|
287
|
+
#
|
288
|
+
# Table 是一个多维数组,每个元素都是带符号的两字节整数(int16_t), 也就是 -32,768~32,767 之间的整数
|
289
|
+
#
|
290
|
+
# Ruby Array 类在处理大量信息时效率很差,因此使用了此类。
|
291
|
+
class Table
|
292
|
+
|
293
|
+
# 数据数组
|
294
|
+
#
|
295
|
+
# @return [Array<Integer>]
|
296
|
+
attr_accessor :data
|
297
|
+
|
298
|
+
# 维度
|
299
|
+
#
|
300
|
+
# @return [Integer]
|
301
|
+
attr_accessor :dim
|
302
|
+
|
303
|
+
# 第一维的长度
|
304
|
+
#
|
305
|
+
# @return [Integer]
|
306
|
+
attr_accessor :xsize
|
307
|
+
|
308
|
+
# 第二维的长度
|
309
|
+
#
|
310
|
+
# @return [Integer]
|
311
|
+
attr_accessor :ysize
|
312
|
+
|
313
|
+
# 第三维的长度
|
314
|
+
#
|
315
|
+
# @return [Integer]
|
316
|
+
attr_accessor :zsize
|
317
|
+
|
318
|
+
# 初始化 Table 对象,指定多维数组各维的长度。生成的数组可以是 1~3 维,甚至是没有元素的数组。
|
319
|
+
#
|
320
|
+
# 初始化时传入的参数个数决定了生成的数组维度:
|
321
|
+
# - 最少 1 维,最多 3 维。
|
322
|
+
# - `ysize` 和 `zsize` 参数可以省略,默认值为 1。
|
323
|
+
#
|
324
|
+
# 注意:该类没有参数检查,请确保 `ysize` 和 `zsize` 的值在 `[-32768, 32767]` 范围内。
|
325
|
+
#
|
326
|
+
# @param xsize [Integer] 第一维的长度(必需)
|
327
|
+
# @param ysize [Integer, nil] 第二维的长度(可选,默认值为 nil)
|
328
|
+
# @param zsize [Integer, nil] 第三维的长度(可选,默认值为 nil)
|
329
|
+
#
|
330
|
+
# @return [Table]
|
331
|
+
def initialize(xsize, ysize = nil, zsize = nil)
|
332
|
+
init_attr(xsize, ysize, zsize)
|
333
|
+
end
|
334
|
+
|
335
|
+
# 设置各维的长度
|
336
|
+
#
|
337
|
+
# @param xsize [Integer] 第一维的长度
|
338
|
+
# @param ysize [Integer, nil] 第二维的长度(如果为 nil,则默认为 1)
|
339
|
+
# @param zsize [Integer, nil] 第三维的长度(如果为 nil,则默认为 1)
|
340
|
+
#
|
341
|
+
# @return [void]
|
342
|
+
def init_attr(xsize, ysize, zsize)
|
343
|
+
@dim = 1 + (ysize.nil? ? 0 : 1) + (zsize.nil? ? 0 : 1)
|
344
|
+
@xsize = xsize
|
345
|
+
@ysize = ysize.nil? ? 1 : ysize
|
346
|
+
@zsize = zsize.nil? ? 1 : zsize
|
347
|
+
@data = Array.new(@xsize * @ysize * @zsize, 0)
|
348
|
+
end
|
349
|
+
|
350
|
+
# 获取指定位置的元素值
|
351
|
+
#
|
352
|
+
# @param x [Integer] 第一维的长度(必需)
|
353
|
+
# @param y [Integer] 第二维的长度(可选,默认值为 0)
|
354
|
+
# @param z [Integer] 第三维的长度(可选,默认值为 0)
|
355
|
+
#
|
356
|
+
# @return [Integer]
|
357
|
+
def [](x, y = 0, z = 0)
|
358
|
+
@data[x + y * @xsize + z * @xsize * @ysize]
|
359
|
+
end
|
360
|
+
|
361
|
+
# 设置指定位置的元素值
|
362
|
+
#
|
363
|
+
# @param args [Array<Integer>] x, y, z, v
|
364
|
+
# - x: 第一维的长度(必需)
|
365
|
+
# - y: 第二维的长度(可选,默认值为 nil)
|
366
|
+
# - z: 第三维的长度(可选,默认值为 nil)
|
367
|
+
# - v: 新的元素值
|
368
|
+
#
|
369
|
+
# @return [void]
|
370
|
+
def []=(*args)
|
371
|
+
v = args.pop
|
372
|
+
x, y, z = args
|
373
|
+
y ||= 0
|
374
|
+
z ||= 0
|
375
|
+
@data[x + y * @xsize + z * @xsize * @ysize] = v
|
376
|
+
end
|
377
|
+
|
378
|
+
# 扩容 Table 对象,保留原有数据
|
379
|
+
#
|
380
|
+
# @param xsize [Integer] 第一维的长度(必需)
|
381
|
+
# @param ysize [Integer, nil] 第二维的长度(可选,默认值为 nil)
|
382
|
+
# @param zsize [Integer, nil] 第三维的长度(可选,默认值为 nil)
|
383
|
+
#
|
384
|
+
# @return [void]
|
385
|
+
def resize(xsize, ysize = nil, zsize = nil)
|
386
|
+
old_data = @data.dup
|
387
|
+
old_xsize, old_ysize, old_zsize = @xsize, @ysize, @zsize
|
388
|
+
init_attr(xsize, ysize, zsize)
|
389
|
+
(0...[old_xsize, @xsize].min).each { |x|
|
390
|
+
(0...[old_ysize, @ysize].min).each { |y|
|
391
|
+
(0...[old_zsize, @zsize].min).each { |z|
|
392
|
+
@data[x + y * @xsize + z * @xsize * @ysize] = old_data[x + y * old_xsize + z * old_xsize * old_ysize]
|
393
|
+
}
|
394
|
+
}
|
395
|
+
}
|
396
|
+
end
|
397
|
+
|
398
|
+
# 序列化 Table 对象
|
399
|
+
#
|
400
|
+
# @param level [Integer] 序列化的级别
|
401
|
+
#
|
402
|
+
# @return [String]
|
403
|
+
def _dump(level)
|
404
|
+
s = [@dim, @xsize, @ysize, @zsize, @xsize * @ysize * @zsize].pack('LLLLL')
|
405
|
+
@data.each do |d|
|
406
|
+
s << [d].pack('s')
|
407
|
+
end
|
408
|
+
s
|
409
|
+
end
|
410
|
+
|
411
|
+
# 反序列化 Table 对象
|
412
|
+
#
|
413
|
+
# @param obj [String] 序列化后的字符串
|
414
|
+
#
|
415
|
+
# @return [Table]
|
416
|
+
def Table._load(obj)
|
417
|
+
# 从序列化字符串中解包维度信息
|
418
|
+
dim, xsize, ysize, zsize, total_size = *obj[0, 20].unpack('LLLLL')
|
419
|
+
# 初始化 Table 对象
|
420
|
+
table = Table.new(*[xsize, ysize, zsize].first(dim))
|
421
|
+
table.data = obj[20, total_size * 2].unpack("s#{total_size}")
|
422
|
+
# 现在 @data 已经从序列化字符串中完整提取
|
423
|
+
table
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
427
|
+
# RPG Maker VX Ace 的RPG 模块
|
428
|
+
module RPG
|
429
|
+
class Map
|
430
|
+
def initialize(width, height)
|
431
|
+
@display_name = ''
|
432
|
+
@tileset_id = 1
|
433
|
+
@width = width
|
434
|
+
@height = height
|
435
|
+
@scroll_type = 0
|
436
|
+
@specify_battleback = false
|
437
|
+
@battleback_floor_name = ''
|
438
|
+
@battleback_wall_name = ''
|
439
|
+
@autoplay_bgm = false
|
440
|
+
@bgm = RPG::BGM.new
|
441
|
+
@autoplay_bgs = false
|
442
|
+
@bgs = RPG::BGS.new('', 80)
|
443
|
+
@disable_dashing = false
|
444
|
+
@encounter_list = []
|
445
|
+
@encounter_step = 30
|
446
|
+
@parallax_name = ''
|
447
|
+
@parallax_loop_x = false
|
448
|
+
@parallax_loop_y = false
|
449
|
+
@parallax_sx = 0
|
450
|
+
@parallax_sy = 0
|
451
|
+
@parallax_show = false
|
452
|
+
@note = ''
|
453
|
+
@data = Table.new(width, height, 4)
|
454
|
+
@events = {}
|
455
|
+
end
|
456
|
+
|
457
|
+
attr_accessor :display_name
|
458
|
+
attr_accessor :tileset_id
|
459
|
+
attr_accessor :width
|
460
|
+
attr_accessor :height
|
461
|
+
attr_accessor :scroll_type
|
462
|
+
attr_accessor :specify_battleback
|
463
|
+
attr_accessor :battleback1_name
|
464
|
+
attr_accessor :battleback2_name
|
465
|
+
attr_accessor :autoplay_bgm
|
466
|
+
attr_accessor :bgm
|
467
|
+
attr_accessor :autoplay_bgs
|
468
|
+
attr_accessor :bgs
|
469
|
+
attr_accessor :disable_dashing
|
470
|
+
attr_accessor :encounter_list
|
471
|
+
attr_accessor :encounter_step
|
472
|
+
attr_accessor :parallax_name
|
473
|
+
attr_accessor :parallax_loop_x
|
474
|
+
attr_accessor :parallax_loop_y
|
475
|
+
attr_accessor :parallax_sx
|
476
|
+
attr_accessor :parallax_sy
|
477
|
+
attr_accessor :parallax_show
|
478
|
+
attr_accessor :note
|
479
|
+
attr_accessor :data
|
480
|
+
attr_accessor :events
|
481
|
+
end
|
482
|
+
|
483
|
+
class Map::Encounter
|
484
|
+
def initialize
|
485
|
+
@troop_id = 1
|
486
|
+
@weight = 10
|
487
|
+
@region_set = []
|
488
|
+
end
|
489
|
+
|
490
|
+
attr_accessor :troop_id
|
491
|
+
attr_accessor :weight
|
492
|
+
attr_accessor :region_set
|
493
|
+
end
|
494
|
+
|
495
|
+
class MapInfo
|
496
|
+
def initialize
|
497
|
+
@name = ''
|
498
|
+
@parent_id = 0
|
499
|
+
@order = 0
|
500
|
+
@expanded = false
|
501
|
+
@scroll_x = 0
|
502
|
+
@scroll_y = 0
|
503
|
+
end
|
504
|
+
|
505
|
+
attr_accessor :name
|
506
|
+
attr_accessor :parent_id
|
507
|
+
attr_accessor :order
|
508
|
+
attr_accessor :expanded
|
509
|
+
attr_accessor :scroll_x
|
510
|
+
attr_accessor :scroll_y
|
511
|
+
end
|
512
|
+
|
513
|
+
class Event
|
514
|
+
def initialize(x, y)
|
515
|
+
@id = 0
|
516
|
+
@name = ''
|
517
|
+
@x = x
|
518
|
+
@y = y
|
519
|
+
@pages = [RPG::Event::Page.new]
|
520
|
+
end
|
521
|
+
|
522
|
+
attr_accessor :id
|
523
|
+
attr_accessor :name
|
524
|
+
attr_accessor :x
|
525
|
+
attr_accessor :y
|
526
|
+
attr_accessor :pages
|
527
|
+
end
|
528
|
+
|
529
|
+
class Event::Page
|
530
|
+
def initialize
|
531
|
+
@condition = RPG::Event::Page::Condition.new
|
532
|
+
@graphic = RPG::Event::Page::Graphic.new
|
533
|
+
@move_type = 0
|
534
|
+
@move_speed = 3
|
535
|
+
@move_frequency = 3
|
536
|
+
@move_route = RPG::MoveRoute.new
|
537
|
+
@walk_anime = true
|
538
|
+
@step_anime = false
|
539
|
+
@direction_fix = false
|
540
|
+
@through = false
|
541
|
+
@priority_type = 0
|
542
|
+
@trigger = 0
|
543
|
+
@list = [RPG::EventCommand.new]
|
544
|
+
end
|
545
|
+
|
546
|
+
attr_accessor :condition
|
547
|
+
attr_accessor :graphic
|
548
|
+
attr_accessor :move_type
|
549
|
+
attr_accessor :move_speed
|
550
|
+
attr_accessor :move_frequency
|
551
|
+
attr_accessor :move_route
|
552
|
+
attr_accessor :walk_anime
|
553
|
+
attr_accessor :step_anime
|
554
|
+
attr_accessor :direction_fix
|
555
|
+
attr_accessor :through
|
556
|
+
attr_accessor :priority_type
|
557
|
+
attr_accessor :trigger
|
558
|
+
attr_accessor :list
|
559
|
+
end
|
560
|
+
|
561
|
+
class Event::Page::Condition
|
562
|
+
def initialize
|
563
|
+
@switch1_valid = false
|
564
|
+
@switch2_valid = false
|
565
|
+
@variable_valid = false
|
566
|
+
@self_switch_valid = false
|
567
|
+
@item_valid = false
|
568
|
+
@actor_valid = false
|
569
|
+
@switch1_id = 1
|
570
|
+
@switch2_id = 1
|
571
|
+
@variable_id = 1
|
572
|
+
@variable_value = 0
|
573
|
+
@self_switch_ch = 'A'
|
574
|
+
@item_id = 1
|
575
|
+
@actor_id = 1
|
576
|
+
end
|
577
|
+
|
578
|
+
attr_accessor :switch1_valid
|
579
|
+
attr_accessor :switch2_valid
|
580
|
+
attr_accessor :variable_valid
|
581
|
+
attr_accessor :self_switch_valid
|
582
|
+
attr_accessor :item_valid
|
583
|
+
attr_accessor :actor_valid
|
584
|
+
attr_accessor :switch1_id
|
585
|
+
attr_accessor :switch2_id
|
586
|
+
attr_accessor :variable_id
|
587
|
+
attr_accessor :variable_value
|
588
|
+
attr_accessor :self_switch_ch
|
589
|
+
attr_accessor :item_id
|
590
|
+
attr_accessor :actor_id
|
591
|
+
end
|
592
|
+
|
593
|
+
class Event::Page::Graphic
|
594
|
+
def initialize
|
595
|
+
@tile_id = 0
|
596
|
+
@character_name = ''
|
597
|
+
@character_index = 0
|
598
|
+
@direction = 2
|
599
|
+
@pattern = 0
|
600
|
+
end
|
601
|
+
|
602
|
+
attr_accessor :tile_id
|
603
|
+
attr_accessor :character_name
|
604
|
+
attr_accessor :character_index
|
605
|
+
attr_accessor :direction
|
606
|
+
attr_accessor :pattern
|
607
|
+
end
|
608
|
+
|
609
|
+
class EventCommand
|
610
|
+
def initialize(code = 0, indent = 0, parameters = [])
|
611
|
+
@code = code
|
612
|
+
@indent = indent
|
613
|
+
@parameters = parameters
|
614
|
+
end
|
615
|
+
|
616
|
+
attr_accessor :code
|
617
|
+
attr_accessor :indent
|
618
|
+
attr_accessor :parameters
|
619
|
+
end
|
620
|
+
|
621
|
+
class MoveRoute
|
622
|
+
def initialize
|
623
|
+
@repeat = true
|
624
|
+
@skippable = false
|
625
|
+
@wait = false
|
626
|
+
@list = [RPG::MoveCommand.new]
|
627
|
+
end
|
628
|
+
|
629
|
+
attr_accessor :repeat
|
630
|
+
attr_accessor :skippable
|
631
|
+
attr_accessor :wait
|
632
|
+
attr_accessor :list
|
633
|
+
end
|
634
|
+
|
635
|
+
class MoveCommand
|
636
|
+
def initialize(code = 0, parameters = [])
|
637
|
+
@code = code
|
638
|
+
@parameters = parameters
|
639
|
+
end
|
640
|
+
|
641
|
+
attr_accessor :code
|
642
|
+
attr_accessor :parameters
|
643
|
+
end
|
644
|
+
|
645
|
+
class BaseItem
|
646
|
+
def initialize
|
647
|
+
@id = 0
|
648
|
+
@name = ''
|
649
|
+
@icon_index = 0
|
650
|
+
@description = ''
|
651
|
+
@features = []
|
652
|
+
@note = ''
|
653
|
+
end
|
654
|
+
|
655
|
+
attr_accessor :id
|
656
|
+
attr_accessor :name
|
657
|
+
attr_accessor :icon_index
|
658
|
+
attr_accessor :description
|
659
|
+
attr_accessor :features
|
660
|
+
attr_accessor :note
|
661
|
+
end
|
662
|
+
|
663
|
+
class Actor < BaseItem
|
664
|
+
|
665
|
+
def initialize
|
666
|
+
super
|
667
|
+
@nickname = ''
|
668
|
+
@class_id = 1
|
669
|
+
@initial_level = 1
|
670
|
+
@max_level = 99
|
671
|
+
@character_name = ''
|
672
|
+
@character_index = 0
|
673
|
+
@face_name = ''
|
674
|
+
@face_index = 0
|
675
|
+
@equips = [0, 0, 0, 0, 0]
|
676
|
+
end
|
677
|
+
|
678
|
+
attr_accessor :nickname
|
679
|
+
attr_accessor :class_id
|
680
|
+
attr_accessor :initial_level
|
681
|
+
attr_accessor :max_level
|
682
|
+
attr_accessor :character_name
|
683
|
+
attr_accessor :character_index
|
684
|
+
attr_accessor :face_name
|
685
|
+
attr_accessor :face_index
|
686
|
+
attr_accessor :equips
|
687
|
+
end
|
688
|
+
|
689
|
+
class Class < BaseItem
|
690
|
+
def initialize
|
691
|
+
super
|
692
|
+
@exp_params = [30, 20, 30, 30]
|
693
|
+
@params = Table.new(8, 100)
|
694
|
+
(1..99).each do |i|
|
695
|
+
@params[0, i] = 400 + i * 50
|
696
|
+
@params[1, i] = 80 + i * 10
|
697
|
+
(2..5).each { |j| @params[j, i] = 15 + i * 5 / 4 }
|
698
|
+
(6..7).each { |j| @params[j, i] = 30 + i * 5 / 2 }
|
699
|
+
end
|
700
|
+
@learnings = []
|
701
|
+
@features.push(RPG::BaseItem::Feature.new(23, 0, 1))
|
702
|
+
@features.push(RPG::BaseItem::Feature.new(22, 0, 0.95))
|
703
|
+
@features.push(RPG::BaseItem::Feature.new(22, 1, 0.05))
|
704
|
+
@features.push(RPG::BaseItem::Feature.new(22, 2, 0.04))
|
705
|
+
@features.push(RPG::BaseItem::Feature.new(41, 1))
|
706
|
+
@features.push(RPG::BaseItem::Feature.new(51, 1))
|
707
|
+
@features.push(RPG::BaseItem::Feature.new(52, 1))
|
708
|
+
end
|
709
|
+
|
710
|
+
def exp_for_level(level)
|
711
|
+
lv = level.to_f
|
712
|
+
basis = @exp_params[0].to_f
|
713
|
+
extra = @exp_params[1].to_f
|
714
|
+
acc_a = @exp_params[2].to_f
|
715
|
+
acc_b = @exp_params[3].to_f
|
716
|
+
return (basis * ((lv - 1) ** (0.9 + acc_a / 250)) * lv * (lv + 1) /
|
717
|
+
(6 + lv ** 2 / 50 / acc_b) + (lv - 1) * extra).round.to_i
|
718
|
+
end
|
719
|
+
|
720
|
+
attr_accessor :exp_params
|
721
|
+
attr_accessor :params
|
722
|
+
attr_accessor :learnings
|
723
|
+
end
|
724
|
+
|
725
|
+
class UsableItem < BaseItem
|
726
|
+
def initialize
|
727
|
+
super
|
728
|
+
@scope = 0
|
729
|
+
@occasion = 0
|
730
|
+
@speed = 0
|
731
|
+
@success_rate = 100
|
732
|
+
@repeats = 1
|
733
|
+
@tp_gain = 0
|
734
|
+
@hit_type = 0
|
735
|
+
@animation_id = 0
|
736
|
+
@damage = RPG::UsableItem::Damage.new
|
737
|
+
@effects = []
|
738
|
+
end
|
739
|
+
|
740
|
+
def for_opponent?
|
741
|
+
[1, 2, 3, 4, 5, 6].include?(@scope)
|
742
|
+
end
|
743
|
+
|
744
|
+
def for_friend?
|
745
|
+
[7, 8, 9, 10, 11].include?(@scope)
|
746
|
+
end
|
747
|
+
|
748
|
+
def for_dead_friend?
|
749
|
+
[9, 10].include?(@scope)
|
750
|
+
end
|
751
|
+
|
752
|
+
def for_user?
|
753
|
+
@scope == 11
|
754
|
+
end
|
755
|
+
|
756
|
+
def for_one?
|
757
|
+
[1, 3, 7, 9, 11].include?(@scope)
|
758
|
+
end
|
759
|
+
|
760
|
+
def for_random?
|
761
|
+
[3, 4, 5, 6].include?(@scope)
|
762
|
+
end
|
763
|
+
|
764
|
+
def number_of_targets
|
765
|
+
for_random? ? @scope - 2 : 0
|
766
|
+
end
|
767
|
+
|
768
|
+
def for_all?
|
769
|
+
[2, 8, 10].include?(@scope)
|
770
|
+
end
|
771
|
+
|
772
|
+
def need_selection?
|
773
|
+
[1, 7, 9].include?(@scope)
|
774
|
+
end
|
775
|
+
|
776
|
+
def battle_ok?
|
777
|
+
[0, 1].include?(@occasion)
|
778
|
+
end
|
779
|
+
|
780
|
+
def menu_ok?
|
781
|
+
[0, 2].include?(@occasion)
|
782
|
+
end
|
783
|
+
|
784
|
+
def certain?
|
785
|
+
@hit_type == 0
|
786
|
+
end
|
787
|
+
|
788
|
+
def physical?
|
789
|
+
@hit_type == 1
|
790
|
+
end
|
791
|
+
|
792
|
+
def magical?
|
793
|
+
@hit_type == 2
|
794
|
+
end
|
795
|
+
|
796
|
+
attr_accessor :scope
|
797
|
+
attr_accessor :occasion
|
798
|
+
attr_accessor :speed
|
799
|
+
attr_accessor :animation_id
|
800
|
+
attr_accessor :success_rate
|
801
|
+
attr_accessor :repeats
|
802
|
+
attr_accessor :tp_gain
|
803
|
+
attr_accessor :hit_type
|
804
|
+
attr_accessor :damage
|
805
|
+
attr_accessor :effects
|
806
|
+
end
|
807
|
+
|
808
|
+
class Skill < UsableItem
|
809
|
+
def initialize
|
810
|
+
super
|
811
|
+
@scope = 1
|
812
|
+
@stype_id = 1
|
813
|
+
@mp_cost = 0
|
814
|
+
@tp_cost = 0
|
815
|
+
@message1 = ''
|
816
|
+
@message2 = ''
|
817
|
+
@required_wtype_id1 = 0
|
818
|
+
@required_wtype_id2 = 0
|
819
|
+
end
|
820
|
+
|
821
|
+
attr_accessor :stype_id
|
822
|
+
attr_accessor :mp_cost
|
823
|
+
attr_accessor :tp_cost
|
824
|
+
attr_accessor :message1
|
825
|
+
attr_accessor :message2
|
826
|
+
attr_accessor :required_wtype_id1
|
827
|
+
attr_accessor :required_wtype_id2
|
828
|
+
end
|
829
|
+
|
830
|
+
class Item < UsableItem
|
831
|
+
def initialize
|
832
|
+
super
|
833
|
+
@scope = 7
|
834
|
+
@itype_id = 1
|
835
|
+
@price = 0
|
836
|
+
@consumable = true
|
837
|
+
end
|
838
|
+
|
839
|
+
def key_item?
|
840
|
+
@itype_id == 2
|
841
|
+
end
|
842
|
+
|
843
|
+
attr_accessor :itype_id
|
844
|
+
attr_accessor :price
|
845
|
+
attr_accessor :consumable
|
846
|
+
end
|
847
|
+
|
848
|
+
class EquipItem < BaseItem
|
849
|
+
def initialize
|
850
|
+
super
|
851
|
+
@price = 0
|
852
|
+
@etype_id = 0
|
853
|
+
@params = [0] * 8
|
854
|
+
end
|
855
|
+
|
856
|
+
attr_accessor :price
|
857
|
+
attr_accessor :etype_id
|
858
|
+
attr_accessor :params
|
859
|
+
end
|
860
|
+
|
861
|
+
class Weapon < EquipItem
|
862
|
+
def initialize
|
863
|
+
super
|
864
|
+
@wtype_id = 0
|
865
|
+
@animation_id = 0
|
866
|
+
@features.push(RPG::BaseItem::Feature.new(31, 1, 0))
|
867
|
+
@features.push(RPG::BaseItem::Feature.new(22, 0, 0))
|
868
|
+
end
|
869
|
+
|
870
|
+
def performance
|
871
|
+
params[2] + params[4] + params.inject(0) { |r, v| r += v }
|
872
|
+
end
|
873
|
+
|
874
|
+
attr_accessor :wtype_id
|
875
|
+
attr_accessor :animation_id
|
876
|
+
end
|
877
|
+
|
878
|
+
class Armor < EquipItem
|
879
|
+
def initialize
|
880
|
+
super
|
881
|
+
@atype_id = 0
|
882
|
+
@etype_id = 1
|
883
|
+
@features.push(RPG::BaseItem::Feature.new(22, 1, 0))
|
884
|
+
end
|
885
|
+
|
886
|
+
def performance
|
887
|
+
params[3] + params[5] + params.inject(0) { |r, v| r += v }
|
888
|
+
end
|
889
|
+
|
890
|
+
attr_accessor :atype_id
|
891
|
+
end
|
892
|
+
|
893
|
+
class Enemy < BaseItem
|
894
|
+
def initialize
|
895
|
+
super
|
896
|
+
@battler_name = ''
|
897
|
+
@battler_hue = 0
|
898
|
+
@params = [100, 0, 10, 10, 10, 10, 10, 10]
|
899
|
+
@exp = 0
|
900
|
+
@gold = 0
|
901
|
+
@drop_items = Array.new(3) { RPG::Enemy::DropItem.new }
|
902
|
+
@actions = [RPG::Enemy::Action.new]
|
903
|
+
@features.push(RPG::BaseItem::Feature.new(22, 0, 0.95))
|
904
|
+
@features.push(RPG::BaseItem::Feature.new(22, 1, 0.05))
|
905
|
+
@features.push(RPG::BaseItem::Feature.new(31, 1, 0))
|
906
|
+
end
|
907
|
+
|
908
|
+
attr_accessor :battler_name
|
909
|
+
attr_accessor :battler_hue
|
910
|
+
attr_accessor :params
|
911
|
+
attr_accessor :exp
|
912
|
+
attr_accessor :gold
|
913
|
+
attr_accessor :drop_items
|
914
|
+
attr_accessor :actions
|
915
|
+
end
|
916
|
+
|
917
|
+
class State < BaseItem
|
918
|
+
def initialize
|
919
|
+
super
|
920
|
+
@restriction = 0
|
921
|
+
@priority = 50
|
922
|
+
@remove_at_battle_end = false
|
923
|
+
@remove_by_restriction = false
|
924
|
+
@auto_removal_timing = 0
|
925
|
+
@min_turns = 1
|
926
|
+
@max_turns = 1
|
927
|
+
@remove_by_damage = false
|
928
|
+
@chance_by_damage = 100
|
929
|
+
@remove_by_walking = false
|
930
|
+
@steps_to_remove = 100
|
931
|
+
@message1 = ''
|
932
|
+
@message2 = ''
|
933
|
+
@message3 = ''
|
934
|
+
@message4 = ''
|
935
|
+
end
|
936
|
+
|
937
|
+
attr_accessor :restriction
|
938
|
+
attr_accessor :priority
|
939
|
+
attr_accessor :remove_at_battle_end
|
940
|
+
attr_accessor :remove_by_restriction
|
941
|
+
attr_accessor :auto_removal_timing
|
942
|
+
attr_accessor :min_turns
|
943
|
+
attr_accessor :max_turns
|
944
|
+
attr_accessor :remove_by_damage
|
945
|
+
attr_accessor :chance_by_damage
|
946
|
+
attr_accessor :remove_by_walking
|
947
|
+
attr_accessor :steps_to_remove
|
948
|
+
attr_accessor :message1
|
949
|
+
attr_accessor :message2
|
950
|
+
attr_accessor :message3
|
951
|
+
attr_accessor :message4
|
952
|
+
end
|
953
|
+
|
954
|
+
class BaseItem::Feature
|
955
|
+
def initialize(code = 0, data_id = 0, value = 0)
|
956
|
+
@code = code
|
957
|
+
@data_id = data_id
|
958
|
+
@value = value
|
959
|
+
end
|
960
|
+
|
961
|
+
attr_accessor :code
|
962
|
+
attr_accessor :data_id
|
963
|
+
attr_accessor :value
|
964
|
+
end
|
965
|
+
|
966
|
+
class UsableItem::Damage
|
967
|
+
def initialize
|
968
|
+
@type = 0
|
969
|
+
@element_id = 0
|
970
|
+
@formula = '0'
|
971
|
+
@variance = 20
|
972
|
+
@critical = false
|
973
|
+
end
|
974
|
+
|
975
|
+
def none?
|
976
|
+
@type == 0
|
977
|
+
end
|
978
|
+
|
979
|
+
def to_hp?
|
980
|
+
[1, 3, 5].include?(@type)
|
981
|
+
end
|
982
|
+
|
983
|
+
def to_mp?
|
984
|
+
[2, 4, 6].include?(@type)
|
985
|
+
end
|
986
|
+
|
987
|
+
def recover?
|
988
|
+
[3, 4].include?(@type)
|
989
|
+
end
|
990
|
+
|
991
|
+
def drain?
|
992
|
+
[5, 6].include?(@type)
|
993
|
+
end
|
994
|
+
|
995
|
+
def sign
|
996
|
+
recover? ? -1 : 1
|
997
|
+
end
|
998
|
+
|
999
|
+
def eval(a, b, v)
|
1000
|
+
[Kernel.eval(@formula), 0].max * sign rescue 0
|
1001
|
+
end
|
1002
|
+
|
1003
|
+
attr_accessor :type
|
1004
|
+
attr_accessor :element_id
|
1005
|
+
attr_accessor :formula
|
1006
|
+
attr_accessor :variance
|
1007
|
+
attr_accessor :critical
|
1008
|
+
end
|
1009
|
+
|
1010
|
+
class UsableItem::Effect
|
1011
|
+
def initialize(code = 0, data_id = 0, value1 = 0, value2 = 0)
|
1012
|
+
@code = code
|
1013
|
+
@data_id = data_id
|
1014
|
+
@value1 = value1
|
1015
|
+
@value2 = value2
|
1016
|
+
end
|
1017
|
+
|
1018
|
+
attr_accessor :code
|
1019
|
+
attr_accessor :data_id
|
1020
|
+
attr_accessor :value1
|
1021
|
+
attr_accessor :value2
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
class Class::Learning
|
1025
|
+
def initialize
|
1026
|
+
@level = 1
|
1027
|
+
@skill_id = 1
|
1028
|
+
@note = ''
|
1029
|
+
end
|
1030
|
+
|
1031
|
+
attr_accessor :level
|
1032
|
+
attr_accessor :skill_id
|
1033
|
+
attr_accessor :note
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
class Enemy::DropItem
|
1037
|
+
def initialize
|
1038
|
+
@kind = 0
|
1039
|
+
@data_id = 1
|
1040
|
+
@denominator = 1
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
attr_accessor :kind
|
1044
|
+
attr_accessor :data_id
|
1045
|
+
attr_accessor :denominator
|
1046
|
+
end
|
1047
|
+
|
1048
|
+
class Enemy::Action
|
1049
|
+
def initialize
|
1050
|
+
@skill_id = 1
|
1051
|
+
@condition_type = 0
|
1052
|
+
@condition_param1 = 0
|
1053
|
+
@condition_param2 = 0
|
1054
|
+
@rating = 5
|
1055
|
+
end
|
1056
|
+
|
1057
|
+
attr_accessor :skill_id
|
1058
|
+
attr_accessor :condition_type
|
1059
|
+
attr_accessor :condition_param1
|
1060
|
+
attr_accessor :condition_param2
|
1061
|
+
attr_accessor :rating
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
class Troop
|
1065
|
+
def initialize
|
1066
|
+
@id = 0
|
1067
|
+
@name = ''
|
1068
|
+
@members = []
|
1069
|
+
@pages = [RPG::Troop::Page.new]
|
1070
|
+
end
|
1071
|
+
|
1072
|
+
attr_accessor :id
|
1073
|
+
attr_accessor :name
|
1074
|
+
attr_accessor :members
|
1075
|
+
attr_accessor :pages
|
1076
|
+
end
|
1077
|
+
|
1078
|
+
class Troop::Member
|
1079
|
+
def initialize
|
1080
|
+
@enemy_id = 1
|
1081
|
+
@x = 0
|
1082
|
+
@y = 0
|
1083
|
+
@hidden = false
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
attr_accessor :enemy_id
|
1087
|
+
attr_accessor :x
|
1088
|
+
attr_accessor :y
|
1089
|
+
attr_accessor :hidden
|
1090
|
+
end
|
1091
|
+
|
1092
|
+
class Troop::Page
|
1093
|
+
def initialize
|
1094
|
+
@condition = RPG::Troop::Page::Condition.new
|
1095
|
+
@span = 0
|
1096
|
+
@list = [RPG::EventCommand.new]
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
attr_accessor :condition
|
1100
|
+
attr_accessor :span
|
1101
|
+
attr_accessor :list
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
class Troop::Page::Condition
|
1105
|
+
def initialize
|
1106
|
+
@turn_ending = false
|
1107
|
+
@turn_valid = false
|
1108
|
+
@enemy_valid = false
|
1109
|
+
@actor_valid = false
|
1110
|
+
@switch_valid = false
|
1111
|
+
@turn_a = 0
|
1112
|
+
@turn_b = 0
|
1113
|
+
@enemy_index = 0
|
1114
|
+
@enemy_hp = 50
|
1115
|
+
@actor_id = 1
|
1116
|
+
@actor_hp = 50
|
1117
|
+
@switch_id = 1
|
1118
|
+
end
|
1119
|
+
|
1120
|
+
attr_accessor :turn_ending
|
1121
|
+
attr_accessor :turn_valid
|
1122
|
+
attr_accessor :enemy_valid
|
1123
|
+
attr_accessor :actor_valid
|
1124
|
+
attr_accessor :switch_valid
|
1125
|
+
attr_accessor :turn_a
|
1126
|
+
attr_accessor :turn_b
|
1127
|
+
attr_accessor :enemy_index
|
1128
|
+
attr_accessor :enemy_hp
|
1129
|
+
attr_accessor :actor_id
|
1130
|
+
attr_accessor :actor_hp
|
1131
|
+
attr_accessor :switch_id
|
1132
|
+
end
|
1133
|
+
|
1134
|
+
class Animation
|
1135
|
+
def initialize
|
1136
|
+
@id = 0
|
1137
|
+
@name = ''
|
1138
|
+
@animation1_name = ''
|
1139
|
+
@animation1_hue = 0
|
1140
|
+
@animation2_name = ''
|
1141
|
+
@animation2_hue = 0
|
1142
|
+
@position = 1
|
1143
|
+
@frame_max = 1
|
1144
|
+
@frames = [RPG::Animation::Frame.new]
|
1145
|
+
@timings = []
|
1146
|
+
end
|
1147
|
+
|
1148
|
+
def to_screen?
|
1149
|
+
@position == 3
|
1150
|
+
end
|
1151
|
+
|
1152
|
+
attr_accessor :id
|
1153
|
+
attr_accessor :name
|
1154
|
+
attr_accessor :animation1_name
|
1155
|
+
attr_accessor :animation1_hue
|
1156
|
+
attr_accessor :animation2_name
|
1157
|
+
attr_accessor :animation2_hue
|
1158
|
+
attr_accessor :position
|
1159
|
+
attr_accessor :frame_max
|
1160
|
+
attr_accessor :frames
|
1161
|
+
attr_accessor :timings
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
class Animation::Frame
|
1165
|
+
def initialize
|
1166
|
+
@cell_max = 0
|
1167
|
+
@cell_data = Table.new(0, 0)
|
1168
|
+
end
|
1169
|
+
|
1170
|
+
attr_accessor :cell_max
|
1171
|
+
attr_accessor :cell_data
|
1172
|
+
end
|
1173
|
+
|
1174
|
+
class Animation::Timing
|
1175
|
+
def initialize
|
1176
|
+
@frame = 0
|
1177
|
+
@se = RPG::SE.new('', 80)
|
1178
|
+
@flash_scope = 0
|
1179
|
+
@flash_color = Color.new(255, 255, 255, 255)
|
1180
|
+
@flash_duration = 5
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
attr_accessor :frame
|
1184
|
+
attr_accessor :se
|
1185
|
+
attr_accessor :flash_scope
|
1186
|
+
attr_accessor :flash_color
|
1187
|
+
attr_accessor :flash_duration
|
1188
|
+
end
|
1189
|
+
|
1190
|
+
class Tileset
|
1191
|
+
def initialize
|
1192
|
+
@id = 0
|
1193
|
+
@mode = 1
|
1194
|
+
@name = ''
|
1195
|
+
@tileset_names = Array.new(9).collect { '' }
|
1196
|
+
@flags = Table.new(8192)
|
1197
|
+
@flags[0] = 0x0010
|
1198
|
+
(2048..2815).each { |i| @flags[i] = 0x000F }
|
1199
|
+
(4352..8191).each { |i| @flags[i] = 0x000F }
|
1200
|
+
@note = ''
|
1201
|
+
end
|
1202
|
+
|
1203
|
+
attr_accessor :id
|
1204
|
+
attr_accessor :mode
|
1205
|
+
attr_accessor :name
|
1206
|
+
attr_accessor :tileset_names
|
1207
|
+
attr_accessor :flags
|
1208
|
+
attr_accessor :note
|
1209
|
+
end
|
1210
|
+
|
1211
|
+
class CommonEvent
|
1212
|
+
def initialize
|
1213
|
+
@id = 0
|
1214
|
+
@name = ''
|
1215
|
+
@trigger = 0
|
1216
|
+
@switch_id = 1
|
1217
|
+
@list = [RPG::EventCommand.new]
|
1218
|
+
end
|
1219
|
+
|
1220
|
+
def autorun?
|
1221
|
+
@trigger == 1
|
1222
|
+
end
|
1223
|
+
|
1224
|
+
def parallel?
|
1225
|
+
@trigger == 2
|
1226
|
+
end
|
1227
|
+
|
1228
|
+
attr_accessor :id
|
1229
|
+
attr_accessor :name
|
1230
|
+
attr_accessor :trigger
|
1231
|
+
attr_accessor :switch_id
|
1232
|
+
attr_accessor :list
|
1233
|
+
end
|
1234
|
+
|
1235
|
+
class System
|
1236
|
+
def initialize
|
1237
|
+
@game_title = ''
|
1238
|
+
@version_id = 0
|
1239
|
+
@japanese = true
|
1240
|
+
@party_members = [1]
|
1241
|
+
@currency_unit = ''
|
1242
|
+
@elements = [nil, '']
|
1243
|
+
@skill_types = [nil, '']
|
1244
|
+
@weapon_types = [nil, '']
|
1245
|
+
@armor_types = [nil, '']
|
1246
|
+
@switches = [nil, '']
|
1247
|
+
@variables = [nil, '']
|
1248
|
+
@boat = RPG::System::Vehicle.new
|
1249
|
+
@ship = RPG::System::Vehicle.new
|
1250
|
+
@airship = RPG::System::Vehicle.new
|
1251
|
+
@title1_name = ''
|
1252
|
+
@title2_name = ''
|
1253
|
+
@opt_draw_title = true
|
1254
|
+
@opt_use_midi = false
|
1255
|
+
@opt_transparent = false
|
1256
|
+
@opt_followers = true
|
1257
|
+
@opt_slip_death = false
|
1258
|
+
@opt_floor_death = false
|
1259
|
+
@opt_display_tp = true
|
1260
|
+
@opt_extra_exp = false
|
1261
|
+
@window_tone = Tone.new(0, 0, 0)
|
1262
|
+
@title_bgm = RPG::BGM.new
|
1263
|
+
@battle_bgm = RPG::BGM.new
|
1264
|
+
@battle_end_me = RPG::ME.new
|
1265
|
+
@gameover_me = RPG::ME.new
|
1266
|
+
@sounds = Array.new(24) { RPG::SE.new }
|
1267
|
+
@test_battlers = []
|
1268
|
+
@test_troop_id = 1
|
1269
|
+
@start_map_id = 1
|
1270
|
+
@start_x = 0
|
1271
|
+
@start_y = 0
|
1272
|
+
@terms = RPG::System::Terms.new
|
1273
|
+
@battleback1_name = ''
|
1274
|
+
@battleback2_name = ''
|
1275
|
+
@battler_name = ''
|
1276
|
+
@battler_hue = 0
|
1277
|
+
@edit_map_id = 1
|
1278
|
+
end
|
1279
|
+
|
1280
|
+
attr_accessor :game_title
|
1281
|
+
attr_accessor :version_id
|
1282
|
+
attr_accessor :japanese
|
1283
|
+
attr_accessor :party_members
|
1284
|
+
attr_accessor :currency_unit
|
1285
|
+
attr_accessor :skill_types
|
1286
|
+
attr_accessor :weapon_types
|
1287
|
+
attr_accessor :armor_types
|
1288
|
+
attr_accessor :elements
|
1289
|
+
attr_accessor :switches
|
1290
|
+
attr_accessor :variables
|
1291
|
+
attr_accessor :boat
|
1292
|
+
attr_accessor :ship
|
1293
|
+
attr_accessor :airship
|
1294
|
+
attr_accessor :title1_name
|
1295
|
+
attr_accessor :title2_name
|
1296
|
+
attr_accessor :opt_draw_title
|
1297
|
+
attr_accessor :opt_use_midi
|
1298
|
+
attr_accessor :opt_transparent
|
1299
|
+
attr_accessor :opt_followers
|
1300
|
+
attr_accessor :opt_slip_death
|
1301
|
+
attr_accessor :opt_floor_death
|
1302
|
+
attr_accessor :opt_display_tp
|
1303
|
+
attr_accessor :opt_extra_exp
|
1304
|
+
attr_accessor :window_tone
|
1305
|
+
attr_accessor :title_bgm
|
1306
|
+
attr_accessor :battle_bgm
|
1307
|
+
attr_accessor :battle_end_me
|
1308
|
+
attr_accessor :gameover_me
|
1309
|
+
attr_accessor :sounds
|
1310
|
+
attr_accessor :test_battlers
|
1311
|
+
attr_accessor :test_troop_id
|
1312
|
+
attr_accessor :start_map_id
|
1313
|
+
attr_accessor :start_x
|
1314
|
+
attr_accessor :start_y
|
1315
|
+
attr_accessor :terms
|
1316
|
+
attr_accessor :battleback1_name
|
1317
|
+
attr_accessor :battleback2_name
|
1318
|
+
attr_accessor :battler_name
|
1319
|
+
attr_accessor :battler_hue
|
1320
|
+
attr_accessor :edit_map_id
|
1321
|
+
end
|
1322
|
+
|
1323
|
+
class System::Vehicle
|
1324
|
+
def initialize
|
1325
|
+
@character_name = ''
|
1326
|
+
@character_index = 0
|
1327
|
+
@bgm = RPG::BGM.new
|
1328
|
+
@start_map_id = 0
|
1329
|
+
@start_x = 0
|
1330
|
+
@start_y = 0
|
1331
|
+
end
|
1332
|
+
|
1333
|
+
attr_accessor :character_name
|
1334
|
+
attr_accessor :character_index
|
1335
|
+
attr_accessor :bgm
|
1336
|
+
attr_accessor :start_map_id
|
1337
|
+
attr_accessor :start_x
|
1338
|
+
attr_accessor :start_y
|
1339
|
+
end
|
1340
|
+
|
1341
|
+
class System::Terms
|
1342
|
+
def initialize
|
1343
|
+
@basic = Array.new(8) { '' }
|
1344
|
+
@params = Array.new(8) { '' }
|
1345
|
+
@etypes = Array.new(5) { '' }
|
1346
|
+
@commands = Array.new(23) { '' }
|
1347
|
+
end
|
1348
|
+
|
1349
|
+
attr_accessor :basic
|
1350
|
+
attr_accessor :params
|
1351
|
+
attr_accessor :etypes
|
1352
|
+
attr_accessor :commands
|
1353
|
+
end
|
1354
|
+
|
1355
|
+
class System::TestBattler
|
1356
|
+
def initialize
|
1357
|
+
@actor_id = 1
|
1358
|
+
@level = 1
|
1359
|
+
@equips = [0, 0, 0, 0, 0]
|
1360
|
+
end
|
1361
|
+
|
1362
|
+
attr_accessor :actor_id
|
1363
|
+
attr_accessor :level
|
1364
|
+
attr_accessor :equips
|
1365
|
+
end
|
1366
|
+
|
1367
|
+
class AudioFile
|
1368
|
+
def initialize(name = '', volume = 100, pitch = 100)
|
1369
|
+
@name = name
|
1370
|
+
@volume = volume
|
1371
|
+
@pitch = pitch
|
1372
|
+
end
|
1373
|
+
|
1374
|
+
attr_accessor :name
|
1375
|
+
attr_accessor :volume
|
1376
|
+
attr_accessor :pitch
|
1377
|
+
end
|
1378
|
+
|
1379
|
+
class BGM < AudioFile
|
1380
|
+
@@last = RPG::BGM.new
|
1381
|
+
|
1382
|
+
def play(pos = 0)
|
1383
|
+
if @name.empty?
|
1384
|
+
Audio.bgm_stop
|
1385
|
+
@@last = RPG::BGM.new
|
1386
|
+
else
|
1387
|
+
Audio.bgm_play('Audio/BGM/' + @name, @volume, @pitch, pos)
|
1388
|
+
@@last = self.clone
|
1389
|
+
end
|
1390
|
+
end
|
1391
|
+
|
1392
|
+
def replay
|
1393
|
+
play(@pos)
|
1394
|
+
end
|
1395
|
+
|
1396
|
+
def self.stop
|
1397
|
+
Audio.bgm_stop
|
1398
|
+
@@last = RPG::BGM.new
|
1399
|
+
end
|
1400
|
+
|
1401
|
+
def self.fade(time)
|
1402
|
+
Audio.bgm_fade(time)
|
1403
|
+
@@last = RPG::BGM.new
|
1404
|
+
end
|
1405
|
+
|
1406
|
+
def self.last
|
1407
|
+
@@last.pos = Audio.bgm_pos
|
1408
|
+
@@last
|
1409
|
+
end
|
1410
|
+
|
1411
|
+
attr_accessor :pos
|
1412
|
+
end
|
1413
|
+
|
1414
|
+
class BGS < AudioFile
|
1415
|
+
@@last = RPG::BGS.new
|
1416
|
+
|
1417
|
+
def play(pos = 0)
|
1418
|
+
if @name.empty?
|
1419
|
+
Audio.bgs_stop
|
1420
|
+
@@last = RPG::BGS.new
|
1421
|
+
else
|
1422
|
+
Audio.bgs_play('Audio/BGS/' + @name, @volume, @pitch, pos)
|
1423
|
+
@@last = self.clone
|
1424
|
+
end
|
1425
|
+
end
|
1426
|
+
|
1427
|
+
def replay
|
1428
|
+
play(@pos)
|
1429
|
+
end
|
1430
|
+
|
1431
|
+
def self.stop
|
1432
|
+
Audio.bgs_stop
|
1433
|
+
@@last = RPG::BGS.new
|
1434
|
+
end
|
1435
|
+
|
1436
|
+
def self.fade(time)
|
1437
|
+
Audio.bgs_fade(time)
|
1438
|
+
@@last = RPG::BGS.new
|
1439
|
+
end
|
1440
|
+
|
1441
|
+
def self.last
|
1442
|
+
@@last.pos = Audio.bgs_pos
|
1443
|
+
@@last
|
1444
|
+
end
|
1445
|
+
|
1446
|
+
attr_accessor :pos
|
1447
|
+
end
|
1448
|
+
|
1449
|
+
class ME < AudioFile
|
1450
|
+
def play
|
1451
|
+
if @name.empty?
|
1452
|
+
Audio.me_stop
|
1453
|
+
else
|
1454
|
+
Audio.me_play('Audio/ME/' + @name, @volume, @pitch)
|
1455
|
+
end
|
1456
|
+
end
|
1457
|
+
|
1458
|
+
def self.stop
|
1459
|
+
Audio.me_stop
|
1460
|
+
end
|
1461
|
+
|
1462
|
+
def self.fade(time)
|
1463
|
+
Audio.me_fade(time)
|
1464
|
+
end
|
1465
|
+
end
|
1466
|
+
|
1467
|
+
class SE < AudioFile
|
1468
|
+
def play
|
1469
|
+
unless @name.empty?
|
1470
|
+
Audio.se_play('Audio/SE/' + @name, @volume, @pitch)
|
1471
|
+
end
|
1472
|
+
end
|
1473
|
+
|
1474
|
+
def self.stop
|
1475
|
+
Audio.se_stop
|
1476
|
+
end
|
1477
|
+
end
|
1478
|
+
|
1457
1479
|
end
|