Project1

标题: 跪求高级物品分类脚本如何整合? [打印本页]

作者: mbk3888    时间: 2011-4-6 12:06
标题: 跪求高级物品分类脚本如何整合?
本人是魔力单击革命版的制作者~~
为了一个梦想,所以投身魔力单机的制作已经3年了~~
但是脚本方面还是很弱~~~
目前遇到了问题~~
跪求各位大大帮忙解决。我现在有两个脚本,请问如何整合成一个?
一个是高级物品显示脚本。
另外一个是高级物品分类脚本~~
脚本如下~~
高级物品显示脚本:
#-----------------------------------------------------------------------------
#脚本-小泡(特别感谢小泡前辈和夏娜前辈,但是现在找不到他。)
#-----------------------------------------------------------------------------
class Window_Item < Window_Selectable
  def initialize
    super(200, 82, 280, 230)
    @column_max = 5
    refresh
    self.index = 0
    self.back_opacity=0
    self.opacity=0
  end
  def item
    return @data[self.index]
  end
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items)
      end
    end
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          @data.push($data_weapons)
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          @data.push($data_armors)
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 48)
          self.contents.font.size = 17
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 5 * (288 - 238)
    y = index / 5 * 48
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x-5, y + 4, bitmap, Rect.new(0, 0, 48, 48), opacity)
    self.contents.font.size = 13
    self.contents.font.color = Color.new(0, 0, 0, 140)
    self.contents.draw_text(x + 12, y + 19, 24, 48, number.to_s, 2)
    self.contents.draw_text(x + 11, y + 20, 24, 48, number.to_s, 2)
    self.contents.draw_text(x + 13, y + 20, 24, 48, number.to_s, 2)
    self.contents.draw_text(x + 12, y + 21, 24, 48, number.to_s, 2)
    self.contents.font.color = Color.new(255, 255, 255, 255)
    self.contents.draw_text(x +12, y + 20, 24, 48, number.to_s, 2)
  end
  def update_help
    text = self.item == nil ? "" : self.item.description
      row = self.index / 5
      if row < self.top_row
        self.top_row = row
      end
      if row > self.top_row + (self.page_row_max - 1)
        self.top_row = row - (self.page_row_max - 1)
      end
      x = self.index % 5 * (self.width/5) + self.x + (self.width/5 - 256)/2
      y = self.index / 5 *48 + 16 - self.oy
      @help_window.set_text(text, 0, true, self.item,x, y)
    else
      @help_window.set_text(text, 0, true, self.item, 112+self.x, 64+self.y)
    end
  def row_max
    return (@item_max + @column_max - 1) / @column_max
  end
  def top_row
    return self.oy / 48
  end
  def top_row=(row)
    if row < 0
      row = 0
    end
    if row > row_max - 1
      row = row_max - 1
    end
    self.oy = row * 48
  end
  def page_row_max
    return (self.height - 32) / 48
  end
  def page_item_max
    return page_row_max * @column_max
  end
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    if row < self.top_row
      self.top_row = row
    end
    if row > self.top_row + (self.page_row_max - 1)
      self.top_row = row - (self.page_row_max - 1)
    end
    cursor_width = self.width / @column_max - 10
    x = @index % @column_max * (cursor_width + 4)
    y = @index / @column_max * 48 - self.oy + 5
    self.cursor_rect.set(x, y, cursor_width, 48)
  end
end
class Window_Helpwp < Window_Base
  CHANGE_FONT_SIZE_WP = 12
  def initialize
    super(200, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity=0
    self.opacity=0
  end
  def set_text(text, align = 0)
    # 如果文本和对齐方式的至少一方与上次的不同
    if text != @text or align != @align
      if self.contents.text_size(text).width <= self.width - 40
        # 再描绘文本
      self.contents.clear
      self.contents.font.size = 12
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
      @text = text
      @align = align
      @actor = nil
      else
        self.contents.clear
        self.contents = Bitmap.new(self.contents.width / CHANGE_FONT_SIZE_WP * CHANGE_FONT_SIZE_WP, self.height - 32)
        self.contents.font.color = normal_color
        self.contents.font.size = CHANGE_FONT_SIZE_WP
        self.contents.draw_text(0, 0, self.contents.text_size(text.to_s).width, self.contents.text_size(text.to_s).height, text.to_s, align)
        self.contents.draw_text(0 - self.contents.width, self.contents.text_size(text.to_s).height, self.contents.text_size(text.to_s).width, self.contents.text_size(text.to_s).height, text.to_s, align)
        @text = text
        @align = align
        @actor = nil
      end
    end
    self.visible = true
  end
  #-----<★灼眼的夏娜★>-----重定义改方法-----
  def set_text(text, align = 0, use = false, item = nil, x = 0, y = 0)
    if use
      # 重描绘判断
      if @item == item
        return
      end
      @item = item
      # 使用该显示方式后,对窗口各种属性进行重设置
      self.width = 320
      self.height = 240
      self.x = x-113
      self.y = y
      self.z = 999
      self.opacity = 0
      self.contents = Bitmap.new("Graphics/Pictures/物品名称显示界面")#(224,160)
#      self.contents.fill_rect(0, 0, 224, 160, Color.new(0,0,0,200))
      # visible 判断
      self.visible = item != nil
      case item
      when RPG::Skill
        # 图标
        bitmap = RPG::Cache.icon(item.icon_name)
        self.contents.blt(24, 32, bitmap, Rect.new(0, 0, 48, 48))
        # 名字
        self.contents.font.size = 12
        self.contents.font.color = Color.new(155,225,0)
        self.contents.draw_text(36, 16, 188, 32, item.name, 1)
        self.contents.font.color = Color.new(0,255,0)
        self.contents.font.size = 12
#        self.contents.draw_text(36, 48, 188, 32, "消耗:SP"+item.sp_cost.to_s, 1)
        # 介绍
        self.contents.font.size = 12
        self.contents.draw_text(16, 80, 188, 32, "介绍:", 0)
        self.contents.font.size = 12
        self.contents.draw_text(16, 112, self.contents.text_size(text).width, self.contents.text_size(text).height, text, align)
        self.contents.draw_text(16 - self.contents.width, 136, self.contents.text_size(text).width, self.contents.text_size(text).height, text, align)
      when RPG::Item
        # 图标
        bitmap = RPG::Cache.icon(item.icon_name)
        self.contents.blt(24, 32, bitmap, Rect.new(0, 0, 48, 48))
        # 名字
        self.contents.font.size = 14
        self.contents.font.color = Color.new(255,246,0)
        self.contents.draw_text(26, 6, 188, 32, item.name, 1)
        self.contents.font.color = Color.new(0,255,0)
        # 介绍
        self.contents.font.size = 12
        self.contents.draw_text(6, 70, 188, 32, "介绍:", 0)
        self.contents.font.size = 12
        self.contents.draw_text(8, 102, self.contents.text_size(text).width, self.contents.text_size(text).height, text, align)
        self.contents.draw_text(15 - self.contents.width, 122, self.contents.text_size(text).width, self.contents.text_size(text).height, text, align)
      when RPG::Weapon
        # 图标
        bitmap = RPG::Cache.icon(item.icon_name)
        self.contents.blt(24, 32, bitmap, Rect.new(0, 0, 48, 48))
        # 名字
        self.contents.font.size = 14
        self.contents.font.color = Color.new(255,0,246)
        self.contents.draw_text(36, 16, 188, 32, item.name, 1)
        self.contents.font.color = Color.new(0,255,0)
        self.contents.font.size = 12
#        self.contents.draw_text(36, 48, 188, 32, "攻击力:+"+item.atk.to_s, 1)
        # 介绍
        self.contents.font.size = 12
        self.contents.draw_text(16, 80, 188, 32, "介绍:", 0)
        self.contents.font.size = 12
        self.contents.draw_text(16, 112, self.contents.text_size(text).width, self.contents.text_size(text).height, text, align)
        self.contents.draw_text(16 - self.contents.width, 132, self.contents.text_size(text).width, self.contents.text_size(text).height, text, align)
      when RPG::Armor
        # 图标
        bitmap = RPG::Cache.icon(item.icon_name)
        self.contents.blt(24, 32, bitmap, Rect.new(0, 0, 48, 48))
        # 名字
        self.contents.font.size = 14
        self.contents.font.color = Color.new(0,246,255)
        self.contents.draw_text(36, 16, 188, 32, item.name, 1)
        self.contents.font.color = Color.new(0,255,0)
        self.contents.font.size = 12
#        self.contents.draw_text(36, 48, 188, 32, "物防御:+"+item.pdef.to_s, 1)
#        self.contents.draw_text(36, 72, 188, 32, "魔防御:+"+item.mdef.to_s, 1)
        # 介绍
        self.contents.font.size = 12
        self.contents.draw_text(16, 80, 188, 32, "介绍:", 0)
        self.contents.font.size = 12
        self.contents.draw_text(16, 112, self.contents.text_size(text).width, self.contents.text_size(text).height, text, align)
        self.contents.draw_text(16 - self.contents.width, 132, self.contents.text_size(text).width, self.contents.text_size(text).height, text, align)
      end   
    else
    # 如果文本和对齐方式的至少一方与上次的不同
    if text != @text or align != @align
      if self.contents.text_size(text).width <= self.width - 40
        # 再描绘文本
      self.contents.clear
      self.contents.font.size = 12
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
      @text = text
      @align = align
      @actor = nil
      else
        self.contents.clear
        self.contents = Bitmap.new(self.contents.width / CHANGE_FONT_SIZE_WP * CHANGE_FONT_SIZE_WP, self.height - 32)
        self.contents.font.color = normal_color
        self.contents.font.size = CHANGE_FONT_SIZE_WP
        self.contents.draw_text(0, 0, self.contents.text_size(text.to_s).width, self.contents.text_size(text.to_s).height, text.to_s, align)
        self.contents.draw_text(0 - self.contents.width, self.contents.text_size(text.to_s).height, self.contents.text_size(text.to_s).width, self.contents.text_size(text.to_s).height, text.to_s, align)
        @text = text
        @align = align
        @actor = nil
      end
    end
      self.visible = true
    end
  end
  def set_actor(actor)
    if actor != @actor
      self.contents.clear
      draw_actor_name(actor, 4, 0)
      draw_actor_state(actor, 140, 0)
      draw_actor_hp(actor, 284, 0)
      draw_actor_sp(actor, 460, 0)
      @actor = actor
      @text = nil
      self.visible = true
    end
  end
  def set_enemy(enemy)
    text = enemy.name
    state_text = make_battler_state_text(enemy, 112, false)
    if state_text != ""
      text += "  " + state_text
    end
    set_text(text, 1)
  end
end
class Window_Goldwp < Window_Base
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity=0
    self.opacity=0
    refresh
  end
  def refresh
    self.contents.font.size = 14
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = Color.new(0, 0, 0, 255)
    self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
  end
end
class Scene_Item
  def main
    @系统菜单 = Sprite.new
    @系统菜单.bitmap = RPG::Cache.picture("系统菜单整体")
    @系统菜单.visible = true
    @系统菜单.x = 0
    @系统菜单.y = 453
    @系统菜单.z = 1
    @背景图像 = Sprite.new
    @背景图像.bitmap = Bitmap.new("Graphics/Pictures/菜单类/物品菜单")
    @背景图像.x = 200
    @背景图像.y =50
    @背景图像.opacity=255
    @help_window = Window_Helpwp.new
    @item_window = Window_Item.new
    @gold_window = Window_Goldwp.new
    @gold_window.x = 310
    @gold_window.y = 11/2+50
    @item_window.help_window = @help_window
    @target_window = Window_Target1.new
    @target_window.visible = false
    @target_window.active = false
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @help_window.dispose
    @item_window.dispose
    @target_window.dispose
    @gold_window.dispose
    @背景图像.dispose
    @系统菜单.dispose
  end
  def update
    @help_window.update
    @item_window.update
    @target_window.update
    if @item_window.active
      update_item
      return
    end
    if @target_window.active
      update_target
      return
    end
  end
  def update_item
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(0)
      return
    end
    if Input.trigger?(Input::C)
      @item = @item_window.item
      unless @item.is_a?(RPG::Item)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      unless $game_party.item_can_use?(@item.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      if @item.scope >= 3
        @item_window.active = false
        @target_window.x = 455
        @target_window.visible = true
        @target_window.active = true
        if @item.scope == 4 || @item.scope == 6
          @target_window.index = -1
        else
          @target_window.index = 0
        end
      else
        if @item.common_event_id > 0
          $game_temp.common_event_id = @item.common_event_id
          $game_system.se_play(@item.menu_se)
          if @item.consumable
            $game_party.lose_item(@item.id, 1)
            @item_window.draw_item(@item_window.index)
          end
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
  def update_target
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      unless $game_party.item_can_use?(@item.id)
        @item_window.refresh
      end
      @item_window.active = true
      @target_window.visible = false
      @target_window.active = false
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.item_number(@item.id) == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @target_window.index == -1
        used = false
        for i in $game_party.actors
          used |= i.item_effect(@item)
        end
      end
      if @target_window.index >= 0
        target = $game_party.actors[@target_window.index]
        used = target.item_effect(@item)
      end
      if used
        $game_system.se_play(@item.menu_se)
        if @item.consumable
          $game_party.lose_item(@item.id, 1)
          @item_window.draw_item(@item_window.index)
        end
        @target_window.refresh
        if $game_party.all_dead?
          $scene = Scene_Gameover.new
          return
        end
        if @item.common_event_id > 0
          $game_temp.common_event_id = @item.common_event_id
          $scene = Scene_Map.new
          return
        end
      end
      unless used
        $game_system.se_play($data_system.buzzer_se)
      end
      return
    end
  end
end
#-----------------------------------------------------------------------------
#==============================================================================
# ■ RPG追加定义,使用@符号分类
#==============================================================================

module RPG
  class Weapon
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "普通物品"
    end
  end
  class Item
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "普通物品"
    end
  end
  class Armor
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "普通物品"
    end
  end
end

另外一个是高级物品分类脚本:
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================


#==============================================================================
# ■ Harts_Window_ItemTitle
#==============================================================================

class Harts_Window_ItemTitle < Window_Base
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  end
end

#==============================================================================
# ■ Harts_Window_ItemCommand
#==============================================================================

class Harts_Window_ItemCommand < Window_Selectable
  attr_accessor :commands
  #--------------------------------------------------------------------------
  # ● 初始化,生成commands窗口
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 160, 352)
    @commands = []
    #————————生成commands窗口
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        push = true
        for com in @commands
          if com == $data_items.desc
            push = false
          end
        end
        if push == true
          @commands.push($data_items.desc)
        end
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0
        push = true
        for com in @commands
          if com == $data_weapons.desc
            push = false
          end
        end
        if push == true
          @commands.push($data_weapons.desc)
        end
      end
    end
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0
        push = true
        for com in @commands
          if com == $data_armors.desc
            push = false
          end
        end
        if push == true
          @commands.push($data_armors.desc)
        end
      end
    end
    if @commands == []
      @commands.push("杂物")
    end      
    @item_max = @commands.size
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    y = index * 32
    self.contents.draw_text(4, y, 128, 32, @commands[index])
  end
  #--------------------------------------------------------------------------
  # 只描绘原文字
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(@commands[self.index])
  end
end

#==============================================================================
# ■ Window_Item
#==============================================================================

class Harts_Window_ItemList < Window_Selectable
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def initialize
    super(160, 0, 480, 416)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def set_item(command)
    refresh
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0 and $data_items.desc == command
        @data.push($data_items)
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0 and $data_weapons.desc == command
        @data.push($data_weapons)
      end
    end
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0 and $data_armors.desc == command
        @data.push($data_armors)
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.clear
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def item_number
    return @item_max
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and
      $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

#==============================================================================
# ■ Harts_Scene_Item
#==============================================================================

class Scene_Item
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def main
    @itemtitle_window = Harts_Window_ItemTitle.new
    @itemcommand_window = Harts_Window_ItemCommand.new
    @command_index = @itemcommand_window.index
    @itemlist_window = Harts_Window_ItemList.new
    @itemlist_window.active = false
    @help_window = Window_Help.new
    @help_window.x = 0
    @help_window.y = 416
    @itemcommand_window.help_window = @help_window
    @itemlist_window.help_window = @help_window
    @target_window = Window_Target.new
    @target_window.visible = false
    @target_window.active = false
    @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @itemtitle_window.dispose
    @itemcommand_window.dispose
    @itemlist_window.dispose
    @help_window.dispose
    @target_window.dispose
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update
    @itemtitle_window.update
    @itemcommand_window.update
    @itemlist_window.update
    @help_window.update
    @target_window.update
    if @command_index != @itemcommand_window.index
      @command_index = @itemcommand_window.index
      @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
    end
    if @itemcommand_window.active
      update_itemcommand
      return
    end
    if @itemlist_window.active
      update_itemlist
      return
    end
    if @target_window.active
      update_target
      return
    end
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update_itemcommand
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(0)
      return
    end
    if Input.trigger?(Input::C)
      if @itemlist_window.item_number == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      @itemcommand_window.active = false
      @itemlist_window.active = true
      @itemlist_window.index = 0
      return
    end
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update_itemlist
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @itemcommand_window.active = true
      @itemlist_window.active = false
      @itemlist_window.index = 0
      @itemcommand_window.index = @command_index
      return
    end
    if Input.trigger?(Input::C)
      @item = @itemlist_window.item
      unless @item.is_a?(RPG::Item)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      unless $game_party.item_can_use?(@item.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      if @item.scope >= 3
        @itemlist_window.active = false
        @target_window.x = 304
        @target_window.visible = true
        @target_window.active = true
        if @item.scope == 4 || @item.scope == 6
          @target_window.index = -1
        else
          @target_window.index = 0
        end
      else
        if @item.common_event_id > 0
          $game_temp.common_event_id = @item.common_event_id
          $game_system.se_play(@item.menu_se)
            if @item.consumable
              $game_party.lose_item(@item.id, 1)
              @itemlist_window.draw_item(@itemlist_window.index)
            end
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update_target
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      unless $game_party.item_can_use?(@item.id)
        @itemlist_window.refresh
      end
      @itemlist_window.active = true
      @target_window.visible = false
      @target_window.active = false
      @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.item_number(@item.id) == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @target_window.index == -1
        used = false
        for i in $game_party.actors
          used |= i.item_effect(@item)
        end
      end
      if @target_window.index >= 0
        target = $game_party.actors[@target_window.index]
        used = target.item_effect(@item)
      end
      if used
        $game_system.se_play(@item.menu_se)
        if @item.consumable
          $game_party.lose_item(@item.id, 1)
          @itemlist_window.draw_item(@itemlist_window.index)
          @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
        end
        @target_window.refresh
        if $game_party.all_dead?
          $scene = Scene_Gameover.new
          return
        end
        if @item.common_event_id > 0
          $game_temp.common_event_id = @item.common_event_id
          $scene = Scene_Map.new
          return
        end
      end
      unless used
        $game_system.se_play($data_system.buzzer_se)
      end
    return
    end
  end
end

#==============================================================================
# ■ RPG追加定义,使用@符号分类
#==============================================================================

module RPG
  class Weapon
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "杂物箱"
    end
  end
  class Item
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "杂物箱"
    end
  end
  class Armor
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "杂物箱"
    end
  end
end

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

应玩家要求,小小再此跪谢各位大大了~~~
再次感谢1、2、3代制作组!dsu_plus_rewardpost_czw




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