TheoAllen

ED - diff select

Nov 9th, 2013
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.08 KB | None | 0 0
  1. module ED_Addon
  2.   def self.set_beginner
  3.     $data_enemies.compact.each do |enemy|
  4.       enemy.maxhp *= 0.75
  5.       enemy.maxmp *= 0.8
  6.       enemy.atk *= 0.75
  7.       enemy.def *= 0.75
  8.       enemy.spi *= 0.8
  9.       enemy.agi *= 0.75
  10.     end
  11.     $game_system.diff = 1
  12.   end
  13. end
  14.  
  15. class Game_System
  16.   attr_writer :diff
  17.  
  18.   alias theo_ed_diff_select_init initialize
  19.   def initialize
  20.     theo_ed_diff_select_init
  21.     @diff = 0
  22.   end
  23.  
  24.   def diff
  25.     @diff ||= 0
  26.   end
  27.  
  28. end
  29.  
  30. class Scene_Difficulty < Scene_Base
  31.  
  32.   def start
  33.     super
  34.     s1 = "Beginner"
  35.     s2 = "Normal"
  36.     @diff_select = Window_Command.new(172, [s1, s2])
  37.     @diff_select.x = (544 - @diff_select.width) / 2
  38.     @diff_select.y = 288
  39.   end
  40.  
  41.   def update
  42.     super
  43.     @diff_select.update
  44.     if Input.trigger?(Input::C)
  45.       case @diff_select.index
  46.       when 0    
  47.         set_beginner
  48.       when 1    
  49.         do_noting
  50.       end
  51.     end
  52.   end
  53.  
  54.   def terminate
  55.     super
  56.     @diff_select.dispose
  57.   end
  58.  
  59.   def set_beginner
  60.     ED_Addon.set_beginner
  61.     goto_map
  62.   end
  63.  
  64.   def do_noting
  65.     goto_map
  66.   end
  67.  
  68.   def goto_map
  69.     confirm_player_location
  70.     Sound.play_decision
  71.     $game_party.setup_starting_members            # Initial party
  72.     $game_map.setup($data_system.start_map_id)    # Initial map position
  73.     $game_player.moveto($data_system.start_x, $data_system.start_y)    
  74.     $game_player.refresh
  75.     $game_player.set_direction(2)
  76.     $scene = Scene_Map.new
  77.     RPG::BGM.fade(1500)
  78.     Graphics.fadeout(60)
  79.     Graphics.wait(40)
  80.     Graphics.frame_count = 0
  81.     RPG::BGM.stop
  82.     $game_map.autoplay
  83.   end
  84.  
  85.   def confirm_player_location
  86.     if $data_system.start_map_id == 0
  87.       print "Player start location not set."
  88.       exit
  89.     end
  90.   end
  91.  
  92. end
  93.  
  94. class Scene_Title < Scene_Base
  95.  
  96.   def command_new_game
  97.     $scene = Scene_Difficulty.new
  98.   end
  99.  
  100. end
  101.  
  102. class Scene_File < Scene_Base
  103.  
  104.   alias ed_diff_select_load do_load
  105.   def do_load
  106.     ed_diff_select_load
  107.     ED_Addon.set_beginner if $game_system.diff == 1
  108.   end
  109.  
  110. end
Advertisement
Add Comment
Please, Sign In to add comment