Advertisement
Rafael_Sol_Maker

RAFAEL_SOL_MAKER's RGSS2 DATA STRUCTURE FOR ACE SLIM

Jul 21st, 2012
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 13.03 KB | None | 0 0
  1. #===============================================================================
  2. #         RAFAEL_SOL_MAKER's RGSS2 DATA STRUCTURE FOR ACE (BETA)
  3. #     SLIM VERSION: LESS 542 LINES IF COMPARED WITH THE PREVIOUS VERSION
  4. #_______________________________________________________________________________
  5. #   Description  | It's simply part of the RPG Module Data Structure, extracted
  6. #                | originally from RPG Maker VX Help file. This version is
  7. #                | tweaked and intended to run only with the RGSS3 game player.
  8. #________________|______________________________________________________________
  9. #     Usage      | Just plug it before any other scripts, including the ones
  10. #                | from default game engine. Yes, this will be the very first!
  11. #________________|______________________________________________________________
  12. # Specifications | Difficulty to Use:
  13. #                |  * (almost none at all, just plug it correctly)
  14. #                | Scripting Difficulty:
  15. #                |  * (few, it's only a data structure after all)
  16. #                | Compatibility:
  17. #                |  ??? (it's already made to create compatibility!)
  18. #                | New Methods:
  19. #                |  - (none, only old methods already made for RPG Module)
  20. #                | Overwritten Methods:
  21. #                |  - (depends on what are you using for)
  22. #                | Aliased Methods:
  23. #                |  - RPG::Actor.new
  24. #                |  - RPG::UsableItem.new
  25. #                |  - RPG::Skill.new
  26. #                |  - RPG::Item.new
  27. #                |  - RPG::EquipItem.new
  28. #                |  - RPG::Weapon.new
  29. #                |  - RPG::Enemy.new
  30. #                |  - RPG::Troop.new
  31. #                |  - RPG::State.new
  32. #                |  - RPG::System.new
  33. #                |  - RPG::System::TestBattler.new
  34. #________________|______________________________________________________________
  35. # Special Thanks | -
  36. #________________|______________________________________________________________
  37. #===============================================================================
  38.  
  39. module RPG
  40.   class Area
  41.     def initialize
  42.       @id = 0
  43.       @name = ""
  44.       @map_id = 0
  45.       @rect = Rect.new(0,0,0,0)
  46.       @encounter_list = []
  47.       @order = 0
  48.     end
  49.     attr_accessor :id
  50.     attr_accessor :name
  51.     attr_accessor :map_id
  52.     attr_accessor :rect
  53.     attr_accessor :encounter_list
  54.     attr_accessor :order
  55.   end  
  56.  
  57.   class Actor
  58.       alias rgss2to3_initialize initialize
  59.       def initialize
  60.         rgss2to3_initialize
  61.       @id = 0
  62.       @name = ""
  63.       @exp_basis = 25
  64.       @exp_inflation = 35
  65.       @parameters = Table.new(6,100)
  66.       for i in 1..99
  67.         @parameters[0,i] = 400+i*50
  68.         @parameters[1,i] = 80+i*10
  69.         @parameters[2,i] = 15+i*5/4
  70.         @parameters[3,i] = 15+i*5/4
  71.         @parameters[4,i] = 20+i*5/2
  72.         @parameters[5,i] = 20+i*5/2
  73.       end
  74.       @weapon_id = 0
  75.       @armor1_id = 0
  76.       @armor2_id = 0
  77.       @armor3_id = 0
  78.       @armor4_id = 0
  79.       @two_swords_style = false
  80.       @fix_equipment = false
  81.       @auto_battle = false
  82.       @super_guard = false
  83.       @pharmacology = false
  84.       @critical_bonus = false
  85.     end
  86.     attr_accessor :id
  87.     attr_accessor :name
  88.     attr_accessor :exp_basis
  89.     attr_accessor :exp_inflation
  90.     attr_accessor :parameters
  91.     attr_accessor :weapon_id
  92.     attr_accessor :armor1_id
  93.     attr_accessor :armor2_id
  94.     attr_accessor :armor3_id
  95.     attr_accessor :armor4_id
  96.     attr_accessor :two_swords_style
  97.     attr_accessor :fix_equipment
  98.     attr_accessor :auto_battle
  99.     attr_accessor :super_guard
  100.     attr_accessor :pharmacology
  101.     attr_accessor :critical_bonus
  102.   end
  103.  
  104.   class Class
  105.     def initialize
  106.       @id = 0
  107.       @name = ""
  108.       @position = 0
  109.       @weapon_set = []
  110.       @armor_set = []
  111.       @element_ranks = Table.new(1)
  112.       @state_ranks = Table.new(1)
  113.       @learnings = []
  114.       @skill_name_valid = false
  115.       @skill_name = ""
  116.     end
  117.     attr_accessor :id
  118.     attr_accessor :name
  119.     attr_accessor :position
  120.     attr_accessor :weapon_set
  121.     attr_accessor :armor_set
  122.     attr_accessor :element_ranks
  123.     attr_accessor :state_ranks
  124.     attr_accessor :learnings
  125.     attr_accessor :skill_name_valid
  126.     attr_accessor :skill_name
  127.   end
  128.  
  129.   class UsableItem < BaseItem
  130.     alias rgss2to3_initialize initialize
  131.     def initialize
  132.       rgss2to3_initialize
  133.       super
  134.       @common_event_id = 0
  135.       @base_damage = 0
  136.       @variance = 20
  137.       @atk_f = 0
  138.       @spi_f = 0
  139.       @physical_attack = false
  140.       @damage_to_mp = false
  141.       @absorb_damage = false
  142.       @ignore_defense = false
  143.       @element_set = []
  144.       @plus_state_set = []
  145.       @minus_state_set = []
  146.     end
  147.     def for_one? # Overwrite: +4
  148.       return [1, 3, 4, 7, 9, 11].include?(@scope)
  149.     end
  150.     def for_two?
  151.       return [5].include?(@scope)
  152.     end
  153.     def for_three?
  154.       return [6].include?(@scope)
  155.     end
  156.     def for_random? # Overwrite: -3
  157.       return [4, 5, 6].include?(@scope)
  158.     end
  159.     def dual?
  160.       return [3].include?(@scope)
  161.     end
  162.     def need_selection? # Overwrite: +3
  163.       return [1, 3, 7, 9].include?(@scope)
  164.     end
  165.     attr_accessor :common_event_id
  166.     attr_accessor :base_damage
  167.     attr_accessor :variance
  168.     attr_accessor :atk_f
  169.     attr_accessor :spi_f
  170.     attr_accessor :physical_attack
  171.     attr_accessor :damage_to_mp
  172.     attr_accessor :absorb_damage
  173.     attr_accessor :ignore_defense
  174.     attr_accessor :element_set
  175.     attr_accessor :plus_state_set
  176.     attr_accessor :minus_state_set
  177.   end
  178.  
  179.   class Skill < UsableItem
  180.     alias rgss2to3_initialize initialize
  181.     def initialize
  182.       rgss2to3_initialize
  183.       super
  184.       @hit = 100
  185.     end
  186.     attr_accessor :hit
  187.   end
  188.  
  189.   class Item < UsableItem
  190.     alias rgss2to3_initialize initialize
  191.     def initialize
  192.       rgss2to3_initialize
  193.       super
  194.       @hp_recovery_rate = 0
  195.       @hp_recovery = 0
  196.       @mp_recovery_rate = 0
  197.       @mp_recovery = 0
  198.       @parameter_type = 0
  199.       @parameter_points = 0
  200.     end
  201.     attr_accessor :hp_recovery_rate
  202.     attr_accessor :hp_recovery
  203.     attr_accessor :mp_recovery_rate
  204.     attr_accessor :mp_recovery
  205.     attr_accessor :parameter_type
  206.     attr_accessor :parameter_points
  207.   end
  208.  
  209.   class EquipItem  < BaseItem  
  210.     alias rgss2to3_initialize initialize
  211.     def initialize
  212.       rgss2to3_initialize
  213.       super
  214.       @atk = 0
  215.       @def = 0
  216.       @spi = 0
  217.       @agi = 0
  218.       @element_set = []
  219.       @state_set = []
  220.     end    
  221.     attr_accessor :atk
  222.     attr_accessor :def
  223.     attr_accessor :spi
  224.     attr_accessor :agi
  225.     attr_accessor :element_set
  226.     attr_accessor :state_set
  227.   end
  228.  
  229.   class Weapon < EquipItem  
  230.     alias rgss2to3_initialize initialize
  231.     def initialize
  232.       rgss2to3_initialize
  233.       super
  234.       @hit = 95
  235.       @two_handed = false
  236.       @fast_attack = false
  237.       @dual_attack = false
  238.       @critical_bonus = false
  239.     end    
  240.     attr_accessor :hit
  241.     attr_accessor :two_handed
  242.     attr_accessor :fast_attack
  243.     attr_accessor :dual_attack
  244.     attr_accessor :critical_bonus
  245.   end
  246.  
  247.   class Armor < EquipItem
  248.     def initialize
  249.       super
  250.       @kind = 0
  251.       @eva = 0
  252.       @prevent_critical = false
  253.       @half_mp_cost = false
  254.       @double_exp_gain = false
  255.       @auto_hp_recover = false
  256.     end    
  257.     attr_accessor :kind
  258.     attr_accessor :eva
  259.     attr_accessor :prevent_critical
  260.     attr_accessor :half_mp_cost
  261.     attr_accessor :double_exp_gain
  262.     attr_accessor :auto_hp_recover
  263.   end
  264.  
  265.   class Enemy
  266.     alias rgss2to3_initialize initialize
  267.     def initialize
  268.       rgss2to3_initialize
  269.       @id = 0
  270.       @name = ""
  271.       @maxhp = 10
  272.       @maxmp = 10
  273.       @atk = 10
  274.       @def = 10
  275.       @spi = 10
  276.       @agi = 10
  277.       @hit = 95
  278.       @eva = 5
  279.       @drop_item1 = RPG::Enemy::DropItem.new
  280.       @drop_item2 = RPG::Enemy::DropItem.new
  281.       @levitate = false
  282.       @has_critical = false
  283.       @element_ranks = Table.new(1)
  284.       @state_ranks = Table.new(1)
  285.       @note = ""
  286.     end
  287.     attr_accessor :id
  288.     attr_accessor :name
  289.     attr_accessor :maxhp
  290.     attr_accessor :maxmp
  291.     attr_accessor :atk
  292.     attr_accessor :def
  293.     attr_accessor :spi
  294.     attr_accessor :agi
  295.     attr_accessor :hit
  296.     attr_accessor :eva
  297.     attr_accessor :drop_item1
  298.     attr_accessor :drop_item2
  299.     attr_accessor :levitate
  300.     attr_accessor :has_critical
  301.     attr_accessor :element_ranks
  302.     attr_accessor :state_ranks
  303.     attr_accessor :note
  304.    
  305.     class DropItem
  306.       def initialize
  307.         @kind = 0
  308.         @item_id = 1
  309.         @weapon_id = 1
  310.         @armor_id = 1
  311.         @denominator = 1
  312.       end
  313.       attr_accessor :kind
  314.       attr_accessor :item_id
  315.       attr_accessor :weapon_id
  316.       attr_accessor :armor_id
  317.       attr_accessor :denominator
  318.     end
  319.    
  320.     class Action
  321.       def initialize
  322.         @kind = 0
  323.         @basic = 0
  324.         @skill_id = 1
  325.         @condition_type = 0
  326.         @condition_param1 = 0
  327.         @condition_param2 = 0
  328.         @rating = 5
  329.       end
  330.       def skill?
  331.         return @kind == 1
  332.       end
  333.       attr_accessor :kind
  334.       attr_accessor :basic
  335.       attr_accessor :skill_id
  336.       attr_accessor :condition_type
  337.       attr_accessor :condition_param1
  338.       attr_accessor :condition_param2
  339.       attr_accessor :rating
  340.     end
  341.   end
  342.  
  343.   class Troop
  344.     class Member
  345.       alias rgss2to3_initialize initialize
  346.       def initialize
  347.         rgss2to3_initialize
  348.         @immortal = false
  349.       end
  350.       attr_accessor :immortal
  351.     end
  352.   end
  353.  
  354.   class State
  355.     alias rgss2to3_initialize initialize
  356.     def initialize
  357.       rgss2to3_initialize
  358.       @id = 0
  359.       @name = ""
  360.       @icon_index = 0
  361.       @priority = 5 # Overwrite: 5 instead 50
  362.       @atk_rate = 100
  363.       @def_rate = 100
  364.       @spi_rate = 100
  365.       @agi_rate = 100
  366.       @nonresistance = false
  367.       @offset_by_opposite = false
  368.       @slip_damage = false
  369.       @reduce_hit_ratio = false
  370.       @battle_only = true
  371.       @release_by_damage = false
  372.       @hold_turn = 0
  373.       @auto_release_prob = 0
  374.       @element_set = []
  375.       @state_set = []
  376.       @note = ""
  377.     end
  378.     attr_accessor :id
  379.     attr_accessor :name
  380.     attr_accessor :icon_index
  381.     attr_accessor :atk_rate
  382.     attr_accessor :def_rate
  383.     attr_accessor :spi_rate
  384.     attr_accessor :agi_rate
  385.     attr_accessor :nonresistance
  386.     attr_accessor :offset_by_opposite
  387.     attr_accessor :slip_damage
  388.     attr_accessor :reduce_hit_ratio
  389.     attr_accessor :battle_only
  390.     attr_accessor :release_by_damage
  391.     attr_accessor :hold_turn
  392.     attr_accessor :auto_release_prob
  393.     attr_accessor :element_set
  394.     attr_accessor :state_set
  395.     attr_accessor :note    
  396.   end
  397.  
  398.   class System
  399.     alias rgss2to3_initialize initialize
  400.     def initialize
  401.       rgss2to3_initialize
  402.       @passages = Table.new(8192)
  403.     end
  404.     attr_accessor :passages
  405.    
  406.     class Terms
  407.       def initialize
  408.         @level = ""
  409.         @level_a = ""
  410.         @hp = ""
  411.         @hp_a = ""
  412.         @mp = ""
  413.         @mp_a = ""
  414.         @atk = ""
  415.         @def = ""
  416.         @spi = ""
  417.         @agi = ""
  418.         @weapon = ""
  419.         @armor1 = ""
  420.         @armor2 = ""
  421.         @armor3 = ""
  422.         @armor4 = ""
  423.         @weapon1 = ""
  424.         @weapon2 = ""
  425.         @attack = ""
  426.         @skill = ""
  427.         @guard = ""
  428.         @item = ""
  429.         @equip = ""
  430.         @status = ""
  431.         @save = ""
  432.         @game_end = ""
  433.         @fight = ""
  434.         @escape = ""
  435.         @new_game = ""
  436.         @continue = ""
  437.         @shutdown = ""
  438.         @to_title = ""
  439.         @cancel = ""
  440.         @gold = ""
  441.       end
  442.       attr_accessor :level
  443.       attr_accessor :level_a
  444.       attr_accessor :hp
  445.       attr_accessor :hp_a
  446.       attr_accessor :mp
  447.       attr_accessor :mp_a
  448.       attr_accessor :atk
  449.       attr_accessor :def
  450.       attr_accessor :spi
  451.       attr_accessor :agi
  452.       attr_accessor :weapon
  453.       attr_accessor :armor1
  454.       attr_accessor :armor2
  455.       attr_accessor :armor3
  456.       attr_accessor :armor4
  457.       attr_accessor :weapon1
  458.       attr_accessor :weapon2
  459.       attr_accessor :attack
  460.       attr_accessor :skill
  461.       attr_accessor :guard
  462.       attr_accessor :item
  463.       attr_accessor :equip
  464.       attr_accessor :status
  465.       attr_accessor :save
  466.       attr_accessor :game_end
  467.       attr_accessor :fight
  468.       attr_accessor :escape
  469.       attr_accessor :new_game
  470.       attr_accessor :continue
  471.       attr_accessor :shutdown
  472.       attr_accessor :to_title
  473.       attr_accessor :cancel
  474.       attr_accessor :gold
  475.    
  476.       class TestBattler
  477.         alias rgss2to3_initialize initialize
  478.         def initialize
  479.           rgss2to3_initialize
  480.           @weapon_id = 0
  481.           @armor1_id = 0
  482.           @armor2_id = 0
  483.           @armor3_id = 0
  484.           @armor4_id = 0
  485.         end
  486.         attr_accessor :weapon_id
  487.         attr_accessor :armor1_id
  488.         attr_accessor :armor2_id
  489.         attr_accessor :armor3_id
  490.         attr_accessor :armor4_id
  491.       end
  492.     end
  493.   end
  494. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement