vindaca510

V's Job Tree System v0.3

Nov 12th, 2013
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 59.68 KB | None | 0 0
  1.  
  2.  
  3. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  4. #                                                                              #
  5. #                           V's Promotion System 2:                            #
  6. #                               Job Tree System                                #
  7. #                                 Version  0.3                                 #
  8. #                                                                              #
  9. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  10. #                                Written By:  V                                #
  11. #                        Last Edited: November 13, 2013                        #
  12. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  13. #                                                                              #
  14. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  15.  
  16.  
  17. #==============================================================================#
  18. #------------------------------------------------------------------------------#
  19. # ** Disclaimer                                                                #
  20. #------------------------------------------------------------------------------#
  21. #                                                                              #
  22. # This script was commissioned by Saber995 it is intended for Non-commercial   #
  23. # use only, if you wish to use this script in a commercial game please PM me   #
  24. # at which ever site you found this script. Either way please give me credit   #
  25. # in your game script as the writer of this script, and send me a PM about     #
  26. # the release of the game/demo.                                                #
  27. #                                                                              #
  28. #------------------------------------------------------------------------------#
  29. # ** How To Use                                                                #
  30. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  31. #                                                                              #
  32. # * All class must have at least one of each of the following tags:            #
  33. #                                                                              #
  34. #     <Class Requirements: class_id, level >                                   #
  35. #     (For  Multiple Class Requirements Repeat The Tag)                        #
  36. #                                                                              #
  37. #     <Sprite: sprite_name, sprite_index>                                      #
  38. #                                                                              #
  39. #     <Cost: ammount>                                                          #
  40. #                                                                              #
  41. # * An optional tag used to change the actors face image.                      #
  42. #                                                                              #
  43. #     <Face: face_nme, face_index>                                             #
  44. #                                                                              #
  45. # * All class must also have a disription below.                               #
  46. #                                                                              #
  47. # * All enemies must have the following tag:                                   #
  48. #                                                                              #
  49. #     <JP: ammount >                                                           #
  50. #                                                                              #
  51. #                                                                              #
  52. # * To add/remove JP use one the following script calls:                       #
  53. #                                                                              #
  54. #     $game_party.gain_jp(ammount)                                             #
  55. #     (All party members will recieve the same ammount.)                       #
  56. #                                                                              #
  57. #     $game_party.lose_jp(ammount)                                             #
  58. #     (All party members will lose the same ammount.)                          #
  59. #                                                                              #
  60. #     $game_party.members[index].add_jp(ammount)                               #
  61. #     (Only the individual will recieve the same ammount.)                     #
  62. #                                                                              #
  63. #     $game_party.members[index].remove_jp(ammount)                            #
  64. #     (Only the individual will lose the same ammount.)                        #
  65. #                                                                              #
  66. #     $game_party.members[index].current_jp                                    #
  67. #     (Returns the individuals current jp.)                                    #
  68. #                                                                              #
  69. # * An Actor notetag used to prevent the graphics from changing:               #
  70. #                                                                              #
  71. #     <Main>                                                                   #
  72. #                                                                              #
  73. #------------------------------------------------------------------------------#
  74. # ** Description                                                               #
  75. #------------------------------------------------------------------------------#
  76. #                                                                              #
  77. #  v0.1                                                                        #
  78. # ~=~=~=~                                                                      #
  79. #                                                                              #
  80. # This system is loosely based on FFT job system. Once your class reaches a set#
  81. # level you can buy a new class with JP or Job Points. JP can be given or      #
  82. # won in combat.                                                               #
  83. #                                                                              #
  84. #  v0.2                                                                        #
  85. # ~=~=~=~                                                                      #
  86. #                                                                              #
  87. # I added a few optional tags for the faces and main party members, I've also  #
  88. # added an option to dislplay numbers instead of stars for the level.          #
  89. #                                                                              #
  90. #  v0.3                                                                        #
  91. # ~=~=~=~                                                                      #
  92. #                                                                              #
  93. # I added an optional to show all of the party member's classes in the current #
  94. # class listing and highlight only the class that are known                    #
  95. #                                                                              #
  96. #------------------------------------------------------------------------------#
  97. #==============================================================================#
  98.  
  99.  
  100.  
  101. #==============================================================================
  102. # ** V's Promotion System 2
  103. #------------------------------------------------------------------------------
  104. #  This module manages customizable features and methods.
  105. #==============================================================================
  106. module V_PS2
  107.   module Specs
  108.    
  109. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  110. #                                                                              #
  111. #                           Start Customizable Area.                           #
  112. #                                                                              #
  113. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  114. #                                                                              #
  115. #                      ONLY EDIT AFTER THE EQUALS SYMBOL.                      #
  116. #                                                                              #
  117. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  118.    
  119.    
  120.   #=============================================================================
  121.   # * Show The Parties Unlocked Classes
  122.   #=============================================================================
  123.  
  124.     Show_Party_Unlocked = true
  125.  
  126.    
  127.   #=============================================================================
  128.   # * Level Display
  129.   #=============================================================================
  130.  
  131.     Use_Numbers = true
  132.     Level_Icon = 125
  133.  
  134.    
  135.   #=============================================================================
  136.   # * JP Info
  137.   #=============================================================================
  138.  
  139.     Max_JP = 100
  140.     JP_Vocab = "JP"
  141.  
  142.    
  143.   #=============================================================================
  144.   # * Class Descriptions
  145.   #=============================================================================
  146.  
  147.     Class_Descriptions = { #<---- Do Not Remove.
  148.    
  149.       1 => [ #<---- Class ID.
  150.         "Just for the cause... The militant backbone.",
  151.         "The soldier can hit just as hard as he can take",
  152.         "a hit. "
  153.       ], #<---- End of Discription.
  154.  
  155.       2 => [ #<---- Class ID.
  156.         "Gential and Calm... The monk finds his center in",
  157.         "order to achive nervana. "
  158.       ], #<---- End of Discription.
  159.      
  160.       3 => [ #<---- Class ID.
  161.         "At peace with God... The paladin is blessed in",
  162.         "combat while fight for his beliefs. The undead",
  163.         "flee in fear of his wrath."
  164.       ], #<---- End of Discription.
  165.      
  166.       4 => [ #<---- Class ID.
  167.         "Cursed and Demented... The spellblade can",
  168.         "enchant his blade with mystic powers and",
  169.         "surround itself in a dark mist."
  170.       ], #<---- End of Discription.
  171.      
  172.    
  173.    
  174. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  175. #                                                                              #
  176. #                            End Customizable Area.                            #
  177. #                                                                              #
  178. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  179. #                                                                              #
  180. #         DO NOT EDIT PAST THIS POINT UNLESS YOU KNOW WHAT YOUR DOING.         #
  181. #                                                                              #
  182. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  183.    
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219. }
  220. end
  221. end #<--- End Module===========================================================
  222.  
  223. #==============================================================================
  224. # ** Window_Base
  225. #------------------------------------------------------------------------------
  226. #  This is a super class of all windows within the game.
  227. #==============================================================================
  228.  
  229. class Window_Promotion_Status < Window_Base
  230.  
  231.   #--------------------------------------------------------------------------
  232.   # * Includes Module's Variables With Class
  233.   #--------------------------------------------------------------------------
  234.  
  235.   include V_PS2::Specs
  236.  
  237.   #--------------------------------------------------------------------------
  238.   # * Initialize Proccessing
  239.   #--------------------------------------------------------------------------
  240.   def initialize(x, y, w, h)
  241.     super(x, y, w, h)
  242.     @height = h
  243.     @width = w
  244.     @actor = $game_party.menu_actor
  245.     refresh(0, 1) unless @actor.current_classes.size > 0
  246.     refresh(0, 0) if @actor.current_classes.size > 0
  247.   end
  248.  
  249.   #--------------------------------------------------------------------------
  250.   # * Refresh Proccessing
  251.   #--------------------------------------------------------------------------
  252.   def refresh(class_id = 0, catagory = 0)
  253.     contents.clear
  254.     case catagory
  255.     when 0
  256.       if @actor.current_classes.size > 0
  257.         id = @actor.current_classes[class_id]
  258.         draw_current_contents(id)
  259.       end
  260.     when 1
  261.       if @actor.available_classes.size > 0
  262.         id = @actor.available_classes[class_id]
  263.         draw_available_contents(id)
  264.       end
  265.     end
  266.   end
  267.  
  268.   #--------------------------------------------------------------------------
  269.   # * Draw Current Class Contents
  270.   #--------------------------------------------------------------------------
  271.   def draw_current_contents(class_id)
  272.     draw_class_level(class_id)
  273.     draw_class_sprite(class_id)
  274.     draw_params(class_id)
  275.     draw_description(class_id)
  276.   end
  277.  
  278.   #--------------------------------------------------------------------------
  279.   # * Draw Available Class Contents
  280.   #--------------------------------------------------------------------------
  281.   def draw_available_contents(class_id)
  282.     draw_class_cost(class_id)
  283.     draw_class_sprite(class_id)
  284.     draw_params(class_id)
  285.     draw_description(class_id)
  286.   end
  287.  
  288.   #--------------------------------------------------------------------------
  289.   # * Draw Class Cost
  290.   #--------------------------------------------------------------------------
  291.   def draw_class_cost(class_id)
  292.     cost = @actor.class_cost(class_id)
  293.     draw_sizeable_text(3, -150, @width, @height, JP_Vocab + " Cost:", 0, 14)
  294.     draw_sizeable_text(25, -135, @width, @height, cost, 0, 30)
  295.   end
  296.  
  297.   #--------------------------------------------------------------------------
  298.   # * Draw Class Sprite
  299.   #--------------------------------------------------------------------------
  300.   def draw_class_sprite(class_id)
  301.     sprite = @actor.class_sprite(class_id)
  302.     draw_zoomed_character(sprite[0], sprite[1].to_i, 40, 75, 2)
  303.   end
  304.  
  305.   #--------------------------------------------------------------------------
  306.   # * Draw Class Level
  307.   #--------------------------------------------------------------------------
  308.   def draw_class_level(class_id)
  309.     level = @actor.class_level(class_id)
  310.     if Use_Numbers == false
  311.       draw_sizeable_text(3, -150, @width, @height, Vocab.level + ":", 0, 14)
  312.       level.times { |i|
  313.         draw_icon(Level_Icon, (10 + (i * 20)), 20)
  314.       }
  315.     else
  316.       draw_sizeable_text(3, -150, @width, @height, "Level: ", 0, 14)
  317.       draw_sizeable_text(25, -135, @width, @height, level, 0, 30)
  318.     end
  319.   end
  320.  
  321.   #--------------------------------------------------------------------------
  322.   # * Draw Class Parameters
  323.   #--------------------------------------------------------------------------
  324.   def draw_params(class_id)
  325.     param_names = [" HP", " MP", "STR", "DEF", "MAT", "MDF", "AGI", "LUK"]
  326.     param_names.size.times { |i|
  327.       draw_sizeable_text(165, (-110 + (i * 17)), @width, @height, param_names[i] + ":", 0, 16)
  328.     }
  329.     cur_params = class_params(@actor.class_id)
  330.     cur_params.size.times { |i|
  331.       draw_sizeable_text(205, (-110 + (i * 17)), @width, @height, cur_params[i], 0, 16)
  332.     }
  333.     spacer = " -> "
  334.     8.times { |i|
  335.       draw_sizeable_text(240, (-110 + (i * 17)), @width, @height, spacer, 0, 16)
  336.     }
  337.     new_params = class_params(class_id)
  338.     new_params.size.times { |i|
  339.       draw_sizeable_text(285, (-110 + (i * 17)), @width, @height, new_params[i], 0, 16)
  340.     }
  341.   end
  342.  
  343.   #--------------------------------------------------------------------------
  344.   # * Draw Description
  345.   #--------------------------------------------------------------------------
  346.   def draw_description(class_id)
  347.     description = class_des(class_id)
  348.     draw_sizeable_text(3, 40, @width, @height, "Description:", 0, 14)
  349.     description.size.times { |i|
  350.       draw_sizeable_text(5, 55 + (i * 20), @width, @height, description[i], 0, 16)
  351.     }
  352.   end
  353.  
  354.   #--------------------------------------------------------------------------
  355.   # * Draw Sizeable Text
  356.   #--------------------------------------------------------------------------
  357.   def draw_sizeable_text(x, y, w, h, text, alignment, size)
  358.     reset_font_settings
  359.     contents.font.size = size
  360.     contents.draw_text(x, y, w, h, text, alignment)
  361.     reset_font_settings
  362.   end
  363.  
  364.   #--------------------------------------------------------------------------
  365.   # * Returns Class Description
  366.   #--------------------------------------------------------------------------
  367.   def class_des(class_id)
  368.     return Class_Descriptions[class_id]
  369.   end
  370.  
  371.   #--------------------------------------------------------------------------
  372.   # * Returns Class Parameters
  373.   #--------------------------------------------------------------------------
  374.   def class_params(class_id)
  375.     params = []
  376.     case
  377.     when @actor.current_classes.include?(class_id)
  378.       level = @actor.class_level(class_id)
  379.     when @actor.current_classes.include?(class_id) == false
  380.       level = 1
  381.     end
  382.     8.times { |i|
  383.       params.push $data_classes[class_id].params[i, level]
  384.     }
  385.     return params
  386.   end
  387.  
  388.   #--------------------------------------------------------------------------
  389.   # * Draw Zoomed Character
  390.   #--------------------------------------------------------------------------
  391.   def draw_zoomed_character(character_name, character_index, x, y, zoom)
  392.     return unless character_name
  393.     bitmap = Cache.character(character_name)
  394.     sign = character_name[/^[\!\$]./]
  395.     if sign && sign.include?('$')
  396.       cw = bitmap.width / 3
  397.       ch = bitmap.height / 4
  398.     else
  399.       cw = bitmap.width / 12
  400.       ch = bitmap.height / 8
  401.     end
  402.     n = character_index
  403.     src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  404.     actor = Rect.new(x, y, cw * zoom, ch * zoom)
  405.     contents.stretch_blt(actor, bitmap, src_rect)    
  406.   end
  407.  
  408. end #<--- End Class============================================================
  409.  
  410.  
  411. #==============================================================================
  412. # ** Window_Base
  413. #------------------------------------------------------------------------------
  414. #  This is a super class of all windows within the game.
  415. #==============================================================================
  416.  
  417. class Window_Promotion_Info < Window_Base
  418.  
  419.   #--------------------------------------------------------------------------
  420.   # * Includes Module's Variables With Class
  421.   #--------------------------------------------------------------------------
  422.  
  423.   include V_PS2::Specs
  424.  
  425.   #--------------------------------------------------------------------------
  426.   # * Initialize Processing
  427.   #--------------------------------------------------------------------------
  428.   def initialize(x, y, w, h)
  429.     @width = w
  430.     @height = h
  431.     @actor = $game_party.menu_actor
  432.     super(x, y, @width, @height)
  433.     refresh
  434.   end
  435.  
  436.   #--------------------------------------------------------------------------
  437.   # * Refresh Proccessing
  438.   #--------------------------------------------------------------------------
  439.   def refresh
  440.     contents.clear
  441.     draw_current_info
  442.   end
  443.  
  444.   #--------------------------------------------------------------------------
  445.   # * Draw Current Info
  446.   #--------------------------------------------------------------------------
  447.   def draw_current_info
  448.     draw_zoomed_character(@actor.character_name, @actor.character_index, @width / 2 - 15, 5, 1)
  449.     draw_sizeable_text(2, 10, @width, @height, @actor.name, 1, 20)
  450.     draw_current_class_name(@actor.class_id)
  451.     draw_class_level(@actor.class_id)
  452.     draw_current_jp
  453.   end
  454.  
  455.   #--------------------------------------------------------------------------
  456.   # * Draw Current JP
  457.   #--------------------------------------------------------------------------
  458.   def draw_current_jp
  459.     draw_sizeable_text(-35, 15, @width, @height, ("Current " + JP_Vocab + ": " + @actor.current_jp.to_s), 2, 20)
  460.   end
  461.  
  462.   #--------------------------------------------------------------------------
  463.   # * Draw Current Class Name
  464.   #--------------------------------------------------------------------------
  465.   def draw_current_class_name(class_id)
  466.     draw_sizeable_text(3, -40, @width, @height, "Current Class:", 0, 14)
  467.     draw_sizeable_text(10, -25, @width, @height, $data_classes[@actor.class_id].name, 0, 20)
  468.   end
  469.  
  470.   #--------------------------------------------------------------------------
  471.   # * Draw Class Level
  472.   #--------------------------------------------------------------------------
  473.   def draw_class_level(class_id)
  474.     level = @actor.class_level(class_id)
  475.     if Use_Numbers == false
  476.       draw_sizeable_text(3, -6, @width, @height, Vocab.level + ":", 0, 18)
  477.       level.times { |i|
  478.         draw_icon(Level_Icon, (10 + (i * 20)), 44)
  479.       }
  480.     else
  481.       change_color(system_color)
  482.       draw_sizeable_text(3, -6, @width, @height, Vocab::level_a, 0, 18)
  483.       change_color(normal_color)
  484.       draw_sizeable_text(35, -6, @width, @height, level, 0, 25)
  485.     end
  486.   end
  487.  
  488.   #--------------------------------------------------------------------------
  489.   # * Draw Sizeable Text
  490.   #--------------------------------------------------------------------------
  491.   def draw_sizeable_text(x, y, w, h, text, alignment, size)
  492.     reset_font_settings
  493.     contents.font.size = size
  494.     contents.draw_text(x, y, w, h, text, alignment)
  495.     reset_font_settings
  496.   end
  497.  
  498.   #--------------------------------------------------------------------------
  499.   # * Draw Zoomed Character
  500.   #--------------------------------------------------------------------------
  501.   def draw_zoomed_character(character_name, character_index, x, y, zoom)
  502.     return unless character_name
  503.     bitmap = Cache.character(character_name)
  504.     sign = character_name[/^[\!\$]./]
  505.     if sign && sign.include?('$')
  506.       cw = bitmap.width / 3
  507.       ch = bitmap.height / 4
  508.     else
  509.       cw = bitmap.width / 12
  510.       ch = bitmap.height / 8
  511.     end
  512.     n = character_index
  513.     src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  514.     actor = Rect.new(x, y, cw * zoom, ch * zoom)
  515.     contents.stretch_blt(actor, bitmap, src_rect)    
  516.   end
  517.  
  518. end #<--- End Class============================================================
  519.  
  520.  
  521. #==============================================================================
  522. # ** Window_Command
  523. #------------------------------------------------------------------------------
  524. #  This window deals with general command choices.
  525. #==============================================================================
  526.  
  527. class Window_Current_Classes < Window_Command
  528.  
  529.   #--------------------------------------------------------------------------
  530.   # * Initialize Processing
  531.   #--------------------------------------------------------------------------
  532.   def initialize(x, y)
  533.     @catagory = 0
  534.     @active = false
  535.     @y = y
  536.     @actor = $game_party.menu_actor
  537.     @actor.current_classes.size > 0 ? @catagory = 0 : @catagory = 1
  538.     super(x, y)
  539.   end
  540.  
  541.   #--------------------------------------------------------------------------
  542.   # * Get Window Height
  543.   #--------------------------------------------------------------------------
  544.   def window_height
  545.     Graphics.height - @y
  546.   end
  547.  
  548.   #--------------------------------------------------------------------------
  549.   # * Change Active Status
  550.   #--------------------------------------------------------------------------
  551.   def win_active(status)
  552.     @active = status
  553.   end
  554.  
  555.   #--------------------------------------------------------------------------
  556.   # * Checks Active Status
  557.   #--------------------------------------------------------------------------
  558.   def win_active?
  559.     return @active
  560.   end
  561.  
  562.   #--------------------------------------------------------------------------
  563.   # * Change Catagory
  564.   #--------------------------------------------------------------------------
  565.   def change_catagory(index)
  566.     @catagory = index
  567.     refresh
  568.   end
  569.  
  570.   #--------------------------------------------------------------------------
  571.   # * Returns Catagory
  572.   #--------------------------------------------------------------------------
  573.   def catagory
  574.     return @catagory
  575.   end
  576.  
  577.   #--------------------------------------------------------------------------
  578.   # * Make Command List
  579.   #--------------------------------------------------------------------------
  580.   def make_command_list
  581.     if Show_Party_Unlocked == true
  582.       case @catagory
  583.       when 0
  584.         $game_party.party_classes.each_index { |i|
  585.           p $game_party.party_classes[i]
  586.           add_command($data_classes[$game_party.party_classes[i]].name, $data_classes[$game_party.party_classes[i]].name.to_sym, class_useable?($game_party.party_classes[i]))
  587.         }
  588.       when 1
  589.         @actor.available_classes.each_index { |i|
  590.           add_command($data_classes[@actor.available_classes[i]].name, $data_classes[@actor.available_classes[i]].name.to_sym, afford?(@actor.available_classes[i]))
  591.         }
  592.       end
  593.     else
  594.       case @catagory
  595.       when 0
  596.         @actor.current_classes.each_index { |i|
  597.           add_command($data_classes[@actor.current_classes[i]].name, $data_classes[@actor.current_classes[i]].name.to_sym)
  598.         }
  599.       when 1
  600.         @actor.available_classes.each_index { |i|
  601.           add_command($data_classes[@actor.available_classes[i]].name, $data_classes[@actor.available_classes[i]].name.to_sym, afford?(@actor.available_classes[i]))
  602.         }
  603.       end
  604.     end
  605.   end
  606.  
  607.   #--------------------------------------------------------------------------
  608.   # * Checks If You Can Afford Class
  609.   #--------------------------------------------------------------------------
  610.   def afford?(class_id)
  611.     check = false
  612.     check = true if @actor.current_jp >= @actor.class_cost(class_id)
  613.     return check
  614.   end
  615.  
  616.   #--------------------------------------------------------------------------
  617.   # * Checks If You Can Use That Class
  618.   #--------------------------------------------------------------------------
  619.   def class_useable?(class_id)
  620.     @actor.current_classes.include?(class_id)
  621.   end
  622.  
  623. end #<--- End Class============================================================
  624.  
  625.  
  626. #==============================================================================
  627. # ** Window_Command
  628. #------------------------------------------------------------------------------
  629. #  This window deals with general command choices.
  630. #==============================================================================
  631.  
  632. class Window_Select_Classes < Window_Command
  633.  
  634.   #--------------------------------------------------------------------------
  635.   # * Get Window Height
  636.   #--------------------------------------------------------------------------
  637.   def window_width
  638.     return 160
  639.   end
  640.  
  641.   #--------------------------------------------------------------------------
  642.   # * Get Window Height
  643.   #--------------------------------------------------------------------------
  644.   def window_height
  645.     return 60
  646.   end
  647.  
  648.   #--------------------------------------------------------------------------
  649.   # * Get Col Max
  650.   #--------------------------------------------------------------------------
  651.   def col_max
  652.     item_max
  653.   end
  654.  
  655.   #--------------------------------------------------------------------------
  656.   # * Get Item Width
  657.   #--------------------------------------------------------------------------
  658.   def item_width
  659.     return 35
  660.   end
  661.  
  662.   #--------------------------------------------------------------------------
  663.   # * Get Item Height
  664.   #--------------------------------------------------------------------------
  665.   def item_height
  666.     return 35
  667.   end
  668.  
  669.   #--------------------------------------------------------------------------
  670.   # * Get Spacing for Items Arranged Side by Side
  671.   #--------------------------------------------------------------------------
  672.   def spacing
  673.     return 25
  674.   end
  675.    
  676.   #--------------------------------------------------------------------------
  677.   # * Get Rectangle for Drawing Items
  678.   #--------------------------------------------------------------------------
  679.   def item_rect(index)
  680.     rect = Rect.new
  681.     rect.width = item_width
  682.     rect.height = item_height
  683.     rect.x = index % col_max * (item_width + spacing) + 20
  684.     rect.y = index / col_max * item_height
  685.     rect
  686.   end
  687.  
  688.   #--------------------------------------------------------------------------
  689.   # * Make Command List
  690.   #--------------------------------------------------------------------------
  691.   def make_command_list
  692.     add_command("Current", :current, current?)
  693.     add_command("Available", :available, available?)
  694.   end
  695.  
  696.   #--------------------------------------------------------------------------
  697.   # * Checks Current Class Size
  698.   #--------------------------------------------------------------------------
  699.   def current?
  700.     actor = $game_party.menu_actor
  701.     return actor.current_classes.size > 0
  702.   end
  703.  
  704.   #--------------------------------------------------------------------------
  705.   # * Checks Available Class Size
  706.   #--------------------------------------------------------------------------
  707.   def available?
  708.     actor = $game_party.menu_actor
  709.     return actor.available_classes.size > 0
  710.   end
  711.  
  712.   #--------------------------------------------------------------------------
  713.   # * Draw Item
  714.   #--------------------------------------------------------------------------
  715.   def draw_item(index)
  716.     draw_icon(230, 25, 5, current?)
  717.     draw_icon(14, 86, 5, available?)
  718.   end
  719.  
  720. end #<--- End Class============================================================
  721.  
  722.  
  723. #==============================================================================
  724. # ** Window_Command
  725. #------------------------------------------------------------------------------
  726. #  This window deals with general command choices.
  727. #==============================================================================
  728.  
  729. class Window_Confirm_Classes < Window_Command
  730.  
  731.   #--------------------------------------------------------------------------
  732.   # * Initialize Processing
  733.   #--------------------------------------------------------------------------
  734.   def initialize(x, y)
  735.     super(x, y)
  736.     @actor = $game_party.menu_actor
  737.     refresh
  738.   end
  739.  
  740.   #--------------------------------------------------------------------------
  741.   # * Refresh Processing
  742.   #--------------------------------------------------------------------------
  743.   def refresh
  744.     super
  745.     text = "Are You Sure"
  746.     draw_sizeable_text(-10, -20, window_width, window_height, text, 1, 20)
  747.   end
  748.  
  749.   #--------------------------------------------------------------------------
  750.   # * Draw Sizeable Text
  751.   #--------------------------------------------------------------------------
  752.   def draw_sizeable_text(x, y, w, h, text, alignment, size)
  753.     reset_font_settings
  754.     contents.font.size = size
  755.     contents.draw_text(x, y, w, h, text, alignment)
  756.     reset_font_settings
  757.   end
  758.  
  759.   #--------------------------------------------------------------------------
  760.   # * Get Window Width
  761.   #--------------------------------------------------------------------------
  762.   def window_width
  763.     return 200
  764.   end
  765.  
  766.   #--------------------------------------------------------------------------
  767.   # * Get Window Height
  768.   #--------------------------------------------------------------------------
  769.   def window_height
  770.     return 125
  771.   end
  772.  
  773.   #--------------------------------------------------------------------------
  774.   # * Get Col Max
  775.   #--------------------------------------------------------------------------
  776.   def col_max
  777.     item_max
  778.   end
  779.  
  780.   #--------------------------------------------------------------------------
  781.   # * Get Visable Number Of Lines
  782.   #--------------------------------------------------------------------------
  783.   def visable_lines
  784.     return 4
  785.   end
  786.  
  787.   #--------------------------------------------------------------------------
  788.   # * Get Rectangle for Drawing Items
  789.   #--------------------------------------------------------------------------
  790.   def item_rect(index)
  791.     rect = Rect.new
  792.     rect.width = item_width
  793.     rect.height = item_height
  794.     rect.x = index % col_max * (item_width + spacing)
  795.     rect.y = index / col_max * item_height + 70
  796.     rect
  797.   end
  798.  
  799.   #--------------------------------------------------------------------------
  800.   # * Make Command Lisl
  801.   #--------------------------------------------------------------------------
  802.   def make_command_list
  803.     add_command("Confirm", :confirm_ok)
  804.     add_command("Cancel", :confirm_cancel)
  805.   end
  806.  
  807. end #<--- End Class============================================================
  808.  
  809.  
  810. #==============================================================================
  811. # ** Scene_Base
  812. #------------------------------------------------------------------------------
  813. #  This is a super class of all scenes within the game.
  814. #==============================================================================
  815.  
  816. class Scene_Promotion < Scene_Base
  817.  
  818.   #--------------------------------------------------------------------------
  819.   # * Initialize Processing
  820.   #--------------------------------------------------------------------------
  821.   def initialize
  822.     @actor = $game_party.menu_actor
  823.     create_windows
  824.   end
  825.  
  826.   #--------------------------------------------------------------------------
  827.   # * Create Windows
  828.   #--------------------------------------------------------------------------
  829.   def create_windows
  830.     draw_info_window
  831.     draw_cat_window
  832.     draw_command_window
  833.     draw_status_window
  834.     draw_confirm_window
  835.   end
  836.  
  837.   #--------------------------------------------------------------------------
  838.   # * Draw Info Window
  839.   #--------------------------------------------------------------------------
  840.   def draw_info_window
  841.     @iw = Window_Promotion_Info.new(0, 0, Graphics.width, 90)
  842.   end
  843.  
  844.   #--------------------------------------------------------------------------
  845.   # * Draw Confirm Window
  846.   #--------------------------------------------------------------------------
  847.   def draw_confirm_window
  848.     @conw = Window_Confirm_Classes.new(175, 155)
  849.     @conw.set_handler(:confirm_ok, method(:command_confirm))
  850.     @conw.set_handler(:confirm_cancel, method(:command_cancel_confirm))
  851.     @conw.openness = 0
  852.     @conw.z = 255
  853.     @conw.deactivate
  854.   end
  855.  
  856.   #--------------------------------------------------------------------------
  857.   # * Draw Select Catagory Window
  858.   #--------------------------------------------------------------------------
  859.   def draw_cat_window
  860.     @cw = Window_Select_Classes.new(0, @iw.height)
  861.     @cw.set_handler(:current, method(:command_current))
  862.     @cw.set_handler(:available, method(:command_available))
  863.     if @actor.current_classes.size > 0
  864.       @cw.select(0)
  865.     else
  866.       @cw.select(1)
  867.     end
  868.       @cw.refresh
  869.   end
  870.  
  871.   #--------------------------------------------------------------------------
  872.   # * Draw Command Window
  873.   #--------------------------------------------------------------------------
  874.   def draw_command_window
  875.     @ccw = Window_Current_Classes.new(0, @cw.height + @iw.height)
  876.     @actor.current_classes.each_index { |i|
  877.       @ccw.set_handler($data_classes[@actor.current_classes[i]].name.to_sym, method(:class_ok))
  878.     }
  879.     @actor.available_classes.each_index { |i|
  880.       @ccw.set_handler($data_classes[@actor.available_classes[i]].name.to_sym, method(:class_ok))
  881.     }
  882.     @ccw.select(0)
  883.     @ccw.deactivate
  884.   end
  885.  
  886.   #--------------------------------------------------------------------------
  887.   # * Draw Status Window
  888.   #--------------------------------------------------------------------------
  889.   def draw_status_window
  890.     @sw = Window_Promotion_Status.new(@ccw.width, @iw.height, Graphics.width - @ccw.width, Graphics.height - @iw.height)
  891.   end
  892.  
  893.   #--------------------------------------------------------------------------
  894.   # * Command Confirm
  895.   #--------------------------------------------------------------------------
  896.   def command_confirm
  897.     confirm_buy_class(@ccw.index) if @ccw.catagory == 1
  898.     confirm_change_class(@ccw.index) unless @ccw.catagory == 1
  899.     @conw.deactivate
  900.     @conw.close
  901.     $game_player.refresh
  902.     @iw.refresh
  903.     return_scene
  904.   end
  905.  
  906.   #--------------------------------------------------------------------------
  907.   # * Confirm Buy Class
  908.   #--------------------------------------------------------------------------
  909.   def confirm_buy_class(index)
  910.     classes = @actor.available_classes
  911.     cost = @actor.class_cost(classes[index])
  912.     sprite = @actor.class_sprite(classes[index])
  913.     face = @actor.class_face(classes[index])
  914.     if @actor.change_image?
  915.       @actor.change_graphic(sprite[0], sprite[1].to_i)
  916.       @actor.change_face(face[0], face[1].to_i) if face && face != []
  917.     end
  918.     @actor.remove_jp(cost) if classes.include?(classes[index])
  919.     @actor.change_class(classes[index])
  920.   end
  921.  
  922.   #--------------------------------------------------------------------------
  923.   # * Confirm Change Class
  924.   #--------------------------------------------------------------------------
  925.   def confirm_change_class(index)
  926.     classes = @actor.current_classes
  927.     class_id = classes[index]
  928.     cost = @actor.class_cost(class_id)
  929.     sprite = @actor.class_sprite(class_id)
  930.     face = @actor.class_face(classes[index])
  931.     if @actor.change_image?
  932.       @actor.change_face(face[0], face[1].to_i) if face && face != []
  933.       @actor.change_graphic(sprite[0], sprite[1].to_i)
  934.     end
  935.     @actor.change_class(class_id)
  936.   end
  937.  
  938.   #--------------------------------------------------------------------------
  939.   # * Command Cancel Confirm
  940.   #--------------------------------------------------------------------------
  941.   def command_cancel_confirm
  942.     @conw.deactivate
  943.     @conw.close
  944.     @ccw.win_active(true)
  945.     @ccw.activate
  946.   end
  947.  
  948.   #--------------------------------------------------------------------------
  949.   # * Command Return Menu
  950.   #--------------------------------------------------------------------------
  951.   def return_menu
  952.     if @actor.current_classes.size > 0
  953.       @ccw.change_catagory(0)
  954.       @ccw.win_active(false)
  955.       @ccw.select(0)
  956.       @ccw.deactivate
  957.       @cw.select(0)
  958.       @sw.refresh(@ccw.index, 0)
  959.       @ccw.refresh
  960.       @cw.refresh
  961.       @cw.activate
  962.     else
  963.       @ccw.change_catagory(1)
  964.       @ccw.win_active(false)
  965.       @ccw.select(0)
  966.       @ccw.deactivate
  967.       @cw.select(1)
  968.       @sw.refresh(@ccw.index, 1)
  969.       @ccw.refresh
  970.       @cw.refresh
  971.       @cw.activate
  972.     end
  973.   end
  974.  
  975.   #--------------------------------------------------------------------------
  976.   # * Command Catagory Current
  977.   #--------------------------------------------------------------------------
  978.   def command_current
  979.     @cw.deactivate
  980.     @ccw.win_active(true)
  981.     @ccw.select(0)
  982.     @ccw.activate
  983.     @sw.refresh(@ccw.index, @ccw.catagory)
  984.   end
  985.  
  986.   #--------------------------------------------------------------------------
  987.   # * Command Catagory Available
  988.   #--------------------------------------------------------------------------
  989.   def command_available
  990.     @cw.deactivate
  991.     @ccw.win_active(true)
  992.     @ccw.select(0)
  993.     @ccw.activate
  994.     @sw.refresh(@ccw.index, @ccw.catagory)
  995.   end
  996.  
  997.   #--------------------------------------------------------------------------
  998.   # * Command Class Ok
  999.   #--------------------------------------------------------------------------
  1000.   def class_ok
  1001.     @ccw.deactivate
  1002.     @conw.select(1)
  1003.     @conw.open
  1004.     @conw.activate
  1005.   end
  1006.  
  1007.   #--------------------------------------------------------------------------
  1008.   # * Update Proccessing
  1009.   #--------------------------------------------------------------------------
  1010.   def update
  1011.     super
  1012.     update_trigs
  1013.   end
  1014.  
  1015.   #--------------------------------------------------------------------------
  1016.   # * Update Trigger Proccessing
  1017.   #--------------------------------------------------------------------------
  1018.   def update_trigs
  1019.     case
  1020.     when Input.trigger?(:UP)
  1021.       @sw.refresh(@ccw.index, @ccw.catagory)
  1022.       @ccw.refresh
  1023.     when Input.trigger?(:DOWN)
  1024.       @sw.refresh(@ccw.index, @ccw.catagory)
  1025.       @ccw.refresh
  1026.     when Input.trigger?(:LEFT)
  1027.       if @ccw.win_active? == false
  1028.         @ccw.catagory == 0 ? @ccw.change_catagory(1) : @ccw.change_catagory(0)
  1029.       end
  1030.       @cw.refresh
  1031.       @sw.refresh(@ccw.index, @ccw.catagory)
  1032.       @ccw.refresh
  1033.     when Input.trigger?(:RIGHT)
  1034.       if @ccw.win_active? == false
  1035.         @ccw.catagory == 0 ? @ccw.change_catagory(1) : @ccw.change_catagory(0)
  1036.       end
  1037.       @cw.refresh
  1038.       @sw.refresh(@ccw.index, @ccw.catagory)
  1039.       @ccw.refresh
  1040.     end
  1041.     return_scene if Input.trigger?(:B) && @ccw.win_active? == false
  1042.     return_menu if Input.trigger?(:B) && @ccw.win_active?
  1043.   end
  1044.  
  1045. end #<--- End Class============================================================
  1046.  
  1047.  
  1048. #==============================================================================
  1049. # ** BattleManager
  1050. #------------------------------------------------------------------------------
  1051. #  This module manages battle progress.
  1052. #==============================================================================
  1053.  
  1054. module BattleManager
  1055.  
  1056.   #--------------------------------------------------------------------------
  1057.   # * Includes Module's Variables With Class
  1058.   #--------------------------------------------------------------------------
  1059.  
  1060.   include V_PS2::Specs
  1061.  
  1062.   #--------------------------------------------------------------------------
  1063.   # * Victory Processing
  1064.   #--------------------------------------------------------------------------
  1065.   def self.process_victory
  1066.     play_battle_end_me
  1067.     replay_bgm_and_bgs
  1068.     $game_message.add(sprintf(Vocab::Victory, $game_party.name))
  1069.     display_exp
  1070.     gain_jp
  1071.     gain_gold
  1072.     gain_drop_items
  1073.     gain_exp
  1074.     SceneManager.return
  1075.     battle_end(0)
  1076.     return true
  1077.   end
  1078.  
  1079.   #--------------------------------------------------------------------------
  1080.   # * JP Acquisition and Display
  1081.   #--------------------------------------------------------------------------
  1082.   def self.gain_jp
  1083.     if $game_troop.jp_total > 0
  1084.       text = sprintf(("%s " + JP_Vocab + " Earned"), $game_troop.jp_total)
  1085.       $game_message.add('\.' + text)
  1086.       $game_party.gain_jp($game_troop.jp_total)
  1087.     end
  1088.     wait_for_message
  1089.   end
  1090.  
  1091. end #<--- End Module===========================================================
  1092.  
  1093.  
  1094. #==============================================================================
  1095. # ** Game_Actor
  1096. #------------------------------------------------------------------------------
  1097. #  This class handles actors. It is used within the Game_Actors class
  1098. # ($game_actors) and is also referenced from the Game_Party class ($game_party).
  1099. #==============================================================================
  1100.  
  1101. class Game_Actor < Game_Battler
  1102.  
  1103.   #--------------------------------------------------------------------------
  1104.   # * Includes Module's Variables With Class
  1105.   #--------------------------------------------------------------------------
  1106.  
  1107.   include V_PS2::Specs
  1108.  
  1109.   #--------------------------------------------------------------------------
  1110.   # * Public Instance Variables
  1111.   #--------------------------------------------------------------------------
  1112.   attr_accessor :jp                                              # Job Points
  1113.  
  1114.   #--------------------------------------------------------------------------
  1115.   # * Aliasing Method: Setup
  1116.   #--------------------------------------------------------------------------
  1117.   alias :gas510 :setup
  1118.  
  1119.   #--------------------------------------------------------------------------
  1120.   # * Setup
  1121.   #--------------------------------------------------------------------------
  1122.   def setup(actor_id)
  1123.     @jp = 0
  1124.     gas510(actor_id)
  1125.   end
  1126.  
  1127.   #--------------------------------------------------------------------------
  1128.   # * Returns Job Points
  1129.   #--------------------------------------------------------------------------
  1130.   def current_jp
  1131.     return @jp
  1132.   end
  1133.  
  1134.   #--------------------------------------------------------------------------
  1135.   # * Add Job Points
  1136.   #--------------------------------------------------------------------------
  1137.   def add_jp(amount)
  1138.     (@jp + amount) > Max_JP ? @jp = Max_JP : @jp += amount
  1139.   end
  1140.  
  1141.   #--------------------------------------------------------------------------
  1142.   # * Remove Job Points
  1143.   #--------------------------------------------------------------------------
  1144.   def remove_jp(amount)
  1145.     (@jp - amount) < 0 ? @jp = 0 : @jp -= amount
  1146.   end
  1147.  
  1148.   #--------------------------------------------------------------------------
  1149.   # * Change Graphics
  1150.   #--------------------------------------------------------------------------
  1151.   def change_graphic(character_name, character_index)
  1152.     @character_name = character_name
  1153.     @character_index = character_index
  1154.   end
  1155.  
  1156.   #--------------------------------------------------------------------------
  1157.   # * Change Graphics
  1158.   #--------------------------------------------------------------------------
  1159.   def change_face(face_name, face_index)
  1160.     @face_name = face_name
  1161.     @face_index = face_index
  1162.   end
  1163.  
  1164.   #--------------------------------------------------------------------------
  1165.   # * Returns all of the actor's class ids
  1166.   #--------------------------------------------------------------------------
  1167.   def current_classes
  1168.     current_classes = []
  1169.     @exp.each_key { |i| current_classes.push i unless i == @class_id}
  1170.     return current_classes
  1171.   end
  1172.  
  1173.   #--------------------------------------------------------------------------
  1174.   # * Returns all of the actor's class ids
  1175.   #--------------------------------------------------------------------------
  1176.   def requirement_met?(class_id, level)
  1177.     met = false
  1178.     if @exp.has_key?(class_id)
  1179.       met = true if class_level(class_id) >= level
  1180.     end
  1181.     return met
  1182.   end
  1183.  
  1184.   #--------------------------------------------------------------------------
  1185.   # * Returns all of the actor's available class ids
  1186.   #--------------------------------------------------------------------------
  1187.   def available_classes
  1188.     available_classes = []
  1189.     $data_classes.size.times { |i|
  1190.       if i > 0
  1191.         r = class_reqs(i)
  1192.         r.size.times  { |req|
  1193.           check = true
  1194.           if requirement_met?(r[req][0], r[req][1]) == false
  1195.             check = false
  1196.           end
  1197.           if check == true
  1198.             available_classes.push i if @exp.has_key?(i) == false
  1199.           end
  1200.         }
  1201.       end
  1202.     }
  1203.     return available_classes
  1204.   end
  1205.  
  1206.   #--------------------------------------------------------------------------
  1207.   # * Returns Class Level
  1208.   #--------------------------------------------------------------------------
  1209.   def class_level(class_id)
  1210.     lv = 1
  1211.     if @exp.has_key?(class_id)
  1212.       xp = @exp[class_id]
  1213.       lv += 1 while !max_level? && xp >= $data_classes[class_id].exp_for_level(lv + 1)
  1214.       lv -= 1 while xp < $data_classes[class_id].exp_for_level(lv)
  1215.     end
  1216.     return lv
  1217.   end
  1218.  
  1219.   #--------------------------------------------------------------------------
  1220.   # * Returns If The Actor Graphics Are Changeable Or Not
  1221.   #--------------------------------------------------------------------------
  1222.   def change_image?
  1223.     note = /<Main>/
  1224.     check = true
  1225.     changeable = $data_actors[@actor_id].note.scan(note)
  1226.     check = false if changeable[0] == "<Main>"
  1227.     return check
  1228.   end
  1229.  
  1230.   #--------------------------------------------------------------------------
  1231.   # * Returns Class JP Cost
  1232.   #--------------------------------------------------------------------------
  1233.   def class_cost(class_id)
  1234.     note = /<Cost:\s(\d*)\s*>/i
  1235.     cost = $data_classes[class_id].note.scan(note)
  1236.     return cost[0][0].to_i
  1237.   end
  1238.  
  1239.   #--------------------------------------------------------------------------
  1240.   # * Returns Class Sprite
  1241.   #--------------------------------------------------------------------------
  1242.   def class_sprite(class_id)
  1243.     note = /<Sprite:\s(\w*)\S*\s*(\d*)>/i
  1244.     sprite = $data_classes[class_id].note.scan(note)
  1245.     return sprite[0]
  1246.   end
  1247.  
  1248.   #--------------------------------------------------------------------------
  1249.   # * Returns Class Sprite
  1250.   #--------------------------------------------------------------------------
  1251.   def class_face(class_id)
  1252.     note = /<Face:\s(\w*)\S*\s*(\d*)>/i
  1253.     face = $data_classes[class_id].note.scan(note)
  1254.     return face[0]
  1255.   end
  1256.  
  1257.   #--------------------------------------------------------------------------
  1258.   # * Returns Class Requirements
  1259.   #--------------------------------------------------------------------------
  1260.   def class_reqs(class_id)
  1261.     requirements =[]
  1262.     note = /<Class Requirements:\s*(\d*)\S*\s*(\d*)\s*>/im
  1263.     class_requirements = $data_classes[class_id].note.scan(note)
  1264.     class_requirements.each_index { |i|
  1265.       requirements.push [class_requirements[i][0].to_i, class_requirements[i][1].to_i]
  1266.     }
  1267.     return requirements
  1268.   end
  1269.  
  1270. end #<--- End Class============================================================
  1271.  
  1272.  
  1273. #==============================================================================
  1274. # ** Game_Party
  1275. #------------------------------------------------------------------------------
  1276. #  This class handles parties. Information such as gold and items is included.
  1277. # Instances of this class are referenced by $game_party.
  1278. #==============================================================================
  1279.  
  1280. class Game_Party < Game_Unit
  1281.  
  1282.   #--------------------------------------------------------------------------
  1283.   # * Returns all of the actor's class ids
  1284.   #--------------------------------------------------------------------------
  1285.   def party_classes
  1286.     party_classes = []
  1287.     members.size.times { |i|
  1288.       members[i].current_classes.size.times { |c|
  1289.         if party_classes.include?(members[i].current_classes[c]) == false
  1290.           party_classes.push members[i].current_classes[c]
  1291.         end
  1292.       }
  1293.     }
  1294.     return party_classes
  1295.   end
  1296.  
  1297.   #--------------------------------------------------------------------------
  1298.   # * Gain JP
  1299.   #--------------------------------------------------------------------------
  1300.   def gain_jp(amount)
  1301.     members.size.times { |i|
  1302.       members[i].add_jp(amount)
  1303.     }
  1304.   end
  1305.  
  1306.   #--------------------------------------------------------------------------
  1307.   # * Lose JP
  1308.   #--------------------------------------------------------------------------
  1309.   def lose_jp(amount)
  1310.     members.size.times { |i|
  1311.       members[i].remove_jp(amount)
  1312.     }
  1313.   end
  1314.  
  1315. end #<--- End Class============================================================
  1316.  
  1317. #==============================================================================
  1318. # ** Game_Enemy
  1319. #------------------------------------------------------------------------------
  1320. #  This class handles enemies. It used within the Game_Troop class
  1321. # ($game_troop).
  1322. #==============================================================================
  1323.  
  1324. class Game_Enemy < Game_Battler
  1325.  
  1326.   #--------------------------------------------------------------------------
  1327.   # * Returns Enemy JP
  1328.   #--------------------------------------------------------------------------
  1329.   def jp
  1330.     note = /<JP:\s(\d*)\s*>/i
  1331.     jp = $data_enemies[@enemy_id].note.scan(note)
  1332.     return jp[0][0].to_i
  1333.   end
  1334.  
  1335. end #<--- End Class============================================================
  1336.  
  1337.  
  1338. #==============================================================================
  1339. # ** Game_Troop
  1340. #------------------------------------------------------------------------------
  1341. #  This class handles enemy groups and battle-related data. Also performs
  1342. # battle events. The instance of this class is referenced by $game_troop.
  1343. #==============================================================================
  1344.  
  1345. class Game_Troop < Game_Unit
  1346.  
  1347.   #--------------------------------------------------------------------------
  1348.   # * Calculate Total Experience
  1349.   #--------------------------------------------------------------------------
  1350.   def jp_total
  1351.     dead_members.inject(0) {|r, enemy| r += enemy.jp }
  1352.   end
  1353.  
  1354. end #<--- End Class============================================================
  1355.  
  1356.  
  1357. #==============================================================================
  1358. # ** Window_Base
  1359. #------------------------------------------------------------------------------
  1360. #  This is a super class of all windows within the game.
  1361. #==============================================================================
  1362.  
  1363. class Window_Base < Window
  1364.  
  1365.   #--------------------------------------------------------------------------
  1366.   # * Includes Module's Variables With Class
  1367.   #--------------------------------------------------------------------------
  1368.  
  1369.   include V_PS2::Specs
  1370.  
  1371.   #--------------------------------------------------------------------------
  1372.   # * Checks for Displaying Numbers For Level
  1373.   #--------------------------------------------------------------------------
  1374.  
  1375.   if Use_Numbers == false
  1376.    
  1377.     #--------------------------------------------------------------------------
  1378.     # * Draw Level
  1379.     #--------------------------------------------------------------------------
  1380.     def draw_actor_level(actor, x, y)
  1381.       level = actor.class_level(actor.class_id)
  1382.       draw_sizeable_text(x, y - 5, 32, line_height, Vocab::level + ":", 0, 16)
  1383.       level.times { |i|
  1384.         draw_icon(Level_Icon, (x + (i * 20)), y + 10)
  1385.       }
  1386.     end
  1387.  
  1388.   end
  1389.  
  1390.   #--------------------------------------------------------------------------
  1391.   # * Draw Sizeable Text
  1392.   #--------------------------------------------------------------------------
  1393.   def draw_sizeable_text(x, y, w, h, text, alignment, size)
  1394.     reset_font_settings
  1395.     contents.font.size = size
  1396.     contents.draw_text(x, y, w, h, text, alignment)
  1397.     reset_font_settings
  1398.   end
  1399.  
  1400. end #<--- End Class============================================================
  1401.  
  1402.  
  1403. #==============================================================================
  1404. # ** Window_MenuCommand
  1405. #------------------------------------------------------------------------------
  1406. #  This command window appears on the menu screen.
  1407. #==============================================================================
  1408.  
  1409. class Window_MenuCommand < Window_Command
  1410.  
  1411.   #--------------------------------------------------------------------------
  1412.   # * Aliasing Method: Add Original Commands
  1413.   #--------------------------------------------------------------------------
  1414.   alias :aoc510 :add_original_commands
  1415.  
  1416.   #--------------------------------------------------------------------------
  1417.   # * For Adding Original Commands
  1418.   #--------------------------------------------------------------------------
  1419.   def add_original_commands
  1420.     aoc510()
  1421.     add_command("Promotions", :promotion, available?)
  1422.   end
  1423.  
  1424.   #--------------------------------------------------------------------------
  1425.   # * Checks Current and Available Class Size
  1426.   #--------------------------------------------------------------------------
  1427.   def available?
  1428.     check = false
  1429.     $game_party.members.size.times { |i|
  1430.       check = true if $game_party.members[i].current_classes.size > 0 || $game_party.members[0].available_classes.size > 0
  1431.       return check if check == true
  1432.     }
  1433.     return check
  1434.   end
  1435.  
  1436. end #<--- End Class============================================================
  1437.  
  1438.  
  1439. #==============================================================================
  1440. # ** Window_MenuStatus
  1441. #------------------------------------------------------------------------------
  1442. #  This window displays party member status on the menu screen.
  1443. #==============================================================================
  1444.  
  1445. class Window_MenuStatus < Window_Selectable
  1446.  
  1447.   #--------------------------------------------------------------------------
  1448.   # * Draw Item
  1449.   #--------------------------------------------------------------------------
  1450.   def draw_item(index)
  1451.     actor = $game_party.members[index]
  1452.     enabled = $game_party.battle_members.include?(actor)
  1453.     rect = item_rect(index)
  1454.     draw_item_background(index)
  1455.     draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
  1456.     draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
  1457.     actor = $game_party.members[index]
  1458.     Use_Numbers == true ? level_y = -10 : level_y = 0
  1459.     draw_sizeable_text(rect.x - 35, (rect.y + 30) + level_y, rect.width, rect.height, "Promotable", 1, 18) if promotable?(actor)
  1460.   end
  1461.  
  1462.   #--------------------------------------------------------------------------
  1463.   # * Aliasing Method: Create Command Window
  1464.   #--------------------------------------------------------------------------
  1465.   alias :wmspo510 :process_ok
  1466.  
  1467.   #--------------------------------------------------------------------------
  1468.   # * Processing When OK Button Is Pressed
  1469.   #--------------------------------------------------------------------------
  1470.   def process_ok
  1471.     actor = $game_party.members[index]
  1472.     has_classes?(actor) ? wmspo510() : Sound.play_buzzer
  1473.   end
  1474.  
  1475.   #--------------------------------------------------------------------------
  1476.   # * Draw Sizeable Text
  1477.   #--------------------------------------------------------------------------
  1478.   def draw_sizeable_text(x, y, w, h, text, alignment, size)
  1479.     reset_font_settings
  1480.     contents.font.size = size
  1481.     contents.draw_text(x, y, w, h, text, alignment)
  1482.     reset_font_settings
  1483.   end
  1484.  
  1485.   #--------------------------------------------------------------------------
  1486.   # * Checks Available Class Size
  1487.   #--------------------------------------------------------------------------
  1488.   def promotable?(actor)
  1489.     check = false
  1490.     check = true if actor.available_classes.size > 0
  1491.     return check
  1492.   end
  1493.  
  1494.   #--------------------------------------------------------------------------
  1495.   # * Checks Current and Available Class Size
  1496.   #--------------------------------------------------------------------------
  1497.   def has_classes?(actor)
  1498.     check = false
  1499.     check = true if actor.current_classes.size > 0 || actor.available_classes.size > 0
  1500.     return check
  1501.   end
  1502.  
  1503. end #<--- End Class============================================================
  1504.  
  1505.  
  1506. #==============================================================================
  1507. # ** Scene_Menu
  1508. #------------------------------------------------------------------------------
  1509. #  This class performs the menu screen processing.
  1510. #==============================================================================
  1511.  
  1512. class Scene_Menu < Scene_MenuBase
  1513.  
  1514.   #--------------------------------------------------------------------------
  1515.   # * Aliasing Method: Create Command Window
  1516.   #--------------------------------------------------------------------------
  1517.   alias :ccw510 :create_command_window
  1518.  
  1519.   #--------------------------------------------------------------------------
  1520.   # * Create Command Window
  1521.   #--------------------------------------------------------------------------
  1522.   def create_command_window
  1523.     ccw510()
  1524.     @command_window.set_handler(:promotion,    method(:command_personal))
  1525.   end
  1526.  
  1527.   #--------------------------------------------------------------------------
  1528.   # * Aliasing Method: [OK] Personal Command
  1529.   #--------------------------------------------------------------------------
  1530.   alias :opo510 :on_personal_ok
  1531.  
  1532.   #--------------------------------------------------------------------------
  1533.   # * [OK] Personal Command
  1534.   #--------------------------------------------------------------------------
  1535.   def on_personal_ok
  1536.     $game_party.menu_actor = $game_party.members[@status_window.index]
  1537.     case @command_window.current_symbol
  1538.     when :promotion
  1539.       SceneManager.call(Scene_Promotion)
  1540.     end
  1541.     opo510()
  1542.   end
  1543.  
  1544. end #<--- End Class============================================================
Advertisement
Add Comment
Please, Sign In to add comment