| 
 
| 赞 | 5 |  
| VIP | 359 |  
| 好人卡 | 195 |  
| 积分 | 3 |  
| 经验 | 560179 |  
| 最后登录 | 2024-5-17 |  
| 在线时间 | 1373 小时 |  
 Lv2.观梦者 
	梦石0 星屑270 在线时间1373 小时注册时间2005-10-16帖子5113 
 | 
| 本帖最后由 亿万星辰 于 2012-1-7 10:46 编辑 
 @item_window = Window_Item.new(@active_battler.id)
 复制代码class Game_Party
  ITEM_FORBID4class = {}
  # 1号职业禁止使用的物品
  ITEM_FORBID4class[1] = [1]
  # --------------------
  ITEM_FORBID4actor = {}
  # 1号角色禁止使用的物品
  ITEM_FORBID4actor[1] = [2]
  # --------------------
  
  #--------------------------------------------------------------------------
  # ● 判断物品可以使用
  #     item_id : 物品 ID
  #--------------------------------------------------------------------------
  alias old_icu? item_can_use?
  def item_can_use?(item_id, actor_id = 0)
    # 如果当前物品在对应角色和职业的禁止使用物品列表里
    if actor_id != 0 and ITEM_FORBID4actor.key?(actor_id) and
      ITEM_FORBID4class.key?($game_actors[actor_id].class_id)
      if ITEM_FORBID4actor[actor_id].include?(item_id) or 
        ITEM_FORBID4class[$game_actors[actor_id].class_id].include?(item_id)
        return false
      end
    end
    old_icu?(item_id)
  end
end
class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  alias old_ini initialize
  def initialize(actor_id = 0)
    @actor_id = actor_id
    old_ini
  end
  #--------------------------------------------------------------------------
  # ● 描绘项目
  #     index : 项目编号
  #--------------------------------------------------------------------------
  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, @actor_id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    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, 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 + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
end
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 开始选择物品
  #--------------------------------------------------------------------------
  def start_item_select
    # 生成物品窗口
    @item_window = Window_Item.new(@active_battler.id)
    # 关联帮助窗口
    @item_window.help_window = @help_window
    # 无效化角色指令窗口
    @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 $game_party.item_can_use?(@item.id, @active_battler.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
  #--------------------------------------------------------------------------
  # ● 生成物品行动结果
  #--------------------------------------------------------------------------
  def make_item_action_result
    # 获取物品
    @item = $data_items[@active_battler.current_action.item_id]
    # 因为物品耗尽而无法使用的情况下
    unless $game_party.item_can_use?(@item.id, @active_battler.id)
      # 移至步骤 1
      @phase4_step = 1
      return
    end
    # 消耗品的情况下
    if @item.consumable
      # 使用的物品减 1
      $game_party.lose_item(@item.id, 1)
    end
    # 在帮助窗口显示物品名
    @help_window.set_text(@item.name, 1)
    # 设置动画 ID
    @animation1_id = @item.animation1_id
    @animation2_id = @item.animation2_id
    # 设置公共事件 ID
    @common_event_id = @item.common_event_id
    # 确定对像
    index = @active_battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    # 设置对像侧战斗者
    set_target_battlers(@item.scope)
    # 应用物品效果
    for target in @target_battlers
      target.item_effect(@item)
    end
  end
end
 | 
 |