查看: 2393|回复: 8

[已经解决] 颜色描绘和装备强化起冲突...

[复制链接]
梦石
0
星屑
1554
在线时间
523 小时
注册时间
2015-8-23
回帖
83
发表于 2015-9-14 10:40:36 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 寂寞的青椒 于 2015-9-14 13:59 编辑

本人脚本渣,一直不懂怎么回事.....
我用[VA] 物品颜色描绘 Ver.1.3    和 仿网游的装备强化系统 更新优化版   这两个脚本结果直接跳窗
接着我把颜色脚本换成 [PS0]物品颜色描绘 跳窗的问题就解决了。
但是,随后我发现,只是武器有颜色显示而物品没有,我把装备强化脚本删掉后,物品又能正确显示颜色了....
还有就是,如果颜色脚本在强化武器脚本下面,那么,强化后装备名字后面没有+1,两个位置调换才能正确显示...
求大神帮帮忙啊~~~~
三个脚本如下.....
[VA 物品颜色描绘 Ver.1.3]#==============================================================================
#  ■ 物品颜色描绘 Ver.1.3  - By 柍若
#     ItemLevelDrawer
#------------------------------------------------------------------------------
#    Item类窗口中给图标描绘彩色边框以表示品质等级,同时改变名称颜色。
#     物品、技能、装备等适用。
#==============================================================================
#
#    - 2014.02.05 By 柍若
#      * [ BUG修正 ]重定义品质判定算法,兼容性更良。   
#      * [    优化 ]简化写法(基本是重写了)。              
#      * [    补充 ]无限扩张品级数目。支持自定义。    
#      * [    补充 ]添加背景块,支持不透明度设定。    
#      * [  新功能 ]美化品质框,可选圆角或方角形状。   
#      * [    优化 ]修正名称文字显示位置。          
#      * [  新功能 ]定义全局自动/ 手动描绘两种模式可切换。
#      * [  新功能 ]物品名称可用控制符。
#
#------------------------------------------------------------------------------
#      基于以下脚本
#      改写已取得两位作者同意
#==============================================================================
#    - 2012.01.03 By 仲秋启明
#      * 修改为VA定义
#    - 2011.12.27 By 仲秋启明
#      * 移植至RGSS3,遵循PS0协议;
#      * 优化数据库备注中设定方法
#    - 2011.08.22 By 冰舞蝶恋
#      * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框)
#    - 2010.08.06 By 仲秋启明
#      * 蓝本(物品颜色描绘脚本(完整无冲突版))
#------------------------------------------------------------------------------
# [使用说明]
#    - 替换原Window_Base中的draw_item_name定义或复制到Main之前
#------------------------------------------------------------------------------
# [使用方法]
#    - 在备注栏内填写"<品质 n>",其中n表示品质等级。
#==============================================================================
module ItemLevelDrawer
#==============================================================================
                 
    # true: 默认全局描绘    / false: 手动设置描绘
   
    WhenZero = true   # 开启则当品质为0(即不填)时,默认描绘品质1颜色
#------------------------------------------------------------------------------

    # true: 圆角    / false: 方角
   
    CornerShape = true
#------------------------------------------------------------------------------

    # 背景块不透明度
   
    BackOpacity = 160
#------------------------------------------------------------------------------
   
    # 各品质颜色设置,预设7种,可自行添加新品级
    # 数据库设定的品质大于下列品质的最大值时,将不描绘品质
   
    ColorSet = [[255, 255, 255],   # 备注 <品质 1> 或不填    [ 白 ]
   
                [128, 255, 128],   # 备注 <品质 2>        [ 绿 ]
                 
                [128, 128, 255],   # 备注 <品质 3>        [ 蓝 ]
                 
                [255,   0, 255],   # 备注 <品质 4>        [ 紫 ]
                 
                [255, 128, 128],   # 备注 <品质 5>        [ 红 ]
                 
                [255, 128,   0],   # 备注 <品质 6>        [ 橙 ]
                 
                [255, 255, 128],   # 备注 <品质 7>        [ 黄 ]
                 
                ]
#==============================================================================
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  alias din2 draw_item_name
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    n = $1.to_i if /<品质 (\d+?)>/i =~ item.note
    x += 2
    return din2(item, x, y, enabled, width) unless n or ItemLevelDrawer::WhenZero and n.to_i <= ItemLevelDrawer::ColorSet.size
    n -= 1 if n and n >= 1
    n = 0 unless n
    n = ItemLevelDrawer::ColorSet[n.to_i]
    self.contents.fill_rect(x+1, y+2, 22, 20, Color.new(n[0], n[1], n[2], ItemLevelDrawer::BackOpacity))
    s = 1 if ItemLevelDrawer::CornerShape
    self.contents.fill_rect(x+s.to_i, y+1, 24-s.to_i*2, 1, Color.new(n[0], n[1], n[2]))
    self.contents.fill_rect(x, y+s.to_i+1, 1, 22-s.to_i*2, Color.new(n[0], n[1], n[2]))
    self.contents.fill_rect(x+s.to_i, y+22, 24-s.to_i*2, 1, Color.new(n[0], n[1], n[2]))
    self.contents.fill_rect(x+23, y+s.to_i+1, 1, 22-s.to_i*2, Color.new(n[0], n[1], n[2]))
    draw_icon(item.icon_index, x, y, enabled)
    change_color(Color.new(n[0], n[1], n[2]), enabled)
    draw_text_ex(x + 30, y, item.name, Color.new(n[0], n[1], n[2]))
  end
  def draw_text_ex(x, y, text, initial_color = normal_color)
    reset_font_settings(initial_color)
    text = convert_escape_characters(text)
    pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
    process_character(text.slice!(0, 1), text, pos) until text.empty?
  end
  def reset_font_settings(initial_color = normal_color)
    change_color(initial_color)
    contents.font.size = Font.default_size
    contents.font.bold = Font.default_bold
    contents.font.italic = Font.default_italic
  end
end
#==============================================================================
# End of Script
#==============================================================================

[RMVA发布 仿网游的装备强化系统 更新优化版]
#==============================================================================
# ■ 强化系统 优化版
#------------------------------------------------------------------------------
#  强化系统  wyongcan制作
# 优化版更新内容:优化了语法,修复部分BUG,使代码可读性增强,增加了宝石选择窗口
# 发布于66RPG  转载请保留版权信息
#==============================================================================
module Qiang
$maxlv = 12  #最高升到的级数
$gailv = [100,80,70,60,50,30,20,10,5,5,5,5,1] #每级提升概率
$gemlv = [[60,23],[10,28],[25,29],[40,30]] #使用宝石提高的几率  [提高几率,宝石ID]
$uplv = [[12,24],[3,25],[6,26],[9,27]] #强化所需要的强化石 [最大强化到的等级,强化石ID]
$xxlv = [0,0,5,10,15,20,25,30,30,40,40,45,60] #每级强化后失败物品消失的几率
$jjlv = [0,10,15,20,30,45,55,65,70,70,75,80,100] #每级强化后失败物品降级的几率
$tsnl = [10,14,18,22,26,30,34,38,42,46,50,54,65] #每级强化提升能力的百分比
$tswp = [31,32] # 意思是:如果有31号物品则失败后物品不消失,如果有32号物品则失败后物品不降级
#武器强化后的计算公式为: 原攻击 * (1 + 提升能力百分比) + (0到当前强化级数随机) * 5 + 当前强化级数
$gemlv.sort!
$uplv.sort!
$当前使用宝石id = 0
$当前使用宝石加成率 = 0
$强化哈希表 = {
"最高等级" => $maxlv ,
"每级概率" => $gailv ,
"宝石效果" => $gemlv ,
"消失几率" => $xxlv  ,
"降级几率" => $jjlv  ,
"提升能力" => $tsnl  ,
"特殊物品" => $tswp  ,
"强化材料" => $uplv  }
def self.idlostitem(id,amount = 1)
  $game_party.lose_item(idgetitem(id),amount)
end

def self.idlostequip(id,weapon = true,amount = 1)
  weapon == true ? $game_party.lose_item($data_weapons[id],amount,true) : $game_party.lose_item($data_armors[id],amount,true)
end

def self.idgainequip(id,weapon = true,amount = 1)
  weapon == true ? $game_party.gain_item($data_weapons[id],amount,true) : $game_party.gain_item($data_armors[id],amount,true)
end

def self.idgetitem(id)
  $data_items[id]
end

def self.equipable?(id,weapon = true)
  weapon == true ? weaponupisnil(id) : armorupisnil(id)
  weapon == true ? equip = $data_weapons[id].dup : equip = $data_armors[id].dup
  price = equip.price
  @needmoney = price * equip.up
  if @needmoney == 0
    @needmoney = price / 2
  end
#循环取出需要的强化材料
  temp = false
  for i in $强化哈希表["强化材料"]
    if equip.up < i[0]
      @lostitem = idgetitem i[1]
      $game_party.has_item?(idgetitem(i[1])) ? temp = true : temp = false
      break
    end
  end
  $game_party.gold >= @needmoney && temp == true ? true : false
end

def self.upweapon (id)
  $message = ""
  success = false
  weaponupisnil(id)
  weapon = $data_weapons[id].dup
  gl = 0
  fangb = false
  fangj = false
  return unless weapon.up < $强化哈希表["最高等级"] && weaponupable?(id)
  loststh
  $message += "本次强化,共消耗:" + Vocab::currency_unit + " " + @needmoney.to_s
  $message += " " + @lostitem.name + "\n "
  gl = $强化哈希表["每级概率"][weapon.up]
  if $usegem == true
    gl += $当前使用宝石加成率
    idlostitem($当前使用宝石id)
    $message += idgetitem($当前使用宝石id).name + " "
  end
  if $fangb == true
    fangb = true
    idlostitem $强化哈希表["特殊物品"][0]
    $message += idgetitem($强化哈希表["特殊物品"][0]).name + " "
  end
  if $fangj == true
    fangj = true
    idlostitem $强化哈希表["特殊物品"][1]
    $message += idgetitem($强化哈希表["特殊物品"][1]).name + " "
  end
  suiji = rand (100)
  if suiji <= gl
    success = true
  end
  $message += "\n强化结果:"
  if success == true
    $message += "强化成功"
    idlostequip id
    weapon.id = $data_weapons.size
    params = weapon.params.dup
    params[2] *= 1 + $强化哈希表["提升能力"][weapon.up] / 100
    params[2] += rand(weapon.up) * 5 + weapon.up
    params[2] += 1 if params[2] == weapon.params[2]
    $message += " 攻击力提升:" + (params[2] - weapon.params[2]).to_int.to_s
    weapon.up += 1
    $data_weapons.insert $data_weapons.size,weapon
    $data_weapons[$data_weapons.size-1].params = params
    idgainequip weapon.id
  else
    $message += "强化失败"
    suiji = rand (100)
    if suiji <= $强化哈希表["消失几率"][weapon.up]
      if fangb != true
      $message += ",道具消失"
      idlostequip id
      else
      $message += ",由于" + idgetitem($强化哈希表["特殊物品"][0]).name + "的作用,道具未消失"
      end
    else
      suiji = rand (100)
      if suiji <= $强化哈希表["降级几率"][weapon.up]
        if fangj == false && weapon.up != 0
          $message += ",道具降级"
          params = weapon.params.dup
          params[2] -= weapon.up + rand(weapon.up) * 5
          params[2] /= 1 + $强化哈希表["提升能力"][weapon.up] / 100
          weapon.params = params
          weapon.up -= 1
          $data_weapons[id] = weapon
        else
          $message += ",由于" + idgetitem($强化哈希表["特殊物品"][1]).name + "的作用,道具未降级"
        end
      end
    end
  end
   $usegem = false
   $fangb = false
   $fangj = false
end

def self.weaponupisnil(id)
   $data_weapons[id].up = 0 unless $data_weapons[id].up != nil
end

def self.weaponupable?(id)
  equipable?(id)
end

def self.uparmor (id)
  $message = ""
  success = false
  armorupisnil(id)
  armor = $data_armors[id].dup
  gl = 0
  fangb = false
  fangj = false
  return unless armor.up < $强化哈希表["最高等级"] && armorupable?(id)
  loststh
  $message += "本次强化,共消耗:" + Vocab::currency_unit + " " + @needmoney.to_s
  $message += " " + @lostitem.name + "\n "
  gl = $强化哈希表["每级概率"][armor.up]
  if $usegem == true
    gl += $当前使用宝石加成率
    idlostitem($当前使用宝石id)
    $message += idgetitem($当前使用宝石id).name + " "
  end
  if $fangb == true
    fangb = true
    idlostitem $强化哈希表["特殊物品"][0]
    $message += idgetitem($强化哈希表["特殊物品"][0]).name + " "
  end
  if $fangj == true
    fangj = true
    idlostitem $强化哈希表["特殊物品"][1]
    $message += idgetitem($强化哈希表["特殊物品"][1]).name + " "
  end
  suiji = rand (100)
  if suiji <= gl
    success = true
  end
  $message += "\n强化结果:"
  if success == true
    $message += "强化成功"
    idlostequip id,false
    armor.id = $data_armors.size
    params = armor.params.dup
    params[3] *= 1 + $强化哈希表["提升能力"][armor.up] / 100
    params[3] += rand(armor.up) * 5 + armor.up
    params[3] += 1 if params[3] == armor.params[3]
    $message += " 防御力提升:" + (params[3] - armor.params[3]).to_int.to_s
    armor.up += 1
    $data_armors.insert $data_armors.size,armor
    $data_armors[$data_armors.size-1].params = params
    idgainequip armor.id,false
  else
    $message += "强化失败"
    suiji = rand (100)
    if suiji <= $强化哈希表["消失几率"][armor.up]
      if fangb != true
      $message += ",道具消失"
      idlostequip id,false
      else
      $message += ",由于" + idgetitem($强化哈希表["特殊物品"][0]).name + "的作用,道具未消失"
      end
    else
      suiji = rand (100)
      if suiji <= $强化哈希表["降级几率"][armor.up]
        if fangj == false && armor.up != 0
          $message += ",道具降级"
          params = armor.params.dup
          params[3] -= armor.up + rand(armor.up) * 5
          params[3] /= 1 + $强化哈希表["提升能力"][armor.up] / 100
          armor.params = params
          armor.up -= 1
          $data_armors[id] = armor
        else
          $message += ",由于" + idgetitem($强化哈希表["特殊物品"][1]).name + "的作用,道具未降级"
        end
      end
    end
  end
   $usegem = false
   $fangb = false
   $fangj = false
end

def self.armorupisnil(id)
   $data_armors[id].up = 0 unless $data_armors[id].up != nil
end
def self.armorupable?(id)
  equipable?(id,false)
end
def self.loststh()
   $game_party.lose_item(@lostitem,1)
   $game_party.lose_gold(@needmoney)
end
def self.needmoney
   @needmoney
end
def self.lostitem
   @lostitem
end
end
#==============================================================================
# ■ Scene_Qiang
#------------------------------------------------------------------------------
#  强化画面
#==============================================================================

