Project1

标题: 流星技能升级系统 V2.1的问题 [打印本页]

作者: sonicdonggua    时间: 2015-1-24 22:01
标题: 流星技能升级系统 V2.1的问题
我又遇到问题了……跪求各位大神,请问为啥一在技能界面按A就会弹出 错误undefined method 'manual_lvup?' for nil:NilClass  跪谢!
作者: rpg-sheep    时间: 2015-1-24 22:30
本帖最后由 rpg-sheep 于 2015-1-24 22:32 编辑

遇到这类的问题,至少应当将你的范例工程上传上来,否则我们是没法分析的。
至于出现这个错误,应该是对一个本应该成为一个新class的变量赋值了null,在调用manual_lvup?方法时发生错误。
你可以尝试把技能界面的脚本复制到记事本里,搜索引号里面的内容:“.manual_lvup?”然后自己解决。
也可以找Input.trigger?(:X) 或Input.press?(:X),找到调用A键的部分,然后解决。
由于我看不到你的工程,只能帮你到这里了
作者: sonicdonggua    时间: 2015-1-24 22:41
标题: RE: 流星技能升级系统 V2.1的问题
本帖最后由 sonicdonggua 于 2015-1-24 23:08 编辑


  1. module Snstar2006
  2.   module Skill_LvUp
  3.     SKILL_LVUP_NO_FORGET = false # 升级时不遗忘旧技能
  4.     SKILL_MANUAL_LVUP    = false # 手动升级
  5.     SKILL_RES_EXP_BASE   = 2     # 升级点数基数,数字越大,获得越少
  6.     SKILL_MAN_LVUP_KEY   = :X    # 手动升级的按键设定
  7.     SKILL_EXP_VOCAB      = "熟练度"   # 技能熟练度术语
  8.     SKILL_REXP_VOCAB     = "精元点数" # 技能提升点数术语
  9.   end
  10. end


  11. class RPG::Skill < RPG::UsableItem
  12.   include Snstar2006::Skill_LvUp
  13.   #--------------------------------------------------------------------------
  14.   # ● 获取技能最高等级
  15.   #--------------------------------------------------------------------------
  16.   def get_max_skill
  17.     self.note.split(/[\r\n]+/).each{ |line|
  18.       if line =~ /\[(?:max_level) (\d+)\]/
  19.         return $1 ? $1.to_i : 1
  20.       end}
  21.     return 1
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 获取技能熟练度基数
  25.   #--------------------------------------------------------------------------
  26.   def get_exp_base
  27.     self.note.split(/[\r\n]+/).each{ |line|
  28.       if line =~ /\[(?:exp_base) (\d+)\]/
  29.         return $1 ? $1.to_i : 30
  30.       end}
  31.     return 30
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 获取技能吸收角色经验值作为熟练度的基础值
  35.   #--------------------------------------------------------------------------
  36.   def get_exp_part
  37.     self.note.split(/[\r\n]+/).each{ |line|
  38.       if line =~ /\[(?:exp_part) (\d+)\]/
  39.         return $1 ? $1.to_i : 0
  40.       end}
  41.     return 0
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ● 获取技能使用时获取的熟练度
  45.   #--------------------------------------------------------------------------
  46.   def get_use_exp
  47.     self.note.split(/[\r\n]+/).each{ |line|
  48.       if line =~ /\[(?:use_exp) (\d+)\]/
  49.         return $1 ? $1.to_i : 1
  50.       end}
  51.     return 1
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 获取技能升级后变化的技能
  55.   #--------------------------------------------------------------------------
  56.   def get_on_level(level)
  57.     trans_skill_id = 0
  58.     self.note.split(/[\r\n]+/).each{ |line|
  59.       if line =~ /\[(?:on_level) (\d+)\,(\d+)\]/
  60.         trans_skill_id = $2.to_i if level == $1.to_i
  61.       end}
  62.     return trans_skill_id
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● 获取技能升级后变化的技能
  66.   #--------------------------------------------------------------------------
  67.   def get_inherit
  68.     self.note.split(/[\r\n]+/).each{ |line|
  69.       if line =~ /\[(?:inherit) (\d+)\]/
  70.         return $1 ? $1.to_i : 0
  71.       end}
  72.     return 0
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 判断是否升级后遗忘
  76.   #--------------------------------------------------------------------------
  77.   def no_forget?
  78.     self.note.split(/[\r\n]+/).each{ |line|
  79.       if line =~ /\[(?:no_forget)\]/
  80.         return true
  81.       end}
  82.     return false
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 获取技能升级后变化的伤害值基数
  86.   #--------------------------------------------------------------------------
  87.   def get_dmg_var
  88.     self.note.split(/[\r\n]+/).each{ |line|
  89.       if line =~ /\[(?:dmg_var) (\d+)\]/
  90.         return $1 ? $1.to_i : 0
  91.       end}
  92.     return 0
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 判断是否能升级
  96.   #--------------------------------------------------------------------------
  97.   def can_lvup?
  98.     skill_level_initialize # 技能等级初始化
  99.     return @max_level > 1
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 判断是否获取角色经验当作熟练度
  103.   #--------------------------------------------------------------------------
  104.   def get_exp_from_actor?
  105.     return false unless can_lvup?
  106.     return @get_exp > 0
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ● 判断是否手动升级
  110.   #--------------------------------------------------------------------------
  111.   def manual_lvup?
  112.     return false unless can_lvup?
  113.     return false if transformed
  114.     return true if SKILL_MANUAL_LVUP
  115.     return false if get_exp_from_actor?
  116.     return false if lvup_by_use?
  117.     return true
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 判断是否在使用时提升熟练度
  121.   #--------------------------------------------------------------------------
  122.   def lvup_by_use?
  123.     return false unless can_lvup?
  124.     return @use_exp > 0
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● 判断是否继承任何技能设定
  128.   #--------------------------------------------------------------------------
  129.   def inherit?
  130.     @transform_from = get_inherit
  131.     return @transform_from > 0
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 技能等级参数初始化
  135.   #--------------------------------------------------------------------------
  136.   def skill_level_initialize
  137.     return if @skill_level_initialized # 已初始化时跳过
  138.     @max_level = get_max_skill
  139.     @get_exp = get_exp_part
  140.     @use_exp = get_use_exp
  141.     @skill_level_initialized = true
  142.     initialize_skill_transform
  143.     @transformed = false
  144.     @transform_from = 0
  145.     @dmg_var = get_dmg_var
  146.     @fml_altered = false
  147.     if @dmg_var > 0
  148.       $game_variables[@dmg_var]=1
  149.     end
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 技能等级参数继承
  153.   #--------------------------------------------------------------------------
  154.   def skill_level_inherit
  155.     return unless inherit? # 已设定继承时跳过
  156.     old_skill = $data_skills[@transform_from]
  157.     @max_level = old_skill.get_max_skill
  158.     @get_exp = old_skill.get_exp_part
  159.     @use_exp = old_skill.get_use_exp
  160.     initialize_skill_transform
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● 获取技能吸取角色经验值的基数
  164.   #--------------------------------------------------------------------------
  165.   def exp_from_actor
  166.     return @get_exp
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● 技能变化资讯初始化
  170.   #--------------------------------------------------------------------------
  171.   def initialize_skill_transform
  172.     @skill_transform = []
  173.     1.upto(@max_level){ |level|
  174.       t_id = get_on_level(level)
  175.       if t_id > 0
  176.         @skill_transform = [level, t_id]
  177.         break
  178.       end
  179.     }
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 判断技能是否会变化
  183.   #--------------------------------------------------------------------------
  184.   def transform?
  185.     return !@skill_transform.empty?
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ● 判断技能是否会在某等级变化
  189.   #--------------------------------------------------------------------------
  190.   def transform_at?(level)
  191.     return false unless transform?
  192.     return @skill_transform[0] == level
  193.   end
  194.   def transform_at
  195.     return @skill_transform[0]
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 获取技能变化后的技能ID
  199.   #--------------------------------------------------------------------------
  200.   def transform_to(level)
  201.     return 0 unless transform_at?(level)
  202.     return @skill_transform[1]
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 判断技能是否有指定伤害变量
  206.   #--------------------------------------------------------------------------
  207.   def dmg_var?
  208.     return @dmg_var>0
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ● 判断技能是否已修改公式
  212.   #--------------------------------------------------------------------------
  213.   def fml_altered?
  214.     return @fml_altered
  215.   end
  216.   attr_reader :max_level # 获取最高等级
  217.   attr_reader :use_exp   # 使用提升熟练度量
  218.   attr_accessor :transformed # 已变化技能
  219.   attr_accessor :fml_altered # 已修改公式
  220.   attr_reader :dmg_var   # 升级提升伤害的变量ID
  221. end
  222. class Game_Actor < Game_Battler
  223.   include Snstar2006::Skill_LvUp
  224.   #--------------------------------------------------------------------------
  225.   # ● 初始化
  226.   #--------------------------------------------------------------------------
  227.   alias skill_level_initialize initialize
  228.   def initialize(actor_id)
  229.     @skill_level = {}    # 纪录技能等级
  230.     @skill_exp = {}      # 记录技能熟练度
  231.     @skill_exp_base = {} # 记录技能熟练度基数
  232.     @skill_next_exp = {} # 记录技能下一级熟练度
  233.     @skill_dmg_val = {}  # 纪录技能伤害变化的变量ID
  234.     @skill_res_exp = 0   # 纪录获取的技能升级点数
  235.     skill_level_initialize(actor_id)
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ● 角色习得技能
  239.   #--------------------------------------------------------------------------
  240.   alias skill_level_learn_skill learn_skill
  241.   def learn_skill(skill_id)
  242.     skill_level_learn_skill(skill_id)
  243.     skill = $data_skills[skill_id]
  244.     if skill.can_lvup? # 判断技能是否可升级
  245.       @skill_level[skill_id] = 1
  246.       @skill_exp[skill_id] = 0
  247.       @skill_exp_base[skill_id] = skill.get_exp_base
  248.       @skill_next_exp[skill_id] = @skill_exp_base[skill_id]
  249.       if skill.dmg_var?
  250.         @skill_dmg_val[skill_id] = skill.dmg_var+@actor_id-1
  251.         alter_damage_formula(skill_id)
  252.       end
  253.     end
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ● 修改伤害公式
  257.   #--------------------------------------------------------------------------
  258.   def alter_damage_formula(skill_id)
  259.     skill = $data_skills[skill_id]
  260.     return if skill.fml_altered? # 已修改时返回
  261.     formula = skill.damage.formula # 获取公式
  262.     dmg_var_id = @skill_dmg_val[skill_id]
  263.     skill.damage.formula = "(#{formula})*v[#{dmg_var_id}]"
  264.     skill.fml_altered = true # 标记为已修改
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● 判断技能是否能升级
  268.   #--------------------------------------------------------------------------
  269.   def skill_can_lvup?(skill_id)
  270.     return false unless $data_skills[skill_id].can_lvup? # 技能不可升级
  271.     return false unless @skills.include?(skill_id) # 角色未学习此技能
  272.     return @skill_level[skill_id] < max_skill_level(skill_id) # 技能未达最高等级
  273.   end
  274.   #--------------------------------------------------------------------------
  275.   # ● 获取技能最高等级
  276.   #--------------------------------------------------------------------------
  277.   def max_skill_level(skill_id)
  278.     return $data_skills[skill_id].max_level
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ● 获取技能等级
  282.   #--------------------------------------------------------------------------
  283.   def skill_level(skill_id)
  284.     return 1 unless $data_skills[skill_id].can_lvup?
  285.     return @skill_level[skill_id]
  286.   end
  287.   #--------------------------------------------------------------------------
  288.   # ● 获取技能下一级熟练度
  289.   #--------------------------------------------------------------------------
  290.   def skill_next_exp(skill_id)
  291.     return 0 unless skill_can_lvup?(skill_id)
  292.     return @skill_next_exp[skill_id]
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● 获取技能当前熟练度
  296.   #--------------------------------------------------------------------------
  297.   def skill_exp(skill_id)
  298.     return 0 unless skill_can_lvup?(skill_id)
  299.     return @skill_exp[skill_id]
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● 角色获得经验值
  303.   #--------------------------------------------------------------------------
  304.   alias skill_level_gain_exp gain_exp
  305.   def gain_exp(exp)
  306.     skill_level_gain_exp(exp)
  307.     gain_skill_res_exp(exp/SKILL_RES_EXP_BASE)
  308.     @skills.each{ |id|
  309.       skill = $data_skills[id]
  310.       if skill.get_exp_from_actor? # 技能是否吸收经验值
  311.           skill_exp = (exp.to_f / skill.exp_from_actor).ceil
  312.           gain_skill_exp(id, skill_exp) # 技能提升熟练度
  313.       end
  314.     }
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● 角色获得技能熟练度
  318.   #--------------------------------------------------------------------------
  319.   def gain_skill_exp(skill_id, val)
  320.     return unless skill_can_lvup?(skill_id)
  321.     skill = $data_skills[skill_id]
  322.     return if skill.transformed
  323.     return if val == 0
  324.     @skill_exp[skill_id] += val
  325.     if @skill_exp[skill_id] >= @skill_next_exp[skill_id]
  326.       skill_lvup(skill_id)
  327.     end
  328.   end
  329.   #--------------------------------------------------------------------------
  330.   # ● 使用技能提升熟练度
  331.   #--------------------------------------------------------------------------
  332.   def gain_skill_exp_by_use(skill)
  333.     @gain_skill_exp = 0
  334.     if skill.is_a?(RPG::Skill) and skill.lvup_by_use?
  335.       @gain_skill_exp = skill.use_exp
  336.     end
  337.   end
  338.   #--------------------------------------------------------------------------
  339.   # ● 角色获得技能提升点数
  340.   #--------------------------------------------------------------------------
  341.   def gain_skill_res_exp(val)
  342.     @skill_res_exp += val
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 返回角色的技能提升点数
  346.   #--------------------------------------------------------------------------
  347.   def res_exp
  348.     return @skill_res_exp
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ● 判断是否能手动升级
  352.   #--------------------------------------------------------------------------
  353.   def can_lv_skill_manually?(skill)
  354.     return false unless skill.manual_lvup?
  355.     return @skill_res_exp > 0
  356.   end
  357.   def has_dmg_var?(skill_id)
  358.     return @skill_dmg_val.keys.include?(skill_id)
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● 手动提升熟练度
  362.   #--------------------------------------------------------------------------
  363.   def gain_skill_exp_manual(skill_id)
  364.     skill = $data_skills[skill_id]
  365.     return unless skill.manual_lvup?
  366.     val = [@skill_next_exp[skill_id], @skill_res_exp].min
  367.     @skill_res_exp -= val
  368.     gain_skill_exp(skill_id, val)
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● 计算使用技能后提升的最终熟练度
  372.   #--------------------------------------------------------------------------
  373.   def gain_skill_final_exp_by_use(skill, hit)
  374.     return if @gain_skill_exp == 0
  375.     @gain_skill_exp /= 2 unless hit # 若是技能落空则熟练度减半
  376.     gain_skill_exp(skill.id, @gain_skill_exp)
  377.     @gain_skill_exp = 0
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 角色使用技能,技能获得熟练度
  381.   #--------------------------------------------------------------------------
  382.   alias skill_level_use_item use_item
  383.   def use_item(item)
  384.     skill_level_use_item(item)
  385.     gain_skill_exp_by_use(item)
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # ● 角色技能升级
  389.   #--------------------------------------------------------------------------
  390.   def skill_lvup(skill_id, val=1)
  391.     return unless skill_can_lvup?(skill_id)
  392.     return if $data_skills[skill_id].transformed
  393.     temp_level = @skill_level[skill_id] + val
  394.     max_level = max_skill_level(skill_id)
  395.     @skill_level[skill_id] = [temp_level, max_level].min
  396.     level = @skill_level[skill_id]
  397.     @skill_exp[skill_id] -= @skill_next_exp[skill_id]
  398.     @skill_exp[skill_id] = [@skill_exp[skill_id], 0].max
  399.     @skill_next_exp[skill_id] = @skill_exp_base[skill_id] * factorial(level)
  400.     if has_dmg_var?(skill_id)
  401.       dmg_var_id = @skill_dmg_val[skill_id]
  402.       $game_variables[dmg_var_id] = 1+(level.to_f/max_level)
  403.     end
  404.     process_skill_transform(skill_id, level)
  405.    
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● 计算技能伤害
  409.   #--------------------------------------------------------------------------
  410.   alias skill_level_make_damage_value make_damage_value
  411.   def make_damage_value(user, item)
  412.     skill_level_make_damage_value(user, item) # 呼叫原有方法
  413.   end
  414.   def process_skill_transform(skill_id, level)
  415.     skill = $data_skills[skill_id]
  416.     return unless skill.transform_at?(level) # 判断技能是否在这个等级变化
  417.     new_skill_id = skill.transform_to(level) # 获取变化后的技能ID
  418.     skill.transformed = true
  419.     learn_skill(new_skill_id) # 学习新技能
  420.    
  421.     # 将旧技能的等级、熟练度、熟练度基数、下一级熟练度转移到新技能下
  422.     $data_skills[new_skill_id].skill_level_inherit # 变化后的技能设定
  423.     @skill_level[new_skill_id] = @skill_level[skill_id]
  424.     @skill_exp[new_skill_id] = @skill_exp[skill_id]
  425.     @skill_exp_base[new_skill_id] = skill.get_exp_base
  426.     @skill_next_exp[new_skill_id] = @skill_next_exp[skill_id]
  427.     @skill_dmg_val[new_skill_id] = @skill_dmg_val[skill_id]
  428.     alter_damage_formula(new_skill_id) # 调整伤害公式
  429.    
  430.     if SKILL_LVUP_NO_FORGET or skill.no_forget? # 若是设定技能升级时不遗忘旧技能
  431.       @skill_exp[new_skill_id] = 0 # 熟练度归零
  432.     else
  433.       forget_skill(skill_id) # 遗忘旧技能
  434.       # 删除旧技能的等级、熟练度、熟练度基数、下一级熟练度
  435.       @skill_level.delete(skill_id)
  436.       @skill_exp.delete(skill_id)
  437.       @skill_exp_base.delete(skill_id)
  438.       @skill_next_exp.delete(skill_id)
  439.       @skill_dmg_val.delete(skill_id)
  440.     end
  441.   end
  442. end
  443. class Game_Battler < Game_BattlerBase
  444.   #--------------------------------------------------------------------------
  445.   # ● 技能使用对象的效果应用
  446.   #--------------------------------------------------------------------------
  447.   alias skill_level_item_apply item_apply
  448.   def item_apply(user, item)
  449.     skill_level_item_apply(user, item) # 呼叫原有方法
  450.     return unless item.is_a?(RPG::Skill) # 不是使用技能时返回
  451.     return unless user.actor?
  452.     user.gain_skill_final_exp_by_use(item, @result.hit?) # 计算最终熟练度
  453.   end
  454. end
  455. class Game_Interpreter
  456.   #--------------------------------------------------------------------------
  457.   # ● 技能等级提升
  458.   #--------------------------------------------------------------------------
  459.   def gain_skill_level(actor_id, skill_id, value=1)
  460.     $game_actors[actor_id].skill_lvup(skill_id, value)
  461.   end
  462.   #--------------------------------------------------------------------------
  463.   # ● 获得技能升级点数
  464.   #--------------------------------------------------------------------------
  465.   def gain_res_exp(actor_id, value=1)
  466.     $game_actors[actor_id].gain_skill_res_exp(value)
  467.   end
  468. end
  469. #--------------------------------------------------------------------------
  470. # ● 计算阶乘(计算技能下一级熟练度使用)
  471. #--------------------------------------------------------------------------
  472. def factorial(val)
  473.   if val <= 1
  474.     return 1
  475.   else
  476.     return factorial(val-2) + factorial(val-1)
  477.   end
  478. end
