| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 1 |  
| 积分 | 4 |  
| 经验 | 868 |  
| 最后登录 | 2014-6-14 |  
| 在线时间 | 628 小时 |  
 Lv2.观梦者 
	梦石0 星屑448 在线时间628 小时注册时间2011-9-27帖子3996 | 
| 装备界面扩张~ 复制代码#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 
#_/    ◆ 拡張装備画面 - KGC_ExtendedEquipScene ◆ VX ◆
 
#_/    ◇ Last update : 2009/02/15 ◇
 
#_/----------------------------------------------------------------------------
 
#_/  機能を強化した装備画面を作成します。
 
#_/============================================================================
 
#_/ 【基本機能】≪ヘルプウィンドウ機能拡張≫ より下に導入してください。
 
#_/ 【装備】≪スキル習得装備≫ より下に導入してください。
 
#_/ 【装備】≪装備拡張≫ より上に導入してください。
 
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 
$data_system = load_data("Data/System.rvdata") if $data_system == nil
 
#==============================================================================
 
# ★ カスタマイズ項目 - Customize BEGIN ★
 
#==============================================================================
 
module KGC
 
module ExtendedEquipScene
 
  # ◆ パラメータ名
 
  VOCAB_PARAM = {
 
    :hit => "命中率",        # 命中率
 
    :eva => "回避率",        # 回避率
 
    :cri => "暴击率",  # クリティカル率
 
  }  # ← この } は消さないこと!
 
  # ◆ 装備変更時に表示するパラメータ
 
  #  表示したい順に , で区切って記入。
 
  #  :maxhp .. 最大 HP
 
  #  :maxmp .. 最大 MP
 
  #  :atk   .. 攻撃力
 
  #  :def   .. 防御力
 
  #  :spi   .. 精神力
 
  #  :agi   .. 敏捷性
 
  #  :hit   .. 命中率
 
  #  :eva   .. 回避率
 
  #  :cri   .. クリティカル率
 
  EQUIP_PARAMS = [ :atk, :def, :spi, :agi, :hit, :eva, :cri ]
 
  # ◆ 拡張装備コマンドを使用する
 
  #  true  : 「最強装備」「すべて外す」コマンドを使用可能
 
  #  false : 装備変更のみ
 
  USE_COMMAND_WINDOW = true
 
  # ◆ 装備画面のコマンド名
 
  COMMANDS = [
 
    "装备更变",    # 装備変更
 
    "最强装备",    # 最強装備
 
    "装备解除",  # すべて外す
 
  ]  # ← この ] は消さないこと!
 
  # ◆ 装備画面コマンドのヘルプ
 
  COMMAND_HELP = [
 
    "更变装备。",            # 装備変更
 
    "装备最强有力的装备。",  # 最強装備
 
    "取下全部的装备。",      # すべて外す
 
  ]  # ← この ] は消さないこと!
 
  # ◆ 最強装備を行わない装備種別
 
  #  最強装備から除外する装備種別を記述。
 
  #  -1..武器  0..盾  1..頭  2..身体  3..装飾品  4~..≪装備拡張≫ で定義
 
  IGNORE_STRONGEST_KIND = [3, 5]
 
  # ◆ 最強武器選択時のパラメータ優先順位
 
  #  優先順位の高い順に , で区切って記入。
 
  #  :atk .. 攻撃力
 
  #  :def .. 防御力
 
  #  :spi .. 精神力
 
  #  :agi .. 敏捷性
 
  STRONGEST_WEAPON_PARAM_ORDER = [ :atk, :spi, :agi, :def ]
 
  # ◆ 最強防具選択時のパラメータ優先順位
 
  #  指定方法は武器と同じ。
 
  STRONGEST_ARMOR_PARAM_ORDER  = [ :def, :spi, :agi, :atk ]
 
  # ◆ AP ウィンドウを使用する
 
  #  true  : 使用する
 
  #  false : 使用しない
 
  #  ≪スキル習得装備≫ 併用時のみ有効。
 
  SHOW_AP_WINDOW    = true
 
  # ◆ AP ウィンドウに表示するスキル数
 
  #  多くしすぎすると表示がバグります。
 
  #  (4 以下を推奨)
 
  AP_WINDOW_SKILLS  = 4
 
  # ◆ AP ウィンドウの習得スキル名のキャプション
 
  AP_WINDOW_CAPTION = "習得#{Vocab.skill}"
 
  # ◆ AP ウィンドウの表示切り替えボタン
 
  #  このボタンを押すと、AP ウィンドウの表示/非表示が切り替わる。
 
  AP_WINDOW_BUTTON  = Input::X
 
end
 
end
 
#==============================================================================
 
# ☆ カスタマイズ項目 終了 - Customize END ☆
 
#==============================================================================
 
$imported = {} if $imported == nil
 
$imported["ExtendedEquipScene"] = true
 
module KGC::ExtendedEquipScene
 
  # パラメータ取得用 Proc
 
  GET_PARAM_PROC = {
 
    :atk => Proc.new { |n| n.atk },
 
    :def => Proc.new { |n| n.def },
 
    :spi => Proc.new { |n| n.spi },
 
    :agi => Proc.new { |n| n.agi },
 
  }
 
  # 最強アイテム用構造体
 
  StrongestItem = Struct.new("StrongestItem", :index, :item)
 
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
 
# ■ Vocab
 
#==============================================================================
 
module Vocab
 
  # 命中率
 
  def self.hit
 
    return KGC::ExtendedEquipScene::VOCAB_PARAM[:hit]
 
  end
 
  # 回避率
 
  def self.eva
 
    return KGC::ExtendedEquipScene::VOCAB_PARAM[:eva]
 
  end
 
  # クリティカル率
 
  def self.cri
 
    return KGC::ExtendedEquipScene::VOCAB_PARAM[:cri]
 
  end
 
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
 
# □ Window_ExtendedEquipCommand
 
#------------------------------------------------------------------------------
 
#   拡張装備画面で、実行する操作を選択するウィンドウです。
 
#==============================================================================
 
class Window_ExtendedEquipCommand < Window_Command
 
  #--------------------------------------------------------------------------
 
  # ● オブジェクト初期化
 
  #--------------------------------------------------------------------------
 
  def initialize
 
    super(160, KGC::ExtendedEquipScene::COMMANDS)
 
    self.active = false
 
    self.z = 1000
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● ヘルプウィンドウの更新
 
  #--------------------------------------------------------------------------
 
  def update_help
 
    @help_window.set_text(KGC::ExtendedEquipScene::COMMAND_HELP[self.index])
 
  end
 
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
 
# □ Window_EquipBaseInfo
 
#------------------------------------------------------------------------------
 
#   装備画面で、アクターの基本情報を表示するウィンドウです。
 
#==============================================================================
 
class Window_EquipBaseInfo < Window_Base
 
  #--------------------------------------------------------------------------
 
  # ● オブジェクト初期化
 
  #     x     : ウィンドウの X 座標
 
  #     y     : ウィンドウの Y 座標
 
  #     actor : アクター
 
  #--------------------------------------------------------------------------
 
  def initialize(x, y, actor)
 
    super(x, y, Graphics.width / 2, WLH + 32)
 
    @actor = actor
 
    refresh
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● リフレッシュ
 
  #--------------------------------------------------------------------------
 
  def refresh
 
    self.contents.clear
 
    draw_actor_name(@actor, 0, 0)
 
    # EP 制を使用する場合は EP を描画
 
    if $imported["EquipExtension"] && KGC::EquipExtension::USE_EP_SYSTEM
 
      draw_actor_ep(@actor, 116, 0, Graphics.width / 2 - 148)
 
    end
 
  end
 
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
 
# ■ Window_Equip
 
#==============================================================================
 
class Window_Equip < Window_Selectable
 
  unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
 
  #--------------------------------------------------------------------------
 
  # ● カーソルを 1 ページ後ろに移動
 
  #--------------------------------------------------------------------------
 
  def cursor_pagedown
 
    return if Input.repeat?(Input::R)
 
    super
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● カーソルを 1 ページ前に移動
 
  #--------------------------------------------------------------------------
 
  def cursor_pageup
 
    return if Input.repeat?(Input::L)
 
    super
 
  end
 
  end  # <-- unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
 
  #--------------------------------------------------------------------------
 
  # ● フレーム更新
 
  #--------------------------------------------------------------------------
 
  def update
 
    super
 
    return unless self.active
 
    if Input.repeat?(Input::RIGHT)
 
      Sound.play_cursor
 
      cursor_pagedown
 
    elsif Input.repeat?(Input::LEFT)
 
      Sound.play_cursor
 
      cursor_pageup
 
    end
 
  end
 
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
 
# ■ Window_EquipItem
 
#==============================================================================
 
class Window_EquipItem < Window_Item
 
  #--------------------------------------------------------------------------
 
  # ● オブジェクト初期化
 
  #     x          : ウィンドウの X 座標
 
  #     y          : ウィンドウの Y 座標
 
  #     width      : ウィンドウの幅
 
  #     height     : ウィンドウの高さ
 
  #     actor      : アクター
 
  #     equip_type : 装備部位
 
  #--------------------------------------------------------------------------
 
  alias initialize_KGC_ExtendedEquipScene initialize
 
  def initialize(x, y, width, height, actor, equip_type)
 
    width = Graphics.width / 2
 
    initialize_KGC_ExtendedEquipScene(x, y, width, height, actor, equip_type)
 
    @column_max = 1
 
    refresh
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● リフレッシュ
 
  #--------------------------------------------------------------------------
 
  alias refresh_KGC_ExtendedEquipScene refresh  unless $@
 
  def refresh
 
    return if @column_max == 2  # 無駄な描画はしない
 
    refresh_KGC_ExtendedEquipScene
 
  end
 
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
 
# □ Window_ExtendedEquipStatus
 
#------------------------------------------------------------------------------
 
#   拡張装備画面で、アクターの能力値変化を表示するウィンドウです。
 
#==============================================================================
 
class Window_ExtendedEquipStatus < Window_EquipStatus
 
  #--------------------------------------------------------------------------
 
  # ○ 公開インスタンス変数
 
  #--------------------------------------------------------------------------
 
  attr_writer   :equip_type               # 装備タイプ
 
  #--------------------------------------------------------------------------
 
  # ● オブジェクト初期化
 
  #     x     : ウィンドウの X 座標
 
  #     y     : ウィンドウの Y 座標
 
  #     actor : アクター
 
  #--------------------------------------------------------------------------
 
  def initialize(x, y, actor)
 
    @equip_type = -1
 
    @caption_cache = nil
 
    super(x, y, actor)
 
    @new_item = nil
 
    @new_param = {}
 
    refresh
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● 解放
 
  #--------------------------------------------------------------------------
 
  def dispose
 
    super
 
    @caption_cache.dispose if @caption_cache != nil
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● ウィンドウ内容の作成
 
  #--------------------------------------------------------------------------
 
  def create_contents
 
    self.contents.dispose
 
    self.contents = Bitmap.new(Graphics.width / 2 - 32, height - 32)
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● リフレッシュ
 
  #--------------------------------------------------------------------------
 
  def refresh
 
    return if @equip_type < 0
 
    if @caption_cache == nil
 
      create_cache
 
    else
 
      self.contents.clear
 
      self.contents.blt(0, 0, @caption_cache, @caption_cache.rect)
 
    end
 
    draw_item_name(@actor.equips[@equip_type], 0, 0)
 
    draw_item_name(@new_item, 24, WLH)
 
    KGC::ExtendedEquipScene::EQUIP_PARAMS.each_with_index { |param, i|
 
      draw_parameter(0, WLH * (i + 2), param)
 
    }
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ キャッシュ生成
 
  #--------------------------------------------------------------------------
 
  def create_cache
 
    create_contents
 
    self.contents.font.color = system_color
 
    self.contents.draw_text(0, WLH, 20, WLH, "→")
 
    # パラメータ描画
 
    KGC::ExtendedEquipScene::EQUIP_PARAMS.each_with_index { |param, i|
 
      draw_parameter_name(0, WLH * (i + 2), param)
 
    }
 
    @caption_cache = Bitmap.new(self.contents.width, self.contents.height)
 
    @caption_cache.blt(0, 0, self.contents, self.contents.rect)
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ 能力値名の描画
 
  #     x    : 描画先 X 座標
 
  #     y    : 描画先 Y 座標
 
  #     type : 能力値の種類
 
  #--------------------------------------------------------------------------
 
  def draw_parameter_name(x, y, type)
 
    case type
 
    when :maxhp
 
      name = Vocab.hp
 
    when :maxmp
 
      name = Vocab.mp
 
    when :atk
 
      name = Vocab.atk
 
    when :def
 
      name = Vocab.def
 
    when :spi
 
      name = Vocab.spi
 
    when :agi
 
      name = Vocab.agi
 
    when :hit
 
      name = Vocab.hit
 
    when :eva
 
      name = Vocab.eva
 
    when :cri
 
      name = Vocab.cri
 
    end
 
    self.contents.font.color = system_color
 
    self.contents.draw_text(x + 4, y, 96, WLH, name)
 
    self.contents.font.color = system_color
 
    self.contents.draw_text(x + 156, y, 20, WLH, "→", 1)
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● 装備変更後の能力値設定
 
  #     new_param : 装備変更後のパラメータの配列
 
  #     new_item  : 変更後の装備
 
  #--------------------------------------------------------------------------
 
  def set_new_parameters(new_param, new_item)
 
    changed = false
 
    # パラメータ変化判定
 
    KGC::ExtendedEquipScene::EQUIP_PARAMS.each { |k|
 
      if @new_param[k] != new_param[k]
 
        changed = true
 
        break
 
      end
 
    }
 
    changed |= (@new_item != new_item)
 
    if changed
 
      @new_item = new_item
 
      @new_param = new_param
 
      refresh
 
    end
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● 能力値の描画
 
  #     x    : 描画先 X 座標
 
  #     y    : 描画先 Y 座標
 
  #     type : 能力値の種類
 
  #--------------------------------------------------------------------------
 
  def draw_parameter(x, y, type)
 
    case type
 
    when :maxhp
 
      value = @actor.maxhp
 
    when :maxmp
 
      value = @actor.maxmp
 
    when :atk
 
      value = @actor.atk
 
    when :def
 
      value = @actor.def
 
    when :spi
 
      value = @actor.spi
 
    when :agi
 
      value = @actor.agi
 
    when :hit
 
      value = @actor.hit
 
    when :eva
 
      value = @actor.eva
 
    when :cri
 
      value = @actor.cri
 
    end
 
    new_value = @new_param[type]
 
    self.contents.font.color = normal_color
 
    self.contents.draw_text(x + 106, y, 48, WLH, value, 2)
 
    if new_value != nil
 
      self.contents.font.color = new_parameter_color(value, new_value)
 
      self.contents.draw_text(x + 176, y, 48, WLH, new_value, 2)
 
    end
 
  end
 
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
 
# □ Window_ExtendedEquipAPViewer
 
#------------------------------------------------------------------------------
 
#   拡張装備画面で、習得スキルを表示するウィンドウです。
 
#==============================================================================
 
if $imported["EquipLearnSkill"]
 
class Window_ExtendedEquipAPViewer < Window_APViewer
 
  #--------------------------------------------------------------------------
 
  # ● 公開インスタンス変数
 
  #--------------------------------------------------------------------------
 
  attr_reader   :item                     # 表示対象のアイテム
 
  #--------------------------------------------------------------------------
 
  # ● オブジェクト初期化
 
  #     x      : ウィンドウの X 座標
 
  #     y      : ウィンドウの Y 座標
 
  #     width  : ウィンドウの幅
 
  #     height : ウィンドウの高さ
 
  #     actor  : アクター
 
  #--------------------------------------------------------------------------
 
  def initialize(x, y, width, height, actor)
 
    @item = nil
 
    super
 
    self.index = -1
 
    self.active = false
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ アイテム設定
 
  #--------------------------------------------------------------------------
 
  def item=(new_item)
 
    @item = new_item
 
    refresh
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ リフレッシュ
 
  #--------------------------------------------------------------------------
 
  def refresh
 
    @data = []
 
    @can_gain_ap_skills = @actor.can_gain_ap_skills
 
    @equipment_skills = @actor.equipment_skills(true)
 
    skills = (@item == nil ? [] : @item.learn_skills)
 
    skills.each { |i|
 
      @data << $data_skills[i]
 
    }
 
    @item_max = @data.size
 
    create_contents
 
    draw_caption
 
    @item_max.times { |i| draw_item(i) }
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ キャプションを描画
 
  #--------------------------------------------------------------------------
 
  def draw_caption
 
    self.contents.font.color = system_color
 
    self.contents.draw_text(0, 0, width - 96, WLH,
 
      KGC::ExtendedEquipScene::AP_WINDOW_CAPTION, 1)
 
    self.contents.draw_text(width - 96, 0, 64, WLH, Vocab.ap, 1)
 
    self.contents.font.color = normal_color
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ スキルをマスク表示するかどうか
 
  #     skill : スキル
 
  #--------------------------------------------------------------------------
 
  def mask?(skill)
 
    return false
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ 項目の描画
 
  #     index : 項目番号
 
  #--------------------------------------------------------------------------
 
  def draw_item(index)
 
    rect = item_rect(index)
 
    rect.y += WLH
 
    self.contents.clear_rect(rect)
 
    skill = @data[index]
 
    if skill != nil
 
      draw_item_name(skill, rect.x, rect.y)
 
      if skill.need_ap > 0
 
        if @actor.ap_full?(skill) || @actor.skill_learn?(skill)
 
          # マスター
 
          text = Vocab.full_ap_skill
 
        else
 
          # AP 蓄積中
 
          text = sprintf("%4d/%4d", @actor.skill_ap(skill.id), skill.need_ap)
 
        end
 
      end
 
      # AP を描画
 
      rect.x = rect.width - 80
 
      rect.width = 80
 
      self.contents.font.color = normal_color
 
      self.contents.draw_text(rect, text, 2)
 
    end
 
  end
 
end
 
end  # <-- if $imported["EquipLearnSkill"]
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
 
# ■ Scene_Equip
 
#==============================================================================
 
class Scene_Equip < Scene_Base
 
  #--------------------------------------------------------------------------
 
  # ○ 定数
 
  #--------------------------------------------------------------------------
 
  STANDARD_WIDTH  = Graphics.width / 2
 
  ANIMATION_SPPED = 8
 
  #--------------------------------------------------------------------------
 
  # ● 開始処理
 
  #--------------------------------------------------------------------------
 
  alias start_KGC_ExtendedEquipScene start
 
  def start
 
    start_KGC_ExtendedEquipScene
 
    # ステータスウィンドウを作り直す
 
    @status_window.dispose
 
    @status_window = Window_ExtendedEquipStatus.new(0, 0, @actor)
 
    create_command_window
 
    @last_item = RPG::Weapon.new
 
    @base_info_window = Window_EquipBaseInfo.new(
 
      0, @help_window.height, @actor)
 
    if $imported["EquipLearnSkill"] && KGC::ExtendedEquipScene::SHOW_AP_WINDOW
 
      @ap_window = Window_ExtendedEquipAPViewer.new(0, 0, 64, 64, @actor)
 
    end
 
    adjust_window_for_extended_equiop_scene
 
    Graphics.frame_reset
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ ウィンドウの座標・サイズを拡張装備画面向けに調整
 
  #--------------------------------------------------------------------------
 
  def adjust_window_for_extended_equiop_scene
 
    @base_info_window.width = @equip_window.width
 
    @equip_window.x = 0
 
    @equip_window.y = @base_info_window.y + @base_info_window.height
 
    @equip_window.height = Graphics.height - @equip_window.y
 
    @equip_window.active = false
 
    @equip_window.z = 100
 
    @status_window.x = 0
 
    @status_window.y = @equip_window.y
 
    @status_window.width = STANDARD_WIDTH
 
    @status_window.height = @equip_window.height
 
    @status_window.visible = false
 
    @status_window.z = 100
 
    @item_windows.each { |window|
 
      window.x = @equip_window.width
 
      window.y = @help_window.height
 
      window.z = 50
 
      window.height = Graphics.height - @help_window.height
 
    }
 
    if @ap_window != nil
 
      @ap_window.width = @item_windows[0].width
 
      @ap_window.height =
 
        (KGC::ExtendedEquipScene::AP_WINDOW_SKILLS + 1) * Window_Base::WLH + 32
 
      @ap_window.x = @equip_window.width
 
      @ap_window.y = Graphics.height - @ap_window.height
 
      @ap_window.z = @item_windows[0].z + 10
 
      @ap_window.refresh
 
    end
 
    # コマンドウィンドウ不使用の場合
 
    unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
 
      @command_window.visible = false
 
      @command_window.active = false
 
      @equip_window.active = true
 
      @equip_window.call_update_help
 
    end
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ コマンドウィンドウの作成
 
  #--------------------------------------------------------------------------
 
  def create_command_window
 
    @command_window = Window_ExtendedEquipCommand.new
 
    @command_window.help_window = @help_window
 
    @command_window.active = true
 
    @command_window.x = (Graphics.width - @command_window.width) / 2
 
    @command_window.y = (Graphics.height - @command_window.height) / 2
 
    @command_window.update_help
 
    # 装備固定なら「最強装備」「すべて外す」を無効化
 
    if @actor.fix_equipment
 
      @command_window.draw_item(1, false)
 
      @command_window.draw_item(2, false)
 
    end
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● 終了処理
 
  #--------------------------------------------------------------------------
 
  alias terminate_KGC_ExtendedEquipScene terminate
 
  def terminate
 
    terminate_KGC_ExtendedEquipScene
 
    @command_window.dispose
 
    @base_info_window.dispose
 
    @ap_window.dispose if @ap_window != nil
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ ウィンドウをリフレッシュ
 
  #--------------------------------------------------------------------------
 
  def refresh_window
 
    @base_info_window.refresh
 
    @equip_window.refresh
 
    @status_window.refresh
 
    @item_windows.each { |window| window.refresh }
 
    @ap_window.refresh if @ap_window != nil
 
    Graphics.frame_reset
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● フレーム更新
 
  #--------------------------------------------------------------------------
 
  alias update_KGC_ExtendedEquipScene update
 
  def update
 
    update_command_window
 
    if @command_window.active
 
      update_KGC_ExtendedEquipScene
 
      update_command_selection
 
    else
 
      update_KGC_ExtendedEquipScene
 
      update_ap_window
 
    end
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ コマンドウィンドウの更新
 
  #--------------------------------------------------------------------------
 
  def update_command_window
 
    @command_window.update
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● ステータスウィンドウの更新
 
  #--------------------------------------------------------------------------
 
  def update_status_window
 
    @base_info_window.update
 
    @status_window.update
 
    if @command_window.active || @equip_window.active
 
      @status_window.set_new_parameters({}, nil)
 
    elsif @item_window.active
 
      return if @last_item == @item_window.item
 
      @last_item = @item_window.item
 
      temp_actor = Marshal.load(Marshal.dump(@actor))
 
      temp_actor.change_equip(@equip_window.index, @item_window.item, true)
 
      param = {
 
        :maxhp => temp_actor.maxhp,
 
        :maxmp => temp_actor.maxmp,
 
        :atk   => temp_actor.atk,
 
        :def   => temp_actor.def,
 
        :spi   => temp_actor.spi,
 
        :agi   => temp_actor.agi,
 
        :hit   => temp_actor.hit,
 
        :eva   => temp_actor.eva,
 
        :cri   => temp_actor.cri,
 
      }
 
      @status_window.equip_type = @equip_window.index
 
      @status_window.set_new_parameters(param, @last_item)
 
      Graphics.frame_reset
 
    end
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ AP ウィンドウの更新
 
  #--------------------------------------------------------------------------
 
  def update_ap_window
 
    return if @ap_window == nil
 
    # 表示/非表示切り替え
 
    button = KGC::ExtendedEquipScene::AP_WINDOW_BUTTON
 
    if button != nil && Input.trigger?(button)
 
      Sound.play_decision
 
      if @ap_window.openness == 255
 
        @ap_window.close
 
      else
 
        @ap_window.open
 
      end
 
    end
 
    # 表示内容更新
 
    @ap_window.update
 
    new_item = (@equip_window.active ? @equip_window.item : @item_window.item)
 
    @ap_window.item = new_item if @ap_window.item != new_item
 
    # 位置更新
 
    ay = @ap_window.y
 
    ayb = @ap_window.y + @ap_window.height  # AP window: Bottom
 
    cy = @item_window.y + 16
 
    cy += @item_window.cursor_rect.y if @item_window.active
 
    cyb = cy + Window_Base::WLH             # Cursor rect: Bottom
 
    bottom = (ay != @item_window.y)
 
    if bottom
 
      # 下で被る
 
      @ap_window.y = @item_window.y if ay < cyb
 
    else
 
      # 上で被る
 
      @ap_window.y = Graphics.height - @ap_window.height if cy < ayb
 
    end
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ コマンド選択の更新
 
  #--------------------------------------------------------------------------
 
  def update_command_selection
 
    update_window_position_for_equip_selection
 
    if Input.trigger?(Input::B)
 
      Sound.play_cancel
 
      return_scene
 
    elsif Input.trigger?(Input::R)
 
      Sound.play_cursor
 
      next_actor
 
    elsif Input.trigger?(Input::L)
 
      Sound.play_cursor
 
      prev_actor
 
    elsif Input.trigger?(Input::C)
 
      case @command_window.index
 
      when 0  # 装備変更
 
        Sound.play_decision
 
        # 装備部位ウィンドウに切り替え
 
        @equip_window.active   = true
 
        @command_window.active = false
 
        @command_window.close
 
      when 1  # 最強装備
 
        if @actor.fix_equipment
 
          Sound.play_buzzer
 
          return
 
        end
 
        Sound.play_equip
 
        process_equip_strongest
 
      when 2  # すべて外す
 
        if @actor.fix_equipment
 
          Sound.play_buzzer
 
          return
 
        end
 
        Sound.play_equip
 
        process_remove_all
 
      end
 
    end
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● 装備部位選択の更新
 
  #--------------------------------------------------------------------------
 
  alias update_equip_selection_KGC_ExtendedEquipScene update_equip_selection
 
  def update_equip_selection
 
    update_window_position_for_equip_selection
 
    if Input.trigger?(Input::A)
 
      if @actor.fix_equipment
 
        Sound.play_buzzer
 
        return
 
      end
 
      # 選択している装備品を外す
 
      Sound.play_equip
 
      @actor.change_equip(@equip_window.index, nil)
 
      refresh_window
 
    elsif Input.trigger?(Input::B)
 
      Sound.play_cancel
 
      if KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
 
        show_command_window
 
      else
 
        # コマンドウィンドウ不使用なら終了
 
        return_scene
 
      end
 
      return
 
    elsif Input.trigger?(Input::R)
 
      unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
 
        # コマンドウィンドウ不使用時のみ切り替え
 
        Sound.play_cursor
 
        next_actor
 
        return
 
      end
 
    elsif Input.trigger?(Input::L)
 
      unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
 
        # コマンドウィンドウ不使用時のみ切り替え
 
        Sound.play_cursor
 
        prev_actor
 
        return
 
      end
 
    elsif Input.trigger?(Input::C)
 
      # 前回のアイテムをダミーにする
 
      @last_item = RPG::Weapon.new
 
    end
 
    update_equip_selection_KGC_ExtendedEquipScene
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ コマンドウィンドウに切り替え
 
  #--------------------------------------------------------------------------
 
  def show_command_window
 
    @equip_window.active   = false
 
    @command_window.active = true
 
    @command_window.open
 
  end
 
  #--------------------------------------------------------------------------
 
  # ● アイテム選択の更新
 
  #--------------------------------------------------------------------------
 
  alias update_item_selection_KGC_ExtendedEquipScene update_item_selection
 
  def update_item_selection
 
    update_window_position_for_item_selection
 
    update_item_selection_KGC_ExtendedEquipScene
 
    if Input.trigger?(Input::C)
 
      @base_info_window.refresh
 
    end
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ ウィンドウ位置の更新 (装備部位選択)
 
  #--------------------------------------------------------------------------
 
  def update_window_position_for_equip_selection
 
    return if @item_window.x == @equip_window.width
 
    @base_info_window.width = @equip_window.width
 
    @item_window.x = [@item_window.x + ANIMATION_SPPED, @equip_window.width].min
 
    if @ap_window != nil
 
      @ap_window.x = @item_window.x
 
    end
 
    @equip_window.visible  = true
 
    @status_window.visible = false
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ ウィンドウ位置の更新 (アイテム選択)
 
  #--------------------------------------------------------------------------
 
  def update_window_position_for_item_selection
 
    return if @item_window.x == STANDARD_WIDTH
 
    @base_info_window.width = STANDARD_WIDTH
 
    @item_window.x = [@item_window.x - ANIMATION_SPPED, STANDARD_WIDTH].max
 
    if @ap_window != nil
 
      @ap_window.x = @item_window.x
 
    end
 
    @equip_window.visible  = false
 
    @status_window.visible = true
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ 最強装備の処理
 
  #--------------------------------------------------------------------------
 
  def process_equip_strongest
 
    # 以前のパラメータを保存
 
    last_hp = @actor.hp
 
    last_mp = @actor.mp
 
    # 最強装備対象の種別を取得
 
    types = [-1]
 
    types += ($imported["EquipExtension"] ? @actor.equip_type : [0, 1, 2, 3])
 
    ignore_types   = KGC::ExtendedEquipScene::IGNORE_STRONGEST_KIND.clone
 
    judged_indices = []
 
    weapon_range   = 0..(@actor.two_swords_style ? 1 : 0)
 
    # 装備対象の武具をすべて外す
 
    types.each_with_index { |t, i|
 
      @actor.change_equip(i, nil) unless ignore_types.include?(t)
 
    }
 
    # 最強武器装備
 
    weapon_range.each { |i|
 
      judged_indices << i
 
      # 1本目が両手持ちの場合は2本目を装備しない
 
      if @actor.two_swords_style
 
        weapon = @actor.weapons[0]
 
        next if weapon != nil && weapon.two_handed
 
      end
 
      weapon = get_strongest_weapon(i)
 
      @actor.change_equip(i, weapon) if weapon != nil
 
    }
 
    # 両手持ち武器を持っている場合は盾 (防具1) を装備しない
 
    weapon = @actor.weapons[0]
 
    if weapon != nil && weapon.two_handed
 
      judged_indices |= [1]
 
    end
 
    # 最強防具装備
 
    exist = true
 
    while exist
 
      strongest = get_strongest_armor(types, ignore_types, judged_indices)
 
      if strongest != nil
 
        @actor.change_equip(strongest.index, strongest.item)
 
        judged_indices << strongest.index
 
      else
 
        exist = false
 
      end
 
    end
 
    # 以前のパラメータを復元
 
    @actor.hp = last_hp
 
    @actor.mp = last_mp
 
    refresh_window
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ 最も強力な武器を取得
 
  #     equip_type : 装備部位
 
  #    該当するアイテムがなければ nil を返す。
 
  #--------------------------------------------------------------------------
 
  def get_strongest_weapon(equip_type)
 
    # 装備可能な武器を取得
 
    equips = $game_party.items.find_all { |item|
 
      valid = item.is_a?(RPG::Weapon) && @actor.equippable?(item)
 
      if valid && $imported["EquipExtension"]
 
        valid = @actor.ep_condition_clear?(equip_type, item)
 
      end
 
      valid
 
    }
 
    return nil if equips.empty?
 
    param_order = KGC::ExtendedEquipScene::STRONGEST_WEAPON_PARAM_ORDER
 
    return get_strongest_item(equips, param_order)
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ 最も強力なアイテムを取得
 
  #     equips      : 装備品リスト
 
  #     param_order : パラメータ優先順位
 
  #--------------------------------------------------------------------------
 
  def get_strongest_item(equips, param_order)
 
    result = []
 
    param_order.each { |param|
 
      # パラメータ順にソート
 
      get_proc = KGC::ExtendedEquipScene::GET_PARAM_PROC[param]
 
      equips   = equips.sort_by { |item| -get_proc.call(item) }
 
      # 最もパラメータが高いアイテムを取得
 
      highest = equips[0]
 
      result  = equips.find_all { |item|
 
        get_proc.call(highest) == get_proc.call(item)
 
      }
 
      # 候補が1つに絞れたら終了
 
      break if result.size == 1
 
      equips = result.clone
 
    }
 
    # 最も ID が大きいアイテムを取得
 
    return (result.sort_by { |v| -v.id })[0]
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ 最も強力な防具を取得 (StrongestItem)
 
  #     types          : 装備部位リスト
 
  #     ignore_types   : 無視する部位リスト
 
  #     judged_indices : 判定済み部位番号リスト
 
  #    該当するアイテムがなければ nil を返す。
 
  #--------------------------------------------------------------------------
 
  def get_strongest_armor(types, ignore_types, judged_indices)
 
    # 装備可能な防具を取得
 
    equips = $game_party.items.find_all { |item|
 
      item.is_a?(RPG::Armor) &&
 
        !ignore_types.include?(item.kind) &&
 
        @actor.equippable?(item)
 
    }
 
    return nil if equips.empty?
 
    param_order = KGC::ExtendedEquipScene::STRONGEST_ARMOR_PARAM_ORDER
 
    # 最強防具を探す
 
    until equips.empty?
 
      armor = get_strongest_item(equips, param_order)
 
      types.each_with_index { |t, i|
 
        next if judged_indices.include?(i)
 
        next if armor.kind != t
 
        if $imported["EquipExtension"]
 
          next unless @actor.ep_condition_clear?(i, armor)
 
        end
 
        return KGC::ExtendedEquipScene::StrongestItem.new(i, armor)
 
      }
 
      equips.delete(armor)
 
    end
 
    return nil
 
  end
 
  #--------------------------------------------------------------------------
 
  # ○ すべて外す処理
 
  #--------------------------------------------------------------------------
 
  def process_remove_all
 
    type_max = ($imported["EquipExtension"] ? @actor.equip_type.size : 4) + 1
 
    type_max.times { |i| @actor.change_equip(i, nil) }
 
    refresh_window
 
  end
 
end
 | 
 |