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

Project1

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

[结贴] 求给一个脚本增加显示备注内容的功能

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2323
在线时间
274 小时
注册时间
2017-7-25
帖子
163
跳转到指定楼层
1
发表于 2020-11-12 19:59:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 骷髅岛遗老 于 2020-11-19 18:21 编辑
  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.   84=>127,    # 巨人的痛击 → 守护神兽:羊驼降临
  24.   }
  25. #—————————————————————————————————————————
  26.   #·各条件“符号”说明
  27.   #  【物品篇】
  28.   #  条件数组头部 :items  :weapons  :armors 符号分别为判断 道具、武器、防具
  29.   #  再在尾部输入物品ID即可
  30.   #  【变量、开关、对比篇】
  31.   #  条件数组尾部 :bit 符号为要显示图片的名字(尺寸24*24)
  32.   #  若省略的话,将不显示图片
  33.   #———————————————————————————————————————
  34.   #·默认条件
  35.   #  技能ID 0 的条件即为默认升级条件
  36.   #  以下4种条件类型都可以设置默认条件
  37.   #———————————————————————————————————————
  38.   #·升级条件-物品【变量消耗( a -= b)】
  39.   #  技能ID => [[:类别符号, 物品ID(a), 消耗数值(b)],[],[]…更多条件…]
  40.   #  例:1 => [[:items, 10,5], [……]]
  41.   IF_ITE = {
  42.   0 => [[:items, 19, 5]], #使用19号道具作为默认升级条件
  43.   30 => [[:items, 18, 1]], #升级 回复Ⅱ 需要18号道具1个
  44.   84 => [[:items, 17, 1],[:weapons, 62, 1],[:armors, 61, 1]] #升级 巨人的痛击
  45.   #需要17号道具1个、62号武器1个、61号防具1个
  46.   }
  47.   #———————————————————————————————————————
  48.   #·升级条件-变量【变量消耗( a -= b)】
  49.   #  技能ID => [["显示文字", "变量连接(a)", 消耗数值(b)],[],[]…更多条件…]
  50.   #  例:1 => [["脚本变量测试","$变量",10], [……]]
  51.   IF_VAR = {
  52.   0 => [["蓝宝石碎片","$game_variables[100]",5]], #使用游戏1号变量作为默认升级条件
  53.   # 恢复技能条件
  54.   28 => [["生命之光","$game_variables[1]",10]], #升级 治愈Ⅲ 需要消耗变量1 10数值
  55.   29 => [["生命之光","$game_variables[1]",20]], #升级 回复 需要消耗变量1 20数值
  56.   30 => [["生命之光","$game_variables[1]",50]], #升级 回复Ⅱ 需要消耗变量1 50数值
  57.   # 伤害技能条件
  58.   82 => [["力量之光","$game_variables[2]",10]], #升级 狂战士咆哮 需要消耗变量2 50数值
  59.   83 => [["力量之光","$game_variables[2]",20]], #升级 狂战士之舞 需要消耗变量2 50数值
  60.   84 => [["力量之光","$game_variables[2]",50], #升级 巨人的痛击 需要消耗变量2 50数值
  61.   ["巨大的蓝宝石","$game_variables[3]",10]] #升级 巨人的痛击 需要消耗变量3 10数值
  62.   }
  63.   #———————————————————————————————————————
  64.   #·升级条件-开关【开关判断( a == true )】
  65.   #  技能ID => [["显示文字", "开关连接(a)"],[],[]…更多条件…]
  66.   #  例:1 => [["脚本开关测试","$开关"], [……]]
  67.   IF_SWI = {
  68.   0 => [],   #默认升级开关条件
  69.   30 => [["获得好人卡","$好人卡",:好人卡]], #升级 回复Ⅱ 需要 $好人卡 为true
  70.   84 => [["作者允许羊驼降临","$羊驼降临",:羊驼]] #升级 巨人的痛击 需要 $羊驼降临 为true
  71.   }
  72.   #———————————————————————————————————————
  73.   #·升级条件-比较【比较相等( a == b )】
  74.   #  技能ID => [["显示文字", "比较连接1(a)", "比较连接2(b)"],[],[]…更多条件…]
  75.   #  例:1 => [["脚本比较测试","$比较1","$比较2"], [……]]
  76.   IF_COM = {
  77.   0 => [],   #默认升级对比条件
  78.   }
  79. #—————————————————————————————————————————
  80.   #·积极、消极值槽颜色
  81.   POS_COLOR1 = Color.new(214,233,83,255)
  82.   POS_COLOR2 = Color.new(255,255,255,255)
  83.   NEG_COLOR1 = Color.new(253,80,128,255)
  84.   NEG_COLOR2 = Color.new(255,255,255,255)
  85. #—————————————————————————————————————————
  86.   #·输出评分最大值
  87.   PFX = 9999999999999999
  88. #—————————————————————————————————————————
  89.   #·图标存放文件夹
  90.   FILE = "Graphics/Icon/"
  91. #—————————————————————————————————————————
  92.   #·效果范围显示文字
  93.   SCOPE = ["无",
  94.   "单个敌人","全体敌人",
  95.   "一个随机敌人","二个随机敌人","三个随机敌人","四个随机敌人",
  96.   "单个队友","全体队友",
  97.   "单个队友(无法战斗)","全体队友(无法战斗)",
  98.   "使用者"]
  99.   #·使用场合显示文字
  100.   OCCASION = ["随时可用","战斗可用","菜单可用","不可用"]
  101.   #·命中类型显示文字
  102.   HIT_TYPE = ["必定命中","物理攻击","魔法攻击"]
  103.   #·输出类型显示文字
  104.   DAMAGE_TYPE = ["无输出","HP伤害","MP伤害","HP恢复","MP恢复","HP吸收","MP吸收"]
  105. #—————————————————————————————————————————
  106. end

  107. #==============================================================================
  108. # ■ SUP_Window_Command
  109. #------------------------------------------------------------------------------
  110. #  技能分类窗口
  111. #==============================================================================

  112. class SUP_Window_Command < Window_Command
  113.   #--------------------------------------------------------------------------
  114.   # ● 定义实例变量
  115.   #--------------------------------------------------------------------------
  116.   attr_reader   :skill_window
  117.   #--------------------------------------------------------------------------
  118.   # ● 初始化对象
  119.   #--------------------------------------------------------------------------
  120.   def initialize(x, y)
  121.     super(x, y)
  122.     @actor = nil
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 获取窗口的宽度
  126.   #--------------------------------------------------------------------------
  127.   def window_width
  128.     return 200
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 设置角色
  132.   #--------------------------------------------------------------------------
  133.   def actor=(actor)
  134.     return if @actor == actor
  135.     @actor = actor
  136.     refresh
  137.     select_last
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 获取显示行数
  141.   #--------------------------------------------------------------------------
  142.   def visible_line_number
  143.     return 4
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 生成指令列表
  147.   #--------------------------------------------------------------------------
  148.   def make_command_list
  149.     return unless @actor
  150.     @actor.added_skill_types.sort.each do |stype_id|
  151.       name = $data_system.skill_types[stype_id]
  152.       add_command(name, :skill, true, stype_id)
  153.     end
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 更新画面
  157.   #--------------------------------------------------------------------------
  158.   def update
  159.     super
  160.     @skill_window.stype_id = current_ext if @skill_window
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● 设置技能窗口
  164.   #--------------------------------------------------------------------------
  165.   def skill_window=(skill_window)
  166.     @skill_window = skill_window
  167.     update
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● 返回上一个选择的位置
  171.   #--------------------------------------------------------------------------
  172.   def select_last
  173.     skill = @actor.last_skill.object
  174.     if skill
  175.       select_ext(skill.stype_id)
  176.     else
  177.       select(0)
  178.     end
  179.   end
  180. end

  181. #==============================================================================
  182. # ■ SUP_Window_Index
  183. #------------------------------------------------------------------------------
  184. #  技能列表窗口。
  185. #==============================================================================

  186. class SUP_Window_Index < Window_Selectable
  187.   #--------------------------------------------------------------------------
  188.   # ● 初始化对象
  189.   #--------------------------------------------------------------------------
  190.   def initialize(x, y, width, height)
  191.     super
  192.     @actor = nil
  193.     @stype_id = 0
  194.     @data = []
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 设置角色
  198.   #--------------------------------------------------------------------------
  199.   def actor=(actor)
  200.     return if @actor == actor
  201.     @actor = actor
  202.     refresh
  203.     self.oy = 0
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● 设置技能类型 ID
  207.   #--------------------------------------------------------------------------
  208.   def stype_id=(stype_id)
  209.     return if @stype_id == stype_id
  210.     @stype_id = stype_id
  211.     refresh
  212.     self.oy = 0
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 获取列数
  216.   #--------------------------------------------------------------------------
  217.   def col_max
  218.     return 1
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # ● 获取项目数
  222.   #--------------------------------------------------------------------------
  223.   def item_max
  224.     @data ? @data.size : 1
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● 获取技能
  228.   #--------------------------------------------------------------------------
  229.   def item
  230.     @data && index >= 0 ? @data[index] : nil
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   # ● 获取选择项目的有效状态
  234.   #--------------------------------------------------------------------------
  235.   def current_item_enabled?
  236.     enable?(@data[index])
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● 查询列表中是否含有此技能
  240.   #--------------------------------------------------------------------------
  241.   def include?(item)
  242.     item && item.stype_id == @stype_id
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ● 查询此技能是否可用
  246.   #--------------------------------------------------------------------------
  247.   def enable?(item)
  248.     item && SUP::UP.has_key?(item.id)
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ● 生成技能列表
  252.   #--------------------------------------------------------------------------
  253.   def make_item_list
  254.     @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # ● 返回上一个选择的位置
  258.   #--------------------------------------------------------------------------
  259.   def select_last
  260.     select(@data.index(@actor.last_skill.object) || 0)
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 绘制项目
  264.   #--------------------------------------------------------------------------
  265.   def draw_item(index)
  266.     skill = @data[index]
  267.     if skill
  268.       rect = item_rect(index)
  269.       rect.width -= 4
  270.       draw_item_name(skill, rect.x, rect.y, enable?(skill))
  271.     end
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● 更新帮助内容
  275.   #--------------------------------------------------------------------------
  276.   def update_help
  277.     @help_window.set_item(item)
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # ● 刷新
  281.   #--------------------------------------------------------------------------
  282.   def refresh
  283.     make_item_list
  284.     create_contents
  285.     draw_all_items
  286.   end
  287. end

  288. #==============================================================================
  289. # ■ SUP_Window_Info
  290. #------------------------------------------------------------------------------
  291. #  技能信息窗口
  292. #==============================================================================

  293. class SUP_Window_Info < Window_Base
  294.   #--------------------------------------------------------------------------
  295.   # ● 初始化对象
  296.   #--------------------------------------------------------------------------
  297.   def initialize(x, y,w,h)
  298.     super(x, y, w, h)
  299.     @w = w ; @h = h
  300.     @yema = 1
  301.     @actor = nil
  302.     @skill = nil
  303.     @font_size = 20
  304.     @help_fill_color1 = Color.new(255,255,255,255)
  305.     @help_fill_color2 = Color.new(255,255,255,0)
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ● 设置角色
  309.   #--------------------------------------------------------------------------
  310.   def actor=(val)
  311.     @actor = val
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # ● 取得技能
  315.   #--------------------------------------------------------------------------
  316.   def skill
  317.     @skill
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ● 设置技能
  321.   #--------------------------------------------------------------------------
  322.   def skill=(val)
  323.     @skill = val
  324.     huanye(@yema)
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● 技能是否可升级
  328.   #--------------------------------------------------------------------------
  329.   def skill_up?
  330.     SUP::UP.has_key?(@skill.id)
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● 获得行高
  334.   #--------------------------------------------------------------------------
  335.   def line_height
  336.     @font_size
  337.   end
  338.   #--------------------------------------------------------------------------
  339.   # ● 获得页码
  340.   #--------------------------------------------------------------------------
  341.   def yema
  342.     @yema
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 换页
  346.   #--------------------------------------------------------------------------
  347.   def huanye(y)
  348.     @yema = y
  349.     case @yema
  350.     when 1
  351.     @draw = method(:draw1)
  352.     @help_txt = ["技能状态信息", "升级技能状态信息", "A键换页(1/2)"]
  353.     when 2
  354.     @draw = method(:draw2)
  355.     @help_txt = ["技能数值信息", "升级技能数值信息", "A键换页(2/2)"]
  356.     end
  357.     refresh
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 刷新
  361.   #--------------------------------------------------------------------------
  362.   def refresh
  363.     contents.clear
  364.     return if !@skill
  365.     #描绘帮助信息
  366.     contents.font.size = 16
  367.     help
  368.     #描绘技能信息
  369.     contents.font.size = line_height
  370.     #描绘选中的技能
  371.     @draw.call(@skill, 0, line_height)
  372.     #描绘升级后的技能
  373.     if skill_up?
  374.       @draw.call($data_skills[SUP::UP[@skill.id]], 0, line_height * 9)
  375.     else
  376.       draw_text(70, line_height * 9 + 65, 280, line_height,
  377.     "技能已经无法升级。")
  378.     end
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 描绘帮助条
  382.   #--------------------------------------------------------------------------
  383.   def help
  384.     #第一条
  385.     contents.gradient_fill_rect(0, 0, @w, line_height,
  386.     @help_fill_color1, @help_fill_color2)
  387.     draw_text(2, 0, 280, line_height, @help_txt[0])
  388.     #第二条
  389.     contents.gradient_fill_rect(0, line_height * 8, @w, line_height,
  390.     @help_fill_color1, @help_fill_color2)
  391.     draw_text(2, line_height * 8, 280, line_height, @help_txt[1])
  392.     #换页
  393.     draw_text(225, 0, 280, line_height, @help_txt[2])
  394.   end
  395.   #--------------------------------------------------------------------------
  396.   # ● 描绘页1
  397.   #--------------------------------------------------------------------------
  398.   def draw1(skill,x,y)
  399.     #名称---------------------------------------------
  400.     draw_item_name(skill, x, y)
  401.     #属性---------------------------------------------
  402.     sx = $data_system.elements[skill.damage.element_id]
  403.     sx = sx=="" ? "无" : sx
  404.     draw_text(x, y + line_height, 280, line_height,
  405.     "属性:"+sx)
  406.     #使用场合-----------------------------------------
  407.     draw_text(x, y + line_height * 2, 280, line_height,
  408.     "使用场合:"+SUP::OCCASION[skill.occasion ])
  409.     #使用范围-----------------------------------------
  410.     draw_text(x, y + line_height * 3, 280, line_height,
  411.     "使用范围:"+SUP::SCOPE[skill.scope])
  412.     #命中类型-----------------------------------------
  413.     draw_text(x, y + line_height * 4, 280, line_height,
  414.     "命中类型:"+SUP::HIT_TYPE[skill.hit_type])
  415.     #输出类型-----------------------------------------
  416.     draw_text(x, y + line_height * 5, 280, line_height,
  417.     "输出类型:"+SUP::DAMAGE_TYPE[skill.damage.type])
  418.     #武器限制-----------------------------------------
  419.     w1 = $data_system.weapon_types[skill.required_wtype_id1]
  420.     w2 = $data_system.weapon_types[skill.required_wtype_id2]
  421.     w = "无武器限制" ; if w1 !="";w=w1;end ; if w2 != "";w+="与"+w2;end
  422.     draw_text(x, y + line_height * 6, 280, line_height,
  423.     "武器限制:"+w)
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● 描绘页2
  427.   #--------------------------------------------------------------------------
  428.   def draw2(skill,x,y)
  429.     #名称---------------------------------------------
  430.     draw_item_name(skill, x, y)
  431.     #魔力值消耗---------------------------------------
  432.     draw_text(x, y + line_height, 280, line_height,
  433.     "魔力值消耗:")
  434.     w = 200 ; h = 15
  435.     b = skill.mp_cost.to_f / 9999
  436.     c1 = Color.new(128,155,122,255)
  437.     c2 = Color.new(25,55,155,255)
  438.     flii(x+120, y + line_height + 3, w, h, b, SUP::NEG_COLOR1, SUP::NEG_COLOR2)
  439.     draw_current_and_max_values(x+40, y + line_height, 280, skill.mp_cost, 9999,
  440.     text_color(0), text_color(0))
  441.     #特技值消耗---------------------------------------
  442.     draw_text(x, y + line_height * 2, 280, line_height,
  443.     "特技值消耗:")
  444.     w = 200 ; h = 15
  445.     b = skill.tp_cost.to_f / 100
  446.     flii(x+120, y + line_height * 2 + 3, w, h, b, SUP::NEG_COLOR1, SUP::NEG_COLOR2)
  447.     draw_current_and_max_values(x+40, y + line_height * 2, 280, skill.tp_cost, 100,
  448.     text_color(0), text_color(0))
  449.     #特技值获得---------------------------------------
  450.     draw_text(x, y + line_height * 3, 280, line_height,
  451.     "特技值获得:")
  452.     w = 200 ; h = 15
  453.     b = skill.tp_gain.to_f / 100
  454.     flii(x+120, y + line_height * 3 + 3, w, h, b, SUP::POS_COLOR1, SUP::POS_COLOR2)
  455.     draw_current_and_max_values(x+40, y + line_height * 3, 280, skill.tp_gain, 100,
  456.     text_color(0), text_color(0))
  457.     #攻击次数-----------------------------------------
  458.     draw_text(x, y + line_height * 4, 280, line_height,
  459.     "攻击次数:")
  460.     w = 200 ; h = 15
  461.     b = skill.repeats.to_f / 9
  462.     flii(x+120, y + line_height * 4 + 3, w, h, b, SUP::POS_COLOR1, SUP::POS_COLOR2)
  463.     draw_current_and_max_values(x+40, y + line_height * 4, 280, skill.repeats, 9,
  464.     text_color(0), text_color(0))
  465.     #成功几率-----------------------------------------
  466.     draw_text(x, y + line_height * 5, 280, line_height,
  467.     "成功几率:")
  468.     w = 200 ; h = 15
  469.     b = skill.success_rate.to_f / 100
  470.     flii(x+120, y + line_height * 5 + 3, w, h, b, SUP::POS_COLOR1, SUP::POS_COLOR2)
  471.     draw_current_and_max_values(x+40, y + line_height * 5, 280, skill.success_rate, 100,
  472.     text_color(0), text_color(0))
  473.     #输出评分-----------------------------------------
  474.     draw_text(x, y + line_height * 6, 280, line_height,
  475.     "输出评分:")
  476.     pf = scpf(skill)
  477.     w = 200 ; h = 15
  478.     b = [pf.to_f / SUP::PFX, 1.0].min
  479.     type = skill.damage.type
  480.     case type
  481.     when 0
  482.       draw_text(x+150, y + line_height * 6, 280, line_height,
  483.     "此技能没有输出。")
  484.     when 1, 2, 5, 6
  485.       flii(x+120, y + line_height * 6 + 3, w, h, b, SUP::NEG_COLOR1, SUP::NEG_COLOR2)
  486.       draw_current_and_max_values(x+40, y + line_height * 6, 280, pf, SUP::PFX,
  487.       text_color(0), text_color(0))
  488.     when 3, 4
  489.       flii(x+120, y + line_height * 6 + 3, w, h, b, SUP::POS_COLOR1, SUP::POS_COLOR2)
  490.       draw_current_and_max_values(x+40, y + line_height * 6, 280, pf, SUP::PFX,
  491.       text_color(0), text_color(0))
  492.     end
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ● 描绘值槽
  496.   #--------------------------------------------------------------------------
  497.   def flii(x, y, w, h, b, color1, color2)
  498.     contents.fill_rect(x, y, w, h, Color.new(0,0,0,64))
  499.     contents.gradient_fill_rect(x, y, w*b, h, color1, color2)
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ● 获得评分
  503.   #--------------------------------------------------------------------------
  504.   def scpf(skill)
  505.     g = skill.damage.formula.to_s
  506.     a = @actor
  507.     v = $game_variables
  508.     g.gsub!(/b/,"a")
  509.     return eval(g)
  510.   end
  511. end

  512. #==============================================================================
  513. # ■ SUP_Window_Choice
  514. #------------------------------------------------------------------------------
  515. #  技能升级条件及确认窗口
  516. #==============================================================================

  517. class SUP_Window_Choice < Window_Command
  518.   #--------------------------------------------------------------------------
  519.   # ● 初始化对象
  520.   #--------------------------------------------------------------------------
  521.   def initialize(x, y)
  522.     @hx = -1
  523.     super(x, y)
  524.     @skill = nil
  525.     @actor = nil
  526.     @enabled = []
  527.     @txt = []
  528.     @ite = []
  529.     @pic = []
  530.     @xh = []
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # ● 设置角色
  534.   #--------------------------------------------------------------------------
  535.   def actor=(val)
  536.     @actor = val
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● 取得技能
  540.   #--------------------------------------------------------------------------
  541.   def skill
  542.     @skill
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   # ● 设置技能
  546.   #--------------------------------------------------------------------------
  547.   def skill=(val)
  548.     @skill = val
  549.     refresh_draw
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ● 取得全部指定条件
  553.   #--------------------------------------------------------------------------
  554.   def all_if(skill_id)
  555.     arr = Array.new
  556.     arr << SUP::IF_ITE[skill_id]
  557.     arr << SUP::IF_VAR[skill_id]
  558.     arr << SUP::IF_SWI[skill_id]
  559.     arr << SUP::IF_COM[skill_id]
  560.   end
  561.   #--------------------------------------------------------------------------
  562.   # ● 获取全部条件有效状态
  563.   #--------------------------------------------------------------------------
  564.   def all_enabled?
  565.     [email protected]?(false)
  566.   end
  567.   #--------------------------------------------------------------------------
  568.   # ● 获取物品、变量条件有效状态
  569.   #--------------------------------------------------------------------------
  570.   def ite_var_enabled?(y, s)
  571.     return false if not y
  572.     y >= s
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ● 获取开关条件有效状态
  576.   #--------------------------------------------------------------------------
  577.   def swi_enabled?(y)
  578.     y
  579.   end
  580.   #--------------------------------------------------------------------------
  581.   # ● 获取对比条件有效状态
  582.   #--------------------------------------------------------------------------
  583.   def com_enabled?(y1, y2)
  584.     y1 == y2
  585.   end
  586.   #--------------------------------------------------------------------------
  587.   # ● 技能升级条件数据
  588.   #--------------------------------------------------------------------------
  589.   def skill_data
  590.     return if !@skill
  591.     @hx = -1 ; @enabled = [] ; @txt = [] ; @pic = [] ; @pid = [] ; @xh = []
  592.     l = all_if(@skill.id) ; n = l.compact
  593.     t = n == [] ? all_if(0) : l
  594.     t1 = t[0] ; t2 = t[1] ; t3 = t[2] ; t4 = t[3]
  595.     if t1
  596.       ite_data(t1)
  597.     end
  598.     if t2
  599.       var_data(t2)
  600.     end
  601.     if t3
  602.       swi_data(t3)
  603.     end
  604.     if t4
  605.       com_data(t4)
  606.     end
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # ● 技能条件进行描绘
  610.   #--------------------------------------------------------------------------
  611.   def skill_draw
  612.     @txt.each_with_index {|txt,i|
  613.     change_color(normal_color, @enabled[i])
  614.     pic = @pic[i]
  615.     if pic.is_a?(Symbol)
  616.       wx = window_width / 2 - text_size(txt).width / 2 - 24
  617.       if pic == :ite
  618.         draw_item_icon(@ite[i], wx, item_height * i)
  619.       else
  620.         draw_bit(pic.to_s, wx, item_height * i)
  621.       end
  622.     end
  623.     draw_text(0, item_height * i, window_width, item_height, txt, 1)
  624.     }
  625.   end
  626.   #--------------------------------------------------------------------------
  627.   # ● 绘制物品图标
  628.   #--------------------------------------------------------------------------
  629.   def draw_item_icon(item, x, y)
  630.     draw_icon(item.icon_index, x, y)
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # ● 绘制图片
  634.   #--------------------------------------------------------------------------
  635.   def draw_bit(name, x, y)
  636.     bitmap = Bitmap.new(SUP::FILE + name)
  637.     rect = Rect.new(0, 0, 24, 24)
  638.     contents.blt(x, y, bitmap, rect)
  639.   end
  640.   #--------------------------------------------------------------------------
  641.   # ● 对技能进行升级(变量、物品消耗)
  642.   #--------------------------------------------------------------------------
  643.   def skill_up
  644.     @actor.forget_skill(@skill.id)
  645.     @actor.learn_skill(SUP::UP[@skill.id])
  646.     @xh.each_with_index {|x, i|
  647.     if x.is_a?(String)
  648.       eval(x)
  649.     else
  650.       $game_party.gain_item(@ite[i], -x)
  651.     end}
  652.   end
  653.   #--------------------------------------------------------------------------
  654.   # ● 物品条件 数据
  655.   #--------------------------------------------------------------------------
  656.   def ite_data(si)
  657.     si.each {|i|
  658.     @hx += 1 ; t = i[0] ; b = i[1] ; s = i[2]
  659.     case t
  660.     when :items
  661.       item = $data_items[b]
  662.     when :weapons
  663.       item = $data_weapons[b]
  664.     when :armors
  665.       item = $data_armors[b]
  666.     end
  667.     y = $game_party.item_number(item)
  668.     enabled = ite_var_enabled?(y, s)
  669.     @enabled[@hx] = enabled
  670.     @txt[@hx] = item.name+"*"+ s.to_s
  671.     @ite[@hx] = item
  672.     @pic[@hx] = :ite
  673.     @xh[@hx] = s
  674.     }
  675.   end
  676.   #--------------------------------------------------------------------------
  677.   # ● 变量条件 数据
  678.   #--------------------------------------------------------------------------
  679.   def var_data(si)
  680.     si.each {|i|
  681.     @hx += 1 ; n = i[0] ; y = eval(i[1]) ; s = i[2]
  682.     enabled = ite_var_enabled?(y, s)
  683.     @enabled[@hx] = enabled
  684.     @txt[@hx] = n+"*"+ s.to_s
  685.     @pic[@hx] = i[-1]
  686.     @xh[@hx] = "#{i[1]} -= #{s.to_s}"
  687.     }
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # ● 开关条件 数据
  691.   #--------------------------------------------------------------------------
  692.   def swi_data(si)
  693.     si.each {|i|
  694.     @hx += 1 ; n = i[0] ; y = eval(i[1])
  695.     enabled = swi_enabled?(y)
  696.     @enabled[@hx] = enabled
  697.     @txt[@hx] = n
  698.     @pic[@hx] = i[-1]
  699.     }
  700.   end
  701.   #--------------------------------------------------------------------------
  702.   # ● 对比条件 数据
  703.   #--------------------------------------------------------------------------
  704.   def com_data(si)
  705.     si.each {|i|
  706.     @hx += 1 ; n = i[0] ; y1 = eval(i[1]) ; y2 = eval(i[2])
  707.     enabled = com_enabled?(y1,y2)
  708.     @enabled[@hx] = enabled
  709.     @txt[@hx] = n
  710.     @pic[@hx] = i[-1]
  711.     }
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● 获取窗口的宽度
  715.   #--------------------------------------------------------------------------
  716.   def window_width
  717.     return 300
  718.   end
  719.   #--------------------------------------------------------------------------
  720.   # ● 获取项目的高度
  721.   #--------------------------------------------------------------------------
  722.   def item_height
  723.     return 28
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # ● 获取对齐方向
  727.   #--------------------------------------------------------------------------
  728.   def alignment
  729.     return 1
  730.   end
  731.   #--------------------------------------------------------------------------
  732.   # ● 获取项目的绘制矩形
  733.   #--------------------------------------------------------------------------
  734.   alias x_item_rect item_rect
  735.   def item_rect(index)
  736.     rect = x_item_rect(index)
  737.     rect.y = rect.y + item_height * (@hx+1)
  738.     rect
  739.   end
  740.   #--------------------------------------------------------------------------
  741.   # ● 刷新(清除内容)
  742.   #--------------------------------------------------------------------------
  743.   def refresh
  744.     contents.clear
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # ● 刷新(取得数据、刷新窗口)
  748.   #--------------------------------------------------------------------------
  749.   def refresh2
  750.     skill_data
  751.     self.height = item_height * (@hx+3)
  752.     self.x = Graphics.width / 2 - window_width / 2
  753.     self.y = Graphics.height / 2 - self.height / 2
  754.     create_contents
  755.   end
  756.   #--------------------------------------------------------------------------
  757.   # ● 刷新(要描绘的内容)
  758.   #--------------------------------------------------------------------------
  759.   def refresh_draw
  760.     refresh
  761.     refresh2
  762.     skill_draw
  763.     clear_command_list
  764.     add_command("确认",   :ok, all_enabled?)
  765.     draw_all_items
  766.   end
  767. end

  768. #==============================================================================
  769. # ■ Scene_SUP
  770. #------------------------------------------------------------------------------
  771. #  技能升级画面
  772. #==============================================================================

  773. class Scene_SUP < Scene_MenuBase
  774.   #--------------------------------------------------------------------------
  775.   # ● 开始处理
  776.   #--------------------------------------------------------------------------
  777.   def start
  778.     super
  779.    
  780.     create_help_window
  781.     suv_window_command
  782.     suv_window_info
  783.     suv_window_index
  784.     suv_window_choice
  785.    
  786.   end
  787.   #--------------------------------------------------------------------------
  788.   # ● 帧更新
  789.   #--------------------------------------------------------------------------
  790.   def update
  791.     super
  792.     if Input.trigger?(:X)
  793.       case @suv_window_info.yema
  794.       when 1
  795.         @suv_window_info.huanye(2)
  796.       when 2
  797.         @suv_window_info.huanye(1)
  798.       end
  799.     end
  800.     if @suv_window_info.skill != @suv_window_index.item
  801.       @suv_window_info.skill = @suv_window_index.item
  802.     end
  803.   end
  804.   #--------------------------------------------------------------------------
  805.   # ● 生成确认窗口
  806.   #--------------------------------------------------------------------------
  807.   def suv_window_choice
  808.     @suv_window_choice = SUP_Window_Choice.new(0, 0)
  809.     @suv_window_choice.viewport = @viewport
  810.     @suv_window_choice.set_handler(:ok,    method(:confirm_ok))
  811.     @suv_window_choice.set_handler(:cancel,   method(:confirm_cancel))
  812.     @suv_window_choice.hide.deactivate
  813.     @suv_window_choice.actor = @actor
  814.   end
  815.   #--------------------------------------------------------------------------
  816.   # ● 生成分类窗口
  817.   #--------------------------------------------------------------------------
  818.   def suv_window_command
  819.     wy = @help_window.height
  820.     @suv_window_command = SUP_Window_Command.new(0, wy)
  821.     @suv_window_command.viewport = @viewport
  822.     @suv_window_command.help_window = @help_window
  823.     @suv_window_command.actor = @actor
  824.     @suv_window_command.set_handler(:skill,    method(:command_skill))
  825.     @suv_window_command.set_handler(:cancel,   method(:return_scene))
  826.     @suv_window_command.set_handler(:pagedown, method(:next_actor))
  827.     @suv_window_command.set_handler(:pageup,   method(:prev_actor))
  828.   end
  829.   #--------------------------------------------------------------------------
  830.   # ● 生成状态窗口
  831.   #--------------------------------------------------------------------------
  832.   def suv_window_info
  833.     y = @help_window.height
  834.     w = Graphics.width - @suv_window_command.width
  835.     h = Graphics.height - @help_window.height
  836.     @suv_window_info = SUP_Window_Info.new(@suv_window_command.width, y, w, h)
  837.     @suv_window_info.viewport = @viewport
  838.     @suv_window_info.actor = @actor
  839.   end
  840.   #--------------------------------------------------------------------------
  841.   # ● 生成列表窗口
  842.   #--------------------------------------------------------------------------
  843.   def suv_window_index
  844.     wx = 0
  845.     wy = @suv_window_command.y + @suv_window_command.height
  846.     ww = Graphics.width - @suv_window_info.width
  847.     wh = Graphics.height - wy
  848.     @suv_window_index = SUP_Window_Index.new(wx, wy, ww, wh)
  849.     @suv_window_index.actor = @actor
  850.     @suv_window_index.viewport = @viewport
  851.     @suv_window_index.help_window = @help_window
  852.     @suv_window_index.set_handler(:ok,     method(:on_item_ok))
  853.     @suv_window_index.set_handler(:cancel, method(:on_item_cancel))
  854.     @suv_window_command.skill_window = @suv_window_index
  855.   end
  856.   #--------------------------------------------------------------------------
  857.   # ● 技能分类里“确定”
  858.   #--------------------------------------------------------------------------
  859.   def command_skill
  860.     @suv_window_index.activate
  861.     @suv_window_index.select_last
  862.   end
  863.   #--------------------------------------------------------------------------
  864.   # ● 技能列表里“确定”
  865.   #--------------------------------------------------------------------------
  866.   def on_item_ok
  867.     skill = @suv_window_index.item
  868.     @suv_window_choice.skill = skill
  869.     @suv_window_choice.show.activate
  870.   end
  871.   #--------------------------------------------------------------------------
  872.   # ● 技能列表里“返回”
  873.   #--------------------------------------------------------------------------
  874.   def on_item_cancel
  875.     @suv_window_index.unselect
  876.     @suv_window_command.activate
  877.   end
  878.   #--------------------------------------------------------------------------
  879.   # ● 确认列表里“确认”
  880.   #--------------------------------------------------------------------------
  881.   def confirm_ok
  882.     @suv_window_choice.skill_up
  883.     @suv_window_index.refresh
  884.     @suv_window_choice.hide.deactivate
  885.     @suv_window_index.activate
  886.   end
  887.   #--------------------------------------------------------------------------
  888.   # ● 确认列表里“返回”
  889.   #--------------------------------------------------------------------------
  890.   def confirm_cancel
  891.     @suv_window_choice.hide.deactivate
  892.     @suv_window_index.activate
  893.   end
  894.   #--------------------------------------------------------------------------
  895.   # ● 切换角色
  896.   #--------------------------------------------------------------------------
  897.   def on_actor_change
  898.     @suv_window_command.actor = @actor
  899.     @suv_window_info.actor = @actor
  900.     @suv_window_index.actor = @actor
  901.     @suv_window_choice.actor = @actor
  902.     @suv_window_command.activate
  903.   end
  904. end