复制代码

  1. class Window_SkillLevel < Window_Base
  2.   include Snstar2006::Skill_LvUp
  3.   attr_reader :skill # 返回当前显示的技能
  4.   #--------------------------------------------------------------------------
  5.   # ● 初始化
  6.   #--------------------------------------------------------------------------
  7.   def initialize(x, y, actor, skill=nil)
  8.     super(x, y, Graphics.width/2, fitting_height(6))
  9.     @actor = actor
  10.     [url=home.php?mod=space&uid=260100]@skill[/url] = skill
  11.   end
  12.   #--------------------------------------------------------------------------
  13.   # ● 设定显示的技能
  14.   #--------------------------------------------------------------------------
  15.   def skill=(skill)
  16.     #return if @skill == skill
  17.     @skill = skill
  18.     refresh
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # ● 设定当前显示的角色
  22.   #--------------------------------------------------------------------------
  23.   def actor=(actor)
  24.     return if @actor == actor
  25.     @actor = actor
  26.     refresh
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # ● 窗口刷新
  30.   #--------------------------------------------------------------------------
  31.   def refresh
  32.     contents.clear
  33.     return unless @skill
  34.     draw_skill_name(@skill, 0, 0)
  35.     if @skill.can_lvup?
  36.       draw_skill_max_level(@skill, 24, line_height)
  37.       draw_skill_exp(@skill, 24, line_height*2)
  38.       draw_actor_res_exp(24, line_height*3)
  39.       draw_skill_transform(@skill, 24, line_height*4)
  40.     else
  41.       text = "此技能无法升级"
  42.       draw_text(24, line_height, text_width(text), line_height, text)
  43.     end
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 绘制技能名称
  47.   #--------------------------------------------------------------------------
  48.   def draw_skill_name(skill, x, y, enabled = true)
  49.     return unless skill
  50.     return unless skill.is_a?(RPG::Skill)
  51.     draw_icon(skill.icon_index, x, y, enabled)
  52.     change_color(normal_color, enabled)
  53.     skill_name = skill.name
  54.     skill_name += " (#{@actor.skill_level(skill.id)}级)" if skill.can_lvup?
  55.     text = skill_name
  56.     draw_text(x + 24, y, text_width(text), line_height, text)
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 绘制技能最高等级
  60.   #--------------------------------------------------------------------------
  61.   def draw_skill_max_level(skill, x, y)
  62.     return unless skill.can_lvup?
  63.     change_color(system_color)
  64.     text = "最高等级"
  65.     draw_text(x, y, text_width(text), line_height, text)
  66.     change_color(normal_color)
  67.     text = "#{skill.max_level} 级"
  68.     draw_text(x+108, y, text_width(text), line_height, text)
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 绘制技能熟练度
  72.   #--------------------------------------------------------------------------
  73.   def draw_skill_exp(skill, x, y)
  74.     return unless skill.can_lvup?
  75.     return if skill.transformed
  76.     change_color(system_color)
  77.     text = SKILL_EXP_VOCAB
  78.     draw_text(x, y, text_width(text), line_height, text)
  79.     change_color(normal_color)
  80.     color1 = text_color(18)
  81.     color2 = text_color(20)
  82.     current = @actor.skill_exp(skill.id)
  83.     if @actor.skill_can_lvup?(skill.id)
  84.       max = @actor.skill_next_exp(skill.id)
  85.       rate = current.to_f / max
  86.       draw_gauge(x+103, y, 120, rate, color1, color2)
  87.       draw_current_and_max_values(x+76, y, 150, current, max, normal_color, normal_color)
  88.     else
  89.       draw_current_and_max_values(x+76, y, 150, "--", "--", normal_color, normal_color)
  90.     end
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 绘制技能变化技
  94.   #--------------------------------------------------------------------------
  95.   def draw_skill_transform(skill, x, y)
  96.     return unless skill.transform?
  97.     change_color(system_color)
  98.     level = skill.transform_at
  99.     new_skill = $data_skills[skill.transform_to(level)]
  100.     text = sprintf("升至%s级则习得", level)
  101.     draw_text(x, y, text_width(text), line_height, text)
  102.     change_color(normal_color)
  103.     draw_item_name(new_skill, x+12, y+line_height)
  104.   end
  105.   def draw_actor_res_exp(x, y)
  106.     enabled = @skill.manual_lvup?
  107.     text = SKILL_REXP_VOCAB
  108.     change_color(system_color, enabled)
  109.     draw_text(x, y, text_width(text), line_height, text)
  110.     change_color(normal_color, enabled)
  111.     text = @actor.res_exp
  112.     draw_text(x+108, y, text_width(text), line_height, text)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 获得文字宽度
  116.   #--------------------------------------------------------------------------
  117.   def text_width(text)
  118.     return text_size(text).width*1.5
  119.   end
  120. end
  121. class Window_SkillList < Window_Selectable
  122.   include Snstar2006::Skill_LvUp
  123.   attr_reader   :skill_level_window # 返回技能等级窗口
  124.   #--------------------------------------------------------------------------
  125.   # ● 选择技能
  126.   #--------------------------------------------------------------------------
  127.   alias skill_level_select select
  128.   def select(index)
  129.     skill_level_select(index)
  130.     if !$game_party.in_battle
  131.       @skill_level_window.skill = item
  132.       @skill_level_window.refresh
  133.       if index % 2 == 0
  134.         @skill_level_window.x = Graphics.width/2
  135.       else
  136.         @skill_level_window.x = 0
  137.       end
  138.     end
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 设定技能等级窗口
  142.   #--------------------------------------------------------------------------
  143.   def skill_level_window=(skill_level_window)
  144.     @skill_level_window = skill_level_window
  145.     call_skill_level
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 呼叫技能窗口更新
  149.   #--------------------------------------------------------------------------
  150.   def call_skill_level
  151.     update_skill_level if active && @skill_level_window
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 技能窗口更新
  155.   #--------------------------------------------------------------------------
  156.   def update_skill_level
  157.     @skill_level_window.clear
  158.   end
  159.   alias skill_level_deactivate deactivate
  160.   def deactivate
  161.     skill_level_deactivate
  162.     return unless @skill_level_window
  163.     @skill_level_window.hide
  164.   end
  165.   alias skill_level_activate activate
  166.   def activate
  167.     skill_level_activate
  168.     return unless @skill_level_window
  169.     @skill_level_window.show
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 处理句柄
  173.   #--------------------------------------------------------------------------
  174.   alias skill_level_process_handling process_handling
  175.   def process_handling
  176.     skill_level_process_handling
  177.     return manual_skill_lvup  if Input.trigger?(SKILL_MAN_LVUP_KEY)
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 执行手动升级
  181.   #--------------------------------------------------------------------------
  182.   def manual_skill_lvup
  183.     if item.manual_lvup? && @actor.can_lv_skill_manually?(item)
  184.       Sound.play_ok
  185.       @actor.gain_skill_exp_manual(item.id)
  186.       refresh
  187.       @skill_level_window.skill = item
  188.     else
  189.       Sound.play_buzzer
  190.     end
  191.     Input.update
  192.   end
  193. end
  194. class Scene_Skill < Scene_ItemBase
  195.   #--------------------------------------------------------------------------
  196.   # ● 场景开始
  197.   #--------------------------------------------------------------------------
  198.   alias skill_level_start start
  199.   def start
  200.     skill_level_start
  201.     create_skill_level_window
  202.     @skill_level_window.z = 200
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 创建技能等级窗口
  206.   #--------------------------------------------------------------------------
  207.   def create_skill_level_window
  208.     y = @help_window.height + 120
  209.     @skill_level_window = Window_SkillLevel.new(Graphics.width/2, y, @actor)
  210.     @item_window.skill_level_window = @skill_level_window
  211.     @skill_level_window.hide
  212.   end
  213. end
复制代码
第2个184行 我去IE怎么把工具栏给吃了……
作者: taroxd    时间: 2015-1-25 16:10
sonicdonggua 发表于 2015-1-24 22:41
第2个184行 我去IE怎么把工具栏给吃了……

在 184 行之前加一句 return unless item 试试看

不保证能解决




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