Project1

标题: 装备帮助增强与超极整合脚本冲突,求解决 [打印本页]

作者: Xnan    时间: 2013-7-22 10:24
标题: 装备帮助增强与超极整合脚本冲突,求解决
装备增强:http://rpg.blue/forum.php?mod=vi ... id%3D368&page=1

超极整合:http://www.66rpg.com/articles/5129


跪求各位大大帮忙。。。。我只要能把“装备帮助增强”这一效果整合进去就行,装备强化什么的都可以不要。

恳请各位帮忙啊,小生定当大大地酬谢!
作者: Ayahiyano    时间: 2013-7-22 20:49
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ 装备说明增强
  4. #------------------------------------------------------------------------------
  5. #  修改了说明窗口,增强了装备的说明 作者:wyongcan  发布于66RPG   转载请注明
  6. #==============================================================================
  7. module Help
  8.   CODE ={
  9.     11 => "属性抗性",
  10.     12 => "弱化抗性",
  11.     13 => "状态抗性",
  12.     14 => "状态免疫",
  13.     21 => "普通能力",
  14.     22 => "添加能力",
  15.     23 => "特殊能力",
  16.     31 => "攻击附带属性",
  17.     32 => "攻击附带状态",
  18.     33 => "修正攻击速度",
  19.     34 => "添加攻击次数",
  20.     41 => "添加技能类型",
  21.     42 => "禁用技能类型",
  22.     43 => "添加技能",
  23.     44 => "禁用技能",
  24.     51 => "可装备武器类型",
  25.     52 => "可装备护甲类型",
  26.     53 => "固定装备",
  27.     54 => "禁用装备",
  28.     55 => "装备风格",
  29.     61 => "添加行动次数",
  30.     62 => "特殊标志",
  31.     63 => "消失效果",
  32.     64 => "队伍能力"}
  33.   #特殊标志
  34.   FLAG ={
  35.                 0 => "自动战斗",
  36.                 1 => "擅长防御",
  37.                 2 => "保护弱者",
  38.                 3 => "特技专注"}
  39.   #普通能力
  40.         PARAM ={
  41.                 0 => "最大HP",
  42.                 1 => "最大MP",
  43.                 2 => "物理攻击",
  44.                 3 => "物理防御",
  45.                 4 => "魔法攻击",
  46.                 5 => "魔法防御",
  47.                 6 => "敏 捷 值",
  48.                 7 => "幸 运 值"}
  49.   #添加能力
  50.         XPARAM ={
  51.                 0 => "物理命中几率:",
  52.                 1 => "物理闪避几率:",
  53.                 2 => "必杀几率:",
  54.                 3 => "必杀闪避几率:",
  55.                 4 => "魔法闪避几率:",
  56.                 5 => "魔法反射几率:",
  57.                 6 => "物理反击几率:",
  58.                 7 => "体力值再生速度:",
  59.                 8 => "魔力值再生速度:",
  60.                 9 => "特技值再生速度:"}
  61.   #特殊能力
  62.         SPARAM ={
  63.                 0 => "受到攻击的几率",
  64.                 1 => "防御效果比率",
  65.                 2 => "恢复效果比率",
  66.                 3 => "药理知识",
  67.                 4 => "MP消费率",
  68.                 5 => "TP消耗率",
  69.                 6 => "物理伤害加成",
  70.                 7 => "魔法伤害加成",
  71.                 8 => "地形伤害加成",
  72.                 9 => "经验获得加成"}
  73. #~   #效果范围
  74. #~         SCOPE ={
  75. #~                 0 => "特殊",
  76. #~                 1 => "单个敌人",
  77. #~                 2 => "全体敌人" ,
  78. #~                 3 => "一个随机敌人",
  79. #~                 4 => "两个随机敌人",
  80. #~                 5 => "三个随机敌人",
  81. #~                 6 => "四个随机敌人",
  82. #~                 7 => "单个队友",
  83. #~                 8 => "全体队友",
  84. #~                 9 => "单个队友(无法战斗)",
  85. #~                 10 => "全体队友(无法战斗)",
  86. #~                 11 => "使用者"}
  87.         @队伍能力 ={
  88.                 0 => "遇敌几率减半",
  89.                 1 => "随机遇敌无效",
  90.                 2 => "敌人偷袭无效",
  91.                 3 => "先制攻击几率上升",
  92.                 4 => "获得金钱数量双倍",
  93.                 5 => "物品掉落几率双倍"}
  94.   def self.ready
  95.     @状态 = {}
  96.     @武器类型 = {}
  97.     @防具类型 = {}
  98.     @属性 = {}
  99.     $data_states.each{|x| @状态[x.id] = x.name if x != nil}
  100.     elements = $data_system.elements
  101.     weapon_types = $data_system.weapon_types
  102.     armor_types = $data_system.armor_types
  103.     elements.each_with_index{|x,y| @属性[y] = x if x != ""}
  104.     weapon_types.each_with_index{|x,y| @武器类型[y] = x if x != ""}
  105.     armor_types.each_with_index{|x,y| @防具类型[y] = x if x != ""}
  106.   end
  107.   def self.getequiphelp(equip)
  108.     help = ""
  109.     param = []
  110.     equip.params.each_with_index{|x,y| param.push([PARAM[y],x])}
  111.     param = param.select{|x| x[1] != 0}
  112.     param.each{|x| help += x[0] + ":" + x[1].to_s + "\n"}
  113.     features = equip.features
  114.     features.select{|x| x.code == 55}.each{|x| help += CODE[x.code] + ":双持武器" + "\n"}
  115. #    features.select{|x| x.code == 11}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "*" + x.value.to_s + "\n"}
  116.     features.select{|x| x.code == 12}.each{|x| help += CODE[x.code] + ":" + PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
  117.     features.select{|x| x.code == 13}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "*" + x.value.to_s + "\n"}
  118.    # features.select{|x| x.code == 14}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "\n"}
  119. #    features.select{|x| x.code == 31}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "\n"}
  120. #    features.select{|x| x.code == 32}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "+" + x.value.to_s + "\n"}
  121.     features.select{|x| x.code == 33}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
  122.     features.select{|x| x.code == 34}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
  123.     features.select{|x| x.code == 41}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法")  + "\n"}
  124.     features.select{|x| x.code == 42}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法")  + "\n"}
  125.    features.select{|x| x.code == 43}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name  + "\n"}
  126.     features.select{|x| x.code == 44}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name  + "\n"}
  127.     features.select{|x| x.code == 51}.each{|x| help += CODE[x.code] + ":" + @武器类型[x.data_id]  + "\n"}
  128.     features.select{|x| x.code == 52}.each{|x| help += CODE[x.code] + ":" + @防具类型[x.data_id]  + "\n"}
  129.     features.select{|x| x.code == 61}.each{|x| help += CODE[x.code] + ":" + x.value.to_s  + "\n"}
  130.     features.select{|x| x.code == 62}.each{|x| help += CODE[x.code] + ":" + FLAG[x.data_id]  + "\n"}
  131.     features.select{|x| x.code == 64}.each{|x| help += CODE[x.code] + ":" + @队伍能力[x.data_id]  + "\n"}
  132.     featuresparam = []
  133.     featuresparam.push features.select{|x| x.code == 21}
  134.     featuresparam.push features.select{|x| x.code == 22}
  135.     featuresparam.push features.select{|x| x.code == 23}
  136.     featuresparam[0].each{|x| help += PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
  137.     featuresparam[1].each{|x| help += XPARAM[x.data_id] + x.value.to_s + "\n"}
  138.     featuresparam[2].each{|x| help += SPARAM[x.data_id] + "*" + x.value.to_s + "\n"}
  139.     help
  140.   end
  141.   def self.getline(text,maxtext)
  142.     xtext = []
  143.     line = 0
  144.     text.each_line{|x| xtext.push x.sub(/\n/){}}
  145.     xtext.each{|x| x.size % maxtext != 0 ? line += x.size / maxtext + 1 : line += x.size / maxtext}
  146.     line
  147.   end
  148. end
  149. #==============================================================================
  150. # ■ Window_Help
  151. #------------------------------------------------------------------------------
  152. #  显示特技和物品等的说明、以及角色状态的窗口
  153. #==============================================================================

  154. class Window_Help < Window_Base
  155.   #--------------------------------------------------------------------------
  156.   # ● 初始化对象
  157.   #--------------------------------------------------------------------------
  158.   def initialize(line_number = 0)
  159.     super(0, 0, 210, fitting_height(line_number))
  160.     self.z = 150
  161.     contents.font.size = 14
  162.     hide
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● 设置内容
  166.   #--------------------------------------------------------------------------
  167.   def set_text(text)
  168.     if text != @text
  169.       @text = text
  170.       refresh
  171.     end
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 清除
  175.   #--------------------------------------------------------------------------
  176.   def clear
  177.     set_text("")
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 更新帮助位置
  181.   #--------------------------------------------------------------------------
  182.   def uppos(index,rect,window)
  183.     self.height = fitting_height2(Help.getline(@xtext,13))
  184.     create_contents
  185.     contents.font.size = 14
  186.     rect.x -= window.ox
  187.     rect.y -= window.oy
  188.     ax = rect.x + rect.width + 10
  189.     ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
  190.     ax += window.x
  191.     ax = 0 if ax < 0
  192.     ay = rect.y + rect.height
  193.     ay = rect.y - self.height if ay + self.height > window.height
  194.     ay += window.y
  195.     ay = 0 if ay < 0
  196.     self.x = ax
  197.     self.y = ay
  198.     set_text(@xtext)
  199.     show
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● 设置物品
  203.   #     item : 技能、物品等
  204.   #--------------------------------------------------------------------------
  205.   def set_item(item)
  206.     if item == nil
  207.       set_text("")
  208.       return
  209.     end
  210.     @xtext = ""
  211.     @xtext = "名称:" + item.name + "\n"
  212.     @xtext += "介绍:" + item.description + "\n"
  213.     @xtext += "价格:" + item.price.to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
  214.     @xtext += Help.getequiphelp(item) if item.is_a?(RPG::EquipItem)
  215.     @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 刷新
  219.   #--------------------------------------------------------------------------
  220.   def refresh
  221.     contents.clear
  222.     hide if @text == ""
  223.     draw_text_ex(4, 0, @text,width,40,false)
  224.   end
  225. end

  226. class Window_Base < Window
  227.   #--------------------------------------------------------------------------
  228.   # ● 计算窗口显示指定行数时的应用高度2*************************
  229.   #--------------------------------------------------------------------------
  230.   def fitting_height2(line_number)
  231.     line_number * contents.font.size + standard_padding * 2
  232.   end
  233. #~ draw_text_ex的增强,使其可以自动换行  原作者:叶子 修改:wyongcan
  234.   #--------------------------------------------------------------------------
  235.   # ● 绘制带有控制符的文本内容
  236.   #   如果传递了width参数的话,会自动换行
  237.   #--------------------------------------------------------------------------
  238.   def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true)
  239.     reset_font_settings if normalfont == true
  240.     text = convert_escape_characters(text)
  241.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  242.     if width != nil
  243.       pos[:height] = contents.font.size
  244.       pos[:width] = width
  245.       pos[:textwidth] = textwidth
  246.     end
  247.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 文字的处理
  251.   #     c    : 文字
  252.   #     text : 绘制处理中的字符串缓存(字符串可能会被修改)
  253.   #     pos  : 绘制位置 {:x, :y, :new_x, :height}
  254.   #--------------------------------------------------------------------------
  255.   def process_character(c, text, pos)
  256.     case c
  257.     when "\r"   # 回车
  258.       return
  259.     when "\n"   # 换行
  260.       process_new_line(text, pos)
  261.     when "\f"   # 翻页
  262.       process_new_page(text, pos)
  263.     when "\e"   # 控制符
  264.       process_escape_character(obtain_escape_code(text), text, pos)
  265.     else        # 普通文字
  266.       pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
  267.       if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
  268.         process_new_line(text, pos)
  269.       end
  270.       process_normal_character(c, pos)
  271.     end
  272.   end
  273. end

  274. class Window_ItemList < Window_Selectable
  275.   #--------------------------------------------------------------------------
  276.   # ● 更新帮助内容
  277.   #--------------------------------------------------------------------------
  278.   def update_help
  279.     @help_window.set_item(item)
  280.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
  281.   end
  282. end

  283. class Window_SkillList < Window_Selectable
  284.   #--------------------------------------------------------------------------
  285.   # ● 更新帮助内容
  286.   #--------------------------------------------------------------------------
  287.   def update_help
  288.     @help_window.set_item(item)
  289.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
  290.   end
  291. end

  292. class Window_ShopBuy < Window_Selectable
  293.   #--------------------------------------------------------------------------
  294.   # ● 更新帮助内容
  295.   #--------------------------------------------------------------------------
  296.   def update_help
  297.     @help_window.set_item(item) if @help_window
  298.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
  299.     @status_window.item = item if @status_window
  300.   end
  301. end

  302. class Window_EquipSlot < Window_Selectable
  303.   #--------------------------------------------------------------------------
  304.   # ● 更新帮助内容
  305.   #--------------------------------------------------------------------------
  306.   def update_help
  307.     super
  308.     @help_window.set_item(item) if @help_window
  309.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
  310.     @status_window.set_temp_actor(nil) if @status_window
  311.   end
  312. end

  313. class Scene_Shop < Scene_MenuBase
  314.         alias on_sell_ok_old on_sell_ok
  315.         def on_sell_ok
  316.                 on_sell_ok_old
  317.                 @help_window.hide
  318.         end
  319.         alias on_buy_ok_old on_buy_ok
  320.         def on_buy_ok
  321.                 on_buy_ok_old
  322.                 @help_window.hide
  323.         end
  324.         alias on_number_ok_old on_number_ok
  325.         def on_number_ok
  326.                 on_number_ok_old
  327.     @help_window.refresh
  328.                 @help_window.show
  329.         end
  330.         alias on_number_cancel_old on_number_cancel
  331.         def on_number_cancel
  332.                 on_number_cancel_old
  333.     @help_window.refresh
  334.                 @help_window.show
  335.         end
  336. end

  337. class Scene_Title < Scene_Base
  338.   alias start_old start
  339.   def start
  340.     start_old
  341.     Help.ready
  342.   end
  343. end
  344. class Window_Base < Window
  345.         alias old_process_new_line process_new_line
  346.         def process_new_line(text, pos)
  347.     old_process_new_line(text, pos)
  348.                 pos[:height] = contents.font.size if pos[:width] != nil
  349.         end
  350. end
  351. class Scene_ItemBase < Scene_MenuBase
  352.         alias old_on_actor_cancel on_actor_cancel
  353.   def on_actor_cancel
  354.     old_on_actor_cancel
  355.         @help_window.refresh
  356.   end
  357.         alias old_on_actor_ok on_actor_ok
  358.   def on_actor_ok
  359.     old_on_actor_ok
  360.         @help_window.refresh
  361.   end
  362. end

  363. class Scene_Battle < Scene_Base
  364.   def create_help_window
  365.     @help_window = Window_Help2.new
  366.     @help_window.visible = false
  367.   end
  368. end
复制代码
加入这个脚本就行了




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