#==============================================================================
# ■ MONSTER_BOOK vol.1.20 (分割定義 2)
#------------------------------------------------------------------------------
# ※ MONSTER_BOOK(分割定義 1)より下に挿入
# 09/04/24
#==============================================================================
#==============================================================================
# ■ Window_monster_graphics
#==============================================================================
class Window_monster_graphics
  #--------------------------------------------------------------------------
  # ■ オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    # □モンスターウィンドウの作成
    @monster_window = Sprite.new
    @index = 0
    # □モンスター画像の更新
    monster_refresh(0)
  end
  #--------------------------------------------------------------------------
  # ■ モンスターの取得
  #--------------------------------------------------------------------------
  def monster
    if $game_system.monsters[@index + 1] != nil
      if $game_system.monsters[@index + 1] != 0
        return $data_enemies[$game_system.monster_numbers[@index + 1]]
      else
        return $data_enemies[$game_system.monster_numbers[@index + 1]]
      end
    else
      return nil
    end
  end
  #--------------------------------------------------------------------------
  # ■ モンスター画像の更新
  #--------------------------------------------------------------------------
  def monster_refresh(index)
    @index = index
    # □バトラー画像を描画
    if monster != nil
      if monster != @old_monster
        @monster_window.bitmap = RPG::Cache.battler(monster.battler_name,monster.battler_hue)
        cw,ch = @monster_window.bitmap.width,@monster_window.bitmap.height
        if cw > 384
          @monster_window.x = 640-cw-16
        else
          @monster_window.x = 240+(400/2)-(cw/2)
        end
        if ch > 384
          @monster_window.y = (384 - ch)/2
        else
          @monster_window.y = (384 - ch)/4
        end
        @old_monster = monster
      end
    # □遭遇していない場合
    else
      @no_monster = Bitmap.new(1,1)
      @monster_window.bitmap = @no_monster
      @old_monster = monster
    end
  end
  #--------------------------------------------------------------------------
  # ■ 解放
  #--------------------------------------------------------------------------
  def dispose
    if @no_monster != nil
      @no_monster.dispose
    end
    # □Cache.battlerなので開放しない
    #@monster_window.bitmap.dispose
    @monster_window.dispose
    @monster_window = nil
  end
end
#==============================================================================
# ■ Window_monster_list
#==============================================================================
class Window_monster_list < Window_Selectable
  include MONSTER_BOOK
  # □スクロールバーを併用
  if MONSTER_BOOK::SCROLL_BAR
    include HIDE_SCROLL_BAR
  end
  # □点滅ウィンドウを作成
  if MONSTER_BOOK::BLINK_WINDOW
    include Blink_Window_Command
  end
  #--------------------------------------------------------------------------
  # ■ オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0,128,240,352)
    @column_max = 1
    self.index = 0
    self.active = true
    @item_max = $game_system.monsters.size
    self.contents = Bitmap.new(width - 32, row_max * 32)
    self.opacity = 0
    self.back_opacity = 0
    # □デフォルトカーソルの消去
    if MONSTER_BOOK::NO_CURSOR
      self.windowskin = Bitmap.new(1,1)
    end
    # □点滅文字ウィンドウを併用
    if MONSTER_BOOK::BLINK_WINDOW
      make_blink_window?
      self.blink_speed = 0
      self.blink_stop = 255
    end
    # □文字装飾の設定
    @fonts = Copy_Font.new
    @fonts.color = MONSTER_BOOK::NORMAL_COLOR
    @fonts.s_color = MONSTER_BOOK::SHADOW_COLOR
    @fonts.round = MONSTER_BOOK::LOUND
    @fonts.shadow = MONSTER_BOOK::SHADOW
    @normal_color = @fonts.color
    @shadow_color = @fonts.s_color
    @blink_color = MONSTER_BOOK::BLINK_COLOR
    # □クエスチョンウィンドウの作成
    if $game_system.total_monsters_number? != $game_system.monsters.size
      @question_window = Sprite.new(Viewport.new(240,0,400,480))
    end
    question_visible?(false)
    # □クエスチョンマークを描画
    @fonts.size = MONSTER_BOOK::LIST_SIZE
    @fonts.round = MONSTER_BOOK::LOUND
    @fonts.shadow = MONSTER_BOOK::SHADOW
    # □クエスチョンマークを描画
    if @question_window != nil
      @question_window.bitmap = question_words?(RPG::Cache.digits("monster_question_bitmap"))
    end
    # □モンスターリストの描画
    draw_monsters?(RPG::Cache.digits("monster_list_bitmap"),RPG::Cache.digits("monster_blink_bitmap"))
    # □スクロールバーの作成
    if MONSTER_BOOK::SCROLL_BAR
      make_scroll_bar(MONSTER_BOOK::SCROLL_BAR_BACK,MONSTER_BOOK::SCROLL_BAR_X,MONSTER_BOOK::SCROLL_BAR_Y)
    end
  end
  #--------------------------------------------------------------------------
  # ■ モンスターの取得
  #--------------------------------------------------------------------------
  def monster
    if $game_system.monsters[self.index + 1] != nil
      if $game_system.monsters[self.index + 1] != 0
        return $data_enemies[$game_system.monster_numbers[self.index + 1]]
      else
        return $data_enemies[$game_system.monster_numbers[self.index + 1]]
      end
    else
      return nil
    end
  end
  #--------------------------------------------------------------------------
  # ■ クエスチョンウィンドウの可視化
  #--------------------------------------------------------------------------
  def question_visible?(visible)
    if @question_window != nil
      if @question_window.visible != visible
        @question_window.visible = visible
      end
    end
  end
  #--------------------------------------------------------------------------
  # ■ クエスチョンマークを描画
  #--------------------------------------------------------------------------
  def question_words?(cache)
    # □キャッシュ化して呼び出しを高速化
    if cache != nil
      return cache
    else
      question_bitmap = Bitmap.new(400,480)
    end
    @fonts.size = 18
    @fonts.round = MONSTER_BOOK::LOUND
    @fonts.shadow = MONSTER_BOOK::SHADOW
    x = 20 ; y = 146
    for i in 1..5
      question_bitmap.draw_cache_text(x,y+32*i,160,32,MONSTER_BOOK::SYSTEM[10],2,@fonts)
      question_bitmap.draw_cache_text(x+192,y+32*i,160,32,MONSTER_BOOK::SYSTEM[10],2,@fonts)
    end
    question_bitmap.draw_cache_text(x,y,160,32,MONSTER_BOOK::SYSTEM[8],2,@fonts)
    question_bitmap.draw_cache_text(x,y+32*8,160,32,MONSTER_BOOK::SYSTEM[10],2,@fonts)
    question_bitmap.draw_cache_text(x+192,y+32*8,160,32,MONSTER_BOOK::SYSTEM[10],2,@fonts)
    question_bitmap.draw_cache_text(112,y+32*9,160,32,MONSTER_BOOK::SYSTEM[12],0,@fonts)
    # □bitmapをキャッシュ化
    RPG::Cache.digits("monster_question_bitmap",question_bitmap)
    return question_bitmap
  end
  #--------------------------------------------------------------------------
  # ■ モンスターリストの描画
  #--------------------------------------------------------------------------
  def draw_monsters?(cache,blink_cache)
    # □キャッシュ化して呼び出しを高速化
    if cache != nil
      list_bitmap = cache
      blink_bitmap = blink_cache
    else
      list_bitmap = Bitmap.new(self.width - 32,self.row_max * 32)
      blink_bitmap = Bitmap.new(self.width - 32,self.row_max * 32)
    end
    #…………………………………………………………………………………………………
    # ■ 通し番号と名前の描画
    #…………………………………………………………………………………………………
    for i in $game_system.monsters.keys
      # □エネミーを取得
      enemy = $data_enemies[$game_system.monster_numbers[i]]
      x = 4-1
      y = (i-1)*32
      text = sprintf("%03d",i) + "："
      size = MONSTER_BOOK::LIST_SIZE
      self.contents.font.size = size
      cw = self.contents.text_size(text).width
      @fonts.color = @normal_color
      @fonts.size = MONSTER_BOOK::LIST_SIZE
      @fonts.round = MONSTER_BOOK::LOUND
      @fonts.shadow = MONSTER_BOOK::SHADOW
      if cache == nil
        list_bitmap.draw_cache_text(x,y,160,32,text,0,@fonts)
        list_bitmap.draw_cache_text(x+cw+size,y,176-cw,32,enemy.name,0,@fonts)
        # □点滅カーソル文字を描画
        if MONSTER_BOOK::BLINK_WINDOW
          @fonts.color = @blink_color
          @fonts.round = @fonts.shadow = false
          blink_bitmap.draw_cache_text(x,y,160,32,text,0,@fonts)
          blink_bitmap.draw_cache_text(x+cw+size,y,176-cw,32,enemy.name,0,@fonts)
        end
      end
    end
    #…………………………………………………………………………………………………
    # ■ 種族属性の描画
    #…………………………………………………………………………………………………
    for i in $game_system.monsters.keys
      if cache == nil
        # □エネミーを取得
        enemy = $data_enemies[$game_system.monster_numbers[i]]
        x = 4
        y = (i-1)*32
        e_icon = RPG::Cache.windowskin(MONSTER_BOOK::ELEMENTS)
        for n in 0...MONSTER_BOOK::ELEMENT_TYPE_IDS.size
          e = MONSTER_BOOK::ELEMENT_TYPE_IDS[n]
          if enemy.element_ranks[e] == 1
            list_bitmap.blt(x+cw,y+8,e_icon,Rect.new(e/10*16,e%10*16,16,16))
          end
        end
      end
    end
    #…………………………………………………………………………………………………
    # ■ bitmapをキャッシュ化
    #…………………………………………………………………………………………………
    if cache == nil
      RPG::Cache.digits("monster_list_bitmap",list_bitmap)
      RPG::Cache.digits("monster_blink_bitmap",blink_bitmap)
    end
    #…………………………………………………………………………………………………
    # ■ self.contentsにbitmapをキャッシュを描画
    #…………………………………………………………………………………………………
    self.contents.blt(0,0,list_bitmap,Rect.new(0,0,self.width - 32,self.row_max * 32))
    if MONSTER_BOOK::BLINK_WINDOW
      @blink_window.bitmap = blink_bitmap.dup
    end
    for i in $game_system.monsters.keys
      # □[?]を描画
      if $game_system.monsters[i] == nil
        x = 4
        y = (i-1)*32
        self.contents.fill_rect(Rect.new(x+cw,y,160,32),Color.new(0,0,0,0))
        @fonts.size = MONSTER_BOOK::LIST_SIZE
        @fonts.color = @normal_color
        @fonts.round = MONSTER_BOOK::LOUND
        @fonts.shadow = MONSTER_BOOK::SHADOW
        self.contents.draw_cache_text(x+cw,y,160,32,MONSTER_BOOK::SYSTEM[11],0,@fonts)
        # □点滅カーソル文字を描画
        if MONSTER_BOOK::BLINK_WINDOW
          @fonts.color = @blink_color
          @fonts.round = @fonts.shadow = false
          @blink_window.bitmap.fill_rect(Rect.new(x+cw,y,160,32),Color.new(0,0,0,0))
          @blink_window.bitmap.draw_cache_text(x+cw,y,160,32,MONSTER_BOOK::SYSTEM[11],0,@fonts)
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ■ 解放
  #--------------------------------------------------------------------------
  if !$@;alias hidesp_monster_list_dispose dispose;end
  def dispose
    @fonts = nil
    # □Cache.battlerなので開放しない
    #@monster_window.bitmap.dispose
    if @question_window != nil
      @question_window.viewport.dispose
      ##@question_window.bitmap.dispose
      @question_window.dispose
      @question_window = nil
    end
    super
  end
end
#==============================================================================
# ■ Window_monster_data
#==============================================================================
class Window_monster_data
  include MONSTER_BOOK
  #--------------------------------------------------------------------------
  # ■ オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    # □文字装飾の設定
    @fonts = Copy_Font.new
    @fonts.color = MONSTER_BOOK::NORMAL_COLOR
    @fonts.s_color = MONSTER_BOOK::SHADOW_COLOR
    @fonts.round = MONSTER_BOOK::LOUND
    @fonts.shadow = MONSTER_BOOK::SHADOW
    @normal_color = @fonts.color
    @shadow_color = @fonts.s_color
    @system_color = MONSTER_BOOK::SYSTEM_COLOR
    # □システムワードの文字サイズ
    @system_size = 20
    # □背景の作成
    @back_window = Sprite.new
    @back_window.bitmap = RPG::Cache.windowskin(MONSTER_BOOK::BACK)
    # □システムワードウィンドウの作成
    @data_window = Sprite.new(Viewport.new(240,128,512,352))
    # □タイトルウィンドウの作成
    @top_window = Sprite.new(Viewport.new(0,0,240,128))
    @top_window.bitmap = Bitmap.new(240,128)
    @top_window.viewport.z = 2
    # □ タイトル/完成度を描画
    draw_top_words
    # □キャッシュ化して呼び出しを高速化
    if (RPG::Cache.digits("monster_data_bitmap")) != nil
      @data_window.bitmap = RPG::Cache.digits("monster_data_bitmap")
      @data_window.viewport.z = 2
      return
    end
    @data_window.bitmap = Bitmap.new(512,352)
    @data_window.viewport.z = 2
    # □システムワードを描画
    draw_system_words
  end
  #--------------------------------------------------------------------------
  # ■ システムワードウィンドウの可視化
  #--------------------------------------------------------------------------
  def visible=(visible)
    @data_window.visible = visible
  end
  #--------------------------------------------------------------------------
  # ■ タイトル/完成度を描画
  #--------------------------------------------------------------------------
  def draw_top_words
    total_num = $game_system.total_monsters_number?.to_s + "/" + ($game_system.monsters.size).to_s
    cx = @top_window.bitmap.text_size(total_num).width
    @fonts.size = 22
    @fonts.color = @normal_color
    @fonts.round = MONSTER_BOOK::LOUND
    @fonts.shadow = MONSTER_BOOK::SHADOW
    @top_window.bitmap.draw_cache_text(224-cx,16+32*2,160,32,total_num,0,@fonts)
    @fonts.color = @system_color
    @top_window.bitmap.draw_cache_text(4+16,16+32*0,160,32,MONSTER_BOOK::SYSTEM[0],0,@fonts)
    @fonts.size = @system_size
    @fonts.color = @system_color
    @fonts.round = MONSTER_BOOK::LOUND
    @fonts.shadow = MONSTER_BOOK::SHADOW
    @top_window.bitmap.draw_cache_text(4+16,16+32*2,160,32,MONSTER_BOOK::SYSTEM[1],0,@fonts)
  end
  #--------------------------------------------------------------------------
  # ■ システムワードを描画
  #--------------------------------------------------------------------------
  def draw_system_words
    x = 28 ; y = 48
    @fonts.size = @system_size
    @fonts.color = @system_color
    @fonts.round = MONSTER_BOOK::LOUND
    @fonts.shadow = MONSTER_BOOK::SHADOW
    @data_window.bitmap.draw_cache_text(x,y-32,160,32,MONSTER_BOOK::SYSTEM[2],0,@fonts)
    data = [$data_system.words.hp,$data_system.words.str,$data_system.words.agi,
    $data_system.words.atk,$data_system.words.mdef]
    data2 = [$data_system.words.sp,$data_system.words.dex,$data_system.words.int,
    $data_system.words.pdef,MONSTER_BOOK::SYSTEM[3]]
    for i in 0...data.size
      @data_window.bitmap.draw_cache_text(x,y+32*i,160,32,data[i],0,@fonts)
      @data_window.bitmap.draw_cache_text(x+192,y+32*i,160,32,data2[i],0,@fonts)
    end
    @data_window.bitmap.draw_cache_text(x,y+32*5,160,32,MONSTER_BOOK::SYSTEM[4],0,@fonts)
    @data_window.bitmap.draw_cache_text(x,y+32*6,160,32,MONSTER_BOOK::SYSTEM[5],0,@fonts)
    @data_window.bitmap.draw_cache_text(x,y+32*7,160,32,MONSTER_BOOK::SYSTEM[6],0,@fonts)
    @data_window.bitmap.draw_cache_text(x+192,y+32*7,160,32,$data_system.words.gold,0,@fonts)
    @data_window.bitmap.draw_cache_text(x,y+32*8,160,32,MONSTER_BOOK::SYSTEM[7],0,@fonts)
    # □bitmapをキャッシュ化
    RPG::Cache.digits("monster_data_bitmap",@data_window.bitmap)
  end
  #--------------------------------------------------------------------------
  # ■ カーソルウィンドウの削除
  #--------------------------------------------------------------------------
  def dispose
    @fonts = nil
    # □Cache.windowskinなので開放しない
    #@back_window.bitmap.dispose
    @back_window.dispose
    @back_window = nil
    @top_window.bitmap.dispose
    @top_window.dispose
    @top_window = nil
    @data_window.viewport.dispose
    # □キャッシュ化するので開放しない(Cache.digits)
    #@data_window.bitmap.dispose
    @data_window.dispose
    @data_window = nil
  end
end
#==============================================================================
# ■ Scene_Monster_book
#==============================================================================
class Scene_Monster_Book
  include MONSTER_BOOK
  if MONSTER_BOOK::KEY_HELP
    include Key_Icon_Make
  end
  #--------------------------------------------------------------------------
  # ■ メイン処理
  #--------------------------------------------------------------------------
  def main
    @visible = true
    @monster_helps = []
    # □文字装飾の設定
    @fonts = Copy_Font.new
    @fonts.round = MONSTER_BOOK::LOUND
    @fonts.shadow = MONSTER_BOOK::SHADOW
    @fonts.color = MONSTER_BOOK::NORMAL_COLOR
    @fonts.s_color = MONSTER_BOOK::SHADOW_COLOR
    @fonts.colors = MONSTER_BOOK::EL_COLORS
    # □データウィンドウを作成
    @monster_data = Window_monster_data.new
    # □モンスター画像ウィンドウを作成
    @monster_graphics = Window_monster_graphics.new
    # □リストウィンドウを作成
    @monster_list = Window_monster_list.new
    dx = 352
    dy = 0
    # □属性防御を描画
    @element = []
    for i in 0...MONSTER_BOOK::ELEMENT_IDS.size
      cx = 240/MONSTER_BOOK::ELEMENT_IDS.size
      if MONSTER_BOOK::ELEMENT_ICON
        @fonts.size = 10
        eid = MONSTER_BOOK::ELEMENT_IDS[i]
        e = Rect_Draw_Icon.new("■",MONSTER_BOOK::ELEMENTS,eid,eid/10*16,eid%10*16,16,16)
        @element.push(Window_digits_number.new(dx+20+cx*i,dy+32*10,200,0,1,[e,MONSTER_BOOK::SYSTEM[8]],@fonts))
      else
        @fonts.size = 20
        e = $data_system.elements[MONSTER_BOOK::ELEMENT_IDS[i]]
        @element.push(Window_digits_number.new(dx+20+cx*i,dy+32*10,200,0,1,[e,MONSTER_BOOK::SYSTEM[8]],@fonts))
      end
    end
    # □ステート防御を描画
    @states = []
    @fonts.size = 10
    for i in 0...MONSTER_BOOK::STATE_IDS.size
      sid = MONSTER_BOOK::STATE_IDS[i]
      s = Rect_Draw_Icon.new("■",MONSTER_BOOK::STATES,sid,sid/10*16,sid%10*16,16,16)
      cx = 240/MONSTER_BOOK::STATE_IDS.size
      @states.push(Window_digits_number.new(dx+20+cx*i,dy+32*11-8,200,0,1,[s,MONSTER_BOOK::SYSTEM[9]],@fonts))
    end
    for i in 0...MONSTER_BOOK::STATE_IDS2.size
      sid = MONSTER_BOOK::STATE_IDS2[i]
      s = Rect_Draw_Icon.new("■",MONSTER_BOOK::STATES,sid,sid/10*16,sid%10*16,16,16)
      cx = 240/MONSTER_BOOK::STATE_IDS2.size
      @states.push(Window_digits_number.new(dx+20+cx*i,dy+32*11+8,200,0,1,[s,MONSTER_BOOK::SYSTEM[9]],@fonts))
    end
    @fonts.size = 22
    # □パラメータを描画
    @fonts.colors = []
    @parameter = []
    @parameter.push(Window_digits_number.new(dx,dy+32*5,200,nil,6,10,@fonts))
    @parameter.push(Window_digits_number.new(dx+192+22,dy+32*5,200,nil,4,10,@fonts))
    for i in 6..9
      @parameter.push(Window_digits_number.new(dx+33,dy+32*i,200,nil,3,10,@fonts))
      @parameter.push(Window_digits_number.new(dx+192+33,dy+32*i,200,nil,3,10,@fonts))
    end
    # □倒した数を描画
    @defeat = Window_digits_number.new(dx+22,dy+32*4,200,nil,4,10,@fonts)
    # □経験値/お金を描画
    dig = MONSTER_BOOK::EXP_D
    @exp = Window_digits_number.new(dx-11+((7-dig)*11),dy+32*12,200,nil,dig,10,@fonts)
    dig = MONSTER_BOOK::GOLD_D
    @gold = Window_digits_number.new(dx+192-11+((7-dig)*11),dy+32*12,200,nil,dig,10,@fonts)
    # □お宝を描画
    treasures = [""]
    for i in $game_system.monsters.keys
      enemy = $data_enemies[$game_system.monster_numbers[i]]
      if enemy.item_id > 0
        treasures[i] = $data_items[enemy.item_id]
      elsif enemy.weapon_id > 0
        treasures[i] = $data_weapons[enemy.weapon_id]
      elsif enemy.armor_id > 0
        treasures[i] = $data_armors[enemy.armor_id]
      else
        treasures[i] = MONSTER_BOOK::SYSTEM[13]
      end
    end
    @treasure = Window_digits_number.new(dx,dy+32*13,200,0,1,treasures,@fonts,true)
    # □ヘルプキーの描画
    if MONSTER_BOOK::KEY_HELP
      @back_key = make_text_key?(MONSTER_BOOK::KEY_HELP_BACK,11,8,96)
      @next_key = make_text_key?(MONSTER_BOOK::KEY_HELP_NEXT,12,168,96)
      if MONSTER_BOOK::HELP_WINDOW
        @push_key = make_text_key?(MONSTER_BOOK::KEY_HELP_PUSH,7,640-72,480-64+16+1)
      end
    end
    # □図鑑の更新
    par_refresh
    # トランジション実行
    Graphics.transition
    # メインループ
    loop do
      # ゲーム画面を更新
      Graphics.update
      # 入力情報を更新
      Input.update
      # フレーム更新
      update
      # 画面が切り替わったらループを中断
      if $scene != self
        break
      end
    end
    # トランジション準備
    Graphics.freeze
    # □ウィンドウを解放
    @fonts = nil
    @monster_data.dispose
    @monster_graphics.dispose
    @monster_list.dispose
    @element.each{ |a| a.dispose }
    @states.each{ |a| a.dispose }
    @parameter.each{ |a| a.dispose }
    @defeat.dispose
    @exp.dispose
    @gold.dispose
    @treasure.dispose
    # □ヘルプ内容を解放
    if @monster_helps != []
      @monster_helps.each{ |a| a.dispose }
    end
    # □ヘルプキーを解放
    if MONSTER_BOOK::KEY_HELP
      @next_key.dispose
      @back_key.dispose
      if MONSTER_BOOK::HELP_WINDOW
        @push_key.dispose
      end
    end
  end
  #--------------------------------------------------------------------------
  # ■ ヘルプ内容を作成
  #--------------------------------------------------------------------------
  def make_helps?
    if @monster_helps == []
      @fonts.size = 18
      help = [[],[],[],[],[]]
      for i in $game_system.monsters.keys
        # □エネミーを取得
        for n in 0...5
          if MONSTER_BOOK::HELP[$data_enemies[$game_system.monster_numbers[i]].id] != nil
            help[n][i-1] = MONSTER_BOOK::HELP[$data_enemies[$game_system.monster_numbers[i]].id][n]
          else
            help[n][i-1] = ""
          end
        end
      end
      for n in 0...5
        @monster_helps.push(Window_digits_number.new(268,32*(n+8),200,0,1,help[n],@fonts,true))
      end
    end
    # □ヘルプ内容を更新
    if @monster_helps != []
      @monster_helps.each{ |a| a.refresh(nil) }
    end
  end
  #--------------------------------------------------------------------------
  # ■ 図鑑内容を変更
  #--------------------------------------------------------------------------
  def change_book?
    # □図鑑の内容を[表示/非表示]切り替え
    @visible ^= true
    # □ヘルプ内容を作成
    make_helps?
    @monster_list.question_visible?(@visible)
    @element.each{ |a| a.visible = @visible }
    @states.each{ |a| a.visible = @visible }
    @parameter.each{ |a| a.visible = @visible }
    @defeat.visible = @visible
    @exp.visible = @visible
    @gold.visible = @visible
    @treasure.visible = @visible
    @monster_data.visible = @visible
    # □図鑑の更新
    @old_index = nil
    par_refresh
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新
  #--------------------------------------------------------------------------
  def update
    # □ヘルプキーを更新
    if MONSTER_BOOK::KEY_HELP
      @next_key.animation
      @back_key.animation
      if MONSTER_BOOK::HELP_WINDOW
        @push_key.animation
      end
    end
    # □ウィンドウを更新
    @monster_list.update
    # □ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
    if @monster_list.active
      update_data
      return
    end
  end
  #--------------------------------------------------------------------------
  # ■ 図鑑の更新
  #--------------------------------------------------------------------------
  def par_refresh
    # □indexに変化が無い場合、戻る
    if @old_index == @monster_list.index
      return
    end
    @old_index = @monster_list.index
    if @monster_list.monster != nil && $game_system.monsters[@monster_list.index+1] != nil && 
      $game_system.monsters[@monster_list.index+1] != 0
      # □[?]の更新
      @monster_list.question_visible?(false)
      # □パラメータの更新
      @parameter[0].refresh(@monster_list.monster.maxhp)
      @parameter[1].refresh(@monster_list.monster.maxsp)
      @parameter[2].refresh(@monster_list.monster.str)
      @parameter[3].refresh(@monster_list.monster.dex)
      @parameter[4].refresh(@monster_list.monster.agi)
      @parameter[5].refresh(@monster_list.monster.int)
      @parameter[6].refresh(@monster_list.monster.atk)
      @parameter[7].refresh(@monster_list.monster.pdef)
      @parameter[8].refresh(@monster_list.monster.mdef)
      @parameter[9].refresh(@monster_list.monster.eva)
      # □属性防御の更新
      for i in 0...MONSTER_BOOK::ELEMENT_IDS.size
        e = @monster_list.monster.element_ranks[MONSTER_BOOK::ELEMENT_IDS[i]]
        @element[i].refresh(0,e)
      end
      # □ステート防御の更新
      for i in 0...MONSTER_BOOK::STATE_IDS.size
        e = @monster_list.monster.state_ranks[MONSTER_BOOK::STATE_IDS[i]]
        @states[i].refresh(0,e)
      end
      for i in 0...MONSTER_BOOK::STATE_IDS2.size
        e = @monster_list.monster.state_ranks[MONSTER_BOOK::STATE_IDS2[i]]
        max = MONSTER_BOOK::STATE_IDS.size
        @states[max+i].refresh(0,e)
      end
      # □倒した数の更新
      @defeat.refresh($game_system.monsters[@monster_list.index+1])
      # □経験値/お金の更新
      @exp.refresh(@monster_list.monster.exp)
      @gold.refresh(@monster_list.monster.gold)
      # □お宝の更新
      @treasure.refresh(@monster_list.index+1)
      # □モンスター画像の更新
      @monster_graphics.monster_refresh(@monster_list.index)
      # □モンスターヘルプの更新
      if @monster_helps != []
        if @visible
          @monster_helps.each{ |a| a.refresh(nil) }
        else
          @monster_helps.each{ |a| a.refresh(@monster_list.index) }
        end
      end
    else
      # □[?]の更新
      if @visible
        @monster_list.question_visible?(true)
      end
      # □パラメータの更新
      @parameter.each{ |a| a.refresh(nil) }
      # □属性防御の更新
      @element.each{ |a| a.refresh(1,0) }
      # □ステート防御の更新
      @states.each{ |a| a.refresh(1,0) }
      # □倒した数の更新
      @defeat.refresh(nil)
      # □経験値/お金の更新
      @exp.refresh(nil)
      @gold.refresh(nil)
      # □お宝の更新
      @treasure.refresh(nil)
      # □モンスター画像の更新
      @monster_graphics.monster_refresh(@monster_list.index)
      # □モンスターヘルプの更新
      if @monster_helps != []
        @monster_helps.each{ |a| a.refresh(nil) }
      end
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新 (アイテムウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_data
    # □図鑑の更新
    par_refresh
    # B ボタンが押された場合
    if Input.trigger?(Input::B)
      # キャンセル SE を演奏
      $game_system.se_play($data_system.cancel_se)
      # □呼び出した場所で分岐
      if $game_temp.monster_book_calling
        $game_temp.monster_book_calling = false
        # マップ画面に切り替え
        $scene = Scene_Map.new
      else
        # メニュー画面に切り替え
        $scene = Scene_Menu.new(MONSTER_BOOK::MENUE_INDEX)
      end
      return
    end
    # C ボタンが押された場合
    if Input.trigger?(Input::C) && MONSTER_BOOK::HELP_WINDOW
      # 決定 SE を演奏
      $game_system.se_play($data_system.decision_se)
      # □図鑑内容を変更
      change_book?
    end
    return
  end
end