R3EXS 1.1.1 → 2.0.0

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.
data/lib/R3EXS/RGSS3.rb CHANGED
@@ -2,285 +2,77 @@
2
2
 
3
3
  # RPG Maker VX Ace Color 类
4
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
5
+ attr_accessor :red,
6
+ :green,
7
+ :blue,
8
+ :alpha
9
+
10
+ # 序列化 Color 对象
11
+ #
12
+ # @return [String]
13
+ def _dump(_level)
14
+ [@red, @green, @blue, @alpha].pack('D4')
15
+ end
16
+
17
+ # 反序列化 Color 对象
18
+ #
19
+ # @param obj [String] 序列化后的字符串
20
+ #
21
+ # @return [Color]
22
+ def self._load(obj)
23
+ r, g, b, a = obj.unpack('D4')
24
+ instance = Color.allocate
25
+ instance.red = r
26
+ instance.green = g
27
+ instance.blue = b
28
+ instance.alpha = a
29
+ instance
30
+ end
143
31
  end
144
32
 
145
33
  # RPG Maker VX Ace Tone 类
146
34
  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
35
+ attr_accessor :red,
36
+ :green,
37
+ :blue,
38
+ :gray
39
+
40
+ # 初始化 Tone 对象
41
+ #
42
+ # @param red [Integer] 红色通道的值 (0-255)
43
+ # @param green [Integer] 绿色通道的值 (0-255)
44
+ # @param blue [Integer] 蓝色通道的值 (0-255)
45
+ # @param gray [Integer] 灰度通道的值 (0-255)
46
+ #
47
+ # @return [Color]
48
+ def initialize(red, green, blue, gray)
49
+ @red = red
50
+ @green = green
51
+ @blue = blue
52
+ @gray = gray
53
+ end
54
+
55
+ # 序列化 Tone 对象
56
+ #
57
+ # @return [String]
58
+ def _dump(_level)
59
+ [@red, @green, @blue, @gray].pack('D4')
60
+ end
61
+
62
+ # 反序列化 Tone 对象
63
+ #
64
+ # @param obj [String] 序列化后的字符串
65
+ #
66
+ # @return [Tone]
67
+ def self._load(obj)
68
+ r, g, b, y = obj.unpack('D4')
69
+ instance = Tone.allocate
70
+ instance.red = r
71
+ instance.green = g
72
+ instance.blue = b
73
+ instance.gray = y
74
+ instance
75
+ end
284
76
  end
285
77
 
286
78
  # RPG Maker VX Ace Table 类
@@ -289,1191 +81,493 @@ end
289
81
  #
290
82
  # Ruby Array 类在处理大量信息时效率很差,因此使用了此类。
291
83
  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
84
+ attr_accessor :dim,
85
+ :xsize,
86
+ :ysize,
87
+ :zsize,
88
+ :data
89
+
90
+ # 序列化 Table 对象
91
+ #
92
+ # @return [String]
93
+ def _dump(_level)
94
+ total = @xsize * @ysize * @zsize
95
+ [@dim, @xsize, @ysize, @zsize, total].pack('L5') + @data.pack('s*')
96
+ end
97
+
98
+ # 反序列化 Table 对象
99
+ #
100
+ # @param obj [String] 序列化后的字符串
101
+ #
102
+ # @return [Table]
103
+ def self._load(obj)
104
+ dim, xsize, ysize, zsize, total_size, *data = obj.unpack('L5s*')
105
+ instance = allocate
106
+ instance.dim = dim
107
+ instance.xsize = xsize
108
+ instance.ysize = ysize
109
+ instance.zsize = zsize
110
+ instance.data = data.first(total_size)
111
+ instance
112
+ end
425
113
  end
426
114
 
427
115
  # RPG Maker VX Ace 的RPG 模块
428
116
  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
-
1479
- end
117
+ # 地图数据类
118
+ class Map
119
+ attr_accessor :display_name,
120
+ :tileset_id,
121
+ :width,
122
+ :height,
123
+ :scroll_type,
124
+ :specify_battleback,
125
+ :battleback1_name,
126
+ :battleback2_name,
127
+ :autoplay_bgm,
128
+ :bgm,
129
+ :autoplay_bgs,
130
+ :bgs,
131
+ :disable_dashing,
132
+ :encounter_list,
133
+ :encounter_step,
134
+ :parallax_name,
135
+ :parallax_loop_x,
136
+ :parallax_loop_y,
137
+ :parallax_sx,
138
+ :parallax_sy,
139
+ :parallax_show,
140
+ :note,
141
+ :data,
142
+ :events
143
+
144
+ # 存储遇敌设置的数据类
145
+ class Encounter
146
+ attr_accessor :troop_id,
147
+ :weight,
148
+ :region_set
149
+ end
150
+ end
151
+
152
+ # 地图信息的数据类
153
+ class MapInfo
154
+ attr_accessor :name,
155
+ :parent_id,
156
+ :order,
157
+ :expanded,
158
+ :scroll_x,
159
+ :scroll_y
160
+ end
161
+
162
+ # 地图事件的数据类
163
+ class Event
164
+ attr_accessor :id,
165
+ :name,
166
+ :x,
167
+ :y,
168
+ :pages
169
+
170
+ # 地图事件块事件页资料
171
+ class Page
172
+ attr_accessor :condition,
173
+ :graphic,
174
+ :move_type,
175
+ :move_speed,
176
+ :move_frequency,
177
+ :move_route,
178
+ :walk_anime,
179
+ :step_anime,
180
+ :direction_fix,
181
+ :through,
182
+ :priority_type,
183
+ :trigger,
184
+ :list
185
+
186
+ # 地图事件块事件页条件的数据类
187
+ class Condition
188
+ attr_accessor :switch1_valid,
189
+ :switch2_valid,
190
+ :variable_valid,
191
+ :self_switch_valid,
192
+ :item_valid,
193
+ :actor_valid,
194
+ :switch1_id,
195
+ :switch2_id,
196
+ :variable_id,
197
+ :variable_value,
198
+ :self_switch_ch,
199
+ :item_id,
200
+ :actor_id
201
+ end
202
+
203
+ # 地图事件块事件页「图片」的数据类
204
+ class Graphic
205
+ attr_accessor :tile_id,
206
+ :character_name,
207
+ :character_index,
208
+ :direction,
209
+ :pattern
210
+ end
211
+ end
212
+ end
213
+
214
+ # 事件指令的数据类
215
+ class EventCommand
216
+ attr_accessor :code,
217
+ :indent,
218
+ :parameters
219
+ end
220
+
221
+ # 移动路线的数据类
222
+ class MoveRoute
223
+ attr_accessor :repeat,
224
+ :skippable,
225
+ :wait,
226
+ :list
227
+ end
228
+
229
+ # 移动路线指令的数据类
230
+ class MoveCommand
231
+ attr_accessor :code,
232
+ :parameters
233
+ end
234
+
235
+ # 角色、职业、技能、物品、武器、护甲、敌人和状态的超类
236
+ class BaseItem
237
+ attr_accessor :id,
238
+ :name,
239
+ :icon_index,
240
+ :description,
241
+ :features,
242
+ :note
243
+
244
+ # 特性的数据类
245
+ class Feature
246
+ attr_accessor :code,
247
+ :data_id,
248
+ :value
249
+ end
250
+ end
251
+
252
+ # 角色的数据类
253
+ class Actor < BaseItem
254
+ attr_accessor :nickname,
255
+ :class_id,
256
+ :initial_level,
257
+ :max_level,
258
+ :character_name,
259
+ :character_index,
260
+ :face_name,
261
+ :face_index,
262
+ :equips
263
+ end
264
+
265
+ # 职业的数据类
266
+ class Class < BaseItem
267
+ attr_accessor :exp_params,
268
+ :params,
269
+ :learnings
270
+
271
+ # 职业[技能]的数据类
272
+ class Learning
273
+ attr_accessor :level,
274
+ :skill_id,
275
+ :note
276
+ end
277
+ end
278
+
279
+ # 技能和物品的超类
280
+ class UsableItem < BaseItem
281
+ attr_accessor :scope,
282
+ :occasion,
283
+ :speed,
284
+ :animation_id,
285
+ :success_rate,
286
+ :repeats,
287
+ :tp_gain,
288
+ :hit_type,
289
+ :damage,
290
+ :effects
291
+
292
+ # 伤害的数据类
293
+ class Damage
294
+ attr_accessor :type,
295
+ :element_id,
296
+ :formula,
297
+ :variance,
298
+ :critical
299
+ end
300
+
301
+ # 使用效果的数据类
302
+ class Effect
303
+ attr_accessor :code,
304
+ :data_id,
305
+ :value1,
306
+ :value2
307
+ end
308
+ end
309
+
310
+ # 技能的数据类
311
+ class Skill < UsableItem
312
+ attr_accessor :stype_id,
313
+ :mp_cost,
314
+ :tp_cost,
315
+ :message1,
316
+ :message2,
317
+ :required_wtype_id1,
318
+ :required_wtype_id2
319
+ end
320
+
321
+ # 物品的数据类
322
+ class Item < UsableItem
323
+ attr_accessor :itype_id,
324
+ :price,
325
+ :consumable
326
+ end
327
+
328
+ # 武器与护甲的超类
329
+ class EquipItem < BaseItem
330
+ attr_accessor :price,
331
+ :etype_id,
332
+ :params
333
+ end
334
+
335
+ # 武器的数据类
336
+ class Weapon < EquipItem
337
+ attr_accessor :wtype_id,
338
+ :animation_id
339
+ end
340
+
341
+ # 护甲的数据类
342
+ class Armor < EquipItem
343
+ attr_accessor :atype_id
344
+ end
345
+
346
+ # 敌人的数据类
347
+ class Enemy < BaseItem
348
+ attr_accessor :battler_name,
349
+ :battler_hue,
350
+ :params,
351
+ :exp,
352
+ :gold,
353
+ :drop_items,
354
+ :actions
355
+
356
+ # 敌人掉落物品的数据类
357
+ class DropItem
358
+ attr_accessor :kind,
359
+ :data_id,
360
+ :denominator
361
+ end
362
+
363
+ # 敌人[行为模式]的数据类
364
+ class Action
365
+ attr_accessor :skill_id,
366
+ :condition_type,
367
+ :condition_param1,
368
+ :condition_param2,
369
+ :rating
370
+ end
371
+ end
372
+
373
+ # 状态的数据类
374
+ class State < BaseItem
375
+ attr_accessor :restriction,
376
+ :priority,
377
+ :remove_at_battle_end,
378
+ :remove_by_restriction,
379
+ :auto_removal_timing,
380
+ :min_turns,
381
+ :max_turns,
382
+ :remove_by_damage,
383
+ :chance_by_damage,
384
+ :remove_by_walking,
385
+ :steps_to_remove,
386
+ :message1,
387
+ :message2,
388
+ :message3,
389
+ :message4
390
+ end
391
+
392
+ # 敌人队伍的数据类
393
+ class Troop
394
+ attr_accessor :id,
395
+ :name,
396
+ :members,
397
+ :pages
398
+
399
+ # 敌方队员的数据类
400
+ class Member
401
+ attr_accessor :enemy_id,
402
+ :x,
403
+ :y,
404
+ :hidden
405
+ end
406
+
407
+ # 战斗事件(页)的数据类
408
+ class Page
409
+ attr_accessor :condition,
410
+ :span,
411
+ :list
412
+
413
+ # 战斗事件的「条件」数据类
414
+ class Condition
415
+ attr_accessor :turn_ending,
416
+ :turn_valid,
417
+ :enemy_valid,
418
+ :actor_valid,
419
+ :switch_valid,
420
+ :turn_a,
421
+ :turn_b,
422
+ :enemy_index,
423
+ :enemy_hp,
424
+ :actor_id,
425
+ :actor_hp,
426
+ :switch_id
427
+ end
428
+ end
429
+ end
430
+
431
+ # 动画的数据类
432
+ class Animation
433
+ attr_accessor :id,
434
+ :name,
435
+ :animation1_name,
436
+ :animation1_hue,
437
+ :animation2_name,
438
+ :animation2_hue,
439
+ :position,
440
+ :frame_max,
441
+ :frames,
442
+ :timings
443
+
444
+ # 动画帧的数据类
445
+ class Frame
446
+ attr_accessor :cell_max,
447
+ :cell_data
448
+ end
449
+
450
+ # 动画的[声效与闪烁效果]的数据类
451
+ class Timing
452
+ attr_accessor :frame,
453
+ :se,
454
+ :flash_scope,
455
+ :flash_color,
456
+ :flash_duration
457
+ end
458
+ end
459
+
460
+ # 图块的数据类
461
+ class Tileset
462
+ attr_accessor :id,
463
+ :mode,
464
+ :name,
465
+ :tileset_names,
466
+ :flags,
467
+ :note
468
+ end
469
+
470
+ # 公共事件的数据类
471
+ class CommonEvent
472
+ attr_accessor :id,
473
+ :name,
474
+ :trigger,
475
+ :switch_id,
476
+ :list
477
+ end
478
+
479
+ # 系统的数据类
480
+ class System
481
+ attr_accessor :game_title,
482
+ :version_id,
483
+ :japanese,
484
+ :party_members,
485
+ :currency_unit,
486
+ :skill_types,
487
+ :weapon_types,
488
+ :armor_types,
489
+ :elements,
490
+ :switches,
491
+ :variables,
492
+ :boat,
493
+ :ship,
494
+ :airship,
495
+ :title1_name,
496
+ :title2_name,
497
+ :opt_draw_title,
498
+ :opt_use_midi,
499
+ :opt_transparent,
500
+ :opt_followers,
501
+ :opt_slip_death,
502
+ :opt_floor_death,
503
+ :opt_display_tp,
504
+ :opt_extra_exp,
505
+ :window_tone,
506
+ :title_bgm,
507
+ :battle_bgm,
508
+ :battle_end_me,
509
+ :gameover_me,
510
+ :sounds,
511
+ :test_battlers,
512
+ :test_troop_id,
513
+ :start_map_id,
514
+ :start_x,
515
+ :start_y,
516
+ :terms,
517
+ :battleback1_name,
518
+ :battleback2_name,
519
+ :battler_name,
520
+ :battler_hue,
521
+ :edit_map_id
522
+
523
+ # 交通工具的数据类
524
+ class Vehicle
525
+ attr_accessor :character_name,
526
+ :character_index,
527
+ :bgm,
528
+ :start_map_id,
529
+ :start_x,
530
+ :start_y
531
+ end
532
+
533
+ # 用语的资料类
534
+ class Terms
535
+ attr_accessor :basic,
536
+ :params,
537
+ :etypes,
538
+ :commands
539
+ end
540
+
541
+ # 战斗测试中使用的角色数据类
542
+ class TestBattler
543
+ attr_accessor :actor_id,
544
+ :level,
545
+ :equips
546
+ end
547
+ end
548
+
549
+ # BGM、BGS、ME、SE的超类
550
+ class AudioFile
551
+ attr_accessor :name,
552
+ :volume,
553
+ :pitch
554
+ end
555
+
556
+ # BGM 的数据类
557
+ class BGM < AudioFile
558
+ attr_accessor :pos
559
+ end
560
+
561
+ # BGS 的数据类
562
+ class BGS < AudioFile
563
+ attr_accessor :pos
564
+ end
565
+
566
+ # ME 的数据类
567
+ class ME < AudioFile
568
+ end
569
+
570
+ # SE 的数据类
571
+ class SE < AudioFile
572
+ end
573
+ end