Advertisement
roninator2

Doctor Todd Difficulty - No Easy

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