Project1

标题: 瞎改装备说明增强改出的产物 [打印本页]

作者: PIKA~    时间: 2017-1-14 00:13
标题: 瞎改装备说明增强改出的产物
本帖最后由 PIKA~ 于 2017-1-14 00:18 编辑

第一次发脚本,不是原创的,也毫无技术含量,不知道能不能发哈
我的改动主要是将wyongcan大神第一版的功能和VIPArcher大神第二版的功能结合了一下。
比如说第一版会将默认的帮助窗口移除,第二版不会,我就在我修改的版本里加入了默认帮助窗口移除。
还有一个我个人觉得鬼畜的东西,就是使用第二版的时候,攻击附加状态的百分比小于1%时,帮助窗口显示的是0%,不会精算到小数,而第一版则直接显示小数,我修改的版本里也是直接显示小数的。
废话不说多,放脚本:

RUBY 代码复制
  1. #==============================================================================
  2. # ■ 技能物品说明增强 蓝本:wyongcan
  3. # 修改 :VIPArcher
  4. # 再次修改 :PIKA~
  5. #
  6. # 改动说明:
  7. # 修复了仍然显示默认帮助窗口的问题
  8. #修复了小数点不精算的问题
  9. #
  10. #  -- 本脚本来自 [url]https://rpg.blue[/url] 使用或转载请保留以上信息。
  11. #==============================================================================
  12. $VIPArcherScript ||= {};$VIPArcherScript[:help_ex] = 20141007
  13. $VIPArcherScript[:equip_limit] = false #是否使用了后知后觉的装备能力限制
  14. class << DataManager
  15.   alias_method :vip_load_database, :load_database
  16.   #--------------------------------------------------------------------------
  17.   # ● 读取数据库
  18.   #--------------------------------------------------------------------------
  19.   def load_database
  20.     vip_load_database
  21.     VIPArcher::Equipplus.equiphelpready
  22.   end
  23. end
  24. module VIPArcher;end
  25. module VIPArcher::Equipplus
  26.   TIME = 90 #帮助窗口自动出现的时间(单位帧
  27.   Font_Name = "黑体" # 推荐"微软雅黑"
  28.   Font_Size = 14                # "微软雅黑"的话就20号字体
  29.   UP   = 1 #能力值提升颜色编号
  30.   DOWN = 1 #能力值下降颜色编号
  31.   VIP  = 1 #特殊能力颜色编号
  32.   MP   = 1
  33.   TP   = 1
  34.   CODE ={
  35.     11 => "属性抗性",
  36.     12 => "弱化抗性",
  37.     13 => "状态抗性",
  38.     14 => "状态免疫",
  39.     21 => "普通能力",
  40.     22 => "添加能力",
  41.     23 => "特殊能力",
  42.     31 => "攻击附带属性",
  43.     32 => "攻击附带状态",
  44.     33 => "修正攻击速度",
  45.     34 => "添加攻击次数",
  46.     41 => "添加技能类型",
  47.     42 => "禁用技能类型",
  48.     43 => "添加技能",
  49.     44 => "禁用技能",
  50.     51 => "可装备武器类型",
  51.     52 => "可装备护甲类型",
  52.     53 => "固定装备",
  53.     54 => "禁用装备",
  54.     55 => "装备风格",
  55.     61 => "添加行动次数",
  56.     62 => "特殊标志",
  57.     63 => "消失效果",
  58.     64 => "队伍能力"}
  59.   #特殊标志
  60.   FLAG ={
  61.     0 => "自动战斗",
  62.     1 => "擅长防御",
  63.     2 => "保护弱者",
  64.     3 => "特技专注"}
  65.   #技能效果范围
  66.   SCOPE ={
  67.     0 => "无",
  68.     1 => "单个敌人",
  69.     2 => "全体敌人",
  70.     3 => "一个随机敌人",
  71.     4 => "两个随机敌人",
  72.     5 => "三个随机敌人",
  73.     6 => "四个随机敌人",
  74.     7 => "单个队友",
  75.     8 => "全体队友",
  76.     9 => "单个队友(战斗不能)",
  77.     10 => "全体队友(战斗不能)",
  78.     11 => "使用者" }
  79.   #技能命中类型
  80.   HIT ={
  81.     0 => "必定命中",
  82.     1 => "物理攻击",
  83.     2 => "魔法攻击"}
  84.   #使用限制
  85.   OCCASION ={
  86.     0 => "随时可用",
  87.     1 => "仅战斗中",
  88.     2 => "仅菜单中",
  89.     3 => "不能使用"}
  90.   #添加能力
  91.   XPARAM ={
  92.     0 => "物理命中几率:",
  93.     1 => "物理闪避几率:",
  94.     2 => "必杀几率:",
  95.     3 => "必杀闪避几率:",
  96.     4 => "魔法闪避几率:",
  97.     5 => "魔法反射几率:",
  98.     6 => "物理反击几率:",
  99.     7 => "体力值再生速度:",
  100.     8 => "魔力值再生速度:",
  101.     9 => "特技值再生速度:"}
  102.   #特殊能力
  103.   SPARAM ={
  104.     0 => "受到攻击的几率",
  105.     1 => "防御效果比率",
  106.     2 => "恢复效果比率",
  107.     3 => "药理知识",
  108.     4 => "MP消费率",
  109.     5 => "TP消耗率",
  110.     6 => "物理伤害加成",
  111.     7 => "魔法伤害加成",
  112.     8 => "地形伤害加成",
  113.     9 => "经验获得加成"}
  114.   #装备风格  require 装备风格扩展脚本
  115.   SLOT_TYPE ={
  116.     0 => "普通",
  117.     1 => "双持武器"}
  118.  
  119.   #队伍能力
  120.   PARTY_ABILITY ={
  121.     0 => "遇敌几率减半",
  122.     1 => "随机遇敌无效",
  123.     2 => "敌人偷袭无效",
  124.     3 => "先制攻击几率上升",
  125.     4 => "获得金钱数量双倍",
  126.     5 => "物品掉落几率双倍"}
  127.  
  128.   #伤害类型
  129.   DAMAGE_TYPE = {
  130.     0 => "无",
  131.     1 => "体力值伤害",
  132.     2 => "魔力值伤害",
  133.     3 => "体力值恢复",
  134.     4 => "魔力值恢复",
  135.     5 => "体力值吸收",
  136.     6 => "魔力值吸收"}
  137.   #普通能力
  138.   #这只是个示范,你也可以依照个人喜好对这些用语添加颜色控制符
  139.   @params ={
  140.     0 => "最大HP",
  141.     1 => "最大MP",
  142.     2 => "物理攻击",
  143.     3 => "物理防御",
  144.     4 => "法术强度",
  145.     5 => "法术防御",
  146.     6 => "敏捷值",
  147.     7 => "幸运值"}
  148.   #我举例技能类型的原因就是因为它 短
  149.   @skill_types = { # 这个和下面equiphelpready里注释掉的做的是一样的事
  150.                    # 只是下面是读取数据库添加用语,这里是手动枚举
  151.     1 => "特技",
  152.     2 => "魔法",
  153.     3 => "必杀",
  154.     4 => "卖萌"}
  155.   #初始化数据,当然如果你要用上面那样的控制符改变颜色的话
  156.   #欢迎枚举格式就是上面这样用Hash,用ID做键把用语对应起来
  157.   def self.equiphelpready
  158.     params = $data_system.terms.params
  159.     elements = $data_system.elements
  160.     weapon_types = $data_system.weapon_types
  161.     armor_types = $data_system.armor_types
  162.     etypes = $data_system.terms.etypes
  163.     skill_types = $data_system.skill_types
  164.     @states       ||= {}
  165.     @params       ||= {}
  166.     @weapon_types ||= {}
  167.     @armor_types  ||= {}
  168.     @etypes       ||= {}
  169.     @skill_types  ||= {}
  170.     @elements     ||= {}
  171.     skill_types.each_with_index{|x,y| @skill_types[y] = x if !x.nil?} if @skill_types == {}
  172.     $data_states.each{|x| @states[x.id] = x.name if !x.nil?} if @states == {}
  173.     elements.each_with_index{|x,y| @elements[y] = x if !x.nil?} if @elements == {}
  174.     weapon_types.each_with_index{|x,y| @weapon_types[y] = x if !x.nil?} if @weapon_types == {}
  175.     armor_types.each_with_index{|x,y| @armor_types[y] = x if !x.nil?} if @armor_types == {}
  176.     etypes.each_with_index{|x,y| @etypes[y] = x} if @etypes == {}
  177.     params.each_with_index{|x,y| @params[y] = x} if @params == {}
  178.   end
  179.   #获取装备帮助内容
  180.   def self.getequiphelp(equip)
  181.     help = ""
  182.     param = []
  183.     help += "装备位置:#{Vocab::etype(equip.etype_id)}\n"
  184.     if $VIPArcherScript[:equip_limit] #装备能力限制
  185.       help += "等级需求:#{equip.level_limit}\n" if equip.level_limit > 0
  186.       param_limit = []
  187.       for i in 0..7
  188.         if equip.params_limit(i) != 0
  189.           help += "#{@params[i]}需求:#{equip.params_limit(i)}\n"
  190.         end
  191.       end
  192.     end
  193.     equip.params.each_with_index{|x,y| param.push([@params[y],x])}
  194.     param = param.select{|x| x[1] != 0}
  195.     param.each{|x| help += "#{x[0]}:#{""if x[1]>0}#{x[1].to_int.to_s}\n"}
  196.     features = equip.features
  197.     featuresparam = []
  198.     featuresparam.push features.select{|x| x.code == 21}
  199.     featuresparam.push features.select{|x| x.code == 22}
  200.     featuresparam.push features.select{|x| x.code == 23}
  201.     featuresparam[0].each{|x| help += @params[x.data_id] + "*" + x.value.to_s + "\n"}
  202.     featuresparam[1].each{|x| help += XPARAM[x.data_id] + x.value.to_s + "\n"}
  203.     featuresparam[2].each{|x| help += SPARAM[x.data_id] + "*" + x.value.to_s + "\n"}
  204.     if $VIPArcherScript[:slot_type]
  205.       help += "#{CODE[55]}:#{SLOT_TYPE[$1.to_i]}\n" if equip.note =~ /<slot_type\s*[:](.*)>/i
  206.     else
  207.       features.select{|x| x.code == 55}.each{|x| help += "#{CODE[x.code]}:双持武器\n"}
  208.     end
  209.     features.select{|x| x.code == 11}.each{|x| help += CODE[x.code] + ":" + @params[x.data_id] + "*" + x.value.to_s + "\n"}
  210.     features.select{|x| x.code == 12}.each{|x| help += CODE[x.code] + ":" + PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
  211.     features.select{|x| x.code == 13}.each{|x| help += CODE[x.code] + ":" + @states[x.data_id] + "*" + x.value.to_s + "\n"}
  212.     features.select{|x| x.code == 14}.each{|x| help += "#{CODE[x.code]}:#{@states[x.data_id]}\n"}
  213.     features.select{|x| x.code == 31}.each{|x| help += "#{CODE[x.code]}:#{@elements[x.data_id]}\n"}
  214.     features.select{|x| x.code == 32}.each{|x| help += CODE[x.code] + ":" + @states[x.data_id] + "+" + x.value.to_s + "\n"}
  215.     features.select{|x| x.code == 33}.each{|x| help += "#{CODE[x.code]}:#{x.value}\n"}
  216.     features.select{|x| x.code == 34}.each{|x| help += "#{CODE[x.code]}:#{x.value}\n"}
  217.     features.select{|x| x.code == 41}.each{|x| help += "#{CODE[x.code]}:#{@skill_types[x.data_id]}\n"}
  218.     features.select{|x| x.code == 42}.each{|x| help += "#{CODE[x.code]}:#{@skill_types[x.data_id]}\n"}
  219.     features.select{|x| x.code == 43}.each{|x| help += "#{CODE[x.code]}:#{$data_skills[x.data_id].name}\n"}
  220.     features.select{|x| x.code == 44}.each{|x| help += "#{CODE[x.code]}:#{$data_skills[x.data_id].name}\n"}
  221.     features.select{|x| x.code == 51}.each{|x| help += "#{CODE[x.code]}:#{@weapon_types[x.data_id]}\n"}
  222.     features.select{|x| x.code == 52}.each{|x| help += "#{CODE[x.code]}:#{@armor_types[x.data_id]}\n"}
  223.     features.select{|x| x.code == 53}.each{|x| help += "#{CODE[x.code]}:#{@etypes[x.data_id]}\n"}
  224.     features.select{|x| x.code == 54}.each{|x| help += "#{CODE[x.code]}:#{@etypes[x.data_id]}\n"}
  225.     features.select{|x| x.code == 61}.each{|x| help += "#{CODE[x.code]}:#{x.value}\n"}
  226.     features.select{|x| x.code == 62}.each{|x| help += "#{CODE[x.code]}:#{FLAG[x.data_id]}\n"}
  227.     features.select{|x| x.code == 64}.each{|x| help += "#{CODE[x.code]}:#{PARTY_ABILITY[x.data_id]}\n"}
  228.     help
  229.   end
  230.   #获取技能帮助内容
  231.   def self.getskillhelp(skill)
  232.     help = ""
  233.     effects = skill.effects
  234.     damage  = skill.damage
  235.     r = [skill.required_wtype_id1,skill.required_wtype_id2]
  236.     help += "消耗:MP:#{skill.mp_cost.to_s} TP:#{skill.tp_cost.to_s}\n" if skill.mp_cost > 0 && skill.tp_cost > 0
  237.     help += "消耗:MP:#{skill.mp_cost.to_s}\n" if skill.mp_cost > 0 && skill.tp_cost <= 0
  238.     help += "消耗:TP:#{skill.tp_cost.to_s}\n" if skill.tp_cost > 0 && skill.mp_cost <= 0
  239.     help += "速度修正:#{skill.speed}\n" if skill.speed != 0
  240.     help += "成功率:#{skill.success_rate}%\n" if skill.success_rate != 100
  241.     help += "类型:#{HIT[skill.hit_type]}\n"
  242.     help += "范围:#{SCOPE[skill.scope]}\n" if skill.scope != 0
  243.     help += "效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\n" if damage.type != 0
  244.     effects.select{|x| x.code == 31}.each{|x| help += "强化:#{@params[x.data_id]} #{x.value1.to_i}回合\n"}
  245.     effects.select{|x| x.code == 32}.each{|x| help += "弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\n"}
  246.     effects.select{|x| x.code == 33}.each{|x| help += "解除:强化#{@params[x.data_id]}\n"}
  247.     effects.select{|x| x.code == 34}.each{|x| help += "解除:弱化#{@params[x.data_id]}\n"}
  248.     effects.select{|x| x.code == 21}.each{|x| help += "附加:#{x.data_id == 0 ? "普通攻击" : @states[x.data_id]} #{(x.value1*100).to_i}%\n"}
  249.     effects.select{|x| x.code == 22}.each{|x| help += "解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\n"}
  250.     effects.select{|x| x.code == 41}.each{|x| help += "特殊效果:撤退\n"}
  251.     effects.select{|x| x.code == 42}.each{|x| help += "提升:#{@params[x.data_id]}#{x.value1.to_i}点\n"}
  252.     effects.select{|x| x.code == 43}.each{|x| help += "学会:#{$data_skills[x.data_id].name}\n"}
  253.     help += "场合:#{OCCASION[skill.occasion]}\n"
  254.     help += "限制:#{$data_system.weapon_types[r[0]] if r[0] != 0} #{$data_system.weapon_types[r[1]] if r[1] != 0}\n" if r != [0,0]
  255.     help
  256.   end
  257.  
  258.   #获取道具帮助内容
  259.   def self.getitemhelp(item)
  260.     help = ""
  261.     effects = item.effects
  262.     damage  = item.damage
  263.     help += "类型:#{"贵重物品  "if item.itype_id != 1}#{item.consumable ? "消耗品":"非消耗品"}\n"
  264.     help += "范围:#{SCOPE[item.scope]}\n" if item.scope != 0
  265.     help += "效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\n" if damage.type != 0
  266.     effects.select{|x| x.code == 31}.each{|x| help += "强化:#{@params[x.data_id]} #{x.value1.to_i}回合\n"}
  267.     effects.select{|x| x.code == 32}.each{|x| help += "弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\n"}
  268.     effects.select{|x| x.code == 33}.each{|x| help += "解除:强化#{@params[x.data_id]}\n"}
  269.     effects.select{|x| x.code == 34}.each{|x| help += "解除:弱化#{@params[x.data_id]}\n"}
  270.     effects.select{|x| x.code == 21}.each{|x| help += "附加:#{x.data_id == 0 ? "普通攻击" : @states[x.data_id]} #{(x.value1*100).to_i}%#[0]\n"}
  271.     effects.select{|x| x.code == 22}.each{|x| help += "解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\n"}
  272.     effects.select{|x| x.code == 41}.each{|x| help += "特殊效果:撤退\n"}
  273.     effects.select{|x| x.code == 42}.each{|x| help += "提升:#{@params[x.data_id]}#{x.value1.to_i}点\n"}
  274.     effects.select{|x| x.code == 43}.each{|x| help += "学会:#{$data_skills[x.data_id].name}\n"}
  275.     help += "场合:#{OCCASION[item.occasion]}\n"
  276.     help
  277.   end
  278.   #计算行数(有些字体的汉字和[字母,数字,符号]的宽度不同,
  279.   #有可能会照成行数计算不对,尽量用宽度相同的字体吧)
  280.   def self.getline(text,maxtext)
  281.     text_new = ""
  282.     xtext = []
  283.     line = 0
  284.     text.each_line{|x| text_new += x.gsub(/\\\S\[\d+\]/i){}} #去掉控制符
  285.     text_new.each_line{|x| xtext.push x.gsub(/\n/){}}        #去掉换行符
  286.     xtext.each{|x| line += (x.size / (maxtext.to_f + 1).to_i) + 1}
  287.     line
  288.   end
  289. end
  290. #==============================================================================
  291. # ■ Window_Help_Ex
  292. #------------------------------------------------------------------------------
  293. #  加强显示特技和物品等的说明
  294. #==============================================================================
  295.  
  296. class Window_Help_Ex < Window_Base
  297.   include VIPArcher::Equipplus
  298.   #--------------------------------------------------------------------------
  299.   # ● 初始化对象
  300.   #--------------------------------------------------------------------------
  301.   def initialize(line_number = 0)
  302.     super(0, 0, 210, 0)
  303.     self.z = 150
  304.     contents.font.size = Font_Size
  305.     [url=home.php?mod=space&uid=134219]@Time[/url] = 0
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ● 设置内容
  309.   #--------------------------------------------------------------------------
  310.   def set_text(text)
  311.     @text = text
  312.     refresh
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ● 清除
  316.   #--------------------------------------------------------------------------
  317.   def clear
  318.     set_text("")
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ● 更新帮助位置
  322.   #--------------------------------------------------------------------------
  323.   def uppos(index,rect,window)
  324.     self.height = fitting_height_vip(VIPArcher::Equipplus.getline(@xtext,13))
  325.     create_contents
  326.     contents.font.name = Font_Name
  327.     contents.font.size = Font_Size
  328.     rect.x -= window.ox
  329.     rect.y -= window.oy
  330.     ax = rect.x + rect.width + 10
  331.     ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
  332.     ax += window.x
  333.     ax = 0 if ax < 0
  334.     ay = rect.y + rect.height
  335.     ay = rect.y - self.height if ay + self.height > window.height
  336.     ay += window.y
  337.     ay = 0 if ay < 0
  338.     self.x = ax
  339.     self.y = ay
  340.     set_text(@xtext)
  341.     @time = TIME
  342.     self.show
  343.     self.openness = 0
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● 设置物品
  347.   #     item : 技能、物品等
  348.   #--------------------------------------------------------------------------
  349.   def set_item(item)
  350.     if item == nil
  351.       set_text("")
  352.       return
  353.     end
  354.     @xtext = ""
  355.     if $VIPArcherScript[:itemcolor] # require 物品描绘颜色脚本
  356.       @xtext = "名称:\\c[#{VIPArcher::ItemColor::Color_Lv[item.color]}]" +
  357.       "#{item.name}  #{item.color if item.color != 0}#{"" if item.color != 0}\\c[0]\n"
  358.     else
  359.       @xtext = "名称:#{item.name}\n"
  360.     end
  361.     @xtext += "介绍:#{item.description}\n"
  362.     if $VIPArcherScript[:load]      # require 队伍负重脚本
  363.       @xtext += "售价:#{item.price} 重量:#{item.load}\n"
  364.     else
  365.       @xtext += item.price == 0 ? "售价:无法出售\n":"售价:#{item.price}\n"
  366.     end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
  367.     @xtext += VIPArcher::Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
  368.     @xtext += VIPArcher::Equipplus.getskillhelp(item) if item.is_a?(RPG::Skill)
  369.     @xtext += VIPArcher::Equipplus.getitemhelp(item) if item.is_a?(RPG::Item)
  370.     if $VIPArcherScript[:exdrop_rate]   # require 队伍掉率扩展
  371.       @xtext += "#{$1}掉率: #{$2}%\n" if
  372.       item.note =~ /<(\W+)掉率:\s*([0-9+.-]+)%>/i
  373.     end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Skill)
  374.     @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● 刷新
  378.   #--------------------------------------------------------------------------
  379.   def refresh
  380.     contents.clear
  381.     self.hide if @text == ""
  382.     draw_text_vip(4, 0, @text,width,40,false)
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # ● 更新画面
  386.   #--------------------------------------------------------------------------
  387.   def update
  388.     super
  389.     @time -= 1 if @time > 0
  390.     self.open if @time == 0
  391.   end
  392. end
  393. class Window_Base < Window
  394.   #--------------------------------------------------------------------------
  395.   # ● 计算窗口显示指定行数时的应用高度2*************************
  396.   #--------------------------------------------------------------------------
  397.   def fitting_height_vip(line_number)
  398.     line_number * contents.font.size + standard_padding * 2
  399.   end
  400.   # draw_text_ex的增强,使其可以自动换行  原作者:叶子 修改:wyongcan
  401.   #--------------------------------------------------------------------------
  402.   # ● 绘制带有控制符的文本内容
  403.   #   如果传递了width参数的话,会自动换行
  404.   #--------------------------------------------------------------------------
  405.   def draw_text_vip(x, y, text, width = nil,textwidth = nil,normalfont = true)
  406.     reset_font_settings if normalfont == true
  407.     text = convert_escape_characters(text)
  408.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  409.     if width != nil
  410.       pos[:height] = contents.font.size
  411.       pos[:width] = width
  412.       pos[:textwidth] = textwidth
  413.     end
  414.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ● 文字的处理
  418.   #     c    : 文字
  419.   #     text : 绘制处理中的字符串缓存(字符串可能会被修改)
  420.   #     pos  : 绘制位置 {:x, :y, :new_x, :height}
  421.   #--------------------------------------------------------------------------
  422.   def process_character(c, text, pos)
  423.     case c
  424.     when "\r"   # 回车
  425.       return
  426.     when "\n"   # 换行
  427.       process_new_line(text, pos)
  428.     when "\f"   # 翻页
  429.       process_new_page(text, pos)
  430.     when "\e"   # 控制符
  431.       process_escape_character(obtain_escape_code(text), text, pos)
  432.     else        # 普通文字
  433.       pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
  434.       if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
  435.         process_new_line(text, pos)
  436.       end
  437.       process_normal_character(c, pos)
  438.     end
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● 处理换行文字
  442.   #--------------------------------------------------------------------------
  443.   alias vip_20141007_process_new_line process_new_line
  444.   def process_new_line(text, pos)
  445.     vip_20141007_process_new_line(text, pos)
  446.     pos[:height] = contents.font.size if pos[:width] != nil
  447.   end
  448. end
  449.  
  450. #==============================================================================
  451. # ■ 设置帮助增强窗口
  452. #==============================================================================
  453. class Window_Selectable < Window_Base
  454.   attr_reader   :help_ex_window
  455.   #--------------------------------------------------------------------------
  456.   # ● 调用帮助窗口的更新方法
  457.   #--------------------------------------------------------------------------
  458.   alias help_ex_call_update_help call_update_help
  459.   def call_update_help
  460.     help_ex_call_update_help
  461.     update_ex_help if active && @help_ex_window
  462.   end
  463.   #--------------------------------------------------------------------------
  464.   # ● 更新帮助内容
  465.   #--------------------------------------------------------------------------
  466.   def update_ex_help
  467.     @help_ex_window.set_item(item) if @help_ex_window
  468.     if index != -1 && item != nil
  469.       @help_ex_window.uppos(index,item_rect(index),self)
  470.     end
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● 设置帮助增强窗口
  474.   #--------------------------------------------------------------------------
  475.   def help_ex_window=(help_ex_window)
  476.     @help_ex_window = help_ex_window
  477.   end
  478. end
  479. #==============================================================================
  480. # ■ 在各场景处理帮助窗口
  481. #==============================================================================
  482. class Scene_Base
  483.   #--------------------------------------------------------------------------
  484.   # ● 生成帮助增强窗口
  485.   #--------------------------------------------------------------------------
  486.   def create_help_ex
  487.     @help_ex_window  = Window_Help_Ex.new
  488.     @help_ex_window .viewport = @viewport
  489.     @item_window.help_ex_window  = @help_ex_window if @item_window
  490.     @slot_window.help_ex_window  = @help_ex_window if @slot_window
  491.     @skill_window.help_ex_window = @help_ex_window if @skill_window
  492.     @buy_window.help_ex_window   = @help_ex_window if @buy_window
  493.     @sell_window.help_ex_window  = @help_ex_window if @sell_window
  494.   end
  495. end
  496. #道具栏
  497. class Scene_Item < Scene_ItemBase
  498.   #--------------------------------------------------------------------------
  499.   # ● 开始处理
  500.   #--------------------------------------------------------------------------
  501.   alias help_ex_start start
  502.   def start
  503.     help_ex_start
  504.     create_help_ex
  505.   end
  506.   #--------------------------------------------------------------------------
  507.   # ● 物品“取消”
  508.   #--------------------------------------------------------------------------
  509.   alias help_ex_on_item_cancel on_item_cancel
  510.   def on_item_cancel
  511.     help_ex_on_item_cancel
  512.     @help_ex_window.hide
  513.   end
  514. end
  515. #装备栏
  516. class Scene_Equip < Scene_MenuBase
  517.   #--------------------------------------------------------------------------
  518.   # ● 开始处理
  519.   #--------------------------------------------------------------------------
  520.   alias help_ex_start start
  521.   def start
  522.     help_ex_start
  523.     create_help_ex
  524.   end
  525.   #--------------------------------------------------------------------------
  526.   # ● 装备栏“取消”
  527.   #--------------------------------------------------------------------------
  528.   alias help_ex_on_slot_cancel on_slot_cancel
  529.   def on_slot_cancel
  530.     help_ex_on_slot_cancel
  531.     @help_ex_window.hide
  532.   end
  533. end
  534. #技能栏
  535. class Scene_Skill < Scene_ItemBase
  536.   #--------------------------------------------------------------------------
  537.   # ● 开始处理
  538.   #--------------------------------------------------------------------------
  539.   alias help_ex_start start
  540.   def start
  541.     help_ex_start
  542.     create_help_ex
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   # ● 物品“确定”
  546.   #--------------------------------------------------------------------------
  547.   alias help_ex_on_item_ok on_item_ok
  548.   def on_item_ok
  549.     help_ex_on_item_ok
  550.     @help_ex_window.hide
  551.   end
  552.   #--------------------------------------------------------------------------
  553.   # ● 物品“取消”
  554.   #--------------------------------------------------------------------------
  555.   alias help_ex_on_item_cancel on_item_cancel
  556.   def on_item_cancel
  557.     help_ex_on_item_cancel
  558.     @help_ex_window.hide
  559.   end
  560. end
  561. #战斗界面
  562. class Scene_Battle < Scene_Base
  563.   #--------------------------------------------------------------------------
  564.   # ● 开始处理
  565.   #--------------------------------------------------------------------------
  566.   alias help_ex_start start
  567.   def start
  568.     help_ex_start
  569.     create_help_ex
  570.   end
  571.   #--------------------------------------------------------------------------
  572.   # ● 技能“确定”
  573.   #--------------------------------------------------------------------------
  574.   alias help_ex_on_skill_ok on_skill_ok
  575.   def on_skill_ok
  576.     help_ex_on_skill_ok
  577.     @help_ex_window.hide
  578.   end
  579.   #--------------------------------------------------------------------------
  580.   # ● 技能“取消”
  581.   #--------------------------------------------------------------------------
  582.   alias help_ex_on_skill_cancel on_skill_cancel
  583.   def on_skill_cancel
  584.     help_ex_on_skill_cancel
  585.     @help_ex_window.hide
  586.   end
  587.   #--------------------------------------------------------------------------
  588.   # ● 物品“确定”
  589.   #--------------------------------------------------------------------------
  590.   alias help_ex_on_item_ok on_item_ok
  591.   def on_item_ok
  592.     help_ex_on_item_ok
  593.     @help_ex_window.hide
  594.   end
  595.   #--------------------------------------------------------------------------
  596.   # ● 物品“取消”
  597.   #--------------------------------------------------------------------------
  598.   alias help_ex_on_item_cancel on_item_cancel
  599.   def on_item_cancel
  600.     help_ex_on_item_cancel
  601.     @help_ex_window.hide
  602.   end
  603. end
  604. #商店界面
  605. class Scene_Shop < Scene_MenuBase
  606.   #--------------------------------------------------------------------------
  607.   # ● 开始处理
  608.   #--------------------------------------------------------------------------
  609.   alias help_ex_start start
  610.   def start
  611.     help_ex_start
  612.     create_help_ex
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # ● 买入“确定”
  616.   #--------------------------------------------------------------------------
  617.   alias help_ex_on_buy_ok on_buy_ok
  618.   def on_buy_ok
  619.     help_ex_on_buy_ok
  620.     @help_ex_window.hide
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # ● 买入“取消”
  624.   #--------------------------------------------------------------------------
  625.   alias help_ex_on_buy_cancel on_buy_cancel
  626.   def on_buy_cancel
  627.     help_ex_on_buy_cancel
  628.     @help_ex_window.hide
  629.   end
  630.   #--------------------------------------------------------------------------
  631.   # ● 卖出“确定”
  632.   #--------------------------------------------------------------------------
  633.   alias help_ex_on_sell_ok on_sell_ok
  634.   def on_sell_ok
  635.     help_ex_on_sell_ok
  636.     @help_ex_window.hide
  637.   end
  638.   #--------------------------------------------------------------------------
  639.   # ● 卖出“取消”
  640.   #--------------------------------------------------------------------------
  641.   alias help_ex_on_sell_cancel on_sell_cancel
  642.   def on_sell_cancel
  643.     help_ex_on_sell_cancel
  644.     @help_ex_window.hide
  645.   end
  646. end
  647. #==============================================================================
  648. # ■ Window_Help
  649. #------------------------------------------------------------------------------
  650. #  显示特技和物品等的说明、以及角色状态的窗口
  651. #==============================================================================
  652.  
  653. class Window_Help < Window_Base
  654.   #--------------------------------------------------------------------------
  655.   # ● 初始化对象
  656.   #--------------------------------------------------------------------------
  657.   def initialize(line_number = 0)
  658.     super(0, 0, 210, fitting_height(line_number))
  659.     self.z = 150
  660.     contents.font.size = 14
  661.     hide
  662.   end
  663.   #--------------------------------------------------------------------------
  664.   # ● 设置内容
  665.   #--------------------------------------------------------------------------
  666.   def set_text(text)
  667.     if text != @text
  668.       @text = text
  669.       refresh
  670.     end
  671.   end
  672.   #--------------------------------------------------------------------------
  673.   # ● 清除
  674.   #--------------------------------------------------------------------------
  675.   def clear
  676.     set_text("")
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # ● 更新帮助位置
  680.   #--------------------------------------------------------------------------
  681.   def uppos(index,rect,window)
  682.     self.height = fitting_height2(Help.getline(@xtext,13))
  683.     create_contents
  684.     contents.font.size = 14
  685.     rect.x -= window.ox
  686.     rect.y -= window.oy
  687.     ax = rect.x + rect.width + 10
  688.     ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
  689.     ax += window.x
  690.     ax = 0 if ax < 0
  691.     ay = rect.y + rect.height
  692.     ay = rect.y - self.height if ay + self.height > window.height
  693.     ay += window.y
  694.     ay = 0 if ay < 0
  695.     self.x = ax
  696.     self.y = ay
  697.     set_text(@xtext)
  698.     show
  699.   end
  700. end


其实最主要就是修复百分比的精算啦。其实毫无技术含量,大神请无视。
附上3版本效果图:

1.png (116.21 KB, 下载次数: 14)

1.png

2.png (130.61 KB, 下载次数: 14)

2.png

3.png (120.64 KB, 下载次数: 11)

3.png

作者: asdxjp233    时间: 2017-1-14 08:22
请问你改了什么???




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