Плохо! Плохо!:  0
Показано с 1 по 1 из 1

Тема: Beastiary

  1. #1

    Сообщение Beastiary

    Этот скрипт открывает в меню функцию которая показывает после убийства монстров и их выпадание вещей,атаку,опыт,деньги,Здо ровье и ману..
    И если нажать кнопку Ентер то он покажет монстра в полном экране...

    sd.pngsad.pngБезымянный.png

    Код:
    #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    #_/ ◆ Enemy Guide - KGC_EnemyGuide ◆ VX ◆
    #_/ ◇  Last Update: 02/15/2009      
    #_/ ◆ Written by TOMY     
    #_/ ◆ Translation by Mr. Anonymous
    #_/ ◆ KGC Site:                                                   
    #_/ ◆  http://ytomy.sakura.ne.jp/        
    #_/ ◆ Translator's Blog:        
    #_/ ◆  http://mraprojects.wordpress.com                      
    #_/-----------------------------------------------------------------------------
    #_/  This script implements a customizable enemy guide, or "beastiary" to your
    #_/   game. Such fields as HP, MP, and other parameters, as well as weakness,
    #_/   resistance, gold given, experience given, and items dropped are included.  
    #_/============================================================================
    #_/ Install: Insert above KGC_ExtraDropItem, and below KGC_CustomMenuCommand.
    #_/============================================================================
    #_/                       ◆ Instructions For Usage ◆
    #_/  To assign a description to an enemy/monster, the following must be added 
    #_/   enemy's "Note" box in the database:
    #_/
    #_/ <enemy_info>
    #_/  Description Text
    #_/ </enemy_info>
    #_/ 
    #_/ Alternatively, you can use <GUIDE_DESCRIPTION> and </GUIDE_DESCRIPTION>
    #_/  
    #_/                         ◆ Event Script Functions ◆
    #_/  The following commands are available using the "Script" item in events.
    #_/
    #_/ * call_enemy_guide
    #_/  Switches the scene to the enemy guide screen.
    #_/
    #_/ * get_enemy_guide_completion(VariableID)
    #_/  Obtains the current amount of completion and stores it in a variable.
    #_/
    #_/ * complete_enemy_guide
    #_/  Sets all enemies as "Defeated", thereby completing the Enemy Guide.
    #_/
    #_/ * reset_enemy_guide
    #_/  Resets the Enemy Guide completely.
    #_/
    #_/ * set_enemy_encountered(EnemyID, Flag)
    #_/  Sets a specified enemy as "Encountered" (or unencountered). If the Flag
    #_/   is omitted, it is automatically assumed to be true.
    #_/   Example: set_enemy_encountered(1) 
    #_/    Sets "Slime" as encountered.
    #_/   Example: set_enemy_encountered(1, false) 
    #_/    Sets "Slime" as unencountered.
    #_/
    #_/ * set_monster_defeated(EnemyID, flag)
    #_/  Sets a specified enemy as "Defeated" (or undefeated). If the Flag is 
    #_/   omitted, it is automatically assumed to be true.
    #_/   Example: set_enemy_defeated(1) 
    #_/    Sets "Slime" as defeated.
    #_/   Example: set_enemy_defeated(1, false) 
    #_/    Sets "Slime" as undefeated.
    #_/
    #_/ * set_enemy_item_dropped(EnemyID, Item_Index, Flag)
    #_/  Sets a specified enemy's drop item as "Dropped" (or not dropped). If Flag
    #_/   is omitted, it is automatically assumed to be true.
    #_/   Example: set_enemy_item_dropped(1, 0)
    #_/    Sets "Slime"'s first dropped item as dropped.
    #_/   Example: set_enemy_item_dropped(1, 1, false)
    #_/    Sets "Slime"'s second dropped item as not dropped.
    #_/
    #_/ * set_enemy_object_stolen(EnemyID, Object_Index, Flag)
    #_/  Sets a specified enemy's stealable item(s) as "stolen" (or not) when used
    #_/   in conjunction with KGC_Steal. If flag is omitted, it is automatically
    #_/   assumed to be true.
    #_/   Example: set_enemy_object_stolen(1, 0)
    #_/    Sets "Slime"'s first stealable item as stolen.
    #_/
    #_/  [ Quick Key:                                                             ]
    #_/  [ VariableID = The in-game variable number used to store data.           ]
    #_/  [                                                                        ]
    #_/  [ EnemyID = The ID number of the desired enemy (found in the database).  ]
    #_/  [                                                                        ]
    #_/  [ Flag = A true or false value.                                          ]
    #_/  [                                                                        ]
    #_/  [ Item_Index = The current index of the enemy's dropped item.            ]
    #_/  [  A value of 0 returns the first item, while 1 returns the second.      ]
    #_/  [                                                                        ]
    #_/  [ Object_Index = The current index of the enemy's stealable items.       ]
    #_/  [  A value of 0 returns the first item, while 1 returns the second, etc. ]
    #_/
    #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    
    #==============================================================================
    # ★ BEGIN Customization ★                                
    #==============================================================================
    
    module KGC
      module EnemyGuide
      #                        ◆ Use Background Image ◆
      # This toggle allows you to use a custom background image for the enemy guide
      #  window's background rather than the window skin.
      #   true  : Use background image defined below ( BACKGROUND_FILENAME )
      #   false : Use Window Skin
      USE_BACKGROUND_IMAGE = true
      # ◆ Background Image File Name
      #  Here, you may designate an image in the "Graphics/System/" folder to be 
      # used as described above. The file extension is automatically recognized.
      BACKGROUND_FILENAME  = "EnemyGuideBack"
      # ◆ Completed Display Interval [In Frames]
      # This allows you to specify the amount of time in frames from which the
      #  Encountered, Defeated, & Completion percentile field are displayed before
      #  switching to the next. To get a better understanding of this, test the game 
      #  and open the enemy guide. The field at hand is in the upper left corner.
      INFO_INTERVAL = 90
    
      #                ◆ Enemy Selection Serial Number Display ◆
      # This toggle allows you to show enemies' serial number before the name. This
      #  is pulled strictly by the enemy's ID number in the database.
      #  For example, when true, Slime's command entry would be: [001] Slime
      #   true = enable display of enemy serial number 
      #   false = ID/Serial number is hidden.
      SHOW_SERIAL_NUMBER = true
      # ◆ Enemy Selection Order By Serial Number
      # This toggle causes the script to arrange the enemies by ID/serial number.
      #  true = Enemies are sorted by serial numbers (Enemy ID)
      #  false = Supposed to sort another way? This doesn't seem to make any impact.
      #  ====================MORE RESEARCH NEEDED=======================
      SERIAL_NUM_FOLLOW  = true
      # ◆ Serial Number Format
      # This is the format in which the serial numbers are displayed in conjunction
      #  with the enemy name. %03d = Serial Number.  
      SERIAL_NUM_FORMAT  = "%03d: "
      # ◆ Unencountered Enemy Name Mask
      #  This allows you to set text for enemy entries that have not yet been
      #   encountered. By setting one character, such as "?", the entire enemy's
      #   name will be masked by that character, such as "Slime" becoming "?????".
      UNKNOWN_ENEMY_NAME = "?"
      # ◆ Uncountered enemy text.
      UNENCOUNTERED_DATA = "- No Data -"
      # ◆ Parameter Names text.
      PARAMETER_NAME = {
        :defeat_count   => "Defeated",
        :weak_element   => "Weakness",
        :resist_element => "Resistance",
        :weak_state     => "Susceptible",
        :resist_state   => "Resistant",
        :exp            => "Experience",
        :treasure       => "Drops",
        :drop_prob      => "Chance",
        :steal_obj      => "Steal",
        :steal_prob     => "Chance",
      }  # ← No not delete!
      # ◆ Undefeated Enemy Parameter Text Mask
      UNDEFEATED_PARAMETER = "???"
      # ◆ Undropped Item Text Mask
      # By setting one character, such as "?", the entire item's name will be masked
      #  by that character, such as "Potion" becoming "?????".
      UNDROPPED_ITEM_NAME  = "?"
    
      #  ◆ Element Weakness and Resistance Range
      #  Here you may specify what elements are shown under the Enemy Guide's 
      #   Weakness and Resistance field. By default, 1..16 includes everything from
      #   element ID 1 to 16.
      ELEMENT_RANGE = [1..16]
      # ◆ Element Icon Display
      #  In this array, you may define the icons used for the elements displayed for
      #   weakness/resistance/state fields. These are ordered by the ranged defined
      #   in ELEMENT_RANGE, above. To find the icon's index, simply look at your 
      #   IconSet and count each from left to right, top to bottom, starting with 0.
      ELEMENT_ICON = [nil,                       # ID:0 Dummy(Don't alter this line)
         50,   1,   4,  14,  24,  12, 189, 136,  # Melee ~ Absorbing
        104, 105, 106, 107, 108, 109, 110, 111,  # Fire ~ Darkness
      ]  # ← Do not remove!
      # ◆ State Tolerance Range
      #  Here you may specify what state are shown under the Enemy Guide's 
      #   State field. By default, 1..16 includes everything from
      #   state ID 1 to 16. This is similar to ELEMENT_RANGE as seen above. 
      STATE_RANGE = [1..16]
    
      #                           ◆ Item Display ◆
      # ◆ Drop Item Display
      #   true  : Show drop items
      #   false : No not show drop items
      SHOW_DROP_ITEM = true
      # ◆ Stealable Item Display
      #  For use with KGC_Steal
      #   true  : Show stealable items
      #   false : No not show stealable items
      SHOW_STEAL_OBJ = true
      
      #                           ◆ Hidden Enemies ◆
      #  You may specify enemies that you do not wish to appear in the monster guide
      #   here within the brackets by EnemyID.
      #  Example: MG_HIDE_ENEMIES = [2, 4, 8, 16, 32]
      HIDDEN_ENEMIES = []
    
      #                        ◆ Enemy Selection Order ◆
      #  Here, you may manually specify the order in which enemies appear in the
      #   selection list. This is handled by the enemy's ID number in the database.
      #   You must separate each number or number range with commas.
      #  A number range is a range of numbers separated by .. - for example, 1..3
      #   is the same as saying 1, 2, 3
      #  Enemies hidden by HIDDEN_ENEMIES will not appear.
      #  Set this function to nil if you do not wish to use it.
      #  Example: ENEMY_ORDER = [1..5, 8..13, 6, 7, 14, 15]
      ENEMY_ORDER = nil
    
      #                      ◆ Transformed Enemy Handling ◆ 
      #  true = If an enemy transforms into another enemy, the original enemy is
      #         flagged as defeated as well as the transformed enemy.
      ORIGINAL_DEFEAT = true
    
      #                            ◆ Command Menu ◆
      # This toggle adds a command to the menu command selection to the main command 
      #  menu. To set this command anywhere other than the bottom, please use
      #  KGC_CustomMenuCommand.
      USE_MENU_ENEMY_GUIDE_COMMAND = true
      # ◆  Text of displayed for Enemy Guide selection on the main command window.
      VOCAB_MENU_ENEMY_GUIDE       = "Beastiary"
      end
    end
    
    #==============================================================================
    # ★ END Customization ★                                
    #==============================================================================
    
    #=================================================#
    #                    IMPORT                       #
    #=================================================#
    
    $imported = {} if $imported == nil
    $imported["EnemyGuide"] = true
    
    #=================================================#
    
    #==============================================================================
    # □ KGC
    #==============================================================================
    module KGC
      module_function
      #--------------------------------------------------------------------------
      # ○ Character String Mask
      #     str  : String Object
      #     mask : Character Mask
      #--------------------------------------------------------------------------
      def mask_string(str, mask)
        text = mask
        if mask.scan(/./).size == 1
          text = mask * str.scan(/./).size
        end
        return text
      end
    end
    
    #==============================================================================
    # □ KGC::EnemyGuide::Regexp
    #==============================================================================
    # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
    #                          Note Field Tag Strings                             #
    # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
    #  Whatever word(s) are after the separator ( | ) in the following lines are 
    #   what are used to determine what is searched for in the "Note" section of  
    #   an enemy.
    
    module KGC::EnemyGuide
      # Regular Expressions Module
      module Regexp
        # Enemy Module
        module Enemy
          # Begin Description tag string
          BEGIN_GUIDE_DESCRIPTION = /<(?:GUIDE_DESCRIPTION|enemy_info)>/i
          # End Description tag string
          END_GUIDE_DESCRIPTION = /<\/(?:GUIDE_DESCRIPTION|enemy_info)>/i
        end
      end
    
      module_function
      #--------------------------------------------------------------------------
      # ○ Range & Integer 
      # Obtain array and convert into integer. (Repeditive elements are excluded.)
      #--------------------------------------------------------------------------
      def convert_integer_array(array)
        result = []
        array.each { |i|
          case i
          when Range
            result |= i.to_a
          when Integer
            result |= [i]
          end
        }
        return result
      end
      #--------------------------------------------------------------------------
      # ○ Is the enemy to be shown?
      #--------------------------------------------------------------------------
      def enemy_show?(enemy_id)
        return false if HIDDEN_ENEMY_LIST.include?(enemy_id)
        if ENEMY_ORDER_ID != nil
          return false unless ENEMY_ORDER_ID.include?(enemy_id)
        end
    
        return true
      end
      
      #--------------------------------------------------------------------------
      # ○ Array Sorting
      #--------------------------------------------------------------------------
      # Hidden Enemy List
      HIDDEN_ENEMY_LIST = convert_integer_array(HIDDEN_ENEMIES)
      # Enemy IDs in the display order
      ENEMY_ORDER_ID = (ENEMY_ORDER == nil ? nil :
        convert_integer_array(ENEMY_ORDER))
      # Check element list
      CHECK_ELEMENT_LIST = convert_integer_array(ELEMENT_RANGE)
      # Check state list
      CHECK_STATE_LIST   = convert_integer_array(STATE_RANGE)  
      
    end
    
    #=================================================#
    
    #==============================================================================
    # □ KGC::Commands
    #==============================================================================
    
    module KGC
    module Commands
      module_function
      #--------------------------------------------------------------------------
      # ○ 遭遇状態取得
      #     enemy_id : 敵 ID
      #--------------------------------------------------------------------------
      def enemy_encountered?(enemy_id)
        return $game_system.enemy_encountered[enemy_id]
      end
      #--------------------------------------------------------------------------
      # ○ 撃破状態取得
      #     enemy_id : 敵 ID
      #--------------------------------------------------------------------------
      def enemy_defeated?(enemy_id)
        return $game_system.enemy_defeated[enemy_id]
      end
      #--------------------------------------------------------------------------
      # ○ アイテムドロップ状態取得
      #     enemy_id   : 敵 ID
      #     item_index : ドロップアイテム番号
      #--------------------------------------------------------------------------
      def enemy_item_dropped?(enemy_id, item_index)
        if $game_system.enemy_item_dropped[enemy_id] == nil
          return false
        end
        result = $game_system.enemy_item_dropped[enemy_id] & (1 << item_index)
        return (result != 0)
      end
      #--------------------------------------------------------------------------
      # ○ 盗み成功済み状態取得
      #     enemy_id  : 敵 ID
      #     obj_index : オブジェクト番号
      #--------------------------------------------------------------------------
      def enemy_object_stolen?(enemy_id, obj_index)
        if $game_system.enemy_object_stolen[enemy_id] == nil
          return false
        end
        result = $game_system.enemy_object_stolen[enemy_id] & (1 << obj_index)
        return (result != 0)
      end
      #--------------------------------------------------------------------------
      # ○ 遭遇状態設定
      #     enemy_id : 敵 ID
      #     enabled  : true..遭遇済み  false..未遭遇
      #--------------------------------------------------------------------------
      def set_enemy_encountered(enemy_id, enabled = true)
        $game_system.enemy_encountered[enemy_id] = enabled
        unless enabled
          # 未遭遇なら撃破済みフラグも解除
          set_enemy_defeated(enemy_id, false)
        end
      end
      #--------------------------------------------------------------------------
      # ○ 撃破状態設定
      #     enemy_id : 敵 ID
      #     enabled  : true..撃破済み  false..未撃破
      #--------------------------------------------------------------------------
      def set_enemy_defeated(enemy_id, enabled = true)
        $game_system.enemy_defeated[enemy_id] = enabled
        if enabled
          # 撃破済みなら遭遇フラグもセット
          set_enemy_encountered(enemy_id)
        end
      end
      #--------------------------------------------------------------------------
      # ○ アイテムドロップ状態設定
      #     enemy_id   : 敵 ID
      #     item_index : ドロップアイテム番号
      #     enabled    : true..ドロップ済み  false..未ドロップ
      #--------------------------------------------------------------------------
      def set_enemy_item_dropped(enemy_id, item_index, enabled = true)
        if $game_system.enemy_item_dropped[enemy_id] == nil
          $game_system.enemy_item_dropped[enemy_id] = 0
        end
        if enabled
          $game_system.enemy_item_dropped[enemy_id] |= (1 << item_index)
        else
          $game_system.enemy_item_dropped[enemy_id] &= ~(1 << item_index)
        end
      end
      #--------------------------------------------------------------------------
      # ○ 盗み成功状態設定
      #     enemy_id  : 敵 ID
      #     obj_index : オブジェクト番号
      #     enabled   : true..成功済み  false..未成功
      #--------------------------------------------------------------------------
      def set_enemy_object_stolen(enemy_id, obj_index, enabled = true)
        if $game_system.enemy_object_stolen[enemy_id] == nil
          $game_system.enemy_object_stolen[enemy_id] = 0
        end
        if enabled
          $game_system.enemy_object_stolen[enemy_id] |= (1 << obj_index)
        else
          $game_system.enemy_object_stolen[enemy_id] &= ~(1 << obj_index)
        end
      end
      #--------------------------------------------------------------------------
      # ○ 図鑑リセット
      #--------------------------------------------------------------------------
      def reset_enemy_guide
        $game_system.enemy_encountered = []
        $game_system.enemy_defeated = []
        $game_system.enemy_item_dropped = []
        $game_system.enemy_object_stolen = []
      end
      #--------------------------------------------------------------------------
      # ○ 図鑑完成
      #--------------------------------------------------------------------------
      def complete_enemy_guide
        (1...$data_enemies.size).each { |i|
          set_enemy_encountered(i)
          set_enemy_defeated(i)
    
          enemy = $data_enemies[i]
    
          items = [enemy.drop_item1, enemy.drop_item2]
          if $imported["ExtraDropItem"]
            items += enemy.extra_drop_items
          end
          items.each_index { |j| set_enemy_item_dropped(i, j) }
    
          if $imported["Steal"]
            objs = enemy.steal_objects
            objs.each_index { |j| set_enemy_object_stolen(i, j) }
          end
        }
      end
      #--------------------------------------------------------------------------
      # ○ 図鑑に含めるか
      #     enemy_id : 敵 ID
      #--------------------------------------------------------------------------
      def enemy_guide_include?(enemy_id)
        return false unless KGC::EnemyGuide.enemy_show?(enemy_id)
        enemy = $data_enemies[enemy_id]
        return (enemy != nil && enemy.name != "")
      end
      #--------------------------------------------------------------------------
      # ○ 存在する敵の種類数取得
      #     variable_id : 取得した値を代入する変数の ID
      #--------------------------------------------------------------------------
      def get_all_enemies_number(variable_id = 0)
        n = 0
        (1...$data_enemies.size).each { |i|
          n += 1 if enemy_guide_include?(i)
        }
        if variable_id > 0
          $game_variables[variable_id] = n
          $game_map.need_refresh = true
        end
        return n
      end
      #--------------------------------------------------------------------------
      # ○ 遭遇した敵の種類数取得
      #     variable_id : 取得した値を代入する変数の ID
      #--------------------------------------------------------------------------
      def get_encountered_enemies_number(variable_id = 0)
        n = 0
        (1...$data_enemies.size).each { |i|
          if enemy_guide_include?(i) && $game_system.enemy_encountered[i]
            n += 1
          end
        }
        if variable_id > 0
          $game_variables[variable_id] = n
          $game_map.need_refresh = true
        end
        return n
      end
      #--------------------------------------------------------------------------
      # ○ 撃破した敵の種類数取得
      #     variable_id : 取得した値を代入する変数の ID
      #--------------------------------------------------------------------------
      def get_defeated_enemies_number(variable_id = 0)
        n = 0
        (1...$data_enemies.size).each { |i|
          if enemy_guide_include?(i) && $game_system.enemy_encountered[i] &&
              $game_system.enemy_defeated[i]
            n += 1
          end
        }
        if variable_id > 0
          $game_variables[variable_id] = n
          $game_map.need_refresh = true
        end
        return n
      end
      #--------------------------------------------------------------------------
      # ○ モンスター図鑑完成度の取得
      #     variable_id : 取得した値を代入する変数の ID
      #--------------------------------------------------------------------------
      def get_enemy_guide_completion(variable_id = 0)
        num = get_all_enemies_number
        value = (num > 0 ? (get_defeated_enemies_number * 100 / num) : 0)
        if variable_id > 0
          $game_variables[variable_id] = value
          $game_map.need_refresh = true
        end
        return value
      end
      #--------------------------------------------------------------------------
      # ○ モンスター図鑑呼び出し
      #--------------------------------------------------------------------------
      def call_enemy_guide
        return if $game_temp.in_battle
        $game_temp.next_scene = :enemy_guide
      end
    end
    end
    
    class Game_Interpreter
      include KGC::Commands
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Vocab
    #==============================================================================
    
    module Vocab
      # モンスター図鑑
      def self.enemy_guide
        return KGC::EnemyGuide::VOCAB_MENU_ENEMY_GUIDE
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ RPG::Enemy
    #==============================================================================
    
    class RPG::Enemy
      #--------------------------------------------------------------------------
      # ○ モンスター図鑑のキャッシュ生成
      #--------------------------------------------------------------------------
      def create_enemy_guide_cache
        @__enemy_guide_description = ""
    
        description_flag = false
        self.note.each_line { |line|
          case line
          when KGC::EnemyGuide::Regexp::Enemy::BEGIN_GUIDE_DESCRIPTION
            # 説明文開始
            description_flag = true
          when KGC::EnemyGuide::Regexp::Enemy::END_GUIDE_DESCRIPTION
            # 説明文終了
            description_flag = false
          else
            if description_flag
              @__enemy_guide_description += line
            end
          end
        }
      end
      #--------------------------------------------------------------------------
      # ○ 図鑑説明文
      #--------------------------------------------------------------------------
      def enemy_guide_description
        create_enemy_guide_cache if @__enemy_guide_description == nil
        return @__enemy_guide_description
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Game_System
    #==============================================================================
    
    class Game_System
      #--------------------------------------------------------------------------
      # ● 公開インスタンス変数
      #--------------------------------------------------------------------------
      attr_writer   :enemy_encountered        # 遭遇済みフラグ
      attr_writer   :enemy_defeated           # 撃破済みフラグ
      attr_writer   :enemy_item_dropped       # アイテムドロップ済みフラグ
      attr_writer   :enemy_object_stolen      # 盗み成功済みフラグ
      #--------------------------------------------------------------------------
      # ○ 遭遇済みフラグ取得
      #--------------------------------------------------------------------------
      def enemy_encountered
        @enemy_encountered = [] if @enemy_encountered == nil
        return @enemy_encountered
      end
      #--------------------------------------------------------------------------
      # ○ 撃破済みフラグ取得
      #--------------------------------------------------------------------------
      def enemy_defeated
        @enemy_defeated = [] if @enemy_defeated == nil
        return @enemy_defeated
      end
      #--------------------------------------------------------------------------
      # ○ アイテムドロップ済みフラグ取得
      #--------------------------------------------------------------------------
      def enemy_item_dropped
        @enemy_item_dropped = [] if @enemy_item_dropped == nil
        return @enemy_item_dropped
      end
      #--------------------------------------------------------------------------
      # ○ 盗み成功済みフラグ取得
      #--------------------------------------------------------------------------
      def enemy_object_stolen
        @enemy_object_stolen = [] if @enemy_object_stolen == nil
        return @enemy_object_stolen
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Game_Enemy
    #==============================================================================
    
    class Game_Enemy < Game_Battler
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     index    : 敵グループ内インデックス
      #     enemy_id : 敵キャラ ID
      #--------------------------------------------------------------------------
      alias initialize_KGC_EnemyGuide initialize
      def initialize(index, enemy_id)
        initialize_KGC_EnemyGuide(index, enemy_id)
    
        @original_ids = []  # 変身前の ID
        # 遭遇済みフラグをオン
        KGC::Commands.set_enemy_encountered(enemy_id) unless hidden
      end
      #--------------------------------------------------------------------------
      # ● コラプスの実行
      #--------------------------------------------------------------------------
      alias perform_collapse_KGC_EnemyGuide perform_collapse
      def perform_collapse
        last_collapsed = @collapse
    
        perform_collapse_KGC_EnemyGuide
    
        if !last_collapsed && @collapse
          # 撃破済みフラグをオン
          KGC::Commands.set_enemy_defeated(enemy_id)
          # 変身前の敵も撃破済みにする
          if KGC::EnemyGuide::ORIGINAL_DEFEAT
            @original_ids.compact.each { |i|
              KGC::Commands.set_enemy_defeated(i)
            }
          end
        end
      end
      #--------------------------------------------------------------------------
      # ● 変身
      #     enemy_id : 変身先の敵キャラ ID
      #--------------------------------------------------------------------------
      alias transform_KGC_EnemyGuide transform
      def transform(enemy_id)
        # 変身前のIDを保存
        @original_ids << @enemy_id
    
        transform_KGC_EnemyGuide(enemy_id)
    
        # 変身後の敵も遭遇済みにする
        KGC::Commands.set_enemy_encountered(enemy_id)
      end
      #--------------------------------------------------------------------------
      # ● 隠れ状態設定
      #--------------------------------------------------------------------------
      alias hidden_equal_KGC_EnemyGuide hidden= unless $@
      def hidden=(value)
        hidden_equal_KGC_EnemyGuide(value)
        # 出現した場合は遭遇済みフラグをオン
        KGC::Commands.set_enemy_encountered(enemy_id) unless value
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Game_Troop
    #==============================================================================
    
    class Game_Troop < Game_Unit
      #--------------------------------------------------------------------------
      # ● ドロップアイテムの配列作成
      #--------------------------------------------------------------------------
      def make_drop_items
        drop_items = []
        dead_members.each { |enemy|
          [enemy.drop_item1, enemy.drop_item2].each_with_index { |di, i|
            next if di.kind == 0
            next if rand(di.denominator) != 0
            if di.kind == 1
              drop_items.push($data_items[di.item_id])
            elsif di.kind == 2
              drop_items.push($data_weapons[di.weapon_id])
            elsif di.kind == 3
              drop_items.push($data_armors[di.armor_id])
            end
            # ドロップ済みフラグをセット
            KGC::Commands.set_enemy_item_dropped(enemy.enemy.id, i)
          }
        }
        return drop_items
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Window_Command
    #==============================================================================
    
    class Window_Command < Window_Selectable
      unless method_defined?(:add_command)
      #--------------------------------------------------------------------------
      # ○ コマンドを追加
      #    追加した位置を返す
      #--------------------------------------------------------------------------
      def add_command(command)
        @commands << command
        @item_max = @commands.size
        item_index = @item_max - 1
        refresh_command
        draw_item(item_index)
        return item_index
      end
      #--------------------------------------------------------------------------
      # ○ コマンドをリフレッシュ
      #--------------------------------------------------------------------------
      def refresh_command
        buf = self.contents.clone
        self.height = [self.height, row_max * WLH + 32].max
        create_contents
        self.contents.blt(0, 0, buf, buf.rect)
        buf.dispose
      end
      #--------------------------------------------------------------------------
      # ○ コマンドを挿入
      #--------------------------------------------------------------------------
      def insert_command(index, command)
        @commands.insert(index, command)
        @item_max = @commands.size
        refresh_command
        refresh
      end
      #--------------------------------------------------------------------------
      # ○ コマンドを削除
      #--------------------------------------------------------------------------
      def remove_command(command)
        @commands.delete(command)
        @item_max = @commands.size
        refresh
      end
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # □ Window_EnemyGuideTop
    #------------------------------------------------------------------------------
    #   モンスター図鑑画面で、完成度を表示するウィンドウです。
    #==============================================================================
    
    class Window_EnemyGuideTop < Window_Base
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, 240, WLH * 4 + 32)
        self.height = WLH + 32
        @duration = 0
        @interval = KGC::EnemyGuide::INFO_INTERVAL
        refresh
    
        if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
          self.opacity = 0
        end
        if self.windowskin != nil
          bitmap = Bitmap.new(windowskin.width, windowskin.height)
          bitmap.blt(0, 0, windowskin, windowskin.rect)
          bitmap.clear_rect(80, 16, 32, 32)
          self.windowskin = bitmap
        end
      end
      #--------------------------------------------------------------------------
      # ● 破棄
      #--------------------------------------------------------------------------
      def dispose
        self.windowskin.dispose
        super
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        total = KGC::Commands.get_all_enemies_number
        encountered = KGC::Commands.get_encountered_enemies_number
        defeated = KGC::Commands.get_defeated_enemies_number
    
        text = sprintf("遭遇済み: %3d/%3d ",encountered, total)
        self.contents.draw_text(0,       0, width - 32, WLH, text, 1)
        self.contents.draw_text(0, WLH * 3, width - 32, WLH, text, 1)
        text = sprintf("撃破済み: %3d/%3d", defeated, total)
        self.contents.draw_text(0, WLH, width - 32, WLH, text, 1)
        text = sprintf("完成度: %3d%%", defeated * 100 / total)
        self.contents.draw_text(0, WLH * 2, width - 32, WLH, text, 1)
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        @duration += 1
        case @duration
        when @interval...(@interval + WLH)
          self.oy += 1
        when (@interval + WLH)
          @duration = 0
          if self.oy >= WLH * 3
            self.oy = 0
          end
        end
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # □ Window_EnemyGuideList
    #------------------------------------------------------------------------------
    #   モンスター図鑑画面で、モンスター一覧を表示するウィンドウです。
    #==============================================================================
    
    class Window_EnemyGuideList < Window_Selectable
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #--------------------------------------------------------------------------
      def initialize
        super(0, WLH + 32, 240, Graphics.height - (WLH + 32))
        self.index = 0
        refresh
        if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
          self.opacity = 0
          self.height -= (self.height - 32) % WLH
        end
      end
      #--------------------------------------------------------------------------
      # ○ 選択モンスターの取得
      #--------------------------------------------------------------------------
      def item
        return @data[self.index]
      end
      #--------------------------------------------------------------------------
      # ○ エネミーをリストに含めるか
      #     enemy_id : 敵 ID
      #--------------------------------------------------------------------------
      def include?(enemy_id)
        return KGC::Commands.enemy_guide_include?(enemy_id)
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        @data = []
        if KGC::EnemyGuide::ENEMY_ORDER_ID == nil
          # ID順
          enemy_list = 1...$data_enemies.size
        else
          # 指定順
          enemy_list = KGC::EnemyGuide::ENEMY_ORDER_ID
        end
        enemy_list.each { |i|
          @data << $data_enemies[i] if include?(i)
        }
        @item_max = @data.size
        create_contents
        for i in 0...@item_max
          draw_item(i)
        end
      end
      #--------------------------------------------------------------------------
      # ● 項目の描画
      #     index : 項目番号
      #--------------------------------------------------------------------------
      def draw_item(index)
        enemy = @data[index]
        self.contents.font.color = normal_color
        unless KGC::Commands.enemy_defeated?(enemy.id)
          self.contents.font.color.alpha = 128
        end
        rect = item_rect(index)
        self.contents.clear_rect(rect)
    
        if KGC::EnemyGuide::SHOW_SERIAL_NUMBER
          s_num = sprintf(KGC::EnemyGuide::SERIAL_NUM_FORMAT,
            KGC::EnemyGuide::SERIAL_NUM_FOLLOW ? (index + 1) : enemy.id)
        end
    
        text = (KGC::EnemyGuide::SHOW_SERIAL_NUMBER ? s_num : "")
        if KGC::Commands.enemy_encountered?(enemy.id)
          # 遭遇済み
          text += enemy.name
        else
          # 未遭遇
          mask = KGC::EnemyGuide::UNKNOWN_ENEMY_NAME
          if mask.scan(/./).size == 1
            mask = mask * enemy.name.scan(/./).size
          end
          text += mask
        end
        self.contents.draw_text(rect, text)
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # □ Window_EnemyGuideStatus
    #------------------------------------------------------------------------------
    #   モンスター図鑑画面で、ステータスを表示するウィンドウです。
    #==============================================================================
    
    class Window_EnemyGuideStatus < Window_Base
      #--------------------------------------------------------------------------
      # ● 公開インスタンス変数
      #--------------------------------------------------------------------------
      attr_reader   :enemy                    # 表示エネミー
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #--------------------------------------------------------------------------
      def initialize
        super(240, 0, Graphics.width - 240, Graphics.height)
        self.enemy = nil
        self.z = 100
        if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
          self.opacity = 0
        end
        @show_sprite = false
        @enemy_sprite = Sprite.new
        @enemy_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
        @enemy_sprite.x = 0
        @enemy_sprite.y = 0
        @enemy_sprite.z = self.z + 100
        @enemy_sprite.visible = false
      end
      #--------------------------------------------------------------------------
      # ● 破棄
      #--------------------------------------------------------------------------
      def dispose
        super
        @enemy_sprite.bitmap.dispose
        @enemy_sprite.dispose
      end
      #--------------------------------------------------------------------------
      # ○ アイテム用ページを表示するか
      #--------------------------------------------------------------------------
      def item_page_show?
        return true if KGC::EnemyGuide::SHOW_DROP_ITEM
        return true if $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ
    
        return false
      end
      #--------------------------------------------------------------------------
      # ○ ページ数取得
      #--------------------------------------------------------------------------
      def pages
        return (item_page_show? ? 3 : 2)
      end
      #--------------------------------------------------------------------------
      # ○ 表示エネミー設定
      #--------------------------------------------------------------------------
      def enemy=(enemy)
        @enemy = enemy
        refresh
      end
      #--------------------------------------------------------------------------
      # ○ 表示情報切り替え
      #     shamt : 移動ページ数
      #--------------------------------------------------------------------------
      def shift_info_type(shamt)
        n = self.ox + (width - 32) * shamt
        self.ox = [[n, 0].max, (width - 32) * (pages - 1)].min
      end
      #--------------------------------------------------------------------------
      # ○ スプライト表示切替
      #--------------------------------------------------------------------------
      def switch_sprite
        @show_sprite = !@show_sprite
        @enemy_sprite.visible = @show_sprite
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        original_width = self.width
        self.width = original_width * pages - (32 * (pages - 1))
        create_contents
        self.width = original_width
    
        draw_enemy_sprite
    
        return if enemy == nil
    
        self.contents.font.color = normal_color
        # 遭遇していない
        unless KGC::Commands.enemy_encountered?(enemy.id)
          self.contents.font.color.alpha = 128
          dy = (height - 32) / 2
          dy -= dy % WLH
          self.contents.draw_text(0, dy, width - 32, WLH,
            KGC::EnemyGuide::UNENCOUNTERED_DATA, 1)
          self.contents.blt(width - 32, 0, self.contents, self.contents.rect)
          return
        end
    
        draw_status
      end
      #--------------------------------------------------------------------------
      # ○ ステータス描画
      #--------------------------------------------------------------------------
      def draw_status
        # Page 1
        dy = draw_basic_info(0, 0)
        dy = draw_parameter2(0, dy)
        dy = draw_element(0, dy, 2)
        dy = draw_state(0, dy, 2)
        draw_prize(0, dy)
    
        # Page 2 (アイテム関連を表示する場合のみ)
        if item_page_show?
          dx = width - 32
          dy = draw_basic_info(dx, 0)
          max_rows = (self.height - dy - 32) / WLH
          rows = (max_rows + 1) / (pages - 1)
          dy = draw_drop_item(dx, dy, rows)
          draw_steal_object(dx, dy, max_rows - rows)
        end
    
        # Page 3
        dx = (width - 32) * (pages - 1)
        dy = draw_basic_info(dx, 0)
        draw_description(dx, dy)
      end
      #--------------------------------------------------------------------------
      # ○ 基本情報画
      #     dx, dy : 描画先 X, Y
      #--------------------------------------------------------------------------
      def draw_basic_info(dx, dy)
        draw_graphic(dx, dy)
        draw_parameter1(dx + 112, dy)
        return dy + 96
      end
      #--------------------------------------------------------------------------
      # ○ グラフィック描画
      #     dx, dy : 描画先 X, Y
      #--------------------------------------------------------------------------
      def draw_graphic(dx, dy)
        buf = Bitmap.new(108, 96)
        bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
        rect = Rect.new(0, 0, bitmap.width / 3, bitmap.height / 3)
        rect.x = (108 - rect.width) / 2
        rect.y = (96 - rect.height) / 2
        buf.stretch_blt(rect, bitmap, bitmap.rect)
        self.contents.blt(dx, dy, buf, buf.rect)
        buf.dispose
      end
      #--------------------------------------------------------------------------
      # ○ エネミースプライト描画
      #--------------------------------------------------------------------------
      def draw_enemy_sprite
        return if @enemy_sprite == nil
    
        @enemy_sprite.bitmap.fill_rect(@enemy_sprite.bitmap.rect,
          Color.new(0, 0, 0, 160))
    
        return if enemy == nil || !KGC::Commands.enemy_encountered?(enemy.id)
    
        bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
        dx = (Graphics.width - bitmap.width) / 2
        dy = (Graphics.height - bitmap.height) / 2
        @enemy_sprite.bitmap.blt(dx, dy, bitmap, bitmap.rect)
      end
      #--------------------------------------------------------------------------
      # ○ パラメータ描画 - 1
      #     dx, dy : 描画先 X, Y
      #--------------------------------------------------------------------------
      def draw_parameter1(dx, dy)
        # 名前, HP, MP
        param = {}
        if KGC::Commands.enemy_defeated?(enemy.id)
          param[:maxhp] = enemy.maxhp
          param[:maxmp] = enemy.maxmp
          if $imported["BattleCount"]
            param[:defeat_count] = KGC::Commands.get_defeat_count(enemy.id)
          end
        else
          param[:maxhp] = param[:maxmp] = KGC::EnemyGuide::UNDEFEATED_PARAMETER
          param[:defeat_count] = 0
        end
    
        self.contents.font.color = normal_color
        self.contents.draw_text(dx, dy, width - 144, WLH, enemy.name)
        self.contents.font.color = system_color
        self.contents.draw_text(dx, dy + WLH,     80, WLH, Vocab.hp)
        self.contents.draw_text(dx, dy + WLH * 2, 80, WLH, Vocab.mp)
        if $imported["BattleCount"]
          self.contents.draw_text(dx, dy + WLH * 3, 80, WLH,
            KGC::EnemyGuide::PARAMETER_NAME[:defeat_count])
        end
        self.contents.font.color = normal_color
        self.contents.draw_text(dx + 88, dy + WLH,     64, WLH, param[:maxhp], 2)
        self.contents.draw_text(dx + 88, dy + WLH * 2, 64, WLH, param[:maxmp], 2)
        if $imported["BattleCount"]
          self.contents.draw_text(dx + 88, dy + WLH * 3, 64, WLH,
            param[:defeat_count], 2)
        end
      end
      #--------------------------------------------------------------------------
      # ○ パラメータ描画 - 2
      #     dx, dy : 描画先 X, Y
      #--------------------------------------------------------------------------
      def draw_parameter2(dx, dy)
        # ATK ~ AGI
        param = {}
        if KGC::Commands.enemy_defeated?(enemy.id)
          param[:atk]   = enemy.atk
          param[:def]   = enemy.def
          param[:spi]   = enemy.spi
          param[:agi]   = enemy.agi
        else
          param[:atk] = param[:def] = param[:spi] = param[:agi] =
            KGC::EnemyGuide::UNDEFEATED_PARAMETER
        end
    
        dw = (width - 32) / 2
        self.contents.font.color = system_color
        self.contents.draw_text(dx,      dy,       80, WLH, Vocab.atk)
        self.contents.draw_text(dx + dw, dy,       80, WLH, Vocab.def)
        self.contents.draw_text(dx,      dy + WLH, 80, WLH, Vocab.spi)
        self.contents.draw_text(dx + dw, dy + WLH, 80, WLH, Vocab.agi)
        dx += 80
        self.contents.font.color = normal_color
        self.contents.draw_text(dx,      dy,       48, WLH, param[:atk], 2)
        self.contents.draw_text(dx + dw, dy,       48, WLH, param[:def], 2)
        self.contents.draw_text(dx     , dy + WLH, 48, WLH, param[:spi], 2)
        self.contents.draw_text(dx + dw, dy + WLH, 48, WLH, param[:agi], 2)
        return dy + WLH * 2
      end
      #--------------------------------------------------------------------------
      # ○ 属性描画
      #     dx, dy : 描画先 X, Y
      #     rows   : 行数
      #--------------------------------------------------------------------------
      def draw_element(dx, dy, rows = 1)
        new_dy = dy + WLH * (rows * 2)
        self.contents.font.color = system_color
        self.contents.draw_text(dx, dy,              80, WLH,
          KGC::EnemyGuide::PARAMETER_NAME[:weak_element])
        self.contents.draw_text(dx, dy + WLH * rows, 80, WLH,
          KGC::EnemyGuide::PARAMETER_NAME[:resist_element])
    
        return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
    
        cols = (width - 112) / 24
        # 弱点属性
        draw_icon_list(dx + 80, dy, rows, cols,
          KGC::EnemyGuide::CHECK_ELEMENT_LIST,
          Proc.new { |i| enemy.element_ranks[i] < 3 },
          Proc.new { |i| KGC::EnemyGuide::ELEMENT_ICON[i] })
        # 耐性属性
        draw_icon_list(dx + 80, dy + WLH * rows, rows, cols,
          KGC::EnemyGuide::CHECK_ELEMENT_LIST,
          Proc.new { |i| enemy.element_ranks[i] > 3 },
          Proc.new { |i| KGC::EnemyGuide::ELEMENT_ICON[i] })
        return new_dy
      end
      #--------------------------------------------------------------------------
      # ○ アイコンリスト描画
      #     dx, dy     : 描画先 X, Y
      #     rows, cols : アイコン行/列数
      #     item_list  : 描画対象のリスト
      #     cond_proc  : 描画条件 Proc
      #     index_proc : アイコン index 取得用 Proc
      #--------------------------------------------------------------------------
      def draw_icon_list(dx, dy, rows, cols, item_list, cond_proc, index_proc)
        nc = 0  # 現在の列数
        nr = 0  # 現在の行数
        item_list.each { |item|
          next if item == nil
          next unless cond_proc.call(item)
          icon_index = index_proc.call(item)
          next if icon_index == nil || icon_index == 0
    
          draw_icon(icon_index, dx + nc * 24, dy + nr * 24)
          nc += 1
          if nc == cols
            # 次の行へ
            nc = 0
            nr += 1
            break if nr == rows  # 行制限オーバー
          end
        }
      end
      #--------------------------------------------------------------------------
      # ○ ステート描画
      #     dx, dy : 描画先 X, Y
      #     rows   : 行数
      #--------------------------------------------------------------------------
      def draw_state(dx, dy, rows = 1)
        new_dy = dy + WLH * (rows * 2)
        self.contents.font.color = system_color
        self.contents.draw_text(dx, dy,              80, WLH,
          KGC::EnemyGuide::PARAMETER_NAME[:weak_state])
        self.contents.draw_text(dx, dy + WLH * rows, 80, WLH,
          KGC::EnemyGuide::PARAMETER_NAME[:resist_state])
    
        return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
    
        cols = (width - 112) / 24
        states = []
        KGC::EnemyGuide::CHECK_STATE_LIST.each { |i| states << $data_states[i] }
        # 弱点ステート
        draw_icon_list(dx + 80, dy, rows, cols,
          states,
          Proc.new { |i| enemy.state_ranks[i.id] < 3 },
          Proc.new { |i| i.icon_index })
        # 無効ステート
        draw_icon_list(dx + 80, dy + WLH * rows, rows, cols,
          states,
          Proc.new { |i| enemy.state_ranks[i.id] == 6 },
          Proc.new { |i| i.icon_index })
        return new_dy
      end
      #--------------------------------------------------------------------------
      # ○ EXP, Gold 描画
      #     dx, dy : 描画先 X, Y
      #--------------------------------------------------------------------------
      def draw_prize(dx, dy)
        param = {}
        if KGC::Commands.enemy_defeated?(enemy.id)
          param[:exp]  = enemy.exp
          param[:gold] = enemy.gold
          param[:ap]   = enemy.ap if $imported["EquipLearnSkill"]
        else
          param[:exp] = param[:gold] = param[:ap] =
            KGC::EnemyGuide::UNDEFEATED_PARAMETER
        end
    
        dw = (width - 32) / 2
        self.contents.font.color = system_color
        self.contents.draw_text(dx,      dy, 80, WLH,
          KGC::EnemyGuide::PARAMETER_NAME[:exp])
        self.contents.draw_text(dx + dw, dy, 80, WLH, Vocab.gold)
        if $imported["EquipLearnSkill"]
          self.contents.draw_text(dx, dy + WLH, 80, WLH, Vocab.ap)
        end
    
        # EXP, Gold
        dx += 76
        self.contents.font.color = normal_color
        self.contents.draw_text(dx,      dy, 52, WLH, param[:exp], 2)
        self.contents.draw_text(dx + dw, dy, 52, WLH, param[:gold], 2)
        if $imported["EquipLearnSkill"]
          self.contents.draw_text(dx, dy + WLH, 52, WLH, param[:ap], 2)
        end
    
        return dy + WLH * 2
      end
      #--------------------------------------------------------------------------
      # ○ ドロップアイテム描画
      #     dx, dy : 描画先 X, Y
      #     rows   : 行数
      #--------------------------------------------------------------------------
      def draw_drop_item(dx, dy, rows)
        return dy unless KGC::EnemyGuide::SHOW_DROP_ITEM
    
        new_dy = dy + WLH * rows
        dw = (width - 32) / 2
        self.contents.font.color = system_color
        self.contents.draw_text(dx,      dy, 128, WLH,
          KGC::EnemyGuide::PARAMETER_NAME[:treasure], 1)
        self.contents.draw_text(dx + dw, dy, 128, WLH,
          KGC::EnemyGuide::PARAMETER_NAME[:drop_prob], 2)
    
        return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
    
        # リスト作成
        drop_items = [enemy.drop_item1, enemy.drop_item2]
        if $imported["ExtraDropItem"]
          drop_items += enemy.extra_drop_items
        end
    
        dy += WLH
        count = 0
        drop_items.each_with_index { |item, i|
          # アイテム名描画
          case item.kind
          when 0
            next
          when 1
            drop_item = $data_items[item.item_id]
          when 2
            drop_item = $data_weapons[item.weapon_id]
          when 3
            drop_item = $data_armors[item.armor_id]
          end
          if KGC::Commands.enemy_item_dropped?(enemy.id, i)
            draw_item_name(drop_item, dx, dy)
          else
            draw_masked_item_name(drop_item, dx, dy)
          end
          # ドロップ率描画
          if $imported["ExtraDropItem"] && item.drop_prob > 0
            text = sprintf("%d%%", item.drop_prob)
          else
            text = "1/#{item.denominator}"
          end
          self.contents.draw_text(dx + dw, dy, 128, WLH, text, 2)
          dy += WLH
          count += 1
          break if count == rows
        }
    
        return new_dy
      end
      #--------------------------------------------------------------------------
      # ○ アイテム名をマスクして描画
      #     item    : アイテム (スキル、武器、防具でも可)
      #     x       : 描画先 X 座標
      #     y       : 描画先 Y 座標
      #     enabled : 有効フラグ。false のとき半透明で描画
      #--------------------------------------------------------------------------
      def draw_masked_item_name(item, x, y, enabled = true)
        return if item == nil
    
        draw_icon(item.icon_index, x, y, enabled)
        self.contents.font.color = normal_color
        self.contents.font.color.alpha = enabled ? 255 : 128
        mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
        text = KGC.mask_string(item.name, mask)
        self.contents.draw_text(x + 24, y, 172, WLH, text)
      end
      #--------------------------------------------------------------------------
      # ○ 盗めるオブジェクト描画
      #     dx, dy : 描画先 X, Y
      #     rows   : 行数
      #--------------------------------------------------------------------------
      def draw_steal_object(dx, dy, rows)
        return dy unless $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ
    
        new_dy = dy + WLH * rows
        dw = (width - 32) / 2
        self.contents.font.color = system_color
        self.contents.draw_text(dx,      dy, 128, WLH,
          KGC::EnemyGuide::PARAMETER_NAME[:steal_obj], 1)
        self.contents.draw_text(dx + dw, dy, 128, WLH,
          KGC::EnemyGuide::PARAMETER_NAME[:steal_prob], 2)
    
        return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
    
        # リスト作成
        steal_objects = enemy.steal_objects.clone
        if steal_objects.size >= rows
          steal_objects = steal_objects[0...(rows - 1)]
        end
    
        dy += WLH
        steal_objects.each_with_index { |obj, i|
          if obj.kind == 4
            # Gold
            if KGC::Commands.enemy_object_stolen?(enemy.id, i)
              text = sprintf("%d%s", obj.gold, Vocab.gold)
            else
              mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
              text = KGC.mask_string("aaa", mask)
            end
            self.contents.draw_text(dx + 24, dy, dw, WLH, text)
          else
            # Item
            case obj.kind
            when 1
              item = $data_items[obj.item_id]
            when 2
              item = $data_weapons[obj.weapon_id]
            when 3
              item = $data_armors[obj.armor_id]
            end
            if KGC::Commands.enemy_object_stolen?(enemy.id, i)
              draw_item_name(item, dx, dy)
            else
              draw_masked_item_name(item, dx, dy)
            end
          end
          # 成功率描画
          if obj.success_prob > 0
            text = sprintf("%d%%", obj.success_prob)
          else
            text = "1/#{obj.denominator}"
          end
          self.contents.draw_text(dx + dw, dy, 128, WLH, text, 2)
          dy += WLH
        }
    
        return new_dy
      end
      #--------------------------------------------------------------------------
      # ○ 説明文描画
      #     dx, dy : 描画先 X, Y
      #--------------------------------------------------------------------------
      def draw_description(dx, dy)
        return unless KGC::Commands.enemy_defeated?(enemy.id)
    
        dx += 4
        enemy.enemy_guide_description.each_line { |line|
          self.contents.draw_text(dx, dy, width - 32, WLH, line.chomp)
          dy += WLH
        }
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Scene_Map
    #==============================================================================
    
    class Scene_Map < Scene_Base
      #--------------------------------------------------------------------------
      # ● 画面切り替えの実行
      #--------------------------------------------------------------------------
      alias update_scene_change_KGC_EnemyGuide update_scene_change
      def update_scene_change
        return if $game_player.moving?    # プレイヤーの移動中?
    
        if $game_temp.next_scene == :enemy_guide
          call_enemy_guide
          return
        end
    
        update_scene_change_KGC_EnemyGuide
      end
      #--------------------------------------------------------------------------
      # ○ モンスター図鑑への切り替え
      #--------------------------------------------------------------------------
      def call_enemy_guide
        $game_temp.next_scene = nil
        $scene = Scene_EnemyGuide.new(0, Scene_EnemyGuide::HOST_MAP)
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Scene_Menu
    #==============================================================================
    
    class Scene_Menu < Scene_Base
      if KGC::EnemyGuide::USE_MENU_ENEMY_GUIDE_COMMAND
      #--------------------------------------------------------------------------
      # ● コマンドウィンドウの作成
      #--------------------------------------------------------------------------
      alias create_command_window_KGC_EnemyGuide create_command_window
      def create_command_window
        create_command_window_KGC_EnemyGuide
    
        return if $imported["CustomMenuCommand"]
    
        @__command_enemy_guide_index =
          @command_window.add_command(Vocab.enemy_guide)
        if @command_window.oy > 0
          @command_window.oy -= Window_Base::WLH
        end
        @command_window.index = @menu_index
      end
      end
      #--------------------------------------------------------------------------
      # ● コマンド選択の更新
      #--------------------------------------------------------------------------
      alias update_command_selection_KGC_EnemyGuide update_command_selection
      def update_command_selection
        current_menu_index = @__command_enemy_guide_index
        call_enemy_guide_flag = false
    
        if Input.trigger?(Input::C)
          case @command_window.index
          when @__command_enemy_guide_index  # モンスター図鑑
            call_enemy_guide_flag = true
          end
        end
    
        # モンスター図鑑に移行
        if call_enemy_guide_flag
          Sound.play_decision
          $scene = Scene_EnemyGuide.new(@__command_enemy_guide_index,
            Scene_EnemyGuide::HOST_MENU)
          return
        end
    
        update_command_selection_KGC_EnemyGuide
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # □ Scene_EnemyGuide
    #------------------------------------------------------------------------------
    #   モンスター図鑑画面の処理を行うクラスです。
    #==============================================================================
    
    class Scene_EnemyGuide < Scene_Base
      HOST_MENU   = 0
      HOST_MAP    = 1
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     menu_index  : コマンドのカーソル初期位置
      #     host_scene  : 呼び出し元 (0..メニュー  1..マップ)
      #--------------------------------------------------------------------------
      def initialize(menu_index = 0, host_scene = HOST_MENU)
        @menu_index = menu_index
        @host_scene = host_scene
      end
      #--------------------------------------------------------------------------
      # ● 開始処理
      #--------------------------------------------------------------------------
      def start
        super
        create_menu_background
        if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
          @back_sprite = Sprite.new
          begin
            @back_sprite.bitmap = Cache.system(KGC::EnemyGuide::BACKGROUND_FILENAME)
          rescue
            @back_sprite.bitmap = Bitmap.new(32, 32)
          end
        end
    
        @top_window = Window_EnemyGuideTop.new
        @enemy_window = Window_EnemyGuideList.new
        @status_window = Window_EnemyGuideStatus.new
        @status_window.enemy = @enemy_window.item
      end
      #--------------------------------------------------------------------------
      # ● 終了処理
      #--------------------------------------------------------------------------
      def terminate
        super
        dispose_menu_background
        if @back_sprite != nil
          @back_sprite.bitmap.dispose
          @back_sprite.dispose
        end
        @top_window.dispose
        @enemy_window.dispose
        @status_window.dispose
      end
      #--------------------------------------------------------------------------
      # ○ 元の画面へ戻る
      #--------------------------------------------------------------------------
      def return_scene
        case @host_scene
        when HOST_MENU
          $scene = Scene_Menu.new(@menu_index)
        when HOST_MAP
          $scene = Scene_Map.new
        end
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        super
        update_menu_background
        @top_window.update
        @enemy_window.update
        @status_window.update
        if @enemy_window.active
          update_enemy_selection
        end
      end
      #--------------------------------------------------------------------------
      # ○ エネミー選択の更新
      #--------------------------------------------------------------------------
      def update_enemy_selection
        if @last_index != @enemy_window.index
          @status_window.enemy = @enemy_window.item
          @last_index = @enemy_window.index
        end
    
        if Input.trigger?(Input::B)
          Sound.play_cancel
          return_scene
        elsif Input.trigger?(Input::A) || Input.trigger?(Input::C)
          # スプライト表示切替
          Sound.play_decision
          @status_window.switch_sprite
        elsif Input.trigger?(Input::LEFT)
          # 左ページ
          Sound.play_cursor
          @status_window.shift_info_type(-1)
        elsif Input.trigger?(Input::RIGHT)
          # 右ページ
          Sound.play_cursor
          @status_window.shift_info_type(1)
        end
      end
    end
    Последний раз редактировалось aisuuw; 22.02.2012 в 19:16.

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Социальные закладки

Социальные закладки

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •  
Beastiary