Advertisement
roninator2

Doctor Todd Difficulty - No Easy

Dec 7th, 2024
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 12.38 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # DT's Difficulty
  4. # Author: DoctorTodd
  5. # Date (15/12/2019)
  6. # Version: (1.0.2) (VXA)
  7. # Level: (Medium)
  8. #
  9. #===============================================================================
  10. #
  11. # NOTES: 1)This script will only work with ace.
  12. #        2)A difficulty must be selected before the first battle or the game WILL
  13. #        CRASH.
  14. #
  15. #===============================================================================
  16. #
  17. # Description: Lets the player select the games difficulty.
  18. #
  19. # Credits: Me (DoctorTodd), D&P3 for saving bug fix.
  20. # Additions by Roninator2
  21. #    Easy option removed from 1.01 for request by SlickDeath97
  22. #===============================================================================
  23. #
  24. # Instructions
  25. # Paste above main.
  26. #
  27. #===============================================================================
  28. #
  29. # Free for any use as long as I'm credited.
  30. #
  31. #===============================================================================
  32. #
  33. # Editing begins 38 and ends on 81.
  34. #
  35. #===============================================================================
  36. module TODDDIFFICULTY  
  37. #Normal Text.  
  38. NORMALT = "Normal"  
  39. #Heroic Text.  
  40. HEROICT = "Heroic"  
  41. #Hard Text.  
  42. HARDT = "Legendary"  
  43. #Heroic enemy parameters multiplier (Normal is skipped since it's what put  
  44. #you into the database).  
  45. HEROICM = 1.25  
  46. #Hard enemy parameters multiplier.  
  47. HARDM = 1.5    
  48. #Heroic enemy experience multiplier (Normal is skipped since it's what put  
  49. #you into the database).  
  50. HEROICEXPM = 1.25  
  51. #Hard enemy experience multiplier.  
  52. HARDEXPM = 1.5    
  53. #Heroic enemy gold multiplier (Normal is skipped since it's what put  
  54. #you into the database).  
  55. HEROICGOLDM = 1.5  
  56. #Hard enemy gold multiplier.  
  57. HARDGOLDM = 2      
  58. #Heroic enemy drop multiplier (Normal is skipped since it's what put  
  59. #you into the database).  
  60. HEROICDROPM = 1.25  
  61. #Hard enemy drop multiplier.  
  62. HARDDROPM = 1.5  
  63. #The text above where the selection is made.  
  64. TEXT = "Please select a difficulty:"  
  65. #Menu command?  
  66. MENU = true  
  67. #Sound effect to play when difficulty is selected.  
  68. SE = "Darkness8"  
  69. #Switch to allow cancelling the difficulty selection.  
  70. #MUST NOT BE ON WHEN SELECTING FOR THE FIRST TIME.  
  71. SWITCH = 5
  72.  
  73. end
  74. #==============================================================================
  75. # ** Game_Enemy
  76. #------------------------------------------------------------------------------
  77. #  This class handles enemies. It used within the Game_Troop class
  78. # ($game_troop).
  79. #==============================================================================
  80.  
  81. class Game_Enemy < Game_Battler  
  82. #--------------------------------------------------------------------------  
  83. # * Get Base Value of Parameter  
  84. #--------------------------------------------------------------------------  
  85.     alias todd_difficulty_gmen_param_base param_base  
  86.     def param_base(param_id, *args)  
  87.         n1 = todd_difficulty_gmen_param_base(param_id, *args)  
  88.         n2 = case $game_system.todd_difficulty  
  89.         when 0
  90.             1  
  91.         when 1
  92.             TODDDIFFICULTY::HEROICM  
  93.         when 2
  94.             TODDDIFFICULTY::HARDM  
  95.         end  
  96.     return n1 * n2
  97.     end  
  98.     #--------------------------------------------------------------------------  
  99.     # * Get Experience  
  100.     #--------------------------------------------------------------------------  
  101.     def exp    
  102.         case $game_system.todd_difficulty    
  103.         when 0
  104.             enemy.exp          
  105.         when 1
  106.             enemy.exp * TODDDIFFICULTY::HEROICEXPM    
  107.         when 2
  108.             enemy.exp * TODDDIFFICULTY::HARDEXPM  
  109.         end
  110.     end  
  111.     #--------------------------------------------------------------------------  
  112.     # * Get Gold  
  113.     #--------------------------------------------------------------------------  
  114.     def gold    
  115.         case $game_system.todd_difficulty    
  116.         when 0
  117.             enemy.gold    
  118.         when 1
  119.             enemy.gold * TODDDIFFICULTY::HEROICGOLDM    
  120.         when 2
  121.             enemy.gold * TODDDIFFICULTY::HARDGOLDM  
  122.         end  
  123.     end  
  124.     #--------------------------------------------------------------------------  
  125.     # * Create Array of Dropped Items  
  126.     #--------------------------------------------------------------------------  
  127.     def make_drop_items    
  128.         case $game_system.todd_difficulty    
  129.     when 0
  130.       @DropMulti = 1    
  131.     when 1
  132.       @DropMulti = TODDDIFFICULTY::HEROICDROPM    
  133.     when 2
  134.       @DropMulti = TODDDIFFICULTY::HARDDROPM  
  135.         end    
  136.         enemy.drop_items.inject([]) do |r, di|      
  137.       if di.kind > 0 && rand * di.denominator < drop_item_rate * @DropMulti
  138.         r.push(item_object(di.kind, di.data_id))      
  139.       else
  140.         r      
  141.       end    
  142.         end  
  143.     end
  144. end
  145.  
  146. #==============================================================================
  147. # ** Game_System
  148. #------------------------------------------------------------------------------
  149. #  This class handles system data. It saves the disable state of saving and
  150. # menus. Instances of this class are referenced by $game_system.
  151. #==============================================================================
  152.  
  153. class Game_System  
  154. #--------------------------------------------------------------------------  
  155. # * Public Instance Variables  
  156. #--------------------------------------------------------------------------  
  157.     attr_accessor :todd_difficulty # save forbidden  
  158. #--------------------------------------------------------------------------  
  159. # * Object Initialization  
  160. #--------------------------------------------------------------------------  
  161.     alias todd_difficulty_gamesystem_init initialize  
  162.     def initialize    
  163.         @todd_difficulty = 0    
  164.         todd_difficulty_gamesystem_init
  165.     end
  166. end
  167.  
  168. #==============================================================================
  169. # ** Window_DifficultySelection
  170. #==============================================================================
  171.  
  172. class Window_DifficultySelection < Window_HorzCommand  
  173. #--------------------------------------------------------------------------  
  174. # * Object Initialization  
  175. #--------------------------------------------------------------------------  
  176.     def initialize    
  177.         super(0, 0)
  178.     end  
  179.     #--------------------------------------------------------------------------  
  180.     # * Get Window Width  
  181.     #--------------------------------------------------------------------------  
  182.     def window_width    
  183.         Graphics.width/2 + 20  
  184.     end  
  185.     #--------------------------------------------------------------------------  
  186.     # * Get Digit Count  
  187.     #--------------------------------------------------------------------------
  188.     def col_max    
  189.         return 3  
  190.     end  
  191.     #--------------------------------------------------------------------------  
  192.     # * Create Command List  
  193.     #--------------------------------------------------------------------------  
  194.     def make_command_list    
  195.         add_command(TODDDIFFICULTY::NORMALT,   :normal)    
  196.         add_command(TODDDIFFICULTY::HEROICT,    :heroic)    
  197.         add_command(TODDDIFFICULTY::HARDT, :hard)  
  198.     end
  199. end
  200. #==============================================================================
  201. # ** Window_DifficultyName
  202. #==============================================================================
  203.  
  204. class Window_DifficultyName < Window_Base  
  205. #--------------------------------------------------------------------------  
  206. # * Object Initialization  
  207. #--------------------------------------------------------------------------  
  208.     def initialize    
  209.         super(0, 0, window_width, fitting_height(1))    
  210.         refresh  
  211.     end  
  212.     #--------------------------------------------------------------------------  
  213.     # * Get Window Width  
  214.     #--------------------------------------------------------------------------  
  215.     def window_width    
  216.         return Graphics.width/2 + 20  
  217.     end  
  218.     #--------------------------------------------------------------------------  
  219.     # * Refresh  
  220.     #--------------------------------------------------------------------------  
  221.     def refresh    
  222.         contents.clear    
  223.         draw_text(15, -27, 400, 80, TODDDIFFICULTY::TEXT)  
  224.     end
  225. end
  226. #==============================================================================
  227. # ** Scene_Difficulty
  228. #==============================================================================
  229.  
  230. class Scene_Difficulty < Scene_MenuBase  
  231. #--------------------------------------------------------------------------  
  232. # * Start Processing  
  233. #--------------------------------------------------------------------------  
  234.     def start    
  235.         super    
  236.         create_command_window    
  237.         create_name_window  
  238.     end  
  239.     #--------------------------------------------------------------------------  
  240.     # * Create Command Window  
  241.     #--------------------------------------------------------------------------  
  242.     def create_command_window    
  243.         @command_window = Window_DifficultySelection.new    
  244.         @command_window.set_handler(:normal,     method(:command_normal))  
  245.         @command_window.set_handler(:heroic,     method(:command_heroic))    
  246.         @command_window.set_handler(:hard,    method(:command_hard))    
  247.         @command_window.set_handler(:cancel,    method(:return_scene))if $game_switches[TODDDIFFICULTY::SWITCH] == true    
  248.         @command_window.x = Graphics.width/2 - 170    
  249.         @command_window.y = Graphics.height/2 - 50  
  250.     end  
  251.     #--------------------------------------------------------------------------  
  252.     # * Create Difficulty Window  
  253.     #--------------------------------------------------------------------------  
  254.     def create_name_window    
  255.         @name_window = Window_DifficultyName.new    
  256.         @name_window.x = Graphics.width/2 - 170    
  257.         @name_window.y = Graphics.height/2 - 97  
  258.     end  
  259.     #--------------------------------------------------------------------------  
  260.     # * [normal] Command  
  261.   #--------------------------------------------------------------------------  
  262.     def command_normal    
  263.         $game_system.todd_difficulty = 0  
  264.         Audio.se_play("Audio/SE/" + TODDDIFFICULTY::SE, 100, 100)    
  265.         return_scene  
  266.     end  
  267.     #--------------------------------------------------------------------------  
  268.     # * [heroic] Command  
  269.     #--------------------------------------------------------------------------  
  270.     def command_heroic    
  271.         $game_system.todd_difficulty = 1    
  272.         Audio.se_play("Audio/SE/" + TODDDIFFICULTY::SE, 100, 100)    
  273.         return_scene  
  274.     end  
  275.     #--------------------------------------------------------------------------  
  276.     # * [hard] Command  
  277.     #--------------------------------------------------------------------------
  278.     def command_hard    
  279.         $game_system.todd_difficulty = 2      
  280.         Audio.se_play("Audio/SE/" + TODDDIFFICULTY::SE, 100, 100)  
  281.         return_scene  
  282.     end
  283. end
  284.  
  285. if TODDDIFFICULTY::MENU == true
  286. #==============================================================================
  287. # ** Scene_Menu
  288. #------------------------------------------------------------------------------
  289. #  This class performs the menu screen processing.
  290. #==============================================================================
  291.  
  292.     class Scene_Menu < Scene_MenuBase  
  293.     #--------------------------------------------------------------------------  
  294.     # * Create Command Window  
  295.     #--------------------------------------------------------------------------  
  296.     alias todd_dif_menu_add_menu_command create_command_window  
  297.     def create_command_window  
  298.         todd_dif_menu_add_menu_command    
  299.         @command_window.set_handler(:dif, method(:command_dif))  
  300.     end
  301. end  
  302.     #--------------------------------------------------------------------------  
  303.     # * [Difficulty] Command  
  304.     #--------------------------------------------------------------------------  
  305.     def command_dif  
  306.         SceneManager.call(Scene_Difficulty)
  307.     end
  308. end
  309.  
  310. if TODDDIFFICULTY::MENU == true
  311. #==============================================================================
  312. # ** Window_MenuCommand
  313. #------------------------------------------------------------------------------
  314. #  This command window appears on the menu screen.
  315. #==============================================================================
  316.  
  317.     class Window_MenuCommand < Window_Command  
  318.     #--------------------------------------------------------------------------  
  319.     # * Add Main Commands to List  
  320.     #--------------------------------------------------------------------------  
  321.         alias todd_dif_menu_command_add_to_menu add_main_commands  
  322.         def add_main_commands    
  323.             todd_dif_menu_command_add_to_menu    
  324.             add_command("Difficulty", :dif, main_commands_enabled)  
  325.         end
  326.     end
  327. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement