查看: 1531|回复: 1

[已经解决] 这个脚本使用后战斗时使用物品不消耗了,不知道怎么改

[复制链接]
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2014-12-6 21:54:32 | 显示全部楼层 |阅读模式

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

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

×
菜单界面使用是可以消耗的。
我看了下菜单界面,里面有带这样的脚本的。

[pre lang="ruby" line="1"]            # 消耗品的情况下
            if @item.consumable
              # 使用的物品数减 1
              if @actor==nil
                $game_party.lose_item(@item.id, 1)
              else
                @actor.items.delete_at(@item_window.index)
              end
[/pre]

这个背包系统的战斗处理部分是不带这样的脚本内容的。
第1362行
我把上面那一段复制进去也没效果。
[pre lang="ruby" line="1"]#==============================================================================
# ■ 本脚本来自www.66rpg.com,作者柳柳,转载使用请保留此信息
# ■ 使用方法写在发布页
#==============================================================================
=begin

部分可能在制作中用到的核心算法:

角色(Game_Actor):
属性:max_size,最大负重,可在游戏更改。如$game_actors[1].max_size += 1
属性:items,物品列表,只可读取,不可修改。如$a = $game_actors[1].items[0]
函数:judge_equip,判断一下是否装备正确。如果不正确就把装备设置为空
函数:gain_item(item_id, kind=1, n=true),给某角色增减物品。
      item_id : 物品 ID;n: true是增加,false是减少;kind:种类,1是物品,2是武器,3是防具
函数:item_amount,返回现有负重物品数量
函数:have_item?(item),判断是否拥有某物
函数:item_full?,判断背包是不是满了


队伍(Game_Party):
属性:max_amount,最大背包中物品数量
属性:now_amount,背包中现有物品数量
函数:item_full?,判断背包是否放满
函数:refresh_item_amount,重新刷新背包中现有物品数量,发生意外的时候用

=end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
  attr_accessor :max_size
  attr_reader   :items
  #--------------------------------------------------------------------------
  # ● 设置
  #     actor_id : 角色 ID
  #--------------------------------------------------------------------------
  alias final_items_setup setup
  def setup(actor_id)
    final_items_setup(actor_id)   
    #--角色自带的物品建立
    @max_size = 8
    @items = []        
    if @weapon_id >0
      @items.push($data_weapons[@weapon_id])
    end
    if @armor1_id >0
      @items.push($data_armors[@armor1_id])
    end
    if @armor2_id >0
      @items.push($data_armors[@armor2_id])
    end
    if @armor3_id >0
      @items.push($data_armors[@armor3_id])
    end
    if @armor4_id >0
      @items.push($data_armors[@armor4_id])
    end
  end
  #--------------------------------------------------------------------------
  # ● 测试装备是否正确,如果不正确就设置为空
  #--------------------------------------------------------------------------
  def judge_equip
    if @armor1_id>0
      unless @items.include?($data_armors[@armor1_id])
        @armor1_id = 0
      end
    end
    if @armor2_id>0
      unless @items.include?($data_armors[@armor2_id])
        @armor2_id = 0
      end
    end
    if @armor3_id>0
      unless @items.include?($data_armors[@armor3_id])
        @armor3_id = 0
      end
    end
    if @armor4_id>0
      unless @items.include?($data_armors[@armor4_id])
        @armor4_id = 0
      end
    end
    if @weapon_id>0
      unless @items.include?($data_weapons[@weapon_id])
        @weapon_id = 0
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 增加物品 (减少)
  #     item_id : 物品 ID
  #     n       : true是增加,false是减少
  #     kind    : 种类,1是物品,2是武器,3是防具
  #--------------------------------------------------------------------------
  def gain_item(item_id, kind=1, n=true)
    return if item_full?
    if kind == 1
      if item_id > 0 and n==true
        @items.push($data_items[item_id])
      elsif item_id >0 and n==false
        @items.delete($data_items[item_id])
      end
    end
    if kind == 2
      if item_id > 0 and n==true
        @items.push($data_weapons[item_id])
      elsif item_id > 0 and n==false
        @items.push($data_weapons[item_id])
      end
    end
    if kind == 3
      if item_id > 0 and n==true
        @items.push($data_armors[item_id])
      elsif item_id > 0 and n==true
        @items.push($data_armors[item_id])
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 返回物品数量
  #--------------------------------------------------------------------------  
  def item_amount
    return @items.size
  end
  #--------------------------------------------------------------------------
  # ● 判断是否拥有物品
  #--------------------------------------------------------------------------  
  def have_item?(item)
    return @items.include?(item)
  end
  #--------------------------------------------------------------------------
  # ● 判断是否物品满了
  #--------------------------------------------------------------------------  
  def item_full?
    return true if @items.size>=@max_size
    return false
  end
  #--------------------------------------------------------------------------
  # ● 变更装备
  #     equip_type : 装备类型
  #     id    : 武器 or 防具 ID  (0 为解除装备)
  #--------------------------------------------------------------------------
  def equip(equip_type, id)
    case equip_type
    when 0  # 武器
      if id >= 0
        @weapon_id = id
      end
    when 1  # 盾
      if id >= 0
        update_auto_state($data_armors[@armor1_id], $data_armors[id])
        @armor1_id = id
      end
    when 2  # 头
      if id >= 0
        update_auto_state($data_armors[@armor2_id], $data_armors[id])
        @armor2_id = id
      end
    when 3  # 身体
      if id >= 0
        update_auto_state($data_armors[@armor3_id], $data_armors[id])
        @armor3_id = id
      end
    when 4  # 装饰品
      if id >= 0
        update_auto_state($data_armors[@armor4_id], $data_armors[id])
        @armor4_id = id
      end
    end
  end  
end

#==============================================================================
# ■ 本脚本来自www.66rpg.com,作者柳柳,转载使用请保留此信息
# ■ 使用方法写在发布页
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
#  处理同伴的类。包含金钱以及物品的信息。本类的实例
# 请参考 $game_party。
#==============================================================================

class Game_Party
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_accessor :max_amount
  attr_reader   :now_amount
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  alias final_item_initialize initialize
  def initialize
    final_item_initialize
    @max_amount = 15
    @now_amount = 0
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def item_full?
    return true if @now_amount>=@max_amount
    return false
  end
  def refresh_item_amount
    @now_amount = 0
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @now_amount += $game_party.item_number(i)
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0
        @now_amount += $game_party.weapon_number(i)
      end
    end
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0
        @now_amount += $game_party.armor_number(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 增加物品 (减少)
  #     item_id : 物品 ID
  #     n       : 个数
  #--------------------------------------------------------------------------
  def gain_item(item_id, n)
    # 更新 hash 的个数数据
    if item_id > 0
      @items[item_id] = [[item_number(item_id) + n, 0].max, @max_amount].min
      refresh_item_amount
    end
  end
  #--------------------------------------------------------------------------
  # ● 增加武器 (减少)
  #     weapon_id : 武器 ID
  #     n         : 个数
  #--------------------------------------------------------------------------
  def gain_weapon(weapon_id, n)
    # 更新 hash 的个数数据
    if weapon_id > 0
      @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, @max_amount].min
      refresh_item_amount
    end
  end
  #--------------------------------------------------------------------------
  # ● 增加防具 (减少)
  #     armor_id : 防具 ID
  #     n        : 个数
  #--------------------------------------------------------------------------
  def gain_armor(armor_id, n)
    # 更新 hash 的个数数据
    if armor_id > 0
      @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, @max_amount].min
      refresh_item_amount
    end
  end  
  #--------------------------------------------------------------------------
  # ● 判断物品可以使用
  #     item_id : 物品 ID
  #--------------------------------------------------------------------------
  def item_can_use?(item_id)
    # 物品个数为 0 的情况
    #if item_number(item_id) == 0
      # 不能使用
      #return false
    #end
    # 获取可以使用的时候
    occasion = $data_items[item_id].occasion
    # 战斗的情况
    if $game_temp.in_battle
      # 可以使用时为 0 (平时) 或者是 1 (战斗时) 可以使用
      return (occasion == 0 or occasion == 1)
    end
    # 可以使用时为 0 (平时) 或者是 2 (菜单时) 可以使用
    return (occasion == 0 or occasion == 2)
  end  
end

#==============================================================================
# ■ 本脚本来自www.66rpg.com,作者柳柳,转载使用请保留此信息
# ■ 使用方法写在发布页
#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
#  一般的命令选择行窗口。
#==============================================================================

class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 项目有效化
  #     index : 项目编号
  #--------------------------------------------------------------------------  
  def enable_item(index)
    draw_item(index, normal_color)
  end
end

#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
#  物品画面、战斗画面、显示浏览物品的窗口。
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize(actor=nil)
    @actor=actor
    super(0, 64, 640, 416)
    @column_max = 1
    refresh
    self.index = 0
    # 战斗中的情况下将窗口移至中央并将其半透明化
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取物品
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # 添加报务

    if @actor==nil   
      for i in 1...$data_items.size
        if $game_party.item_number(i) > 0
          for pushtimes in 0...$game_party.item_number(i)
            @data.push($data_items)
          end
        end
      end
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          for pushtimes in 0...$game_party.weapon_number(i)
            @data.push($data_weapons)
          end
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          for pushtimes in 0...$game_party.armor_number(i)
            @data.push($data_armors)
          end
        end
      end
    else
      for i in 0...@actor.items.size
        if @actor.items.is_a?(RPG::Item)
          @data.push(@actor.items)
        else         
          if @actor.items.is_a?(RPG::Weapon) or @actor.items.is_a?(RPG::Armor)
            if @actor.items.name==$data_items[@actor.items.id].name
              @data.push($data_items[@actor.items.id])
              next
            else
              @data.push(@actor.items)
              next
            end
          end
        end
      end
    end
    # 如果项目数不是 0 就生成位图、重新描绘全部项目
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.size = 20
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘项目
  #     index : 项目编号
  #--------------------------------------------------------------------------
  def draw_item(index)
    if @actor==nil
      item = @data[index]
      x = 4
      y = index * 32
      rect = Rect.new(x, y, self.width - 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, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.font.size = 20
      self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
      self.contents.font.size = 14
      self.contents.draw_text(x + 150, y, 400, 42, ":"+"    ★队伍目前物品数:"+$game_party.now_amount.to_s+" / "+$game_party.max_amount.to_s, 0)
    else
      item = @data[index]
      #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
      rect = Rect.new(x, y, self.width - 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, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.font.size = 20
      self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
      self.contents.font.size = 14
      self.contents.draw_text(x + 150, y, 400, 42, ":"+"    物品数量:"+@actor.item_amount.to_s+"    最大负重:"+@actor.max_size.to_s, 0)
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新帮助文本
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(item)
    @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
    #@help_window.contents.font.size = 18
    #if @actor==nil
    #  @help_window.set_text(self.item == nil ? ""+"    ★队伍目前物品数:"+$game_party.now_amount.to_s+" / "+$game_party.max_amount.to_s : self.item.description+"    ★队伍目前物品数:"+$game_party.now_amount.to_s+" / "+$game_party.max_amount.to_s )
    #else
    #  @help_window.set_text(@actor.name+"    物品数量:"+@actor.item_amount.to_s+"    最大负重:"+@actor.max_size.to_s)
    #end
  end
  def dispose
    super
    @actor.judge_equip if @actor != nil
  end
end

#==============================================================================
# ■ 本脚本来自www.66rpg.com,作者柳柳,转载使用请保留此信息
# ■ 使用方法写在发布页
#============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
#  装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================

class Window_EquipItem < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []

    # 添加可以装备的武器
    if @equip_type == 0
      weapon_set = $data_classes[@actor.class_id].weapon_set
      for item in @actor.items
        if item.is_a?(RPG::Weapon) and weapon_set.include?(item.id)
          @data.push(item)
        end
      end
    end
    # 添加可以装备的防具
    if @equip_type != 0
      armor_set = $data_classes[@actor.class_id].armor_set
      for item in @actor.items
        if item.is_a?(RPG::Armor) and armor_set.include?(item.id)
          if item.kind == @equip_type-1
            @data.push(item)
          end
        end
      end
    end
    # 添加空白
    @data.push(nil)
    # 生成位图、描绘全部项目
    @item_max = @data.size
    self.contents = Bitmap.new(width - 32, row_max * 32)
    for i in 0...@item_max-1
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ● 项目的描绘
  #     index : 项目符号
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  end
end

#==============================================================================
# ■ 本脚本来自www.66rpg.com,作者柳柳,转载使用请保留此信息
# ■ 使用方法写在发布页
#==============================================================================
# ■ Window_ShopStatus_New
#------------------------------------------------------------------------------
#  商店画面、显示物品所持数与角色装备的窗口。
#==============================================================================

class Window_ShopStatus_New < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(368, 128, 272, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.size = 18
    @item = nil
    @item_max = $game_party.actors.size + 1
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear

    if @item == nil
      return
    end
    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
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, 32, "队伍中本物品数:")
    self.contents.font.color = normal_color
    self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(4, 32, 200, 32, "队伍目前物品数:")
    self.contents.font.color = normal_color
    self.contents.draw_text(164, 32, 72, 32, $game_party.now_amount.to_s+" / "+$game_party.max_amount.to_s, 2)
    #if @item.is_a?(RPG::Item)
      #return
    #end
    # 添加装备品信息
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      self.contents.font.color = Color.new(255,255,0)
      self.contents.draw_text(116, 64 + 64 * i, 132, 32, "负重: ")
      self.contents.font.color = normal_color
      self.contents.draw_text(164, 64 + 64 * i, 72, 32, actor.item_amount.to_s+" / "+actor.max_size.to_s,2)
      # 获取当前的装备品
      unless @item == nil or @item.is_a?(RPG::Item)
        if @item.is_a?(RPG::Weapon)
          item1 = $data_weapons[actor.weapon_id]
        elsif @item.kind == 0
          item1 = $data_armors[actor.armor1_id]
        elsif @item.kind == 1
          item1 = $data_armors[actor.armor2_id]
        elsif @item.kind == 2
          item1 = $data_armors[actor.armor3_id]
        else
          item1 = $data_armors[actor.armor4_id]
        end
        # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
        if actor.equippable?(@item)
          self.contents.font.color = normal_color
        else
          self.contents.font.color = disabled_color
        end        
        # 描绘角色名字
        self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
        # 可以装备的情况
        if actor.equippable?(@item)
          # 武器的情况
          if @item.is_a?(RPG::Weapon)
            atk1 = item1 != nil ? item1.atk : 0
            atk2 = @item != nil ? @item.atk : 0
            change = atk2 - atk1
          end
          # 防具的情况
          if @item.is_a?(RPG::Armor)
            pdef1 = item1 != nil ? item1.pdef : 0
            mdef1 = item1 != nil ? item1.mdef : 0
            pdef2 = @item != nil ? @item.pdef : 0
            mdef2 = @item != nil ? @item.mdef : 0
            change = pdef2 - pdef1 + mdef2 - mdef1
          end
          # 描绘能力值变化
          self.contents.draw_text(124, 96 + 64 * i, 112, 32,
            sprintf("%+d", change), 2)
        end
        # 描绘物品
        if item1 != nil
          x = 4
          y = 64 + 64 * i + 32
          bitmap = RPG::Cache.icon(item1.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, item1.name)
        end
      else
        self.contents.font.color = normal_color
        # 描绘角色名字
        self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 设置物品
  #     item : 新的物品
  #--------------------------------------------------------------------------
  def item=(item)
    if @item != item
      @item = item
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新光标矩形
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 64, self.width - 32, 64)
    end
  end
end

#==============================================================================
# ■ 本脚本来自www.66rpg.com,作者柳柳,转载使用请保留此信息
# ■ 使用方法写在发布页
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
#  处理菜单画面的类。
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     menu_index : 命令光标的初期位置
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # ● 主处理
  #--------------------------------------------------------------------------
  def main
        @menu_com = Sprite.new
    @menu_com.bitmap = RPG::Cache.picture("自己做背景.png")  

    # 生成命令窗口
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "状态"
    s5 = "存档"
    s6 = "结束游戏"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    @item_command_window = Window_Command.new(160,["队伍物品","个人物品"])
    @item_command_window.x = 120
    @item_command_window.visible = false
    @item_command_window.active = false
    @item_command_window.z = 999
    # 同伴人数为 0 的情况下
    if $game_party.actors.size == 0
      # 物品、特技、装备、状态无效化
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # 禁止存档的情况下
    if $game_system.save_disabled
      # 存档无效
      @command_window.disable_item(4)
    end
    # 生成游戏时间窗口
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    # 生成步数窗口
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    # 生成金钱窗口
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # 生成状态窗口
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # 执行过渡
    Graphics.transition
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果切换画面就中断循环
      if $scene != self
        break
      end
    end
    # 准备过渡
    Graphics.freeze
    # 释放窗口
        @menu_com.bitmap.dispose if @menu_com.bitmap  
    @menu_com.dispose

    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
    @item_command_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    # 刷新窗口
    @command_window.update
    @playtime_window.update
    @steps_window.update
    @gold_window.update
    @status_window.update
    @item_command_window.update
    # 命令窗口被激活的情况下: 调用 update_command
    if @command_window.active
      update_command
      return
    end
    # 状态窗口被激活的情况下: 调用 update_status
    if @status_window.active
      update_status
      return
    end
    if @item_command_window.active
      update_item_command
      return
    end
  end
  def update_item_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @item_command_window.active = false
      @item_command_window.visible = false
      @command_window.active = true
    end
    if Input.trigger?(Input::C)
      case @item_command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new
      when 1
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 激活状态窗口
        @item_command_window.active = false
        @item_command_window.visible = false
        @status_window.active = true
        @status_window.index = 0
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (命令窗口被激活的情况下)
  #--------------------------------------------------------------------------
  def update_command
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换的地图画面
      $scene = Scene_Map.new
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      # 同伴人数为 0、存档、游戏结束以外的场合
      if $game_party.actors.size == 0 and @command_window.index < 4
        # 演奏冻结 SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 命令窗口的光标位置分支
      case @command_window.index
      when 0  # 物品
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 激活状态窗口
        @command_window.active = false
        @item_command_window.active = true
        @item_command_window.index = 0
        @item_command_window.visible = true
      when 1  # 特技
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 激活状态窗口
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # 装备
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 激活状态窗口
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # 状态
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 激活状态窗口
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # 存档
        # 禁止存档的情况下
        if $game_system.save_disabled
          # 演奏冻结 SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到存档画面
        $scene = Scene_Save.new
      when 5  # 游戏结束
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到游戏结束画面
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (状态窗口被激活的情况下)
  #--------------------------------------------------------------------------
  def update_status
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 激活命令窗口
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      # 命令窗口的光标位置分支
      case @command_window.index
      when 0  # 物品        
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new($game_party.actors[@status_window.index])
      when 1  # 特技
        # 本角色的行动限制在 2 以上的情况下
        if $game_party.actors[@status_window.index].restriction >= 2
          # 演奏冻结 SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到特技画面
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # 装备
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换的装备画面
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # 状态
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到状态画面
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end

#==============================================================================
# ■ 本脚本来自www.66rpg.com,作者柳柳,转载使用请保留此信息
# ■ 使用方法写在发布页
#==============================================================================
# ■ Scene_Item
#------------------------------------------------------------------------------
#  处理物品画面的类。
#==============================================================================

class Scene_Item

  #★——添加定义
  def initialize(actor = nil)
    @actor = actor
  end

  #--------------------------------------------------------------------------
  # ● 主处理
  #--------------------------------------------------------------------------
  def main
        @menu_com = Sprite.new
    @menu_com.bitmap = RPG::Cache.picture("技能窗口.png")  

    # 生成帮助窗口、物品窗口
    @help_window = Window_Help.new
    @item_window = Window_Item.new(@actor)
    # 关联帮助窗口
    @item_window.help_window = @help_window
    # 生成目标窗口 (设置为不可见・不活动)
    @target_window = Window_Target.new
    @target_window.visible = false
    @target_window.active = false
    if @actor==nil
      @command_window = Window_Command.new(160,["使用物品","交给他人","丢弃物品"])
    else
      @command_window = Window_Command.new(160,["使用物品","转交他人","丢弃物品","放回队伍"])
    end
    @command_window.x = 240
    @command_window.y = 180
    @command_window.visible = false
    @command_window.active = false
    @command_window.z = 999
    @target_window.z = 10000
    # 执行过度
    Graphics.transition
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果画面切换就中断循环
      if $scene != self
        break
      end
    end
    # 装备过渡
    Graphics.freeze
    # 释放窗口
        @menu_com.bitmap.dispose if @menu_com.bitmap  
    @menu_com.dispose

    @help_window.dispose
    @item_window.dispose
    @target_window.dispose
    @command_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    # 刷新窗口
    @help_window.update
    @item_window.update
    @target_window.update
    @command_window.update
    # 物品窗口被激活的情况下: 调用 update_item
    if @item_window.active
      update_item
      return
    end
    # 目标窗口被激活的情况下: 调用 update_target
    if @target_window.active
      update_target
      return
    end
    if @command_window.active
      update_command
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update_command
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换到菜单画面
      @command_window.visible = false
      @command_window.active = false
      @item_window.active = true
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        # 获取物品窗口当前选中的物品数据
        @item = @item_window.item
        # 不使用物品的情况下
        if @actor == nil
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        unless @item.is_a?(RPG::Item)
          # 演奏冻结 SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 不能使用的情况下
        unless $game_party.item_can_use?(@item.id)
          # 演奏冻结 SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 效果范围是我方的情况下
        if @item.scope >= 3
          # 激活目标窗口
          @command_window.active = false
          @target_window.x = (@item_window.index + 1) % 2 * 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
          # 公共事件 ID 有效的情况下
          if @item.common_event_id > 0
            # 预约调用公共事件
            $game_temp.common_event_id = @item.common_event_id
            # 演奏物品使用时的 SE
            $game_system.se_play(@item.menu_se)
            # 消耗品的情况下
            if @item.consumable
              # 使用的物品数减 1
              if @actor==nil
                $game_party.lose_item(@item.id, 1)
              else
                @actor.items.delete_at(@item_window.index)
              end
              # 再描绘物品窗口的项目
              @item_window.draw_item(@item_window.index)
            end
            # 切换到地图画面
            $scene = Scene_Map.new
            return
          end
        end
        return
      when 1
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @target_window.visible = true
        @target_window.index = 0
        @target_window.active = true
      when 2
        $game_system.se_play($data_system.load_se)
        if @actor != nil
          @actor.items.delete_at(@item_window.index)
          @actor.judge_equip
        else
          if @item_window.item.is_a?(RPG::Item)
            $game_party.gain_item(@item_window.item.id,-1)
          end
          if @item_window.item.is_a?(RPG::Weapon)
            $game_party.gain_weapon(@item_window.item.id,-1)
          end
          if @item_window.item.is_a?(RPG::Armor)
            $game_party.gain_armor(@item_window.item.id,-1)
          end
        end
        # 切换到菜单画面
        @command_window.visible = false
        @command_window.active = false
        @item_window.refresh
        @item_window.active = true
      when 3
        if $game_party.item_full?
          $game_system.se_play($data_system.cancel_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        if @item_window.item.is_a?(RPG::Item)
          $game_party.gain_item(@item_window.item.id,1)
        end
        if @item_window.item.is_a?(RPG::Weapon)
          $game_party.gain_weapon(@item_window.item.id,1)
        end
        if @item_window.item.is_a?(RPG::Armor)
          $game_party.gain_armor(@item_window.item.id,1)
        end
        @actor.items.delete_at(@item_window.index)
        # 切换到菜单画面
        @command_window.visible = false
        @command_window.active = false
        @item_window.refresh
        @item_window.active = true
      end
    end
  end  
  #--------------------------------------------------------------------------
  # ● 刷新画面 (物品窗口被激活的情况下)
  #--------------------------------------------------------------------------
  def update_item
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换到菜单画面
      $scene = Scene_Menu.new(0)
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      # 获取物品窗口当前选中的物品数据
      @item = @item_window.item
      $game_system.se_play($data_system.decision_se)
      if @item.is_a?(RPG::Item) and $game_party.item_can_use?(@item.id) and @actor != nil
        @command_window.enable_item(0)
      else
        @command_window.disable_item(0)
      end
      @command_window.index = 0
      @command_window.visible = true
      @command_window.active = true
      @item_window.active = false
      return
    end
    # 按下 R 键的情况下
    if Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      actor_index = 0
      for i in 0...$game_party.actors.size
        if @actor==$game_party.actors
          actor_index = i
          break
        end
      end
      actor_index += 1
      actor_index %= $game_party.actors.size
      # 切换到别的特技画面
      $scene = Scene_Item.new($game_party.actors[actor_index])
      return
    end
    # 按下 L 键的情况下
    if Input.trigger?(Input::L)
      # 演奏光标 SE
      $game_system.se_play($data_system.cursor_se)      
      actor_index = 0
      for i in 0...$game_party.actors.size
        if @actor==$game_party.actors
          actor_index = i
          break
        end
      end
      actor_index -= 1
      actor_index %= $game_party.actors.size
      # 切换到别的特技画面
      $scene = Scene_Item.new($game_party.actors[actor_index])
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (目标窗口被激活的情况下)
  #--------------------------------------------------------------------------
  def update_target
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 由于物品用完而不能使用的场合
      unless $game_party.item_can_use?(@item.id)
        # 再次生成物品窗口的内容
        @item_window.refresh
      end
      # 删除目标窗口
      @command_window.active = true
      @target_window.visible = false
      @target_window.active = false
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      if @command_window.index==0
        # 目标是全体的情况下
        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
          # 演奏物品使用时的 SE
          $game_system.se_play(@item.menu_se)
          # 消耗品的情况下
          if @item.consumable

            if @actor == nil
              # 使用的物品数减 1
              $game_party.lose_item(@item.id, 1)
            else
              @actor.items.delete_at(@item_window.index)
            end

            # 再描绘物品窗口的项目
            @item_window.draw_item(@item_window.index)
          end
          # 再生成目标窗口的内容
          @target_window.refresh
          # 全灭的情况下
          if $game_party.all_dead?
            # 切换到游戏结束画面
            $scene = Scene_Gameover.new
            return
          end
          # 公共事件 ID 有效的情况下
          if @item.common_event_id > 0
            # 预约调用公共事件
            $game_temp.common_event_id = @item.common_event_id
            # 切换到地图画面
            $scene = Scene_Map.new
            return
          end
          @item_window.refresh
          @item_window.index -= 1 if @item_window.index >0
        end
        # 无法使用物品的情况下
        unless used
          # 演奏冻结 SE
          $game_system.se_play($data_system.buzzer_se)
        end
        return
      end
      if @command_window.index==1
        if $game_party.actors[@target_window.index].item_full?
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        if @actor != nil
          @actor.items.delete_at(@item_window.index)
        else
          if @item_window.item.is_a?(RPG::Item)
            $game_party.lose_item(@item_window.item.id, 1)
          elsif @item_window.item.is_a?(RPG::Weapon)
            $game_party.lose_weapon(@item_window.item.id, 1)
          elsif @item_window.item.is_a?(RPG::Armor)
            $game_party.lose_armor(@item_window.item.id, 1)
          end
        end
        $game_system.se_play($data_system.decision_se)
        $game_party.actors[@target_window.index].items.push(@item_window.item)
        @item_window.refresh
        @item_window.index -= 1 if @item_window.index>0
        @item_window.active = true
        @command_window.visible = false
        @command_window.active = false
        @command_window.index = 0
        @target_window.visible = false
        @target_window.active = false
      end
    end
  end
end

#==============================================================================
# ■ 本脚本来自www.66rpg.com,作者柳柳,转载使用请保留此信息
# ■ 使用方法写在发布页
#==============================================================================
# ■ Scene_Battle (分割定义 3)
#------------------------------------------------------------------------------
#  处理战斗画面的类。
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 开始选择物品
  #--------------------------------------------------------------------------
  def start_item_select
    # 无效化角色指令窗口
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # 生成物品窗口
    @item_window = Window_Item.new($game_party.actors[@actor_index])
    # 关联帮助窗口
    #@item_window.help_window = @help_window
    @item_window.help_window =  Window_Help.new#★★★★★★★★★★★★
    # 无效化角色指令窗口
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (角色命令回合 : 选择物品)
  #--------------------------------------------------------------------------
  def update_phase3_item_select
    # 设置物品窗口为可视状态
    @item_window.visible = true
    # 刷新物品窗口
    @item_window.update
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 选择物品结束
      end_item_select
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      # 获取物品窗口现在选择的物品资料
      @item = @item_window.item
      unless @item.is_a?(RPG::Item)
        # 演奏冻结 SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 无法使用的情况下
      unless $game_party.item_can_use?(@item.id)
        # 演奏冻结 SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 演奏确定 SE
      $game_system.se_play($data_system.decision_se)

      # 设置行动
      @active_battler.current_action.item_id = @item.id
      # 设置物品窗口为不可见状态
      @item_window.visible = false
          # 效果范围是敌单体的情况下
      if @item.scope == 1
        # 开始选择敌人
        start_enemy_select
      # 效果范围是我方单体的情况下
      elsif @item.scope == 3 or @item.scope == 5
        # 开始选择角色
        start_actor_select
      # 效果范围不是单体的情况下
      else
        # 物品选择结束
        end_item_select
        # 转到下一位角色的指令输入
        phase3_next_actor
      end
      return
    end
  end
end

#==============================================================================
# ■ 本脚本来自www.66rpg.com,作者柳柳,转载使用请保留此信息
# ■ 使用方法写在发布页
#==============================================================================
# ■ Scene_Shop
#------------------------------------------------------------------------------
#  处理商店画面的类。
#==============================================================================

class Scene_Shop
  #--------------------------------------------------------------------------
  # ● 主处理
  #--------------------------------------------------------------------------
  def main

    @type = 0   

    # 生成帮助窗口
    #@help_window = Window_Help.new
    @help_window = Window_Help.new#★★★★★★★★★★★★★★★★
    # 生成指令窗口
    @command_window = Window_ShopCommand.new
    # 生成金钱窗口
    @gold_window = Window_Gold.new
    @gold_window.x = 480
    @gold_window.y = 64
    # 生成时间窗口
    @dummy_window = Window_Base.new(0, 128, 640, 352)
    # 生成购买窗口
    @buy_window = Window_ShopBuy.new($game_temp.shop_goods)
    @buy_window.active = false
    @buy_window.visible = false
    @buy_window.help_window = @help_window
    # 生成卖出窗口
    @sell_window = Window_ShopSell.new
    @sell_window.active = false
    @sell_window.visible = false
    @sell_window.help_window = @help_window
    # 生成状态窗口
    @status_window = Window_ShopStatus_New.new
    @status_window.visible = false
    @status_window.index = -1
    # 执行过渡
    Graphics.transition
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果画面切换的话就中断循环
      if $scene != self
        break
      end
    end
    # 准备过渡
    Graphics.freeze
    # 释放窗口
    @help_window.dispose
    @command_window.dispose
    @gold_window.dispose
    @dummy_window.dispose
    @buy_window.dispose
    @sell_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    # 刷新窗口
    @help_window.update
    @command_window.update
    @gold_window.update
    @dummy_window.update
    @buy_window.update
    @sell_window.update
    @status_window.update
    # 指令窗口激活的情况下: 调用 update_command
    if @command_window.active
      @help_window.visible=false
      update_command
      return
    end
    # 购买窗口激活的情况下: 调用 update_buy
    if @buy_window.active
# 修改開始
      @help_window.visible=true#★★★★★★★★★★★★★★★★
      if @buy_window.item==nil#★★★★★★★★★★★★★★★★
        @help_window.visible=false#★★★★★★★★★★★★★★★★
      end #★★★★★★★★★★★★★★★★     
      update_buy
      return
    end
    # 卖出窗口激活的情况下: 调用 update_sell
    if @sell_window.active
# 修改開始
      @help_window.visible=true#★★★★★★★★★★★★★★★★
      if @sell_window.item==nil#★★★★★★★★★★★★★★★★
        @help_window.visible=false#★★★★★★★★★★★★★★★★
      end #★★★★★★★★★★★★★★★★
# 修改終了
      update_sell
      return
    end
    if @type==1
# 修改開始
      @help_window.visible=true#★★★★★★★★★★★★★★★★
      if @sell_window.item==nil#★★★★★★★★★★★★★★★★
        @help_window.visible=false#★★★★★★★★★★★★★★★★
      end #★★★★★★★★★★★★★★★★
# 修改終了
      update_st1
      return
    end
  end

  def update_st1
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @buy_window.active = true
      @type = 0
      @status_window.index = -1
      @status_window.active = false
      return
    end
    if Input.trigger?(Input::C)
      if @status_window.index == 0        
        if $game_party.item_full?
          $game_system.se_play($data_system.cancel_se)
          return
        end        
        # 演奏商店 SE
        $game_system.se_play($data_system.shop_se)
        $game_party.lose_gold(@item.price)
        case @item
        when RPG::Item
          $game_party.gain_item(@item.id, 1)
        when RPG::Weapon
          $game_party.gain_weapon(@item.id, 1)
        when RPG::Armor
          $game_party.gain_armor(@item.id, 1)
        end
        # 刷新各窗口
        @gold_window.refresh
        @buy_window.refresh
        @status_window.refresh
        # 窗口状态转向购买模式
        @buy_window.active = true
        @buy_window.visible = true
        @status_window.active = false
        @status_window.index = -1
        @type = 0
      else
        if $game_party.actors[@status_window.index-1].item_full?
          $game_system.se_play($data_system.cancel_se)
          return
        end        
        # 演奏商店 SE
        $game_system.se_play($data_system.shop_se)
        $game_party.lose_gold(@item.price)
        case @item
        when RPG::Item
          $game_party.actors[@status_window.index-1].gain_item(@item.id, 1)
        when RPG::Weapon
          $game_party.actors[@status_window.index-1].gain_item(@item.id, 2)
        when RPG::Armor
          $game_party.actors[@status_window.index-1].gain_item(@item.id, 3)
        end
        # 刷新各窗口
        @gold_window.refresh
        @buy_window.refresh
        @status_window.refresh
        # 窗口状态转向购买模式
        @buy_window.active = true
        @status_window.active = false
        @type = 0
        @status_window.index = -1
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (指令窗口激活的情况下)
  #--------------------------------------------------------------------------
  def update_command
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换到地图画面
      $scene = Scene_Map.new
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      # 命令窗口光标位置分支
      case @command_window.index
      when 0  # 购买
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 窗口状态转向购买模式
        @command_window.active = false
        @dummy_window.visible = false
        @buy_window.active = true
        @buy_window.visible = true
        @buy_window.refresh
        @status_window.visible = true
      when 1  # 卖出
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 窗口状态转向卖出模式
        @command_window.active = false
        @dummy_window.visible = false
        @sell_window.active = true
        @sell_window.visible = true
        @sell_window.refresh
      when 2  # 取消
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到地图画面
        $scene = Scene_Map.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (购买窗口激活的情况下)
  #--------------------------------------------------------------------------
  def update_buy
    # 设置状态窗口的物品
    @status_window.item = @buy_window.item
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 窗口状态转向初期模式
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      # 删除帮助文本
      @help_window.set_text("")
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      # 获取物品
      @item = @buy_window.item
      # 物品无效的情况下、或者价格在所持金以上的情况下
      if @item == nil or @item.price > $game_party.gold
        # 演奏冻结 SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 获取物品所持数
      #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
      # 如果已经拥有了 99 个情况下
      #if number == 99
        # 演奏冻结 SE
        #$game_system.se_play($data_system.buzzer_se)
        #return
      #end
      # 演奏确定 SE
      $game_system.se_play($data_system.decision_se)
      # 计算可以最多购买的数量
      #max = @item.price == 0 ? 99 : $game_party.gold / @item.price
      #max = [max, 99 - number].min
      # 窗口状态转向数值输入模式
      #@buy_window.active = false
      #@buy_window.visible = false
      #@number_window.set(@item, max, @item.price)
      #@number_window.active = true
      #@number_window.visible = true
      @buy_window.active = false
      @status_window.index = 0
      @type = 1
      @status_window.active = true
    end
  end
  #--------------------------------------------------------------------------
  # ● 画面更新 (卖出窗口激活的情况下)
  #--------------------------------------------------------------------------
  def update_sell
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 窗口状态转向初期模式
      @command_window.active = true
      @dummy_window.visible = true
      @sell_window.active = false
      @sell_window.visible = false
      @status_window.item = nil
      # 删除帮助文本
      @help_window.set_text("")
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      # 获取物品
      @item = @sell_window.item
      # 设置状态窗口的物品
      @status_window.item = @item
      # 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
      if @item == nil or @item.price == 0
        # 演奏冻结 SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 演奏确定 SE
      $game_system.se_play($data_system.decision_se)      
      # 卖出处理
      $game_party.gain_gold(@item.price / 2)
      case @item
      when RPG::Item
        $game_party.lose_item(@item.id, 1)
      when RPG::Weapon
        $game_party.lose_weapon(@item.id, 1)
      when RPG::Armor
        $game_party.lose_armor(@item.id, 1)
      end
      # 刷新各窗口
      @gold_window.refresh
      @sell_window.refresh
      @status_window.refresh
    end
  end
end
[/pre]
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

 楼主| 发表于 2014-12-10 21:14:20 | 显示全部楼层
我自己已经解决
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部