设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2385|回复: 2
打印 上一主题 下一主题

[已经过期] 技能强化脚本出错啊

[复制链接]

Lv1.梦旅人

梦石
0
星屑
85
在线时间
26 小时
注册时间
2014-12-3
帖子
13
跳转到指定楼层
1
发表于 2014-12-7 11:50:36 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 wy155059181 于 2014-12-7 11:55 编辑

RUBY 代码复制
  1. # -----------------------------------------------------------------------------
  2. # ◆技能升级(SKILL_UP) By.Clov
  3. # -----------------------------------------------------------------------------
  4. # Ver:1.0.0 Date:2012.06.11
  5. # -1.0.0:完整版
  6. # 界面:SceneManager.call(Scene_SUP)
  7. # 角色切换:技能分类栏 L / R
  8. # -----------------------------------------------------------------------------
  9. module SUP
  10. #—————————————————————————————————————————
  11.   #·升级技能关联
  12.   #  技能ID => 升级后技能ID
  13.   UP = {
  14.   26=>27,    # 治愈 → 治愈Ⅱ
  15.   27=>28,    # 治愈Ⅱ → 治愈Ⅲ
  16.   28=>29,    # 治愈Ⅲ → 回复
  17.   29=>30,    # 回复 → 回复Ⅱ
  18.   30=>116,   # 回复Ⅱ → 精灵的叹息
  19.   80=>81,    # 强击 → 横扫
  20.   81=>82,    # 横扫 → 狂战士咆哮
  21.   82=>83,    # 狂战士咆哮 → 狂战士之舞
  22.   83=>84,    # 狂战士之舞 → 巨人的痛击
  23.   51=>52,
  24.   53=>54,
  25.   55=>56,
  26.   57=>58,
  27.   59=>60,
  28.   51=>62,
  29.   108=>109# 巨人的痛击 → 守护神兽:草泥马降临
  30.   }
  31. #—————————————————————————————————————————
  32.   #·各条件“符号”说明
  33.   #  【物品篇】
  34.   #  条件数组头部 :items  :weapons  :armors 符号分别为判断 道具、武器、防具
  35.   #  再在尾部输入物品ID即可
  36.   #  【变量、开关、对比篇】
  37.   #  条件数组尾部 :bit 符号为要显示图片的名字(尺寸24*24)
  38.   #  若省略的话,将不显示图片
  39.   #———————————————————————————————————————
  40.   #·默认条件
  41.   #  技能ID 0 的条件即为默认升级条件
  42.   #  以下4种条件类型都可以设置默认条件
  43.   #———————————————————————————————————————
  44.   #·升级条件-物品【变量消耗( a -= b)】
  45.   #  技能ID => [[:类别符号, 物品ID(a), 消耗数值(b)],[],[]…更多条件…]
  46.   #  例:1 => [[:items, 10,5], [……]]
  47.   IF_ITE = {
  48. 0 => [[:items, 19, 5]],
  49. #0 => [[:items, 34,3]],
  50. 26 => [[:items, 35, 1]],
  51.   27 => [[:items, 35, 2]],
  52.   28 => [[:items, 35, 3]],
  53.   29 => [[:items, 35, 4]],
  54.   30 => [[:items, 35, 5]]
  55.  
  56.  
  57.  
  58. #使用19号道具作为默认升级条件
  59. #升级 回复Ⅱ 需要18号道具1个
  60.    #升级 巨人的痛击
  61.   #需要17号道具1个、62号武器1个、61号防具1个
  62.   }
  63.   #———————————————————————————————————————
  64.   #·升级条件-变量【变量消耗( a -= b)】
  65.   #  技能ID => [["显示文字", "变量连接(a)", 消耗数值(b)],[],[]…更多条件…]
  66.   #  例:1 => [["脚本变量测试","$变量",10], [……]]
  67.   IF_VAR = {
  68.   0 => [["QP点","$game_variables[100]",5]], #使用游戏1号变量作为默认升级条件
  69.   # 恢复技能条件
  70.  
  71.  
  72.   }
  73.   #———————————————————————————————————————
  74.   #·升级条件-开关【开关判断( a == true )】
  75.   #  技能ID => [["显示文字", "开关连接(a)"],[],[]…更多条件…]
  76.   #  例:1 => [["脚本开关测试","$开关"], [……]]
  77.   IF_SWI = {
  78.   0 => [],   #默认升级开关条件
  79.  
  80.   }
  81.   #———————————————————————————————————————
  82.   #·升级条件-比较【比较相等( a == b )】
  83.   #  技能ID => [["显示文字", "比较连接1(a)", "比较连接2(b)"],[],[]…更多条件…]
  84.   #  例:1 => [["脚本比较测试","$比较1","$比较2"], [……]]
  85.   IF_COM = {
  86.   0 => [],   #默认升级对比条件
  87.   }
  88. #—————————————————————————————————————————
  89.   #·积极、消极值槽颜色
  90.   POS_COLOR1 = Color.new(214,233,83,255)
  91.   POS_COLOR2 = Color.new(255,255,255,255)
  92.   NEG_COLOR1 = Color.new(253,80,128,255)
  93.   NEG_COLOR2 = Color.new(255,255,255,255)
  94. #—————————————————————————————————————————
  95.   #·输出评分最大值
  96.   PFX = 9999
  97. #—————————————————————————————————————————
  98.   #·图标存放文件夹
  99.   FILE = "Graphics/Icon/"
  100. #—————————————————————————————————————————
  101.   #·效果范围显示文字
  102.   SCOPE = ["无",
  103.   "单个敌人","全体敌人",
  104.   "一个随机敌人","二个随机敌人","三个随机敌人","四个随机敌人",
  105.   "单个队友","全体队友",
  106.   "单个队友(无法战斗)","全体队友(无法战斗)",
  107.   "使用者"]
  108.   #·使用场合显示文字
  109.   OCCASION = ["随时可用","战斗可用","菜单可用","不可用"]
  110.   #·命中类型显示文字
  111.   HIT_TYPE = ["必定命中","物理攻击","魔法攻击"]
  112.   #·输出类型显示文字
  113.   DAMAGE_TYPE = ["无输出","HP伤害","MP伤害","HP恢复","MP恢复","HP吸收","MP吸收"]
  114. #—————————————————————————————————————————
  115. end
  116.  
  117. #==============================================================================
  118. # ■ SUP_Window_Command
  119. #------------------------------------------------------------------------------
  120. #  技能分类窗口
  121. #==============================================================================
  122.  
  123. class SUP_Window_Command < Window_Command
  124.   #--------------------------------------------------------------------------
  125.   # ● 定义实例变量
  126.   #--------------------------------------------------------------------------
  127.   attr_reader   :skill_window
  128.   #--------------------------------------------------------------------------
  129.   # ● 初始化对象
  130.   #--------------------------------------------------------------------------
  131.   def initialize(x, y)
  132.     super(x, y)
  133.     @actor = nil
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 获取窗口的宽度
  137.   #--------------------------------------------------------------------------
  138.   def window_width
  139.     return 200
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● 设置角色
  143.   #--------------------------------------------------------------------------
  144.   def actor=(actor)
  145.     return if @actor == actor
  146.     @actor = actor
  147.     refresh
  148.     select_last
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● 获取显示行数
  152.   #--------------------------------------------------------------------------
  153.   def visible_line_number
  154.     return 4
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● 生成指令列表
  158.   #--------------------------------------------------------------------------
  159.   def make_command_list
  160.     return unless @actor
  161.     @actor.added_skill_types.sort.each do |stype_id|
  162.       name = $data_system.skill_types[stype_id]
  163.       add_command(name, :skill, true, stype_id)
  164.     end
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 更新画面
  168.   #--------------------------------------------------------------------------
  169.   def update
  170.     super
  171.     @skill_window.stype_id = current_ext if @skill_window
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 设置技能窗口
  175.   #--------------------------------------------------------------------------
  176.   def skill_window=(skill_window)
  177.     @skill_window = skill_window
  178.     update
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ● 返回上一个选择的位置
  182.   #--------------------------------------------------------------------------
  183.   def select_last
  184.     skill = @actor.last_skill.object
  185.     if skill
  186.       select_ext(skill.stype_id)
  187.     else
  188.       select(0)
  189.     end
  190.   end
  191. end
  192.  
  193. #==============================================================================
  194. # ■ SUP_Window_Index
  195. #------------------------------------------------------------------------------
  196. #  技能列表窗口。
  197. #==============================================================================
  198.  
  199. class SUP_Window_Index < Window_Selectable
  200.   #--------------------------------------------------------------------------
  201.   # ● 初始化对象
  202.   #--------------------------------------------------------------------------
  203.   def initialize(x, y, width, height)
  204.     super
  205.     @actor = nil
  206.     @stype_id = 0
  207.     @data = []
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● 设置角色
  211.   #--------------------------------------------------------------------------
  212.   def actor=(actor)
  213.     return if @actor == actor
  214.     @actor = actor
  215.     refresh
  216.     self.oy = 0
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ● 设置技能类型 ID
  220.   #--------------------------------------------------------------------------
  221.   def stype_id=(stype_id)
  222.     return if @stype_id == stype_id
  223.     @stype_id = stype_id
  224.     refresh
  225.     self.oy = 0
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 获取列数
  229.   #--------------------------------------------------------------------------
  230.   def col_max
  231.     return 1
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # ● 获取项目数
  235.   #--------------------------------------------------------------------------
  236.   def item_max
  237.     @data ? @data.size : 1
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # ● 获取技能
  241.   #--------------------------------------------------------------------------
  242.   def item
  243.     @data && index >= 0 ? @data[index] : nil
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● 获取选择项目的有效状态
  247.   #--------------------------------------------------------------------------
  248.   def current_item_enabled?
  249.     enable?(@data[index])
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ● 查询列表中是否含有此技能
  253.   #--------------------------------------------------------------------------
  254.   def include?(item)
  255.     item && item.stype_id == @stype_id
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # ● 查询此技能是否可用
  259.   #--------------------------------------------------------------------------
  260.   def enable?(item)
  261.     item && SUP::UP.has_key?(item.id)
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● 生成技能列表
  265.   #--------------------------------------------------------------------------
  266.   def make_item_list
  267.     @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● 返回上一个选择的位置
  271.   #--------------------------------------------------------------------------
  272.   def select_last
  273.     select(@data.index(@actor.last_skill.object) || 0)
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ● 绘制项目
  277.   #--------------------------------------------------------------------------
  278.   def draw_item(index)
  279.     skill = @data[index]
  280.     if skill
  281.       rect = item_rect(index)
  282.       rect.width -= 4
  283.       draw_item_name(skill, rect.x, rect.y, enable?(skill))
  284.     end
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ● 更新帮助内容
  288.   #--------------------------------------------------------------------------
  289.   def update_help
  290.     @help_window.set_item(item)
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ● 刷新
  294.   #--------------------------------------------------------------------------
  295.   def refresh
  296.     make_item_list
  297.     create_contents
  298.     draw_all_items
  299.   end
  300. end
  301.  
  302. #==============================================================================
  303. # ■ SUP_Window_Info
  304. #------------------------------------------------------------------------------
  305. #  技能信息窗口
  306. #==============================================================================
  307.  
  308. class SUP_Window_Info < Window_Base
  309.   #--------------------------------------------------------------------------
  310.   # ● 初始化对象
  311.   #--------------------------------------------------------------------------
  312.   def initialize(x, y,w,h)
  313.     super(x, y, w, h)
  314.     [url=home.php?mod=space&uid=133944]@w[/url] = w ; @h = h
  315.     @yema = 1
  316.     @actor = nil
  317.     [url=home.php?mod=space&uid=260100]@skill[/url] = nil
  318.     @font_size = 20
  319.     @help_fill_color1 = Color.new(255,255,255,255)
  320.     @help_fill_color2 = Color.new(255,255,255,0)
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 设置角色
  324.   #--------------------------------------------------------------------------
  325.   def actor=(val)
  326.     @actor = val
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ● 取得技能
  330.   #--------------------------------------------------------------------------
  331.   def skill
  332.     @skill
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● 设置技能
  336.   #--------------------------------------------------------------------------
  337.   def skill=(val)
  338.     @skill = val
  339.     huanye(@yema)
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ● 技能是否可升级
  343.   #--------------------------------------------------------------------------
  344.   def skill_up?
  345.     SUP::UP.has_key?(@skill.id)
  346.   end
  347.   #--------------------------------------------------------------------------
  348.   # ● 获得行高
  349.   #--------------------------------------------------------------------------
  350.   def line_height
  351.     @font_size
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● 获得页码
  355.   #--------------------------------------------------------------------------
  356.   def yema
  357.     @yema
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 换页
  361.   #--------------------------------------------------------------------------
  362.   def huanye(y)
  363.     @yema = y
  364.     case @yema
  365.     when 1
  366.     @draw = method(:draw1)
  367.     @help_txt = ["技能状态信息", "升级技能状态信息", "A键换页(1/2)"]
  368.     when 2
  369.     @draw = method(:draw2)
  370.     @help_txt = ["技能数值信息", "升级技能数值信息", "A键换页(2/2)"]
  371.     end
  372.     refresh
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ● 刷新
  376.   #--------------------------------------------------------------------------
  377.   def refresh
  378.     contents.clear
  379.     return if !@skill
  380.     #描绘帮助信息
  381.     contents.font.size = 16
  382.     help
  383.     #描绘技能信息
  384.     contents.font.size = line_height
  385.     #描绘选中的技能
  386.     @draw.call(@skill, 0, line_height)
  387.     #描绘升级后的技能
  388.     if skill_up?
  389.       @draw.call($data_skills[SUP::UP[@skill.id]], 0, line_height * 9)
  390.     else
  391.       draw_text(70, line_height * 9 + 65, 280, line_height,
  392.     "技能已经无法升级。")
  393.     end
  394.   end
  395.   #--------------------------------------------------------------------------
  396.   # ● 描绘帮助条
  397.   #--------------------------------------------------------------------------
  398.   def help
  399.     #第一条
  400.     contents.gradient_fill_rect(0, 0, @w, line_height,
  401.     @help_fill_color1, @help_fill_color2)
  402.     draw_text(2, 0, 280, line_height, @help_txt[0])
  403.     #第二条
  404.     contents.gradient_fill_rect(0, line_height * 8, @w, line_height,
  405.     @help_fill_color1, @help_fill_color2)
  406.     draw_text(2, line_height * 8, 280, line_height, @help_txt[1])
  407.     #换页
  408.     draw_text(225, 0, 280, line_height, @help_txt[2])
  409.   end
  410.   #--------------------------------------------------------------------------
  411.   # ● 描绘页1
  412.   #--------------------------------------------------------------------------
  413.   def draw1(skill,x,y)
  414.     #名称---------------------------------------------
  415.     draw_item_name(skill, x, y)
  416.     #属性---------------------------------------------
  417.     sx = $data_system.elements[skill.damage.element_id]
  418.     sx = sx=="" ? "无" : sx
  419.     draw_text(x, y + line_height, 280, line_height,
  420.     "属性:"+sx)
  421.     #使用场合-----------------------------------------
  422.     draw_text(x, y + line_height * 2, 280, line_height,
  423.     "使用场合:"+SUP::OCCASION[skill.occasion ])
  424.     #使用范围-----------------------------------------
  425.     draw_text(x, y + line_height * 3, 280, line_height,
  426.     "使用范围:"+SUP::SCOPE[skill.scope])
  427.     #命中类型-----------------------------------------
  428.     draw_text(x, y + line_height * 4, 280, line_height,
  429.     "命中类型:"+SUP::HIT_TYPE[skill.hit_type])
  430.     #输出类型-----------------------------------------
  431.     draw_text(x, y + line_height * 5, 280, line_height,
  432.     "输出类型:"+SUP::DAMAGE_TYPE[skill.damage.type])
  433.     #武器限制-----------------------------------------
  434.     w1 = $data_system.weapon_types[skill.required_wtype_id1]
  435.     w2 = $data_system.weapon_types[skill.required_wtype_id2]
  436.     w = "无武器限制" ; if w1 !="";w=w1;end ; if w2 != "";w+="与"+w2;end
  437.     draw_text(x, y + line_height * 6, 280, line_height,
  438.     "武器限制:"+w)
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● 描绘页2
  442.   #--------------------------------------------------------------------------
  443.   def draw2(skill,x,y)
  444.     #名称---------------------------------------------
  445.     draw_item_name(skill, x, y)
  446.     #魔力值消耗---------------------------------------
  447.     draw_text(x, y + line_height, 280, line_height,
  448.     "魔力值消耗:")
  449.     w = 200 ; h = 15
  450.     b = skill.mp_cost.to_f / 9999
  451.     c1 = Color.new(128,155,122,255)
  452.     c2 = Color.new(25,55,155,255)
  453.     flii(x+120, y + line_height + 3, w, h, b, SUP::NEG_COLOR1, SUP::NEG_COLOR2)
  454.     draw_current_and_max_values(x+40, y + line_height, 280, skill.mp_cost, 9999,
  455.     text_color(0), text_color(0))
  456.     #特技值消耗---------------------------------------
  457.     draw_text(x, y + line_height * 2, 280, line_height,
  458.     "特技值消耗:")
  459.     w = 200 ; h = 15
  460.     b = skill.tp_cost.to_f / 100
  461.     flii(x+120, y + line_height * 2 + 3, w, h, b, SUP::NEG_COLOR1, SUP::NEG_COLOR2)
  462.     draw_current_and_max_values(x+40, y + line_height * 2, 280, skill.tp_cost, 100,
  463.     text_color(0), text_color(0))
  464.     #特技值获得---------------------------------------
  465.     draw_text(x, y + line_height * 3, 280, line_height,
  466.     "特技值获得:")
  467.     w = 200 ; h = 15
  468.     b = skill.tp_gain.to_f / 100
  469.     flii(x+120, y + line_height * 3 + 3, w, h, b, SUP::POS_COLOR1, SUP::POS_COLOR2)
  470.     draw_current_and_max_values(x+40, y + line_height * 3, 280, skill.tp_gain, 100,
  471.     text_color(0), text_color(0))
  472.     #攻击次数-----------------------------------------
  473.     draw_text(x, y + line_height * 4, 280, line_height,
  474.     "攻击次数:")
  475.     w = 200 ; h = 15
  476.     b = skill.repeats.to_f / 9
  477.     flii(x+120, y + line_height * 4 + 3, w, h, b, SUP::POS_COLOR1, SUP::POS_COLOR2)
  478.     draw_current_and_max_values(x+40, y + line_height * 4, 280, skill.repeats, 9,
  479.     text_color(0), text_color(0))
  480.     #成功几率-----------------------------------------
  481.     draw_text(x, y + line_height * 5, 280, line_height,
  482.     "成功几率:")
  483.     w = 200 ; h = 15
  484.     b = skill.success_rate.to_f / 100
  485.     flii(x+120, y + line_height * 5 + 3, w, h, b, SUP::POS_COLOR1, SUP::POS_COLOR2)
  486.     draw_current_and_max_values(x+40, y + line_height * 5, 280, skill.success_rate, 100,
  487.     text_color(0), text_color(0))
  488.     #输出评分-----------------------------------------
  489.     draw_text(x, y + line_height * 6, 280, line_height,
  490.     "输出评分:")
  491.     pf = scpf(skill)
  492.     w = 200 ; h = 15
  493.     b = [pf.to_f / SUP::PFX, 1.0].min
  494.     type = skill.damage.type
  495.     case type
  496.     when 0
  497.       draw_text(x+150, y + line_height * 6, 280, line_height,
  498.     "此技能没有输出。")
  499.     when 1, 2, 5, 6
  500.       flii(x+120, y + line_height * 6 + 3, w, h, b, SUP::NEG_COLOR1, SUP::NEG_COLOR2)
  501.       draw_current_and_max_values(x+40, y + line_height * 6, 280, pf, SUP::PFX,
  502.       text_color(0), text_color(0))
  503.     when 3, 4
  504.       flii(x+120, y + line_height * 6 + 3, w, h, b, SUP::POS_COLOR1, SUP::POS_COLOR2)
  505.       draw_current_and_max_values(x+40, y + line_height * 6, 280, pf, SUP::PFX,
  506.       text_color(0), text_color(0))
  507.     end
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # ● 描绘值槽
  511.   #--------------------------------------------------------------------------
  512.   def flii(x, y, w, h, b, color1, color2)
  513.     contents.fill_rect(x, y, w, h, Color.new(0,0,0,64))
  514.     contents.gradient_fill_rect(x, y, w*b, h, color1, color2)
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # ● 获得评分
  518.   #--------------------------------------------------------------------------
  519.   def scpf(skill)
  520.     g = skill.damage.formula.to_s
  521.     a = @actor
  522.     v = $game_variables
  523.     g.gsub!(/b/,"a")
  524.     return eval(g)
  525.   end
  526. end
  527.  
  528. #==============================================================================
  529. # ■ SUP_Window_Choice
  530. #------------------------------------------------------------------------------
  531. #  技能升级条件及确认窗口
  532. #==============================================================================
  533.  
  534. class SUP_Window_Choice < Window_Command
  535.   #--------------------------------------------------------------------------
  536.   # ● 初始化对象
  537.   #--------------------------------------------------------------------------
  538.   def initialize(x, y)
  539.     @hx = -1
  540.     super(x, y)
  541.     @skill = nil
  542.     @actor = nil
  543.     @enabled = []
  544.     @txt = []
  545.     @ite = []
  546.     @pic = []
  547.     @xh = []
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # ● 设置角色
  551.   #--------------------------------------------------------------------------
  552.   def actor=(val)
  553.     @actor = val
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● 取得技能
  557.   #--------------------------------------------------------------------------
  558.   def skill
  559.     @skill
  560.   end
  561.   #--------------------------------------------------------------------------
  562.   # ● 设置技能
  563.   #--------------------------------------------------------------------------
  564.   def skill=(val)
  565.     @skill = val
  566.     refresh_draw
  567.   end
  568.   #--------------------------------------------------------------------------
  569.   # ● 取得全部指定条件
  570.   #--------------------------------------------------------------------------
  571.   def all_if(skill_id)
  572.     arr = Array.new
  573.     arr << SUP::IF_ITE[skill_id]
  574.     arr << SUP::IF_VAR[skill_id]
  575.     arr << SUP::IF_SWI[skill_id]
  576.     arr << SUP::IF_COM[skill_id]
  577.   end
  578.   #--------------------------------------------------------------------------
  579.   # ● 获取全部条件有效状态
  580.   #--------------------------------------------------------------------------
  581.   def all_enabled?
  582.     !@enabled.include?(false)
  583.   end
  584.   #--------------------------------------------------------------------------
  585.   # ● 获取物品、变量条件有效状态
  586.   #--------------------------------------------------------------------------
  587.   def ite_var_enabled?(y, s)
  588.     return false if not y
  589.     y >= s
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   # ● 获取开关条件有效状态
  593.   #--------------------------------------------------------------------------
  594.   def swi_enabled?(y)
  595.     y
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # ● 获取对比条件有效状态
  599.   #--------------------------------------------------------------------------
  600.   def com_enabled?(y1, y2)
  601.     y1 == y2
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # ● 技能升级条件数据
  605.   #--------------------------------------------------------------------------
  606.   def skill_data
  607.     return if !@skill
  608.     @hx = -1 ; @enabled = [] ; @txt = [] ; @pic = [] ; @pid = [] ; @xh = []
  609.     l = all_if(@skill.id) ; n = l.compact
  610.     t = n == [] ? all_if(0) : l
  611.     t1 = t[0] ; t2 = t[1] ; t3 = t[2] ; t4 = t[3]
  612.     if t1
  613.       ite_data(t1)
  614.     end
  615.     if t2
  616.       var_data(t2)
  617.     end
  618.     if t3
  619.       swi_data(t3)
  620.     end
  621.     if t4
  622.       com_data(t4)
  623.     end
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # ● 技能条件进行描绘
  627.   #--------------------------------------------------------------------------
  628.   def skill_draw
  629.     @txt.each_with_index {|txt,i|
  630.     change_color(normal_color, @enabled[i])
  631.     pic = @pic[i]
  632.     if pic.is_a?(Symbol)
  633.       wx = window_width / 2 - text_size(txt).width / 2 - 24
  634.       if pic == :ite
  635.         draw_item_icon(@ite[i], wx, item_height * i)
  636.       else
  637.         draw_bit(pic.to_s, wx, item_height * i)
  638.       end
  639.     end
  640.     draw_text(0, item_height * i, window_width, item_height, txt, 1)
  641.     }
  642.   end
  643.   #--------------------------------------------------------------------------
  644.   # ● 绘制物品图标
  645.   #--------------------------------------------------------------------------
  646.   def draw_item_icon(item, x, y)
  647.     draw_icon(item.icon_index, x, y)
  648.   end
  649.   #--------------------------------------------------------------------------
  650.   # ● 绘制图片
  651.   #--------------------------------------------------------------------------
  652.   def draw_bit(name, x, y)
  653.     bitmap = Bitmap.new(SUP::FILE + name)
  654.     rect = Rect.new(0, 0, 24, 24)
  655.     contents.blt(x, y, bitmap, rect)
  656.   end
  657.   #--------------------------------------------------------------------------
  658.   # ● 对技能进行升级(变量、物品消耗)
  659.   #--------------------------------------------------------------------------
  660.   def skill_up
  661.     @actor.forget_skill(@skill.id)
  662.     @actor.learn_skill(SUP::UP[@skill.id])
  663.     @xh.each_with_index {|x, i|
  664.     if x.is_a?(String)
  665.       eval(x)
  666.     else
  667.       $game_party.gain_item(@ite[i], -x)
  668.     end}
  669.   end
  670.   #--------------------------------------------------------------------------
  671.   # ● 物品条件 数据
  672.   #--------------------------------------------------------------------------
  673.   def ite_data(si)
  674.     si.each {|i|
  675.     @hx += 1 ; t = i[0] ; b = i[1] ; s = i[2]
  676.     case t
  677.     when :items
  678.       item = $data_items[b]
  679.     when :weapons
  680.       item = $data_weapons[b]
  681.     when :armors
  682.       item = $data_armors[b]
  683.     end
  684.     y = $game_party.item_number(item)
  685.     enabled = ite_var_enabled?(y, s)
  686.     @enabled[@hx] = enabled
  687.     @txt[@hx] = item.name+"*"+ s.to_s
  688.     @ite[@hx] = item
  689.     @pic[@hx] = :ite
  690.     @xh[@hx] = s
  691.     }
  692.   end
  693.   #--------------------------------------------------------------------------
  694.   # ● 变量条件 数据
  695.   #--------------------------------------------------------------------------
  696.   def var_data(si)
  697.     si.each {|i|
  698.     @hx += 1 ; n = i[0] ; y = eval(i[1]) ; s = i[2]
  699.     enabled = ite_var_enabled?(y, s)
  700.     @enabled[@hx] = enabled
  701.     @txt[@hx] = n+"*"+ s.to_s
  702.     @pic[@hx] = i[-1]
  703.     @xh[@hx] = "#{i[1]} -= #{s.to_s}"
  704.     }
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # ● 开关条件 数据
  708.   #--------------------------------------------------------------------------
  709.   def swi_data(si)
  710.     si.each {|i|
  711.     @hx += 1 ; n = i[0] ; y = eval(i[1])
  712.     enabled = swi_enabled?(y)
  713.     @enabled[@hx] = enabled
  714.     @txt[@hx] = n
  715.     @pic[@hx] = i[-1]
  716.     }
  717.   end
  718.   #--------------------------------------------------------------------------
  719.   # ● 对比条件 数据
  720.   #--------------------------------------------------------------------------
  721.   def com_data(si)
  722.     si.each {|i|
  723.     @hx += 1 ; n = i[0] ; y1 = eval(i[1]) ; y2 = eval(i[2])
  724.     enabled = com_enabled?(y1,y2)
  725.     @enabled[@hx] = enabled
  726.     @txt[@hx] = n
  727.     @pic[@hx] = i[-1]
  728.     }
  729.   end
  730.   #--------------------------------------------------------------------------
  731.   # ● 获取窗口的宽度
  732.   #--------------------------------------------------------------------------
  733.   def window_width
  734.     return 300
  735.   end
  736.   #--------------------------------------------------------------------------
  737.   # ● 获取项目的高度
  738.   #--------------------------------------------------------------------------
  739.   def item_height
  740.     return 28
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ● 获取对齐方向
  744.   #--------------------------------------------------------------------------
  745.   def alignment
  746.     return 1
  747.   end
  748.   #--------------------------------------------------------------------------
  749.   # ● 获取项目的绘制矩形
  750.   #--------------------------------------------------------------------------
  751.   alias x_item_rect item_rect
  752.   def item_rect(index)
  753.     rect = x_item_rect(index)
  754.     rect.y = rect.y + item_height * (@hx+1)
  755.     rect
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # ● 刷新(清除内容)
  759.   #--------------------------------------------------------------------------
  760.   def refresh
  761.     contents.clear
  762.   end
  763.   #--------------------------------------------------------------------------
  764.   # ● 刷新(取得数据、刷新窗口)
  765.   #--------------------------------------------------------------------------
  766.   def refresh2
  767.     skill_data
  768.     self.height = item_height * (@hx+3)
  769.     self.x = Graphics.width / 2 - window_width / 2
  770.     self.y = Graphics.height / 2 - self.height / 2
  771.     create_contents
  772.   end
  773.   #--------------------------------------------------------------------------
  774.   # ● 刷新(要描绘的内容)
  775.   #--------------------------------------------------------------------------
  776.   def refresh_draw
  777.     refresh
  778.     refresh2
  779.     skill_draw
  780.     clear_command_list
  781.     add_command("确认",   :ok, all_enabled?)
  782.     draw_all_items
  783.   end
  784. end
  785.  
  786. #==============================================================================
  787. # ■ Scene_SUP
  788. #------------------------------------------------------------------------------
  789. #  技能升级画面
  790. #==============================================================================
  791.  
  792. class Scene_SUP < Scene_MenuBase
  793.   #--------------------------------------------------------------------------
  794.   # ● 开始处理
  795.   #--------------------------------------------------------------------------
  796.   def start
  797.     super
  798.     create_help_window
  799.     suv_window_command
  800.     suv_window_info
  801.     suv_window_index
  802.     suv_window_choice
  803.   end
  804.   #--------------------------------------------------------------------------
  805.   # ● 帧更新
  806.   #--------------------------------------------------------------------------
  807.   def update
  808.     super
  809.     if Input.trigger?(:X)
  810.       case @suv_window_info.yema
  811.       when 1
  812.         @suv_window_info.huanye(2)
  813.       when 2
  814.         @suv_window_info.huanye(1)
  815.       end
  816.     end
  817.     if @suv_window_info.skill != @suv_window_index.item
  818.       @suv_window_info.skill = @suv_window_index.item
  819.     end
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # ● 生成确认窗口
  823.   #--------------------------------------------------------------------------
  824.   def suv_window_choice
  825.     @suv_window_choice = SUP_Window_Choice.new(0, 0)
  826.     @suv_window_choice.viewport = @viewport
  827.     @suv_window_choice.set_handler(:ok,    method(:confirm_ok))
  828.     @suv_window_choice.set_handler(:cancel,   method(:confirm_cancel))
  829.     @suv_window_choice.hide.deactivate
  830.     @suv_window_choice.actor = @actor
  831.   end
  832.   #--------------------------------------------------------------------------
  833.   # ● 生成分类窗口
  834.   #--------------------------------------------------------------------------
  835.   def suv_window_command
  836.     wy = @help_window.height
  837.     @suv_window_command = SUP_Window_Command.new(0, wy)
  838.     @suv_window_command.viewport = @viewport
  839.     @suv_window_command.help_window = @help_window
  840.     @suv_window_command.actor = @actor
  841.     @suv_window_command.set_handler(:skill,    method(:command_skill))
  842.     @suv_window_command.set_handler(:cancel,   method(:return_scene))
  843.     @suv_window_command.set_handler(:pagedown, method(:next_actor))
  844.     @suv_window_command.set_handler(:pageup,   method(:prev_actor))
  845.   end
  846.   #--------------------------------------------------------------------------
  847.   # ● 生成状态窗口
  848.   #--------------------------------------------------------------------------
  849.   def suv_window_info
  850.     y = @help_window.height
  851.     w = Graphics.width - @suv_window_command.width
  852.     h = Graphics.height - @help_window.height
  853.     @suv_window_info = SUP_Window_Info.new(@suv_window_command.width, y, w, h)
  854.     @suv_window_info.viewport = @viewport
  855.     @suv_window_info.actor = @actor
  856.   end
  857.   #--------------------------------------------------------------------------
  858.   # ● 生成列表窗口
  859.   #--------------------------------------------------------------------------
  860.   def suv_window_index
  861.     wx = 0
  862.     wy = @suv_window_command.y + @suv_window_command.height
  863.     ww = Graphics.width - @suv_window_info.width
  864.     wh = Graphics.height - wy
  865.     @suv_window_index = SUP_Window_Index.new(wx, wy, ww, wh)
  866.     @suv_window_index.actor = @actor
  867.     @suv_window_index.viewport = @viewport
  868.     @suv_window_index.help_window = @help_window
  869.     @suv_window_index.set_handler(:ok,     method(:on_item_ok))
  870.     @suv_window_index.set_handler(:cancel, method(:on_item_cancel))
  871.     @suv_window_command.skill_window = @suv_window_index
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   # ● 技能分类里“确定”
  875.   #--------------------------------------------------------------------------
  876.   def command_skill
  877.     @suv_window_index.activate
  878.     @suv_window_index.select_last
  879.   end
  880.   #--------------------------------------------------------------------------
  881.   # ● 技能列表里“确定”
  882.   #--------------------------------------------------------------------------
  883.   def on_item_ok
  884.     skill = @suv_window_index.item
  885.     @suv_window_choice.skill = skill
  886.     @suv_window_choice.show.activate
  887.   end
  888.   #--------------------------------------------------------------------------
  889.   # ● 技能列表里“返回”
  890.   #--------------------------------------------------------------------------
  891.   def on_item_cancel
  892.     @suv_window_index.unselect
  893.     @suv_window_command.activate
  894.   end
  895.   #--------------------------------------------------------------------------
  896.   # ● 确认列表里“确认”
  897.   #--------------------------------------------------------------------------
  898.   def confirm_ok
  899.     @suv_window_choice.skill_up
  900.     @suv_window_index.refresh
  901.     @suv_window_choice.hide.deactivate
  902.     @suv_window_index.activate
  903.   end
  904.   #--------------------------------------------------------------------------
  905.   # ● 确认列表里“返回”
  906.   #--------------------------------------------------------------------------
  907.   def confirm_cancel
  908.     @suv_window_choice.hide.deactivate
  909.     @suv_window_index.activate
  910.   end
  911.   #--------------------------------------------------------------------------
  912.   # ● 切换角色
  913.   #--------------------------------------------------------------------------
  914.   def on_actor_change
  915.     @suv_window_command.actor = @actor
  916.     @suv_window_info.actor = @actor
  917.     @suv_window_index.actor = @actor
  918.     @suv_window_choice.actor = @actor
  919.     @suv_window_command.activate
  920.   end
  921. end

图2.jpg (17.55 KB, 下载次数: 17)

图2.jpg

Lv2.观梦者

梦石
0
星屑
599
在线时间
333 小时
注册时间
2011-11-19
帖子
194
2
发表于 2014-12-7 16:02:27 | 只看该作者
建议先仔细检查一下脚本前部分填写的升级要求,看看格式以及是不是用了中文符号而不是英文……
支持《彼岸之光》系列!加油!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
85
在线时间
26 小时
注册时间
2014-12-3
帖子
13
3
 楼主| 发表于 2014-12-7 17:22:53 | 只看该作者
q854240045 发表于 2014-12-7 16:02
建议先仔细检查一下脚本前部分填写的升级要求,看看格式以及是不是用了中文符号而不是英文…… ...

升级要求都是正确的 因为我用技能强化范例脚本是正常的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-15 08:58

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表