Project1

标题: 小白求“关于状态有效度的脚本设置。” [打印本页]

作者: 血之月殇    时间: 2015-3-5 14:14
标题: 小白求“关于状态有效度的脚本设置。”
这是原脚本。
我需要改动一个地方。
前面也设置了获取属性有效度的ID了,可是怎么还是出错。
求帮忙。


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




我打算改的地方。


RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2.   # draw_property
  3.   #--------------------------------------------------------------------------
  4.   def draw_property(property, dx, dy, dw)
  5.     case property[0]
  6.     #---
  7.     when :hit
  8.       fmt = "%1.2f%%"
  9.       value = sprintf(fmt, @actor.hit * 100)
  10.     when :element_1
  11.       fmt = "%1.2f%%"
  12.       value = sprintf(fmt, @actor.element_1 * 100)
  13.       ……



小白求大神帮忙……

作者: 血之月殇    时间: 2015-3-5 14:16
@三途亚梦 大触!!!

求教程。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1