Advertisement
Rafael_Sol_Maker

RGSS2 DATA STRUCTURE FOR ACE

Jul 9th, 2012
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 25.67 KB | None | 0 0
  1. #===============================================================================
  2. #              RAFAEL_SOL_MAKER's RGSS2 DATA STRUCTURE FOR ACE (BETA)
  3. #_______________________________________________________________________________
  4. #   Description  | It's simply the entire RPG Module Data Structure, extracted
  5. #                | originally from RPG Maker VX Help file. This version is (at
  6. #                | this moment) slight tweaked to run with RGSS3 player.
  7. #                | Soon, I plan to make a 'lite' version, only with the  
  8. #                | essentials to run. Here I just decided to put everything,
  9. #                | as it's only for testing purposes. Lots of these classes
  10. #                | are completely unnecessary, like the AudioFile ones.
  11. #________________|______________________________________________________________
  12. #     Usage      | Just plug it before any other scripts, including the ones
  13. #                | from default game engine. Yes, this will be the very first!
  14. #________________|______________________________________________________________
  15. # Specifications | Difficulty to Use:
  16. #                |  * (almost none at all, just plug it correctly )
  17. #                | Scripting Difficulty:
  18. #                |  * (few, it's only a data structure after all)
  19. #                | Compatibility:
  20. #                |  ??? (it's already made to create compatibility!)
  21. #                | New Methods:
  22. #                |  - (none, only every old method already made for RPG Module)
  23. #                | Overwritten Methods:
  24. #                |  - (depends on what are you using for)
  25. #                | Aliased Methods:
  26. #                |  - (none)
  27. #________________|______________________________________________________________
  28. # Special Thanks | -
  29. #________________|______________________________________________________________
  30. #===============================================================================
  31.  
  32. module RPG
  33.   class Map
  34.     def initialize(width, height)
  35.       @width = width
  36.       @height = height
  37.       @scroll_type = 0
  38.       @autoplay_bgm = false
  39.       @bgm = RPG::AudioFile.new
  40.       @autoplay_bgs = false
  41.       @bgs = RPG::AudioFile.new("", 80)
  42.       @disable_dashing = false
  43.       @encounter_list = []
  44.       @encounter_step = 30
  45.       @parallax_name = ""
  46.       @parallax_loop_x = false
  47.       @parallax_loop_y = false
  48.       @parallax_sx = 0
  49.       @parallax_sy = 0
  50.       @parallax_show = false
  51.       @data = Table.new(width, height, 3)
  52.       @events = {}
  53.     end
  54.     attr_accessor :width
  55.     attr_accessor :height
  56.     attr_accessor :scroll_type
  57.     attr_accessor :autoplay_bgm
  58.     attr_accessor :bgm
  59.     attr_accessor :autoplay_bgs
  60.     attr_accessor :bgs
  61.     attr_accessor :disable_dashing
  62.     attr_accessor :encounter_list
  63.     attr_accessor :encounter_step
  64.     attr_accessor :parallax_name
  65.     attr_accessor :parallax_loop_x
  66.     attr_accessor :parallax_loop_y
  67.     attr_accessor :parallax_sx
  68.     attr_accessor :parallax_sy
  69.     attr_accessor :parallax_show
  70.     attr_accessor :data
  71.     attr_accessor :events
  72.   end
  73.  
  74.   class MapInfo
  75.     def initialize
  76.       @name = ""
  77.       @parent_id = 0
  78.       @order = 0
  79.       @expanded = false
  80.       @scroll_x = 0
  81.       @scroll_y = 0
  82.     end
  83.     attr_accessor :name
  84.     attr_accessor :parent_id
  85.     attr_accessor :order
  86.     attr_accessor :expanded
  87.     attr_accessor :scroll_x
  88.     attr_accessor :scroll_y
  89.   end  
  90.  
  91.   class Area
  92.     def initialize
  93.       @id = 0
  94.       @name = ""
  95.       @map_id = 0
  96.       @rect = Rect.new(0,0,0,0)
  97.       @encounter_list = []
  98.       @order = 0
  99.     end
  100.     attr_accessor :id
  101.     attr_accessor :name
  102.     attr_accessor :map_id
  103.     attr_accessor :rect
  104.     attr_accessor :encounter_list
  105.     attr_accessor :order
  106.   end
  107.  
  108.   class Event
  109.     def initialize(x, y)
  110.       @id = 0
  111.       @name = ""
  112.       @x = x
  113.       @y = y
  114.       @pages = [RPG::Event::Page.new]
  115.     end
  116.     attr_accessor :id
  117.     attr_accessor :name
  118.     attr_accessor :x
  119.     attr_accessor :y
  120.     attr_accessor :pages
  121.    
  122.     class Page
  123.       def initialize
  124.         @condition = RPG::Event::Page::Condition.new
  125.         @graphic = RPG::Event::Page::Graphic.new
  126.         @move_type = 0
  127.         @move_speed = 3
  128.         @move_frequency = 3
  129.         @move_route = RPG::MoveRoute.new
  130.         @walk_anime = true
  131.         @step_anime = false
  132.         @direction_fix = false
  133.         @through = false
  134.         @priority_type = 0
  135.         @trigger = 0
  136.         @list = [RPG::EventCommand.new]
  137.       end    
  138.       attr_accessor :condition
  139.       attr_accessor :graphic
  140.       attr_accessor :move_type
  141.       attr_accessor :move_speed
  142.       attr_accessor :move_frequency
  143.       attr_accessor :move_route
  144.       attr_accessor :walk_anime
  145.       attr_accessor :step_anime
  146.       attr_accessor :direction_fix
  147.       attr_accessor :through
  148.       attr_accessor :priority_type
  149.       attr_accessor :trigger
  150.       attr_accessor :list      
  151.  
  152.       class Condition
  153.         def initialize
  154.           @switch1_valid = false
  155.           @switch2_valid = false
  156.           @variable_valid = false
  157.           @self_switch_valid = false
  158.           @item_valid = false
  159.           @actor_valid = false
  160.           @switch1_id = 1
  161.           @switch2_id = 1
  162.           @variable_id = 1
  163.           @variable_value = 0
  164.           @self_switch_ch = "A"
  165.           @item_id = 1
  166.           @actor_id = 1
  167.         end        
  168.         attr_accessor :switch1_valid
  169.         attr_accessor :switch2_valid
  170.         attr_accessor :variable_valid
  171.         attr_accessor :self_switch_valid
  172.         attr_accessor :item_valid
  173.         attr_accessor :actor_valid
  174.         attr_accessor :switch1_id
  175.         attr_accessor :switch2_id
  176.         attr_accessor :variable_id
  177.         attr_accessor :variable_value
  178.         attr_accessor :self_switch_ch
  179.         attr_accessor :item_id
  180.         attr_accessor :actor_id
  181.       end
  182.  
  183.       class Graphic
  184.         def initialize
  185.           @tile_id = 0
  186.           @character_name = ""
  187.           @character_index = 0
  188.           @direction = 2
  189.           @pattern = 0
  190.         end
  191.         attr_accessor :tile_id
  192.         attr_accessor :character_name
  193.         attr_accessor :character_index
  194.         attr_accessor :direction
  195.         attr_accessor :pattern
  196.       end    
  197.     end
  198.   end
  199.  
  200.   class EventCommand
  201.     def initialize(code = 0, indent = 0, parameters = [])
  202.       @code = code
  203.       @indent = indent
  204.       @parameters = parameters
  205.     end
  206.     attr_accessor :code
  207.     attr_accessor :indent
  208.     attr_accessor :parameters
  209.   end
  210.  
  211.   class MoveRoute
  212.     def initialize
  213.       @repeat = true
  214.       @skippable = false
  215.       @wait = false
  216.       @list = [RPG::MoveCommand.new]
  217.     end
  218.     attr_accessor :repeat
  219.     attr_accessor :skippable
  220.       attr_accessor :wait
  221.     attr_accessor :list
  222.   end
  223.  
  224.   class MoveCommand
  225.     def initialize(code = 0, parameters = [])
  226.       @code = code
  227.       @parameters = parameters
  228.     end
  229.     attr_accessor :code
  230.     attr_accessor :parameters
  231.   end  
  232.  
  233.   class Actor
  234.     def initialize
  235.       @id = 0
  236.       @name = ""
  237.       @class_id = 1
  238.       @initial_level = 1
  239.       @exp_basis = 25
  240.       @exp_inflation = 35
  241.       @character_name = ""
  242.       @character_index = 0
  243.       @face_name = ""
  244.       @face_index = 0
  245.       @parameters = Table.new(6,100)
  246.       for i in 1..99
  247.         @parameters[0,i] = 400+i*50
  248.         @parameters[1,i] = 80+i*10
  249.         @parameters[2,i] = 15+i*5/4
  250.         @parameters[3,i] = 15+i*5/4
  251.         @parameters[4,i] = 20+i*5/2
  252.         @parameters[5,i] = 20+i*5/2
  253.       end
  254.       @weapon_id = 0
  255.       @armor1_id = 0
  256.       @armor2_id = 0
  257.       @armor3_id = 0
  258.       @armor4_id = 0
  259.       @two_swords_style = false
  260.       @fix_equipment = false
  261.       @auto_battle = false
  262.       @super_guard = false
  263.       @pharmacology = false
  264.       @critical_bonus = false
  265.     end
  266.     attr_accessor :id
  267.     attr_accessor :name
  268.     attr_accessor :class_id
  269.     attr_accessor :initial_level
  270.     attr_accessor :exp_basis
  271.     attr_accessor :exp_inflation
  272.     attr_accessor :character_name
  273.     attr_accessor :character_index
  274.     attr_accessor :face_name
  275.     attr_accessor :face_index
  276.     attr_accessor :parameters
  277.     attr_accessor :weapon_id
  278.     attr_accessor :armor1_id
  279.     attr_accessor :armor2_id
  280.     attr_accessor :armor3_id
  281.     attr_accessor :armor4_id
  282.     attr_accessor :two_swords_style
  283.     attr_accessor :fix_equipment
  284.     attr_accessor :auto_battle
  285.     attr_accessor :super_guard
  286.     attr_accessor :pharmacology
  287.     attr_accessor :critical_bonus
  288.   end
  289.  
  290.   class Class
  291.     def initialize
  292.       @id = 0
  293.       @name = ""
  294.       @position = 0
  295.       @weapon_set = []
  296.       @armor_set = []
  297.       @element_ranks = Table.new(1)
  298.       @state_ranks = Table.new(1)
  299.       @learnings = []
  300.       @skill_name_valid = false
  301.       @skill_name = ""
  302.     end
  303.     attr_accessor :id
  304.     attr_accessor :name
  305.     attr_accessor :position
  306.     attr_accessor :weapon_set
  307.     attr_accessor :armor_set
  308.     attr_accessor :element_ranks
  309.     attr_accessor :state_ranks
  310.     attr_accessor :learnings
  311.     attr_accessor :skill_name_valid
  312.     attr_accessor :skill_name
  313.  
  314.     class Learning
  315.       def initialize
  316.         @level = 1
  317.         @skill_id = 1
  318.       end
  319.       attr_accessor :level
  320.       attr_accessor :skill_id
  321.     end  
  322.   end
  323.  
  324.   class BaseItem
  325.     def initialize
  326.       @id = 0
  327.       @name = ""
  328.       @icon_index = 0
  329.       @description = ""
  330.       @note = ""
  331.     end
  332.     attr_accessor :id
  333.     attr_accessor :name
  334.     attr_accessor :icon_index
  335.     attr_accessor :description
  336.     attr_accessor :note
  337.   end
  338.  
  339.   class UsableItem < BaseItem
  340.     def initialize
  341.       super
  342.       @scope = 0
  343.       @occasion = 0
  344.       @speed = 0
  345.       @animation_id = 0
  346.       @common_event_id = 0
  347.       @base_damage = 0
  348.       @variance = 20
  349.       @atk_f = 0
  350.       @spi_f = 0
  351.       @physical_attack = false
  352.       @damage_to_mp = false
  353.       @absorb_damage = false
  354.       @ignore_defense = false
  355.       @element_set = []
  356.       @plus_state_set = []
  357.       @minus_state_set = []
  358.     end
  359.     def for_opponent?
  360.       return [1, 2, 3, 4, 5, 6].include?(@scope)
  361.     end
  362.     def for_friend?
  363.       return [7, 8, 9, 10, 11].include?(@scope)
  364.     end
  365.     def for_dead_friend?
  366.       return [9, 10].include?(@scope)
  367.     end
  368.     def for_user?
  369.       return [11].include?(@scope)
  370.     end
  371.     def for_one?
  372.       return [1, 3, 4, 7, 9, 11].include?(@scope)
  373.     end
  374.     def for_two?
  375.       return [5].include?(@scope)
  376.     end
  377.     def for_three?
  378.       return [6].include?(@scope)
  379.     end
  380.     def for_random?
  381.       return [4, 5, 6].include?(@scope)
  382.     end
  383.     def for_all?
  384.       return [2, 8, 10].include?(@scope)
  385.     end
  386.     def dual?
  387.       return [3].include?(@scope)
  388.     end
  389.     def need_selection?
  390.       return [1, 3, 7, 9].include?(@scope)
  391.     end
  392.     def battle_ok?
  393.       return [0, 1].include?(@occasion)
  394.     end
  395.     def menu_ok?
  396.       return [0, 2].include?(@occasion)
  397.     end
  398.     attr_accessor :scope
  399.     attr_accessor :occasion
  400.     attr_accessor :speed
  401.     attr_accessor :animation_id
  402.     attr_accessor :common_event_id
  403.     attr_accessor :base_damage
  404.     attr_accessor :variance
  405.     attr_accessor :atk_f
  406.     attr_accessor :spi_f
  407.     attr_accessor :physical_attack
  408.     attr_accessor :damage_to_mp
  409.     attr_accessor :absorb_damage
  410.     attr_accessor :ignore_defense
  411.     attr_accessor :element_set
  412.     attr_accessor :plus_state_set
  413.     attr_accessor :minus_state_set
  414.   end
  415.  
  416.   class Skill < UsableItem
  417.     def initialize
  418.       super
  419.       @scope = 1
  420.       @mp_cost = 0
  421.       @hit = 100
  422.       @message1 = ""
  423.       @message2 = ""
  424.     end
  425.     attr_accessor :mp_cost
  426.     attr_accessor :hit
  427.     attr_accessor :message1
  428.     attr_accessor :message2
  429.   end
  430.  
  431.   class Item < UsableItem
  432.     def initialize
  433.       super
  434.       @scope = 7
  435.       @price = 0
  436.       @consumable = true
  437.       @hp_recovery_rate = 0
  438.       @hp_recovery = 0
  439.       @mp_recovery_rate = 0
  440.       @mp_recovery = 0
  441.       @parameter_type = 0
  442.       @parameter_points = 0
  443.     end
  444.     attr_accessor :price
  445.     attr_accessor :consumable
  446.     attr_accessor :hp_recovery_rate
  447.     attr_accessor :hp_recovery
  448.     attr_accessor :mp_recovery_rate
  449.     attr_accessor :mp_recovery
  450.     attr_accessor :parameter_type
  451.     attr_accessor :parameter_points
  452.   end
  453.  
  454.   class EquipItem  < BaseItem
  455.     attr_accessor :price
  456.     attr_accessor :atk
  457.     attr_accessor :def
  458.     attr_accessor :spi
  459.     attr_accessor :agi
  460.    
  461.     def initialize
  462.       super
  463.       @price = 0
  464.       @atk = 0
  465.       @def = 0
  466.       @spi = 0
  467.       @agi = 0
  468.     end
  469.   end
  470.  
  471.   class Weapon < EquipItem
  472.     attr_accessor :animation_id
  473.     attr_accessor :hit
  474.     attr_accessor :two_handed
  475.     attr_accessor :fast_attack
  476.     attr_accessor :dual_attack
  477.     attr_accessor :critical_bonus
  478.     attr_accessor :element_set
  479.     attr_accessor :state_set
  480.    
  481.     def initialize
  482.       super
  483.       @animation_id = 0
  484.       @hit = 95
  485.       @two_handed = false
  486.       @fast_attack = false
  487.       @dual_attack = false
  488.       @critical_bonus = false
  489.       @element_set = []
  490.       @state_set = []
  491.     end
  492.   end
  493.  
  494.   class Armor < EquipItem
  495.     attr_accessor :kind
  496.     attr_accessor :eva
  497.     attr_accessor :prevent_critical
  498.     attr_accessor :half_mp_cost
  499.     attr_accessor :double_exp_gain
  500.     attr_accessor :auto_hp_recover
  501.     attr_accessor :element_set
  502.     attr_accessor :state_set
  503.    
  504.     def initialize
  505.       super
  506.       @kind = 0
  507.       @eva = 0
  508.       @prevent_critical = false
  509.       @half_mp_cost = false
  510.       @double_exp_gain = false
  511.       @auto_hp_recover = false
  512.       @element_set = []
  513.       @state_set = []
  514.     end
  515.   end
  516.  
  517.   class Enemy
  518.     def initialize
  519.       @id = 0
  520.       @name = ""
  521.       @battler_name = ""
  522.       @battler_hue = 0
  523.       @maxhp = 10
  524.       @maxmp = 10
  525.       @atk = 10
  526.       @def = 10
  527.       @spi = 10
  528.       @agi = 10
  529.       @hit = 95
  530.       @eva = 5
  531.       @exp = 0
  532.       @gold = 0
  533.       @drop_item1 = RPG::Enemy::DropItem.new
  534.       @drop_item2 = RPG::Enemy::DropItem.new
  535.       @levitate = false
  536.       @has_critical = false
  537.       @element_ranks = Table.new(1)
  538.       @state_ranks = Table.new(1)
  539.       @actions = [RPG::Enemy::Action.new]
  540.       @note = ""
  541.     end
  542.     attr_accessor :id
  543.     attr_accessor :name
  544.     attr_accessor :battler_name
  545.     attr_accessor :battler_hue
  546.     attr_accessor :maxhp
  547.     attr_accessor :maxmp
  548.     attr_accessor :atk
  549.     attr_accessor :def
  550.     attr_accessor :spi
  551.     attr_accessor :agi
  552.     attr_accessor :hit
  553.     attr_accessor :eva
  554.     attr_accessor :exp
  555.     attr_accessor :gold
  556.     attr_accessor :drop_item1
  557.     attr_accessor :drop_item2
  558.     attr_accessor :levitate
  559.     attr_accessor :has_critical
  560.     attr_accessor :element_ranks
  561.     attr_accessor :state_ranks
  562.     attr_accessor :actions
  563.     attr_accessor :note
  564.    
  565.     class DropItem
  566.       def initialize
  567.         @kind = 0
  568.         @item_id = 1
  569.         @weapon_id = 1
  570.         @armor_id = 1
  571.         @denominator = 1
  572.       end
  573.       attr_accessor :kind
  574.       attr_accessor :item_id
  575.       attr_accessor :weapon_id
  576.       attr_accessor :armor_id
  577.       attr_accessor :denominator
  578.     end
  579.    
  580.     class Action
  581.       def initialize
  582.         @kind = 0
  583.         @basic = 0
  584.         @skill_id = 1
  585.         @condition_type = 0
  586.         @condition_param1 = 0
  587.         @condition_param2 = 0
  588.         @rating = 5
  589.       end
  590.       def skill?
  591.         return @kind == 1
  592.       end
  593.       attr_accessor :kind
  594.       attr_accessor :basic
  595.       attr_accessor :skill_id
  596.       attr_accessor :condition_type
  597.       attr_accessor :condition_param1
  598.       attr_accessor :condition_param2
  599.       attr_accessor :rating
  600.     end
  601.   end
  602. end
  603. module RPG
  604.   class Troop
  605.     def initialize
  606.       @id = 0
  607.       @name = ""
  608.       @members = []
  609.       @pages = [RPG::BattleEventPage.new]
  610.     end
  611.     attr_accessor :id
  612.     attr_accessor :name
  613.     attr_accessor :members
  614.     attr_accessor :pages
  615.    
  616.     class Member
  617.       def initialize
  618.         @enemy_id = 1
  619.         @x = 0
  620.         @y = 0
  621.         @hidden = false
  622.         @immortal = false
  623.       end
  624.       attr_accessor :enemy_id
  625.       attr_accessor :x
  626.       attr_accessor :y
  627.       attr_accessor :hidden
  628.       attr_accessor :immortal
  629.     end
  630.    
  631.     class Page
  632.       def initialize
  633.         @condition = RPG::Troop::Page::Condition.new
  634.         @span = 0
  635.         @list = [RPG::EventCommand.new]
  636.       end
  637.       attr_accessor :condition
  638.       attr_accessor :span
  639.       attr_accessor :list
  640.      
  641.       class Condition
  642.         def initialize
  643.           @turn_ending = false
  644.           @turn_valid = false
  645.           @enemy_valid = false
  646.           @actor_valid = false
  647.           @switch_valid = false
  648.           @turn_a = 0
  649.           @turn_b = 0
  650.           @enemy_index = 0
  651.           @enemy_hp = 50
  652.           @actor_id = 1
  653.           @actor_hp = 50
  654.           @switch_id = 1
  655.         end
  656.         attr_accessor :turn_ending
  657.         attr_accessor :turn_valid
  658.         attr_accessor :enemy_valid
  659.         attr_accessor :actor_valid
  660.         attr_accessor :switch_valid
  661.         attr_accessor :turn_a
  662.         attr_accessor :turn_b
  663.         attr_accessor :enemy_index
  664.         attr_accessor :enemy_hp
  665.         attr_accessor :actor_id
  666.         attr_accessor :actor_hp
  667.         attr_accessor :switch_id
  668.       end
  669.     end    
  670.   end
  671.  
  672.   class State
  673.     def initialize
  674.       @id = 0
  675.       @name = ""
  676.       @icon_index = 0
  677.       @restriction = 0
  678.       @priority = 5
  679.       @atk_rate = 100
  680.       @def_rate = 100
  681.       @spi_rate = 100
  682.       @agi_rate = 100
  683.       @nonresistance = false
  684.       @offset_by_opposite = false
  685.       @slip_damage = false
  686.       @reduce_hit_ratio = false
  687.       @battle_only = true
  688.       @release_by_damage = false
  689.       @hold_turn = 0
  690.       @auto_release_prob = 0
  691.       @message1 = ""
  692.       @message2 = ""
  693.       @message3 = ""
  694.       @message4 = ""
  695.       @element_set = []
  696.       @state_set = []
  697.       @note = ""
  698.     end
  699.     attr_accessor :id
  700.     attr_accessor :name
  701.     attr_accessor :icon_index
  702.     attr_accessor :restriction
  703.     attr_accessor :priority
  704.     attr_accessor :atk_rate
  705.     attr_accessor :def_rate
  706.     attr_accessor :spi_rate
  707.     attr_accessor :agi_rate
  708.     attr_accessor :nonresistance
  709.     attr_accessor :offset_by_opposite
  710.     attr_accessor :slip_damage
  711.     attr_accessor :reduce_hit_ratio
  712.     attr_accessor :battle_only
  713.     attr_accessor :release_by_damage
  714.     attr_accessor :hold_turn
  715.     attr_accessor :auto_release_prob
  716.     attr_accessor :message1
  717.     attr_accessor :message2
  718.     attr_accessor :message3
  719.     attr_accessor :message4
  720.     attr_accessor :element_set
  721.     attr_accessor :state_set
  722.     attr_accessor :note
  723.   end
  724.  
  725.   class CommonEvent
  726.     def initialize
  727.       @id = 0
  728.       @name = ""
  729.       @trigger = 0
  730.       @switch_id = 1
  731.       @list = [RPG::EventCommand.new]
  732.     end
  733.     attr_accessor :id
  734.     attr_accessor :name
  735.     attr_accessor :trigger
  736.     attr_accessor :switch_id
  737.     attr_accessor :list
  738.   end
  739.  
  740.   class Animation
  741.     def initialize
  742.       @id = 0
  743.       @name = ""
  744.       @animation1_name = ""
  745.       @animation1_hue = 0
  746.       @animation2_name = ""
  747.       @animation2_hue = 0
  748.       @position = 1
  749.       @frame_max = 1
  750.       @frames = [RPG::Animation::Frame.new]
  751.       @timings = []
  752.     end
  753.     attr_accessor :id
  754.     attr_accessor :name
  755.     attr_accessor :animation1_name
  756.     attr_accessor :animation1_hue
  757.     attr_accessor :animation2_name
  758.     attr_accessor :animation2_hue
  759.     attr_accessor :position
  760.     attr_accessor :frame_max
  761.     attr_accessor :frames
  762.     attr_accessor :timings
  763.    
  764.     class Frame
  765.       def initialize
  766.         @cell_max = 0
  767.         @cell_data = Table.new(0, 0)
  768.       end
  769.       attr_accessor :cell_max
  770.       attr_accessor :cell_data
  771.     end
  772.    
  773.     class Timing
  774.       def initialize
  775.         @frame = 0
  776.         @se = RPG::AudioFile.new("", 80)
  777.         @flash_scope = 0
  778.         @flash_color = Color.new(255,255,255,255)
  779.         @flash_duration = 5
  780.       end
  781.       attr_accessor :frame
  782.       attr_accessor :se
  783.       attr_accessor :flash_scope
  784.       attr_accessor :flash_color
  785.       attr_accessor :flash_duration
  786.     end
  787.   end
  788.  
  789.   class System
  790.     def initialize
  791.       @game_title = ""
  792.       @version_id = 0
  793.       @party_members = [1]
  794.       @elements = [nil, ""]
  795.       @switches = [nil, ""]
  796.       @variables = [nil, ""]
  797.       @passages = Table.new(8192)
  798.       @boat = RPG::System::Vehicle.new
  799.       @ship = RPG::System::Vehicle.new
  800.       @airship = RPG::System::Vehicle.new
  801.       @title_bgm = RPG::BGM.new
  802.       @battle_bgm = RPG::BGM.new
  803.       @battle_end_me = RPG::ME.new
  804.       @gameover_me = RPG::ME.new
  805.       @sounds = []
  806.       20.times { @sounds.push(RPG::AudioFile.new) }
  807.       @test_battlers = []
  808.       @test_troop_id = 1
  809.       @start_map_id = 1
  810.       @start_x = 0
  811.       @start_y = 0
  812.       @terms = RPG::System::Terms.new
  813.       @battler_name = ""
  814.       @battler_hue = 0
  815.       @edit_map_id = 1
  816.     end
  817.     attr_accessor :game_title
  818.     attr_accessor :version_id
  819.     attr_accessor :party_members
  820.     attr_accessor :elements
  821.     attr_accessor :switches
  822.     attr_accessor :variables
  823.     attr_accessor :passages
  824.     attr_accessor :boat
  825.     attr_accessor :ship
  826.     attr_accessor :airship
  827.     attr_accessor :title_bgm
  828.     attr_accessor :battle_bgm
  829.     attr_accessor :battle_end_me
  830.     attr_accessor :gameover_me
  831.     attr_accessor :sounds
  832.     attr_accessor :test_battlers
  833.     attr_accessor :test_troop_id
  834.     attr_accessor :start_map_id
  835.     attr_accessor :start_x
  836.     attr_accessor :start_y
  837.     attr_accessor :terms
  838.     attr_accessor :battler_name
  839.     attr_accessor :battler_hue
  840.     attr_accessor :edit_map_id
  841.    
  842.     class Vehicle
  843.       def initialize
  844.         @character_name = ""
  845.         @character_index = 0
  846.         @bgm = RPG::AudioFile.new
  847.         @start_map_id = 0
  848.         @start_x = 0
  849.         @start_y = 0
  850.       end
  851.       attr_accessor :character_name
  852.       attr_accessor :character_index
  853.       attr_accessor :bgm
  854.       attr_accessor :start_map_id
  855.       attr_accessor :start_x
  856.       attr_accessor :start_y
  857.     end
  858.    
  859.     class Terms
  860.       def initialize
  861.         @level = ""
  862.         @level_a = ""
  863.         @hp = ""
  864.         @hp_a = ""
  865.         @mp = ""
  866.         @mp_a = ""
  867.         @atk = ""
  868.         @def = ""
  869.         @spi = ""
  870.         @agi = ""
  871.         @weapon = ""
  872.         @armor1 = ""
  873.         @armor2 = ""
  874.         @armor3 = ""
  875.         @armor4 = ""
  876.         @weapon1 = ""
  877.         @weapon2 = ""
  878.         @attack = ""
  879.         @skill = ""
  880.         @guard = ""
  881.         @item = ""
  882.         @equip = ""
  883.         @status = ""
  884.         @save = ""
  885.         @game_end = ""
  886.         @fight = ""
  887.         @escape = ""
  888.         @new_game = ""
  889.         @continue = ""
  890.         @shutdown = ""
  891.         @to_title = ""
  892.         @cancel = ""
  893.         @gold = ""
  894.       end
  895.       attr_accessor :level
  896.       attr_accessor :level_a
  897.       attr_accessor :hp
  898.       attr_accessor :hp_a
  899.       attr_accessor :mp
  900.       attr_accessor :mp_a
  901.       attr_accessor :atk
  902.       attr_accessor :def
  903.       attr_accessor :spi
  904.       attr_accessor :agi
  905.       attr_accessor :weapon
  906.       attr_accessor :armor1
  907.       attr_accessor :armor2
  908.       attr_accessor :armor3
  909.       attr_accessor :armor4
  910.       attr_accessor :weapon1
  911.       attr_accessor :weapon2
  912.       attr_accessor :attack
  913.       attr_accessor :skill
  914.       attr_accessor :guard
  915.       attr_accessor :item
  916.       attr_accessor :equip
  917.       attr_accessor :status
  918.       attr_accessor :save
  919.       attr_accessor :game_end
  920.       attr_accessor :fight
  921.       attr_accessor :escape
  922.       attr_accessor :new_game
  923.       attr_accessor :continue
  924.       attr_accessor :shutdown
  925.       attr_accessor :to_title
  926.       attr_accessor :cancel
  927.       attr_accessor :gold
  928.     end
  929.    
  930.     class TestBattler
  931.       def initialize
  932.         @actor_id = 1
  933.         @level = 1
  934.         @weapon_id = 0
  935.         @armor1_id = 0
  936.         @armor2_id = 0
  937.         @armor3_id = 0
  938.         @armor4_id = 0
  939.       end
  940.       attr_accessor :actor_id
  941.       attr_accessor :level
  942.       attr_accessor :weapon_id
  943.       attr_accessor :armor1_id
  944.       attr_accessor :armor2_id
  945.       attr_accessor :armor3_id
  946.       attr_accessor :armor4_id
  947.     end
  948.   end
  949.  
  950.   class AudioFile
  951.     def initialize(name = "", volume = 100, pitch = 100)
  952.       @name = name
  953.       @volume = volume
  954.       @pitch = pitch
  955.     end
  956.     attr_accessor :name
  957.     attr_accessor :volume
  958.     attr_accessor :pitch
  959.   end
  960.  
  961.   class BGM < AudioFile
  962.     @@last = BGM.new
  963.     def play
  964.       if @name.empty?
  965.         Audio.bgm_stop
  966.         @@last = BGM.new
  967.       else
  968.         Audio.bgm_play("Audio/BGM/" + @name, @volume, @pitch)
  969.         @@last = self
  970.       end
  971.     end
  972.     def self.stop
  973.       Audio.bgm_stop
  974.       @@last = BGM.new
  975.     end
  976.     def self.fade(time)
  977.       Audio.bgm_fade(time)
  978.       @@last = BGM.new
  979.     end
  980.     def self.last
  981.       @@last
  982.     end
  983.   end
  984.  
  985.   class BGS < AudioFile
  986.     @@last = BGS.new
  987.     def play
  988.       if @name.empty?
  989.         Audio.bgs_stop
  990.         @@last = BGS.new
  991.       else
  992.         Audio.bgs_play("Audio/BGS/" + @name, @volume, @pitch)
  993.         @@last = self
  994.       end
  995.     end
  996.     def self.stop
  997.       Audio.bgs_stop
  998.       @@last = BGS.new
  999.     end
  1000.     def self.fade(time)
  1001.       Audio.bgs_fade(time)
  1002.       @@last = BGS.new
  1003.     end
  1004.     def self.last
  1005.       @@last
  1006.     end
  1007.   end
  1008.  
  1009.   class ME < AudioFile
  1010.     def play
  1011.       if @name.empty?
  1012.         Audio.me_stop
  1013.       else
  1014.         Audio.me_play("Audio/ME/" + @name, @volume, @pitch)
  1015.       end
  1016.     end
  1017.     def self.stop
  1018.       Audio.me_stop
  1019.     end
  1020.     def self.fade(time)
  1021.       Audio.me_fade(time)
  1022.     end
  1023.   end
  1024.  
  1025.   class SE < AudioFile
  1026.     def play
  1027.       unless @name.empty?
  1028.         Audio.se_play("Audio/SE/" + @name, @volume, @pitch)
  1029.       end
  1030.     end
  1031.     def self.stop
  1032.       Audio.se_stop
  1033.     end
  1034.   end
  1035. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement