Advertisement
Fomar0153

Fomar0153 - Include Battle Events from another Troop 1.0

Feb 5th, 2012
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.21 KB | None | 0 0
  1. =begin
  2. Include Battle Events from another Troop
  3. by Fomar0153
  4. Version 1.0
  5. ----------------------
  6. Notes
  7. ----------------------
  8. No requirements
  9. Allows you to include all the battle events from a troop
  10. in all the other troops.
  11. ----------------------
  12. Instructions
  13. ----------------------
  14. Choose which troop you wish to have the set events and
  15. set INCLUDE_EVENTS_TROOP_ID to its id
  16. ----------------------
  17. Known bugs
  18. ----------------------
  19. None
  20. =end
  21. module DataManager
  22.   #--------------------------------------------------------------------------
  23.   # ● Choose the troop whose events should be included in every battle
  24.   #--------------------------------------------------------------------------
  25.   INCLUDE_EVENTS_TROOP_ID = 1
  26.   #--------------------------------------------------------------------------
  27.   # ● Alias the loading methods
  28.   #--------------------------------------------------------------------------
  29.   class << self
  30.     alias include_events_load_normal_database load_normal_database
  31.     alias include_events_load_battle_test_database load_battle_test_database
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● Load the original database and then inclde the additional events
  35.   #--------------------------------------------------------------------------
  36.   def self.load_normal_database
  37.     include_events_load_normal_database
  38.     include_battle_events
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● Load the original database and then inclde the additional events
  42.   #--------------------------------------------------------------------------
  43.   def self.load_battle_test_database
  44.     include_events_load_battle_test_database
  45.     include_battle_events
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● Include the first troops events in all other troops
  49.   #--------------------------------------------------------------------------
  50.   def self.include_battle_events
  51.     for troop in $data_troops
  52.       next if troop.nil?
  53.       unless troop.id == INCLUDE_EVENTS_TROOP_ID
  54.         troop.pages += $data_troops[INCLUDE_EVENTS_TROOP_ID].pages
  55.       end
  56.     end
  57.   end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement