Advertisement
Archeia

Yanfly Engine Ace - Ace Status Menu v1.02

Mar 30th, 2014
922
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 39.48 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Status Menu v1.02
  4. # -- Last Updated: 2011.12.26
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-StatusMenu"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.08.06 - Fix Sp Paramater TCR
  17. # 2011.12.26 - Compatibility Update: Rename Actor
  18. # 2011.12.23 - Started Script and Finished.
  19. #
  20. #==============================================================================
  21. # ▼ Introduction
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # This script changes the status screen completely to something the player can
  24. # interact with more and be able to view actor data with more clarity. The
  25. # player is able to view the general information for an actor (parameters and
  26. # experience), a parameters bar graph, the various hidden extra parameters
  27. # (named properties in the script), and a customizable biography for the actor.
  28. # Also with this script, biographies can be changed at any time using a script
  29. # call to add more of a personal touch to characters.
  30. #
  31. #==============================================================================
  32. # ▼ Instructions
  33. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  34. # To install this script, open up your script editor and copy/paste this script
  35. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  36. #
  37. # -----------------------------------------------------------------------------
  38. # Script Calls - These commands are used with script calls.
  39. # -----------------------------------------------------------------------------
  40. # $game_actors[x].description = string
  41. # Changes the biography description for actor x to that of the string. Use \n
  42. # to designate linebreaks in the string. If you wish to use text codes, write
  43. # them in the strings as \\n[2] or \\c[3] to make them work properly.
  44. #
  45. #==============================================================================
  46. # ▼ Compatibility
  47. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  48. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  49. # it will run with RPG Maker VX without adjusting.
  50. #
  51. #==============================================================================
  52.  
  53. module YEA
  54.   module STATUS
  55.    
  56.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  57.     # - Command Window Settings -
  58.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  59.     # This section adjusts the commands that appear in the command window used
  60.     # for the status screen. Rearrange the commands, add new ones, remove them
  61.     # as you see fit.
  62.     #
  63.     # -------------------------------------------------------------------------
  64.     # :command         Description
  65.     # -------------------------------------------------------------------------
  66.     # :general         Adds general page.
  67.     # :parameters      Adds parameters page.
  68.     # :properties      Adds properties page.
  69.     # :biography       Adds biography page.
  70.     #
  71.     # :rename          Requires YEA - Rename Actor
  72.     # :retitle         Requires YEA - Retitle Actor
  73.     #
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.     COMMANDS =[ # The order at which the menu items are shown.
  76.     # [    :command,    "Display"],
  77.       [    :general,    "General"],
  78.       [ :parameters, "Parameters"],
  79.       [ :properties, "Properties"],
  80.     # [    :custom1,     "Skills"],
  81.     # [    :custom2,  "Equipment"],
  82.     # [    :custom3,      "Class"],
  83.       [  :biography,  "Biography"],
  84.       [     :rename,     "Rename"],  # Requires YEA - Rename Actor
  85.       [    :retitle,    "Retitle"],  # Requires YEA - Rename Actor
  86.     ] # Do not remove this.
  87.    
  88.     #--------------------------------------------------------------------------
  89.     # - Status Custom Commands -
  90.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  91.     # For those who use scripts to that may produce unique effects for the
  92.     # status menu, use this hash to manage the custom commands for the Status
  93.     # Command Window. You can disable certain commands or prevent them from
  94.     # appearing by using switches. If you don't wish to bind them to a switch,
  95.     # set the proper switch to 0 for it to have no impact.
  96.     #--------------------------------------------------------------------------
  97.     CUSTOM_STATUS_COMMANDS ={
  98.     # :command => [EnableSwitch, ShowSwitch, Handler Method, Window Draw],
  99.       :custom1 => [           0,          0, :command_name1, :draw_custom1],
  100.       :custom2 => [           0,          0, :command_name2, :draw_custom2],
  101.       :custom3 => [           0,          0, :command_name3, :draw_custom3],
  102.     } # Do not remove this.
  103.    
  104.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  105.     # - General Window Settings -
  106.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  107.     # These settings adjust the way the general window visually appears.
  108.     # Not many changes need to be done here other than vocab changes.
  109.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  110.     PARAMETERS_VOCAB = "Parameters"         # Title used for Parameters.
  111.     EXPERIENCE_VOCAB = "Experience"         # Title used for Experience.
  112.     NEXT_TOTAL_VOCAB = "Next %s Total EXP"  # Label used for total experience.
  113.    
  114.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  115.     # - Parameters Window Settings -
  116.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  117.     # These settings adjust the way the parameters window visually appears.
  118.     # Each of the stats have a non-window colour. Adjust them as you see fit.
  119.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  120.     PARAM_COLOUR ={
  121.     # ParamID => [:stat,       Colour1,                   Colour2          ],
  122.             2 => [ :atk, Color.new(225, 100, 100), Color.new(240, 150, 150)],
  123.             3 => [ :def, Color.new(250, 150,  30), Color.new(250, 180, 100)],
  124.             4 => [ :mat, Color.new( 70, 140, 200), Color.new(135, 180, 230)],
  125.             5 => [ :mdf, Color.new(135, 130, 190), Color.new(170, 160, 220)],
  126.             6 => [ :agi, Color.new( 60, 180,  80), Color.new(120, 200, 120)],
  127.             7 => [ :luk, Color.new(255, 240, 100), Color.new(255, 250, 200)],
  128.     } # Do not remove this.
  129.    
  130.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131.     # - Properties Window Settings -
  132.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  133.     # These settings adjust the way the properties window visually appears.
  134.     # The properties have abbreviations, but leaving them as such makes things
  135.     # confusing (as it's sometimes hard to figure out what the abbreviations
  136.     # mean). Change the way the appear, whether or not they appear, and what
  137.     # order they will appear in.
  138.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  139.     PROPERTIES_FONT_SIZE = 16        # Font size used for properties.
  140.    
  141.     # These are the properties that appear in column 1.
  142.     PROPERTIES_COLUMN1 =[
  143.       [:hit, "Hit Rate"],
  144.       [:eva, "Evasion"],
  145.       [:cri, "Critical Hit"],
  146.       [:cev, "Critical Evade"],
  147.       [:mev, "Magic Evasion"],
  148.       [:mrf, "Magic Reflect"],
  149.       [:cnt, "Counter Rate"],
  150.       [:tgr, "Target Rate"],
  151.     ] # Do not remove this.
  152.    
  153.     # These are the properties that appear in column 2.
  154.     PROPERTIES_COLUMN2 =[
  155.       [:hrg, "HP Regen"],
  156.       [:mrg, "MP Regen"],
  157.       [:trg, "TP Regen"],
  158.       [:rec, "Recovery"],
  159.       [:grd, "Guard Rate"],
  160.       [:pha, "Item Boost"],
  161.       [:exr, "EXP Rate"],
  162.       [:tcr, "TP Charge"],
  163.     ] # Do not remove this.
  164.    
  165.     # These are the properties that appear in column 3.
  166.     PROPERTIES_COLUMN3 =[
  167.       [:hcr, "HP Cost Rate"],    # Requires YEA - Skill Cost Manager
  168.       [:mcr, "MP Cost Rate"],
  169.       [:tcr_y, "TP Cost Rate"],    # Requires YEA - Skill Cost Manager
  170.       [:cdr, "Cooldown Rate"],   # Requires YEA - Skill Restrictions
  171.       [:wur, "Warmup Rate"],     # Requires YEA - Skill Restrictions
  172.       [:pdr, "Physical Damage"],
  173.       [:mdr, "Magical Damage"],
  174.       [:fdr, "Floor Damage"],
  175.     ] # Do not remove this.
  176.    
  177.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  178.     # - Biography Window Settings -
  179.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  180.     # These settings adjust the way the biography appears including the title
  181.     # used at the top, the font size, and whatnot.
  182.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  183.     BIOGRAPHY_NICKNAME_TEXT = "%s the %s"   # How the nickname will appear.
  184.     BIOGRAPHY_NICKNAME_SIZE = 32            # Size of the font used.
  185.    
  186.   end # STATUS
  187. end # YEA
  188.  
  189. #==============================================================================
  190. # ▼ Editting anything past this point may potentially result in causing
  191. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  192. # halitosis so edit at your own risk.
  193. #==============================================================================
  194.  
  195. #==============================================================================
  196. # ■ Numeric
  197. #==============================================================================
  198.  
  199. class Numeric
  200.  
  201.   #--------------------------------------------------------------------------
  202.   # new method: group_digits
  203.   #--------------------------------------------------------------------------
  204.   unless $imported["YEA-CoreEngine"]
  205.   def group; return self.to_s; end
  206.   end # $imported["YEA-CoreEngine"]
  207.    
  208. end # Numeric
  209.  
  210. #==============================================================================
  211. # ■ Game_Temp
  212. #==============================================================================
  213.  
  214. class Game_Temp
  215.  
  216.   #--------------------------------------------------------------------------
  217.   # public instance variables
  218.   #--------------------------------------------------------------------------
  219.   attr_accessor :scene_status_index
  220.   attr_accessor :scene_status_oy
  221.  
  222. end # Game_Temp
  223.  
  224. #==============================================================================
  225. # ■ Game_Actor
  226. #==============================================================================
  227.  
  228. class Game_Actor < Game_Battler
  229.  
  230.   #--------------------------------------------------------------------------
  231.   # new method: description=
  232.   #--------------------------------------------------------------------------
  233.   def description=(text)
  234.     @description = text
  235.   end
  236.  
  237.   #--------------------------------------------------------------------------
  238.   # overwrite method: description
  239.   #--------------------------------------------------------------------------
  240.   def description
  241.     return @description unless @description.nil?
  242.     return actor.description
  243.   end
  244.  
  245. end # Game_Actor
  246.  
  247. #==============================================================================
  248. # ■ Window_StatusCommand
  249. #==============================================================================
  250.  
  251. class Window_StatusCommand < Window_Command
  252.  
  253.   #--------------------------------------------------------------------------
  254.   # public instance variables
  255.   #--------------------------------------------------------------------------
  256.   attr_accessor :item_window
  257.  
  258.   #--------------------------------------------------------------------------
  259.   # initialize
  260.   #--------------------------------------------------------------------------
  261.   def initialize(dx, dy)
  262.     super(dx, dy)
  263.     @actor = nil
  264.   end
  265.  
  266.   #--------------------------------------------------------------------------
  267.   # window_width
  268.   #--------------------------------------------------------------------------
  269.   def window_width; return 160; end
  270.  
  271.   #--------------------------------------------------------------------------
  272.   # actor=
  273.   #--------------------------------------------------------------------------
  274.   def actor=(actor)
  275.     return if @actor == actor
  276.     @actor = actor
  277.     refresh
  278.   end
  279.  
  280.   #--------------------------------------------------------------------------
  281.   # visible_line_number
  282.   #--------------------------------------------------------------------------
  283.   def visible_line_number; return 4; end
  284.  
  285.   #--------------------------------------------------------------------------
  286.   # ok_enabled?
  287.   #--------------------------------------------------------------------------
  288.   def ok_enabled?
  289.     return handle?(current_symbol)
  290.   end
  291.  
  292.   #--------------------------------------------------------------------------
  293.   # make_command_list
  294.   #--------------------------------------------------------------------------
  295.   def make_command_list
  296.     return unless @actor
  297.     for command in YEA::STATUS::COMMANDS
  298.       case command[0]
  299.       #--- Default ---
  300.       when :general, :parameters, :properties, :biography
  301.         add_command(command[1], command[0])
  302.       #--- Yanfly Engine Ace ---
  303.       when :rename
  304.         next unless $imported["YEA-RenameActor"]
  305.         add_command(command[1], command[0], @actor.rename_allow?)
  306.       when :retitle
  307.         next unless $imported["YEA-RenameActor"]
  308.         add_command(command[1], command[0], @actor.retitle_allow?)
  309.       #--- Custom Commands ---
  310.       else
  311.         process_custom_command(command)
  312.       end
  313.     end
  314.     if !$game_temp.scene_status_index.nil?
  315.       select($game_temp.scene_status_index)
  316.       self.oy = $game_temp.scene_status_oy
  317.     end
  318.     $game_temp.scene_status_index = nil
  319.     $game_temp.scene_status_oy = nil
  320.   end
  321.  
  322.   #--------------------------------------------------------------------------
  323.   # process_ok
  324.   #--------------------------------------------------------------------------
  325.   def process_ok
  326.     $game_temp.scene_status_index = index
  327.     $game_temp.scene_status_oy = self.oy
  328.     super
  329.   end
  330.  
  331.   #--------------------------------------------------------------------------
  332.   # process_custom_command
  333.   #--------------------------------------------------------------------------
  334.   def process_custom_command(command)
  335.     return unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(command[0])
  336.     show = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][1]
  337.     continue = show <= 0 ? true : $game_switches[show]
  338.     return unless continue
  339.     text = command[1]
  340.     switch = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][0]
  341.     enabled = switch <= 0 ? true : $game_switches[switch]
  342.     add_command(text, command[0], enabled)
  343.   end
  344.  
  345.   #--------------------------------------------------------------------------
  346.   # update
  347.   #--------------------------------------------------------------------------
  348.   def update
  349.     super
  350.     update_item_window
  351.   end
  352.  
  353.   #--------------------------------------------------------------------------
  354.   # update_item_window
  355.   #--------------------------------------------------------------------------
  356.   def update_item_window
  357.     return if @item_window.nil?
  358.     return if @current_index == current_symbol
  359.     @current_index = current_symbol
  360.     @item_window.refresh
  361.   end
  362.  
  363.   #--------------------------------------------------------------------------
  364.   # item_window=
  365.   #--------------------------------------------------------------------------
  366.   def item_window=(window)
  367.     @item_window = window
  368.     update
  369.   end
  370.  
  371.   #--------------------------------------------------------------------------
  372.   # update_help
  373.   #--------------------------------------------------------------------------
  374.   def update_help
  375.     return if @actor.nil?
  376.     @help_window.set_text(@actor.actor.description)
  377.   end
  378.  
  379. end # Window_StatusCommand
  380.  
  381. #==============================================================================
  382. # ■ Window_StatusActor
  383. #==============================================================================
  384.  
  385. class Window_StatusActor < Window_Base
  386.  
  387.   #--------------------------------------------------------------------------
  388.   # initialize
  389.   #--------------------------------------------------------------------------
  390.   def initialize(dx, dy)
  391.     super(dx, dy, window_width, fitting_height(4))
  392.     @actor = nil
  393.   end
  394.  
  395.   #--------------------------------------------------------------------------
  396.   # window_width
  397.   #--------------------------------------------------------------------------
  398.   def window_width; return Graphics.width - 160; end
  399.  
  400.   #--------------------------------------------------------------------------
  401.   # actor=
  402.   #--------------------------------------------------------------------------
  403.   def actor=(actor)
  404.     return if @actor == actor
  405.     @actor = actor
  406.     refresh
  407.   end
  408.  
  409.   #--------------------------------------------------------------------------
  410.   # refresh
  411.   #--------------------------------------------------------------------------
  412.   def refresh
  413.     contents.clear
  414.     return unless @actor
  415.     draw_actor_face(@actor, 0, 0)
  416.     draw_actor_simple_status(@actor, 108, line_height / 2)
  417.   end
  418.  
  419. end # Window_StatusActor
  420.  
  421. #==============================================================================
  422. # ■ Window_StatusItem
  423. #==============================================================================
  424.  
  425. class Window_StatusItem < Window_Base
  426.  
  427.   #--------------------------------------------------------------------------
  428.   # initialize
  429.   #--------------------------------------------------------------------------
  430.   def initialize(dx, dy, command_window)
  431.     super(dx, dy, Graphics.width, Graphics.height - dy)
  432.     @command_window = command_window
  433.     @actor = nil
  434.     refresh
  435.   end
  436.  
  437.   #--------------------------------------------------------------------------
  438.   # actor=
  439.   #--------------------------------------------------------------------------
  440.   def actor=(actor)
  441.     return if @actor == actor
  442.     @actor = actor
  443.     refresh
  444.   end
  445.  
  446.   #--------------------------------------------------------------------------
  447.   # refresh
  448.   #--------------------------------------------------------------------------
  449.   def refresh
  450.     contents.clear
  451.     reset_font_settings
  452.     return unless @actor
  453.     draw_window_contents
  454.   end
  455.  
  456.   #--------------------------------------------------------------------------
  457.   # draw_window_contents
  458.   #--------------------------------------------------------------------------
  459.   def draw_window_contents
  460.     case @command_window.current_symbol
  461.     when :general
  462.       draw_actor_general
  463.     when :parameters
  464.       draw_parameter_graph
  465.     when :properties
  466.       draw_properties_list
  467.     when :biography, :rename, :retitle
  468.       draw_actor_biography
  469.     else
  470.       draw_custom
  471.     end
  472.   end
  473.  
  474.   #--------------------------------------------------------------------------
  475.   # draw_actor_general
  476.   #--------------------------------------------------------------------------
  477.   def draw_actor_general
  478.     change_color(system_color)
  479.     text = YEA::STATUS::PARAMETERS_VOCAB
  480.     draw_text(0, 0, contents.width/2, line_height, text, 1)
  481.     text = YEA::STATUS::EXPERIENCE_VOCAB
  482.     draw_text(contents.width/2, 0, contents.width/2, line_height, text, 1)
  483.     draw_general_parameters
  484.     draw_general_experience
  485.   end
  486.  
  487.   #--------------------------------------------------------------------------
  488.   # draw_general_parameters
  489.   #--------------------------------------------------------------------------
  490.   def draw_general_parameters
  491.     dx = 24
  492.     dy = line_height / 2
  493.     draw_actor_level(dx, line_height*1+dy, contents.width/2 - 24)
  494.     draw_actor_param(0, dx, line_height*2+dy, contents.width/2 - 24)
  495.     draw_actor_param(1, dx, line_height*3+dy, contents.width/2 - 24)
  496.     draw_actor_param(2, dx, line_height*4+dy, contents.width/4 - 12)
  497.     draw_actor_param(4, dx, line_height*5+dy, contents.width/4 - 12)
  498.     draw_actor_param(6, dx, line_height*6+dy, contents.width/4 - 12)
  499.     dx += contents.width/4 - 12
  500.     draw_actor_param(3, dx, line_height*4+dy, contents.width/4 - 12)
  501.     draw_actor_param(5, dx, line_height*5+dy, contents.width/4 - 12)
  502.     draw_actor_param(7, dx, line_height*6+dy, contents.width/4 - 12)
  503.   end
  504.  
  505.   #--------------------------------------------------------------------------
  506.   # draw_actor_level
  507.   #--------------------------------------------------------------------------
  508.   def draw_actor_level(dx, dy, dw)
  509.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  510.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  511.     contents.fill_rect(rect, colour)
  512.     change_color(system_color)
  513.     draw_text(dx+4, dy, dw-8, line_height, Vocab::level)
  514.     change_color(normal_color)
  515.     draw_text(dx+4, dy, dw-8, line_height, @actor.level.group, 2)
  516.   end
  517.  
  518.   #--------------------------------------------------------------------------
  519.   # draw_actor_param
  520.   #--------------------------------------------------------------------------
  521.   def draw_actor_param(param_id, dx, dy, dw)
  522.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  523.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  524.     contents.fill_rect(rect, colour)
  525.     change_color(system_color)
  526.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  527.     change_color(normal_color)
  528.     draw_text(dx+4, dy, dw-8, line_height, @actor.param(param_id).group, 2)
  529.   end
  530.  
  531.   #--------------------------------------------------------------------------
  532.   # draw_general_experience
  533.   #--------------------------------------------------------------------------
  534.   def draw_general_experience
  535.     if @actor.max_level?
  536.       s1 = @actor.exp.group
  537.       s2 = "-------"
  538.       s3 = "-------"
  539.     else
  540.       s1 = @actor.exp.group
  541.       s2 = (@actor.next_level_exp - @actor.exp).group
  542.       s3 = @actor.next_level_exp.group
  543.     end
  544.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  545.     total_next_text = sprintf(YEA::STATUS::NEXT_TOTAL_VOCAB, Vocab::level)
  546.     change_color(system_color)
  547.     dx = contents.width/2 + 12
  548.     dy = line_height * 3 / 2
  549.     dw = contents.width/2 - 36
  550.     draw_text(dx, dy + line_height * 0, dw, line_height, Vocab::ExpTotal)
  551.     draw_text(dx, dy + line_height * 2, dw, line_height, s_next)
  552.     draw_text(dx, dy + line_height * 4, dw, line_height, total_next_text)
  553.     change_color(normal_color)
  554.     draw_text(dx, dy + line_height * 1, dw, line_height, s1, 2)
  555.     draw_text(dx, dy + line_height * 3, dw, line_height, s2, 2)
  556.     draw_text(dx, dy + line_height * 5, dw, line_height, s3, 2)
  557.   end
  558.  
  559.   #--------------------------------------------------------------------------
  560.   # draw_parameter_graph
  561.   #--------------------------------------------------------------------------
  562.   def draw_parameter_graph
  563.     draw_parameter_title
  564.     dy = line_height * 3/2
  565.     maximum = 1
  566.     minimum = @actor.param_max(2)
  567.     for i in 2..7
  568.       maximum = [@actor.param(i), maximum].max
  569.       minimum = [@actor.param(i), minimum].min
  570.     end
  571.     maximum += minimum * 0.33 unless maximum == minimum
  572.     for i in 2..7
  573.       rate = calculate_rate(maximum, minimum, i)
  574.       dy = line_height * i - line_height/2
  575.       draw_param_gauge(i, dy, rate)
  576.       change_color(system_color)
  577.       draw_text(28, dy, contents.width - 56, line_height, Vocab::param(i))
  578.       dw = (contents.width - 48) * rate - 8
  579.       change_color(normal_color)
  580.       draw_text(28, dy, dw, line_height, @actor.param(i).group, 2)
  581.     end
  582.   end
  583.  
  584.   #--------------------------------------------------------------------------
  585.   # calculate_rate
  586.   #--------------------------------------------------------------------------
  587.   def calculate_rate(maximum, minimum, param_id)
  588.     return 1.0 if maximum == minimum
  589.     rate = (@actor.param(param_id).to_f - minimum) / (maximum - minimum).to_f
  590.     rate *= 0.67
  591.     rate += 0.33
  592.     return rate
  593.   end
  594.  
  595.   #--------------------------------------------------------------------------
  596.   # draw_param_gauge
  597.   #--------------------------------------------------------------------------
  598.   def draw_param_gauge(param_id, dy, rate)
  599.     dw = contents.width - 48
  600.     colour1 = param_gauge1(param_id)
  601.     colour2 = param_gauge2(param_id)
  602.     draw_gauge(24, dy, dw, rate, colour1, colour2)
  603.   end
  604.  
  605.   #--------------------------------------------------------------------------
  606.   # param_gauge1
  607.   #--------------------------------------------------------------------------
  608.   def param_gauge1(param_id)
  609.     return YEA::STATUS::PARAM_COLOUR[param_id][1]
  610.   end
  611.  
  612.   #--------------------------------------------------------------------------
  613.   # param_gauge2
  614.   #--------------------------------------------------------------------------
  615.   def param_gauge2(param_id)
  616.     return YEA::STATUS::PARAM_COLOUR[param_id][2]
  617.   end
  618.  
  619.   #--------------------------------------------------------------------------
  620.   # draw_parameter_title
  621.   #--------------------------------------------------------------------------
  622.   def draw_parameter_title
  623.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  624.     rect = Rect.new(0, 0, contents.width, contents.height)
  625.     contents.fill_rect(rect, colour)
  626.     change_color(system_color)
  627.     text = YEA::STATUS::PARAMETERS_VOCAB
  628.     draw_text(0, line_height/3, contents.width, line_height, text, 1)
  629.   end
  630.  
  631.   #--------------------------------------------------------------------------
  632.   # draw_properties_list
  633.   #--------------------------------------------------------------------------
  634.   def draw_properties_list
  635.     contents.font.size = YEA::STATUS::PROPERTIES_FONT_SIZE
  636.     draw_properties_column1
  637.     draw_properties_column2
  638.     draw_properties_column3
  639.     reset_font_settings
  640.   end
  641.  
  642.   #--------------------------------------------------------------------------
  643.   # draw_properties_column1
  644.   #--------------------------------------------------------------------------
  645.   def draw_properties_column1
  646.     dx = 24
  647.     dw = (contents.width - 24) / 3 - 24
  648.     dy = 0
  649.     for property in YEA::STATUS::PROPERTIES_COLUMN1
  650.       dy = draw_property(property, dx, dy, dw)
  651.     end
  652.   end
  653.  
  654.   #--------------------------------------------------------------------------
  655.   # draw_properties_column2
  656.   #--------------------------------------------------------------------------
  657.   def draw_properties_column2
  658.     dx = 24 + (contents.width - 24) / 3
  659.     dw = (contents.width - 24) / 3 - 24
  660.     dy = 0
  661.     for property in YEA::STATUS::PROPERTIES_COLUMN2
  662.       dy = draw_property(property, dx, dy, dw)
  663.     end
  664.   end
  665.  
  666.   #--------------------------------------------------------------------------
  667.   # draw_properties_column3
  668.   #--------------------------------------------------------------------------
  669.   def draw_properties_column3
  670.     dx = 24 + (contents.width - 24) / 3 * 2
  671.     dw = (contents.width - 24) / 3 - 24
  672.     dy = 0
  673.     for property in YEA::STATUS::PROPERTIES_COLUMN3
  674.       dy = draw_property(property, dx, dy, dw)
  675.     end
  676.   end
  677.  
  678.   #--------------------------------------------------------------------------
  679.   # draw_property
  680.   #--------------------------------------------------------------------------
  681.   def draw_property(property, dx, dy, dw)
  682.     fmt = "%1.2f%%"
  683.     case property[0]
  684.     #---
  685.     when :hit
  686.       value = sprintf(fmt, @actor.hit * 100)
  687.     when :eva
  688.       value = sprintf(fmt, @actor.eva * 100)
  689.     when :cri
  690.       value = sprintf(fmt, @actor.cri * 100)
  691.     when :cev
  692.       value = sprintf(fmt, @actor.cev * 100)
  693.     when :mev
  694.       value = sprintf(fmt, @actor.mev * 100)
  695.     when :mrf
  696.       value = sprintf(fmt, @actor.mrf * 100)
  697.     when :cnt
  698.       value = sprintf(fmt, @actor.cnt * 100)
  699.     when :hrg
  700.       value = sprintf(fmt, @actor.hrg * 100)
  701.     when :mrg
  702.       value = sprintf(fmt, @actor.mrg * 100)
  703.     when :trg
  704.       value = sprintf(fmt, @actor.trg * 100)
  705.     when :tgr
  706.       value = sprintf(fmt, @actor.tgr * 100)
  707.     when :grd
  708.       value = sprintf(fmt, @actor.grd * 100)
  709.     when :rec
  710.       value = sprintf(fmt, @actor.rec * 100)
  711.     when :pha
  712.       value = sprintf(fmt, @actor.pha * 100)
  713.     when :mcr
  714.       value = sprintf(fmt, @actor.mcr * 100)
  715.     when :tcr
  716.       value = sprintf(fmt, @actor.tcr * 100)
  717.     when :pdr
  718.       value = sprintf(fmt, @actor.pdr * 100)
  719.     when :mdr
  720.       value = sprintf(fmt, @actor.mdr * 100)
  721.     when :fdr
  722.       value = sprintf(fmt, @actor.fdr * 100)
  723.     when :exr
  724.       value = sprintf(fmt, @actor.exr * 100)
  725.     when :hcr
  726.       return dy unless $imported["YEA-SkillCostManager"]
  727.       value = sprintf(fmt, @actor.hcr * 100)
  728.     when :tcr_y
  729.       return dy unless $imported["YEA-SkillCostManager"]
  730.       value = sprintf(fmt, @actor.tcr_y * 100)
  731.     when :gcr
  732.       return dy unless $imported["YEA-SkillCostManager"]
  733.       value = sprintf(fmt, @actor.gcr * 100)
  734.     when :cdr
  735.       return dy unless $imported["YEA-SkillRestrictions"]
  736.       value = sprintf(fmt, @actor.cdr * 100)
  737.     when :wur
  738.       return dy unless $imported["YEA-SkillRestrictions"]
  739.       value = sprintf(fmt, @actor.wur * 100)
  740.     #---
  741.     else; return dy
  742.     end
  743.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  744.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  745.     contents.fill_rect(rect, colour)
  746.     change_color(system_color)
  747.     draw_text(dx+4, dy, dw-8, line_height, property[1], 0)
  748.     change_color(normal_color)
  749.     draw_text(dx+4, dy, dw-8, line_height, value, 2)
  750.     return dy + line_height
  751.   end
  752.  
  753.   #--------------------------------------------------------------------------
  754.   # draw_actor_biography
  755.   #--------------------------------------------------------------------------
  756.   def draw_actor_biography
  757.     fmt = YEA::STATUS::BIOGRAPHY_NICKNAME_TEXT
  758.     text = sprintf(fmt, @actor.name, @actor.nickname)
  759.     contents.font.size = YEA::STATUS::BIOGRAPHY_NICKNAME_SIZE
  760.     draw_text(0, 0, contents.width, line_height*2, text, 1)
  761.     reset_font_settings
  762.     draw_text_ex(24, line_height*2, @actor.description)
  763.   end
  764.  
  765.   #--------------------------------------------------------------------------
  766.   # draw_custom
  767.   #--------------------------------------------------------------------------
  768.   def draw_custom
  769.     current_symbol = @command_window.current_symbol
  770.     return unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(current_symbol)
  771.     method(YEA::STATUS::CUSTOM_STATUS_COMMANDS[current_symbol][3]).call
  772.   end
  773.  
  774.   #--------------------------------------------------------------------------
  775.   # draw_custom1
  776.   #--------------------------------------------------------------------------
  777.   def draw_custom1
  778.     dx = 0; dy = 0
  779.     for skill in @actor.skills
  780.       next if skill.nil?
  781.       next unless @actor.added_skill_types.include?(skill.stype_id)
  782.       draw_item_name(skill, dx, dy)
  783.       dx = dx == contents.width / 2 + 16 ? 0 : contents.width / 2 + 16
  784.       dy += line_height if dx == 0
  785.       return if dy + line_height > contents.height
  786.     end
  787.   end
  788.  
  789.   #--------------------------------------------------------------------------
  790.   # draw_custom2
  791.   #--------------------------------------------------------------------------
  792.   def draw_custom2
  793.     dx = 4; dy = 0; slot_id = 0
  794.     for equip in @actor.equips
  795.       change_color(system_color)
  796.       text = Vocab.etype(@actor.equip_slots[slot_id])
  797.       draw_text(dx, dy, contents.width - dx, line_height, text)
  798.       reset_font_settings
  799.       draw_item_name(equip, dx+92, dy) unless equip.nil?
  800.       slot_id += 1
  801.       dy += line_height
  802.       break if dy + line_height > contents.height
  803.     end
  804.     dw = Graphics.width * 2 / 5 - 24
  805.     dx = contents.width - dw; dy = 0
  806.     param_id = 0
  807.     8.times do
  808.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  809.       rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  810.       contents.fill_rect(rect, colour)
  811.       size = $imported["YEA-AceEquipEngine"] ? YEA::EQUIP::STATUS_FONT_SIZE : 20
  812.       contents.font.size = size
  813.       change_color(system_color)
  814.       draw_text(dx+4, dy, dw, line_height, Vocab::param(param_id))
  815.       change_color(normal_color)
  816.       dwa = (Graphics.width * 2 / 5 - 2) / 2
  817.       draw_text(dx, dy, dwa, line_height, @actor.param(param_id).group, 2)
  818.       reset_font_settings
  819.       change_color(system_color)
  820.       draw_text(dx + dwa, dy, 22, line_height, "→", 1)
  821.       param_id += 1
  822.       dy += line_height
  823.       break if dy + line_height > contents.height
  824.     end
  825.   end
  826.  
  827.   #--------------------------------------------------------------------------
  828.   # draw_custom3
  829.   #--------------------------------------------------------------------------
  830.   def draw_custom3
  831.     return unless $imported["YEA-ClassSystem"]
  832.     data = []
  833.     for class_id in YEA::CLASS_SYSTEM::CLASS_ORDER
  834.       next if $data_classes[class_id].nil?
  835.       item = $data_classes[class_id]
  836.       next unless @actor.unlocked_classes.include?(item.id) or
  837.         YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS.include?(item.id)
  838.       data.push(item)
  839.     end
  840.     dx = 0; dy = 0; class_index = 0
  841.     for class_id in data
  842.       item = data[class_index]
  843.       reset_font_settings
  844.       if item == @actor.class
  845.         change_color(text_color(YEA::CLASS_SYSTEM::CURRENT_CLASS_COLOUR))
  846.       elsif item == @actor.subclass
  847.         change_color(text_color(YEA::CLASS_SYSTEM::SUBCLASS_COLOUR))
  848.       else
  849.         change_color(normal_color)
  850.       end
  851.       icon = item.icon_index
  852.       draw_icon(icon, dx, dy)
  853.       text = item.name
  854.       draw_text(24, dy, contents.width-24, line_height, text)
  855.       next if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
  856.       level = @actor.class_level(item.id)
  857.       contents.font.size = YEA::CLASS_SYSTEM::LEVEL_FONT_SIZE
  858.       text = sprintf(YEA::CLASS_SYSTEM::CLASS_LEVEL, level.group)
  859.       dwa = contents.width - (Graphics.width * 2 / 5 - 24) - 28
  860.       draw_text(dx, dy, dwa, line_height, text, 2)
  861.       class_index += 1
  862.       dy += line_height
  863.       break if dy + line_height > contents.height
  864.     end
  865.     dw = Graphics.width * 2 / 5 - 24
  866.     dx = contents.width - dw; dy = 0
  867.     param_id = 0
  868.     8.times do
  869.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  870.       rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  871.       contents.fill_rect(rect, colour)
  872.       contents.font.size = YEA::CLASS_SYSTEM::PARAM_FONT_SIZE
  873.       change_color(system_color)
  874.       draw_text(dx+4, dy, dw, line_height, Vocab::param(param_id))
  875.       change_color(normal_color)
  876.       dwa = (Graphics.width * 2 / 5 - 2) / 2
  877.       draw_text(dx, dy, dwa, line_height, @actor.param(param_id).group, 2)
  878.       reset_font_settings
  879.       change_color(system_color)
  880.       draw_text(dx + dwa, dy, 22, line_height, "→", 1)
  881.       param_id += 1
  882.       dy += line_height
  883.       break if dy + line_height > contents.height
  884.     end
  885.   end
  886.  
  887. end # Window_StatusItem
  888.  
  889. #==============================================================================
  890. # ■ Scene_Status
  891. #==============================================================================
  892.  
  893. class Scene_Status < Scene_MenuBase
  894.  
  895.   #--------------------------------------------------------------------------
  896.   # start
  897.   #--------------------------------------------------------------------------
  898.   def start
  899.     super
  900.     create_help_window
  901.     create_command_window
  902.     create_status_window
  903.     create_item_window
  904.     relocate_windows
  905.   end
  906.  
  907.   #--------------------------------------------------------------------------
  908.   # create_command_window
  909.   #--------------------------------------------------------------------------
  910.   def create_command_window
  911.     wy = @help_window.height
  912.     @command_window = Window_StatusCommand.new(0, wy)
  913.     @command_window.viewport = @viewport
  914.     @command_window.actor = @actor
  915.     @command_window.help_window = @help_window
  916.     @command_window.set_handler(:cancel,   method(:return_scene))
  917.     @command_window.set_handler(:pagedown, method(:next_actor))
  918.     @command_window.set_handler(:pageup,   method(:prev_actor))
  919.     process_custom_status_commands
  920.   end
  921.  
  922.   #--------------------------------------------------------------------------
  923.   # process_custom_status_commands
  924.   #--------------------------------------------------------------------------
  925.   def process_custom_status_commands
  926.     for command in YEA::STATUS::COMMANDS
  927.       next unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(command[0])
  928.       called_method = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][2]
  929.       @command_window.set_handler(command[0], method(called_method))
  930.     end
  931.   end
  932.  
  933.   #--------------------------------------------------------------------------
  934.   # create_status_window
  935.   #--------------------------------------------------------------------------
  936.   def create_status_window
  937.     wy = @help_window.height
  938.     @status_window = Window_StatusActor.new(@command_window.width, wy)
  939.     @status_window.viewport = @viewport
  940.     @status_window.actor = @actor
  941.   end
  942.  
  943.   #--------------------------------------------------------------------------
  944.   # create_item_window
  945.   #--------------------------------------------------------------------------
  946.   def create_item_window
  947.     dy = @command_window.y + @command_window.height
  948.     @item_window = Window_StatusItem.new(0, dy, @command_window)
  949.     @item_window.viewport = @viewport
  950.     @item_window.actor = @actor
  951.     @command_window.item_window = @item_window
  952.   end
  953.  
  954.   #--------------------------------------------------------------------------
  955.   # relocate_windows
  956.   #--------------------------------------------------------------------------
  957.   def relocate_windows
  958.     return unless $imported["YEA-AceMenuEngine"]
  959.     case Menu.help_window_location
  960.     when 0 # Top
  961.       @help_window.y = 0
  962.       @command_window.y = @help_window.height
  963.       @item_window.y = @command_window.y + @command_window.height
  964.     when 1 # Middle
  965.       @command_window.y = 0
  966.       @help_window.y = @command_window.height
  967.       @item_window.y = @help_window.y + @help_window.height
  968.     else # Bottom
  969.       @command_window.y = 0
  970.       @item_window.y = @command_window.height
  971.       @help_window.y = @item_window.y + @item_window.height
  972.     end
  973.     @status_window.y = @command_window.y
  974.   end
  975.  
  976.   #--------------------------------------------------------------------------
  977.   # on_actor_change
  978.   #--------------------------------------------------------------------------
  979.   def on_actor_change
  980.     @command_window.actor = @actor
  981.     @status_window.actor = @actor
  982.     @item_window.actor = @actor
  983.     @command_window.activate
  984.   end
  985.  
  986.   #--------------------------------------------------------------------------
  987.   # new method: command_name1
  988.   #--------------------------------------------------------------------------
  989.   def command_name1
  990.     SceneManager.call(Scene_Skill)
  991.   end
  992.  
  993.   #--------------------------------------------------------------------------
  994.   # new method: command_name2
  995.   #--------------------------------------------------------------------------
  996.   def command_name2
  997.     SceneManager.call(Scene_Equip)
  998.   end
  999.  
  1000.   #--------------------------------------------------------------------------
  1001.   # new method: command_name3
  1002.   #--------------------------------------------------------------------------
  1003.   def command_name3
  1004.     unless $imported["YEA-ClassSystem"]
  1005.       @command_window.activate
  1006.       return
  1007.     end
  1008.     SceneManager.call(Scene_Class)
  1009.   end
  1010.  
  1011. end # Scene_Status
  1012.  
  1013. #==============================================================================
  1014. #
  1015. # ▼ End of File
  1016. #
  1017. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement