Guest User

Untitled

a guest
Nov 20th, 2011
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 84.42 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Yanfly Engine Zealous - Enemy Scan Query
  4. # Last Date Updated: 2010.01.27
  5. # Level: Easy, Normal, Hard
  6. #
  7. # Sometimes it's hard to keep track of an enemy's capabilities as players go
  8. # through a game. With the aid of a scan skill, the player can view enemy data
  9. # to recollect their thoughts and recalculate their strategies. However, unlike
  10. # most scan skills found in most commercial RPG's, the scan window can be
  11. # accessed whenever the player can target the enemy rather than requiring the
  12. # player to manually cast a scan skill on the enemy each turn.
  13. #
  14. # The scan windows will provide basic stat information, elemental and status
  15. # resistances, a skill list, and finally, a drop list. This information will
  16. # not be available to the player straight from the get go, but instead, will
  17. # require the player to slowly (or quickly) unlock each bit of the scan data to
  18. # reveal an enemy's entire information list.
  19. #
  20. #===============================================================================
  21. # Updates
  22. # -----------------------------------------------------------------------------
  23. # o 2010.01.27 - Enemy Levels compatibility.
  24. # o 2010.01.25 - Finished Script.
  25. # o 2010.01.23 - Started Script.
  26. #===============================================================================
  27. # Instructions
  28. # -----------------------------------------------------------------------------
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # Skill and Item Tags - Insert the following tags into Skill or Item noteboxes.
  34. # -----------------------------------------------------------------------------
  35. # <scan: phrase>
  36. # This will scan a certain bit of the enemy or all of it depending on the word
  37. # you've used in place of "phrase" in the tag above. Here is a list of words
  38. # you can replace phrase with:
  39. # All - Scans all aspects of the enemy.
  40. # HP - Scans the HP aspect of the enemy.
  41. # MP - Scans the MP aspect of the enemy.
  42. # Stats - Scans the stats aspect of the enemy.
  43. # Skills - Scans the skills aspect of the enemy.
  44. # Drops - Scans the drops aspect of the enemy.
  45. #
  46. # <scan element: x> or <scan elements: x,x>
  47. # This will scan the enemy's element resistance to element ID x. Use either the
  48. # latter tag or multiple tags to include scanning for more elements. If the ID
  49. # used is not within the shown elements, this tag will have no effect. To scan
  50. # all elements, use the <scan: all elements> tag.
  51. #
  52. # <scan state: x> or <scan states: x,x>
  53. # This will scan the enemy's status resistance to the state ID x. Use multiple
  54. # tags or the latter tag to include scanning for more states. If the ID used is
  55. # not within the shown states list, this tag will have no effect. To scan all
  56. # states, use the <scan: all states> tag.
  57. #
  58. # -----------------------------------------------------------------------------
  59. # Enemy Tags - Insert the following tags into Enemy noteboxes.
  60. # -----------------------------------------------------------------------------
  61. # <hidden: phrase>
  62. # This determines which pages the enemy will have hidden even if scanned. This
  63. # is sometimes used to prevent too much information from leaking out to the
  64. # player's advantage. Replace the word "phrase" with one of the following:
  65. # general - Hides the general information page.
  66. # element - Hides the element resistance page.
  67. # states - Hides the status resistance page.
  68. # skills - Hides the skill list page.
  69. # victory - Hides the victory information page.
  70. #
  71. # <gauge width x>
  72. # When using quick scan, this will adjust the width of the quick scan bars.
  73. # Note that +32 pixels will be added onto whatever value x is in order to
  74. # prevent any user created errors you may do.
  75. #
  76. # <hide hp gauge> or <show hp gauge>
  77. # <hide mp gauge> or <show mp gauge>
  78. # <hide states gauge> or <show states gauge>
  79. # To prevent some gauges from being shown during quick scan for some specific
  80. # enemy types, use these tags to hide or show whatever respective item you wish
  81. # to enable or disable from view.
  82. #
  83. # <hp gauge x, y> or <mp gauge x, y>
  84. # This allows you to change the colours of the HP or MP gauge to whatever the
  85. # gradient values you've set for x and y. Both x and y use text colours.
  86. #
  87. # <scan description>
  88. # text
  89. # </scan description>
  90. # This adjusts the enemy scan description that appears below the enemy data when
  91. # browsing through the scan query. Use | to attach any line breaks (and to start
  92. # new lines) within the description box.
  93. #
  94. # -----------------------------------------------------------------------------
  95. # Debug Shortcuts - Only during $TEST and $BTEST mode
  96. # -----------------------------------------------------------------------------
  97. # Pressing F5 while viewing an enemy profile will reveal all of its data.
  98. #
  99. #===============================================================================
  100. # Compatibility
  101. # -----------------------------------------------------------------------------
  102. # - Works With: YEZ Battle Engine Zealous, KGC Extra Drop Item
  103. # YEZ Battler Stats and Class Stats, YEZ JP System: Skill Levels
  104. # -----------------------------------------------------------------------------
  105. # Note: This script may not work with former Yanfly Engine ReDux scripts.
  106. # Use Yanfly Engine Zealous scripts to work with this if available.
  107. #===============================================================================
  108.  
  109. $imported = {} if $imported == nil
  110. $imported["EnemyScanQuery"] = true
  111.  
  112. module YEZ
  113. module SCAN
  114.  
  115. #===========================================================================
  116. # Basic Settings
  117. # --------------------------------------------------------------------------
  118. # This area sets the basic settings used for the script. Here you adjust
  119. # the various scanning aspects such as the button used, page order, the
  120. # sound played when turning pages, etc.
  121. #===========================================================================
  122.  
  123. # This is the button used to launch the scan menu during enemy selection.
  124. SCAN_BUTTON = Input::A
  125.  
  126. # This determines the order the pages are drawn inside of the scan window.
  127. # Use the following methods below to determine which pages will appear.
  128. # :general General page. Displays the usual enemy stats.
  129. # :element Element page. Displays the enemy's elemental affinities.
  130. # :states States page. Displays the enemy's status resistances.
  131. # :skills Skills page. Displays the enemy's usable skills.
  132. # :victory Victory page. Displays the enemy's victory spoil info.
  133. PAGE_ORDER =[
  134. :general, # General page. Displays the usual enemy stats.
  135. :skills, # Skills page. Displays the enemy's usable skills.
  136. :element, # Element page. Displays the enemy's elemental affinities.
  137. :states, # States page. Displays the enemy's status resistances.
  138. :victory, # Victory page. Displays the enemy's victory spoil info.
  139. ] # Do not remove this.
  140.  
  141. # This is the sound effect that plays whenever a page is flipped inside of
  142. # the scan list. Set this to nil if you don't want a sound to play.
  143. PAGE_SOUND = RPG::SE.new("P4CLICK", 80, 100)
  144.  
  145. # If this option is set, it will require enemies to be scanned before their
  146. # full data will appear within the scan query.
  147. REQUIRE_SCAN = true
  148.  
  149. # If this feature is on, this will set some skills to have automatic scan
  150. # traits to them. For example, MP damage skills will reveal MP info. Each
  151. # of the elements will reveal elemental scan information. Things as such.
  152. AUTO_CREATE_SCAN = true
  153.  
  154. #===========================================================================
  155. # Quick Scan Settings
  156. # --------------------------------------------------------------------------
  157. # The following settings below will determine the Quick Scan settings for
  158. # the quick bars shown on the enemies. Here are the tags to override the
  159. # default settings for the quick scan bars:
  160. # <gauge width x> - Change gauge width.
  161. # <hp gauge x, y> - Change HP gauge colours.
  162. # <mp gauge x, y> - Change MP gauge colours.
  163. # <show hp gauge> - Show the HP Gauge.
  164. # <hide hp gauge> - Hide the HP Gauge.
  165. # <show mp gauge> - Show the MP Gauge.
  166. # <hide mp gauge> - Hide the MP Gauge.
  167. # <show states gauge> - Show the states gauge.
  168. # <hide states gauge> - Hide the states gauge.
  169. #===========================================================================
  170.  
  171. # Set this to true to make use of the quick scan bars. The quick scan will
  172. # show a gauge-only representation of the enemy's HP/MP status. If this is
  173. # set to false, none of the settings used below will matter.
  174. USE_QUICK_SCAN = false
  175.  
  176. # The following will determine what are the default settings in regards to
  177. # the quick scan bars.
  178. GAUGE_DEFAULTS = {
  179. # Method => Text Colour
  180. :width => 64, # Automatically, +32 added to the width.
  181. :states => true, # How many states shown depends on the width.
  182. :show_hp => true, # Show the HP gauge by default?
  183. :hp_gauge1 => 10, # HP colour 1 for gauge gradient.
  184. :hp_gauge2 => 2, # HP colour 2 for gauge gradient.
  185. :show_mp => true, # Show the MP gauge (and rage) by default?
  186. :mp_gauge1 => 9, # MP colour 1 for gauge gradient.
  187. :mp_gauge2 => 1, # MP colour 2 for gauge gradient.
  188. } # Do not remove this.
  189.  
  190. #===========================================================================
  191. # Target Help Settings
  192. # --------------------------------------------------------------------------
  193. # The scan help window will appear whenever the target enemy window appears
  194. # inside of battle. It will give the player a notice that by pressing a
  195. # certain key, the scan query windows can appear.
  196. #===========================================================================
  197.  
  198. # These settings adjust the various aspects of the scan query's help
  199. # window that appears in battle.
  200. HELP_WINDOW ={
  201. # Setting => Value
  202. :x => 416, # The X position of the window.
  203. :y => 40, # The Y position of the window.
  204. :width => 128, # The width of the window.
  205. :height => 56, # The height of the window.
  206. :trans => true, # Make the window transparent?
  207. :icon => 613, # This is the icon used at the very left side.
  208. :text => "view data",
  209. } # Do not remove this.
  210.  
  211. #===========================================================================
  212. # General Page Settings
  213. # --------------------------------------------------------------------------
  214. # This section sets up the general information regarding the general page.
  215. # The general page displays basic HP/MP information as well as basic stats
  216. # and a simplified element list.
  217. #===========================================================================
  218.  
  219. # The following will allow you to adjust how you would like for HP and MP
  220. # to appear. The following will explain how each type formats HP and MP:
  221. # - Type 1: Current
  222. # - Type 2: Current / Max
  223. # - Type 3: Percent
  224. DISPLAY_HP_STYLE = 2
  225. DISPLAY_MP_STYLE = 2
  226.  
  227. # This determines which stats are drawn in the two stat columns within
  228. # the general page as well as what font size to display them at. The items
  229. # you may place into these arrays are:
  230. # :atk, :def, :spi, :res, :dex, :agi, :hit, :eva, :cri, :luk, :dur, :odds
  231. STAT_FONT_SIZE = 16
  232. STAT_COLUMN1 = [:atk, :spi, :dex]
  233. STAT_COLUMN2 = [:def, :res, :agi]
  234.  
  235. #===========================================================================
  236. # Elements and Status Page Settings
  237. # --------------------------------------------------------------------------
  238. # The elements page will show which elements the enemy is weak against and
  239. # which elements the enemy is resistant to, immune to, or will absorb.
  240. #===========================================================================
  241.  
  242. # This is the list of elements and states that will be shown on the elements
  243. # list, states page, and general page for the scan query.
  244. SHOWN_ELEMENTS = [1..6, 8, 9] # Element 7 (Ether) is skipped
  245. SHOWN_STATES = [2..6, 8, 9, 10]
  246.  
  247. # This is the font size used for the general page. Spacing determines how
  248. # far the icons are apart from each x value.
  249. GENERAL_ELEMENT_FONT_SIZE = 14 #default: 12
  250. GENERAL_ELEMENT_SPACING = 32
  251.  
  252. # Since elements do not innately have icons, you must manually bind icons
  253. # to them in order for them to show up properly.
  254. ELEMENT_ICONS ={
  255. # ID => Icon ID
  256. 1 => 2, # Phys
  257. 2 => 18, # Fire
  258. 3 => 19, # Water
  259. 4 => 20, # Earth
  260. 5 => 21, # Wind
  261. 6 => 22, # Elec
  262. 7 => 23, # Ether
  263. 8 => 24, # Light
  264. 9 => 25, # Dark
  265. } # Do not remove this.
  266.  
  267. # Depending on the rate numbers, different ranks will use different text
  268. # colours to represent them.
  269. RANK_SETTINGS ={
  270. # Rank = > [Colour, Element, Status]
  271. :nodata => [ 0, "-----", "-----"],
  272. :srank => [ 2, "ERROR", "ERROR"], # Not used
  273. :arank => [ 2, "ERROR", "ERROR"], # Not used
  274. :brank => [ 14, "Weak", "Weak"],
  275. :crank => [ 6, "-", "-"],
  276. :drank => [ 3, "Resists", "Resists"],
  277. :erank => [ 4, "Null", "Resists"],
  278. :frank => [ 5, "Absorb", "Null"],
  279. } # Do not remove this.
  280.  
  281. #===========================================================================
  282. # Skills Page Settings
  283. # --------------------------------------------------------------------------
  284. # The skills page has a number of options for how it can unlock. Adjust the
  285. # settings appropriately below.
  286. #===========================================================================
  287.  
  288. # This is the title used for the skills page.
  289. SKILL_TITLE = "Skill List"
  290.  
  291. # This will record the skill as a part of the enemy's skill list when the
  292. # enemy uses that skill. Set false if you wish to disable this feature.
  293. SCAN_SKILL_WHEN_USED = true
  294.  
  295. # This will be the icon used to hide the skill if the skill is unscanned.
  296. HIDDEN_SKILL_ICON = 98
  297.  
  298. #===========================================================================
  299. # Victory Page Settings
  300. # --------------------------------------------------------------------------
  301. # This page will be automatic and will always unlock itself upon meeting a
  302. # new enemy. The only way for this page to not be shown is if the enemy has
  303. # the page listed in hidden pages.
  304. #===========================================================================
  305.  
  306. # This hash determines the vocabulary used for the victory page's various
  307. # text settings and whatnot.
  308. VICTORY_SETTINGS ={
  309. # Method => [Icon, Title, Display]
  310. :encounters => [ 631, "Encounters", "× %s"],
  311. :defeated => [ 626, "Defeated", "× %s"],
  312. :escaped => [ 630, "Escaped", "× %s"],
  313. :spoils => [ 632, "Drops", ""],
  314. :gold => [ 652, "Florins", "%s Florins"],
  315. :exp => [ 633, "Experience", "%s EXP"],
  316. } # Do not remove this.
  317.  
  318. # This will cause the drops to unlock themselves individually rather than
  319. # being fully revealed once an enemy is killed.
  320. UNLOCK_INDIVIDUAL_DROPS = true
  321.  
  322. # This is the icon used for hidden and masked drops.
  323. HIDDEN_DROP_ICON = 144
  324.  
  325. end # SCAN
  326. end # YEZ
  327.  
  328. #===============================================================================
  329. # Editting anything past this point may potentially result in causing computer
  330. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  331. # Therefore, edit at your own risk.
  332. #===============================================================================
  333.  
  334. module YEZ
  335. module REGEXP
  336. SCAN_TYPES = ["HP", "MP", "STATS", "SKILLS", "DROPS"]
  337. module USABLEITEM
  338.  
  339. SCAN = /<(?:SCAN|scan):[ ](.*)>/i
  340. SCAN_ELEMENT = /<(?:SCAN ELEMENT|scan elements):[ ](\d+(?:\s*,\s*\d+)*)>/i
  341. SCAN_STATES = /<(?:SCAN STATE|scan states):[ ](\d+(?:\s*,\s*\d+)*)>/i
  342.  
  343. end # USABLEITEM
  344. module ENEMY
  345.  
  346. GAUGE_WIDTH = /<(?:GAUGE_WIDTH|gauge width)[ ]*(\d+)>/i
  347. HIDE_GAUGE = /<(.*)[ ](.*)[ ](?:GAUGE|gauge)>/i
  348. HP_GAUGE = /<(?:HP_GAUGE|hp gauge)[ ]*(\d+),[ ]*(\d+)>/i
  349. MP_GAUGE = /<(?:MP_GAUGE|mp gauge)[ ]*(\d+),[ ]*(\d+)>/i
  350. HIDE_SCAN = /<(?:HIDDEN|hidden):[ ](.*)>/i
  351.  
  352. DESCRIPTION_ON = /<(?:SCAN_DESCRIPTION|scan description)>/i
  353. DESCRIPTION_OFF = /<\/(?:SCAN_DESCRIPTION|scan description)>/i
  354.  
  355. end # ENEMY
  356. end # REGEXP
  357. end # YEZ
  358. module YEZ::SCAN
  359. module_function
  360. #--------------------------------------------------------------------------
  361. # convert_integer_array
  362. #--------------------------------------------------------------------------
  363. def convert_integer_array(array)
  364. result = []
  365. array.each { |i|
  366. case i
  367. when Range; result |= i.to_a
  368. when Integer; result |= [i]
  369. end }
  370. return result
  371. end
  372. #--------------------------------------------------------------------------
  373. # converted arrays
  374. #--------------------------------------------------------------------------
  375. SHOWN_ELEMENTS_LIST = convert_integer_array(SHOWN_ELEMENTS)
  376. SHOWN_STATES_LIST = convert_integer_array(SHOWN_STATES)
  377. end # YEZ::SCAN
  378.  
  379. module Vocab
  380. def self.hit; return "HIT"; end
  381. def self.eva; return "EVA"; end
  382. def self.cri; return "CRI"; end
  383. def self.odds;return "AGR"; end
  384. end # Vocab
  385.  
  386. #===============================================================================
  387. # RPG::UsableItem
  388. #===============================================================================
  389.  
  390. class RPG::UsableItem
  391.  
  392. #--------------------------------------------------------------------------
  393. # common cache: yez_cache_usableitem_esq
  394. #--------------------------------------------------------------------------
  395. def yez_cache_usableitem_esq
  396. @scan_reveal = []; @scan_elements = []; @scan_states = []
  397. create_auto_scan if YEZ::SCAN::AUTO_CREATE_SCAN
  398.  
  399. self.note.split(/[\r\n]+/).each { |line|
  400. case line
  401. #---
  402. when YEZ::REGEXP::USABLEITEM::SCAN
  403. case $1.upcase
  404. when "HP", "MP", "SP", "STAT", "STATS", "SKILL", "SKILLS", "DROP",
  405. "DROPS"
  406. text = $1.upcase
  407. text = "MP" if text == "SP"
  408. text = "STATS" if text == "STAT"
  409. text = "SKILLS" if text == "SKILL"
  410. text = "DROPS" if text == "DROP"
  411. @scan_reveal.push(text)
  412. when "ALL ELEMENTS"
  413. @scan_elements = YEZ::SCAN::SHOWN_ELEMENTS_LIST
  414. @scan_reveal.push("ELEMENT")
  415. when "ALL STATES"
  416. @scan_states = YEZ::SCAN::SHOWN_STATES_LIST
  417. @scan_reveal.push("STATE")
  418. when "ALL"
  419. array = YEZ::REGEXP::SCAN_TYPES
  420. for item in array; @scan_reveal.push(item); end
  421. @scan_elements = YEZ::SCAN::SHOWN_ELEMENTS_LIST
  422. @scan_reveal.push("ELEMENT")
  423. @scan_states = YEZ::SCAN::SHOWN_STATES_LIST
  424. @scan_reveal.push("STATE")
  425. else; next
  426. end
  427. #---
  428. when YEZ::REGEXP::USABLEITEM::SCAN_ELEMENT
  429. @scan_reveal.push("ELEMENT")
  430. $1.scan(/\d+/).each { |num|
  431. @scan_elements.push(num.to_i) if num.to_i > 0 }
  432. #---
  433. when YEZ::REGEXP::USABLEITEM::SCAN_STATES
  434. @scan_reveal.push("STATE")
  435. $1.scan(/\d+/).each { |num|
  436. @scan_states.push(num.to_i) if num.to_i > 0 }
  437. #---
  438. end
  439. } # end self.note.split
  440. end # yez_cache_usableitem_esq
  441.  
  442. #--------------------------------------------------------------------------
  443. # new method: create_auto_scan
  444. #--------------------------------------------------------------------------
  445. def create_auto_scan
  446. @scan_reveal.push("MP") if self.damage_to_mp
  447. if self.is_a?(RPG::Item)
  448. @scan_reveal.push("MP") if self.mp_recovery_rate != 0
  449. @scan_reveal.push("MP") if self.mp_recovery != 0
  450. end
  451. if YEZ::SCAN::SHOWN_ELEMENTS_LIST & self.element_set != []
  452. @scan_elements = YEZ::SCAN::SHOWN_ELEMENTS_LIST & self.element_set
  453. @scan_reveal.push("ELEMENT")
  454. end
  455. if YEZ::SCAN::SHOWN_STATES_LIST & self.plus_state_set != []
  456. @scan_states = YEZ::SCAN::SHOWN_STATES_LIST & self.plus_state_set
  457. @scan_reveal.push("STATE")
  458. end
  459. for state_id in self.plus_state_set
  460. break if @scan_reveal.include?("STATS")
  461. state = $data_states[state_id]
  462. @scan_reveal.push("STATS") if state.atk_rate != 100
  463. @scan_reveal.push("STATS") if state.def_rate != 100
  464. @scan_reveal.push("STATS") if state.spi_rate != 100
  465. @scan_reveal.push("STATS") if state.agi_rate != 100
  466. end
  467. end
  468.  
  469. #--------------------------------------------------------------------------
  470. # new method: scan_reveal
  471. #--------------------------------------------------------------------------
  472. def scan_reveal
  473. yez_cache_usableitem_esq if @scan_reveal == nil
  474. return @scan_reveal.uniq
  475. end
  476.  
  477. #--------------------------------------------------------------------------
  478. # new method: scan_elements
  479. #--------------------------------------------------------------------------
  480. def scan_elements
  481. yez_cache_usableitem_esq if @scan_elements == nil
  482. return @scan_elements
  483. end
  484.  
  485. #--------------------------------------------------------------------------
  486. # new method: scan_states
  487. #--------------------------------------------------------------------------
  488. def scan_states
  489. yez_cache_usableitem_esq if @scan_states == nil
  490. return @scan_states
  491. end
  492.  
  493. end # RPG::UsableItem
  494.  
  495. #===============================================================================
  496. # RPG::Enemy
  497. #===============================================================================
  498.  
  499. class RPG::Enemy
  500.  
  501. #--------------------------------------------------------------------------
  502. # common cache: yez_cache_enemy_esq
  503. #--------------------------------------------------------------------------
  504. def yez_cache_enemy_esq
  505. @scan_description = ""; @scan_desc_mode = false; @quick_gauge = {}
  506. @quick_gauge[:width] = YEZ::SCAN::GAUGE_DEFAULTS[:width] + 32
  507. @quick_gauge[:states] = YEZ::SCAN::GAUGE_DEFAULTS[:states]
  508. @quick_gauge[:show_hp] = YEZ::SCAN::GAUGE_DEFAULTS[:show_hp]
  509. @quick_gauge[:hp_gauge1] = YEZ::SCAN::GAUGE_DEFAULTS[:hp_gauge1]
  510. @quick_gauge[:hp_gauge2] = YEZ::SCAN::GAUGE_DEFAULTS[:hp_gauge2]
  511. @quick_gauge[:show_mp] = YEZ::SCAN::GAUGE_DEFAULTS[:show_mp]
  512. @quick_gauge[:mp_gauge1] = YEZ::SCAN::GAUGE_DEFAULTS[:mp_gauge1]
  513. @quick_gauge[:mp_gauge2] = YEZ::SCAN::GAUGE_DEFAULTS[:mp_gauge2]
  514. @hidden_pages = []
  515.  
  516. self.note.split(/[\r\n]+/).each { |line|
  517. case line
  518. #---
  519. when YEZ::REGEXP::ENEMY::HIDE_SCAN
  520. case $1.upcase
  521. when "GENERAL", "ELEMENT", "STATES", "SKILLS", "VICTORY"
  522. text = $1.upcase
  523. else; next
  524. end
  525. @hidden_pages.push(text)
  526. #---
  527. when YEZ::REGEXP::ENEMY::GAUGE_WIDTH
  528. @quick_gauge[:width] = $1.to_i + 32
  529. #---
  530. when YEZ::REGEXP::ENEMY::HIDE_GAUGE
  531. case $1.upcase
  532. when "HIDE"
  533. setting = false
  534. when "SHOW"
  535. setting = true
  536. else; next
  537. end
  538. case $2.upcase
  539. when "STATE", "STATES"
  540. @quick_gauge[:states] = setting
  541. when "HP"
  542. @quick_gauge[:show_hp] = setting
  543. when "MP", "SP"
  544. @quick_gauge[:show_mp] = setting
  545. else; next
  546. end
  547. #---
  548. when YEZ::REGEXP::ENEMY::HP_GAUGE
  549. @quick_gauge[:hp_gauge1] = $1.to_i
  550. @quick_gauge[:hp_gauge2] = $2.to_i
  551. #---
  552. when YEZ::REGEXP::ENEMY::MP_GAUGE
  553. @quick_gauge[:mp_gauge1] = $1.to_i
  554. @quick_gauge[:mp_gauge2] = $2.to_i
  555. #---
  556. when YEZ::REGEXP::ENEMY::DESCRIPTION_ON
  557. @scan_desc_mode = true
  558. when YEZ::REGEXP::ENEMY::DESCRIPTION_OFF
  559. @scan_desc_mode = false
  560. else
  561. @scan_description += line if @scan_desc_mode
  562. #---
  563. end
  564. } # end self.note.split
  565. end # yez_cache_enemy_esq
  566.  
  567. #--------------------------------------------------------------------------
  568. # new method: quick_gauge
  569. #--------------------------------------------------------------------------
  570. def quick_gauge
  571. yez_cache_enemy_esq if @quick_gauge == nil
  572. return @quick_gauge
  573. end
  574.  
  575. #--------------------------------------------------------------------------
  576. # new method: scan_description
  577. #--------------------------------------------------------------------------
  578. def scan_description
  579. yez_cache_enemy_esq if @scan_description == nil
  580. return @scan_description
  581. end
  582.  
  583. #--------------------------------------------------------------------------
  584. # new method: hidden_pages
  585. #--------------------------------------------------------------------------
  586. def hidden_pages
  587. yez_cache_enemy_esq if @hidden_pages == nil
  588. return @hidden_pages
  589. end
  590.  
  591. end # RPG::Enemy
  592.  
  593. #===============================================================================
  594. # Game_System
  595. #===============================================================================
  596.  
  597. class Game_System
  598.  
  599. #--------------------------------------------------------------------------
  600. # new method: create_scan_arrays
  601. #--------------------------------------------------------------------------
  602. def create_scan_arrays
  603. @scanned = {} if @scanned == nil
  604. @scanned_elements = {} if @scanned_elements == nil
  605. @scanned_states = {} if @scanned_states == nil
  606. @scanned_skills = {} if @scanned_skills == nil
  607. @scanned_encounters = {} if @scanned_encounters == nil
  608. @scanned_defeated = {} if @scanned_defeated == nil
  609. @scanned_escaped = {} if @scanned_escaped == nil
  610. @scanned_drop_item = {} if @scanned_drop_item == nil
  611. @scanned_drop_weapon = {} if @scanned_drop_weapon == nil
  612. @scanned_drop_armour = {} if @scanned_drop_armour == nil
  613. end
  614.  
  615. #--------------------------------------------------------------------------
  616. # new method: full_scan
  617. #--------------------------------------------------------------------------
  618. def full_scan(battler)
  619. id = battler.enemy.id
  620. create_scan_arrays
  621. for type in YEZ::REGEXP::SCAN_TYPES
  622. @scanned[type] = [] if @scanned[type] == nil
  623. @scanned[type] += [id]
  624. @scanned[type].uniq!
  625. end
  626. @scanned_elements[id] = [] if @scanned_elements[id] == nil
  627. @scanned_elements[id] += YEZ::SCAN::SHOWN_ELEMENTS_LIST
  628. @scanned_elements[id].uniq!
  629. @scanned_states[id] = [] if @scanned_states[id] == nil
  630. @scanned_states[id] += YEZ::SCAN::SHOWN_STATES_LIST
  631. @scanned_states[id].uniq!
  632. @scanned_skills[id] = [] if @scanned_skills[id] == nil
  633. result = []
  634. for action in battler.enemy.actions
  635. next unless action.kind == 1
  636. result.push(action.skill_id) unless result.include?(action.skill_id)
  637. end
  638. @scanned_skills[id] += result
  639. @scanned_skills[id].uniq
  640. end
  641.  
  642. #--------------------------------------------------------------------------
  643. # new method: scan_target
  644. #--------------------------------------------------------------------------
  645. def scan_target(enemy, obj)
  646. create_scan_arrays
  647. return if enemy == nil
  648. id = enemy.id
  649. for scan_type in obj.scan_reveal
  650. case scan_type
  651. when "HP", "MP", "STATS", "DROPS"
  652. @scanned[scan_type] = [] if @scanned[scan_type] == nil
  653. @scanned[scan_type].push(id) unless @scanned[scan_type].include?(id)
  654. when "ELEMENT"
  655. @scanned_elements[id] = [] if @scanned_elements[id] == nil
  656. @scanned_elements[id] += obj.scan_elements
  657. @scanned_elements[id].uniq!
  658. when "STATE"
  659. @scanned_states[id] = [] if @scanned_states[id] == nil
  660. @scanned_states[id] += obj.scan_states
  661. @scanned_states[id].uniq!
  662. when "SKILLS"
  663. @scanned_skills[id] = [] if @scanned_skills[id] == nil
  664. result = []
  665. for action in enemy.actions
  666. next unless action.kind == 1
  667. result.push(action.skill_id) unless result.include?(action.skill_id)
  668. end
  669. @scanned_skills[id] += result
  670. @scanned_skills[id].uniq
  671. end
  672. end
  673. end
  674.  
  675. #--------------------------------------------------------------------------
  676. # new method: scan_skill
  677. #--------------------------------------------------------------------------
  678. def scan_skill(enemy, skill)
  679. return unless YEZ::SCAN::SCAN_SKILL_WHEN_USED
  680. create_scan_arrays
  681. id = enemy.id
  682. @scanned_skills[id] = [] if @scanned_skills[id] == nil
  683. @scanned_skills[id].push(skill.id) unless
  684. @scanned_skills[id].include?(skill.id)
  685. end
  686.  
  687. #--------------------------------------------------------------------------
  688. # new method: scan_drop_item
  689. #--------------------------------------------------------------------------
  690. def scan_drop_item(enemy, drop_item)
  691. return unless YEZ::SCAN::UNLOCK_INDIVIDUAL_DROPS
  692. create_scan_arrays
  693. id = enemy.id
  694. case drop_item.kind
  695. when 1
  696. item = $data_items[drop_item.item_id]
  697. @scanned_drop_item[id] = [] if @scanned_drop_item[id] == nil
  698. @scanned_drop_item[id].push(item.id) unless
  699. @scanned_drop_item[id].include?(item.id)
  700. when 2
  701. item = $data_weapons[drop_item.weapon_id]
  702. @scanned_drop_weapon[id] = [] if @scanned_drop_weapon[id] == nil
  703. @scanned_drop_weapon[id].push(item.id) unless
  704. @scanned_drop_weapon[id].include?(item.id)
  705. when 3
  706. item = $data_armors[drop_item.armor_id]
  707. @scanned_drop_armour[id] = [] if @scanned_drop_armour[id] == nil
  708. @scanned_drop_armour[id].push(item.id) unless
  709. @scanned_drop_armour[id].include?(item.id)
  710. end
  711. end
  712.  
  713. #--------------------------------------------------------------------------
  714. # new method: scanned
  715. #--------------------------------------------------------------------------
  716. def scanned
  717. create_scan_arrays if @scanned == nil
  718. return @scanned
  719. end
  720.  
  721. #--------------------------------------------------------------------------
  722. # new method: scanned_elements
  723. #--------------------------------------------------------------------------
  724. def scanned_elements
  725. create_scan_arrays if @scanned_elements == nil
  726. for type in YEZ::REGEXP::SCAN_TYPES
  727. @scanned[type] = [] if @scanned[type] == nil
  728. end
  729. return @scanned_elements
  730. end
  731.  
  732. #--------------------------------------------------------------------------
  733. # new method: scanned_states
  734. #--------------------------------------------------------------------------
  735. def scanned_states
  736. create_scan_arrays if @scanned_states == nil
  737. return @scanned_states
  738. end
  739.  
  740. #--------------------------------------------------------------------------
  741. # new method: scanned_skills
  742. #--------------------------------------------------------------------------
  743. def scanned_skills
  744. create_scan_arrays if @scanned_skills == nil
  745. return @scanned_skills
  746. end
  747.  
  748. #--------------------------------------------------------------------------
  749. # new method: scanned_encounters
  750. #--------------------------------------------------------------------------
  751. def scanned_encounters
  752. create_scan_arrays if @scanned_encounters == nil
  753. return @scanned_encounters
  754. end
  755.  
  756. #--------------------------------------------------------------------------
  757. # new method: scanned_defeated
  758. #--------------------------------------------------------------------------
  759. def scanned_defeated
  760. create_scan_arrays if @scanned_defeated == nil
  761. return @scanned_defeated
  762. end
  763.  
  764. #--------------------------------------------------------------------------
  765. # new method: scanned_escaped
  766. #--------------------------------------------------------------------------
  767. def scanned_escaped
  768. create_scan_arrays if @scanned_escaped == nil
  769. return @scanned_escaped
  770. end
  771.  
  772. #--------------------------------------------------------------------------
  773. # new method: scanned_drop_item
  774. #--------------------------------------------------------------------------
  775. def scanned_drop_item
  776. create_scan_arrays if @scanned_drop_item == nil
  777. return @scanned_drop_item
  778. end
  779.  
  780. #--------------------------------------------------------------------------
  781. # new method: scanned_drop_weapon
  782. #--------------------------------------------------------------------------
  783. def scanned_drop_weapon
  784. create_scan_arrays if @scanned_drop_weapon == nil
  785. return @scanned_drop_weapon
  786. end
  787.  
  788. #--------------------------------------------------------------------------
  789. # new method: scanned_drop_armour
  790. #--------------------------------------------------------------------------
  791. def scanned_drop_armour
  792. create_scan_arrays if @scanned_drop_armour == nil
  793. return @scanned_drop_armour
  794. end
  795.  
  796. end # Game_System
  797.  
  798. #===============================================================================
  799. # Game_Battler
  800. #===============================================================================
  801.  
  802. class Game_Battler
  803.  
  804. #--------------------------------------------------------------------------
  805. # new method: maxmp_limit
  806. #--------------------------------------------------------------------------
  807. unless method_defined?(:maxmp_limit)
  808. def maxmp_limit
  809. return 9999
  810. end
  811. end # method_defined?(:maxmp_limit)
  812.  
  813. #--------------------------------------------------------------------------
  814. # alias method: item_effect
  815. #--------------------------------------------------------------------------
  816. alias item_effect_esq item_effect unless $@
  817. def item_effect(user, item)
  818. item_effect_esq(user, item)
  819. if !actor? and !@skipped and !@missed and !@evaded and user.actor?
  820. $game_system.scan_target(self.enemy, item)
  821. end
  822. end
  823.  
  824. #--------------------------------------------------------------------------
  825. # alias method: skill_effect
  826. #--------------------------------------------------------------------------
  827. alias skill_effect_esq skill_effect unless $@
  828. def skill_effect(user, skill)
  829. skill_effect_esq(user, skill)
  830. $game_system.scan_skill(user.enemy, skill) if !user.actor?
  831. if !actor? and !@skipped and !@missed and !@evaded and user.actor?
  832. $game_system.scan_target(self.enemy, skill)
  833. end
  834. end
  835.  
  836. end # Game_Battler
  837.  
  838. #==============================================================================
  839. # Game_Enemy
  840. #==============================================================================
  841.  
  842. class Game_Enemy
  843.  
  844. #--------------------------------------------------------------------------
  845. # alias method: initialize
  846. #--------------------------------------------------------------------------
  847. alias initialize_enemy_esq initialize unless $@
  848. def initialize(index, enemy_id)
  849. initialize_enemy_esq(index, enemy_id)
  850. $game_system.scanned_encounters[@enemy_id] = 0 if
  851. $game_system.scanned_encounters[@enemy_id] == nil
  852. $game_system.scanned_encounters[@enemy_id] += 1
  853. end
  854.  
  855. #--------------------------------------------------------------------------
  856. # alias method: transform
  857. #--------------------------------------------------------------------------
  858. alias transform_esq transform unless $@
  859. def transform(enemy_id)
  860. transform_esq(enemy_id)
  861. $game_system.scanned_encounters[@enemy_id] = 0 if
  862. $game_system.scanned_encounters[@enemy_id] == nil
  863. $game_system.scanned_encounters[@enemy_id] += 1 if $game_temp.in_battle
  864. end
  865.  
  866. #--------------------------------------------------------------------------
  867. # alias method: perform_collapse
  868. #--------------------------------------------------------------------------
  869. alias perform_collapse_esq perform_collapse unless $@
  870. def perform_collapse
  871. perform_collapse_esq
  872. if $game_temp.in_battle and dead?
  873. $game_system.scanned_defeated[@enemy_id] = 0 if
  874. $game_system.scanned_defeated[@enemy_id] == nil
  875. $game_system.scanned_defeated[@enemy_id] += 1
  876. end
  877. end
  878.  
  879. #--------------------------------------------------------------------------
  880. # alias method: escape
  881. #--------------------------------------------------------------------------
  882. alias escape_esq escape unless $@
  883. def escape
  884. $game_system.scanned_escaped[@enemy_id] = 0 if
  885. $game_system.scanned_escaped[@enemy_id] == nil
  886. $game_system.scanned_escaped[@enemy_id] += 1
  887. escape_esq
  888. end
  889.  
  890. #--------------------------------------------------------------------------
  891. # new method: total_skills
  892. #--------------------------------------------------------------------------
  893. def total_skills
  894. result = []
  895. for action in enemy.actions
  896. next unless action.kind == 1
  897. skill = $data_skills[action.skill_id]
  898. result.push(skill) unless result.include?(skill)
  899. end
  900. result.sort! { |a,b| a.id <=> b.id }
  901. return result.uniq
  902. end
  903.  
  904. end # Game_Enemy
  905.  
  906. #===============================================================================
  907. # Game_Troop
  908. #===============================================================================
  909.  
  910. class Game_Troop < Game_Unit
  911.  
  912. #--------------------------------------------------------------------------
  913. # overwrite method: make_drop_items
  914. #--------------------------------------------------------------------------
  915. def make_drop_items
  916. drop_items = []
  917. for enemy in dead_members
  918. id = enemy.enemy.id
  919. for di in [enemy.drop_item1, enemy.drop_item2]
  920. next if di.kind == 0
  921. next if rand(di.denominator) != 0
  922. if di.kind == 1
  923. drop_items.push($data_items[di.item_id])
  924. elsif di.kind == 2
  925. drop_items.push($data_weapons[di.weapon_id])
  926. elsif di.kind == 3
  927. drop_items.push($data_armors[di.armor_id])
  928. end
  929. $game_system.scan_drop_item(enemy.enemy, di)
  930. end
  931. end
  932. return drop_items unless $imported["ExtraDropItem"]
  933. dead_members.each { |enemy|
  934. enemy.extra_drop_items.each_with_index { |di, i|
  935. next if di.kind == 0
  936. if di.drop_prob > 0
  937. next if di.drop_prob < rand(100)
  938. else
  939. next if rand(di.denominator) != 0
  940. end
  941. id = enemy.enemy.id
  942. if di.kind == 1
  943. drop_items.push($data_items[di.item_id])
  944. elsif di.kind == 2
  945. drop_items.push($data_weapons[di.weapon_id])
  946. elsif di.kind == 3
  947. drop_items.push($data_armors[di.armor_id])
  948. end
  949. $game_system.scan_drop_item(enemy.enemy, di)
  950. if $imported["EnemyGuide"]
  951. KGC::Commands.set_enemy_item_dropped(enemy.enemy.id, i + 2)
  952. end
  953. }
  954. }
  955. return drop_items
  956. end
  957.  
  958. end # Game_Troop
  959.  
  960. #===============================================================================
  961. # Scene_Battle
  962. #===============================================================================
  963.  
  964. class Scene_Battle < Scene_Base
  965.  
  966. #--------------------------------------------------------------------------
  967. # alias method: start
  968. #--------------------------------------------------------------------------
  969. alias start_battle_esq start unless $@
  970. def start
  971. start_battle_esq
  972. @scan_query_window = Window_ScanQuery.new
  973. end
  974.  
  975. #--------------------------------------------------------------------------
  976. # alias method: terminate
  977. #--------------------------------------------------------------------------
  978. alias terminate_battle_esq terminate unless $@
  979. def terminate
  980. @scan_query_window.dispose if @scan_query_window != nil
  981. @target_scan_help_window.dispose if @target_scan_help_window != nil
  982. terminate_battle_esq
  983. end
  984.  
  985. #--------------------------------------------------------------------------
  986. # alias method: update
  987. #--------------------------------------------------------------------------
  988. alias update_battle_esq update unless $@
  989. def update
  990. @scan_query_window.update
  991. if @scan_query_window.active or @scan_query_window.openness != 0
  992. super
  993. return
  994. end
  995. update_battle_esq
  996. end
  997.  
  998. #--------------------------------------------------------------------------
  999. # alias method: start_target_enemy_selection
  1000. #--------------------------------------------------------------------------
  1001. alias start_target_enemy_selection_esq start_target_enemy_selection unless $@
  1002. def start_target_enemy_selection
  1003. start_target_enemy_selection_esq
  1004. @target_scan_help_window = Window_TargetScanHelp.new
  1005. return unless YEZ::SCAN::USE_QUICK_SCAN
  1006. @enemy_gauge_window = Window_EnemyGauge.new
  1007. end
  1008.  
  1009. #--------------------------------------------------------------------------
  1010. # alias method: end_target_enemy_selection
  1011. #--------------------------------------------------------------------------
  1012. alias end_target_enemy_selection_esq end_target_enemy_selection unless $@
  1013. def end_target_enemy_selection
  1014. end_target_enemy_selection_esq
  1015. if @target_scan_help_window != nil
  1016. @target_scan_help_window.dispose
  1017. @target_scan_help_window = nil
  1018. end
  1019. return unless YEZ::SCAN::USE_QUICK_SCAN
  1020. @enemy_gauge_window.dispose if @enemy_gauge_window != nil
  1021. @enemy_gauge_window = nil
  1022. @last_gauge_window_index = nil
  1023. end
  1024.  
  1025. #--------------------------------------------------------------------------
  1026. # alias method: update_target_enemy_selection
  1027. #--------------------------------------------------------------------------
  1028. alias update_target_enemy_selection_esq update_target_enemy_selection unless $@
  1029. def update_target_enemy_selection
  1030. update_target_enemy_selection_esq
  1031. return if @target_enemy_window == nil
  1032. if Input.trigger?(YEZ::SCAN::SCAN_BUTTON)
  1033. @scan_query_window.appear(@target_enemy_window, @target_enemy_window.enemy)
  1034. end
  1035. return unless YEZ::SCAN::USE_QUICK_SCAN
  1036. if @last_gauge_window_index != @target_enemy_window.index
  1037. @last_gauge_window_index = @target_enemy_window.index
  1038. @enemy_gauge_window.battler = @target_enemy_window.enemy
  1039. end
  1040. end
  1041.  
  1042. end # Scene_Battle
  1043.  
  1044. #===============================================================================
  1045. # Window_Base
  1046. #===============================================================================
  1047.  
  1048. class Window_Base < Window
  1049.  
  1050. #--------------------------------------------------------------------------
  1051. # new method: draw_enemy_hp_gauge
  1052. #--------------------------------------------------------------------------
  1053. def draw_enemy_hp_gauge(battler, x, y, width = 120)
  1054. battler.hp = [battler.hp, battler.maxhp].min
  1055. gc0 = gauge_back_color
  1056. gc1 = text_color(battler.enemy.quick_gauge[:hp_gauge1])
  1057. gc2 = text_color(battler.enemy.quick_gauge[:hp_gauge2])
  1058. gh = 6
  1059. gy = y + WLH - 8 - (gh - 6)
  1060. if battler.maxhp < battler.base_maxhp and battler.base_maxhp > 0 and
  1061. !(battler.base_maxhp > battler.maxhp_limit)
  1062. gb = width * battler.maxhp / battler.base_maxhp
  1063. self.contents.fill_rect(x, gy, width, gh, text_color(15))
  1064. else
  1065. gb = width
  1066. end
  1067. self.contents.fill_rect(x, gy, gb, gh, gc0)
  1068. gw = gb * battler.hp / battler.maxhp
  1069. self.contents.gradient_fill_rect(x, gy, gw, gh, gc1, gc2)
  1070. end
  1071.  
  1072. #--------------------------------------------------------------------------
  1073. # overwrite method: draw_enemy_mp_gauge
  1074. #--------------------------------------------------------------------------
  1075. def draw_enemy_mp_gauge(battler, x, y, width = 120, height = nil)
  1076. battler.mp = [battler.mp, battler.maxmp].min
  1077. gc0 = gauge_back_color
  1078. gc1 = text_color(battler.enemy.quick_gauge[:mp_gauge1])
  1079. gc2 = text_color(battler.enemy.quick_gauge[:mp_gauge1])
  1080. gh = 6
  1081. gy = y + WLH - 8 - (gh - 6)
  1082. if battler.maxmp < battler.base_maxmp and battler.base_maxmp > 0 and
  1083. !(battler.base_maxmp > battler.maxmp_limit)
  1084. gb = width * battler.maxmp / battler.base_maxmp
  1085. self.contents.fill_rect(x, gy, width, gh, text_color(7))
  1086. else
  1087. gb = width
  1088. end
  1089. self.contents.fill_rect(x, gy, gb, gh, gc0)
  1090. if battler.maxmp <= 0
  1091. if battler.base_maxmp <= 0
  1092. gw = width
  1093. else
  1094. gw = 0
  1095. end
  1096. else
  1097. gw = gb * battler.mp / battler.maxmp
  1098. end
  1099. self.contents.gradient_fill_rect(x, gy, gw, gh, gc1, gc2)
  1100. end
  1101.  
  1102. end # Window_Base
  1103.  
  1104. #===============================================================================
  1105. # Window_EnemyGauge
  1106. #===============================================================================
  1107.  
  1108. class Window_EnemyGauge < Window_Base
  1109.  
  1110. #--------------------------------------------------------------------------
  1111. # initialize
  1112. #--------------------------------------------------------------------------
  1113. def initialize
  1114. super(0, 0, 120, WLH*3+32)
  1115. self.visible = false
  1116. self.opacity = 0
  1117. self.back_opacity = 0
  1118. end
  1119.  
  1120. #--------------------------------------------------------------------------
  1121. # battler=
  1122. #--------------------------------------------------------------------------
  1123. def battler=(battler)
  1124. @battler = battler
  1125. self.visible = true
  1126. self.width = @battler.enemy.quick_gauge[:width]
  1127. self.x = @battler.screen_x - self.width/2
  1128. self.y = @battler.screen_y - self.height/2 - WLH + 12
  1129. create_contents
  1130. refresh
  1131. end
  1132.  
  1133. #--------------------------------------------------------------------------
  1134. # refresh
  1135. #--------------------------------------------------------------------------
  1136. def refresh
  1137. dy = 0
  1138. sw = self.width - 32
  1139. draw_actor_state(@battler, 0, WLH, sw) if @battler.enemy.quick_gauge[:states]
  1140. dy += WLH+8
  1141. if @battler.enemy.quick_gauge[:show_hp]
  1142. draw_back_gauge(0, dy, sw)
  1143. draw_enemy_hp_gauge(@battler, 1, dy+1, sw-2)
  1144. dy += 7
  1145. end
  1146. if @battler.enemy.quick_gauge[:show_mp]
  1147. draw_back_gauge(0, dy, self.width-32)
  1148. if $imported["BattleEngineMelody"] and @battler.use_rage?
  1149. draw_actor_rage_gauge(@battler, 1, dy+1, sw/2-1)
  1150. draw_enemy_mp_gauge(@battler, sw/2+1, dy+1, sw/2-2)
  1151. else
  1152. draw_enemy_mp_gauge(@battler, 1, dy+1, sw-2)
  1153. end
  1154. dy += 7
  1155. end
  1156. end
  1157.  
  1158. #--------------------------------------------------------------------------
  1159. # new method: draw_back_gauge
  1160. #--------------------------------------------------------------------------
  1161. def draw_back_gauge(x, y, width = 120)
  1162. self.contents.fill_rect(x, y + WLH - 8, width, 8, gauge_back_color)
  1163. end
  1164.  
  1165. end # Window_EnemyGauge
  1166.  
  1167. #===============================================================================
  1168. # Window_TargetScanHelp
  1169. #===============================================================================
  1170.  
  1171. class Window_TargetScanHelp < Window_Base
  1172.  
  1173. #--------------------------------------------------------------------------
  1174. # initialize
  1175. #--------------------------------------------------------------------------
  1176. def initialize
  1177. settings = YEZ::SCAN::HELP_WINDOW
  1178. super(settings[:x], settings[:y], settings[:width], settings[:height])
  1179. if settings[:trans]
  1180. self.back_opacity = 0
  1181. self.opacity = 0
  1182. end
  1183. refresh
  1184. end
  1185.  
  1186. #--------------------------------------------------------------------------
  1187. # refresh
  1188. #--------------------------------------------------------------------------
  1189. def refresh
  1190. self.contents.clear
  1191. draw_icon(YEZ::SCAN::HELP_WINDOW[:icon], 0, 0)
  1192. text = YEZ::SCAN::HELP_WINDOW[:text]
  1193. self.contents.draw_text(24, 0, self.width-56, WLH, text, 0)
  1194. end
  1195.  
  1196. end # Window_TargetScanHelp
  1197.  
  1198. #===============================================================================
  1199. # Window_ScanHelp
  1200. #===============================================================================
  1201.  
  1202. class Window_ScanHelp < Window_Base
  1203.  
  1204. #--------------------------------------------------------------------------
  1205. # initialize
  1206. #--------------------------------------------------------------------------
  1207. def initialize
  1208. super(0, 0, Graphics.width, 56)
  1209. self.back_opacity = 255
  1210. self.openness = 0
  1211. self.active = false
  1212. self.z = 10001
  1213. end
  1214.  
  1215. #--------------------------------------------------------------------------
  1216. # refresh
  1217. #--------------------------------------------------------------------------
  1218. def refresh(battler)
  1219. self.contents.clear
  1220. @battler = battler
  1221. return if @battler == nil
  1222. text = @battler.name
  1223. if $imported["EnemyLevels"]
  1224. text = sprintf(YEZ::ENEMY_LEVEL::LEVEL_TEXT, @battler.level, text)
  1225. end
  1226. c_width = contents.text_size(text).width
  1227. dx = (self.width-32)/2 - c_width/2
  1228. self.contents.draw_text(dx, 0, c_width, WLH, text)
  1229. end
  1230.  
  1231. end # Window_ScanHelp
  1232.  
  1233. #===============================================================================
  1234. # Window_ScanData
  1235. #===============================================================================
  1236.  
  1237. class Window_ScanData < Window_Base
  1238.  
  1239. #--------------------------------------------------------------------------
  1240. # initialize
  1241. #--------------------------------------------------------------------------
  1242. def initialize
  1243. super(0, Graphics.height - 128, Graphics.width, 128)
  1244. self.back_opacity = 255
  1245. self.openness = 0
  1246. self.active = false
  1247. self.z = 10002
  1248. end
  1249.  
  1250. #--------------------------------------------------------------------------
  1251. # refresh
  1252. #--------------------------------------------------------------------------
  1253. def refresh(battler)
  1254. self.contents.clear
  1255. @battler = battler
  1256. return if @battler == nil
  1257. @text = @battler.enemy.scan_description
  1258. draw_enemy_description(@text)
  1259. end
  1260.  
  1261. #--------------------------------------------------------------------------
  1262. # draw_enemy_description
  1263. #--------------------------------------------------------------------------
  1264. def draw_enemy_description(text)
  1265. dx = 4; dy = 0; txsize = Font.default_size; nwidth = Graphics.width * 8
  1266. text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
  1267. text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
  1268. text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
  1269. lines = text.split(/(?:[|]|\\n)/i)
  1270. lines.each_with_index { |l, i| l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
  1271. self.contents.draw_text(dx, i * (txsize + 4) + dy, nwidth, WLH, l, 0)}
  1272. end
  1273.  
  1274. end # Window_ScanData
  1275.  
  1276. #===============================================================================
  1277. # Window_ScanSkills
  1278. #===============================================================================
  1279.  
  1280. class Window_ScanSkills < Window_Selectable
  1281.  
  1282. #--------------------------------------------------------------------------
  1283. # initialize
  1284. #--------------------------------------------------------------------------
  1285. def initialize(battler)
  1286. @battler = battler
  1287. @id = @battler.enemy.id
  1288. dx = Graphics.width/2-16
  1289. super(dx, 80, Graphics.width - dx, Graphics.height - 208)
  1290. self.active = false
  1291. self.back_opacity = 0
  1292. self.opacity = 0
  1293. self.z = 10003
  1294. refresh
  1295. end
  1296.  
  1297. #--------------------------------------------------------------------------
  1298. # refresh
  1299. #--------------------------------------------------------------------------
  1300. def refresh
  1301. @data = []
  1302. for skill in @battler.total_skills
  1303. @data.push(skill)
  1304. end
  1305. @item_max = @data.size
  1306. self.index = 0 if @item_max > 7
  1307. create_contents
  1308. for i in 0..(@item_max-1); draw_item(i); end
  1309. end
  1310.  
  1311. #--------------------------------------------------------------------------
  1312. # draw_item
  1313. #--------------------------------------------------------------------------
  1314. def draw_item(index)
  1315. rect = item_rect(index)
  1316. self.contents.clear_rect(rect)
  1317. skill = @data[index]
  1318. return if skill == nil
  1319. rect.width -= 4
  1320. $game_system.scanned_skills[@id] = [] if
  1321. $game_system.scanned_skills[@id] == nil
  1322. if $game_system.scanned_skills[@id].include?(skill.id) or
  1323. !YEZ::SCAN::REQUIRE_SCAN
  1324. enabled = true
  1325. icon = skill.icon_index
  1326. name = skill.name
  1327. else
  1328. enabled = false
  1329. icon = YEZ::SCAN::HIDDEN_SKILL_ICON
  1330. mask = "?"
  1331. name = mask * skill.name.scan(/./).size
  1332. end
  1333. draw_icon(icon, rect.x, rect.y, enabled)
  1334. if $imported["JobSystemSkillLevels"] and enabled
  1335. draw_skill_level(rect.x, rect.y, skill, @battler)
  1336. end
  1337. self.contents.font.color = normal_color
  1338. self.contents.font.color.alpha = enabled ? 255 : 128
  1339. self.contents.draw_text(rect.x + 24, rect.y, self.width-56, WLH, name)
  1340. end
  1341.  
  1342. end # Window_ScanSkills
  1343.  
  1344. #===============================================================================
  1345. # Window_ScanSpoils
  1346. #===============================================================================
  1347.  
  1348. class Window_ScanSpoils < Window_Selectable
  1349.  
  1350. #--------------------------------------------------------------------------
  1351. # initialize
  1352. #--------------------------------------------------------------------------
  1353. def initialize(battler)
  1354. @battler = battler
  1355. @enemy = @battler.enemy
  1356. dx = Graphics.width/2-16
  1357. super(dx, 56, Graphics.width - dx, Graphics.height - 184)
  1358. self.active = false
  1359. self.back_opacity = 0
  1360. self.opacity = 0
  1361. self.z = 10004
  1362. refresh
  1363. end
  1364.  
  1365. #--------------------------------------------------------------------------
  1366. # refresh
  1367. #--------------------------------------------------------------------------
  1368. def refresh
  1369. @data = [:encounters, :defeated, :escaped, :exp, :gold]
  1370. drops = [:spoils]
  1371. drops += [@battler.drop_item1] if @battler.drop_item1.kind != 0
  1372. drops += [@battler.drop_item2] if @battler.drop_item2.kind != 0
  1373. drops += @battler.extra_drop_items if $imported["ExtraDropItem"]
  1374. @data += drops if drops.size > 1
  1375. @data -= [nil]
  1376. @item_max = @data.size
  1377. self.index = 0 if @item_max > 8
  1378. create_contents
  1379. for i in 0..(@item_max-1); draw_item(i); end
  1380. end
  1381.  
  1382. #--------------------------------------------------------------------------
  1383. # draw_item
  1384. #--------------------------------------------------------------------------
  1385. def draw_item(index)
  1386. rect = item_rect(index)
  1387. self.contents.clear_rect(rect)
  1388. item = @data[index]
  1389. return if item == nil
  1390. self.contents.font.color = system_color
  1391. masked = false; enabled = true
  1392. if item == :encounters
  1393. icon = YEZ::SCAN::VICTORY_SETTINGS[:encounters][0]
  1394. name = YEZ::SCAN::VICTORY_SETTINGS[:encounters][1]
  1395. $game_system.scanned_encounters[@enemy.id] = 0 if
  1396. $game_system.scanned_encounters[@enemy.id] == nil
  1397. value = $game_system.scanned_encounters[@enemy.id]
  1398. value = sprintf(YEZ::SCAN::VICTORY_SETTINGS[:encounters][2], value)
  1399. elsif item == :defeated
  1400. icon = YEZ::SCAN::VICTORY_SETTINGS[:defeated][0]
  1401. name = YEZ::SCAN::VICTORY_SETTINGS[:defeated][1]
  1402. $game_system.scanned_defeated[@enemy.id] = 0 if
  1403. $game_system.scanned_defeated[@enemy.id] == nil
  1404. value = $game_system.scanned_defeated[@enemy.id]
  1405. value = sprintf(YEZ::SCAN::VICTORY_SETTINGS[:defeated][2], value)
  1406. elsif item == :escaped
  1407. icon = YEZ::SCAN::VICTORY_SETTINGS[:escaped][0]
  1408. name = YEZ::SCAN::VICTORY_SETTINGS[:escaped][1]
  1409. $game_system.scanned_escaped[@enemy.id] = 0 if
  1410. $game_system.scanned_escaped[@enemy.id] == nil
  1411. value = $game_system.scanned_escaped[@enemy.id]
  1412. value = sprintf(YEZ::SCAN::VICTORY_SETTINGS[:defeated][2], value)
  1413. elsif item == :exp
  1414. icon = YEZ::SCAN::VICTORY_SETTINGS[:exp][0]
  1415. name = YEZ::SCAN::VICTORY_SETTINGS[:exp][1]
  1416. $game_system.scanned_defeated[@enemy.id] = 0 if
  1417. $game_system.scanned_defeated[@enemy.id] == nil
  1418. if $game_system.scanned_defeated[@enemy.id] > 0
  1419. value = sprintf(YEZ::SCAN::VICTORY_SETTINGS[:exp][2], @battler.exp)
  1420. else
  1421. value = "???"
  1422. end
  1423. elsif item == :gold
  1424. icon = YEZ::SCAN::VICTORY_SETTINGS[:gold][0]
  1425. name = YEZ::SCAN::VICTORY_SETTINGS[:gold][1]
  1426. $game_system.scanned_defeated[@enemy.id] = 0 if
  1427. $game_system.scanned_defeated[@enemy.id] == nil
  1428. if $game_system.scanned_defeated[@enemy.id] > 0
  1429. value = sprintf(YEZ::SCAN::VICTORY_SETTINGS[:gold][2], @battler.gold)
  1430. else
  1431. value = "???"
  1432. end
  1433. elsif item == :spoils
  1434. self.contents.font.color = system_color
  1435. text = YEZ::SCAN::VICTORY_SETTINGS[:spoils][1]
  1436. self.contents.draw_text(rect.x, rect.y, rect.width, WLH, text, 1)
  1437. return
  1438. else
  1439. masked = true
  1440. self.contents.font.color = normal_color
  1441. case item.kind
  1442. when 1
  1443. drop_item = $data_items[item.item_id]
  1444. $game_system.scanned_drop_item[@enemy.id] = [] if
  1445. $game_system.scanned_drop_item[@enemy.id] == nil
  1446. masked = false if
  1447. $game_system.scanned_drop_item[@enemy.id].include?(drop_item.id)
  1448. when 2
  1449. drop_item = $data_weapons[item.weapon_id]
  1450. $game_system.scanned_drop_weapon[@enemy.id] = [] if
  1451. $game_system.scanned_drop_weapon[@enemy.id] == nil
  1452. masked = false if
  1453. $game_system.scanned_drop_weapon[@enemy.id].include?(drop_item.id)
  1454. when 3
  1455. drop_item = $data_armors[item.armor_id]
  1456. $game_system.scanned_drop_armour[@enemy.id] = [] if
  1457. $game_system.scanned_drop_armour[@enemy.id] == nil
  1458. masked = false if
  1459. $game_system.scanned_drop_armour[@enemy.id].include?(drop_item.id)
  1460. else; return
  1461. end
  1462. icon = drop_item.icon_index
  1463. name = drop_item.name
  1464. if $imported["ExtraDropItem"] and item.drop_prob > 0
  1465. value = sprintf("%d%%", item.drop_prob)
  1466. else
  1467. value = sprintf("%d%%", 1 * 100 /item.denominator)
  1468. end
  1469. masked = false if !YEZ::SCAN::REQUIRE_SCAN or
  1470. (!YEZ::SCAN::UNLOCK_INDIVIDUAL_DROPS and
  1471. $game_system.scanned_defeated[@enemy.id] > 0) or
  1472. $game_system.scanned["DROPS"].include?(@enemy.id)
  1473. end
  1474. if masked
  1475. icon = YEZ::SCAN::HIDDEN_DROP_ICON
  1476. mask = "?"; value = "??%"
  1477. name = mask * name.scan(/./).size
  1478. enabled = false
  1479. self.contents.font.color.alpha = 128
  1480. end
  1481. draw_icon(icon, rect.x, rect.y, enabled)
  1482. self.contents.draw_text(rect.x+24, rect.y, 172, WLH, name)
  1483. self.contents.font.color = normal_color
  1484. self.contents.font.color.alpha = enabled ? 255 : 128
  1485. self.contents.draw_text(rect.x+24, rect.y, rect.width-24, WLH, value, 2)
  1486. end
  1487.  
  1488. end # Window_ScanSpoils
  1489.  
  1490. #===============================================================================
  1491. # Window_ScanQuery
  1492. #===============================================================================
  1493.  
  1494. class Window_ScanQuery < Window_Base
  1495.  
  1496. #--------------------------------------------------------------------------
  1497. # initialize
  1498. #--------------------------------------------------------------------------
  1499. def initialize
  1500. @help_window = Window_ScanHelp.new
  1501. @data_window = Window_ScanData.new
  1502. dh = Graphics.height - @help_window.height - @data_window.height
  1503. super(0, @help_window.height, Graphics.width, dh)
  1504. self.back_opacity = 255
  1505. self.openness = 0
  1506. self.active = false
  1507. self.z = 10000
  1508. end
  1509.  
  1510. #--------------------------------------------------------------------------
  1511. # dispose
  1512. #--------------------------------------------------------------------------
  1513. def dispose
  1514. @help_window.dispose
  1515. @data_window.dispose
  1516. super
  1517. end
  1518.  
  1519. #--------------------------------------------------------------------------
  1520. # appear
  1521. #--------------------------------------------------------------------------
  1522. def appear(host_window, battler)
  1523. @host_window = host_window
  1524. @host_window.active = false
  1525. @battler = battler
  1526. @enemy = battler.enemy
  1527. self.active = true
  1528. Sound.play_decision
  1529. @help_window.refresh(@battler)
  1530. @help_window.openness = 255
  1531. @data_window.refresh(@battler)
  1532. @data_window.openness = 255
  1533. @page = 0
  1534. create_pages
  1535. refresh
  1536. self.open
  1537. end
  1538.  
  1539. #--------------------------------------------------------------------------
  1540. # disappear
  1541. #--------------------------------------------------------------------------
  1542. def disappear
  1543. @host_window.active = true
  1544. self.active = false
  1545. @help_window.openness = 0
  1546. @data_window.openness = 0
  1547. @battler_states = nil
  1548. if @skill_window != nil
  1549. @skill_window.dispose
  1550. @skill_window = nil
  1551. end
  1552. if @spoils_window != nil
  1553. @spoils_window.dispose
  1554. @spoils_window = nil
  1555. end
  1556. self.close
  1557. end
  1558.  
  1559. #--------------------------------------------------------------------------
  1560. # create_pages
  1561. #--------------------------------------------------------------------------
  1562. def create_pages
  1563. @data = []
  1564. for page in YEZ::SCAN::PAGE_ORDER
  1565. case page
  1566. when :general
  1567. next if @enemy.hidden_pages.include?("GENERAL")
  1568. when :element
  1569. next if @enemy.hidden_pages.include?("ELEMENT")
  1570. $game_system.scanned_elements[@enemy.id] = [] if
  1571. $game_system.scanned_elements[@enemy.id] == nil
  1572. next if $game_system.scanned_elements[@enemy.id] == [] and
  1573. YEZ::SCAN::REQUIRE_SCAN
  1574.  
  1575. when :states
  1576. next if @enemy.hidden_pages.include?("STATES")
  1577. $game_system.scanned_states[@enemy.id] = [] if
  1578. $game_system.scanned_states[@enemy.id] == nil
  1579. next if $game_system.scanned_states[@enemy.id] == [] and
  1580. YEZ::SCAN::REQUIRE_SCAN
  1581.  
  1582. when :skills
  1583. next if @enemy.hidden_pages.include?("SKILLS")
  1584. $game_system.scanned_skills[@enemy.id] = [] if
  1585. $game_system.scanned_skills[@enemy.id] == nil
  1586. next if $game_system.scanned_skills[@enemy.id] == [] and
  1587. YEZ::SCAN::REQUIRE_SCAN
  1588. if @skill_window == nil
  1589. @skill_window = Window_ScanSkills.new(@battler)
  1590. @skill_window.openness = 0
  1591. end
  1592.  
  1593. when :victory
  1594. next if @enemy.hidden_pages.include?("VICTORY")
  1595. if @spoils_window == nil
  1596. @spoils_window = Window_ScanSpoils.new(@battler)
  1597. end
  1598.  
  1599. else; next
  1600. end
  1601. @data.push(page)
  1602. end
  1603. end
  1604.  
  1605. #--------------------------------------------------------------------------
  1606. # update
  1607. #--------------------------------------------------------------------------
  1608. def update
  1609. @help_window.update
  1610. @data_window.update
  1611. @skill_window.update if @skill_window != nil
  1612. @spoils_window.update if @spoils_window != nil
  1613. super
  1614. return unless self.active
  1615. if Input.repeat?(Input::LEFT)
  1616. return if @data.size <= 1
  1617. YEZ::SCAN::PAGE_SOUND.play if YEZ::SCAN::PAGE_SOUND != nil
  1618. @page -= 1
  1619. @page = [@data.size-1, 0].max if @page < 0
  1620. refresh
  1621. elsif Input.repeat?(Input::RIGHT)
  1622. return if @data.size <= 1
  1623. YEZ::SCAN::PAGE_SOUND.play if YEZ::SCAN::PAGE_SOUND != nil
  1624. @page += 1
  1625. @page = 0 if @page + 1 > @data.size
  1626. refresh
  1627. elsif Input.trigger?(Input::X)
  1628. return if @data.size <= 1
  1629. return if @page == 0
  1630. YEZ::SCAN::PAGE_SOUND.play if YEZ::SCAN::PAGE_SOUND != nil
  1631. @page = 0
  1632. refresh
  1633. elsif Input.trigger?(Input::Y)
  1634. return if @data.size <= 1
  1635. return if @page == [@data.size-1, 0].max
  1636. YEZ::SCAN::PAGE_SOUND.play if YEZ::SCAN::PAGE_SOUND != nil
  1637. @page = [@data.size-1, 0].max
  1638. refresh
  1639. elsif ($TEST or $BTEST) and Input.trigger?(Input::F5)
  1640. Sound.play_equip
  1641. $game_system.full_scan(@battler)
  1642. create_pages
  1643. @page = 0
  1644. refresh
  1645. @skill_window.refresh if @skill_window != nil
  1646. @spoils_window.refresh if @spoils_window != nil
  1647. elsif Input.trigger?(Input::B) or Input.trigger?(Input::C) or
  1648. Input.trigger?(YEZ::SCAN::SCAN_BUTTON)
  1649. if Input.trigger?(Input::C)
  1650. Sound.play_decision
  1651. else
  1652. Sound.play_cancel
  1653. end
  1654. disappear
  1655. end
  1656. end
  1657.  
  1658. #--------------------------------------------------------------------------
  1659. # refresh
  1660. #--------------------------------------------------------------------------
  1661. def refresh
  1662. self.contents.clear
  1663. self.contents.font.size = Font.default_size
  1664. self.contents.font.color = normal_color
  1665. if @skill_window != nil
  1666. @skill_window.openness = 0
  1667. @skill_window.active = false
  1668. end
  1669. if @spoils_window != nil
  1670. @spoils_window.openness = 0
  1671. @spoils_window.active = false
  1672. end
  1673. draw_enemy_bitmap
  1674. case @data[@page]
  1675. when :general; draw_general_page
  1676. when :element; draw_element_page
  1677. when :states; draw_states_page
  1678. when :skills; draw_skills_page
  1679. when :victory; draw_victory_page
  1680. end
  1681. end
  1682.  
  1683. #--------------------------------------------------------------------------
  1684. # draw_enemy_bitmap
  1685. #--------------------------------------------------------------------------
  1686. def draw_enemy_bitmap
  1687. enemybit = Cache.battler(@battler.battler_name, @battler.battler_hue)
  1688. bw = enemybit.width
  1689. bh = enemybit.height
  1690. if bw > (self.width - 32)/2 - 24
  1691. bw = (self.width - 32)/2 - 24
  1692. bh *= (self.width - 32)/2 - 24
  1693. bh /= enemybit.width
  1694. end
  1695. if bh > (self.height - 32)
  1696. bh = (self.height - 32)
  1697. bw *= (self.height - 32)
  1698. bw /= enemybit.height
  1699. end
  1700. rect = Rect.new(0, 0, bw, bh)
  1701. rect.x = ((self.width - 32)/2 - 24 - rect.width) / 2
  1702. rect.y = (self.height - 32 - rect.height) / 2
  1703. self.contents.stretch_blt(rect, enemybit, enemybit.rect)
  1704. end
  1705.  
  1706. #--------------------------------------------------------------------------
  1707. # draw_general_page
  1708. #--------------------------------------------------------------------------
  1709. def draw_general_page
  1710. dy = WLH*6 + 9
  1711. color = Color.new(0, 0, 0, 80)
  1712. self.contents.fill_rect(0, dy, (self.width - 32)/2 - 24, WLH*3, color)
  1713. draw_general_states_list
  1714. draw_actor_stun(@battler, 1, dy - WLH) if $imported["ClassStatDUR"]
  1715. draw_enemy_hp(@battler, 1, dy, (self.width-32)/2 - 26); dy += WLH
  1716. draw_enemy_mp(@battler, 1, dy, (self.width-32)/2 - 26)
  1717. dy = WLH*8 - (YEZ::SCAN::STAT_COLUMN1.size*WLH) + 9
  1718. draw_enemy_stats(YEZ::SCAN::STAT_COLUMN1, (self.width-32)/2, dy)
  1719. draw_enemy_stats(YEZ::SCAN::STAT_COLUMN2, (self.width-32)*3/4, dy)
  1720. draw_general_elements
  1721. draw_general_states if YEZ::SCAN::STAT_COLUMN1.size <= 4
  1722. end
  1723.  
  1724. #--------------------------------------------------------------------------
  1725. # draw_general_states_list
  1726. #--------------------------------------------------------------------------
  1727. def draw_general_states_list
  1728. count = 0; dx = 0; dy = 0
  1729. @battler_states = @battler.states.clone if @battler_states == nil
  1730. for state in @battler_states
  1731. next if state.icon_index == 0
  1732. next if $imported["CoreFixesUpgradesMelody"] and state.hide_state
  1733. draw_icon(state.icon_index, dx + 24 * count, dy)
  1734. draw_state_turns(dx + 24 * count, dy, state, @battler) if
  1735. $imported["CoreFixesUpgradesMelody"]
  1736. count += 1
  1737. if (24 * count > (self.width-32)/2 - 24)
  1738. dx = 0; dy += WLH; count = 0
  1739. end
  1740. end
  1741. self.contents.font.color = normal_color
  1742. self.contents.font.bold = Font.default_bold
  1743. self.contents.font.size = Font.default_size
  1744. end
  1745.  
  1746. #--------------------------------------------------------------------------
  1747. # draw_enemy_hp
  1748. #--------------------------------------------------------------------------
  1749. def draw_enemy_hp(battler, dx, dy, dw = 120)
  1750. draw_enemy_hp_gauge(battler, dx, dy, dw)
  1751. self.contents.font.color = system_color
  1752. self.contents.draw_text(dx, dy, 30, WLH, Vocab::hp_a)
  1753. self.contents.font.color = hp_color(battler)
  1754. case YEZ::SCAN::DISPLAY_HP_STYLE
  1755. when 1 # Current Only
  1756. if $game_system.scanned["HP"].include?(@enemy.id) or
  1757. !YEZ::SCAN::REQUIRE_SCAN
  1758. text = battler.hp
  1759. else
  1760. mask = "?"
  1761. mask = mask * battler.hp.to_s.scan(/./).size
  1762. text = mask
  1763. end
  1764. when 2 # Current / Max
  1765. if $game_system.scanned["HP"].include?(@enemy.id) or
  1766. !YEZ::SCAN::REQUIRE_SCAN
  1767. text = sprintf("%s/%s", battler.hp, battler.maxhp)
  1768. else
  1769. mask = "?"
  1770. mask1 = mask * battler.hp.to_s.scan(/./).size
  1771. mask2 = mask * battler.maxhp.to_s.scan(/./).size
  1772. text = sprintf("%s/%s", mask1, mask2)
  1773. end
  1774. else # Percentile
  1775. if $game_system.scanned["HP"].include?(@enemy.id) or
  1776. !YEZ::SCAN::REQUIRE_SCAN
  1777. percent = battler.maxhp == 0 ? 0 : battler.hp * 100 / battler.maxhp
  1778. text = sprintf("%s%%", percent)
  1779. else
  1780. mask = "?"
  1781. percent = battler.maxhp == 0 ? 0 : battler.hp * 100 / battler.maxhp
  1782. mask = mask * percent.to_s.scan(/./).size
  1783. text = sprintf("%s%%", mask)
  1784. end
  1785. end
  1786. self.contents.draw_text(dx + 30, dy, dw - 32, WLH, text, 2)
  1787. end
  1788.  
  1789. #--------------------------------------------------------------------------
  1790. # draw_enemy_mp
  1791. #--------------------------------------------------------------------------
  1792. def draw_enemy_mp(battler, dx, dy, dw = 120)
  1793. self.contents.font.color = system_color
  1794. if $imported["BattleEngineMelody"] and battler.use_rage?
  1795. draw_actor_rage_gauge(battler, dx, dy, dw/2)
  1796. draw_enemy_mp_gauge(battler, dx + dw/2, dy, dw/2)
  1797. self.contents.draw_text(dx+dw/2, dy, 28, WLH, Vocab::mp_a, 0)
  1798. self.contents.draw_text(dx, dy, 28, WLH, Vocab::rage_a, 0)
  1799. else
  1800. draw_enemy_mp_gauge(battler, dx, dy, dw)
  1801. self.contents.draw_text(dx, dy, 28, WLH, Vocab::mp_a, 0)
  1802. end
  1803. case YEZ::SCAN::DISPLAY_MP_STYLE
  1804. when 1 # Current Only
  1805. if $game_system.scanned["MP"].include?(@enemy.id) or
  1806. !YEZ::SCAN::REQUIRE_SCAN
  1807. text = battler.mp
  1808. else
  1809. mask = "?"
  1810. mask = mask * battler.mp.to_s.scan(/./).size
  1811. text = mask
  1812. end
  1813. when 2 # Current / Max
  1814. if $game_system.scanned["MP"].include?(@enemy.id) or
  1815. !YEZ::SCAN::REQUIRE_SCAN
  1816. text = sprintf("%s/%s", battler.mp, battler.maxmp)
  1817. else
  1818. mask = "?"
  1819. mask1 = mask * battler.mp.to_s.scan(/./).size
  1820. mask2 = mask * battler.maxmp.to_s.scan(/./).size
  1821. text = sprintf("%s/%s", mask1, mask2)
  1822. end
  1823. else
  1824. if $game_system.scanned["MP"].include?(@enemy.id) or
  1825. !YEZ::SCAN::REQUIRE_SCAN
  1826. percent = battler.maxmp == 0 ? 0 : battler.mp * 100 / battler.maxmp
  1827. text = sprintf("%s%%", percent)
  1828. else
  1829. mask = "?"
  1830. percent = battler.maxmp == 0 ? 0 : battler.mp * 100 / battler.maxmp
  1831. mask = mask * percent.to_s.scan(/./).size
  1832. text = sprintf("%s%%", mask)
  1833. end
  1834. end # Percentile
  1835. if $imported["BattleEngineMelody"] and battler.use_rage?
  1836. self.contents.font.color = normal_color
  1837. if $game_system.scanned["MP"].include?(@enemy.id) or
  1838. !YEZ::SCAN::REQUIRE_SCAN
  1839. value = battler.rage
  1840. else
  1841. value = "???"
  1842. end
  1843. self.contents.draw_text(dx+20, dy, dw/2-22, WLH, value, 2)
  1844. self.contents.font.color = mp_color(battler)
  1845. self.contents.draw_text(dx+dw/2+20, dy, dw/2-22, WLH, text, 2)
  1846. else
  1847. self.contents.font.color = mp_color(battler)
  1848. self.contents.draw_text(dx + 30, dy, dw - 32, WLH, text, 2)
  1849. end
  1850. end
  1851.  
  1852. #--------------------------------------------------------------------------
  1853. # draw_enemy_stats
  1854. #--------------------------------------------------------------------------
  1855. def draw_enemy_stats(array, dx, dy)
  1856. self.contents.font.size = YEZ::SCAN::STAT_FONT_SIZE
  1857. masked = !($game_system.scanned["STATS"].include?(@enemy.id) or
  1858. !YEZ::SCAN::REQUIRE_SCAN)
  1859. count = 0; mask = "?"
  1860. for type in array
  1861. # up_icon = YEM::BATTLE_ENGINE::STATUS::AFFINITY_RANKS[:up]
  1862. # dn_icon = YEM::BATTLE_ENGINE::STATUS::AFFINITY_RANKS[:down]
  1863. case type
  1864. when :atk
  1865. # up_icon = YEM::ICON[:upatk] if $imported["Icons"]
  1866. # dn_icon = YEM::ICON[:dnatk] if $imported["Icons"]
  1867. icon = $imported["Icons"] ? YEM::ICON[:atk] : 693
  1868. icon = 50 if @battler.atk > @battler.base_atk
  1869. icon = 57 if @battler.atk < @battler.base_atk
  1870. value = masked ? mask * @battler.atk.to_s.scan(/./).size : @battler.atk
  1871. name = Vocab.atk
  1872. when :def
  1873. # up_icon = YEM::ICON[:updef] if $imported["Icons"]
  1874. # dn_icon = YEM::ICON[:dndef] if $imported["Icons"]
  1875. icon = $imported["Icons"] ? YEM::ICON[:def] : 694
  1876. icon = 51 if @battler.def > @battler.base_def
  1877. icon = 58 if @battler.def < @battler.base_def
  1878. value = masked ? mask * @battler.def.to_s.scan(/./).size : @battler.def
  1879. name = Vocab.def
  1880. when :spi
  1881. # up_icon = YEM::ICON[:upspi] if $imported["Icons"]
  1882. # dn_icon = YEM::ICON[:dnspi] if $imported["Icons"]
  1883. icon = $imported["Icons"] ? YEM::ICON[:spi] : 695
  1884. icon = 52 if @battler.spi > @battler.base_spi
  1885. icon = 59 if @battler.spi < @battler.base_spi
  1886. value = masked ? mask * @battler.spi.to_s.scan(/./).size : @battler.spi
  1887. name = Vocab.spi
  1888. when :agi
  1889. # up_icon = YEM::ICON[:upagi] if $imported["Icons"]
  1890. # dn_icon = YEM::ICON[:dnagi] if $imported["Icons"]
  1891. icon = $imported["Icons"] ? YEM::ICON[:agi] : 696
  1892. # Down here, "icon = " can be changed to the appropriate boosted stat
  1893. # icon in the IconSet file!
  1894. icon = 53 if @battler.agi > @battler.base_agi
  1895. icon = 60 if @battler.agi < @battler.base_agi
  1896. value = masked ? mask * @battler.agi.to_s.scan(/./).size : @battler.agi
  1897. name = Vocab.agi
  1898. when :hit
  1899. icon = $imported["Icons"] ? YEM::ICON[:hit] : 698
  1900. if masked
  1901. value = mask * [[@battler.hit, 0].max, 99].min.to_s.scan(/./).size
  1902. else
  1903. value = [[@battler.hit, 0].max, 99].min
  1904. end
  1905. value = sprintf("%s%%", value)
  1906. name = Vocab.hit
  1907. when :eva
  1908. icon = $imported["Icons"] ? YEM::ICON[:eva] : 699
  1909. if masked
  1910. value = mask * [[@battler.eva, 0].max, 99].min.to_s.scan(/./).size
  1911. else
  1912. value = [[@battler.eva, 0].max, 99].min
  1913. end
  1914. value = sprintf("%s%%", value)
  1915. name = Vocab.eva
  1916. when :cri
  1917. icon = $imported["Icons"] ? YEM::ICON[:cri] : 0
  1918. if masked
  1919. value = mask * [[@battler.cri, 0].max, 99].min.to_s.scan(/./).size
  1920. else
  1921. value = [[@battler.cri, 0].max, 99].min
  1922. end
  1923. value = sprintf("%s%%", value)
  1924. name = Vocab.cri
  1925. when :odds
  1926. icon = $imported["Icons"] ? YEM::ICON[:odds] : 0
  1927. n = 0
  1928. for member in $game_troop.existing_members; n += member.odds; end
  1929. if masked
  1930. value = mask *[[@battler.odds*100/n,1].max,99].min.to_s.scan(/./).size
  1931. else
  1932. value = [[@battler.odds * 100 / n, 1].max, 99].min
  1933. end
  1934. value = sprintf("%s%%", value)
  1935. name = Vocab.odds
  1936. when :res
  1937. next unless $imported["RES Stat"]
  1938. # up_icon = YEM::ICON[:upres] if $imported["Icons"]
  1939. # dn_icon = YEM::ICON[:dnres] if $imported["Icons"]
  1940. icon = $imported["Icons"] ? YEM::ICON[:res] : 700
  1941. # icon = up_icon if @battler.res > @battler.base_res
  1942. # icon = dn_icon if @battler.res < @battler.base_res
  1943. value = masked ? mask * @battler.res.to_s.scan(/./).size : @battler.res
  1944. name = Vocab.res
  1945. when :dex
  1946. next unless $imported["DEX Stat"]
  1947. # up_icon = YEM::ICON[:updex] if $imported["Icons"]
  1948. # dn_icon = YEM::ICON[:dndex] if $imported["Icons"]
  1949. icon = $imported["Icons"] ? YEM::ICON[:dex] : 701
  1950. icon = 55 if @battler.dex > @battler.base_dex
  1951. icon = 62 if @battler.dex < @battler.base_dex
  1952. value = masked ? mask * @battler.dex.to_s.scan(/./).size : @battler.dex
  1953. name = Vocab.dex
  1954. when :luk
  1955. next unless $imported["ClassStatLUK"]
  1956. # up_icon = YEM::ICON[:upluk] if $imported["Icons"]
  1957. # dn_icon = YEM::ICON[:dnluk] if $imported["Icons"]
  1958. icon = $imported["Icons"] ? YEM::ICON[:luk] : 0
  1959. icon = up_icon if @battler.luk > @battler.base_luk
  1960. icon = dn_icon if @battler.luk < @battler.base_luk
  1961. value = masked ? mask * @battler.luk.to_s.scan(/./).size : @battler.luk
  1962. name = Vocab.luk
  1963. when :dur
  1964. next unless $imported["ClassStatDUR"]
  1965. icon = $imported["Icons"] ? YEM::ICON[:dur] : 0
  1966. value = masked ? mask * @battler.max_dur.to_s.scan(/./).size :
  1967. @battler.max_dur
  1968. name = Vocab.dur
  1969. else; next
  1970. end
  1971. draw_icon(icon, dx, dy)
  1972. self.contents.font.color = system_color
  1973. self.contents.draw_text(dx+24, dy, 40, WLH, name, 0)
  1974. self.contents.font.color = normal_color
  1975. self.contents.draw_text(dx+64, dy, 52, WLH, value, 2)
  1976. dy += WLH; count += 1
  1977. break if count > 6
  1978. end
  1979. end
  1980.  
  1981. #--------------------------------------------------------------------------
  1982. # draw_general_elements
  1983. #--------------------------------------------------------------------------
  1984. def draw_general_elements
  1985. $game_system.scanned_elements[@enemy.id] = [] if
  1986. $game_system.scanned_elements[@enemy.id] == nil
  1987. self.contents.font.size = YEZ::SCAN::GENERAL_ELEMENT_FONT_SIZE
  1988. dy = 0; dx = (self.width-32) * 3/4
  1989. spacing = YEZ::SCAN::GENERAL_ELEMENT_SPACING
  1990. dx -= YEZ::SCAN::SHOWN_ELEMENTS_LIST.size * spacing/2
  1991. for ele_id in YEZ::SCAN::SHOWN_ELEMENTS_LIST
  1992. next if ele_id > $data_system.elements.size
  1993. icon = YEZ::SCAN::ELEMENT_ICONS[ele_id]
  1994. draw_icon(icon, dx + (spacing-24)/2, dy)
  1995. if $game_system.scanned_elements[@enemy.id].include?(ele_id) or
  1996. !YEZ::SCAN::REQUIRE_SCAN
  1997. rate = @battler.element_rate(ele_id)
  1998. text = sprintf("%+d%%", rate - 100)
  1999. if rate > 200; setting = :srank
  2000. elsif rate > 150; setting = :arank
  2001. elsif rate > 100; setting = :brank
  2002. elsif rate > 50; setting = :crank
  2003. elsif rate > 0; setting = :drank
  2004. elsif rate == 0; setting = :erank
  2005. else
  2006. setting = :frank
  2007. text = sprintf("%d%%", rate * -1)
  2008. end
  2009. else
  2010. setting = :nodata
  2011. text = "-"
  2012. end
  2013. colour = YEZ::SCAN::RANK_SETTINGS[setting][0]
  2014. self.contents.font.color = text_color(colour)
  2015. self.contents.draw_text(dx+2, dy+WLH, spacing-4, WLH, text, 1)
  2016. dx += spacing
  2017. end
  2018. end
  2019.  
  2020. #--------------------------------------------------------------------------
  2021. # draw_general_states
  2022. #--------------------------------------------------------------------------
  2023. def draw_general_states
  2024. $game_system.scanned_states[@enemy.id] = [] if
  2025. $game_system.scanned_states[@enemy.id] == nil
  2026. self.contents.font.size = YEZ::SCAN::GENERAL_ELEMENT_FONT_SIZE
  2027. dy = WLH*2+4; dx = (self.width-32) * 3/4
  2028. spacing = YEZ::SCAN::GENERAL_ELEMENT_SPACING
  2029. dx -= YEZ::SCAN::SHOWN_STATES_LIST.size * spacing/2
  2030. for state_id in YEZ::SCAN::SHOWN_STATES_LIST
  2031. state = $data_states[state_id]
  2032. next if state == nil
  2033. icon = state.icon_index
  2034. draw_icon(icon, dx + (spacing-24)/2, dy)
  2035. if $game_system.scanned_states[@enemy.id].include?(state_id) or
  2036. !YEZ::SCAN::REQUIRE_SCAN
  2037. rate = @battler.state_probability(state_id)
  2038. text = sprintf("%d%%", rate)
  2039. if rate > 100; setting = :srank
  2040. elsif rate > 80; setting = :arank
  2041. elsif rate > 60; setting = :brank
  2042. elsif rate > 40; setting = :crank
  2043. elsif rate > 20; setting = :drank
  2044. elsif rate > 0; setting = :erank
  2045. else; setting = :frank
  2046. end
  2047. else
  2048. setting = :nodata
  2049. text = "-"
  2050. end
  2051. colour = YEZ::SCAN::RANK_SETTINGS[setting][0]
  2052. self.contents.font.color = text_color(colour)
  2053. self.contents.draw_text(dx+2, dy+WLH, spacing-4, WLH, text, 1)
  2054. dx += spacing
  2055. end
  2056. end
  2057.  
  2058. #--------------------------------------------------------------------------
  2059. # draw_element_page
  2060. #--------------------------------------------------------------------------
  2061. def draw_element_page
  2062. dx = (self.width-32)/2; dy = 0; dw = (self.width-32)/5
  2063. for ele_id in YEZ::SCAN::SHOWN_ELEMENTS_LIST
  2064. next if ele_id > $data_system.elements.size
  2065. self.contents.font.color = normal_color
  2066. self.contents.font.size = Font.default_size
  2067. icon = YEZ::SCAN::ELEMENT_ICONS[ele_id]
  2068. draw_icon(icon, dx, dy)
  2069. name = $data_system.elements[ele_id]
  2070. self.contents.draw_text(dx+24, dy, dw-24, WLH, name, 0)
  2071. if $game_system.scanned_elements[@enemy.id].include?(ele_id) or
  2072. !YEZ::SCAN::REQUIRE_SCAN
  2073. rate = @battler.element_rate(ele_id)
  2074. text = sprintf("%+d%%", rate - 100)
  2075. if rate > 200; setting = :srank
  2076. elsif rate > 150; setting = :arank
  2077. elsif rate > 100; setting = :brank
  2078. elsif rate > 50; setting = :crank
  2079. elsif rate > 0; setting = :drank
  2080. elsif rate == 0; setting = :erank
  2081. else
  2082. setting = :frank
  2083. text = sprintf("%d%%", rate * -1)
  2084. end
  2085. colour = YEZ::SCAN::RANK_SETTINGS[setting][0]
  2086. data = YEZ::SCAN::RANK_SETTINGS[setting][1]
  2087. else
  2088. colour = YEZ::SCAN::RANK_SETTINGS[:nodata][0]
  2089. data = YEZ::SCAN::RANK_SETTINGS[:nodata][1]
  2090. text = "---"
  2091. end
  2092. self.contents.font.color = text_color(colour)
  2093. self.contents.draw_text(dx+dw, dy, dw/2, WLH, text, 2)
  2094. self.contents.font.color = normal_color
  2095. self.contents.draw_text(dx+dw*3/2+12, dy, dw-12, WLH, data, 0)
  2096. dy += WLH
  2097. end
  2098. end
  2099.  
  2100. #--------------------------------------------------------------------------
  2101. # draw_states_page
  2102. #--------------------------------------------------------------------------
  2103. def draw_states_page
  2104. dx = (self.width-32)/2; dy = 0; dw = (self.width-32)/5
  2105. for state_id in YEZ::SCAN::SHOWN_STATES_LIST
  2106. state = $data_states[state_id]
  2107. next if state == nil
  2108. self.contents.font.color = normal_color
  2109. self.contents.font.size = Font.default_size
  2110. icon = state.icon_index
  2111. draw_icon(icon, dx, dy)
  2112. name = state.name
  2113. self.contents.draw_text(dx+24, dy, dw-24, WLH, name, 0)
  2114. if $game_system.scanned_states[@enemy.id].include?(state_id) or
  2115. !YEZ::SCAN::REQUIRE_SCAN
  2116. rate = @battler.state_probability(state_id)
  2117. text = sprintf("%d%%", rate)
  2118. if rate >= 100; setting = :srank
  2119. elsif rate > 80; setting = :arank
  2120. elsif rate > 60; setting = :brank
  2121. elsif rate > 40; setting = :crank
  2122. elsif rate > 20; setting = :drank
  2123. elsif rate > 0; setting = :erank
  2124. else; setting = :frank
  2125. end
  2126. colour = YEZ::SCAN::RANK_SETTINGS[setting][0]
  2127. data = YEZ::SCAN::RANK_SETTINGS[setting][2]
  2128. else
  2129. colour = YEZ::SCAN::RANK_SETTINGS[:nodata][0]
  2130. data = YEZ::SCAN::RANK_SETTINGS[:nodata][2]
  2131. text = "---"
  2132. end
  2133. self.contents.font.color = text_color(colour)
  2134. self.contents.draw_text(dx+dw, dy, dw/2, WLH, text, 2)
  2135. self.contents.font.color = normal_color
  2136. self.contents.draw_text(dx+dw*3/2+12, dy, dw-12, WLH, data, 0)
  2137. dy += WLH
  2138. end
  2139. end
  2140.  
  2141. #--------------------------------------------------------------------------
  2142. # draw_skills_page
  2143. #--------------------------------------------------------------------------
  2144. def draw_skills_page
  2145. self.contents.font.color = system_color
  2146. text = YEZ::SCAN::SKILL_TITLE
  2147. dx = (self.width-32)/2
  2148. self.contents.draw_text(dx, 0, dx, WLH, text, 1)
  2149. @skill_window.openness = 255
  2150. @skill_window.active = true
  2151. end
  2152.  
  2153. #--------------------------------------------------------------------------
  2154. # draw_victory_page
  2155. #--------------------------------------------------------------------------
  2156. def draw_victory_page
  2157. dx = (self.width-32)/2; dy = 0
  2158. @spoils_window.openness = 255
  2159. @spoils_window.active = true
  2160. end
  2161.  
  2162. end # Window_ScanQuery
  2163.  
  2164. #===============================================================================
  2165. #
  2166. # END OF FILE
  2167. #
  2168. #===============================================================================
  2169.  
Advertisement
Add Comment
Please, Sign In to add comment