class Scene_Qiang < Scene_MenuBase
  $wufang = true
  $usegem = false
  $fangb = false
  $fangj = false
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def start
    super
    create_help_window
    @help_window.hide
    create_qianghelp_window
    create_command_window
    create_qiangxz_window
    create_wu_window
    create_fang_window
    create_choosegem_window
  end
  #--------------------------------------------------------------------------
  # ● 生成说明窗口
  #--------------------------------------------------------------------------
  def create_qianghelp_window
    @qianghelp_window = Window_Qianghelp.new
    @qianghelp_window.y = Graphics.height - @qianghelp_window.height
    @qianghelp_window.viewport = @viewport
    @qianghelp_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 生成选择宝石
  #--------------------------------------------------------------------------
  def create_choosegem_window
    @choosegem_window = Window_Choosegem.new
    @choosegem_window.y = Graphics.height - @choosegem_window.height
    @choosegem_window.viewport = @viewport
    @choosegem_window.z = 120
  end
  #--------------------------------------------------------------------------
  # ● 生成选择窗口
  #--------------------------------------------------------------------------
  def create_qiangxz_window
    @qiangxz_window = Window_Qiangxz.new
    @qiangxz_window.y = @help_window.height + fitting_height(5) /2
    @qiangxz_window.z = 110
    @qiangxz_window.viewport = @viewport
    @qiangxz_window.set_handler(:gem,    method(:qiangxz_gem))
    @qiangxz_window.set_handler(:fangb,    method(:qiangxz_fangb))
    @qiangxz_window.set_handler(:fangj,    method(:qiangxz_fangj))
    @qiangxz_window.set_handler(:ok, method(:qiangxz_ok))
    @qiangxz_window.set_handler(:cancel, method(:qiangxz_cancel))
    @qiangxz_window.hide
    @qiangxz_window.deactivate
  end
  #--------------------------------------------------------------------------
  # ● 生成指令窗口
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_QiangCommand.new
    @command_window.viewport = @viewport
    @command_window.y = @help_window.height + fitting_height(3) /2
    @command_window.set_handler(:qiangwu,    method(:qiangwu))
    @command_window.set_handler(:qiangfang,   method(:qiangfang))
    @command_window.set_handler(:cancel, method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # ● 生成武器强化窗口
  #--------------------------------------------------------------------------
  def create_wu_window
    @wu_window = Window_Qiangwu.new(@qianghelp_window,@qiangxz_window)
    @wu_window.viewport = @viewport
    @wu_window.y += @help_window.height
    @wu_window.hide
    @wu_window.help_window= @help_window
    @wu_window.set_handler(:cancel, method(:qiangwu_cancel))
    @wu_window.set_handler(:ok,     method(:qiangwu_ok))
  end
  #--------------------------------------------------------------------------
  # ● 生成防具强化窗口
  #--------------------------------------------------------------------------
  def create_fang_window
    @fang_window = Window_Qiangfang.new(@qianghelp_window,@qiangxz_window)
    @fang_window.viewport = @viewport
    @fang_window.y += @help_window.height
    @fang_window.hide
    @fang_window.help_window= @help_window
    @fang_window.set_handler(:cancel, method(:qiangfang_cancel))
    @fang_window.set_handler(:ok,     method(:qiangfang_ok))
  end
  #--------------------------------------------------------------------------
  # ● 计算窗口显示指定行数时的应用高度
  #--------------------------------------------------------------------------
  def fitting_height(line_number)
    line_number * 24 + 12 * 2
  end
  #--------------------------------------------------------------------------
  # ● 显示强化武器
  #--------------------------------------------------------------------------
  def qiangwu
    @command_window.hide
    @help_window.show
    @wu_window.show
    @wu_window.start
    @qianghelp_window.show
    @wu_window.activate
    $wufang = true
    @command_window.deactivate
  end
  #--------------------------------------------------------------------------
  # ● 显示强化防具
  #--------------------------------------------------------------------------
  def qiangfang
    @command_window.hide
    @help_window.show
    @fang_window.show
    @fang_window.start
    @qianghelp_window.show
    @fang_window.activate
    $wufang = false
    @command_window.deactivate
  end
  #--------------------------------------------------------------------------
  # ● 取消强化武器
  #--------------------------------------------------------------------------
  def qiangwu_cancel
    @command_window.show
    @help_window.hide
    @wu_window.hide
    @qianghelp_window.hide
    @command_window.activate
    @qianghelp_window.set_text("")
    @help_window.set_text("")
  end
  #--------------------------------------------------------------------------
  # ● 取消强化防具
  #--------------------------------------------------------------------------
  def qiangfang_cancel
    @command_window.show
    @help_window.hide
    @fang_window.hide
    @qianghelp_window.hide
    @command_window.activate
    @qianghelp_window.set_text("")
    @help_window.set_text("")
  end
  #--------------------------------------------------------------------------
  # ● 确定强化武器
  #--------------------------------------------------------------------------
  def qiangwu_ok
    @wu_window.qiangwu_ok
    @qiangxz_window.show
    @qiangxz_window.activate
  end
  #--------------------------------------------------------------------------
  # ● 确定强化防具
  #--------------------------------------------------------------------------
  def qiangfang_ok
    @fang_window.qiangfang_ok
    @qiangxz_window.show
    @qiangxz_window.activate
  end
  #--------------------------------------------------------------------------
  # ● 获取卖出价格
  #--------------------------------------------------------------------------
  def selling_price
    @item.price / 2
  end
  
  def qiangxz_gem
    @choosegem_window.start
    @qiangxz_window.deactivate
    @choosegem_window.qiangxz= @qiangxz_window
    if $wufang == true
      @choosegem_window.wufangwindow= @wu_window
    else
      @choosegem_window.wufangwindow= @fang_window
    end
  end
  
  def qiangxz_fangb
    $fangb = !$fangb
    if $wufang == true
      @wu_window.update_help
    else
      @fang_window.update_help
    end
    @qiangxz_window.activate
  end
  
  def qiangxz_fangj
    $fangj = !$fangj
    if $wufang == true
      @wu_window.update_help
    else
      @fang_window.update_help
    end
    @qiangxz_window.activate
  end
  
  def qiangxz_ok
    if $wufang == true
      Qiang.upweapon(@wu_window.itemid)
      qianging
      @qianghelp_window.set_text($message)
      @qiangxz_window.hide
      Graphics.wait(60)
      @wu_window.activate
      @qiangxz_window.deactivate
      $当前使用宝石加成率 = 0
      $usegem = false
      @fang_window.update_help
      @wu_window.refresh
      @command_window.deactivate
    else
      Qiang.uparmor(@fang_window.itemid)
      qianging
      @qianghelp_window.set_text($message)
      @qiangxz_window.hide
      Graphics.wait(60)
      @fang_window.activate
      @qiangxz_window.deactivate
      $当前使用宝石加成率 = 0
      $usegem = false
      @fang_window.update_help
      @fang_window.refresh
      @command_window.deactivate
end
  end
  
  def qiangxz_cancel
    @wu_window.show
    @qiangxz_window.hide
    @qiangxz_window.deactivate
    if $wufang == true
      @wu_window.activate
    else
      @fang_window.activate
    end
    $当前使用宝石加成率 = 0
    $usegem = false
    @command_window.deactivate
  end
  
  def qianging
    i = 0
    while i < 20
      i += 1
      text = "\n"
      text += "★" * i + "☆" * (20 - i)
      text = text + "\n强化中,请等待。"
      @qianghelp_window.set_text(text)
      Graphics.wait(6)
    end
  end
end

class RPG::EquipItem < RPG::BaseItem
  alias old initialize
  def initialize
    old
    @up = 0 #装备强化次数
  end
  attr_accessor :up
end
#==============================================================================
# ■ Window_Qiangwu
#------------------------------------------------------------------------------
#  强化系统_武器强化窗口
#==============================================================================

class Window_Qiangwu < Window_ItemList
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(qianghelp,xuanze)
    super(0, 0, Graphics.width, fitting_height(8))
    self.openness = 0
    deactivate
    @qianghelp = qianghelp
    @xuanze = xuanze
  end
  #--------------------------------------------------------------------------
  # ● 开始输入的处理
  #--------------------------------------------------------------------------
  def start
    self.category = :weapon
    refresh
    select(0)
    open
    activate
  end
  #--------------------------------------------------------------------------
  # ● 查询此物品是否可用
  #--------------------------------------------------------------------------
  def enable?(item)
    return false unless item != nil
    Qiang.weaponupable?(item.id)
  end
  #--------------------------------------------------------------------------
  # ● 确定强化武器
  #--------------------------------------------------------------------------
  def qiangwu_ok
    result = item ? item.id : 0
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    return unless item != nil
    @help_window.set_item(item)
    needmoney = 0
    Qiang.weaponupable?(item.id)
    qitemname = Qiang.lostitem.name
    if item.up >= $强化哈希表["最高等级"]
      qitemname = "无法继续升级"
    end
    temp = []
    $usegem == true ? temp.push("使用") : temp.push("未使用")
    temp.push($data_items[$强化哈希表["特殊物品"][0]].name)
    $fangb == true ? temp.push("使用") : temp.push("未使用")
    temp.push($data_items[$强化哈希表["特殊物品"][1]].name)
    $fangj == true ? temp.push("使用") : temp.push("未使用")
    cgl = ($强化哈希表["每级概率"][item.up] + $当前使用宝石加成率).to_s
    if item.up == 0
      min = item.params[2] + 1
      max = min + 5
    else
      if item.up >= $强化哈希表["最高等级"]
        min = item.params[2].to_int
        max = min
      else
    min = (item.params[2] * (1 + $强化哈希表["提升能力"][item.up] / 100)).to_int + item.up
    max = min + item.up * 5
    end
  end
    text = "装备名称:" + item.name + " 强化所需" + Vocab::currency_unit + ":" + Qiang.needmoney.to_s
    text = text + "\n" + "当前强化等级:" + item.up.to_s + " 强化需要:" +  qitemname
    text = text + "\n" + "强化宝石:" + temp [0] + " " + temp[1] + ":" + temp[2]+ " " + temp[3] + ":" + temp[4]
    text = text + "\n" + "成功率:" + cgl + "% " + "强化后攻击力范围:" + min.to_s + "~" + max.to_s
    @qianghelp.set_text(text)
  end
  #--------------------------------------------------------------------------
  # ● 获取当前武器等级
  #--------------------------------------------------------------------------
  def getweaponup
    Qiang.weaponupisnil(item.id)
    item.up
  end
  
  def itemid
    item.id
  end
  #--------------------------------------------------------------------------
  # ● 选择项目
  #--------------------------------------------------------------------------
  def select(index)
    self.index = index if index
    update_help
  end
end
#==============================================================================
# ■ Window_Qiangfang
#------------------------------------------------------------------------------
#  强化系统_防具强化窗口
#==============================================================================

class Window_Qiangfang < Window_ItemList
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(qianghelp,xuanze)
    super(0, 0, Graphics.width, fitting_height(8))
    self.openness = 0
    deactivate
    @qianghelp = qianghelp
    @xuanze = xuanze
  end
  #--------------------------------------------------------------------------
  # ● 开始输入的处理
  #--------------------------------------------------------------------------
  def start
    self.category = :armor
    refresh
    select(0)
    open
    activate
  end
  #--------------------------------------------------------------------------
  # ● 查询此物品是否可用
  #--------------------------------------------------------------------------
  def enable?(item)
    return false unless item != nil
    Qiang.armorupable?(item.id)
  end
  #--------------------------------------------------------------------------
  # ● 确定强化防具
  #--------------------------------------------------------------------------
  def qiangfang_ok
    result = item ? item.id : 0
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    return unless item != nil
    @help_window.set_item(item)
    needmoney = 0
    Qiang.armorupable?(item.id)
    qitemname = Qiang.lostitem.name
    if item.up >= $强化哈希表["最高等级"]
      qitemname = "无法继续升级"
    end
    temp = []
    $usegem == true ? temp.push("使用") : temp.push("未使用")
    temp.push($data_items[$强化哈希表["特殊物品"][0]].name)
    $fangb == true ? temp.push("使用") : temp.push("未使用")
    temp.push($data_items[$强化哈希表["特殊物品"][1]].name)
    $fangj == true ? temp.push("使用") : temp.push("未使用")
    cgl = ($强化哈希表["每级概率"][item.up] + $当前使用宝石加成率).to_s
    if item.up == 0
      min = item.params[3] + 1
      max = min + 5
    else
      if item.up >= $强化哈希表["最高等级"]
        min = item.params[3].to_int
        max = min
      else
    min = (item.params[3] * (1 + $强化哈希表["提升能力"][item.up] / 100)).to_int + item.up
    max = min + item.up * 5
    end
  end
    text = "装备名称:" + item.name + " 强化所需" + Vocab::currency_unit + ":" + Qiang.needmoney.to_s
    text = text + "\n" + "当前强化等级:" + item.up.to_s + " 强化需要:" +  qitemname
    text = text + "\n" + "强化宝石:" + temp [0] + " " + temp[1] + ":" + temp[2]+ " " + temp[3] + ":" + temp[4]
    text = text + "\n" + "成功率:" + cgl + "% " + "强化后防御力范围:" + min.to_s + "~" + max.to_s
    @qianghelp.set_text(text)
  end
  #--------------------------------------------------------------------------
  # ● 获取当前防具等级
  #--------------------------------------------------------------------------
  def getarmorup
    Qiang.armorupisnil(item.id)
    item.up
  end
  
  def itemid
    item.id
  end
  #--------------------------------------------------------------------------
  # ● 选择项目
  #--------------------------------------------------------------------------
  def select(index)
    self.index = index if index
    update_help
  end
end
#==============================================================================
# ■ Window_QiangCommand
#------------------------------------------------------------------------------
#  强化系统中,处理命令选择的窗口。
#==============================================================================

class Window_QiangCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    update_placement
    self.openness = 0
    open
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # ● 更新窗口的位置
  #--------------------------------------------------------------------------
  def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height - height) / 2
  end
  #--------------------------------------------------------------------------
  # ● 生成指令列表
  #--------------------------------------------------------------------------
  def make_command_list
    add_command("强化武器",    :qiangwu)
    add_command("强化防具",    :qiangfang)
    add_command(Vocab::ShopCancel, :cancel)
  end
end
#==============================================================================
# ■ Window_Qianghelp
#------------------------------------------------------------------------------
#  显示说明
#==============================================================================

class Window_Qianghelp < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, fitting_height(4) + 8)
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 544
  end
  #--------------------------------------------------------------------------
  # ● 获取持有金钱
  #--------------------------------------------------------------------------
  def value
    $game_party.gold
  end
  #--------------------------------------------------------------------------
  # ● 获取货币单位
  #--------------------------------------------------------------------------
  def currency_unit
    Vocab::currency_unit
  end
  #--------------------------------------------------------------------------
  # ● 设置内容
  #--------------------------------------------------------------------------
  def set_text(text)
    if text != @text
      @text = text
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● 清除
  #--------------------------------------------------------------------------
  def clear
    set_text("")
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_text_ex(4, 0, @text)
  end
end
#==============================================================================
# ■ Window_Qiangxz
#------------------------------------------------------------------------------
#  强化系统中,选择强化方式的窗口。
#==============================================================================

class Window_Qiangxz < Window_Command
  @havegem = false
  @havefangb = false
  @havefangj = false
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    index = 0
    update_placement
    self.openness = 0
    open
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 180
  end
  #--------------------------------------------------------------------------
  # ● 更新窗口的位置
  #--------------------------------------------------------------------------
  def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height - height) / 2
  end
  #--------------------------------------------------------------------------
  # ● 检查可用
  #--------------------------------------------------------------------------
  def haveitem
    @havegem = false
    @havefangb = false
    @havefangj = false
    for i in $强化哈希表["宝石效果"]
        if $game_party.has_item?($data_items[i[1]])
        @havegem = true
      end
    end
    @havefangb = $game_party.has_item?($data_items[$强化哈希表["特殊物品"][0]])
    @havefangj = $game_party.has_item?($data_items[$强化哈希表["特殊物品"][1]])
  end
  #--------------------------------------------------------------------------
  # ● 生成指令列表
  #--------------------------------------------------------------------------
  def make_command_list
    haveitem
    add_command("宝石",     :gem, @havegem)
    add_command(Qiang.idgetitem($强化哈希表["特殊物品"][0]).name, :fangb, @havefangb)
    add_command(Qiang.idgetitem($强化哈希表["特殊物品"][1]).name, :fangj, @havefangj)
    add_command("开始强化", :start)
    add_command("取消强化", :cancel)
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中所有窗口的父类
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 绘制物品名称
  #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    draw_icon(item.icon_index, x, y, enabled)
    change_color(normal_color, enabled)
  if item.is_a?(RPG::EquipItem)
  if item.up != nil && item.up != 0
    draw_text(x + 24, y, width, line_height, item.name + "+" + item.up.to_s)
  else
    draw_text(x + 24, y, width, line_height, item.name)
  end
  else
    draw_text(x + 24, y, width, line_height, item.name)
  end
  end
end
class Window_ItemList
  #--------------------------------------------------------------------------
  # ● 查询列表中是否含有此物品
  #--------------------------------------------------------------------------
  def include?(item)
    case @category
    when :item
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon)
    when :armor
      item.is_a?(RPG::Armor)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?
    when :gem
      itemid = item ? item.id : 0
      itemid != 0 ? isgem(itemid) : false
    else
      false
    end
  end
  
  def isgem(itemid)
    for i in $强化哈希表["宝石效果"]
      return true if i[1] == itemid
    end
    false
  end
end
#==============================================================================
# ■ Window_Choosegem
#------------------------------------------------------------------------------
#  选择强化使用的宝石
#==============================================================================

class Window_Choosegem < Window_ItemList
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize()
    super(0, 0, Graphics.width, fitting_height(2))
    self.openness = 0
    deactivate
    @wufangwindow = nil
    @qiangxz = nil
    set_handler(:ok,     method(:on_ok))
    set_handler(:cancel, method(:on_cancel))
  end
  
  def wufangwindow=(wufangwindow)
    @wufangwindow = wufangwindow
  end
  def qiangxz=(qiangxz)
    @qiangxz = qiangxz
  end
  #--------------------------------------------------------------------------
  # ● 开始输入的处理
  #--------------------------------------------------------------------------
  def start
    self.category = :gem
    self.y = (Graphics.height - height) / 2
    refresh
    select(0)
    open
    activate
  end
  #--------------------------------------------------------------------------
  # ● 确定时的处理
  #--------------------------------------------------------------------------
  def on_ok
    result = item ? item.id : 0
    if result != 0
     $usegem = true
     $当前使用宝石id = result
     for i in $强化哈希表["宝石效果"]
       $当前使用宝石加成率 = i[0] if i[1] == $当前使用宝石id
     end
   else
     $当前使用宝石加成率 = 0
     $usegem = false
    end
    @wufangwindow.update_help
    @qiangxz.activate
    close
  end
  #--------------------------------------------------------------------------
  # ● 查询此物品是否可用
  #--------------------------------------------------------------------------
  def enable?(item)
    true
  end
  #--------------------------------------------------------------------------
  # ● 取消时的处理
  #--------------------------------------------------------------------------
  def on_cancel
    $当前使用宝石加成率 = 0
    $usegem = false
    @wufangwindow.update_help
    @qiangxz.activate
    close
  end
end
#==============================================================================
# ■ 强化系统DataManager
#------------------------------------------------------------------------------
#  将武器和防具数据保存入存档
#==============================================================================
module DataManager
  #--------------------------------------------------------------------------
  # ● 生成存档内容
  #--------------------------------------------------------------------------
  def self.make_save_contents
    contents = {}
    contents[:system]        = $game_system
    contents[:timer]         = $game_timer
    contents[:message]       = $game_message
    contents[:switches]      = $game_switches
    contents[:variables]     = $game_variables
    contents[:self_switches] = $game_self_switches
    contents[:actors]        = $game_actors
    contents[:party]         = $game_party
    contents[:troop]         = $game_troop
    contents[:map]           = $game_map
    contents[:player]        = $game_player
    contents[:weapons]       = $data_weapons
    contents[:armors]        = $data_armors
    contents
  end
  #--------------------------------------------------------------------------
  # ● 展开存档内容
  #--------------------------------------------------------------------------
  def self.extract_save_contents(contents)
    $game_system        = contents[:system]
    $game_timer         = contents[:timer]
    $game_message       = contents[:message]
    $game_switches      = contents[:switches]
    $game_variables     = contents[:variables]
    $game_self_switches = contents[:self_switches]
    $game_actors        = contents[:actors]
    $game_party         = contents[:party]
    $game_troop         = contents[:troop]
    $game_map           = contents[:map]
    $game_player        = contents[:player]
    $data_weapons       = contents[:weapons]
    $data_armors        = contents[:armors]
  end
end

[RMVA发布 [PS0]物品颜色描绘 ]#==============================================================================
# [PS0]物品颜色描绘
#      Window_Base_Itemcolor
#------------------------------------------------------------------------------
#     在物品、技能选项中显示物品品质并显示品质框和修改物品名颜色。
#==============================================================================
# [更新记录]
#    - 2012.01.03 By 仲秋启明
#      * 修改为VA定义
#    - 2011.12.27 By 仲秋启明
#      * 移植至RGSS3,遵循PS0协议;
#      * 优化数据库备注中设定方法
#    - 2011.08.22 By 冰舞蝶恋
#      * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框)
#    - 2010.08.06 By 仲秋启明
#      * 蓝本(物品颜色描绘脚本(完整无冲突版))
#------------------------------------------------------------------------------
# [使用方法]
#    - 替换原Window_Base中的draw_item_name定义或复制到Main之前
#==============================================================================
$_PS0 = {} if $_PS0 == nil  
$_PS0["Window_Base_Itemcolor"] = 20111227
#==============================================================================
# [PS0] 通用配置模块  
#==============================================================================
module PS0
  module Window_Base_Itemcolor
    Color1 = Color.new(255, 255, 255)  # 一般品质的色彩(白,1)
    Color2 = Color.new(128, 255, 128)  # 平庸品质的色彩(绿,2)
    Color3 = Color.new(128, 128, 255)  # 精良品质的色彩(蓝,3)
    Color4 = Color.new(255, 0, 255)    # 卓越品质的色彩(紫,4)
    Color5 = Color.new(255, 128, 128)  # 神秘品质的色彩(红,5)
    Color6 = Color.new(255, 128, 0)    # 传说品质的色彩(橙,6)
    Color7 = Color.new(255, 255, 128)  # 特殊品质的色彩(黄,7)
  end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  def draw_item_name(item, x, y, enabled = true, width = 172)
    if item != nil
      n = item.note
      a = n.split{/<(?:Quality|品质)\s*(.+)>/i}
      c = a[1].to_i
      if c <= 1
        color = PS0::Window_Base_Itemcolor::Color1
      elsif c == 2
        color = PS0::Window_Base_Itemcolor::Color2
      elsif c == 3
        color = PS0::Window_Base_Itemcolor::Color3
      elsif c == 4
        color = PS0::Window_Base_Itemcolor::Color4
      elsif c == 5
        color = PS0::Window_Base_Itemcolor::Color5
      elsif c == 6
        color = PS0::Window_Base_Itemcolor::Color6
      elsif c == 7
        color = PS0::Window_Base_Itemcolor::Color7
      else
        color = Color.new(0, 0, 0, 0)
      end
      self.contents.fill_rect(x, y, 24, 1, color)
      self.contents.fill_rect(x, y, 1, 24, color)
      self.contents.fill_rect(x, y+23, 24, 1, color)
      self.contents.fill_rect(x+23, y, 1, 24, color)
      draw_icon(item.icon_index, x, y, enabled)
      change_color(color, enabled)
      draw_text(x + 24, y, width, line_height, item.name)
    end
  end
end
#==============================================================================
# [PS0] End of Script
#==============================================================================

换成【PSO】就不会跳窗

换成【PSO】就不会跳窗
梦石
0
星屑
4058
在线时间
836 小时
注册时间
2013-7-29
回帖
145

开拓者

发表于 2015-9-14 11:42:07 | 显示全部楼层
应该是没有冲突的,把报错跳窗截图发上来啊
现在论坛上的少,有事联系
QQ:2287688663
回复

使用道具 举报

梦石
0
星屑
1554
在线时间
523 小时
注册时间
2015-8-23
回帖
83
 楼主| 发表于 2015-9-14 13:53:53 | 显示全部楼层
dongdongdjh 发表于 2015-9-14 11:42
应该是没有冲突的,把报错跳窗截图发上来啊

好的,我就上传。

点评

感觉跟这个很像:http://rm.66rpg.com/thread-392794-1-1.html抱歉在下不再仔细读题了,如果阁下觉得有用,那更好  发表于 2016-5-5 17:10
主要是2个脚本的draw_item_name冲突了,改了一下。  发表于 2015-9-14 15:09
回复

使用道具 举报

梦石
0
星屑
4058
在线时间
836 小时
注册时间
2013-7-29
回帖
145

开拓者

发表于 2015-9-14 14:56:11 | 显示全部楼层
[pre lang="ruby"]#==============================================================================
#  ■ 物品颜色描绘 Ver.1.3  - By 柍若
#     ItemLevelDrawer
#------------------------------------------------------------------------------
#    Item类窗口中给图标描绘彩色边框以表示品质等级,同时改变名称颜色。
#     物品、技能、装备等适用。
#==============================================================================
#
#    - 2014.02.05 By 柍若
#      * [ BUG修正 ]重定义品质判定算法,兼容性更良。   
#      * [    优化 ]简化写法(基本是重写了)。              
#      * [    补充 ]无限扩张品级数目。支持自定义。    
#      * [    补充 ]添加背景块,支持不透明度设定。    
#      * [  新功能 ]美化品质框,可选圆角或方角形状。   
#      * [    优化 ]修正名称文字显示位置。          
#      * [  新功能 ]定义全局自动/ 手动描绘两种模式可切换。
#      * [  新功能 ]物品名称可用控制符。
#
#------------------------------------------------------------------------------
#      基于以下脚本
#      改写已取得两位作者同意
#==============================================================================
#    - 2012.01.03 By 仲秋启明
#      * 修改为VA定义
#    - 2011.12.27 By 仲秋启明
#      * 移植至RGSS3,遵循PS0协议;
#      * 优化数据库备注中设定方法
#    - 2011.08.22 By 冰舞蝶恋
#      * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框)
#    - 2010.08.06 By 仲秋启明
#      * 蓝本(物品颜色描绘脚本(完整无冲突版))
#------------------------------------------------------------------------------
# [使用说明]
#    - 替换原Window_Base中的draw_item_name定义或复制到Main之前
#------------------------------------------------------------------------------
# [使用方法]
#    - 在备注栏内填写"<品质 n>",其中n表示品质等级。
#==============================================================================
module ItemLevelDrawer
#==============================================================================
                 
    # true: 默认全局描绘    / false: 手动设置描绘
   
    WhenZero = true   # 开启则当品质为0(即不填)时,默认描绘品质1颜色
#------------------------------------------------------------------------------

    # true: 圆角    / false: 方角
   
    CornerShape = true
#------------------------------------------------------------------------------

    # 背景块不透明度
   
    BackOpacity = 160
#------------------------------------------------------------------------------
   
    # 各品质颜色设置,预设7种,可自行添加新品级
    # 数据库设定的品质大于下列品质的最大值时,将不描绘品质
   
    ColorSet = [[255, 255, 255],   # 备注 <品质 1> 或不填    [ 白 ]
   
                [128, 255, 128],   # 备注 <品质 2>        [ 绿 ]
                 
                [128, 128, 255],   # 备注 <品质 3>        [ 蓝 ]
                 
                [255,   0, 255],   # 备注 <品质 4>        [ 紫 ]
                 
                [255, 128, 128],   # 备注 <品质 5>        [ 红 ]
                 
                [255, 128,   0],   # 备注 <品质 6>        [ 橙 ]
                 
                [255, 255, 128],   # 备注 <品质 7>        [ 黄 ]
                 
                ]
#==============================================================================
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  alias din2 draw_item_name
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    n = $1.to_i if /<品质 (\d+?)>/i =~ item.note
    x += 2
    return din2(item, x, y, enabled, width) unless n or ItemLevelDrawer::WhenZero and n.to_i <= ItemLevelDrawer::ColorSet.size
    n -= 1 if n and n >= 1
    n = 0 unless n
    n = ItemLevelDrawer::ColorSet[n.to_i]
    self.contents.fill_rect(x+1, y+2, 22, 20, Color.new(n[0], n[1], n[2], ItemLevelDrawer::BackOpacity))
    s = 1 if ItemLevelDrawer::CornerShape
    self.contents.fill_rect(x+s.to_i, y+1, 24-s.to_i*2, 1, Color.new(n[0], n[1], n[2]))
    self.contents.fill_rect(x, y+s.to_i+1, 1, 22-s.to_i*2, Color.new(n[0], n[1], n[2]))
    self.contents.fill_rect(x+s.to_i, y+22, 24-s.to_i*2, 1, Color.new(n[0], n[1], n[2]))
    self.contents.fill_rect(x+23, y+s.to_i+1, 1, 22-s.to_i*2, Color.new(n[0], n[1], n[2]))
    draw_icon(item.icon_index, x, y, enabled)
    change_color(Color.new(n[0], n[1], n[2]), enabled)
    if item.is_a?(RPG::EquipItem)
    if item.up != nil && item.up != 0
      draw_text_ex(x + 30, y, item.name + "+" + item.up.to_s, Color.new(n[0], n[1], n[2]))
    else
      draw_text_ex(x + 30, y, item.name, Color.new(n[0], n[1], n[2]))
    end
    else
      draw_text_ex(x + 30, y, item.name, Color.new(n[0], n[1], n[2]))
    end
  end
  def draw_text_ex(x, y, text, initial_color = normal_color)
    reset_font_settings(initial_color)
    text = convert_escape_characters(text)
    pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
    process_character(text.slice!(0, 1), text, pos) until text.empty?
  end
  def reset_font_settings(initial_color = normal_color)
    change_color(initial_color)
    contents.font.size = Font.default_size
    contents.font.bold = Font.default_bold
    contents.font.italic = Font.default_italic
  end
end
#==============================================================================
# End of Script
#==============================================================================[/pre]

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 辛苦了,但应该有人改过

查看全部评分

现在论坛上的少,有事联系
QQ:2287688663
回复

使用道具 举报

梦石
0
星屑
4058
在线时间
836 小时
注册时间
2013-7-29
回帖
145

开拓者

发表于 2015-9-14 14:56:38 | 显示全部楼层
[pre lang="ruby"]#==============================================================================
# ■ 强化系统 优化版
#------------------------------------------------------------------------------
#  强化系统  wyongcan制作
# 优化版更新内容:优化了语法,修复部分BUG,使代码可读性增强,增加了宝石选择窗口
# 发布于66RPG  转载请保留版权信息
#==============================================================================
module Qiang
$maxlv = 12  #最高升到的级数
$gailv = [100,80,70,60,50,30,20,10,5,5,5,5,1] #每级提升概率
$gemlv = [[60,23],[10,28],[25,29],[40,30]] #使用宝石提高的几率  [提高几率,宝石ID]
$uplv = [[12,24],[3,25],[6,26],[9,27]] #强化所需要的强化石 [最大强化到的等级,强化石ID]
$xxlv = [0,0,5,10,15,20,25,30,30,40,40,45,60] #每级强化后失败物品消失的几率
$jjlv = [0,10,15,20,30,45,55,65,70,70,75,80,100] #每级强化后失败物品降级的几率
$tsnl = [10,14,18,22,26,30,34,38,42,46,50,54,65] #每级强化提升能力的百分比
$tswp = [31,32] # 意思是:如果有31号物品则失败后物品不消失,如果有32号物品则失败后物品不降级
#武器强化后的计算公式为: 原攻击 * (1 + 提升能力百分比) + (0到当前强化级数随机) * 5 + 当前强化级数
$gemlv.sort!
$uplv.sort!
$当前使用宝石id = 0
$当前使用宝石加成率 = 0
$强化哈希表 = {
"最高等级" => $maxlv ,
"每级概率" => $gailv ,
"宝石效果" => $gemlv ,
"消失几率" => $xxlv  ,
"降级几率" => $jjlv  ,
"提升能力" => $tsnl  ,
"特殊物品" => $tswp  ,
"强化材料" => $uplv  }
def self.idlostitem(id,amount = 1)
  $game_party.lose_item(idgetitem(id),amount)
end

def self.idlostequip(id,weapon = true,amount = 1)
  weapon == true ? $game_party.lose_item($data_weapons[id],amount,true) : $game_party.lose_item($data_armors[id],amount,true)
end

def self.idgainequip(id,weapon = true,amount = 1)
  weapon == true ? $game_party.gain_item($data_weapons[id],amount,true) : $game_party.gain_item($data_armors[id],amount,true)
end

def self.idgetitem(id)
  $data_items[id]
end

def self.equipable?(id,weapon = true)
  weapon == true ? weaponupisnil(id) : armorupisnil(id)
  weapon == true ? equip = $data_weapons[id].dup : equip = $data_armors[id].dup
  price = equip.price
  @needmoney = price * equip.up
  if @needmoney == 0
    @needmoney = price / 2
  end
#循环取出需要的强化材料
  temp = false
  for i in $强化哈希表["强化材料"]
    if equip.up < i[0]
      @lostitem = idgetitem i[1]
      $game_party.has_item?(idgetitem(i[1])) ? temp = true : temp = false
      break
    end
  end
  $game_party.gold >= @needmoney && temp == true ? true : false
end

def self.upweapon (id)
  $message = ""
  success = false
  weaponupisnil(id)
  weapon = $data_weapons[id].dup
  gl = 0
  fangb = false
  fangj = false
  return unless weapon.up < $强化哈希表["最高等级"] && weaponupable?(id)
  loststh
  $message += "本次强化,共消耗:" + Vocab::currency_unit + " " + @needmoney.to_s
  $message += " " + @lostitem.name + "\n "
  gl = $强化哈希表["每级概率"][weapon.up]
  if $usegem == true
    gl += $当前使用宝石加成率
    idlostitem($当前使用宝石id)
    $message += idgetitem($当前使用宝石id).name + " "
  end
  if $fangb == true
    fangb = true
    idlostitem $强化哈希表["特殊物品"][0]
    $message += idgetitem($强化哈希表["特殊物品"][0]).name + " "
  end
  if $fangj == true
    fangj = true
    idlostitem $强化哈希表["特殊物品"][1]
    $message += idgetitem($强化哈希表["特殊物品"][1]).name + " "
  end
  suiji = rand (100)
  if suiji <= gl
    success = true
  end
  $message += "\n强化结果:"
  if success == true
    $message += "强化成功"
    idlostequip id
    weapon.id = $data_weapons.size
    params = weapon.params.dup
    params[2] *= 1 + $强化哈希表["提升能力"][weapon.up] / 100
    params[2] += rand(weapon.up) * 5 + weapon.up
    params[2] += 1 if params[2] == weapon.params[2]
    $message += " 攻击力提升:" + (params[2] - weapon.params[2]).to_int.to_s
    weapon.up += 1
    $data_weapons.insert $data_weapons.size,weapon
    $data_weapons[$data_weapons.size-1].params = params
    idgainequip weapon.id
  else
    $message += "强化失败"
    suiji = rand (100)
    if suiji <= $强化哈希表["消失几率"][weapon.up]
      if fangb != true
      $message += ",道具消失"
      idlostequip id
      else
      $message += ",由于" + idgetitem($强化哈希表["特殊物品"][0]).name + "的作用,道具未消失"
      end
    else
      suiji = rand (100)
      if suiji <= $强化哈希表["降级几率"][weapon.up]
        if fangj == false && weapon.up != 0
          $message += ",道具降级"
          params = weapon.params.dup
          params[2] -= weapon.up + rand(weapon.up) * 5
          params[2] /= 1 + $强化哈希表["提升能力"][weapon.up] / 100
          weapon.params = params
          weapon.up -= 1
          $data_weapons[id] = weapon
        else
          $message += ",由于" + idgetitem($强化哈希表["特殊物品"][1]).name + "的作用,道具未降级"
        end
      end
    end
  end
   $usegem = false
   $fangb = false
   $fangj = false
end

def self.weaponupisnil(id)
   $data_weapons[id].up = 0 unless $data_weapons[id].up != nil
end

def self.weaponupable?(id)
  equipable?(id)
end

def self.uparmor (id)
  $message = ""
  success = false
  armorupisnil(id)
  armor = $data_armors[id].dup
  gl = 0
  fangb = false
  fangj = false
  return unless armor.up < $强化哈希表["最高等级"] && armorupable?(id)
  loststh
  $message += "本次强化,共消耗:" + Vocab::currency_unit + " " + @needmoney.to_s
  $message += " " + @lostitem.name + "\n "
  gl = $强化哈希表["每级概率"][armor.up]
  if $usegem == true
    gl += $当前使用宝石加成率
    idlostitem($当前使用宝石id)
    $message += idgetitem($当前使用宝石id).name + " "
  end
  if $fangb == true
    fangb = true
    idlostitem $强化哈希表["特殊物品"][0]
    $message += idgetitem($强化哈希表["特殊物品"][0]).name + " "
  end
  if $fangj == true
    fangj = true
    idlostitem $强化哈希表["特殊物品"][1]
    $message += idgetitem($强化哈希表["特殊物品"][1]).name + " "
  end
  suiji = rand (100)
  if suiji <= gl
    success = true
  end
  $message += "\n强化结果:"
  if success == true
    $message += "强化成功"
    idlostequip id,false
    armor.id = $data_armors.size
    params = armor.params.dup
    params[3] *= 1 + $强化哈希表["提升能力"][armor.up] / 100
    params[3] += rand(armor.up) * 5 + armor.up
    params[3] += 1 if params[3] == armor.params[3]
    $message += " 防御力提升:" + (params[3] - armor.params[3]).to_int.to_s
    armor.up += 1
    $data_armors.insert $data_armors.size,armor
    $data_armors[$data_armors.size-1].params = params
    idgainequip armor.id,false
  else
    $message += "强化失败"
    suiji = rand (100)
    if suiji <= $强化哈希表["消失几率"][armor.up]
      if fangb != true
      $message += ",道具消失"
      idlostequip id,false
      else
      $message += ",由于" + idgetitem($强化哈希表["特殊物品"][0]).name + "的作用,道具未消失"
      end
    else
      suiji = rand (100)
      if suiji <= $强化哈希表["降级几率"][armor.up]
        if fangj == false && armor.up != 0
          $message += ",道具降级"
          params = armor.params.dup
          params[3] -= armor.up + rand(armor.up) * 5
          params[3] /= 1 + $强化哈希表["提升能力"][armor.up] / 100
          armor.params = params
          armor.up -= 1
          $data_armors[id] = armor
        else
          $message += ",由于" + idgetitem($强化哈希表["特殊物品"][1]).name + "的作用,道具未降级"
        end
      end
    end
  end
   $usegem = false
   $fangb = false
   $fangj = false
end

def self.armorupisnil(id)
   $data_armors[id].up = 0 unless $data_armors[id].up != nil
end
def self.armorupable?(id)
  equipable?(id,false)
end
def self.loststh()
   $game_party.lose_item(@lostitem,1)
   $game_party.lose_gold(@needmoney)
end
def self.needmoney
   @needmoney
end
def self.lostitem
   @lostitem
end
end
#==============================================================================
# ■ Scene_Qiang
#------------------------------------------------------------------------------
#  强化画面
#==============================================================================

class Scene_Qiang < Scene_MenuBase
  $wufang = true
  $usegem = false
  $fangb = false
  $fangj = false
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def start
    super
    create_help_window
    @help_window.hide
    create_qianghelp_window
    create_command_window
    create_qiangxz_window
    create_wu_window
    create_fang_window
    create_choosegem_window
  end
  #--------------------------------------------------------------------------
  # ● 生成说明窗口
  #--------------------------------------------------------------------------
  def create_qianghelp_window
    @qianghelp_window = Window_Qianghelp.new
    @qianghelp_window.y = Graphics.height - @qianghelp_window.height
    @qianghelp_window.viewport = @viewport
    @qianghelp_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 生成选择宝石
  #--------------------------------------------------------------------------
  def create_choosegem_window
    @choosegem_window = Window_Choosegem.new
    @choosegem_window.y = Graphics.height - @choosegem_window.height
    @choosegem_window.viewport = @viewport
    @choosegem_window.z = 120
  end
  #--------------------------------------------------------------------------
  # ● 生成选择窗口
  #--------------------------------------------------------------------------
  def create_qiangxz_window
    @qiangxz_window = Window_Qiangxz.new
    @qiangxz_window.y = @help_window.height + fitting_height(5) /2
    @qiangxz_window.z = 110
    @qiangxz_window.viewport = @viewport
    @qiangxz_window.set_handler(:gem,    method(:qiangxz_gem))
    @qiangxz_window.set_handler(:fangb,    method(:qiangxz_fangb))
    @qiangxz_window.set_handler(:fangj,    method(:qiangxz_fangj))
    @qiangxz_window.set_handler(:ok, method(:qiangxz_ok))
    @qiangxz_window.set_handler(:cancel, method(:qiangxz_cancel))
    @qiangxz_window.hide
    @qiangxz_window.deactivate
  end
  #--------------------------------------------------------------------------
  # ● 生成指令窗口
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_QiangCommand.new
    @command_window.viewport = @viewport
    @command_window.y = @help_window.height + fitting_height(3) /2
    @command_window.set_handler(:qiangwu,    method(:qiangwu))
    @command_window.set_handler(:qiangfang,   method(:qiangfang))
    @command_window.set_handler(:cancel, method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # ● 生成武器强化窗口
  #--------------------------------------------------------------------------
  def create_wu_window
    @wu_window = Window_Qiangwu.new(@qianghelp_window,@qiangxz_window)
    @wu_window.viewport = @viewport
    @wu_window.y += @help_window.height
    @wu_window.hide
    @wu_window.help_window= @help_window
    @wu_window.set_handler(:cancel, method(:qiangwu_cancel))
    @wu_window.set_handler(:ok,     method(:qiangwu_ok))
  end
  #--------------------------------------------------------------------------
  # ● 生成防具强化窗口
  #--------------------------------------------------------------------------
  def create_fang_window
    @fang_window = Window_Qiangfang.new(@qianghelp_window,@qiangxz_window)
    @fang_window.viewport = @viewport
    @fang_window.y += @help_window.height
    @fang_window.hide
    @fang_window.help_window= @help_window
    @fang_window.set_handler(:cancel, method(:qiangfang_cancel))
    @fang_window.set_handler(:ok,     method(:qiangfang_ok))
  end
  #--------------------------------------------------------------------------
  # ● 计算窗口显示指定行数时的应用高度
  #--------------------------------------------------------------------------
  def fitting_height(line_number)
    line_number * 24 + 12 * 2
  end
  #--------------------------------------------------------------------------
  # ● 显示强化武器
  #--------------------------------------------------------------------------
  def qiangwu
    @command_window.hide
    @help_window.show
    @wu_window.show
    @wu_window.start
    @qianghelp_window.show
    @wu_window.activate
    $wufang = true
    @command_window.deactivate
  end
  #--------------------------------------------------------------------------
  # ● 显示强化防具
  #--------------------------------------------------------------------------
  def qiangfang
    @command_window.hide
    @help_window.show
    @fang_window.show
    @fang_window.start
    @qianghelp_window.show
    @fang_window.activate
    $wufang = false
    @command_window.deactivate
  end
  #--------------------------------------------------------------------------
  # ● 取消强化武器
  #--------------------------------------------------------------------------
  def qiangwu_cancel
    @command_window.show
    @help_window.hide
    @wu_window.hide
    @qianghelp_window.hide
    @command_window.activate
    @qianghelp_window.set_text("")
    @help_window.set_text("")
  end
  #--------------------------------------------------------------------------
  # ● 取消强化防具
  #--------------------------------------------------------------------------
  def qiangfang_cancel
    @command_window.show
    @help_window.hide
    @fang_window.hide
    @qianghelp_window.hide
    @command_window.activate
    @qianghelp_window.set_text("")
    @help_window.set_text("")
  end
  #--------------------------------------------------------------------------
  # ● 确定强化武器
  #--------------------------------------------------------------------------
  def qiangwu_ok
    @wu_window.qiangwu_ok
    @qiangxz_window.show
    @qiangxz_window.activate
  end
  #--------------------------------------------------------------------------
  # ● 确定强化防具
  #--------------------------------------------------------------------------
  def qiangfang_ok
    @fang_window.qiangfang_ok
    @qiangxz_window.show
    @qiangxz_window.activate
  end
  #--------------------------------------------------------------------------
  # ● 获取卖出价格
  #--------------------------------------------------------------------------
  def selling_price
    @item.price / 2
  end
  
  def qiangxz_gem
    @choosegem_window.start
    @qiangxz_window.deactivate
    @choosegem_window.qiangxz= @qiangxz_window
    if $wufang == true
      @choosegem_window.wufangwindow= @wu_window
    else
      @choosegem_window.wufangwindow= @fang_window
    end
  end
  
  def qiangxz_fangb
    $fangb = !$fangb
    if $wufang == true
      @wu_window.update_help
    else
      @fang_window.update_help
    end
    @qiangxz_window.activate
  end
  
  def qiangxz_fangj
    $fangj = !$fangj
    if $wufang == true
      @wu_window.update_help
    else
      @fang_window.update_help
    end
    @qiangxz_window.activate
  end
  
  def qiangxz_ok
    if $wufang == true
      Qiang.upweapon(@wu_window.itemid)
      qianging
      @qianghelp_window.set_text($message)
      @qiangxz_window.hide
      Graphics.wait(60)
      @wu_window.activate
      @qiangxz_window.deactivate
      $当前使用宝石加成率 = 0
      $usegem = false
      @fang_window.update_help
      @wu_window.refresh
      @command_window.deactivate
    else
      Qiang.uparmor(@fang_window.itemid)
      qianging
      @qianghelp_window.set_text($message)
      @qiangxz_window.hide
      Graphics.wait(60)
      @fang_window.activate
      @qiangxz_window.deactivate
      $当前使用宝石加成率 = 0
      $usegem = false
      @fang_window.update_help
      @fang_window.refresh
      @command_window.deactivate
end
  end
  
  def qiangxz_cancel
    @wu_window.show
    @qiangxz_window.hide
    @qiangxz_window.deactivate
    if $wufang == true
      @wu_window.activate
    else
      @fang_window.activate
    end
    $当前使用宝石加成率 = 0
    $usegem = false
    @command_window.deactivate
  end
  
  def qianging
    i = 0
    while i < 20
      i += 1
      text = "\n"
      text += "★" * i + "☆" * (20 - i)
      text = text + "\n强化中,请等待。"
      @qianghelp_window.set_text(text)
      Graphics.wait(6)
    end
  end
end

class RPG::EquipItem < RPG::BaseItem
  alias old initialize
  def initialize
    old
    @up = 0 #装备强化次数
  end
  attr_accessor :up
end
#==============================================================================
# ■ Window_Qiangwu
#------------------------------------------------------------------------------
#  强化系统_武器强化窗口
#==============================================================================

class Window_Qiangwu < Window_ItemList
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(qianghelp,xuanze)
    super(0, 0, Graphics.width, fitting_height(8))
    self.openness = 0
    deactivate
    @qianghelp = qianghelp
    @xuanze = xuanze
  end
  #--------------------------------------------------------------------------
  # ● 开始输入的处理
  #--------------------------------------------------------------------------
  def start
    self.category = :weapon
    refresh
    select(0)
    open
    activate
  end
  #--------------------------------------------------------------------------
  # ● 查询此物品是否可用
  #--------------------------------------------------------------------------
  def enable?(item)
    return false unless item != nil
    Qiang.weaponupable?(item.id)
  end
  #--------------------------------------------------------------------------
  # ● 确定强化武器
  #--------------------------------------------------------------------------
  def qiangwu_ok
    result = item ? item.id : 0
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    return unless item != nil
    @help_window.set_item(item)
    needmoney = 0
    Qiang.weaponupable?(item.id)
    qitemname = Qiang.lostitem.name
    if item.up >= $强化哈希表["最高等级"]
      qitemname = "无法继续升级"
    end
    temp = []
    $usegem == true ? temp.push("使用") : temp.push("未使用")
    temp.push($data_items[$强化哈希表["特殊物品"][0]].name)
    $fangb == true ? temp.push("使用") : temp.push("未使用")
    temp.push($data_items[$强化哈希表["特殊物品"][1]].name)
    $fangj == true ? temp.push("使用") : temp.push("未使用")
    cgl = ($强化哈希表["每级概率"][item.up] + $当前使用宝石加成率).to_s
    if item.up == 0
      min = item.params[2] + 1
      max = min + 5
    else
      if item.up >= $强化哈希表["最高等级"]
        min = item.params[2].to_int
        max = min
      else
    min = (item.params[2] * (1 + $强化哈希表["提升能力"][item.up] / 100)).to_int + item.up
    max = min + item.up * 5
    end
  end
    text = "装备名称:" + item.name + " 强化所需" + Vocab::currency_unit + ":" + Qiang.needmoney.to_s
    text = text + "\n" + "当前强化等级:" + item.up.to_s + " 强化需要:" +  qitemname
    text = text + "\n" + "强化宝石:" + temp [0] + " " + temp[1] + ":" + temp[2]+ " " + temp[3] + ":" + temp[4]
    text = text + "\n" + "成功率:" + cgl + "% " + "强化后攻击力范围:" + min.to_s + "~" + max.to_s
    @qianghelp.set_text(text)
  end
  #--------------------------------------------------------------------------
  # ● 获取当前武器等级
  #--------------------------------------------------------------------------
  def getweaponup
    Qiang.weaponupisnil(item.id)
    item.up
  end
  
  def itemid
    item.id
  end
  #--------------------------------------------------------------------------
  # ● 选择项目
  #--------------------------------------------------------------------------
  def select(index)
    self.index = index if index
    update_help
  end
end
#==============================================================================
# ■ Window_Qiangfang
#------------------------------------------------------------------------------
#  强化系统_防具强化窗口
#==============================================================================

class Window_Qiangfang < Window_ItemList
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(qianghelp,xuanze)
    super(0, 0, Graphics.width, fitting_height(8))
    self.openness = 0
    deactivate
    @qianghelp = qianghelp
    @xuanze = xuanze
  end
  #--------------------------------------------------------------------------
  # ● 开始输入的处理
  #--------------------------------------------------------------------------
  def start
    self.category = :armor
    refresh
    select(0)
    open
    activate
  end
  #--------------------------------------------------------------------------
  # ● 查询此物品是否可用
  #--------------------------------------------------------------------------
  def enable?(item)
    return false unless item != nil
    Qiang.armorupable?(item.id)
  end
  #--------------------------------------------------------------------------
  # ● 确定强化防具
  #--------------------------------------------------------------------------
  def qiangfang_ok
    result = item ? item.id : 0
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    return unless item != nil
    @help_window.set_item(item)
    needmoney = 0
    Qiang.armorupable?(item.id)
    qitemname = Qiang.lostitem.name
    if item.up >= $强化哈希表["最高等级"]
      qitemname = "无法继续升级"
    end
    temp = []
    $usegem == true ? temp.push("使用") : temp.push("未使用")
    temp.push($data_items[$强化哈希表["特殊物品"][0]].name)
    $fangb == true ? temp.push("使用") : temp.push("未使用")
    temp.push($data_items[$强化哈希表["特殊物品"][1]].name)
    $fangj == true ? temp.push("使用") : temp.push("未使用")
    cgl = ($强化哈希表["每级概率"][item.up] + $当前使用宝石加成率).to_s
    if item.up == 0
      min = item.params[3] + 1
      max = min + 5
    else
      if item.up >= $强化哈希表["最高等级"]
        min = item.params[3].to_int
        max = min
      else
    min = (item.params[3] * (1 + $强化哈希表["提升能力"][item.up] / 100)).to_int + item.up
    max = min + item.up * 5
    end
  end
    text = "装备名称:" + item.name + " 强化所需" + Vocab::currency_unit + ":" + Qiang.needmoney.to_s
    text = text + "\n" + "当前强化等级:" + item.up.to_s + " 强化需要:" +  qitemname
    text = text + "\n" + "强化宝石:" + temp [0] + " " + temp[1] + ":" + temp[2]+ " " + temp[3] + ":" + temp[4]
    text = text + "\n" + "成功率:" + cgl + "% " + "强化后防御力范围:" + min.to_s + "~" + max.to_s
    @qianghelp.set_text(text)
  end
  #--------------------------------------------------------------------------
  # ● 获取当前防具等级
  #--------------------------------------------------------------------------
  def getarmorup
    Qiang.armorupisnil(item.id)
    item.up
  end
  
  def itemid
    item.id
  end
  #--------------------------------------------------------------------------
  # ● 选择项目
  #--------------------------------------------------------------------------
  def select(index)
    self.index = index if index
    update_help
  end
end
#==============================================================================
# ■ Window_QiangCommand
#------------------------------------------------------------------------------
#  强化系统中,处理命令选择的窗口。
#==============================================================================

class Window_QiangCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    update_placement
    self.openness = 0
    open
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # ● 更新窗口的位置
  #--------------------------------------------------------------------------
  def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height - height) / 2
  end
  #--------------------------------------------------------------------------
  # ● 生成指令列表
  #--------------------------------------------------------------------------
  def make_command_list
    add_command("强化武器",    :qiangwu)
    add_command("强化防具",    :qiangfang)
    add_command(Vocab::ShopCancel, :cancel)
  end
end
#==============================================================================
# ■ Window_Qianghelp
#------------------------------------------------------------------------------
#  显示说明
#==============================================================================

class Window_Qianghelp < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, fitting_height(4) + 8)
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 544
  end
  #--------------------------------------------------------------------------
  # ● 获取持有金钱
  #--------------------------------------------------------------------------
  def value
    $game_party.gold
  end
  #--------------------------------------------------------------------------
  # ● 获取货币单位
  #--------------------------------------------------------------------------
  def currency_unit
    Vocab::currency_unit
  end
  #--------------------------------------------------------------------------
  # ● 设置内容
  #--------------------------------------------------------------------------
  def set_text(text)
    if text != @text
      @text = text
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● 清除
  #--------------------------------------------------------------------------
  def clear
    set_text("")
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_text_ex(4, 0, @text)
  end
end
#==============================================================================
# ■ Window_Qiangxz
#------------------------------------------------------------------------------
#  强化系统中,选择强化方式的窗口。
#==============================================================================

class Window_Qiangxz < Window_Command
  @havegem = false
  @havefangb = false
  @havefangj = false
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    index = 0
    update_placement
    self.openness = 0
    open
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 180
  end
  #--------------------------------------------------------------------------
  # ● 更新窗口的位置
  #--------------------------------------------------------------------------
  def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height - height) / 2
  end
  #--------------------------------------------------------------------------
  # ● 检查可用
  #--------------------------------------------------------------------------
  def haveitem
    @havegem = false
    @havefangb = false
    @havefangj = false
    for i in $强化哈希表["宝石效果"]
        if $game_party.has_item?($data_items[i[1]])
        @havegem = true
      end
    end
    @havefangb = $game_party.has_item?($data_items[$强化哈希表["特殊物品"][0]])
    @havefangj = $game_party.has_item?($data_items[$强化哈希表["特殊物品"][1]])
  end
  #--------------------------------------------------------------------------
  # ● 生成指令列表
  #--------------------------------------------------------------------------
  def make_command_list
    haveitem
    add_command("宝石",     :gem, @havegem)
    add_command(Qiang.idgetitem($强化哈希表["特殊物品"][0]).name, :fangb, @havefangb)
    add_command(Qiang.idgetitem($强化哈希表["特殊物品"][1]).name, :fangj, @havefangj)
    add_command("开始强化", :start)
    add_command("取消强化", :cancel)
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中所有窗口的父类
#==============================================================================


class Window_ItemList
  #--------------------------------------------------------------------------
  # ● 查询列表中是否含有此物品
  #--------------------------------------------------------------------------
  def include?(item)
    case @category
    when :item
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon)
    when :armor
      item.is_a?(RPG::Armor)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?
    when :gem
      itemid = item ? item.id : 0
      itemid != 0 ? isgem(itemid) : false
    else
      false
    end
  end
  
  def isgem(itemid)
    for i in $强化哈希表["宝石效果"]
      return true if i[1] == itemid
    end
    false
  end
end
#==============================================================================
# ■ Window_Choosegem
#------------------------------------------------------------------------------
#  选择强化使用的宝石
#==============================================================================

class Window_Choosegem < Window_ItemList
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize()
    super(0, 0, Graphics.width, fitting_height(2))
    self.openness = 0
    deactivate
    @wufangwindow = nil
    @qiangxz = nil
    set_handler(:ok,     method(:on_ok))
    set_handler(:cancel, method(:on_cancel))
  end
  
  def wufangwindow=(wufangwindow)
    @wufangwindow = wufangwindow
  end
  def qiangxz=(qiangxz)
    @qiangxz = qiangxz
  end
  #--------------------------------------------------------------------------
  # ● 开始输入的处理
  #--------------------------------------------------------------------------
  def start
    self.category = :gem
    self.y = (Graphics.height - height) / 2
    refresh
    select(0)
    open
    activate
  end
  #--------------------------------------------------------------------------
  # ● 确定时的处理
  #--------------------------------------------------------------------------
  def on_ok
    result = item ? item.id : 0
    if result != 0
     $usegem = true
     $当前使用宝石id = result
     for i in $强化哈希表["宝石效果"]
       $当前使用宝石加成率 = i[0] if i[1] == $当前使用宝石id
     end
   else
     $当前使用宝石加成率 = 0
     $usegem = false
    end
    @wufangwindow.update_help
    @qiangxz.activate
    close
  end
  #--------------------------------------------------------------------------
  # ● 查询此物品是否可用
  #--------------------------------------------------------------------------
  def enable?(item)
    true
  end
  #--------------------------------------------------------------------------
  # ● 取消时的处理
  #--------------------------------------------------------------------------
  def on_cancel
    $当前使用宝石加成率 = 0
    $usegem = false
    @wufangwindow.update_help
    @qiangxz.activate
    close
  end
end
#==============================================================================
# ■ 强化系统DataManager
#------------------------------------------------------------------------------
#  将武器和防具数据保存入存档
#==============================================================================
module DataManager
  #--------------------------------------------------------------------------
  # ● 生成存档内容
  #--------------------------------------------------------------------------
  def self.make_save_contents
    contents = {}
    contents[:system]        = $game_system
    contents[:timer]         = $game_timer
    contents[:message]       = $game_message
    contents[:switches]      = $game_switches
    contents[:variables]     = $game_variables
    contents[:self_switches] = $game_self_switches
    contents[:actors]        = $game_actors
    contents[:party]         = $game_party
    contents[:troop]         = $game_troop
    contents[:map]           = $game_map
    contents[:player]        = $game_player
    contents[:weapons]       = $data_weapons
    contents[:armors]        = $data_armors
    contents
  end
  #--------------------------------------------------------------------------
  # ● 展开存档内容
  #--------------------------------------------------------------------------
  def self.extract_save_contents(contents)
    $game_system        = contents[:system]
    $game_timer         = contents[:timer]
    $game_message       = contents[:message]
    $game_switches      = contents[:switches]
    $game_variables     = contents[:variables]
    $game_self_switches = contents[:self_switches]
    $game_actors        = contents[:actors]
    $game_party         = contents[:party]
    $game_troop         = contents[:troop]
    $game_map           = contents[:map]
    $game_player        = contents[:player]
    $data_weapons       = contents[:weapons]
    $data_armors        = contents[:armors]
  end
end[/pre]
现在论坛上的少,有事联系
QQ:2287688663
回复

使用道具 举报

梦石
0
星屑
4058
在线时间
836 小时
注册时间
2013-7-29
回帖
145

开拓者

发表于 2015-9-14 14:57:34 | 显示全部楼层
修改了下两个脚本,现在兼容了。但不保证和其他脚本是否会不兼容。
现在论坛上的少,有事联系
QQ:2287688663
回复

使用道具 举报

梦石
0
星屑
1554
在线时间
523 小时
注册时间
2015-8-23
回帖
83
 楼主| 发表于 2015-9-14 15:21:19 | 显示全部楼层
dongdongdjh 发表于 2015-9-14 14:57
修改了下两个脚本,现在兼容了。但不保证和其他脚本是否会不兼容。

谢谢大大~爱你么么哒~
回复

使用道具 举报

梦石
0
星屑
480
在线时间
97 小时
注册时间
2016-4-5
回帖
92
发表于 2016-5-2 08:02:37 | 显示全部楼层
dongdongdjh 发表于 2015-9-14 14:57
修改了下两个脚本,现在兼容了。但不保证和其他脚本是否会不兼容。

#在下面if c <= 0处修改强化升到各级时显示的颜色
#c代表着升级次数
#==============================================================================
# [PS0]物品颜色描绘
#      Window_Base_Itemcolor
#------------------------------------------------------------------------------
#     在物品、技能选项中显示物品品质并显示品质框和修改物品名颜色。
#==============================================================================
# [更新记录]
#    - 2012.02.17 By wyongcan
#      * 修改为适合装备系统增强  不会读取说明中的品质
#    - 2012.01.03 By 仲秋启明
#      * 修改为VA定义
#    - 2011.12.27 By 仲秋启明
#      * 移植至RGSS3,遵循PS0协议;
#      * 优化数据库备注中设定方法
#    - 2011.08.22 By 冰舞蝶恋
#      * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框)
#    - 2010.08.06 By 仲秋启明
#      * 蓝本(物品颜色描绘脚本(完整无冲突版))
#------------------------------------------------------------------------------
# [使用方法]
#    - 替换原Window_Base中的draw_item_name定义或复制到Main之前
#==============================================================================
$_PS0 = {} if $_PS0 == nil  
$_PS0["Window_Base_Itemcolor"] = 20111227
#==============================================================================
# [PS0] 通用配置模块  
#==============================================================================
module PS0
  module Window_Base_Itemcolor
    Color1 = Color.new(255, 255, 255)  # 一般品质的色彩(白,1)
    Color2 = Color.new(128, 255, 128)  # 平庸品质的色彩(绿,2)
    Color3 = Color.new(128, 128, 255)  # 精良品质的色彩(蓝,3)
    Color4 = Color.new(255, 0, 255)    # 卓越品质的色彩(紫,4)
    Color5 = Color.new(255, 128, 128)  # 神秘品质的色彩(红,5)
    Color6 = Color.new(255, 128, 0)    # 传说品质的色彩(橙,6)
    Color7 = Color.new(255, 255, 128)  # 特殊品质的色彩(黄,7)
  end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    item.up = 0 if item.is_a?(RPG::EquipItem) && item.up == nil
    c = 0
    c = item.up if item.is_a?(RPG::EquipItem)
      if c <= 0
        color = PS0::Window_Base_Itemcolor::Color1
      elsif c <= 2
        color = PS0::Window_Base_Itemcolor::Color2
      elsif c <= 4
        color = PS0::Window_Base_Itemcolor::Color3
      elsif c <= 6
        color = PS0::Window_Base_Itemcolor::Color4
      elsif c <= 8
        color = PS0::Window_Base_Itemcolor::Color5
      elsif c <= 10
        color = PS0::Window_Base_Itemcolor::Color6
      elsif c <= 12
        color = PS0::Window_Base_Itemcolor::Color7
      else
        color = Color.new(0, 0, 0, 0)
      end
      self.contents.fill_rect(x, y, 24, 1, color)
      self.contents.fill_rect(x, y, 1, 24, color)
      self.contents.fill_rect(x, y+23, 24, 1, color)
      self.contents.fill_rect(x+23, y, 1, 24, color)
      draw_icon(item.icon_index, x, y, enabled)
      change_color(color, enabled)
      if item.is_a?(RPG::EquipItem) && item.up != nil && item.up != 0
        draw_text(x + 24, y, width, line_height, item.name + "+" + item.up.to_s)
        return
      end
      draw_text(x + 24, y, width, line_height, item.name)
    end
end
#==============================================================================
# [PS0] End of Script
#==============================================================================好这个也兼容 大神有办法吗?
回复

使用道具 举报

梦石
0
星屑
480
在线时间
97 小时
注册时间
2016-4-5
回帖
92
发表于 2016-5-2 08:03:00 | 显示全部楼层
dongdongdjh 发表于 2015-9-14 14:57
修改了下两个脚本,现在兼容了。但不保证和其他脚本是否会不兼容。

#在下面if c <= 0处修改强化升到各级时显示的颜色
#c代表着升级次数
#==============================================================================
# [PS0]物品颜色描绘
#      Window_Base_Itemcolor
#------------------------------------------------------------------------------
#     在物品、技能选项中显示物品品质并显示品质框和修改物品名颜色。
#==============================================================================
# [更新记录]
#    - 2012.02.17 By wyongcan
#      * 修改为适合装备系统增强  不会读取说明中的品质
#    - 2012.01.03 By 仲秋启明
#      * 修改为VA定义
#    - 2011.12.27 By 仲秋启明
#      * 移植至RGSS3,遵循PS0协议;
#      * 优化数据库备注中设定方法
#    - 2011.08.22 By 冰舞蝶恋
#      * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框)
#    - 2010.08.06 By 仲秋启明
#      * 蓝本(物品颜色描绘脚本(完整无冲突版))
#------------------------------------------------------------------------------
# [使用方法]
#    - 替换原Window_Base中的draw_item_name定义或复制到Main之前
#==============================================================================
$_PS0 = {} if $_PS0 == nil  
$_PS0["Window_Base_Itemcolor"] = 20111227
#==============================================================================
# [PS0] 通用配置模块  
#==============================================================================
module PS0
  module Window_Base_Itemcolor
    Color1 = Color.new(255, 255, 255)  # 一般品质的色彩(白,1)
    Color2 = Color.new(128, 255, 128)  # 平庸品质的色彩(绿,2)
    Color3 = Color.new(128, 128, 255)  # 精良品质的色彩(蓝,3)
    Color4 = Color.new(255, 0, 255)    # 卓越品质的色彩(紫,4)
    Color5 = Color.new(255, 128, 128)  # 神秘品质的色彩(红,5)
    Color6 = Color.new(255, 128, 0)    # 传说品质的色彩(橙,6)
    Color7 = Color.new(255, 255, 128)  # 特殊品质的色彩(黄,7)
  end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    item.up = 0 if item.is_a?(RPG::EquipItem) && item.up == nil
    c = 0
    c = item.up if item.is_a?(RPG::EquipItem)
      if c <= 0
        color = PS0::Window_Base_Itemcolor::Color1
      elsif c <= 2
        color = PS0::Window_Base_Itemcolor::Color2
      elsif c <= 4
        color = PS0::Window_Base_Itemcolor::Color3
      elsif c <= 6
        color = PS0::Window_Base_Itemcolor::Color4
      elsif c <= 8
        color = PS0::Window_Base_Itemcolor::Color5
      elsif c <= 10
        color = PS0::Window_Base_Itemcolor::Color6
      elsif c <= 12
        color = PS0::Window_Base_Itemcolor::Color7
      else
        color = Color.new(0, 0, 0, 0)
      end
      self.contents.fill_rect(x, y, 24, 1, color)
      self.contents.fill_rect(x, y, 1, 24, color)
      self.contents.fill_rect(x, y+23, 24, 1, color)
      self.contents.fill_rect(x+23, y, 1, 24, color)
      draw_icon(item.icon_index, x, y, enabled)
      change_color(color, enabled)
      if item.is_a?(RPG::EquipItem) && item.up != nil && item.up != 0
        draw_text(x + 24, y, width, line_height, item.name + "+" + item.up.to_s)
        return
      end
      draw_text(x + 24, y, width, line_height, item.name)
    end
end
#==============================================================================
# [PS0] End of Script
#==============================================================================和这个也兼容 大神有办法吗?
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部