- #===============================================================================
- #
- # Yanfly Engine Zealous - Enemy Scan Query
- # Last Date Updated: 2010.01.27
- # Level: Easy, Normal, Hard
- #
- # Sometimes it's hard to keep track of an enemy's capabilities as players go
- # through a game. With the aid of a scan skill, the player can view enemy data
- # to recollect their thoughts and recalculate their strategies. However, unlike
- # most scan skills found in most commercial RPG's, the scan window can be
- # accessed whenever the player can target the enemy rather than requiring the
- # player to manually cast a scan skill on the enemy each turn.
- #
- # The scan windows will provide basic stat information, elemental and status
- # resistances, a skill list, and finally, a drop list. This information will
- # not be available to the player straight from the get go, but instead, will
- # require the player to slowly (or quickly) unlock each bit of the scan data to
- # reveal an enemy's entire information list.
- #
- #===============================================================================
- # Updates
- # -----------------------------------------------------------------------------
- # o 2010.01.27 - Enemy Levels compatibility.
- # o 2010.01.25 - Finished Script.
- # o 2010.01.23 - Started Script.
- #===============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #
- # -----------------------------------------------------------------------------
- # Skill and Item Tags - Insert the following tags into Skill or Item noteboxes.
- # -----------------------------------------------------------------------------
- # <scan: phrase>
- # This will scan a certain bit of the enemy or all of it depending on the word
- # you've used in place of "phrase" in the tag above. Here is a list of words
- # you can replace phrase with:
- # All - Scans all aspects of the enemy.
- # HP - Scans the HP aspect of the enemy.
- # MP - Scans the MP aspect of the enemy.
- # Stats - Scans the stats aspect of the enemy.
- # Skills - Scans the skills aspect of the enemy.
- # Drops - Scans the drops aspect of the enemy.
- #
- # <scan element: x> or <scan elements: x,x>
- # This will scan the enemy's element resistance to element ID x. Use either the
- # latter tag or multiple tags to include scanning for more elements. If the ID
- # used is not within the shown elements, this tag will have no effect. To scan
- # all elements, use the <scan: all elements> tag.
- #
- # <scan state: x> or <scan states: x,x>
- # This will scan the enemy's status resistance to the state ID x. Use multiple
- # tags or the latter tag to include scanning for more states. If the ID used is
- # not within the shown states list, this tag will have no effect. To scan all
- # states, use the <scan: all states> tag.
- #
- # -----------------------------------------------------------------------------
- # Enemy Tags - Insert the following tags into Enemy noteboxes.
- # -----------------------------------------------------------------------------
- # <hidden: phrase>
- # This determines which pages the enemy will have hidden even if scanned. This
- # is sometimes used to prevent too much information from leaking out to the
- # player's advantage. Replace the word "phrase" with one of the following:
- # general - Hides the general information page.
- # element - Hides the element resistance page.
- # states - Hides the status resistance page.
- # skills - Hides the skill list page.
- # victory - Hides the victory information page.
- #
- # <gauge width x>
- # When using quick scan, this will adjust the width of the quick scan bars.
- # Note that +32 pixels will be added onto whatever value x is in order to
- # prevent any user created errors you may do.
- #
- # <hide hp gauge> or <show hp gauge>
- # <hide mp gauge> or <show mp gauge>
- # <hide states gauge> or <show states gauge>
- # To prevent some gauges from being shown during quick scan for some specific
- # enemy types, use these tags to hide or show whatever respective item you wish
- # to enable or disable from view.
- #
- # <hp gauge x, y> or <mp gauge x, y>
- # This allows you to change the colours of the HP or MP gauge to whatever the
- # gradient values you've set for x and y. Both x and y use text colours.
- #
- # <scan description>
- # text
- # </scan description>
- # This adjusts the enemy scan description that appears below the enemy data when
- # browsing through the scan query. Use | to attach any line breaks (and to start
- # new lines) within the description box.
- #
- # -----------------------------------------------------------------------------
- # Debug Shortcuts - Only during $TEST and $BTEST mode
- # -----------------------------------------------------------------------------
- # Pressing F5 while viewing an enemy profile will reveal all of its data.
- #
- #===============================================================================
- # Compatibility
- # -----------------------------------------------------------------------------
- # - Works With: YEZ Battle Engine Zealous, KGC Extra Drop Item
- # YEZ Battler Stats and Class Stats, YEZ JP System: Skill Levels
- # -----------------------------------------------------------------------------
- # Note: This script may not work with former Yanfly Engine ReDux scripts.
- # Use Yanfly Engine Zealous scripts to work with this if available.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["EnemyScanQuery"] = true
- module YEZ
- module SCAN
- #===========================================================================
- # Basic Settings
- # --------------------------------------------------------------------------
- # This area sets the basic settings used for the script. Here you adjust
- # the various scanning aspects such as the button used, page order, the
- # sound played when turning pages, etc.
- #===========================================================================
- # This is the button used to launch the scan menu during enemy selection.
- SCAN_BUTTON = Input::A
- # This determines the order the pages are drawn inside of the scan window.
- # Use the following methods below to determine which pages will appear.
- # :general General page. Displays the usual enemy stats.
- # :element Element page. Displays the enemy's elemental affinities.
- # :states States page. Displays the enemy's status resistances.
- # :skills Skills page. Displays the enemy's usable skills.
- # :victory Victory page. Displays the enemy's victory spoil info.
- PAGE_ORDER =[
- :general, # General page. Displays the usual enemy stats.
- :skills, # Skills page. Displays the enemy's usable skills.
- :element, # Element page. Displays the enemy's elemental affinities.
- :states, # States page. Displays the enemy's status resistances.
- :victory, # Victory page. Displays the enemy's victory spoil info.
- ] # Do not remove this.
- # This is the sound effect that plays whenever a page is flipped inside of
- # the scan list. Set this to nil if you don't want a sound to play.
- PAGE_SOUND = RPG::SE.new("P4CLICK", 80, 100)
- # If this option is set, it will require enemies to be scanned before their
- # full data will appear within the scan query.
- REQUIRE_SCAN = true
- # If this feature is on, this will set some skills to have automatic scan
- # traits to them. For example, MP damage skills will reveal MP info. Each
- # of the elements will reveal elemental scan information. Things as such.
- AUTO_CREATE_SCAN = true
- #===========================================================================
- # Quick Scan Settings
- # --------------------------------------------------------------------------
- # The following settings below will determine the Quick Scan settings for
- # the quick bars shown on the enemies. Here are the tags to override the
- # default settings for the quick scan bars:
- # <gauge width x> - Change gauge width.
- # <hp gauge x, y> - Change HP gauge colours.
- # <mp gauge x, y> - Change MP gauge colours.
- # <show hp gauge> - Show the HP Gauge.
- # <hide hp gauge> - Hide the HP Gauge.
- # <show mp gauge> - Show the MP Gauge.
- # <hide mp gauge> - Hide the MP Gauge.
- # <show states gauge> - Show the states gauge.
- # <hide states gauge> - Hide the states gauge.
- #===========================================================================
- # Set this to true to make use of the quick scan bars. The quick scan will
- # show a gauge-only representation of the enemy's HP/MP status. If this is
- # set to false, none of the settings used below will matter.
- USE_QUICK_SCAN = false
- # The following will determine what are the default settings in regards to
- # the quick scan bars.
- GAUGE_DEFAULTS = {
- # Method => Text Colour
- :width => 64, # Automatically, +32 added to the width.
- :states => true, # How many states shown depends on the width.
- :show_hp => true, # Show the HP gauge by default?
- :hp_gauge1 => 10, # HP colour 1 for gauge gradient.
- :hp_gauge2 => 2, # HP colour 2 for gauge gradient.
- :show_mp => true, # Show the MP gauge (and rage) by default?
- :mp_gauge1 => 9, # MP colour 1 for gauge gradient.
- :mp_gauge2 => 1, # MP colour 2 for gauge gradient.
- } # Do not remove this.
- #===========================================================================
- # Target Help Settings
- # --------------------------------------------------------------------------
- # The scan help window will appear whenever the target enemy window appears
- # inside of battle. It will give the player a notice that by pressing a
- # certain key, the scan query windows can appear.
- #===========================================================================
- # These settings adjust the various aspects of the scan query's help
- # window that appears in battle.
- HELP_WINDOW ={
- # Setting => Value
- :x => 416, # The X position of the window.
- :y => 40, # The Y position of the window.
- :width => 128, # The width of the window.
- :height => 56, # The height of the window.
- :trans => true, # Make the window transparent?
- :icon => 613, # This is the icon used at the very left side.
- :text => "view data",
- } # Do not remove this.
- #===========================================================================
- # General Page Settings
- # --------------------------------------------------------------------------
- # This section sets up the general information regarding the general page.
- # The general page displays basic HP/MP information as well as basic stats
- # and a simplified element list.
- #===========================================================================
- # The following will allow you to adjust how you would like for HP and MP
- # to appear. The following will explain how each type formats HP and MP:
- # - Type 1: Current
- # - Type 2: Current / Max
- # - Type 3: Percent
- DISPLAY_HP_STYLE = 2
- DISPLAY_MP_STYLE = 2
- # This determines which stats are drawn in the two stat columns within
- # the general page as well as what font size to display them at. The items
- # you may place into these arrays are:
- # :atk, :def, :spi, :res, :dex, :agi, :hit, :eva, :cri, :luk, :dur, :odds
- STAT_FONT_SIZE = 16
- STAT_COLUMN1 = [:atk, :spi, :dex]
- STAT_COLUMN2 = [:def, :res, :agi]
- #===========================================================================
- # Elements and Status Page Settings
- # --------------------------------------------------------------------------
- # The elements page will show which elements the enemy is weak against and
- # which elements the enemy is resistant to, immune to, or will absorb.
- #===========================================================================
- # This is the list of elements and states that will be shown on the elements
- # list, states page, and general page for the scan query.
- SHOWN_ELEMENTS = [1..6, 8, 9] # Element 7 (Ether) is skipped
- SHOWN_STATES = [2..6, 8, 9, 10]
- # This is the font size used for the general page. Spacing determines how
- # far the icons are apart from each x value.
- GENERAL_ELEMENT_FONT_SIZE = 14 #default: 12
- GENERAL_ELEMENT_SPACING = 32
- # Since elements do not innately have icons, you must manually bind icons
- # to them in order for them to show up properly.
- ELEMENT_ICONS ={
- # ID => Icon ID
- 1 => 2, # Phys
- 2 => 18, # Fire
- 3 => 19, # Water
- 4 => 20, # Earth
- 5 => 21, # Wind
- 6 => 22, # Elec
- 7 => 23, # Ether
- 8 => 24, # Light
- 9 => 25, # Dark
- } # Do not remove this.
- # Depending on the rate numbers, different ranks will use different text
- # colours to represent them.
- RANK_SETTINGS ={
- # Rank = > [Colour, Element, Status]
- :nodata => [ 0, "-----", "-----"],
- :srank => [ 2, "ERROR", "ERROR"], # Not used
- :arank => [ 2, "ERROR", "ERROR"], # Not used
- :brank => [ 14, "Weak", "Weak"],
- :crank => [ 6, "-", "-"],
- :drank => [ 3, "Resists", "Resists"],
- :erank => [ 4, "Null", "Resists"],
- :frank => [ 5, "Absorb", "Null"],
- } # Do not remove this.
- #===========================================================================
- # Skills Page Settings
- # --------------------------------------------------------------------------
- # The skills page has a number of options for how it can unlock. Adjust the
- # settings appropriately below.
- #===========================================================================
- # This is the title used for the skills page.
- SKILL_TITLE = "Skill List"
- # This will record the skill as a part of the enemy's skill list when the
- # enemy uses that skill. Set false if you wish to disable this feature.
- SCAN_SKILL_WHEN_USED = true
- # This will be the icon used to hide the skill if the skill is unscanned.
- HIDDEN_SKILL_ICON = 98
- #===========================================================================
- # Victory Page Settings
- # --------------------------------------------------------------------------
- # This page will be automatic and will always unlock itself upon meeting a
- # new enemy. The only way for this page to not be shown is if the enemy has
- # the page listed in hidden pages.
- #===========================================================================
- # This hash determines the vocabulary used for the victory page's various
- # text settings and whatnot.
- VICTORY_SETTINGS ={
- # Method => [Icon, Title, Display]
- :encounters => [ 631, "Encounters", "× %s"],
- :defeated => [ 626, "Defeated", "× %s"],
- :escaped => [ 630, "Escaped", "× %s"],
- :spoils => [ 632, "Drops", ""],
- :gold => [ 652, "Florins", "%s Florins"],
- :exp => [ 633, "Experience", "%s EXP"],
- } # Do not remove this.
- # This will cause the drops to unlock themselves individually rather than
- # being fully revealed once an enemy is killed.
- UNLOCK_INDIVIDUAL_DROPS = true
- # This is the icon used for hidden and masked drops.
- HIDDEN_DROP_ICON = 144
- end # SCAN
- end # YEZ
- #===============================================================================
- # Editting anything past this point may potentially result in causing computer
- # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
- # Therefore, edit at your own risk.
- #===============================================================================
- module YEZ
- module REGEXP
- SCAN_TYPES = ["HP", "MP", "STATS", "SKILLS", "DROPS"]
- module USABLEITEM
- SCAN = /<(?:SCAN|scan):[ ](.*)>/i
- SCAN_ELEMENT = /<(?:SCAN ELEMENT|scan elements):[ ](\d+(?:\s*,\s*\d+)*)>/i
- SCAN_STATES = /<(?:SCAN STATE|scan states):[ ](\d+(?:\s*,\s*\d+)*)>/i
- end # USABLEITEM
- module ENEMY
- GAUGE_WIDTH = /<(?:GAUGE_WIDTH|gauge width)[ ]*(\d+)>/i
- HIDE_GAUGE = /<(.*)[ ](.*)[ ](?:GAUGE|gauge)>/i
- HP_GAUGE = /<(?:HP_GAUGE|hp gauge)[ ]*(\d+),[ ]*(\d+)>/i
- MP_GAUGE = /<(?:MP_GAUGE|mp gauge)[ ]*(\d+),[ ]*(\d+)>/i
- HIDE_SCAN = /<(?:HIDDEN|hidden):[ ](.*)>/i
- DESCRIPTION_ON = /<(?:SCAN_DESCRIPTION|scan description)>/i
- DESCRIPTION_OFF = /<\/(?:SCAN_DESCRIPTION|scan description)>/i
- end # ENEMY
- end # REGEXP
- end # YEZ
- module YEZ::SCAN
- module_function
- #--------------------------------------------------------------------------
- # convert_integer_array
- #--------------------------------------------------------------------------
- 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
- #--------------------------------------------------------------------------
- # converted arrays
- #--------------------------------------------------------------------------
- SHOWN_ELEMENTS_LIST = convert_integer_array(SHOWN_ELEMENTS)
- SHOWN_STATES_LIST = convert_integer_array(SHOWN_STATES)
- end # YEZ::SCAN
- module Vocab
- def self.hit; return "HIT"; end
- def self.eva; return "EVA"; end
- def self.cri; return "CRI"; end
- def self.odds;return "AGR"; end
- end # Vocab
- #===============================================================================
- # RPG::UsableItem
- #===============================================================================
- class RPG::UsableItem
- #--------------------------------------------------------------------------
- # common cache: yez_cache_usableitem_esq
- #--------------------------------------------------------------------------
- def yez_cache_usableitem_esq
- @scan_reveal = []; @scan_elements = []; @scan_states = []
- create_auto_scan if YEZ::SCAN::AUTO_CREATE_SCAN
- self.note.split(/[\r\n]+/).each { |line|
- case line
- #---
- when YEZ::REGEXP::USABLEITEM::SCAN
- case $1.upcase
- when "HP", "MP", "SP", "STAT", "STATS", "SKILL", "SKILLS", "DROP",
- "DROPS"
- text = $1.upcase
- text = "MP" if text == "SP"
- text = "STATS" if text == "STAT"
- text = "SKILLS" if text == "SKILL"
- text = "DROPS" if text == "DROP"
- @scan_reveal.push(text)
- when "ALL ELEMENTS"
- @scan_elements = YEZ::SCAN::SHOWN_ELEMENTS_LIST
- @scan_reveal.push("ELEMENT")
- when "ALL STATES"
- @scan_states = YEZ::SCAN::SHOWN_STATES_LIST
- @scan_reveal.push("STATE")
- when "ALL"
- array = YEZ::REGEXP::SCAN_TYPES
- for item in array; @scan_reveal.push(item); end
- @scan_elements = YEZ::SCAN::SHOWN_ELEMENTS_LIST
- @scan_reveal.push("ELEMENT")
- @scan_states = YEZ::SCAN::SHOWN_STATES_LIST
- @scan_reveal.push("STATE")
- else; next
- end
- #---
- when YEZ::REGEXP::USABLEITEM::SCAN_ELEMENT
- @scan_reveal.push("ELEMENT")
- $1.scan(/\d+/).each { |num|
- @scan_elements.push(num.to_i) if num.to_i > 0 }
- #---
- when YEZ::REGEXP::USABLEITEM::SCAN_STATES
- @scan_reveal.push("STATE")
- $1.scan(/\d+/).each { |num|
- @scan_states.push(num.to_i) if num.to_i > 0 }
- #---
- end
- } # end self.note.split
- end # yez_cache_usableitem_esq
- #--------------------------------------------------------------------------
- # new method: create_auto_scan
- #--------------------------------------------------------------------------
- def create_auto_scan
- @scan_reveal.push("MP") if self.damage_to_mp
- if self.is_a?(RPG::Item)
- @scan_reveal.push("MP") if self.mp_recovery_rate != 0
- @scan_reveal.push("MP") if self.mp_recovery != 0
- end
- if YEZ::SCAN::SHOWN_ELEMENTS_LIST & self.element_set != []
- @scan_elements = YEZ::SCAN::SHOWN_ELEMENTS_LIST & self.element_set
- @scan_reveal.push("ELEMENT")
- end
- if YEZ::SCAN::SHOWN_STATES_LIST & self.plus_state_set != []
- @scan_states = YEZ::SCAN::SHOWN_STATES_LIST & self.plus_state_set
- @scan_reveal.push("STATE")
- end
- for state_id in self.plus_state_set
- break if @scan_reveal.include?("STATS")
- state = $data_states[state_id]
- @scan_reveal.push("STATS") if state.atk_rate != 100
- @scan_reveal.push("STATS") if state.def_rate != 100
- @scan_reveal.push("STATS") if state.spi_rate != 100
- @scan_reveal.push("STATS") if state.agi_rate != 100
- end
- end
- #--------------------------------------------------------------------------
- # new method: scan_reveal
- #--------------------------------------------------------------------------
- def scan_reveal
- yez_cache_usableitem_esq if @scan_reveal == nil
- return @scan_reveal.uniq
- end
- #--------------------------------------------------------------------------
- # new method: scan_elements
- #--------------------------------------------------------------------------
- def scan_elements
- yez_cache_usableitem_esq if @scan_elements == nil
- return @scan_elements
- end
- #--------------------------------------------------------------------------
- # new method: scan_states
- #--------------------------------------------------------------------------
- def scan_states
- yez_cache_usableitem_esq if @scan_states == nil
- return @scan_states
- end
- end # RPG::UsableItem
- #===============================================================================
- # RPG::Enemy
- #===============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # common cache: yez_cache_enemy_esq
- #--------------------------------------------------------------------------
- def yez_cache_enemy_esq
- @scan_description = ""; @scan_desc_mode = false; @quick_gauge = {}
- @quick_gauge[:width] = YEZ::SCAN::GAUGE_DEFAULTS[:width] + 32
- @quick_gauge[:states] = YEZ::SCAN::GAUGE_DEFAULTS[:states]
- @quick_gauge[:show_hp] = YEZ::SCAN::GAUGE_DEFAULTS[:show_hp]
- @quick_gauge[:hp_gauge1] = YEZ::SCAN::GAUGE_DEFAULTS[:hp_gauge1]
- @quick_gauge[:hp_gauge2] = YEZ::SCAN::GAUGE_DEFAULTS[:hp_gauge2]
- @quick_gauge[:show_mp] = YEZ::SCAN::GAUGE_DEFAULTS[:show_mp]
- @quick_gauge[:mp_gauge1] = YEZ::SCAN::GAUGE_DEFAULTS[:mp_gauge1]
- @quick_gauge[:mp_gauge2] = YEZ::SCAN::GAUGE_DEFAULTS[:mp_gauge2]
- @hidden_pages = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- #---
- when YEZ::REGEXP::ENEMY::HIDE_SCAN
- case $1.upcase
- when "GENERAL", "ELEMENT", "STATES", "SKILLS", "VICTORY"
- text = $1.upcase
- else; next
- end
- @hidden_pages.push(text)
- #---
- when YEZ::REGEXP::ENEMY::GAUGE_WIDTH
- @quick_gauge[:width] = $1.to_i + 32
- #---
- when YEZ::REGEXP::ENEMY::HIDE_GAUGE
- case $1.upcase
- when "HIDE"
- setting = false
- when "SHOW"
- setting = true
- else; next
- end
- case $2.upcase
- when "STATE", "STATES"
- @quick_gauge[:states] = setting
- when "HP"
- @quick_gauge[:show_hp] = setting
- when "MP", "SP"
- @quick_gauge[:show_mp] = setting
- else; next
- end
- #---
- when YEZ::REGEXP::ENEMY::HP_GAUGE
- @quick_gauge[:hp_gauge1] = $1.to_i
- @quick_gauge[:hp_gauge2] = $2.to_i
- #---
- when YEZ::REGEXP::ENEMY::MP_GAUGE
- @quick_gauge[:mp_gauge1] = $1.to_i
- @quick_gauge[:mp_gauge2] = $2.to_i
- #---
- when YEZ::REGEXP::ENEMY::DESCRIPTION_ON
- @scan_desc_mode = true
- when YEZ::REGEXP::ENEMY::DESCRIPTION_OFF
- @scan_desc_mode = false
- else
- @scan_description += line if @scan_desc_mode
- #---
- end
- } # end self.note.split
- end # yez_cache_enemy_esq
- #--------------------------------------------------------------------------
- # new method: quick_gauge
- #--------------------------------------------------------------------------
- def quick_gauge
- yez_cache_enemy_esq if @quick_gauge == nil
- return @quick_gauge
- end
- #--------------------------------------------------------------------------
- # new method: scan_description
- #--------------------------------------------------------------------------
- def scan_description
- yez_cache_enemy_esq if @scan_description == nil
- return @scan_description
- end
- #--------------------------------------------------------------------------
- # new method: hidden_pages
- #--------------------------------------------------------------------------
- def hidden_pages
- yez_cache_enemy_esq if @hidden_pages == nil
- return @hidden_pages
- end
- end # RPG::Enemy
- #===============================================================================
- # Game_System
- #===============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # new method: create_scan_arrays
- #--------------------------------------------------------------------------
- def create_scan_arrays
- @scanned = {} if @scanned == nil
- @scanned_elements = {} if @scanned_elements == nil
- @scanned_states = {} if @scanned_states == nil
- @scanned_skills = {} if @scanned_skills == nil
- @scanned_encounters = {} if @scanned_encounters == nil
- @scanned_defeated = {} if @scanned_defeated == nil
- @scanned_escaped = {} if @scanned_escaped == nil
- @scanned_drop_item = {} if @scanned_drop_item == nil
- @scanned_drop_weapon = {} if @scanned_drop_weapon == nil
- @scanned_drop_armour = {} if @scanned_drop_armour == nil
- end
- #--------------------------------------------------------------------------
- # new method: full_scan
- #--------------------------------------------------------------------------
- def full_scan(battler)
- id = battler.enemy.id
- create_scan_arrays
- for type in YEZ::REGEXP::SCAN_TYPES
- @scanned[type] = [] if @scanned[type] == nil
- @scanned[type] += [id]
- @scanned[type].uniq!
- end
- @scanned_elements[id] = [] if @scanned_elements[id] == nil
- @scanned_elements[id] += YEZ::SCAN::SHOWN_ELEMENTS_LIST
- @scanned_elements[id].uniq!
- @scanned_states[id] = [] if @scanned_states[id] == nil
- @scanned_states[id] += YEZ::SCAN::SHOWN_STATES_LIST
- @scanned_states[id].uniq!
- @scanned_skills[id] = [] if @scanned_skills[id] == nil
- result = []
- for action in battler.enemy.actions
- next unless action.kind == 1
- result.push(action.skill_id) unless result.include?(action.skill_id)
- end
- @scanned_skills[id] += result
- @scanned_skills[id].uniq
- end
- #--------------------------------------------------------------------------
- # new method: scan_target
- #--------------------------------------------------------------------------
- def scan_target(enemy, obj)
- create_scan_arrays
- return if enemy == nil
- id = enemy.id
- for scan_type in obj.scan_reveal
- case scan_type
- when "HP", "MP", "STATS", "DROPS"
- @scanned[scan_type] = [] if @scanned[scan_type] == nil
- @scanned[scan_type].push(id) unless @scanned[scan_type].include?(id)
- when "ELEMENT"
- @scanned_elements[id] = [] if @scanned_elements[id] == nil
- @scanned_elements[id] += obj.scan_elements
- @scanned_elements[id].uniq!
- when "STATE"
- @scanned_states[id] = [] if @scanned_states[id] == nil
- @scanned_states[id] += obj.scan_states
- @scanned_states[id].uniq!
- when "SKILLS"
- @scanned_skills[id] = [] if @scanned_skills[id] == nil
- result = []
- for action in enemy.actions
- next unless action.kind == 1
- result.push(action.skill_id) unless result.include?(action.skill_id)
- end
- @scanned_skills[id] += result
- @scanned_skills[id].uniq
- end
- end
- end
- #--------------------------------------------------------------------------
- # new method: scan_skill
- #--------------------------------------------------------------------------
- def scan_skill(enemy, skill)
- return unless YEZ::SCAN::SCAN_SKILL_WHEN_USED
- create_scan_arrays
- id = enemy.id
- @scanned_skills[id] = [] if @scanned_skills[id] == nil
- @scanned_skills[id].push(skill.id) unless
- @scanned_skills[id].include?(skill.id)
- end
- #--------------------------------------------------------------------------
- # new method: scan_drop_item
- #--------------------------------------------------------------------------
- def scan_drop_item(enemy, drop_item)
- return unless YEZ::SCAN::UNLOCK_INDIVIDUAL_DROPS
- create_scan_arrays
- id = enemy.id
- case drop_item.kind
- when 1
- item = $data_items[drop_item.item_id]
- @scanned_drop_item[id] = [] if @scanned_drop_item[id] == nil
- @scanned_drop_item[id].push(item.id) unless
- @scanned_drop_item[id].include?(item.id)
- when 2
- item = $data_weapons[drop_item.weapon_id]
- @scanned_drop_weapon[id] = [] if @scanned_drop_weapon[id] == nil
- @scanned_drop_weapon[id].push(item.id) unless
- @scanned_drop_weapon[id].include?(item.id)
- when 3
- item = $data_armors[drop_item.armor_id]
- @scanned_drop_armour[id] = [] if @scanned_drop_armour[id] == nil
- @scanned_drop_armour[id].push(item.id) unless
- @scanned_drop_armour[id].include?(item.id)
- end
- end
- #--------------------------------------------------------------------------
- # new method: scanned
- #--------------------------------------------------------------------------
- def scanned
- create_scan_arrays if @scanned == nil
- return @scanned
- end
- #--------------------------------------------------------------------------
- # new method: scanned_elements
- #--------------------------------------------------------------------------
- def scanned_elements
- create_scan_arrays if @scanned_elements == nil
- for type in YEZ::REGEXP::SCAN_TYPES
- @scanned[type] = [] if @scanned[type] == nil
- end
- return @scanned_elements
- end
- #--------------------------------------------------------------------------
- # new method: scanned_states
- #--------------------------------------------------------------------------
- def scanned_states
- create_scan_arrays if @scanned_states == nil
- return @scanned_states
- end
- #--------------------------------------------------------------------------
- # new method: scanned_skills
- #--------------------------------------------------------------------------
- def scanned_skills
- create_scan_arrays if @scanned_skills == nil
- return @scanned_skills
- end
- #--------------------------------------------------------------------------
- # new method: scanned_encounters
- #--------------------------------------------------------------------------
- def scanned_encounters
- create_scan_arrays if @scanned_encounters == nil
- return @scanned_encounters
- end
- #--------------------------------------------------------------------------
- # new method: scanned_defeated
- #--------------------------------------------------------------------------
- def scanned_defeated
- create_scan_arrays if @scanned_defeated == nil
- return @scanned_defeated
- end
- #--------------------------------------------------------------------------
- # new method: scanned_escaped
- #--------------------------------------------------------------------------
- def scanned_escaped
- create_scan_arrays if @scanned_escaped == nil
- return @scanned_escaped
- end
- #--------------------------------------------------------------------------
- # new method: scanned_drop_item
- #--------------------------------------------------------------------------
- def scanned_drop_item
- create_scan_arrays if @scanned_drop_item == nil
- return @scanned_drop_item
- end
- #--------------------------------------------------------------------------
- # new method: scanned_drop_weapon
- #--------------------------------------------------------------------------
- def scanned_drop_weapon
- create_scan_arrays if @scanned_drop_weapon == nil
- return @scanned_drop_weapon
- end
- #--------------------------------------------------------------------------
- # new method: scanned_drop_armour
- #--------------------------------------------------------------------------
- def scanned_drop_armour
- create_scan_arrays if @scanned_drop_armour == nil
- return @scanned_drop_armour
- end
- end # Game_System
- #===============================================================================
- # Game_Battler
- #===============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # new method: maxmp_limit
- #--------------------------------------------------------------------------
- unless method_defined?(:maxmp_limit)
- def maxmp_limit
- return 9999
- end
- end # method_defined?(:maxmp_limit)
- #--------------------------------------------------------------------------
- # alias method: item_effect
- #--------------------------------------------------------------------------
- alias item_effect_esq item_effect unless $@
- def item_effect(user, item)
- item_effect_esq(user, item)
- if !actor? and !@skipped and !@missed and !@evaded and user.actor?
- $game_system.scan_target(self.enemy, item)
- end
- end
- #--------------------------------------------------------------------------
- # alias method: skill_effect
- #--------------------------------------------------------------------------
- alias skill_effect_esq skill_effect unless $@
- def skill_effect(user, skill)
- skill_effect_esq(user, skill)
- $game_system.scan_skill(user.enemy, skill) if !user.actor?
- if !actor? and !@skipped and !@missed and !@evaded and user.actor?
- $game_system.scan_target(self.enemy, skill)
- end
- end
- end # Game_Battler
- #==============================================================================
- # Game_Enemy
- #==============================================================================
- class Game_Enemy
- #--------------------------------------------------------------------------
- # alias method: initialize
- #--------------------------------------------------------------------------
- alias initialize_enemy_esq initialize unless $@
- def initialize(index, enemy_id)
- initialize_enemy_esq(index, enemy_id)
- $game_system.scanned_encounters[@enemy_id] = 0 if
- $game_system.scanned_encounters[@enemy_id] == nil
- $game_system.scanned_encounters[@enemy_id] += 1
- end
- #--------------------------------------------------------------------------
- # alias method: transform
- #--------------------------------------------------------------------------
- alias transform_esq transform unless $@
- def transform(enemy_id)
- transform_esq(enemy_id)
- $game_system.scanned_encounters[@enemy_id] = 0 if
- $game_system.scanned_encounters[@enemy_id] == nil
- $game_system.scanned_encounters[@enemy_id] += 1 if $game_temp.in_battle
- end
- #--------------------------------------------------------------------------
- # alias method: perform_collapse
- #--------------------------------------------------------------------------
- alias perform_collapse_esq perform_collapse unless $@
- def perform_collapse
- perform_collapse_esq
- if $game_temp.in_battle and dead?
- $game_system.scanned_defeated[@enemy_id] = 0 if
- $game_system.scanned_defeated[@enemy_id] == nil
- $game_system.scanned_defeated[@enemy_id] += 1
- end
- end
- #--------------------------------------------------------------------------
- # alias method: escape
- #--------------------------------------------------------------------------
- alias escape_esq escape unless $@
- def escape
- $game_system.scanned_escaped[@enemy_id] = 0 if
- $game_system.scanned_escaped[@enemy_id] == nil
- $game_system.scanned_escaped[@enemy_id] += 1
- escape_esq
- end
- #--------------------------------------------------------------------------
- # new method: total_skills
- #--------------------------------------------------------------------------
- def total_skills
- result = []
- for action in enemy.actions
- next unless action.kind == 1
- skill = $data_skills[action.skill_id]
- result.push(skill) unless result.include?(skill)
- end
- result.sort! { |a,b| a.id <=> b.id }
- return result.uniq
- end
- end # Game_Enemy
- #===============================================================================
- # Game_Troop
- #===============================================================================
- class Game_Troop < Game_Unit
- #--------------------------------------------------------------------------
- # overwrite method: make_drop_items
- #--------------------------------------------------------------------------
- def make_drop_items
- drop_items = []
- for enemy in dead_members
- id = enemy.enemy.id
- for di in [enemy.drop_item1, enemy.drop_item2]
- 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
- $game_system.scan_drop_item(enemy.enemy, di)
- end
- end
- return drop_items unless $imported["ExtraDropItem"]
- dead_members.each { |enemy|
- enemy.extra_drop_items.each_with_index { |di, i|
- next if di.kind == 0
- if di.drop_prob > 0
- next if di.drop_prob < rand(100)
- else
- next if rand(di.denominator) != 0
- end
- id = enemy.enemy.id
- 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
- $game_system.scan_drop_item(enemy.enemy, di)
- if $imported["EnemyGuide"]
- KGC::Commands.set_enemy_item_dropped(enemy.enemy.id, i + 2)
- end
- }
- }
- return drop_items
- end
- end # Game_Troop
- #===============================================================================
- # Scene_Battle
- #===============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # alias method: start
- #--------------------------------------------------------------------------
- alias start_battle_esq start unless $@
- def start
- start_battle_esq
- @scan_query_window = Window_ScanQuery.new
- end
- #--------------------------------------------------------------------------
- # alias method: terminate
- #--------------------------------------------------------------------------
- alias terminate_battle_esq terminate unless $@
- def terminate
- @scan_query_window.dispose if @scan_query_window != nil
- @target_scan_help_window.dispose if @target_scan_help_window != nil
- terminate_battle_esq
- end
- #--------------------------------------------------------------------------
- # alias method: update
- #--------------------------------------------------------------------------
- alias update_battle_esq update unless $@
- def update
- @scan_query_window.update
- if @scan_query_window.active or @scan_query_window.openness != 0
- super
- return
- end
- update_battle_esq
- end
- #--------------------------------------------------------------------------
- # alias method: start_target_enemy_selection
- #--------------------------------------------------------------------------
- alias start_target_enemy_selection_esq start_target_enemy_selection unless $@
- def start_target_enemy_selection
- start_target_enemy_selection_esq
- @target_scan_help_window = Window_TargetScanHelp.new
- return unless YEZ::SCAN::USE_QUICK_SCAN
- @enemy_gauge_window = Window_EnemyGauge.new
- end
- #--------------------------------------------------------------------------
- # alias method: end_target_enemy_selection
- #--------------------------------------------------------------------------
- alias end_target_enemy_selection_esq end_target_enemy_selection unless $@
- def end_target_enemy_selection
- end_target_enemy_selection_esq
- if @target_scan_help_window != nil
- @target_scan_help_window.dispose
- @target_scan_help_window = nil
- end
- return unless YEZ::SCAN::USE_QUICK_SCAN
- @enemy_gauge_window.dispose if @enemy_gauge_window != nil
- @enemy_gauge_window = nil
- @last_gauge_window_index = nil
- end
- #--------------------------------------------------------------------------
- # alias method: update_target_enemy_selection
- #--------------------------------------------------------------------------
- alias update_target_enemy_selection_esq update_target_enemy_selection unless $@
- def update_target_enemy_selection
- update_target_enemy_selection_esq
- return if @target_enemy_window == nil
- if Input.trigger?(YEZ::SCAN::SCAN_BUTTON)
- @scan_query_window.appear(@target_enemy_window, @target_enemy_window.enemy)
- end
- return unless YEZ::SCAN::USE_QUICK_SCAN
- if @last_gauge_window_index != @target_enemy_window.index
- @last_gauge_window_index = @target_enemy_window.index
- @enemy_gauge_window.battler = @target_enemy_window.enemy
- end
- end
- end # Scene_Battle
- #===============================================================================
- # Window_Base
- #===============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # new method: draw_enemy_hp_gauge
- #--------------------------------------------------------------------------
- def draw_enemy_hp_gauge(battler, x, y, width = 120)
- battler.hp = [battler.hp, battler.maxhp].min
- gc0 = gauge_back_color
- gc1 = text_color(battler.enemy.quick_gauge[:hp_gauge1])
- gc2 = text_color(battler.enemy.quick_gauge[:hp_gauge2])
- gh = 6
- gy = y + WLH - 8 - (gh - 6)
- if battler.maxhp < battler.base_maxhp and battler.base_maxhp > 0 and
- !(battler.base_maxhp > battler.maxhp_limit)
- gb = width * battler.maxhp / battler.base_maxhp
- self.contents.fill_rect(x, gy, width, gh, text_color(15))
- else
- gb = width
- end
- self.contents.fill_rect(x, gy, gb, gh, gc0)
- gw = gb * battler.hp / battler.maxhp
- self.contents.gradient_fill_rect(x, gy, gw, gh, gc1, gc2)
- end
- #--------------------------------------------------------------------------
- # overwrite method: draw_enemy_mp_gauge
- #--------------------------------------------------------------------------
- def draw_enemy_mp_gauge(battler, x, y, width = 120, height = nil)
- battler.mp = [battler.mp, battler.maxmp].min
- gc0 = gauge_back_color
- gc1 = text_color(battler.enemy.quick_gauge[:mp_gauge1])
- gc2 = text_color(battler.enemy.quick_gauge[:mp_gauge1])
- gh = 6
- gy = y + WLH - 8 - (gh - 6)
- if battler.maxmp < battler.base_maxmp and battler.base_maxmp > 0 and
- !(battler.base_maxmp > battler.maxmp_limit)
- gb = width * battler.maxmp / battler.base_maxmp
- self.contents.fill_rect(x, gy, width, gh, text_color(7))
- else
- gb = width
- end
- self.contents.fill_rect(x, gy, gb, gh, gc0)
- if battler.maxmp <= 0
- if battler.base_maxmp <= 0
- gw = width
- else
- gw = 0
- end
- else
- gw = gb * battler.mp / battler.maxmp
- end
- self.contents.gradient_fill_rect(x, gy, gw, gh, gc1, gc2)
- end
- end # Window_Base
- #===============================================================================
- # Window_EnemyGauge
- #===============================================================================
- class Window_EnemyGauge < Window_Base
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 120, WLH*3+32)
- self.visible = false
- self.opacity = 0
- self.back_opacity = 0
- end
- #--------------------------------------------------------------------------
- # battler=
- #--------------------------------------------------------------------------
- def battler=(battler)
- @battler = battler
- self.visible = true
- self.width = @battler.enemy.quick_gauge[:width]
- self.x = @battler.screen_x - self.width/2
- self.y = @battler.screen_y - self.height/2 - WLH + 12
- create_contents
- refresh
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- dy = 0
- sw = self.width - 32
- draw_actor_state(@battler, 0, WLH, sw) if @battler.enemy.quick_gauge[:states]
- dy += WLH+8
- if @battler.enemy.quick_gauge[:show_hp]
- draw_back_gauge(0, dy, sw)
- draw_enemy_hp_gauge(@battler, 1, dy+1, sw-2)
- dy += 7
- end
- if @battler.enemy.quick_gauge[:show_mp]
- draw_back_gauge(0, dy, self.width-32)
- if $imported["BattleEngineMelody"] and @battler.use_rage?
- draw_actor_rage_gauge(@battler, 1, dy+1, sw/2-1)
- draw_enemy_mp_gauge(@battler, sw/2+1, dy+1, sw/2-2)
- else
- draw_enemy_mp_gauge(@battler, 1, dy+1, sw-2)
- end
- dy += 7
- end
- end
- #--------------------------------------------------------------------------
- # new method: draw_back_gauge
- #--------------------------------------------------------------------------
- def draw_back_gauge(x, y, width = 120)
- self.contents.fill_rect(x, y + WLH - 8, width, 8, gauge_back_color)
- end
- end # Window_EnemyGauge
- #===============================================================================
- # Window_TargetScanHelp
- #===============================================================================
- class Window_TargetScanHelp < Window_Base
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- settings = YEZ::SCAN::HELP_WINDOW
- super(settings[:x], settings[:y], settings[:width], settings[:height])
- if settings[:trans]
- self.back_opacity = 0
- self.opacity = 0
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_icon(YEZ::SCAN::HELP_WINDOW[:icon], 0, 0)
- text = YEZ::SCAN::HELP_WINDOW[:text]
- self.contents.draw_text(24, 0, self.width-56, WLH, text, 0)
- end
- end # Window_TargetScanHelp
- #===============================================================================
- # Window_ScanHelp
- #===============================================================================
- class Window_ScanHelp < Window_Base
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, Graphics.width, 56)
- self.back_opacity = 255
- self.openness = 0
- self.active = false
- self.z = 10001
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh(battler)
- self.contents.clear
- @battler = battler
- return if @battler == nil
- text = @battler.name
- if $imported["EnemyLevels"]
- text = sprintf(YEZ::ENEMY_LEVEL::LEVEL_TEXT, @battler.level, text)
- end
- c_width = contents.text_size(text).width
- dx = (self.width-32)/2 - c_width/2
- self.contents.draw_text(dx, 0, c_width, WLH, text)
- end
- end # Window_ScanHelp
- #===============================================================================
- # Window_ScanData
- #===============================================================================
- class Window_ScanData < Window_Base
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0, Graphics.height - 128, Graphics.width, 128)
- self.back_opacity = 255
- self.openness = 0
- self.active = false
- self.z = 10002
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh(battler)
- self.contents.clear
- @battler = battler
- return if @battler == nil
- @text = @battler.enemy.scan_description
- draw_enemy_description(@text)
- end
- #--------------------------------------------------------------------------
- # draw_enemy_description
- #--------------------------------------------------------------------------
- def draw_enemy_description(text)
- dx = 4; dy = 0; txsize = Font.default_size; nwidth = Graphics.width * 8
- text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
- text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
- text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
- lines = text.split(/(?:[|]|\\n)/i)
- lines.each_with_index { |l, i| l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
- self.contents.draw_text(dx, i * (txsize + 4) + dy, nwidth, WLH, l, 0)}
- end
- end # Window_ScanData
- #===============================================================================
- # Window_ScanSkills
- #===============================================================================
- class Window_ScanSkills < Window_Selectable
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(battler)
- @battler = battler
- @id = @battler.enemy.id
- dx = Graphics.width/2-16
- super(dx, 80, Graphics.width - dx, Graphics.height - 208)
- self.active = false
- self.back_opacity = 0
- self.opacity = 0
- self.z = 10003
- refresh
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- for skill in @battler.total_skills
- @data.push(skill)
- end
- @item_max = @data.size
- self.index = 0 if @item_max > 7
- create_contents
- for i in 0..(@item_max-1); draw_item(i); end
- end
- #--------------------------------------------------------------------------
- # draw_item
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- skill = @data[index]
- return if skill == nil
- rect.width -= 4
- $game_system.scanned_skills[@id] = [] if
- $game_system.scanned_skills[@id] == nil
- if $game_system.scanned_skills[@id].include?(skill.id) or
- !YEZ::SCAN::REQUIRE_SCAN
- enabled = true
- icon = skill.icon_index
- name = skill.name
- else
- enabled = false
- icon = YEZ::SCAN::HIDDEN_SKILL_ICON
- mask = "?"
- name = mask * skill.name.scan(/./).size
- end
- draw_icon(icon, rect.x, rect.y, enabled)
- if $imported["JobSystemSkillLevels"] and enabled
- draw_skill_level(rect.x, rect.y, skill, @battler)
- end
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(rect.x + 24, rect.y, self.width-56, WLH, name)
- end
- end # Window_ScanSkills
- #===============================================================================
- # Window_ScanSpoils
- #===============================================================================
- class Window_ScanSpoils < Window_Selectable
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(battler)
- @battler = battler
- @enemy = @battler.enemy
- dx = Graphics.width/2-16
- super(dx, 56, Graphics.width - dx, Graphics.height - 184)
- self.active = false
- self.back_opacity = 0
- self.opacity = 0
- self.z = 10004
- refresh
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- @data = [:encounters, :defeated, :escaped, :exp, :gold]
- drops = [:spoils]
- drops += [@battler.drop_item1] if @battler.drop_item1.kind != 0
- drops += [@battler.drop_item2] if @battler.drop_item2.kind != 0
- drops += @battler.extra_drop_items if $imported["ExtraDropItem"]
- @data += drops if drops.size > 1
- @data -= [nil]
- @item_max = @data.size
- self.index = 0 if @item_max > 8
- create_contents
- for i in 0..(@item_max-1); draw_item(i); end
- end
- #--------------------------------------------------------------------------
- # draw_item
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- item = @data[index]
- return if item == nil
- self.contents.font.color = system_color
- masked = false; enabled = true
- if item == :encounters
- icon = YEZ::SCAN::VICTORY_SETTINGS[:encounters][0]
- name = YEZ::SCAN::VICTORY_SETTINGS[:encounters][1]
- $game_system.scanned_encounters[@enemy.id] = 0 if
- $game_system.scanned_encounters[@enemy.id] == nil
- value = $game_system.scanned_encounters[@enemy.id]
- value = sprintf(YEZ::SCAN::VICTORY_SETTINGS[:encounters][2], value)
- elsif item == :defeated
- icon = YEZ::SCAN::VICTORY_SETTINGS[:defeated][0]
- name = YEZ::SCAN::VICTORY_SETTINGS[:defeated][1]
- $game_system.scanned_defeated[@enemy.id] = 0 if
- $game_system.scanned_defeated[@enemy.id] == nil
- value = $game_system.scanned_defeated[@enemy.id]
- value = sprintf(YEZ::SCAN::VICTORY_SETTINGS[:defeated][2], value)
- elsif item == :escaped
- icon = YEZ::SCAN::VICTORY_SETTINGS[:escaped][0]
- name = YEZ::SCAN::VICTORY_SETTINGS[:escaped][1]
- $game_system.scanned_escaped[@enemy.id] = 0 if
- $game_system.scanned_escaped[@enemy.id] == nil
- value = $game_system.scanned_escaped[@enemy.id]
- value = sprintf(YEZ::SCAN::VICTORY_SETTINGS[:defeated][2], value)
- elsif item == :exp
- icon = YEZ::SCAN::VICTORY_SETTINGS[:exp][0]
- name = YEZ::SCAN::VICTORY_SETTINGS[:exp][1]
- $game_system.scanned_defeated[@enemy.id] = 0 if
- $game_system.scanned_defeated[@enemy.id] == nil
- if $game_system.scanned_defeated[@enemy.id] > 0
- value = sprintf(YEZ::SCAN::VICTORY_SETTINGS[:exp][2], @battler.exp)
- else
- value = "???"
- end
- elsif item == :gold
- icon = YEZ::SCAN::VICTORY_SETTINGS[:gold][0]
- name = YEZ::SCAN::VICTORY_SETTINGS[:gold][1]
- $game_system.scanned_defeated[@enemy.id] = 0 if
- $game_system.scanned_defeated[@enemy.id] == nil
- if $game_system.scanned_defeated[@enemy.id] > 0
- value = sprintf(YEZ::SCAN::VICTORY_SETTINGS[:gold][2], @battler.gold)
- else
- value = "???"
- end
- elsif item == :spoils
- self.contents.font.color = system_color
- text = YEZ::SCAN::VICTORY_SETTINGS[:spoils][1]
- self.contents.draw_text(rect.x, rect.y, rect.width, WLH, text, 1)
- return
- else
- masked = true
- self.contents.font.color = normal_color
- case item.kind
- when 1
- drop_item = $data_items[item.item_id]
- $game_system.scanned_drop_item[@enemy.id] = [] if
- $game_system.scanned_drop_item[@enemy.id] == nil
- masked = false if
- $game_system.scanned_drop_item[@enemy.id].include?(drop_item.id)
- when 2
- drop_item = $data_weapons[item.weapon_id]
- $game_system.scanned_drop_weapon[@enemy.id] = [] if
- $game_system.scanned_drop_weapon[@enemy.id] == nil
- masked = false if
- $game_system.scanned_drop_weapon[@enemy.id].include?(drop_item.id)
- when 3
- drop_item = $data_armors[item.armor_id]
- $game_system.scanned_drop_armour[@enemy.id] = [] if
- $game_system.scanned_drop_armour[@enemy.id] == nil
- masked = false if
- $game_system.scanned_drop_armour[@enemy.id].include?(drop_item.id)
- else; return
- end
- icon = drop_item.icon_index
- name = drop_item.name
- if $imported["ExtraDropItem"] and item.drop_prob > 0
- value = sprintf("%d%%", item.drop_prob)
- else
- value = sprintf("%d%%", 1 * 100 /item.denominator)
- end
- masked = false if !YEZ::SCAN::REQUIRE_SCAN or
- (!YEZ::SCAN::UNLOCK_INDIVIDUAL_DROPS and
- $game_system.scanned_defeated[@enemy.id] > 0) or
- $game_system.scanned["DROPS"].include?(@enemy.id)
- end
- if masked
- icon = YEZ::SCAN::HIDDEN_DROP_ICON
- mask = "?"; value = "??%"
- name = mask * name.scan(/./).size
- enabled = false
- self.contents.font.color.alpha = 128
- end
- draw_icon(icon, rect.x, rect.y, enabled)
- self.contents.draw_text(rect.x+24, rect.y, 172, WLH, name)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(rect.x+24, rect.y, rect.width-24, WLH, value, 2)
- end
- end # Window_ScanSpoils
- #===============================================================================
- # Window_ScanQuery
- #===============================================================================
- class Window_ScanQuery < Window_Base
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- @help_window = Window_ScanHelp.new
- @data_window = Window_ScanData.new
- dh = Graphics.height - @help_window.height - @data_window.height
- super(0, @help_window.height, Graphics.width, dh)
- self.back_opacity = 255
- self.openness = 0
- self.active = false
- self.z = 10000
- end
- #--------------------------------------------------------------------------
- # dispose
- #--------------------------------------------------------------------------
- def dispose
- @help_window.dispose
- @data_window.dispose
- super
- end
- #--------------------------------------------------------------------------
- # appear
- #--------------------------------------------------------------------------
- def appear(host_window, battler)
- @host_window = host_window
- @host_window.active = false
- @battler = battler
- @enemy = battler.enemy
- self.active = true
- Sound.play_decision
- @help_window.refresh(@battler)
- @help_window.openness = 255
- @data_window.refresh(@battler)
- @data_window.openness = 255
- @page = 0
- create_pages
- refresh
- self.open
- end
- #--------------------------------------------------------------------------
- # disappear
- #--------------------------------------------------------------------------
- def disappear
- @host_window.active = true
- self.active = false
- @help_window.openness = 0
- @data_window.openness = 0
- @battler_states = nil
- if @skill_window != nil
- @skill_window.dispose
- @skill_window = nil
- end
- if @spoils_window != nil
- @spoils_window.dispose
- @spoils_window = nil
- end
- self.close
- end
- #--------------------------------------------------------------------------
- # create_pages
- #--------------------------------------------------------------------------
- def create_pages
- @data = []
- for page in YEZ::SCAN::PAGE_ORDER
- case page
- when :general
- next if @enemy.hidden_pages.include?("GENERAL")
- when :element
- next if @enemy.hidden_pages.include?("ELEMENT")
- $game_system.scanned_elements[@enemy.id] = [] if
- $game_system.scanned_elements[@enemy.id] == nil
- next if $game_system.scanned_elements[@enemy.id] == [] and
- YEZ::SCAN::REQUIRE_SCAN
- when :states
- next if @enemy.hidden_pages.include?("STATES")
- $game_system.scanned_states[@enemy.id] = [] if
- $game_system.scanned_states[@enemy.id] == nil
- next if $game_system.scanned_states[@enemy.id] == [] and
- YEZ::SCAN::REQUIRE_SCAN
- when :skills
- next if @enemy.hidden_pages.include?("SKILLS")
- $game_system.scanned_skills[@enemy.id] = [] if
- $game_system.scanned_skills[@enemy.id] == nil
- next if $game_system.scanned_skills[@enemy.id] == [] and
- YEZ::SCAN::REQUIRE_SCAN
- if @skill_window == nil
- @skill_window = Window_ScanSkills.new(@battler)
- @skill_window.openness = 0
- end
- when :victory
- next if @enemy.hidden_pages.include?("VICTORY")
- if @spoils_window == nil
- @spoils_window = Window_ScanSpoils.new(@battler)
- end
- else; next
- end
- @data.push(page)
- end
- end
- #--------------------------------------------------------------------------
- # update
- #--------------------------------------------------------------------------
- def update
- @help_window.update
- @data_window.update
- @skill_window.update if @skill_window != nil
- @spoils_window.update if @spoils_window != nil
- super
- return unless self.active
- if Input.repeat?(Input::LEFT)
- return if @data.size <= 1
- YEZ::SCAN::PAGE_SOUND.play if YEZ::SCAN::PAGE_SOUND != nil
- @page -= 1
- @page = [@data.size-1, 0].max if @page < 0
- refresh
- elsif Input.repeat?(Input::RIGHT)
- return if @data.size <= 1
- YEZ::SCAN::PAGE_SOUND.play if YEZ::SCAN::PAGE_SOUND != nil
- @page += 1
- @page = 0 if @page + 1 > @data.size
- refresh
- elsif Input.trigger?(Input::X)
- return if @data.size <= 1
- return if @page == 0
- YEZ::SCAN::PAGE_SOUND.play if YEZ::SCAN::PAGE_SOUND != nil
- @page = 0
- refresh
- elsif Input.trigger?(Input::Y)
- return if @data.size <= 1
- return if @page == [@data.size-1, 0].max
- YEZ::SCAN::PAGE_SOUND.play if YEZ::SCAN::PAGE_SOUND != nil
- @page = [@data.size-1, 0].max
- refresh
- elsif ($TEST or $BTEST) and Input.trigger?(Input::F5)
- Sound.play_equip
- $game_system.full_scan(@battler)
- create_pages
- @page = 0
- refresh
- @skill_window.refresh if @skill_window != nil
- @spoils_window.refresh if @spoils_window != nil
- elsif Input.trigger?(Input::B) or Input.trigger?(Input::C) or
- Input.trigger?(YEZ::SCAN::SCAN_BUTTON)
- if Input.trigger?(Input::C)
- Sound.play_decision
- else
- Sound.play_cancel
- end
- disappear
- end
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.size = Font.default_size
- self.contents.font.color = normal_color
- if @skill_window != nil
- @skill_window.openness = 0
- @skill_window.active = false
- end
- if @spoils_window != nil
- @spoils_window.openness = 0
- @spoils_window.active = false
- end
- draw_enemy_bitmap
- case @data[@page]
- when :general; draw_general_page
- when :element; draw_element_page
- when :states; draw_states_page
- when :skills; draw_skills_page
- when :victory; draw_victory_page
- end
- end
- #--------------------------------------------------------------------------
- # draw_enemy_bitmap
- #--------------------------------------------------------------------------
- def draw_enemy_bitmap
- enemybit = Cache.battler(@battler.battler_name, @battler.battler_hue)
- bw = enemybit.width
- bh = enemybit.height
- if bw > (self.width - 32)/2 - 24
- bw = (self.width - 32)/2 - 24
- bh *= (self.width - 32)/2 - 24
- bh /= enemybit.width
- end
- if bh > (self.height - 32)
- bh = (self.height - 32)
- bw *= (self.height - 32)
- bw /= enemybit.height
- end
- rect = Rect.new(0, 0, bw, bh)
- rect.x = ((self.width - 32)/2 - 24 - rect.width) / 2
- rect.y = (self.height - 32 - rect.height) / 2
- self.contents.stretch_blt(rect, enemybit, enemybit.rect)
- end
- #--------------------------------------------------------------------------
- # draw_general_page
- #--------------------------------------------------------------------------
- def draw_general_page
- dy = WLH*6 + 9
- color = Color.new(0, 0, 0, 80)
- self.contents.fill_rect(0, dy, (self.width - 32)/2 - 24, WLH*3, color)
- draw_general_states_list
- draw_actor_stun(@battler, 1, dy - WLH) if $imported["ClassStatDUR"]
- draw_enemy_hp(@battler, 1, dy, (self.width-32)/2 - 26); dy += WLH
- draw_enemy_mp(@battler, 1, dy, (self.width-32)/2 - 26)
- dy = WLH*8 - (YEZ::SCAN::STAT_COLUMN1.size*WLH) + 9
- draw_enemy_stats(YEZ::SCAN::STAT_COLUMN1, (self.width-32)/2, dy)
- draw_enemy_stats(YEZ::SCAN::STAT_COLUMN2, (self.width-32)*3/4, dy)
- draw_general_elements
- draw_general_states if YEZ::SCAN::STAT_COLUMN1.size <= 4
- end
- #--------------------------------------------------------------------------
- # draw_general_states_list
- #--------------------------------------------------------------------------
- def draw_general_states_list
- count = 0; dx = 0; dy = 0
- @battler_states = @battler.states.clone if @battler_states == nil
- for state in @battler_states
- next if state.icon_index == 0
- next if $imported["CoreFixesUpgradesMelody"] and state.hide_state
- draw_icon(state.icon_index, dx + 24 * count, dy)
- draw_state_turns(dx + 24 * count, dy, state, @battler) if
- $imported["CoreFixesUpgradesMelody"]
- count += 1
- if (24 * count > (self.width-32)/2 - 24)
- dx = 0; dy += WLH; count = 0
- end
- end
- self.contents.font.color = normal_color
- self.contents.font.bold = Font.default_bold
- self.contents.font.size = Font.default_size
- end
- #--------------------------------------------------------------------------
- # draw_enemy_hp
- #--------------------------------------------------------------------------
- def draw_enemy_hp(battler, dx, dy, dw = 120)
- draw_enemy_hp_gauge(battler, dx, dy, dw)
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 30, WLH, Vocab::hp_a)
- self.contents.font.color = hp_color(battler)
- case YEZ::SCAN::DISPLAY_HP_STYLE
- when 1 # Current Only
- if $game_system.scanned["HP"].include?(@enemy.id) or
- !YEZ::SCAN::REQUIRE_SCAN
- text = battler.hp
- else
- mask = "?"
- mask = mask * battler.hp.to_s.scan(/./).size
- text = mask
- end
- when 2 # Current / Max
- if $game_system.scanned["HP"].include?(@enemy.id) or
- !YEZ::SCAN::REQUIRE_SCAN
- text = sprintf("%s/%s", battler.hp, battler.maxhp)
- else
- mask = "?"
- mask1 = mask * battler.hp.to_s.scan(/./).size
- mask2 = mask * battler.maxhp.to_s.scan(/./).size
- text = sprintf("%s/%s", mask1, mask2)
- end
- else # Percentile
- if $game_system.scanned["HP"].include?(@enemy.id) or
- !YEZ::SCAN::REQUIRE_SCAN
- percent = battler.maxhp == 0 ? 0 : battler.hp * 100 / battler.maxhp
- text = sprintf("%s%%", percent)
- else
- mask = "?"
- percent = battler.maxhp == 0 ? 0 : battler.hp * 100 / battler.maxhp
- mask = mask * percent.to_s.scan(/./).size
- text = sprintf("%s%%", mask)
- end
- end
- self.contents.draw_text(dx + 30, dy, dw - 32, WLH, text, 2)
- end
- #--------------------------------------------------------------------------
- # draw_enemy_mp
- #--------------------------------------------------------------------------
- def draw_enemy_mp(battler, dx, dy, dw = 120)
- self.contents.font.color = system_color
- if $imported["BattleEngineMelody"] and battler.use_rage?
- draw_actor_rage_gauge(battler, dx, dy, dw/2)
- draw_enemy_mp_gauge(battler, dx + dw/2, dy, dw/2)
- self.contents.draw_text(dx+dw/2, dy, 28, WLH, Vocab::mp_a, 0)
- self.contents.draw_text(dx, dy, 28, WLH, Vocab::rage_a, 0)
- else
- draw_enemy_mp_gauge(battler, dx, dy, dw)
- self.contents.draw_text(dx, dy, 28, WLH, Vocab::mp_a, 0)
- end
- case YEZ::SCAN::DISPLAY_MP_STYLE
- when 1 # Current Only
- if $game_system.scanned["MP"].include?(@enemy.id) or
- !YEZ::SCAN::REQUIRE_SCAN
- text = battler.mp
- else
- mask = "?"
- mask = mask * battler.mp.to_s.scan(/./).size
- text = mask
- end
- when 2 # Current / Max
- if $game_system.scanned["MP"].include?(@enemy.id) or
- !YEZ::SCAN::REQUIRE_SCAN
- text = sprintf("%s/%s", battler.mp, battler.maxmp)
- else
- mask = "?"
- mask1 = mask * battler.mp.to_s.scan(/./).size
- mask2 = mask * battler.maxmp.to_s.scan(/./).size
- text = sprintf("%s/%s", mask1, mask2)
- end
- else
- if $game_system.scanned["MP"].include?(@enemy.id) or
- !YEZ::SCAN::REQUIRE_SCAN
- percent = battler.maxmp == 0 ? 0 : battler.mp * 100 / battler.maxmp
- text = sprintf("%s%%", percent)
- else
- mask = "?"
- percent = battler.maxmp == 0 ? 0 : battler.mp * 100 / battler.maxmp
- mask = mask * percent.to_s.scan(/./).size
- text = sprintf("%s%%", mask)
- end
- end # Percentile
- if $imported["BattleEngineMelody"] and battler.use_rage?
- self.contents.font.color = normal_color
- if $game_system.scanned["MP"].include?(@enemy.id) or
- !YEZ::SCAN::REQUIRE_SCAN
- value = battler.rage
- else
- value = "???"
- end
- self.contents.draw_text(dx+20, dy, dw/2-22, WLH, value, 2)
- self.contents.font.color = mp_color(battler)
- self.contents.draw_text(dx+dw/2+20, dy, dw/2-22, WLH, text, 2)
- else
- self.contents.font.color = mp_color(battler)
- self.contents.draw_text(dx + 30, dy, dw - 32, WLH, text, 2)
- end
- end
- #--------------------------------------------------------------------------
- # draw_enemy_stats
- #--------------------------------------------------------------------------
- def draw_enemy_stats(array, dx, dy)
- self.contents.font.size = YEZ::SCAN::STAT_FONT_SIZE
- masked = !($game_system.scanned["STATS"].include?(@enemy.id) or
- !YEZ::SCAN::REQUIRE_SCAN)
- count = 0; mask = "?"
- for type in array
- # up_icon = YEM::BATTLE_ENGINE::STATUS::AFFINITY_RANKS[:up]
- # dn_icon = YEM::BATTLE_ENGINE::STATUS::AFFINITY_RANKS[:down]
- case type
- when :atk
- # up_icon = YEM::ICON[:upatk] if $imported["Icons"]
- # dn_icon = YEM::ICON[:dnatk] if $imported["Icons"]
- icon = $imported["Icons"] ? YEM::ICON[:atk] : 693
- icon = 50 if @battler.atk > @battler.base_atk
- icon = 57 if @battler.atk < @battler.base_atk
- value = masked ? mask * @battler.atk.to_s.scan(/./).size : @battler.atk
- name = Vocab.atk
- when :def
- # up_icon = YEM::ICON[:updef] if $imported["Icons"]
- # dn_icon = YEM::ICON[:dndef] if $imported["Icons"]
- icon = $imported["Icons"] ? YEM::ICON[:def] : 694
- icon = 51 if @battler.def > @battler.base_def
- icon = 58 if @battler.def < @battler.base_def
- value = masked ? mask * @battler.def.to_s.scan(/./).size : @battler.def
- name = Vocab.def
- when :spi
- # up_icon = YEM::ICON[:upspi] if $imported["Icons"]
- # dn_icon = YEM::ICON[:dnspi] if $imported["Icons"]
- icon = $imported["Icons"] ? YEM::ICON[:spi] : 695
- icon = 52 if @battler.spi > @battler.base_spi
- icon = 59 if @battler.spi < @battler.base_spi
- value = masked ? mask * @battler.spi.to_s.scan(/./).size : @battler.spi
- name = Vocab.spi
- when :agi
- # up_icon = YEM::ICON[:upagi] if $imported["Icons"]
- # dn_icon = YEM::ICON[:dnagi] if $imported["Icons"]
- icon = $imported["Icons"] ? YEM::ICON[:agi] : 696
- # Down here, "icon = " can be changed to the appropriate boosted stat
- # icon in the IconSet file!
- icon = 53 if @battler.agi > @battler.base_agi
- icon = 60 if @battler.agi < @battler.base_agi
- value = masked ? mask * @battler.agi.to_s.scan(/./).size : @battler.agi
- name = Vocab.agi
- when :hit
- icon = $imported["Icons"] ? YEM::ICON[:hit] : 698
- if masked
- value = mask * [[@battler.hit, 0].max, 99].min.to_s.scan(/./).size
- else
- value = [[@battler.hit, 0].max, 99].min
- end
- value = sprintf("%s%%", value)
- name = Vocab.hit
- when :eva
- icon = $imported["Icons"] ? YEM::ICON[:eva] : 699
- if masked
- value = mask * [[@battler.eva, 0].max, 99].min.to_s.scan(/./).size
- else
- value = [[@battler.eva, 0].max, 99].min
- end
- value = sprintf("%s%%", value)
- name = Vocab.eva
- when :cri
- icon = $imported["Icons"] ? YEM::ICON[:cri] : 0
- if masked
- value = mask * [[@battler.cri, 0].max, 99].min.to_s.scan(/./).size
- else
- value = [[@battler.cri, 0].max, 99].min
- end
- value = sprintf("%s%%", value)
- name = Vocab.cri
- when :odds
- icon = $imported["Icons"] ? YEM::ICON[:odds] : 0
- n = 0
- for member in $game_troop.existing_members; n += member.odds; end
- if masked
- value = mask *[[@battler.odds*100/n,1].max,99].min.to_s.scan(/./).size
- else
- value = [[@battler.odds * 100 / n, 1].max, 99].min
- end
- value = sprintf("%s%%", value)
- name = Vocab.odds
- when :res
- next unless $imported["RES Stat"]
- # up_icon = YEM::ICON[:upres] if $imported["Icons"]
- # dn_icon = YEM::ICON[:dnres] if $imported["Icons"]
- icon = $imported["Icons"] ? YEM::ICON[:res] : 700
- # icon = up_icon if @battler.res > @battler.base_res
- # icon = dn_icon if @battler.res < @battler.base_res
- value = masked ? mask * @battler.res.to_s.scan(/./).size : @battler.res
- name = Vocab.res
- when :dex
- next unless $imported["DEX Stat"]
- # up_icon = YEM::ICON[:updex] if $imported["Icons"]
- # dn_icon = YEM::ICON[:dndex] if $imported["Icons"]
- icon = $imported["Icons"] ? YEM::ICON[:dex] : 701
- icon = 55 if @battler.dex > @battler.base_dex
- icon = 62 if @battler.dex < @battler.base_dex
- value = masked ? mask * @battler.dex.to_s.scan(/./).size : @battler.dex
- name = Vocab.dex
- when :luk
- next unless $imported["ClassStatLUK"]
- # up_icon = YEM::ICON[:upluk] if $imported["Icons"]
- # dn_icon = YEM::ICON[:dnluk] if $imported["Icons"]
- icon = $imported["Icons"] ? YEM::ICON[:luk] : 0
- icon = up_icon if @battler.luk > @battler.base_luk
- icon = dn_icon if @battler.luk < @battler.base_luk
- value = masked ? mask * @battler.luk.to_s.scan(/./).size : @battler.luk
- name = Vocab.luk
- when :dur
- next unless $imported["ClassStatDUR"]
- icon = $imported["Icons"] ? YEM::ICON[:dur] : 0
- value = masked ? mask * @battler.max_dur.to_s.scan(/./).size :
- @battler.max_dur
- name = Vocab.dur
- else; next
- end
- draw_icon(icon, dx, dy)
- self.contents.font.color = system_color
- self.contents.draw_text(dx+24, dy, 40, WLH, name, 0)
- self.contents.font.color = normal_color
- self.contents.draw_text(dx+64, dy, 52, WLH, value, 2)
- dy += WLH; count += 1
- break if count > 6
- end
- end
- #--------------------------------------------------------------------------
- # draw_general_elements
- #--------------------------------------------------------------------------
- def draw_general_elements
- $game_system.scanned_elements[@enemy.id] = [] if
- $game_system.scanned_elements[@enemy.id] == nil
- self.contents.font.size = YEZ::SCAN::GENERAL_ELEMENT_FONT_SIZE
- dy = 0; dx = (self.width-32) * 3/4
- spacing = YEZ::SCAN::GENERAL_ELEMENT_SPACING
- dx -= YEZ::SCAN::SHOWN_ELEMENTS_LIST.size * spacing/2
- for ele_id in YEZ::SCAN::SHOWN_ELEMENTS_LIST
- next if ele_id > $data_system.elements.size
- icon = YEZ::SCAN::ELEMENT_ICONS[ele_id]
- draw_icon(icon, dx + (spacing-24)/2, dy)
- if $game_system.scanned_elements[@enemy.id].include?(ele_id) or
- !YEZ::SCAN::REQUIRE_SCAN
- rate = @battler.element_rate(ele_id)
- text = sprintf("%+d%%", rate - 100)
- if rate > 200; setting = :srank
- elsif rate > 150; setting = :arank
- elsif rate > 100; setting = :brank
- elsif rate > 50; setting = :crank
- elsif rate > 0; setting = :drank
- elsif rate == 0; setting = :erank
- else
- setting = :frank
- text = sprintf("%d%%", rate * -1)
- end
- else
- setting = :nodata
- text = "-"
- end
- colour = YEZ::SCAN::RANK_SETTINGS[setting][0]
- self.contents.font.color = text_color(colour)
- self.contents.draw_text(dx+2, dy+WLH, spacing-4, WLH, text, 1)
- dx += spacing
- end
- end
- #--------------------------------------------------------------------------
- # draw_general_states
- #--------------------------------------------------------------------------
- def draw_general_states
- $game_system.scanned_states[@enemy.id] = [] if
- $game_system.scanned_states[@enemy.id] == nil
- self.contents.font.size = YEZ::SCAN::GENERAL_ELEMENT_FONT_SIZE
- dy = WLH*2+4; dx = (self.width-32) * 3/4
- spacing = YEZ::SCAN::GENERAL_ELEMENT_SPACING
- dx -= YEZ::SCAN::SHOWN_STATES_LIST.size * spacing/2
- for state_id in YEZ::SCAN::SHOWN_STATES_LIST
- state = $data_states[state_id]
- next if state == nil
- icon = state.icon_index
- draw_icon(icon, dx + (spacing-24)/2, dy)
- if $game_system.scanned_states[@enemy.id].include?(state_id) or
- !YEZ::SCAN::REQUIRE_SCAN
- rate = @battler.state_probability(state_id)
- text = sprintf("%d%%", rate)
- if rate > 100; setting = :srank
- elsif rate > 80; setting = :arank
- elsif rate > 60; setting = :brank
- elsif rate > 40; setting = :crank
- elsif rate > 20; setting = :drank
- elsif rate > 0; setting = :erank
- else; setting = :frank
- end
- else
- setting = :nodata
- text = "-"
- end
- colour = YEZ::SCAN::RANK_SETTINGS[setting][0]
- self.contents.font.color = text_color(colour)
- self.contents.draw_text(dx+2, dy+WLH, spacing-4, WLH, text, 1)
- dx += spacing
- end
- end
- #--------------------------------------------------------------------------
- # draw_element_page
- #--------------------------------------------------------------------------
- def draw_element_page
- dx = (self.width-32)/2; dy = 0; dw = (self.width-32)/5
- for ele_id in YEZ::SCAN::SHOWN_ELEMENTS_LIST
- next if ele_id > $data_system.elements.size
- self.contents.font.color = normal_color
- self.contents.font.size = Font.default_size
- icon = YEZ::SCAN::ELEMENT_ICONS[ele_id]
- draw_icon(icon, dx, dy)
- name = $data_system.elements[ele_id]
- self.contents.draw_text(dx+24, dy, dw-24, WLH, name, 0)
- if $game_system.scanned_elements[@enemy.id].include?(ele_id) or
- !YEZ::SCAN::REQUIRE_SCAN
- rate = @battler.element_rate(ele_id)
- text = sprintf("%+d%%", rate - 100)
- if rate > 200; setting = :srank
- elsif rate > 150; setting = :arank
- elsif rate > 100; setting = :brank
- elsif rate > 50; setting = :crank
- elsif rate > 0; setting = :drank
- elsif rate == 0; setting = :erank
- else
- setting = :frank
- text = sprintf("%d%%", rate * -1)
- end
- colour = YEZ::SCAN::RANK_SETTINGS[setting][0]
- data = YEZ::SCAN::RANK_SETTINGS[setting][1]
- else
- colour = YEZ::SCAN::RANK_SETTINGS[:nodata][0]
- data = YEZ::SCAN::RANK_SETTINGS[:nodata][1]
- text = "---"
- end
- self.contents.font.color = text_color(colour)
- self.contents.draw_text(dx+dw, dy, dw/2, WLH, text, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(dx+dw*3/2+12, dy, dw-12, WLH, data, 0)
- dy += WLH
- end
- end
- #--------------------------------------------------------------------------
- # draw_states_page
- #--------------------------------------------------------------------------
- def draw_states_page
- dx = (self.width-32)/2; dy = 0; dw = (self.width-32)/5
- for state_id in YEZ::SCAN::SHOWN_STATES_LIST
- state = $data_states[state_id]
- next if state == nil
- self.contents.font.color = normal_color
- self.contents.font.size = Font.default_size
- icon = state.icon_index
- draw_icon(icon, dx, dy)
- name = state.name
- self.contents.draw_text(dx+24, dy, dw-24, WLH, name, 0)
- if $game_system.scanned_states[@enemy.id].include?(state_id) or
- !YEZ::SCAN::REQUIRE_SCAN
- rate = @battler.state_probability(state_id)
- text = sprintf("%d%%", rate)
- if rate >= 100; setting = :srank
- elsif rate > 80; setting = :arank
- elsif rate > 60; setting = :brank
- elsif rate > 40; setting = :crank
- elsif rate > 20; setting = :drank
- elsif rate > 0; setting = :erank
- else; setting = :frank
- end
- colour = YEZ::SCAN::RANK_SETTINGS[setting][0]
- data = YEZ::SCAN::RANK_SETTINGS[setting][2]
- else
- colour = YEZ::SCAN::RANK_SETTINGS[:nodata][0]
- data = YEZ::SCAN::RANK_SETTINGS[:nodata][2]
- text = "---"
- end
- self.contents.font.color = text_color(colour)
- self.contents.draw_text(dx+dw, dy, dw/2, WLH, text, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(dx+dw*3/2+12, dy, dw-12, WLH, data, 0)
- dy += WLH
- end
- end
- #--------------------------------------------------------------------------
- # draw_skills_page
- #--------------------------------------------------------------------------
- def draw_skills_page
- self.contents.font.color = system_color
- text = YEZ::SCAN::SKILL_TITLE
- dx = (self.width-32)/2
- self.contents.draw_text(dx, 0, dx, WLH, text, 1)
- @skill_window.openness = 255
- @skill_window.active = true
- end
- #--------------------------------------------------------------------------
- # draw_victory_page
- #--------------------------------------------------------------------------
- def draw_victory_page
- dx = (self.width-32)/2; dy = 0
- @spoils_window.openness = 255
- @spoils_window.active = true
- end
- end # Window_ScanQuery
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================