复制代码


想要的效果:
1.删除技能升级页面内的技能的全部说明词条(就是效果范围啊连续次数啊那些乱七八糟的),改为显示数据库技能中备注的内容,如:
备注
<升级AAAA>
<升级B    B>
则显示为
AAAA
B    B
同一个<>内不用考虑换行问题

2.技能升级界面默认在菜单内显示


联系QQ794418703,100R走支付宝转账

Lv5.捕梦者

梦石
0
星屑
24297
在线时间
5048 小时
注册时间
2016-3-8
帖子
1618
2
发表于 2020-11-12 21:21:51 | 只看该作者
本帖最后由 alexncf125 于 2020-11-12 21:37 编辑

<升级AAAA>
<升级B    B>
好像是不行的, 好像只能读取到AAAA, 不会读取B    B

2.技能升级界面默认在菜单内显示
其实"在菜单内添加指令呼出特定界面/場景"的脚本, 是有一套既有模板的说
读档菜单指令

只需拿模板小修小改一下就行了, 以下脚本免费赠送:
RUBY 代码复制
  1. class Window_MenuCommand < Window_Command
  2.  
  3.   alias make_command_list_with_sup_command make_command_list
  4.   def make_command_list
  5.     make_command_list_with_sup_command
  6.     add_sup_command
  7.   end
  8.  
  9.   def add_command_with_index(name, symbol, index, enabled = true, ext = nil)
  10.     @list[index, 0] = {:name=>name, :symbol=>symbol, :enabled=>enabled, :ext=>ext}
  11.   end
  12.  
  13.   def add_sup_command
  14.     @list.each_with_index{|data, index|
  15.       if data[:symbol] == :skill
  16.         add_command_with_index("技能升级", :sup, index.next)
  17.         return
  18.       end
  19.     }
  20.     add_command("技能升级", :sup)
  21.   end
  22.  
  23. end
  24.  
  25.  
  26. class Scene_Menu < Scene_MenuBase
  27.  
  28.   alias create_sup_command create_command_window
  29.   def create_command_window
  30.     create_sup_command
  31.     @command_window.set_handler(:sup, method(:command_sup))
  32.   end
  33.  
  34.   def command_sup
  35.     SceneManager.call(Scene_SUP)
  36.   end
  37.  
  38. end

点评

已经自行找到猎奇的办法解决了,不过还是谢谢  发表于 2020-11-19 18:20
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
265
在线时间
28 小时
注册时间
2020-10-30
帖子
23
3
发表于 2020-11-18 00:53:48 | 只看该作者
alexncf125 发表于 2020-11-12 21:21
好像是不行的, 好像只能读取到AAAA, 不会读取B    B

2.技能升级界面默认在菜单内显示

厉害啊。末日丧尸题材招人,不知道有没有兴趣》?

点评

啊, 弄错了, 这兒不是VA区...不过我是用VA的, 所以无法与你合作喔~~  发表于 2020-11-18 00:56
你用MZ的跑来VA区招人???  发表于 2020-11-18 00:55
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
265
在线时间
28 小时
注册时间
2020-10-30
帖子
23
4
发表于 2020-11-18 00:57:47 | 只看该作者
deskbook 发表于 2020-11-18 00:53
厉害啊。末日丧尸题材招人,不知道有没有兴趣》?

话说在VA区看到一个技术求助帖我也奇怪呢
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 21:56

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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