Advertisement
theguyver

Untitled

Jul 21st, 2016
541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 116.22 KB | None | 0 0
  1. =begin
  2. ===============================================================================
  3. Fantasy Bestiary v3.4 (29/1/2015)
  4. -------------------------------------------------------------------------------
  5. Created By: Shadowmaster/Shadowmaster9000/Shadowpasta
  6. (www.crimson-castle.co.uk)
  7. Special Thanks: KilloZapit (For the Word Wrap script that this script uses a
  8. part of)
  9.  
  10. KilloZapit's Word Wrap Script: http://www.rpgmakervxace.net/topic/6964-word-wrapping-message-boxes/
  11.  
  12. ===============================================================================
  13. Information
  14. -------------------------------------------------------------------------------
  15. This script adds a Bestiary that allows you to view enemy information. It can
  16. be accessed either from the main menu or through a script call. This Bestiary
  17. uses a design heavily inspired by the types of Bestiaries used in the Final
  18. Fantasy series (hence the name).
  19.  
  20. The Bestiary is split up into two sections. The first section contains a
  21. vertical listing of enemies. When an enemy is selected, you are taken to
  22. the enemy's page (the second section), where you can view the enemy's sprite,
  23. as well as various statistics.
  24.  
  25. Each enemy can have any number of pages to display various information, which
  26. can be toggled with the confirm button. While on an enemy's page, you can still
  27. scroll to other enemies.
  28.  
  29. ===============================================================================
  30. How to Use
  31. -------------------------------------------------------------------------------
  32. Place this script under Materials. You can call the Bestiary scene by using the
  33. script call:
  34.  
  35. SceneManager.call(Scene_Bestiary)
  36.  
  37. Further down are some options you can change to your liking.
  38.  
  39. ===============================================================================
  40. Note Tags
  41. -------------------------------------------------------------------------------
  42. Place any of these note tags within an enemy in the database.
  43.  
  44. <hide from bestiary>
  45. Enemies with this notetag will automatically be hidden when you start up the
  46. beginning of the game. (This will not work for old save files, in which case
  47. you will need to use the Hide Enemy script call.) Hidden enemies do not count
  48. towards the Completion tracker. You can still unhide this enemy later on by
  49. using the Unhide Enemy script call.
  50.  
  51. <hide hp>
  52. <hide mp>
  53. <hide stats>
  54. <hide spoils>
  55. Enemies with the hide hp and hide mp notetags will have their hp and mp values
  56. hidden respectively. Enemies with the hide stats notetag will have their ATK,
  57. DEF, MAT, MDF, AGI and LUK values hidden. Enemies with the hide spoils notetag
  58. will have their Gold, Exp and Drops hidden.
  59.  
  60. <bestiary image: "string">
  61. When using this notetag, instead of using the image used in the database, the
  62. enemy will use the image set in this notetag, where "string" is the filename of
  63. image to be used from the battler folder (excluding the file format extension).
  64.  
  65. <bestiary hue: n>
  66. When using the besitary image tag, you can use this tag to set a hue for the
  67. bestiary image, where n is the value of the hue used.
  68.  
  69. <mirror bestiary image>
  70. When using this notetag, the enemy's image in the Bestiary will be mirrored.
  71.  
  72. <bestiary holders pose: n1 n2>
  73. If using Holders Battlers with Battle Engine Symphony, you can use this
  74. notetag to determine the enemy's pose in the Bestiary, where n1 is the line
  75. and n2 is the frame.
  76.  
  77. <bestiary bgm: "string" n1 n2>
  78. Loading up the enemy's entry will play the bgm stored in this notetag, where
  79. "string" is the filename of the bgm (exluding the file format extension), n1
  80. is the volume and n2 is the pitch. You do not need to include the n1 and n2
  81. variables.
  82.  
  83. <x offset: n>
  84. <y offset: n>
  85. Allows you to adjust the enemy sprite's x or y position, where n is the number
  86. you want to adjust it by. Using a positive number for x moves the enemy to the
  87. right, using a negative number for y moves them to the left. Using a positive
  88. number for y moves the enemy down, using a negative number for y moves them up.
  89.  
  90. <battleback1: "string">
  91. <battleback2: "string">
  92. Loads up a battleback behind the enemy sprite, where "string" is the file of
  93. the battleback (excluding the file format extension). battleback1 loads the
  94. battleback from the Battlebacks1 folder, while battleback2 loads the battleback
  95. from the Battlebacks2 folder.
  96.  
  97. <battleback x offset: n>
  98. <battleback y offset: n>
  99. If the battlebacks are not set to cover the entire screen, these tags
  100. allow you to adjust the enemy's battleback x or y position, where n is the
  101. number you want to adjust it by. Using a positive number for x moves the
  102. battleback to the right, using a negative number for x moves the battleback to
  103. the left. Using a positive number for y moves the battleback down, using a
  104. negative number for y moves it up.
  105.  
  106. <completion bonus: n>
  107. Sets the enemy's completion bonus, where n is the number you want to set it to.
  108. At default, all enemies have a completion bonus of 0. If an enemy has a
  109. completion bonus of 1, they add +1% to the completion percentage. Using this
  110. will allow you to exceed the standard maximum completion total. Ignore this if
  111. you dont plan on displaying the Completion Total as a percentage.
  112.  
  113. <bestiary icon: n>
  114. Lets you set an icon for the enemy, where n is the index number of the icon
  115. you want to use. You can also change an enemy's bestiary icon in mid-play
  116. by using the script call change_bestiary_icon(enemy id, index).
  117.  
  118. <bestiary level: n>
  119. Sets the enemy's level, where n is the level number. This number is purely
  120. for cosmetic purposes and does not increase the enemy's base stats the
  121. higher the number. If the enemy's level is set to be viewed in the Bestiary
  122. and that enemy has no level tag, their level will simply appear as "???". You
  123. can also change the enemy's level mid-play by using the script call
  124. change_enemy_level(enemy id, level).
  125.  
  126. <type: "string">
  127. <location: "string">
  128. <elem weak: "string">
  129. <elem resist: "string">
  130. <elem immune: "string">
  131. <elem absorb: "string">
  132. <state weak: "string">
  133. <state resist: "string">
  134. <state immune: "string">
  135. <skills pg1: "string">
  136. <skills pg2: "string">
  137. <skills pg3: "string">
  138. <long desc: "string">
  139. Replace string with anything you want. You can set a new line within a string
  140. by using \L. Other control characters can be used such as using \I[n] for
  141. displaying icons. If any of those tags are not set up for an enemy, the text
  142. in that respective area will simply appear as "None".
  143.  
  144. <desc: "string">
  145. Replace string with anything you want. You can set a new line within a string
  146. by using \L. Only 2 lines of space are available. You can ignore this if you
  147. have set up the description window to not show up.
  148.  
  149. ===============================================================================
  150. Script Calls
  151. -------------------------------------------------------------------------------
  152.  
  153. reveal_enemy(enemy id)
  154. Reveals the enemy in the Bestiary. If the enemy has been set to hide, you
  155. will still not see the enemy in the Bestiary until you unhide them.
  156.  
  157. unreveal_enemy(enemy id)
  158. Unreveals the enemy in the Bestiary. They are still set to be tracked by the
  159. Bestiary and will still count towards your Completion total. If you want the
  160. enemy you just unrevealed to not count towards your Completion total, use the
  161. Hide Enemy script call.
  162.  
  163. hide_enemy(enemy id)
  164. Removes the enemy from the Bestiary listings. The enemy will no longer be
  165. tracked by the Completion tracker regardless of whether the enemy was revealed
  166. beforehand or not.
  167.  
  168. unhide_enemy(enemy id)
  169. Adds the hidden enemy back onto the Bestiary listings. If they were revealed
  170. before being hidden, they will return back onto the Bestiary as revealed.
  171. If they were unrevealed before being hidden, they will stay unrevealed until
  172. you reveal them.
  173.  
  174. change_enemy_level(enemy id, level)
  175. Changes the enemy's level that appears in the Bestiary. If you want to remove
  176. an enemy's level, replace level with nil.
  177.  
  178. change_bestiary_icon(enemy id, index)
  179. Changes the enemy's icon that appears in the Bestiary. Use an value of 0 for
  180. index if you want to remove the enemy's icon.
  181.  
  182. ===============================================================================
  183. Required
  184. -------------------------------------------------------------------------------
  185. Nothing.
  186.  
  187. ===============================================================================
  188. Other User Script Features
  189. -------------------------------------------------------------------------------
  190. I've added some extra functionality to the Bestiary when using certain scripts:
  191.  
  192. Yanfly Ace Engine Core
  193. ----------------------
  194. Also when using the Yanfly Engine Ace Core script, if grouping numbers is
  195. enabled, this script will group the numbers on the first status page for
  196. enemies in the Bestiary.
  197.  
  198. Battle Engine Symphony
  199. ----------------------
  200. The Bestiary can read any Holders Battlers notetags and will load that
  201. enemy's holders battler image instead of their normal image. This image
  202. will automatically be mirrored, but can be un-mirrored using the
  203. <mirror bestiary image> tag. You can also use the <bestiary holders pose: n1 n2>
  204. tag to determine what pose the enemy uses in the Bestiary.
  205.  
  206. If you don't wish to use the enemy's holders battler image for the bestiary,
  207. use the <bestiary image: "string"> notetag inside of the enemy's notetag area.
  208.  
  209. ===============================================================================
  210. Change log
  211. -------------------------------------------------------------------------------
  212. v3.4: Since KilloZapit's Word Wrapping script does not work with Fantasy
  213. Bestiary due to this script overwriting methods that KilloZapit's Word Wrapping
  214. script uses, I've added KilloZapit's Word Wrapping functionality into this
  215. script. (29/1/2015)
  216. v3.3: Fixed a bug where the BGM played by the Bestiary wasn't affected by any
  217. settings from Yanfly's System Options script. (20/11/2014)
  218. v3.2: Slightly reduced number of lines used and changed how various data is
  219. called to help make it compatible with the New Game Plus Add-On. (10/9/2014)
  220. v3.1: Fixed an error where using the Bestiary on an old save file and killing
  221. an enemy before viewing the Bestiary will throw up an error. Also fixed the
  222. Defeated, Level, Gold and Exp strings so you can now use control characters in
  223. them. (01/8/2014)
  224. v3.0: You can now set how many pages you want and how which sections you want
  225. on each page. Also added new sections such as State information, Skills info
  226. and an additional information section for anyone who doesn't want to use the
  227. descriptipn window. Icon implementation has changed so you can now insert icons
  228. anywhere in section titles you want. Also changed \N to \L to insert linebreaks
  229. to allow for actor name implementation with \N[i]. You can now set a default
  230. battleback for all enemies. Fixed a bug where if replaying map bgm was disabled,
  231. the map bgm still played. This has now been corrected. Also fixed the description
  232. notetag so the script guidelines now show the correct description notetag.
  233. New enemies added to the database should now work correctly for old save files.
  234. (27/7/2014)
  235. v2.0: Added icon support for various areas of the Bestiary, you can now set
  236. icons for individual enemies, category titles and category areas. You can
  237. also change an enemy's level and icon mid-play using script calls. Users now
  238. the option of easily adding a second tracker and can give any name to both
  239. completion trackers. Completion variables now also work while the Completion
  240. values aren't displayed as a percentage. Finally, users of Battle Engine Symphony
  241. Holders Battlers can now set what pose they want for each individual enemy in
  242. the Bestiary. (22/10/2013)
  243. v1.5: Added various enemy viewing options. You can now set an alternate picture
  244. for the enemy to use with a note tag. Added an option to allow the battleback
  245. to stretch across the entire screen and not just be kept inside of the enemy
  246. picture window. Added the option to mirror enemy images using a notetag. I've
  247. also added compatibility with Battle Engine Symphony Holders Battlers, where
  248. this script will detect a enemy's holders battlers name and use that image
  249. as the enemy's image in the Bestiary. (21/10/2013)
  250. v1.1: Added ability to tie Completion Percentage to a variable and give enemies
  251. a completion bonus. (15/05/2013)
  252. v1.0: First release. (04/05/2013)
  253.  
  254. ===============================================================================
  255. Terms of Use
  256. -------------------------------------------------------------------------------
  257. * Free to use for both commercial and non-commerical projects.
  258. * Credit me and KilloZapit if used.
  259. * Do not claim this as your own.
  260. * You're free to post this on other websites, but please credit me and keep
  261. the header intact.
  262. * If you want to release any modifications/add-ons for this script, the
  263. add-on script must use the same Terms of Use as this script uses. (But you
  264. can also require any users of your add-on script to credit you in their game
  265. if they use your add-on script.)
  266. * If you're making any compatibility patches or scripts to help this script
  267. work with other scripts, the Terms of Use for the compatibility patch does
  268. not matter so long as the compatibility patch still requires this script to
  269. run.
  270. * If you want to use your own seperate Terms of Use for your version or
  271. add-ons of this script, you must contact me at http://www.rpgmakervxace.net
  272. or www.crimson-castle.co.uk
  273.  
  274. ===============================================================================
  275. =end
  276. $imported = {} if $imported.nil?
  277. $imported["FantasyBestiary"] = true
  278.  
  279. module FantasyBestiary
  280.  
  281. #==============================================================================
  282. # ** Menu Access
  283. #------------------------------------------------------------------------------
  284. # If set to true, the Bestiary can be accessed from the main menu, and will be
  285. # placed under all of the main commands (Item, Skill, Equip and Status). If
  286. # set to false, you will need to call the Bestiary scene through a script call:
  287. #
  288. # SceneManager.call(Scene_Bestiary)
  289. #==============================================================================
  290.  
  291. Menu_Access = false
  292.  
  293. #==============================================================================
  294. # ** Vocab
  295. #------------------------------------------------------------------------------
  296. # This allows you to change the names for various stats, headers and other
  297. # pieces of text.
  298. #
  299. # For all strings with the exception of Besitary_Name, you can insert various
  300. # control characters such as icons \I[N] in the string. The string for
  301. # Bestiary_Name must be contained in "". All other strings must be contained
  302. # in '' instead.
  303. #==============================================================================
  304.  
  305. Bestiary_Name = "Bestiary"
  306. Defeated = 'Defeated'
  307. Level = 'Level'
  308. Exp = 'Exp'
  309. Currency = 'Gold'
  310. Drops_Name = 'Drops'
  311. Type = 'Types'
  312. Location = 'Locations'
  313. Elem_Weak = 'Elemental Weaknesses'
  314. Elem_Resist = 'Elemental Resistances'
  315. Elem_Immune = 'Elemental Immunities'
  316. Elem_Absorb = 'Elemental Absorption'
  317. State_Weak = 'State Weaknesses'
  318. State_Resist = 'State Resistances'
  319. State_Immune = 'State Immunities'
  320. Skills_1 = 'Skills Page 1'
  321. Skills_2 = 'Skills Page 2'
  322. Skills_3 = 'Skills Page 3'
  323. Long_Desc = 'Information'
  324. Empty_Text = 'None'
  325. Toggle_Status_Text = 'Press Confirm to Toggle'
  326.  
  327. #==============================================================================
  328. # ** Drop Icon Options
  329. #------------------------------------------------------------------------------
  330. # If Show_Drop_Icons is set to true, icons for the enemy's droppable items
  331. # will appear next to the drop name if the spoils haven't been hidden.
  332. #==============================================================================
  333.  
  334. Show_Drop_Icons = false
  335.  
  336. #==============================================================================
  337. # ** Reveal and Kill Options
  338. #------------------------------------------------------------------------------
  339. # When Spot_Reveal is set to true, the enemy will reveal itself in the Bestiary
  340. # as soon as you see it in battle (unless if the enemy is set to hidden, in
  341. # which case it will still not show up).
  342. #
  343. # When Kill_Reveal is set to true, when you kill an enemy that enemy is
  344. # automatically set to reveal itself in the Bestiary (unless if the enemy is
  345. # set to hidden, in which case it will still not show up).
  346. #
  347. # If both Spot_Reveal & Kill_Reveal are set to false, you will have to manually
  348. # reveal each enemy yourself using the script call:
  349. #
  350. # reveal_enemy(id)
  351. #
  352. # When Show_Kill is set to true, you will see the kill count for all
  353. # enemies even if they are unrevealed. If set to false, the kill count
  354. # for any unrevealed enemies will simply show up as "?".
  355. #==============================================================================
  356.  
  357. Spot_Reveal = false
  358. Kill_Reveal = true
  359. Show_Kill = true
  360.  
  361. #==============================================================================
  362. # ** Completion Window Options
  363. #------------------------------------------------------------------------------
  364. # Setting Completion_Window to true will make the Completion Window appear on
  365. # the first page showing how much of the Bestiary you have completed. Setting
  366. # this to false will give the enemy listing more space on the first page.
  367. #
  368. # Completion_Percent when set to true will display how much of the Bestiary
  369. # you have completed as a percentage.
  370. #
  371. # When Completion_Variable is set to any value higher than 0, the Completion
  372. # Tracker will instead display the value currently set for the Variable ID
  373. # equal to Completion_Variable's value.
  374. #
  375. # When Second_Tracker is set to true, a second tracker will show up, which
  376. # can be used to track other things related to the enemies. It is recommended
  377. # to use Second_Tracker_Variable with this, otherwise both Completion_Window
  378. # and Second_Tracker will show the same data.
  379. #
  380. # Completion_Align sets how the Completion text is aligned in its window:
  381. #
  382. # 0 = Left
  383. # 1 = Middle
  384. # 2 = Right
  385. #
  386. # The effects of Completion_Align are disabled while Second_Tracker is
  387. # activated.
  388. #==============================================================================
  389.  
  390. Completion_Window = true
  391. Completion_Name = "Completed: "
  392. Completion_Percent = false
  393. Completion_Variable = 0
  394. Second_Tracker = false
  395. Second_Tracker_Name = "Marked: "
  396. Second_Tracker_Percent = true
  397. Second_Tracker_Variable = 0
  398. Completion_Align = 1
  399.  
  400. #==============================================================================
  401. # ** Enemy Status Window Options
  402. #------------------------------------------------------------------------------
  403. # Status_Page_Width Determines the width of the status page. The larger the
  404. # status page, the more space your stats will have, but at the same time, this
  405. # will also give you less space to view the enemy sprite.
  406. #
  407. # Default_Battleback1 and Default_Battleback2 sets default battlebacks for
  408. # any enemies lacking battleback notetags. If you don't want to use any
  409. # default battlebacks, leave an empty string like "".
  410. #
  411. # When Battleback_Full_Screen is set to true, the window frame for the enemy
  412. # and battleback images will disappear and the battleback images will cover
  413. # the background of the entire screen instead of just the enemy image window.
  414. #
  415. # When Battleback_Full_Screen is set to false, Enemy_Picture_Padding Determines
  416. # the padding for the enemy's sprite and battleback inside its window. The
  417. # higher the padding is, the more that will be cut off of the enemy sprite and
  418. # battleback. This is useful if in case you are using any custom window
  419. # designs. For the default window design, the default value is 6.
  420. #
  421. # When Global_Mirror is set to true, all enemies in the Bestiary will
  422. # have their images mirrored. This is useful for when using a custom battle
  423. # system that automatically flips an enemy's image. You can still use the
  424. # <mirror bestiary image> tag to un-mirror an enemy.
  425. #==============================================================================
  426.  
  427. Status_Page_Width = 200
  428. Default_Battleback1 = "Grassland"
  429. Default_Battleback2 = ""
  430. Battleback_Full_Screen = true
  431. Enemy_Picture_Padding = 6
  432. Global_Mirror = true
  433.  
  434. #==============================================================================
  435. # ** Replay Map BGM when Enemy has no BGM
  436. #------------------------------------------------------------------------------
  437. # If set to true, when viewing an enemy that has no Bestiary BGM assigned to
  438. # it through notetagging, the Map BGM will be replayed. If set to false, when
  439. # viewing an enemy with no BGM, all music will be turned off.
  440. #
  441. # Regardless of whether this is set to true or false, the Map BGM will always
  442. # replay whenever you return to the first screen of the Bestiary.
  443. #==============================================================================
  444.  
  445. Replay_Map_BGM = true
  446.  
  447. #==============================================================================
  448. # ** Page Structure
  449. #------------------------------------------------------------------------------
  450. # This is where you can insert how many pages you want in the Bestiary, along
  451. # with which sections you want on each page. Below are the list of strings
  452. # available and what they add to the page:
  453. #
  454. # "Space" = Adds a line break between sections.
  455. # "Line" = Adds a line bar between sections.
  456. # "Kill Count" = Shows how many of that enemy have been defeated.
  457. # "Level" = Shows the enemy's level that has been assigned to the enemy.
  458. # "HP" = Shows enemy's max HP.
  459. # "MP" = Shows enemy's max MP.
  460. # "Stats" = Shows the enemy's parameters. There is an option below that lets
  461. # you set how many parameters you want to be viewable.
  462. # "Exp" = Shows how much Exp the enemy gives.
  463. # "Gold" = Shows how much Gold the enemy gives.
  464. # "Drop Title" = Shows the Drop title.
  465. # "Drop" = Shows what items the enemy can drop.
  466. # "Type Title" = Shows the Types title.
  467. # "Type" = Shows a list of the types assigned to the enemy through the
  468. # <type: "string"> notetag.
  469. # "Location Title" = Shows the Location title.
  470. # "Location" = Shows a list of the locations assigned to the enemy through the
  471. # <location: "string"> notetag.
  472. # "Elem Weak Title" = Shows the Elemental Weaknesses title.
  473. # "Elem Weak" = Shows a list of elemental weaknesses assigned to the enemy
  474. # through the <elem weak: "string"> notetag.
  475. # "Elem Resist Title" = Shows the Elemental Resistances title.
  476. # "Elem Resist" = Shows a list of elemental resistances assigned to the enemy
  477. # through the <elem resist: "string"> notetag.
  478. # "Elem Immune Title" = Shows the Elemental Immunities title.
  479. # "Elem Immune" = Shows a list of elemental immunities assigned to the enemy
  480. # through the <elem immune: "string"> notetag.
  481. # "Elem Absorb Title" = Shows the Elemental Absorptions title.
  482. # "Elem Absorb" = Shows a list of elemental absorptions assigned to the enemy
  483. # through the <elem absorb: "string"> notetag.
  484. # "State Weak Title" = Shows the State Weaknesses title.
  485. # "State Weak" = Shows a list of state weaknesses assigned to the enemy
  486. # through the <elem weak: "string"> notetag.
  487. # "State Resist Title" = Shows the State Resistances title.
  488. # "State Resist" = Shows a list of state resistances assigned to the enemy
  489. # through the <elem resist: "string"> notetag.
  490. # "State Immune Title" = Shows the State Immunities title.
  491. # "State Immune" = Shows a list of state immunities assigned to the enemy
  492. # through the <elem immune: "string"> notetag.
  493. # "Skills 1 Title" = Shows the Skills Page 1 title.
  494. # "Skills 1" = A section that can be used to show the enemy's skills that
  495. # are written in the <skills pg1: "string"> notetag.
  496. # "Skills 2 Title" = Shows the Skills Page 2 title.
  497. # "Skills 2" = An additional section that can be used to show the enemy's
  498. # skills that are written in the <skills pg2: "string"> notetag.
  499. # "Skills 3 Title" = Shows the Skills Page 3 title.
  500. # "Skills 3" = An additional section that can be used to show the enemy's
  501. # skills that are written in the <skills pg3: "string"> notetag.
  502. # "Long Desc Title" = Shows the Long Description title.
  503. # "Long Desc" = A miscellaneous section that be used to write additional
  504. # info about the enemy with the <long desc: "string"> notetag if you do not
  505. # want to use the dedicated description window.
  506. #
  507. # If you ever get confused or mess up your page structures, below is the
  508. # default Pages array:
  509. #
  510. # Pages =[ # Do not remove!
  511. # ["Kill Count", "Space", "Level", "HP", "MP", "Stats", "Exp", "Gold"],
  512. # ["Drop Title", "Line", "Drop", "Space", "Type Title", "Line", "Type", "Space", "Location Title", "Line", "Location"],
  513. # ["Elem Weak Title", "Line", "Elem Weak", "Space", "Elem Resist Title", "Line", "Elem Resist", "Space", "Elem Immune Title", "Line", "Elem Immune"],
  514. # ] # Do not remove!
  515. #
  516. #==============================================================================
  517.  
  518. Pages =[ # Do not remove!
  519. ["Kill Count", "Space", "Level", "HP", "MP", "Stats", "Exp", "Gold"],
  520. ["Drop Title", "Line", "Drop", "Space", "Type Title", "Line", "Type", "Space", "Location Title", "Line", "Location"],
  521. ["Elem Weak Title", "Line", "Elem Weak", "Space", "Elem Resist Title", "Line", "Elem Resist", "Space", "Elem Immune Title", "Line", "Elem Immune"],
  522. ] # Do not remove!
  523.  
  524. #==============================================================================
  525. # ** Additional Enemy Status Displays
  526. #------------------------------------------------------------------------------
  527. # When Show_Desc_Window set to true, this will make a window appear that
  528. # allows you to write a description about the enemy you are viewing. Setting
  529. # this to false will allow you to view more of an enemy and its battleback.
  530. #
  531. # Stats_To_Display sets how many stats you want to display, from ATK to LUK.
  532. # (Unless if you have made any custom params, do not set this value any higher
  533. # than 6!)
  534. #==============================================================================
  535.  
  536. Show_Desc_Window = true
  537. Stats_To_Display = 6
  538.  
  539. #==============================================================================
  540. # ** Word Wrap
  541. #------------------------------------------------------------------------------
  542. # If set to true, the description for any sections will wrap along lines if
  543. # any text goes outside of the status page box. (This does not apply for
  544. # section titles.)
  545. #
  546. # Right_Margin sets the space away from the right hand side of the page box
  547. # the text will begin to wrap.
  548. #==============================================================================
  549.  
  550. Word_Wrap = true
  551. Right_Margin = 0
  552.  
  553. #==============================================================================
  554. # ** Horizontal Line Opacity
  555. #------------------------------------------------------------------------------
  556. # Sets the horizontal line opacity that shows up on the second status page for
  557. # an enemy. This number can range from 0-255.
  558. #==============================================================================
  559.  
  560. Horz_Line_Opac = 48
  561.  
  562. #==============================================================================
  563. # ** DO NOT edit anything below this unless if you know what you're doing!
  564. #==============================================================================
  565.  
  566. end
  567.  
  568. #==============================================================================
  569. # ** DataManager
  570. #------------------------------------------------------------------------------
  571. # This module manages the database and game objects. Almost all of the
  572. # global variables used by the game are initialized by this module.
  573. #==============================================================================
  574.  
  575. module DataManager
  576. #--------------------------------------------------------------------------
  577. # * Load Database
  578. #--------------------------------------------------------------------------
  579. class <<self; alias load_database_fantasybestiary load_database; end
  580. def self.load_database
  581. load_database_fantasybestiary
  582. load_notetags_fantasybestiary
  583. end
  584. #--------------------------------------------------------------------------
  585. # * Load Notetags for Fantasy Bestiary
  586. #--------------------------------------------------------------------------
  587. def self.load_notetags_fantasybestiary
  588. groups = [$data_enemies]
  589. for group in groups
  590. for obj in group
  591. next if obj.nil?
  592. obj.load_notetags_fantasybestiary
  593. end
  594. end
  595. end
  596. end
  597.  
  598. #==============================================================================
  599. # ** RPG::Enemy
  600. #------------------------------------------------------------------------------
  601. # This class defines attributes for enemies. Its superclass is RPG::BaseItem.
  602. #==============================================================================
  603.  
  604. class RPG::Enemy
  605. #--------------------------------------------------------------------------
  606. # Public Instance Variables
  607. #--------------------------------------------------------------------------
  608. attr_accessor :bestiary_bgm
  609. attr_accessor :bgm_volume
  610. attr_accessor :bgm_pitch
  611. attr_accessor :bestiary_image
  612. attr_accessor :bestiary_hue
  613. attr_accessor :bestiary_mirror
  614. attr_accessor :x_offset
  615. attr_accessor :y_offset
  616. attr_accessor :battleback1
  617. attr_accessor :battleback2
  618. attr_accessor :bb_x_offset
  619. attr_accessor :bb_y_offset
  620. attr_accessor :hide_from_start
  621. attr_accessor :hide_hp
  622. attr_accessor :hide_mp
  623. attr_accessor :hide_stats
  624. attr_accessor :hide_spoils
  625. attr_accessor :completion_bonus
  626. attr_accessor :bestiary_level
  627. attr_accessor :elem_weak
  628. attr_accessor :elem_resist
  629. attr_accessor :elem_immune
  630. attr_accessor :elem_absorb
  631. attr_accessor :state_weak
  632. attr_accessor :state_resist
  633. attr_accessor :state_immune
  634. attr_accessor :type
  635. attr_accessor :location
  636. attr_accessor :skillspg1
  637. attr_accessor :skillspg2
  638. attr_accessor :skillspg3
  639. attr_accessor :description
  640. attr_accessor :long_desc
  641. attr_accessor :bestiary_icon
  642. attr_accessor :holders_line
  643. attr_accessor :holders_frame
  644. #--------------------------------------------------------------------------
  645. # Defining Attributes
  646. #--------------------------------------------------------------------------
  647. def load_notetags_fantasybestiary
  648. @bgm_volume = 100
  649. @bgm_pitch = 100
  650. @bestiary_hue = 0
  651. @bestiary_mirror = false
  652. @x_offset = 0
  653. @y_offset = 0
  654. @bb_x_offset = 0
  655. @bb_y_offset = 0
  656. @completion_bonus = 0
  657. @hide_from_start = false
  658. @hide_hp = false
  659. @hide_mp = false
  660. @hide_stats = false
  661. @hide_spoils = false
  662. @elem_weak = ""
  663. @elem_resist = ""
  664. @elem_immune = ""
  665. @elem_absorb = ""
  666. @state_weak = ""
  667. @state_resist = ""
  668. @state_immune = ""
  669. @type = ""
  670. @location = ""
  671. @skillspg1 = ""
  672. @skillspg2 = ""
  673. @skillspg3 = ""
  674. @description = ""
  675. @long_desc = ""
  676. @bestiary_icon = 0
  677. @holders_line = 0
  678. @holders_frame = 0
  679. if @hide_from_start == false
  680. if @note =~ /<bestiary bgm: "(.+?)\">/i
  681. @bestiary_bgm = $1.to_s
  682. end
  683. if @note =~ /<bestiary bgm: "(.+?)\" (.*)>/i
  684. @bestiary_bgm = $1.to_s
  685. @bgm_volume = $2.to_i
  686. @bgm_volume = 100 if @bgm_volume > 100
  687. @bgm_volume = 0 if @bgm_volume < 0
  688. end
  689. if @note =~ /<bestiary bgm: "(.+?)\" (.*) (.*)>/i
  690. @bestiary_bgm = $1.to_s
  691. @bgm_volume = $2.to_i
  692. @bgm_pitch = $3.to_i
  693. @bgm_volume = 100 if @bgm_volume > 100
  694. @bgm_volume = 0 if @bgm_volume < 0
  695. @bgm_pitch = 150 if @bgm_pitch > 150
  696. @bgm_volume = 50 if @bgm_pitch < 50
  697. end
  698. if @note =~ /<bestiary image: "(.+?)\">/i
  699. @bestiary_image = $1.to_s
  700. end
  701. if @note =~ /<bestiary hue: (.*)>/i
  702. @bestiary_hue = $1.to_i
  703. end
  704. if @note =~ /<mirror bestiary image>/i
  705. @bestiary_mirror = true
  706. end
  707. if @note =~ /<x offset: (.*)>/i
  708. @x_offset = $1.to_i
  709. end
  710. if @note =~ /<y offset: (.*)>/i
  711. @y_offset = $1.to_i
  712. end
  713. if @note =~ /<battleback1: "(.+?)\">/i
  714. @battleback1 = $1.to_s
  715. end
  716. if @note =~ /<battleback2: "(.+?)\">/i
  717. @battleback2 = $1.to_s
  718. end
  719. if @note =~ /<battleback x offset: (.*)>/i
  720. @bb_x_offset = $1.to_i
  721. end
  722. if @note =~ /<battleback y offset: (.*)>/i
  723. @bb_y_offset = $1.to_i
  724. end
  725. if @note =~ /<completion bonus: (.*)>/i
  726. @completion_bonus = $1.to_i
  727. end
  728. if @note =~ /<bestiary level: (.*)>/i
  729. @bestiary_level = $1.to_i
  730. end
  731. if note[/<(elem weak: )\"(.+?)\">/im]
  732. @elem_weak = $2
  733. @elem_weak.gsub!(/[\r\n]/, "")
  734. @elem_weak.gsub!(/\\[Ll]/, "\n")
  735. end
  736. if note[/<(elem resist: )\"(.+?)\">/im]
  737. @elem_resist = $2
  738. @elem_resist.gsub!(/[\r\n]/, "")
  739. @elem_resist.gsub!(/\\[Ll]/, "\n")
  740. end
  741. if note[/<(elem immune: )\"(.+?)\">/im]
  742. @elem_immune = $2
  743. @elem_immune.gsub!(/[\r\n]/, "")
  744. @elem_immune.gsub!(/\\[Ll]/, "\n")
  745. end
  746. if note[/<(elem absorb: )\"(.+?)\">/im]
  747. @elem_absorb = $2
  748. @elem_absorb.gsub!(/[\r\n]/, "")
  749. @elem_absorb.gsub!(/\\[Ll]/, "\n")
  750. end
  751. if note[/<(state weak: )\"(.+?)\">/im]
  752. @state_weak = $2
  753. @state_weak.gsub!(/[\r\n]/, "")
  754. @state_weak.gsub!(/\\[Ll]/, "\n")
  755. end
  756. if note[/<(state resist: )\"(.+?)\">/im]
  757. @state_resist = $2
  758. @state_resist.gsub!(/[\r\n]/, "")
  759. @state_resist.gsub!(/\\[Ll]/, "\n")
  760. end
  761. if note[/<(state immune: )\"(.+?)\">/im]
  762. @state_immune = $2
  763. @state_immune.gsub!(/[\r\n]/, "")
  764. @state_immune.gsub!(/\\[Ll]/, "\n")
  765. end
  766. if note[/<(type: )\"(.+?)\">/im]
  767. @type = $2
  768. @type.gsub!(/[\r\n]/, "")
  769. @type.gsub!(/\\[Ll]/, "\n")
  770. end
  771. if note[/<(location: )\"(.+?)\">/im]
  772. @location = $2
  773. @location.gsub!(/[\r\n]/, "")
  774. @location.gsub!(/\\[Ll]/, "\n")
  775. end
  776. if note[/<(skills pg1: )\"(.+?)\">/im]
  777. @skillspg1 = $2
  778. @skillspg1.gsub!(/[\r\n]/, "")
  779. @skillspg1.gsub!(/\\[Ll]/, "\n")
  780. end
  781. if note[/<(skills pg2: )\"(.+?)\">/im]
  782. @skillspg2 = $2
  783. @skillspg2.gsub!(/[\r\n]/, "")
  784. @skillspg2.gsub!(/\\[Ll]/, "\n")
  785. end
  786. if note[/<(skills pg3: )\"(.+?)\">/im]
  787. @skillspg3 = $2
  788. @skillspg3.gsub!(/[\r\n]/, "")
  789. @skillspg3.gsub!(/\\[Ll]/, "\n")
  790. end
  791. if note[/<(desc: )\"(.+?)\">/im]
  792. @description = $2
  793. @description.gsub!(/[\r\n]/, "")
  794. @description.gsub!(/\\[Ll]/, "\n")
  795. end
  796. if note[/<(long desc: )\"(.+?)\">/im]
  797. @long_desc = $2
  798. @long_desc.gsub!(/[\r\n]/, "")
  799. @long_desc.gsub!(/\\[Ll]/, "\n")
  800. end
  801. if @note =~ /<hide hp>/i
  802. @hide_hp = true
  803. end
  804. if @note =~ /<hide mp>/i
  805. @hide_mp = true
  806. end
  807. if @note =~ /<hide stats>/i
  808. @hide_stats = true
  809. end
  810. if @note =~ /<hide spoils>/i
  811. @hide_spoils = true
  812. end
  813. if @note =~ /<bestiary icon: (.*)>/i
  814. @bestiary_icon = $1.to_i
  815. end
  816. if @note =~ /<bestiary holders pose: (.*) (.*)>/i
  817. @holders_line = $1.to_i - 1
  818. @holders_frame = $2.to_i - 1
  819. end
  820. if @note =~ /<hide from bestiary>/i
  821. @hide_from_start = true
  822. end
  823. end
  824. end
  825. end
  826.  
  827. #==============================================================================
  828. # ** Numeric
  829. #------------------------------------------------------------------------------
  830. # The abstract class for numbers.
  831. #==============================================================================
  832.  
  833. class Numeric
  834. #--------------------------------------------------------------------------
  835. # * Group Digits
  836. #--------------------------------------------------------------------------
  837. unless $imported["YEA-CoreEngine"]
  838. def group; return self.to_s; end
  839. end # $imported["YEA-CoreEngine"]
  840. end
  841.  
  842. #==============================================================================
  843. # ** Window_MenuCommand
  844. #------------------------------------------------------------------------------
  845. # This command window appears on the menu screen.
  846. #==============================================================================
  847.  
  848. class Window_MenuCommand < Window_Command
  849. #--------------------------------------------------------------------------
  850. # * Add Main Commands to List
  851. #--------------------------------------------------------------------------
  852. alias bestiary_add_main_commands add_main_commands
  853. def add_main_commands
  854. bestiary_add_main_commands
  855. if FantasyBestiary::Menu_Access
  856. add_command(FantasyBestiary::Bestiary_Name, :fantasy_bestiary)
  857. end
  858. end
  859. end
  860.  
  861. #==============================================================================
  862. # ** Scene_Menu
  863. #------------------------------------------------------------------------------
  864. # This class performs the menu screen processing.
  865. #==============================================================================
  866.  
  867. class Scene_Menu < Scene_MenuBase
  868. #--------------------------------------------------------------------------
  869. # * Create Command Window
  870. #--------------------------------------------------------------------------
  871. alias bestiary_create_command_window create_command_window
  872. def create_command_window
  873. bestiary_create_command_window
  874. @command_window.set_handler(:fantasy_bestiary, method(:command_fantasy_bestiary))
  875. end
  876. #--------------------------------------------------------------------------
  877. # * [Journal] Command
  878. #--------------------------------------------------------------------------
  879. def command_fantasy_bestiary
  880. SceneManager.call(Scene_Bestiary)
  881. end
  882. end
  883.  
  884. #==============================================================================
  885. # ** Game_Enemy
  886. #------------------------------------------------------------------------------
  887. # This class handles enemies. It used within the Game_Troop class
  888. # ($game_troop).
  889. #==============================================================================
  890.  
  891. class Game_Enemy < Game_Battler
  892. #--------------------------------------------------------------------------
  893. # * Alias: Object Initialization
  894. #--------------------------------------------------------------------------
  895. alias initialize_bestiary initialize
  896. def initialize(index, enemy_id)
  897. initialize_bestiary(index, enemy_id)
  898. if FantasyBestiary::Spot_Reveal
  899. $game_party.add_found(enemy_id)
  900. $game_party.enemies_revealed.push(enemy_id) unless $game_party.enemies_hidden.include?(enemy_id)
  901. end
  902. end
  903. #--------------------------------------------------------------------------
  904. # * Knock Out
  905. #--------------------------------------------------------------------------
  906. def die
  907. super
  908. $game_party.add_kill(enemy)
  909. end
  910. end
  911.  
  912. #==============================================================================
  913. # ** Game_Party
  914. #------------------------------------------------------------------------------
  915. # This class handles parties. Information such as gold and items is included.
  916. # Instances of this class are referenced by $game_party.
  917. #==============================================================================
  918.  
  919. class Game_Party < Game_Unit
  920. #--------------------------------------------------------------------------
  921. # * Public Instance Variables
  922. #--------------------------------------------------------------------------
  923. attr_accessor :kill_count
  924. attr_accessor :bestiary_level
  925. attr_accessor :bestiary_icon
  926. attr_accessor :enemies_revealed
  927. attr_accessor :enemies_hidden
  928. attr_accessor :enemies_found
  929. attr_accessor :enemies_total
  930. attr_accessor :completion_bonus
  931. #--------------------------------------------------------------------------
  932. # * Object Initialization
  933. #--------------------------------------------------------------------------
  934. alias beastiary_initialize initialize
  935. def initialize
  936. beastiary_initialize
  937. @enemies_found = 0
  938. @enemies_total = 0
  939. @completion_bonus = 0
  940. @kill_count = []
  941. @bestiary_level = []
  942. @bestiary_icon = []
  943. @enemies_revealed = []
  944. @enemies_hidden = []
  945. for i in 0..$data_enemies.size
  946. @kill_count[i] = 0
  947. end
  948. $data_enemies.compact.each { |enemy| @enemies_hidden.push(enemy.id) if enemy.hide_from_start
  949. @enemies_total += 1 if !enemy.hide_from_start
  950. @bestiary_level.push(enemy.id)
  951. @bestiary_level[enemy.id] = enemy.bestiary_level
  952. @bestiary_icon.push(enemy.id)
  953. @bestiary_icon[enemy.id] = enemy.bestiary_icon}
  954. end
  955. #--------------------------------------------------------------------------
  956. # * Check Nil Values
  957. #--------------------------------------------------------------------------
  958. def check_nil_values
  959. if @enemies_found == nil
  960. @enemies_found = 0
  961. end
  962. if @enemies_total == nil
  963. @enemies_total = 0
  964. end
  965. if @completion_bonus == nil
  966. @completion_bonus = 0
  967. end
  968. if @kill_count == nil
  969. @kill_count = []
  970. for i in 0..$data_enemies.size
  971. @kill_count[i] = 0
  972. end
  973. end
  974. if @enemies_revealed == nil
  975. @enemies_revealed = []
  976. end
  977. if @enemies_hidden == nil
  978. @enemies_hidden = []
  979. end
  980. if @bestiary_level == nil
  981. @bestiary_level = []
  982. end
  983. if @bestiary_icon == nil
  984. @bestiary_icon = []
  985. end
  986. end
  987. #--------------------------------------------------------------------------
  988. # * Hide New Enemies from Start
  989. #--------------------------------------------------------------------------
  990. def hide_new_enemies_from_start
  991. groups = [$data_enemies]
  992. for group in groups
  993. for obj in group
  994. next if obj.nil?
  995. next if @bestiary_icon[obj.id] != nil
  996. @enemies_hidden.push(obj.id) if obj.hide_from_start
  997. @enemies_total += 1 if !obj.hide_from_start
  998. @bestiary_icon.push(obj.id)
  999. @bestiary_icon[obj.id] = obj.bestiary_icon
  1000. end
  1001. end
  1002. end
  1003. #--------------------------------------------------------------------------
  1004. # * Remove found for hidden Enemy
  1005. #--------------------------------------------------------------------------
  1006. def hide_found(enemy)
  1007. @bonus = $data_enemies[enemy].completion_bonus
  1008. @enemies_total -= 1 if !@enemies_hidden.include?(enemy)
  1009. @enemies_found -= 1 if @enemies_revealed.include?(enemy) && !@enemies_hidden.include?(enemy)
  1010. @completion_bonus -= @bonus if @enemies_revealed.include?(enemy) && !@enemies_hidden.include?(enemy)
  1011. end
  1012. #--------------------------------------------------------------------------
  1013. # * Add found for unhidden Enemy if revealed
  1014. #--------------------------------------------------------------------------
  1015. def unhide_found(enemy)
  1016. @bonus = $data_enemies[enemy].completion_bonus
  1017. @enemies_total += 1 if @enemies_hidden.include?(enemy)
  1018. @enemies_found += 1 if @enemies_revealed.include?(enemy) && @enemies_hidden.include?(enemy)
  1019. @completion_bonus += @bonus if @enemies_revealed.include?(enemy) && @enemies_hidden.include?(enemy)
  1020. end
  1021. #--------------------------------------------------------------------------
  1022. # * Add found for Enemy when revealed
  1023. #--------------------------------------------------------------------------
  1024. def add_found(enemy)
  1025. @bonus = $data_enemies[enemy].completion_bonus
  1026. @enemies_found += 1 if !@enemies_revealed.include?(enemy) && !@enemies_hidden.include?(enemy)
  1027. @completion_bonus += @bonus if !@enemies_revealed.include?(enemy) && !@enemies_hidden.include?(enemy)
  1028. end
  1029. #--------------------------------------------------------------------------
  1030. # * Remove found for Enemy when unrevealed
  1031. #--------------------------------------------------------------------------
  1032. def remove_found(enemy)
  1033. @bonus = $data_enemies[enemy].completion_bonus
  1034. @enemies_found -= 1 if @enemies_revealed.include?(enemy) && !@enemies_hidden.include?(enemy)
  1035. @completion_bonus -= @bonus if @enemies_revealed.include?(enemy) && !@enemies_hidden.include?(enemy)
  1036. end
  1037. #--------------------------------------------------------------------------
  1038. # * Add to Enemy Kill Count
  1039. #--------------------------------------------------------------------------
  1040. def add_kill(enemy)
  1041. check_nil_values
  1042. if @kill_count[enemy.id] == nil
  1043. @kill_count[enemy.id] = 0
  1044. end
  1045. if @kill_count[enemy.id] < 2000
  1046. @kill_count[enemy.id] += 1
  1047. if FantasyBestiary::Kill_Reveal && !FantasyBestiary::Spot_Reveal
  1048. @enemies_found += 1 unless @enemies_hidden.include?(enemy.id) || @enemies_revealed.include?(enemy.id)
  1049. @bonus = $data_enemies[enemy.id].completion_bonus
  1050. @completion_bonus += @bonus unless @enemies_hidden.include?(enemy.id) || @enemies_revealed.include?(enemy.id)
  1051. @enemies_revealed.push(enemy.id) unless @enemies_hidden.include?(enemy.id)
  1052. end
  1053. end
  1054. end
  1055. #--------------------------------------------------------------------------
  1056. # * Define Change Level for Enemy
  1057. #--------------------------------------------------------------------------
  1058. def change_enemy_level(id, level)
  1059. @bestiary_level[id] = level
  1060. end
  1061. #--------------------------------------------------------------------------
  1062. # * Define Change Icon for Enemy
  1063. #--------------------------------------------------------------------------
  1064. def change_enemy_icon(id, index)
  1065. @bestiary_icon[id] = index
  1066. end
  1067. end
  1068.  
  1069. #==============================================================================
  1070. # ** Game_Interpreter
  1071. #------------------------------------------------------------------------------
  1072. # An interpreter for executing event commands. This class is used within the
  1073. # Game_Map, Game_Troop, and Game_Event classes.
  1074. #==============================================================================
  1075.  
  1076. class Game_Interpreter
  1077. #--------------------------------------------------------------------------
  1078. # * Hide Enemy
  1079. #--------------------------------------------------------------------------
  1080. def hide_enemy(enemy)
  1081. $game_party.hide_found(enemy)
  1082. $game_party.enemies_hidden.push(enemy)
  1083. end
  1084. #--------------------------------------------------------------------------
  1085. # * Unhide Enemy
  1086. #--------------------------------------------------------------------------
  1087. def unhide_enemy(enemy)
  1088. $game_party.unhide_found(enemy)
  1089. $game_party.enemies_hidden.delete(enemy)
  1090. end
  1091. #--------------------------------------------------------------------------
  1092. # * Reveal Enemy
  1093. #--------------------------------------------------------------------------
  1094. def reveal_enemy(enemy)
  1095. $game_party.add_found(enemy)
  1096. $game_party.enemies_revealed.push(enemy)
  1097. end
  1098. #--------------------------------------------------------------------------
  1099. # * Unreveal Enemy
  1100. #--------------------------------------------------------------------------
  1101. def unreveal_enemy(enemy)
  1102. $game_party.remove_found(enemy)
  1103. $game_party.enemies_revealed.delete(enemy)
  1104. end
  1105. #--------------------------------------------------------------------------
  1106. # * Change Enemy Level
  1107. #--------------------------------------------------------------------------
  1108. def change_enemy_level(id, level)
  1109. $game_party.change_enemy_level(id, level)
  1110. end
  1111. #--------------------------------------------------------------------------
  1112. # * Change Bestiary Icon for Enemy
  1113. #--------------------------------------------------------------------------
  1114. def change_bestiary_icon(id, index)
  1115. $game_party.change_enemy_icon(id, index)
  1116. end
  1117. end
  1118.  
  1119. #==============================================================================
  1120. # ** Window_EnemyList
  1121. #------------------------------------------------------------------------------
  1122. # This window displays a list of enemies on the first Bestiary screen.
  1123. #==============================================================================
  1124.  
  1125. class Window_EnemyList < Window_Selectable
  1126. #--------------------------------------------------------------------------
  1127. # * Object Initialization
  1128. #--------------------------------------------------------------------------
  1129. def initialize(x, y, width, height)
  1130. super
  1131. @data = []
  1132. refresh
  1133. end
  1134. #--------------------------------------------------------------------------
  1135. # * Get Digit Count
  1136. #--------------------------------------------------------------------------
  1137. def col_max
  1138. return 1
  1139. end
  1140. #--------------------------------------------------------------------------
  1141. # * Update Cursor
  1142. #--------------------------------------------------------------------------
  1143. def update_cursor
  1144. if @cursor_all
  1145. cursor_rect.set(0, 0, contents.width, row_max * item_height)
  1146. self.top_row = 0
  1147. elsif @index < 0
  1148. cursor_rect.empty
  1149. else
  1150. ensure_cursor_visible
  1151. bx = (index % col_max * (item_width + spacing))
  1152. by = index / col_max * item_height
  1153. cursor_rect.set(bx + (((contents.width / 7) * 2) - 74), by, (item_width / 7) * 5, item_height)
  1154. end
  1155. end
  1156. #--------------------------------------------------------------------------
  1157. # * Get Number of Items
  1158. #--------------------------------------------------------------------------
  1159. def item_max
  1160. @data ? @data.size : 1
  1161. end
  1162. #--------------------------------------------------------------------------
  1163. # * Get Item
  1164. #--------------------------------------------------------------------------
  1165. def item
  1166. @data && index >= 0 ? @data[index] : nil
  1167. end
  1168. #--------------------------------------------------------------------------
  1169. # * Get Activation State of Selection Item
  1170. #--------------------------------------------------------------------------
  1171. def current_item_enabled?
  1172. enable?(@data[index])
  1173. end
  1174. #--------------------------------------------------------------------------
  1175. # * Include in Item List?
  1176. #--------------------------------------------------------------------------
  1177. def include?(item)
  1178. item.is_a?(RPG::Enemy) && !$game_party.enemies_hidden.include?(item.id)
  1179. end
  1180. #--------------------------------------------------------------------------
  1181. # * Display in Enabled State?
  1182. #--------------------------------------------------------------------------
  1183. def enable?(item)
  1184. $game_party.enemies_revealed.include?(item.id)
  1185. end
  1186. #--------------------------------------------------------------------------
  1187. # * Create Item List
  1188. #--------------------------------------------------------------------------
  1189. def make_item_list
  1190. @data = $data_enemies.select {|item| include?(item)}
  1191. @data.push(nil) if include?(nil)
  1192. end
  1193. #--------------------------------------------------------------------------
  1194. # * Restore Previous Selection Position
  1195. #--------------------------------------------------------------------------
  1196. def select_last
  1197. select(@data.index($game_party.last_item.object) || 0)
  1198. end
  1199. #--------------------------------------------------------------------------
  1200. # * Draw Item
  1201. #--------------------------------------------------------------------------
  1202. def draw_item(index)
  1203. x = 0
  1204. y = index / col_max * 24
  1205. item = @data[index]
  1206. if item
  1207. text = sprintf("%01d", index + 1).to_s + "."
  1208. text = sprintf("%02d", index + 1).to_s + "." if $game_party.enemies_total >= 10
  1209. text = sprintf("%03d", index + 1).to_s + "." if $game_party.enemies_total >= 100
  1210. draw_text(x + (((contents.width / 7) * 2) - 70), y, 50, line_height, text, 0)
  1211. if !$game_party.enemies_revealed.include?(item.id)
  1212. enemy_name = "??????"
  1213. if $game_party.kill_count[item.id] == nil
  1214. $game_party.kill_count[item] = 0
  1215. end
  1216. kill_count = $game_party.kill_count[item.id].to_s if FantasyBestiary::Show_Kill
  1217. kill_count = "?" if !FantasyBestiary::Show_Kill
  1218. else
  1219. if $game_party.bestiary_icon[item.id] == nil
  1220. $game_party.change_enemy_level(item.id, item.bestiary_level) if item.bestiary_level != nil && $game_party.bestiary_level[item.id] == nil
  1221. $game_party.change_enemy_icon(item.id, item.bestiary_icon)
  1222. end
  1223. draw_icon($game_party.bestiary_icon[item.id], x + (((contents.width / 7) * 2) - 98), y) if $game_party.bestiary_icon[item.id] > 0
  1224. enemy_name = item.name
  1225. if $game_party.kill_count[item.id] == nil
  1226. $game_party.kill_count[item] = 0
  1227. end
  1228. kill_count = $game_party.kill_count[item.id].to_s
  1229. end
  1230. draw_text(x + ((contents.width / 7) * 2), y, (contents.width / 7) * 4, line_height, enemy_name, 0)
  1231. draw_text(x + (((contents.width / 7) * 5) + 20), y, 50, line_height, kill_count, 2)
  1232. end
  1233. end
  1234. #--------------------------------------------------------------------------
  1235. # * Update Help Text
  1236. #--------------------------------------------------------------------------
  1237. def update_help
  1238. @help_window.set_item(item)
  1239. end
  1240. #--------------------------------------------------------------------------
  1241. # * Refresh
  1242. #--------------------------------------------------------------------------
  1243. def refresh
  1244. make_item_list
  1245. create_contents
  1246. draw_all_items
  1247. end
  1248. #--------------------------------------------------------------------------
  1249. # * Processing When OK Button Is Pressed
  1250. #--------------------------------------------------------------------------
  1251. def process_ok
  1252. if current_item_enabled?
  1253. Sound.play_ok
  1254. Input.update
  1255. deactivate
  1256. call_ok_handler
  1257. else
  1258. Sound.play_buzzer
  1259. end
  1260. end
  1261. end
  1262.  
  1263. #==============================================================================
  1264. # ** Window_Completion
  1265. #------------------------------------------------------------------------------
  1266. # This window shows how much of the Bestiary you have completed with a
  1267. # percent.
  1268. #==============================================================================
  1269.  
  1270. class Window_Completion < Window_Base
  1271. #--------------------------------------------------------------------------
  1272. # * Object Initialization
  1273. #--------------------------------------------------------------------------
  1274. def initialize(line_number = 2)
  1275. super(0, 0, Graphics.width, fitting_height(line_number))
  1276. refresh
  1277. end
  1278. #--------------------------------------------------------------------------
  1279. # * Refresh
  1280. #--------------------------------------------------------------------------
  1281. def refresh
  1282. contents.clear
  1283. contents.font.size = 32
  1284. if FantasyBestiary::Completion_Percent
  1285. percent = (100*$game_party.enemies_found/$game_party.enemies_total) + $game_party.completion_bonus
  1286. percent = $game_variables[FantasyBestiary::Completion_Variable] if FantasyBestiary::Completion_Variable > 0
  1287. text = sprintf(FantasyBestiary::Completion_Name + "%1.0f%%", percent)
  1288. else
  1289. found = $game_party.enemies_found.to_s
  1290. found = $game_variables[FantasyBestiary::Completion_Variable] if FantasyBestiary::Completion_Variable > 0
  1291. total = $game_party.enemies_total.to_s
  1292. text = FantasyBestiary::Completion_Name + found + "/" + total
  1293. end
  1294. if FantasyBestiary::Second_Tracker
  1295. @width = (contents.width / 2)
  1296. draw_text(0, 0, @width, contents.height, text, FantasyBestiary::Completion_Align)
  1297. else
  1298. draw_text(0, 0, contents.width, contents.height, text, FantasyBestiary::Completion_Align)
  1299. end
  1300. if FantasyBestiary::Second_Tracker
  1301. if FantasyBestiary::Second_Tracker_Percent
  1302. percent = (100*$game_party.enemies_found/$game_party.enemies_total) + $game_party.completion_bonus
  1303. percent = $game_variables[FantasyBestiary::Second_Tracker_Variable] if FantasyBestiary::Second_Tracker_Variable > 0
  1304. text = sprintf(FantasyBestiary::Second_Tracker_Name + "%1.0f%%", percent)
  1305. else
  1306. found = $game_party.enemies_found.to_s
  1307. found = $game_variables[FantasyBestiary::Second_Tracker_Variable] if FantasyBestiary::Second_Tracker_Variable > 0
  1308. total = $game_party.enemies_total.to_s
  1309. text = FantasyBestiary::Second_Tracker_Name + found + "/" + total
  1310. end
  1311. draw_text(@width, 0, @width, contents.height, text, FantasyBestiary::Completion_Align)
  1312. end
  1313. end
  1314. end
  1315.  
  1316. #==============================================================================
  1317. # ** Window_EnemyHorzList
  1318. #------------------------------------------------------------------------------
  1319. # This window displays a horizontal list of enemies on an enemy's page.
  1320. #==============================================================================
  1321.  
  1322. class Window_EnemyHorzList < Window_Selectable
  1323. #--------------------------------------------------------------------------
  1324. # * Object Initialization
  1325. #--------------------------------------------------------------------------
  1326. def initialize(x, y, width)
  1327. super(x, y, width, window_height)
  1328. @data = []
  1329. @width = width
  1330. refresh
  1331. end
  1332. #--------------------------------------------------------------------------
  1333. # * Get Window Height
  1334. #--------------------------------------------------------------------------
  1335. def window_height
  1336. fitting_height(visible_line_number)
  1337. end
  1338. #--------------------------------------------------------------------------
  1339. # * Get Number of Lines to Show
  1340. #--------------------------------------------------------------------------
  1341. def visible_line_number
  1342. return 1
  1343. end
  1344. #--------------------------------------------------------------------------
  1345. # * Get Digit Count
  1346. #--------------------------------------------------------------------------
  1347. def col_max
  1348. return 1
  1349. end
  1350. #--------------------------------------------------------------------------
  1351. # * Get Spacing for Items Arranged Side by Side
  1352. #--------------------------------------------------------------------------
  1353. def spacing
  1354. return 8
  1355. end
  1356. #--------------------------------------------------------------------------
  1357. # * Calculate Width of Window Contents
  1358. #--------------------------------------------------------------------------
  1359. def contents_width
  1360. (item_width + spacing) * item_max - spacing
  1361. end
  1362. #--------------------------------------------------------------------------
  1363. # * Calculate Height of Window Contents
  1364. #--------------------------------------------------------------------------
  1365. def contents_height
  1366. item_height
  1367. end
  1368. #--------------------------------------------------------------------------
  1369. # * Get Leading Digits
  1370. #--------------------------------------------------------------------------
  1371. def top_col
  1372. ox / (item_width + spacing)
  1373. end
  1374. #--------------------------------------------------------------------------
  1375. # * Set Leading Digits
  1376. #--------------------------------------------------------------------------
  1377. def top_col=(col)
  1378. col = 0 if col < 0
  1379. self.ox = col * (item_width + spacing)
  1380. end
  1381. #--------------------------------------------------------------------------
  1382. # * Get Trailing Digits
  1383. #--------------------------------------------------------------------------
  1384. def bottom_col
  1385. top_col + col_max - 1
  1386. end
  1387. #--------------------------------------------------------------------------
  1388. # * Set Trailing Digits
  1389. #--------------------------------------------------------------------------
  1390. def bottom_col=(col)
  1391. self.top_col = col - (col_max - 1)
  1392. end
  1393. #--------------------------------------------------------------------------
  1394. # * Scroll Cursor to Position Within Screen
  1395. #--------------------------------------------------------------------------
  1396. def ensure_cursor_visible
  1397. self.top_col = index if index < top_col
  1398. self.bottom_col = index if index > bottom_col
  1399. end
  1400. #--------------------------------------------------------------------------
  1401. # * Get Rectangle for Displaying Items
  1402. #--------------------------------------------------------------------------
  1403. def item_rect(index)
  1404. rect = Rect.new
  1405. rect.width = item_width
  1406. rect.height = item_height
  1407. rect.x = index * (item_width + spacing)
  1408. rect.y = 0
  1409. rect
  1410. end
  1411. #--------------------------------------------------------------------------
  1412. # * Move Cursor Right
  1413. #--------------------------------------------------------------------------
  1414. def cursor_right(wrap = false)
  1415. select((index + 1) % item_max)
  1416. if !enable?(item)
  1417. cursor_right
  1418. end
  1419. end
  1420. #--------------------------------------------------------------------------
  1421. # * Move Cursor Left
  1422. #--------------------------------------------------------------------------
  1423. def cursor_left(wrap = false)
  1424. select((index - 1 + item_max) % item_max)
  1425. if !enable?(item)
  1426. cursor_left
  1427. end
  1428. end
  1429. #--------------------------------------------------------------------------
  1430. # * Move Cursor Down
  1431. #--------------------------------------------------------------------------
  1432. def cursor_down(wrap = false)
  1433. end
  1434. #--------------------------------------------------------------------------
  1435. # * Move Cursor Up
  1436. #--------------------------------------------------------------------------
  1437. def cursor_up(wrap = false)
  1438. end
  1439. #--------------------------------------------------------------------------
  1440. # * Move Cursor One Page Down
  1441. #--------------------------------------------------------------------------
  1442. def cursor_pagedown
  1443. end
  1444. #--------------------------------------------------------------------------
  1445. # * Move Cursor One Page Up
  1446. #--------------------------------------------------------------------------
  1447. def cursor_pageup
  1448. end
  1449. #--------------------------------------------------------------------------
  1450. # * Get Number of Items
  1451. #--------------------------------------------------------------------------
  1452. def item_max
  1453. @data ? @data.size : 1
  1454. end
  1455. #--------------------------------------------------------------------------
  1456. # * Get Item
  1457. #--------------------------------------------------------------------------
  1458. def item
  1459. @data && index >= 0 ? @data[index] : nil
  1460. end
  1461. #--------------------------------------------------------------------------
  1462. # * Get Item
  1463. #--------------------------------------------------------------------------
  1464. def item_id
  1465. @data[index].id
  1466. end
  1467. #--------------------------------------------------------------------------
  1468. # * Include in Item List?
  1469. #--------------------------------------------------------------------------
  1470. def include?(item)
  1471. item.is_a?(RPG::Enemy) && !$game_party.enemies_hidden.include?(item.id)
  1472. end
  1473. #--------------------------------------------------------------------------
  1474. # * Display in Enabled State?
  1475. #--------------------------------------------------------------------------
  1476. def enable?(item)
  1477. $game_party.enemies_revealed.include?(item.id)
  1478. end
  1479. #--------------------------------------------------------------------------
  1480. # * Create Item List
  1481. #--------------------------------------------------------------------------
  1482. def make_item_list
  1483. @data = $data_enemies.select {|item| include?(item)}
  1484. @data.push(nil) if include?(nil)
  1485. end
  1486. #--------------------------------------------------------------------------
  1487. # * Restore Previous Selection Position
  1488. #--------------------------------------------------------------------------
  1489. def select_last
  1490. select(@data.index($game_party.last_item.object) || 0)
  1491. end
  1492. #--------------------------------------------------------------------------
  1493. # * Draw Item
  1494. #--------------------------------------------------------------------------
  1495. def draw_item(index)
  1496. x = 0
  1497. y = index / col_max * 24
  1498. item = @data[index]
  1499. if item
  1500. text = sprintf("%01d", index + 1).to_s + ". "
  1501. text = sprintf("%02d", index + 1).to_s + ". " if $game_party.enemies_total >= 10
  1502. text = sprintf("%03d", index + 1).to_s + ". " if $game_party.enemies_total >= 100
  1503. if $game_party.bestiary_icon[item.id] != nil
  1504. draw_icon($game_party.bestiary_icon[item.id], index * @width - 16 * index, 0) if $game_party.bestiary_icon[item.id] > 0
  1505. end
  1506. draw_text(item_rect_for_text(index), text + item.name, 1)
  1507. end
  1508. end
  1509. #--------------------------------------------------------------------------
  1510. # * Update Help Text
  1511. #--------------------------------------------------------------------------
  1512. def update_help
  1513. @help_window.set_item(item)
  1514. end
  1515. #--------------------------------------------------------------------------
  1516. # * Refresh
  1517. #--------------------------------------------------------------------------
  1518. def refresh
  1519. make_item_list
  1520. create_contents
  1521. draw_all_items
  1522. end
  1523. end
  1524.  
  1525. #==============================================================================
  1526. # ** Window_BestiaryHelp
  1527. #------------------------------------------------------------------------------
  1528. # This window shows enemy explanations in the Bestiary.
  1529. #==============================================================================
  1530.  
  1531. class Window_BestiaryHelp < Window_Help
  1532. #--------------------------------------------------------------------------
  1533. # * Character Processing
  1534. # c : Characters
  1535. # text : A character string buffer in drawing processing (destructive)
  1536. # pos : Draw position {:x, :y, :new_x, :height}
  1537. #--------------------------------------------------------------------------
  1538. def process_character(c, text, pos)
  1539. if FantasyBestiary::Word_Wrap && c =~ /[ \t]/
  1540. c = '' if @lastc =~ /[\s\n\f]/
  1541. if pos[:x] + get_next_word_size(c, text) > contents.width - FantasyBestiary::Right_Margin
  1542. process_new_line(text, pos)
  1543. else
  1544. process_normal_character(c, pos)
  1545. end
  1546. @lastc = c
  1547. else
  1548. @lastc = c
  1549. case c
  1550. when "\n" # New line
  1551. process_new_line(text, pos)
  1552. when "\f" # New page
  1553. process_new_page(text, pos)
  1554. when "\e" # Control character
  1555. process_escape_character(obtain_escape_code(text), text, pos)
  1556. else # Normal character
  1557. process_normal_character(c, pos)
  1558. end
  1559. end
  1560. end
  1561. #--------------------------------------------------------------------------
  1562. # * Normal Character Processing
  1563. #--------------------------------------------------------------------------
  1564. alias bestiary_process_normal_character process_normal_character
  1565. def process_normal_character(c, pos)
  1566. if @toggletext == true
  1567. text_width = text_size(c).width
  1568. draw_text(pos[:x], pos[:y], text_width * 1.2, pos[:height], c)
  1569. pos[:x] += (text_width * 0.75)
  1570. else
  1571. bestiary_process_normal_character(c, pos)
  1572. end
  1573. end
  1574. #--------------------------------------------------------------------------
  1575. # * Get Next Word Size
  1576. #--------------------------------------------------------------------------
  1577. def get_next_word_size(c, text)
  1578. # Split text by the next space/line/page and grab the first split
  1579. nextword = text.split(/[\s\n\f]/, 2)[0]
  1580. if nextword
  1581. icons = 0
  1582. if nextword =~ /\e/i
  1583. # Get rid of color codes and YEA Message system outline colors
  1584. nextword = nextword.split(/\e[oOcC]+\[\d*\]/).join
  1585. # Get rid of message timing control codes
  1586. nextword = nextword.split(/\e[\.\|\^<>!]/).join
  1587. # Split text by the first non-icon escape code
  1588. # (the hH is for compatibility with the Icon Hues script)
  1589. nextword = nextword.split(/\e[^iIhH]+/, 2)[0]
  1590. # Erase and count icons in remaining text
  1591. nextword.gsub!(/\e[iIhH]+\[[\d,]*\]/) do
  1592. icons += 1
  1593. ''
  1594. end if nextword
  1595. end
  1596. wordsize = (nextword ? text_size(c + nextword).width : text_size( c ).width)
  1597. wordsize += icons * 24
  1598. else
  1599. wordsize = text_size( c ).width
  1600. end
  1601. return wordsize
  1602. end
  1603. #--------------------------------------------------------------------------
  1604. # * Control Character Processing
  1605. # code : the core of the control character
  1606. # e.g. "C" in the case of the control character \C[1].
  1607. #--------------------------------------------------------------------------
  1608. alias process_escape_character_bestiary process_escape_character
  1609. def process_escape_character(code, text, pos)
  1610. process_escape_character_bestiary(code, text, pos)
  1611. # Recalculate the next word size and insert line breaks
  1612. # (Needed primarily for font changes)
  1613. if pos[:x] + get_next_word_size('', text) > contents.width
  1614. process_new_line(text, pos)
  1615. end
  1616. end
  1617. end
  1618.  
  1619.  
  1620. #==============================================================================
  1621. # ** Window_BestiaryStatusBase
  1622. #------------------------------------------------------------------------------
  1623. # The base window for the various status pages for the selected enemy.
  1624. #==============================================================================
  1625.  
  1626. class Window_BestiaryStatusBase < Window_Base
  1627. #--------------------------------------------------------------------------
  1628. # * Object Initialization
  1629. #--------------------------------------------------------------------------
  1630. def initialize(x, y, width, height)
  1631. super
  1632. @lastc = "\n"
  1633. end
  1634. #--------------------------------------------------------------------------
  1635. # * Draw Text with Control Characters
  1636. #--------------------------------------------------------------------------
  1637. def draw_text_ex(x, y, text)
  1638. text = convert_escape_characters(text)
  1639. pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  1640. process_character(text.slice!(0, 1), text, pos) until text.empty?
  1641. end
  1642. #--------------------------------------------------------------------------
  1643. # * Draw Text with Control Characters
  1644. #--------------------------------------------------------------------------
  1645. def draw_text_ex_title(x, y, text)
  1646. text = convert_escape_characters(text)
  1647. pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  1648. process_character_no_wrap(text.slice!(0, 1), text, pos) until text.empty?
  1649. end
  1650. #--------------------------------------------------------------------------
  1651. # * Calculate Line Height
  1652. # restore_font_size : Return to original font size after calculating
  1653. #--------------------------------------------------------------------------
  1654. def calc_line_height(text, restore_font_size = true)
  1655. result = [@smline_height, contents.font.size].max
  1656. last_font_size = contents.font.size
  1657. text.slice(/^.*$/).scan(/\e[\{\}]/).each do |esc|
  1658. make_font_bigger if esc == "\e{"
  1659. make_font_smaller if esc == "\e}"
  1660. result = [result, contents.font.size].max
  1661. end
  1662. contents.font.size = last_font_size if restore_font_size
  1663. result
  1664. end
  1665. #--------------------------------------------------------------------------
  1666. # * Character Processing
  1667. # c : Characters
  1668. # text : A character string buffer in drawing processing (destructive)
  1669. # pos : Draw position {:x, :y, :new_x, :height}
  1670. #--------------------------------------------------------------------------
  1671. def process_character(c, text, pos)
  1672. if FantasyBestiary::Word_Wrap && c =~ /[ \t]/
  1673. c = '' if @lastc =~ /[\s\n\f]/
  1674. if pos[:x] + get_next_word_size(c, text) > contents.width - FantasyBestiary::Right_Margin
  1675. process_new_line(text, pos)
  1676. @dy += @smline_height
  1677. else
  1678. process_normal_character(c, pos)
  1679. end
  1680. @lastc = c
  1681. else
  1682. @lastc = c
  1683. case c
  1684. when "\n" # New line
  1685. process_new_line(text, pos)
  1686. @dy += @smline_height
  1687. when "\f" # New page
  1688. process_new_page(text, pos)
  1689. when "\e" # Control character
  1690. process_escape_character(obtain_escape_code(text), text, pos)
  1691. else # Normal character
  1692. process_normal_character(c, pos)
  1693. end
  1694. end
  1695. end
  1696. #--------------------------------------------------------------------------
  1697. # * Character Processing No Wrap
  1698. # c : Characters
  1699. # text : A character string buffer in drawing processing (destructive)
  1700. # pos : Draw position {:x, :y, :new_x, :height}
  1701. #--------------------------------------------------------------------------
  1702. def process_character_no_wrap(c, text, pos)
  1703. case c
  1704. when "\e" # Control character
  1705. process_escape_character(obtain_escape_code(text), text, pos)
  1706. else # Normal character
  1707. process_normal_character(c, pos)
  1708. end
  1709. end
  1710. #--------------------------------------------------------------------------
  1711. # * Normal Character Processing
  1712. #--------------------------------------------------------------------------
  1713. alias bestiary_process_normal_character process_normal_character
  1714. def process_normal_character(c, pos)
  1715. if @toggletext == true
  1716. text_width = text_size(c).width
  1717. draw_text(pos[:x], pos[:y], text_width * 1.2, pos[:height], c)
  1718. pos[:x] += (text_width * 0.75)
  1719. else
  1720. bestiary_process_normal_character(c, pos)
  1721. end
  1722. end
  1723. #--------------------------------------------------------------------------
  1724. # * Get Next Word Size
  1725. #--------------------------------------------------------------------------
  1726. def get_next_word_size(c, text)
  1727. # Split text by the next space/line/page and grab the first split
  1728. nextword = text.split(/[\s\n\f]/, 2)[0]
  1729. if nextword
  1730. icons = 0
  1731. if nextword =~ /\e/i
  1732. # Get rid of color codes and YEA Message system outline colors
  1733. nextword = nextword.split(/\e[oOcC]+\[\d*\]/).join
  1734. # Get rid of message timing control codes
  1735. nextword = nextword.split(/\e[\.\|\^<>!]/).join
  1736. # Split text by the first non-icon escape code
  1737. # (the hH is for compatibility with the Icon Hues script)
  1738. nextword = nextword.split(/\e[^iIhH]+/, 2)[0]
  1739. # Erase and count icons in remaining text
  1740. nextword.gsub!(/\e[iIhH]+\[[\d,]*\]/) do
  1741. icons += 1
  1742. ''
  1743. end if nextword
  1744. end
  1745. wordsize = (nextword ? text_size(c + nextword).width : text_size( c ).width)
  1746. wordsize += icons * 18
  1747. else
  1748. wordsize = text_size( c ).width
  1749. end
  1750. return wordsize
  1751. end
  1752. #--------------------------------------------------------------------------
  1753. # * Control Character Processing
  1754. # code : the core of the control character
  1755. # e.g. "C" in the case of the control character \C[1].
  1756. #--------------------------------------------------------------------------
  1757. alias process_escape_character_bestiary process_escape_character
  1758. def process_escape_character(code, text, pos)
  1759. process_escape_character_bestiary(code, text, pos)
  1760. # Recalculate the next word size and insert line breaks
  1761. # (Needed primarily for font changes)
  1762. if pos[:x] + get_next_word_size('', text) > contents.width
  1763. process_new_line(text, pos)
  1764. end
  1765. end
  1766. #--------------------------------------------------------------------------
  1767. # * Icon Drawing Process by Control Characters
  1768. #--------------------------------------------------------------------------
  1769. def process_draw_icon(icon_index, pos)
  1770. draw_icon(icon_index, pos[:x], pos[:y])
  1771. pos[:x] += @icon_size
  1772. end
  1773. #--------------------------------------------------------------------------
  1774. # * Draw Horizontal Line
  1775. #--------------------------------------------------------------------------
  1776. def draw_horz_line(y)
  1777. line_y = y + @smline_height / 4 - 2
  1778. contents.fill_rect(0, line_y, contents_width, 2, line_color)
  1779. @dy += @smline_height / 4 + 2 #- 2
  1780. end
  1781. #--------------------------------------------------------------------------
  1782. # * Get Color of Horizontal Line
  1783. #--------------------------------------------------------------------------
  1784. def line_color
  1785. color = normal_color
  1786. color.alpha = FantasyBestiary::Horz_Line_Opac
  1787. color
  1788. end
  1789. #--------------------------------------------------------------------------
  1790. # * Draw Icon
  1791. #--------------------------------------------------------------------------
  1792. def draw_icon(icon_index, x, y, enabled = true)
  1793. bitmap = Cache.system("Iconset")
  1794. rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1795. target = Rect.new(x , y, @icon_size, @icon_size)
  1796. contents.stretch_blt(target, bitmap, rect)
  1797. end
  1798. #--------------------------------------------------------------------------
  1799. # * Draw Number of Defeated
  1800. #--------------------------------------------------------------------------
  1801. def draw_defeated(dx, dy, dw)
  1802. change_color(normal_color)
  1803. draw_text_ex_title(dx, dy, FantasyBestiary::Defeated)
  1804. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, $game_party.kill_count[@item.id], 2)
  1805. end
  1806. #--------------------------------------------------------------------------
  1807. # * Draw Level
  1808. #--------------------------------------------------------------------------
  1809. def draw_level(dx, dy, dw)
  1810. change_color(system_color)
  1811. draw_text_ex_title(dx, dy, FantasyBestiary::Level)
  1812. change_color(normal_color)
  1813. if $game_party.bestiary_level[@item.id] != nil
  1814. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, $game_party.bestiary_level[@item.id].group, 2)
  1815. else
  1816. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, "???", 2)
  1817. end
  1818. end
  1819. #--------------------------------------------------------------------------
  1820. # * Draw HP
  1821. #--------------------------------------------------------------------------
  1822. def draw_hp(dx, dy, dw)
  1823. change_color(system_color)
  1824. draw_text(dx, dy, 120, @smline_height + 2, Vocab::hp, 0)
  1825. change_color(normal_color)
  1826. if !@item.hide_hp
  1827. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, @item.params[0].group, 2)
  1828. else
  1829. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, "???", 2)
  1830. end
  1831. end
  1832. #--------------------------------------------------------------------------
  1833. # * Draw MP
  1834. #--------------------------------------------------------------------------
  1835. def draw_mp(dx, dy, dw)
  1836. change_color(system_color)
  1837. draw_text(dx, dy, 120, @smline_height + 2, Vocab::mp, 0)
  1838. change_color(normal_color)
  1839. if !@item.hide_mp
  1840. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, @item.params[1].group, 2)
  1841. else
  1842. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, "???", 2)
  1843. end
  1844. end
  1845. #--------------------------------------------------------------------------
  1846. # * Draw other Stats
  1847. #--------------------------------------------------------------------------
  1848. def draw_stats(dx, dy)
  1849. FantasyBestiary::Stats_To_Display.times {|i| draw_enemy_param(dx, dy + @smline_height * i, i + 2) }
  1850. end
  1851. #--------------------------------------------------------------------------
  1852. # * Draw Parameters
  1853. #--------------------------------------------------------------------------
  1854. def draw_enemy_param(x, y, param_id)
  1855. change_color(system_color)
  1856. draw_text(x, y, 120, @smline_height + 2, Vocab::param(param_id))
  1857. change_color(normal_color)
  1858. if !@item.hide_stats
  1859. draw_text(x + 120, y, contents.width - 120, @smline_height + 2, @item.params[(param_id)].group, 2)
  1860. else
  1861. draw_text(x + 120, y, contents.width - 120, @smline_height + 2, "???", 2)
  1862. end
  1863. @dy += @smline_height
  1864. end
  1865. #--------------------------------------------------------------------------
  1866. # * Draw Exp
  1867. #--------------------------------------------------------------------------
  1868. def draw_exp(dx, dy, dw)
  1869. change_color(system_color)
  1870. draw_text_ex_title(dx, dy, FantasyBestiary::Exp)
  1871. change_color(normal_color)
  1872. if !@item.hide_spoils
  1873. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, @item.exp.group, 2)
  1874. else
  1875. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, "???", 2)
  1876. end
  1877. end
  1878. #--------------------------------------------------------------------------
  1879. # * Draw Gold
  1880. #--------------------------------------------------------------------------
  1881. def draw_gold(dx, dy, dw)
  1882. change_color(system_color)
  1883. draw_text_ex_title(dx, dy, FantasyBestiary::Currency)
  1884. change_color(normal_color)
  1885. if !@item.hide_spoils
  1886. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, @item.gold.group, 2)
  1887. else
  1888. draw_text(dx + 120, dy, contents.width - 120, @smline_height + 2, "???", 2)
  1889. end
  1890. end
  1891. #--------------------------------------------------------------------------
  1892. # * Draw Drop Name
  1893. #--------------------------------------------------------------------------
  1894. def draw_dropname(dx, dy, dw)
  1895. change_color(normal_color)
  1896. text = FantasyBestiary::Drops_Name
  1897. draw_text_ex_title(dx, dy, text)
  1898. @dy += @smline_height
  1899. end
  1900. #--------------------------------------------------------------------------
  1901. # * Draw Drops
  1902. #--------------------------------------------------------------------------
  1903. def draw_drops(dx, dy, dw)
  1904. change_color(normal_color)
  1905. if !@item.hide_spoils
  1906. drop = 0
  1907. for i in @item.drop_items
  1908. next if i.kind == 0
  1909. drop += 1
  1910. dropname = $data_items[i.data_id] if i.kind == 1
  1911. dropname = $data_weapons[i.data_id] if i.kind == 2
  1912. dropname = $data_armors [i.data_id] if i.kind == 3
  1913. ddy = dy + (@smline_height * (drop - 1))
  1914. if FantasyBestiary::Show_Drop_Icons
  1915. draw_icon(dropname.icon_index, dx, ddy)
  1916. self.contents.draw_text(dx + @icon_size, ddy, contents.width, @smline_height, " " + dropname.name.to_s, 0)
  1917. else
  1918. self.contents.draw_text(dx, ddy, contents.width, @smline_height, dropname.name.to_s, 0)
  1919. end
  1920. @dy += @smline_height
  1921. end
  1922. @dy -= @smline_height
  1923. text = FantasyBestiary::Empty_Text
  1924. draw_text_ex(dx, dy, text) if drop == 0
  1925. @dy += @smline_height if drop == 0
  1926. else
  1927. draw_text(dx, dy, contents.width, @smline_height + 2, "???", 0)
  1928. end
  1929. @dy += (@smline_height / 2)
  1930. end
  1931. #--------------------------------------------------------------------------
  1932. # * Draw Type Name
  1933. #--------------------------------------------------------------------------
  1934. def draw_type_title(dx, dy, dw)
  1935. change_color(normal_color)
  1936. text = FantasyBestiary::Type
  1937. draw_text_ex_title(dx, dy, text)
  1938. @dy += @smline_height
  1939. end
  1940. #--------------------------------------------------------------------------
  1941. # * Draw Types
  1942. #--------------------------------------------------------------------------
  1943. def draw_types(dx, dy, dw)
  1944. change_color(normal_color)
  1945. if @item.type == "" || @item.type == nil
  1946. text = FantasyBestiary::Empty_Text
  1947. draw_text_ex(dx, dy, text)
  1948. else
  1949. draw_text_ex(dx, dy, @item.type)
  1950. end
  1951. @dy += (@smline_height / 2)
  1952. end
  1953. #--------------------------------------------------------------------------
  1954. # * Draw Location Name
  1955. #--------------------------------------------------------------------------
  1956. def draw_location_title(dx, dy, dw)
  1957. change_color(normal_color)
  1958. text = FantasyBestiary::Location
  1959. draw_text_ex_title(dx, dy, text)
  1960. @dy += @smline_height
  1961. end
  1962. #--------------------------------------------------------------------------
  1963. # * Draw Locations
  1964. #--------------------------------------------------------------------------
  1965. def draw_locations(dx, dy, dw)
  1966. change_color(normal_color)
  1967. if @item.location == "" || @item.location == nil
  1968. text = FantasyBestiary::Empty_Text
  1969. draw_text_ex(dx, dy, text)
  1970. else
  1971. draw_text_ex(dx, dy, @item.location)
  1972. end
  1973. @dy += (@smline_height / 2)
  1974. end
  1975. #--------------------------------------------------------------------------
  1976. # * Draw Elemental Weakness Name
  1977. #--------------------------------------------------------------------------
  1978. def draw_elem_weak_title(dx, dy, dw)
  1979. change_color(normal_color)
  1980. text = FantasyBestiary::Elem_Weak
  1981. draw_text_ex_title(dx, dy, text)
  1982. @dy += @smline_height
  1983. end
  1984. #--------------------------------------------------------------------------
  1985. # * Draw Elemental Weaknesses
  1986. #--------------------------------------------------------------------------
  1987. def draw_elem_weak(dx, dy, dw)
  1988. change_color(normal_color)
  1989. if @item.elem_weak == "" || @item.elem_weak == nil
  1990. text = FantasyBestiary::Empty_Text
  1991. draw_text_ex(dx, dy, text)
  1992. else
  1993. draw_text_ex(dx, dy, @item.elem_weak)
  1994. end
  1995. @dy += (@smline_height / 2)
  1996. end
  1997. #--------------------------------------------------------------------------
  1998. # * Draw Elemental Resistance Name
  1999. #--------------------------------------------------------------------------
  2000. def draw_elem_resist_title(dx, dy, dw)
  2001. change_color(normal_color)
  2002. text = FantasyBestiary::Elem_Resist
  2003. draw_text_ex_title(dx, dy, text)
  2004. @dy += @smline_height
  2005. end
  2006. #--------------------------------------------------------------------------
  2007. # * Draw Elemental Resistances
  2008. #--------------------------------------------------------------------------
  2009. def draw_elem_resist(dx, dy, dw)
  2010. change_color(normal_color)
  2011. if @item.elem_resist == "" || @item.elem_resist == nil
  2012. text = FantasyBestiary::Empty_Text
  2013. draw_text_ex(dx, dy, text)
  2014. else
  2015. draw_text_ex(dx, dy, @item.elem_resist)
  2016. end
  2017. @dy += (@smline_height / 2)
  2018. end
  2019. #--------------------------------------------------------------------------
  2020. # * Draw Elemental Immunity Name
  2021. #--------------------------------------------------------------------------
  2022. def draw_elem_immune_title(dx, dy, dw)
  2023. change_color(normal_color)
  2024. text = FantasyBestiary::Elem_Immune
  2025. draw_text_ex_title(dx, dy, text)
  2026. @dy += @smline_height
  2027. end
  2028. #--------------------------------------------------------------------------
  2029. # * Draw Elemental Immunities
  2030. #--------------------------------------------------------------------------
  2031. def draw_elem_immune(dx, dy, dw)
  2032. change_color(normal_color)
  2033. if @item.elem_immune == "" || @item.elem_immune == nil
  2034. text = FantasyBestiary::Empty_Text
  2035. draw_text_ex(dx, dy, text)
  2036. else
  2037. draw_text_ex(dx, dy, @item.elem_immune)
  2038. end
  2039. @dy += (@smline_height / 2)
  2040. end
  2041. #--------------------------------------------------------------------------
  2042. # * Draw Elemental Absorption Name
  2043. #--------------------------------------------------------------------------
  2044. def draw_elem_absorb_title(dx, dy, dw)
  2045. change_color(normal_color)
  2046. text = FantasyBestiary::Elem_Absorb
  2047. draw_text_ex_title(dx, dy, text)
  2048. @dy += @smline_height
  2049. end
  2050. #--------------------------------------------------------------------------
  2051. # * Draw Elemental Absorptions
  2052. #--------------------------------------------------------------------------
  2053. def draw_elem_absorb(dx, dy, dw)
  2054. change_color(normal_color)
  2055. if @item.elem_absorb == "" || @item.elem_absorb == nil
  2056. text = FantasyBestiary::Empty_Text
  2057. draw_text_ex(dx, dy, text)
  2058. else
  2059. draw_text_ex(dx, dy, @item.elem_absorb)
  2060. end
  2061. @dy += (@smline_height / 2)
  2062. end
  2063. #--------------------------------------------------------------------------
  2064. # * Draw State Weakness Name
  2065. #--------------------------------------------------------------------------
  2066. def draw_state_weak_title(dx, dy, dw)
  2067. change_color(normal_color)
  2068. text = FantasyBestiary::State_Weak
  2069. draw_text_ex_title(dx, dy, text)
  2070. @dy += @smline_height
  2071. end
  2072. #--------------------------------------------------------------------------
  2073. # * Draw State Weaknesses
  2074. #--------------------------------------------------------------------------
  2075. def draw_state_weak(dx, dy, dw)
  2076. change_color(normal_color)
  2077. if @item.state_weak == "" || @item.state_weak == nil
  2078. text = FantasyBestiary::Empty_Text
  2079. draw_text_ex(dx, dy, text)
  2080. else
  2081. draw_text_ex(dx, dy, @item.state_weak)
  2082. end
  2083. @dy += (@smline_height / 2)
  2084. end
  2085. #--------------------------------------------------------------------------
  2086. # * Draw State Resistance Name
  2087. #--------------------------------------------------------------------------
  2088. def draw_state_resist_title(dx, dy, dw)
  2089. change_color(normal_color)
  2090. text = FantasyBestiary::State_Resist
  2091. draw_text_ex_title(dx, dy, text)
  2092. @dy += @smline_height
  2093. end
  2094. #--------------------------------------------------------------------------
  2095. # * Draw State Resistances
  2096. #--------------------------------------------------------------------------
  2097. def draw_state_resist(dx, dy, dw)
  2098. change_color(normal_color)
  2099. if @item.state_resist == "" || @item.state_resist == nil
  2100. text = FantasyBestiary::Empty_Text
  2101. draw_text_ex(dx, dy, text)
  2102. else
  2103. draw_text_ex(dx, dy, @item.state_resist)
  2104. end
  2105. @dy += (@smline_height / 2)
  2106. end
  2107. #--------------------------------------------------------------------------
  2108. # * Draw State Immunity Name
  2109. #--------------------------------------------------------------------------
  2110. def draw_state_immune_title(dx, dy, dw)
  2111. change_color(normal_color)
  2112. text = FantasyBestiary::State_Immune
  2113. draw_text_ex_title(dx, dy, text)
  2114. @dy += @smline_height
  2115. end
  2116. #--------------------------------------------------------------------------
  2117. # * Draw State Immunities
  2118. #--------------------------------------------------------------------------
  2119. def draw_state_immune(dx, dy, dw)
  2120. change_color(normal_color)
  2121. if @item.state_immune == "" || @item.state_immune == nil
  2122. text = FantasyBestiary::Empty_Text
  2123. draw_text_ex(dx, dy, text)
  2124. else
  2125. draw_text_ex(dx, dy, @item.state_immune)
  2126. end
  2127. @dy += (@smline_height / 2)
  2128. end
  2129. #--------------------------------------------------------------------------
  2130. # * Draw Skills 1 Title
  2131. #--------------------------------------------------------------------------
  2132. def draw_skills1_title(dx, dy, dw)
  2133. change_color(normal_color)
  2134. text = FantasyBestiary::Skills_1
  2135. draw_text_ex_title(dx, dy, text)
  2136. @dy += @smline_height
  2137. end
  2138. #--------------------------------------------------------------------------
  2139. # * Draw Skills 1
  2140. #--------------------------------------------------------------------------
  2141. def draw_skills1(dx, dy, dw)
  2142. change_color(normal_color)
  2143. if @item.skillspg1 == "" || @item.skillspg1 == nil
  2144. text = FantasyBestiary::Empty_Text
  2145. draw_text_ex(dx, dy, text)
  2146. else
  2147. draw_text_ex(dx, dy, @item.skillspg1)
  2148. end
  2149. @dy += (@smline_height / 2)
  2150. end
  2151. #--------------------------------------------------------------------------
  2152. # * Draw Skills 2 Title
  2153. #--------------------------------------------------------------------------
  2154. def draw_skills2_title(dx, dy, dw)
  2155. change_color(normal_color)
  2156. text = FantasyBestiary::Skills_2
  2157. draw_text_ex_title(dx, dy, text)
  2158. @dy += @smline_height
  2159. end
  2160. #--------------------------------------------------------------------------
  2161. # * Draw Skills 2
  2162. #--------------------------------------------------------------------------
  2163. def draw_skills2(dx, dy, dw)
  2164. change_color(normal_color)
  2165. if @item.skillspg2 == "" || @item.skillspg2 == nil
  2166. text = FantasyBestiary::Empty_Text
  2167. draw_text_ex(dx, dy, text)
  2168. else
  2169. draw_text_ex(dx, dy, @item.skillspg2)
  2170. end
  2171. @dy += (@smline_height / 2)
  2172. end
  2173. #--------------------------------------------------------------------------
  2174. # * Draw Skills 3 Title
  2175. #--------------------------------------------------------------------------
  2176. def draw_skills3_title(dx, dy, dw)
  2177. change_color(normal_color)
  2178. text = FantasyBestiary::Skills_3
  2179. draw_text_ex_title(dx, dy, text)
  2180. @dy += @smline_height
  2181. end
  2182. #--------------------------------------------------------------------------
  2183. # * Draw Skills 3
  2184. #--------------------------------------------------------------------------
  2185. def draw_skills3(dx, dy, dw)
  2186. change_color(normal_color)
  2187. if @item.skillspg3 == "" || @item.skillspg3 == nil
  2188. text = FantasyBestiary::Empty_Text
  2189. draw_text_ex(dx, dy, text)
  2190. else
  2191. draw_text_ex(dx, dy, @item.skillspg3)
  2192. end
  2193. @dy += (@smline_height / 2)
  2194. end
  2195. #--------------------------------------------------------------------------
  2196. # * Draw Long Description Title
  2197. #--------------------------------------------------------------------------
  2198. def draw_long_desc_title(dx, dy, dw)
  2199. change_color(normal_color)
  2200. text = FantasyBestiary::Long_Desc
  2201. draw_text_ex_title(dx, dy, text)
  2202. @dy += @smline_height
  2203. end
  2204. #--------------------------------------------------------------------------
  2205. # * Draw Long Description
  2206. #--------------------------------------------------------------------------
  2207. def draw_long_desc(dx, dy, dw)
  2208. change_color(normal_color)
  2209. if @item.long_desc == "" || @item.long_desc == nil
  2210. text = FantasyBestiary::Empty_Text
  2211. draw_text_ex(dx, dy, text)
  2212. else
  2213. draw_text_ex(dx, dy, @item.long_desc)
  2214. end
  2215. @dy += (@smline_height / 2)
  2216. end
  2217. #--------------------------------------------------------------------------
  2218. # * Draw Toggle Description
  2219. #--------------------------------------------------------------------------
  2220. def draw_toggle(dx, bdy, dw)
  2221. change_color(normal_color)
  2222. text = FantasyBestiary::Toggle_Status_Text
  2223. draw_text_ex_title(dx, bdy + 4, text)
  2224. end
  2225. end
  2226.  
  2227. #==============================================================================
  2228. # ** Window_BestiaryStatus
  2229. #------------------------------------------------------------------------------
  2230. # This window displays the status page for the selected enemy.
  2231. #==============================================================================
  2232.  
  2233. class Window_BestiaryStatus < Window_BestiaryStatusBase
  2234. #--------------------------------------------------------------------------
  2235. # * Object Initialization
  2236. #--------------------------------------------------------------------------
  2237. def initialize(dx, dy, width, height, enemyhorzlist_window)
  2238. super(dx, dy, width, height)
  2239. @enemyhorzlist_window = enemyhorzlist_window
  2240. @item = nil
  2241. @page_num = 1
  2242. contents.clear
  2243. reset_font_settings
  2244. draw_enemy_info
  2245. end
  2246. #--------------------------------------------------------------------------
  2247. # * Frame Update
  2248. #--------------------------------------------------------------------------
  2249. def update
  2250. super
  2251. update_item(@enemyhorzlist_window.item)
  2252. end
  2253. #--------------------------------------------------------------------------
  2254. # * Update Item Window
  2255. #--------------------------------------------------------------------------
  2256. def update_item(item)
  2257. return if @item == item
  2258. @item = item
  2259. refresh
  2260. end
  2261. #--------------------------------------------------------------------------
  2262. # * Refresh
  2263. #--------------------------------------------------------------------------
  2264. def refresh
  2265. contents.clear
  2266. reset_font_settings
  2267. draw_enemy_info
  2268. end
  2269. #--------------------------------------------------------------------------
  2270. # * Refresh
  2271. #--------------------------------------------------------------------------
  2272. def refresh2
  2273. contents.clear
  2274. reset_font_settings
  2275. @page_num += 1
  2276. @page_num = 1 if @page_num > FantasyBestiary::Pages.size
  2277. draw_enemy_info
  2278. end
  2279. #--------------------------------------------------------------------------
  2280. # * Reset Page Number Parameter
  2281. #--------------------------------------------------------------------------
  2282. def resetpage_num
  2283. @page_num = 1
  2284. end
  2285. #--------------------------------------------------------------------------
  2286. # * Stats Font Size
  2287. #--------------------------------------------------------------------------
  2288. def stat_font_size
  2289. @smline_height = 20
  2290. contents.font.size = 20
  2291. @icon_size = 20
  2292. end
  2293. #--------------------------------------------------------------------------
  2294. # * Title Font Size
  2295. #--------------------------------------------------------------------------
  2296. def title_font_size
  2297. @smline_height = 18
  2298. contents.font.size = 20
  2299. @icon_size = 20
  2300. end
  2301. #--------------------------------------------------------------------------
  2302. # * Text Font Size
  2303. #--------------------------------------------------------------------------
  2304. def text_font_size
  2305. @smline_height = 18
  2306. contents.font.size = 18
  2307. @icon_size = 18
  2308. end
  2309. #--------------------------------------------------------------------------
  2310. # * Draw Enemy Information
  2311. #--------------------------------------------------------------------------
  2312. def draw_enemy_info
  2313. return unless @item.is_a?(RPG::Enemy)
  2314. dx = 0
  2315. @dy = 0
  2316. bdy = contents.height - contents.font.size
  2317. dw = 0
  2318. @toggletext = false
  2319. size = 0
  2320. pages = FantasyBestiary::Pages
  2321. for page in pages
  2322. size += 1
  2323. if size == @page_num
  2324. for info in page
  2325. case info
  2326. when "Space"
  2327. @dy += @smline_height
  2328. when "Line"
  2329. draw_horz_line(@dy)
  2330. when "Kill Count"
  2331. stat_font_size
  2332. draw_defeated(dx, @dy, dw)
  2333. @dy += @smline_height
  2334. when "Level"
  2335. stat_font_size
  2336. draw_level(dx, @dy, dw)
  2337. @dy += @smline_height
  2338. when "HP"
  2339. stat_font_size
  2340. draw_hp(dx, @dy, dw)
  2341. @dy += @smline_height
  2342. when "MP"
  2343. stat_font_size
  2344. draw_mp(dx, @dy, dw)
  2345. @dy += @smline_height
  2346. when "Stats"
  2347. stat_font_size
  2348. draw_stats(dx, @dy)
  2349. @dy += @smline_height
  2350. when "Exp"
  2351. stat_font_size
  2352. draw_exp(dx, @dy, dw)
  2353. @dy += @smline_height
  2354. when "Gold"
  2355. stat_font_size
  2356. draw_gold(dx, @dy, dw)
  2357. @dy += @smline_height
  2358. when "Drop Title"
  2359. title_font_size
  2360. draw_dropname(dx, @dy, dw)
  2361. when "Drop"
  2362. text_font_size
  2363. draw_drops(dx, @dy, dw)
  2364. when "Type Title"
  2365. title_font_size
  2366. draw_type_title(dx, @dy, dw)
  2367. when "Type"
  2368. text_font_size
  2369. draw_types(dx, @dy, dw)
  2370. when "Location Title"
  2371. title_font_size
  2372. draw_location_title(dx, @dy, dw)
  2373. when "Location"
  2374. text_font_size
  2375. draw_locations(dx, @dy, dw)
  2376. when "Elem Weak Title"
  2377. title_font_size
  2378. draw_elem_weak_title(dx, @dy, dw)
  2379. when "Elem Weak"
  2380. text_font_size
  2381. draw_elem_weak(dx, @dy, dw)
  2382. when "Elem Resist Title"
  2383. title_font_size
  2384. draw_elem_resist_title(dx, @dy, dw)
  2385. when "Elem Resist"
  2386. text_font_size
  2387. draw_elem_resist(dx, @dy, dw)
  2388. when "Elem Immune Title"
  2389. title_font_size
  2390. draw_elem_immune_title(dx, @dy, dw)
  2391. when "Elem Immune"
  2392. text_font_size
  2393. draw_elem_immune(dx, @dy, dw)
  2394. when "Elem Absorb Title"
  2395. title_font_size
  2396. draw_elem_absorb_title(dx, @dy, dw)
  2397. when "Elem Absorb"
  2398. text_font_size
  2399. draw_elem_absorb(dx, @dy, dw)
  2400. when "State Weak Title"
  2401. title_font_size
  2402. draw_state_weak_title(dx, @dy, dw)
  2403. when "State Weak"
  2404. text_font_size
  2405. draw_state_weak(dx, @dy, dw)
  2406. when "State Resist Title"
  2407. title_font_size
  2408. draw_state_resist_title(dx, @dy, dw)
  2409. when "State Resist"
  2410. text_font_size
  2411. draw_state_resist(dx, @dy, dw)
  2412. when "State Immune Title"
  2413. title_font_size
  2414. draw_state_immune_title(dx, @dy, dw)
  2415. when "State Immune"
  2416. text_font_size
  2417. draw_state_immune(dx, @dy, dw)
  2418. when "Skills 1 Title"
  2419. title_font_size
  2420. draw_skills1_title(dx, @dy, dw)
  2421. when "Skills 1"
  2422. text_font_size
  2423. draw_skills1(dx, @dy, dw)
  2424. when "Skills 2 Title"
  2425. title_font_size
  2426. draw_skills2_title(dx, @dy, dw)
  2427. when "Skills 2"
  2428. text_font_size
  2429. draw_skills2(dx, @dy, dw)
  2430. when "Skills 3 Title"
  2431. title_font_size
  2432. draw_skills3_title(dx, @dy, dw)
  2433. when "Skills 3"
  2434. text_font_size
  2435. draw_skills3(dx, @dy, dw)
  2436. when "Long Desc Title"
  2437. title_font_size
  2438. draw_long_desc_title(dx, @dy, dw)
  2439. when "Long Desc"
  2440. text_font_size
  2441. draw_long_desc(dx, @dy, dw)
  2442. end
  2443. end
  2444. end
  2445. end
  2446. @icon_size = 20
  2447. @smline_height = 20
  2448. contents.font.size = 20
  2449. @toggletext = true
  2450. draw_toggle(dx, bdy, dw) if FantasyBestiary::Pages.size > 1
  2451. end
  2452. end
  2453.  
  2454. #==============================================================================
  2455. # ** Window_BestiaryPic
  2456. #------------------------------------------------------------------------------
  2457. # This window displays the enemy's sprite as well as any battlebacks they are
  2458. # tied to.
  2459. #==============================================================================
  2460.  
  2461. class Window_BestiaryPic < Window_Base
  2462. #--------------------------------------------------------------------------
  2463. # * Object Initialization
  2464. #--------------------------------------------------------------------------
  2465. def initialize(dx, dy, width, height, enemyhorzlist_window)
  2466. super(dx, dy, width, height)
  2467. @window_x = dx
  2468. @window_y = dy
  2469. @window_width = width
  2470. @window_height = height
  2471. @enemyhorzlist_window = enemyhorzlist_window
  2472. @item = nil
  2473. self.opacity = 0 if FantasyBestiary::Battleback_Full_Screen
  2474. self.back_opacity = 0 if FantasyBestiary::Battleback_Full_Screen
  2475. refresh
  2476. end
  2477. #--------------------------------------------------------------------------
  2478. # * Frame Update
  2479. #--------------------------------------------------------------------------
  2480. def update
  2481. super
  2482. update_item(@enemyhorzlist_window.item)
  2483. end
  2484. #--------------------------------------------------------------------------
  2485. # * Get Standard Padding Size
  2486. #--------------------------------------------------------------------------
  2487. def standard_padding
  2488. return FantasyBestiary::Enemy_Picture_Padding
  2489. end
  2490. #--------------------------------------------------------------------------
  2491. # * Update Item Window
  2492. #--------------------------------------------------------------------------
  2493. def update_item(item)
  2494. return if @item == item
  2495. @item = item
  2496. refresh
  2497. end
  2498. #--------------------------------------------------------------------------
  2499. # * Refresh
  2500. #--------------------------------------------------------------------------
  2501. def refresh
  2502. contents.clear
  2503. clear_sprite if @enemypic != nil
  2504. reset_font_settings
  2505. draw_battleback1
  2506. draw_battleback2
  2507. draw_enemy_sprite
  2508. end
  2509. #--------------------------------------------------------------------------
  2510. # * Enemy Battleback 1
  2511. #--------------------------------------------------------------------------
  2512. def draw_battleback1
  2513. if FantasyBestiary::Default_Battleback1 == ""
  2514. return unless @item.is_a?(RPG::Enemy) && @item.battleback1 != nil
  2515. end
  2516. return unless @item.is_a?(RPG::Enemy)
  2517. if FantasyBestiary::Battleback_Full_Screen
  2518. @bb1viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
  2519. else
  2520. @bb1w_x = @window_x + (FantasyBestiary::Enemy_Picture_Padding)
  2521. @bb1w_y = @window_y + (FantasyBestiary::Enemy_Picture_Padding)
  2522. @bb1w_width = @window_width - (FantasyBestiary::Enemy_Picture_Padding * 2)
  2523. @bb1w_height = @window_height - (FantasyBestiary::Enemy_Picture_Padding * 2)
  2524. @bb1viewport = Viewport.new(@bb1w_x, @bb1w_y, @bb1w_width, @bb1w_height)
  2525. end
  2526. @bb1viewport.z = 1
  2527. @bb1viewport.z = 1000 if !FantasyBestiary::Battleback_Full_Screen
  2528. @bb1pic = Sprite.new(@bb1viewport)
  2529. @dbb1pic = FantasyBestiary::Default_Battleback1
  2530. @dbb1pic = @item.battleback1 if @item.battleback1 != nil
  2531. @bb1pic.bitmap = Cache.battleback1(@dbb1pic)
  2532. x = @bb1viewport.rect.width / 2
  2533. y = @bb1viewport.rect.height / 2
  2534. bbx = @bb1pic.bitmap.width / 2
  2535. bby = @bb1pic.bitmap.height / 2
  2536. @bb1pic.x = x - bbx
  2537. @bb1pic.y = y - bby
  2538. @bb1pic.x += @item.bb_x_offset if !FantasyBestiary::Battleback_Full_Screen
  2539. @bb1pic.y += @item.bb_y_offset if !FantasyBestiary::Battleback_Full_Screen
  2540. end
  2541. #--------------------------------------------------------------------------
  2542. # * Draw Enemy Battleback 2
  2543. #--------------------------------------------------------------------------
  2544. def draw_battleback2
  2545. if FantasyBestiary::Default_Battleback2 == ""
  2546. return unless @item.is_a?(RPG::Enemy) && @item.battleback2 != nil
  2547. end
  2548. return unless @item.is_a?(RPG::Enemy)
  2549. if FantasyBestiary::Battleback_Full_Screen
  2550. @bb2viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
  2551. else
  2552. @bb2w_x = @window_x + (FantasyBestiary::Enemy_Picture_Padding)
  2553. @bb2w_y = @window_y + (FantasyBestiary::Enemy_Picture_Padding)
  2554. @bb2w_width = @window_width - (FantasyBestiary::Enemy_Picture_Padding * 2)
  2555. @bb2w_height = @window_height - (FantasyBestiary::Enemy_Picture_Padding * 2)
  2556. @bb2viewport = Viewport.new(@bb2w_x, @bb2w_y, @bb2w_width, @bb2w_height)
  2557. end
  2558. @bb2viewport.z = 2
  2559. @bb2viewport.z = 1001 if !FantasyBestiary::Battleback_Full_Screen
  2560. @bb2pic = Sprite.new(@bb2viewport)
  2561. @dbb2pic = FantasyBestiary::Default_Battleback2
  2562. @dbb2pic = @item.battleback2 if @item.battleback2 != nil
  2563. @bb2pic.bitmap = Cache.battleback2(@dbb2pic)
  2564. x = @bb2viewport.rect.width / 2
  2565. y = @bb2viewport.rect.height / 2
  2566. bbx = @bb2pic.bitmap.width / 2
  2567. bby = @bb2pic.bitmap.height / 2
  2568. @bb2pic.x = x - bbx
  2569. @bb2pic.y = y - bby
  2570. @bb2pic.x += @item.bb_x_offset if !FantasyBestiary::Battleback_Full_Screen
  2571. @bb2pic.y += @item.bb_y_offset if !FantasyBestiary::Battleback_Full_Screen
  2572. end
  2573. #--------------------------------------------------------------------------
  2574. # * Draw Enemy Sprite
  2575. #--------------------------------------------------------------------------
  2576. def draw_enemy_sprite
  2577. @holders = false
  2578. return unless @item.is_a?(RPG::Enemy)
  2579. if FantasyBestiary::Battleback_Full_Screen
  2580. @ew_x = @window_x
  2581. @ew_y = @window_y
  2582. @enemyviewport = Viewport.new(@ew_x, @ew_y, Graphics.width, Graphics.height)
  2583. else
  2584. @ew_x = @window_x + (FantasyBestiary::Enemy_Picture_Padding)
  2585. @ew_y = @window_y + (FantasyBestiary::Enemy_Picture_Padding)
  2586. @ew_width = @window_width - (FantasyBestiary::Enemy_Picture_Padding * 2)
  2587. @ew_height = @window_height - (FantasyBestiary::Enemy_Picture_Padding * 2)
  2588. @enemyviewport = Viewport.new(@ew_x, @ew_y, @ew_width, @ew_height)
  2589. end
  2590. @enemyviewport.z = 3
  2591. @enemyviewport.z = 1002 if !FantasyBestiary::Battleback_Full_Screen
  2592. @enemypic = Sprite.new(@enemyviewport)
  2593. if @item.bestiary_image != nil
  2594. @enemypic.bitmap = Cache.battler(@item.bestiary_image, @item.bestiary_hue)
  2595. ex = @enemyviewport.rect.width / 2
  2596. ey = @enemyviewport.rect.height / 2
  2597. ebx = @enemypic.bitmap.width / 2
  2598. eby = @enemypic.bitmap.height / 2
  2599. elsif $imported["BattleSymphony-HB"] && @item.holders_name != nil
  2600. @holders = true
  2601. @enemypic.bitmap = Cache.character(@item.holders_name)
  2602. @cw = @enemypic.src_rect.width / 4
  2603. @ch = @enemypic.src_rect.height / 14
  2604. sx = @item.holders_frame * @cw
  2605. sy = @item.holders_line * @ch
  2606. @enemypic.src_rect.set(sx, sy, @cw, @ch)
  2607. ebx = @enemypic.bitmap.width / 8
  2608. eby = @enemypic.bitmap.height / 28
  2609. else
  2610. @enemypic.bitmap = Cache.battler(@item.battler_name, @item.battler_hue)
  2611. ebx = @enemypic.bitmap.width / 2
  2612. eby = @enemypic.bitmap.height / 2
  2613. end
  2614. if FantasyBestiary::Battleback_Full_Screen
  2615. ex = @window_width / 2
  2616. ey = @window_height / 2
  2617. @enemypic.x = ex - ebx + @item.x_offset
  2618. @enemypic.y = ey - eby + @item.y_offset
  2619. else
  2620. ex = @enemyviewport.rect.width / 2
  2621. ey = @enemyviewport.rect.height / 2
  2622. @enemypic.x = ex - ebx + @item.x_offset
  2623. @enemypic.y = ey - eby + @item.y_offset
  2624. end
  2625. @enemypic.mirror = true if @holders || @item.bestiary_mirror || FantasyBestiary::Global_Mirror
  2626. @enemypic.mirror = false if @holders && FantasyBestiary::Global_Mirror
  2627. @enemypic.mirror = false if @holders && @item.bestiary_mirror
  2628. @enemypic.mirror = false if @item.bestiary_mirror && FantasyBestiary::Global_Mirror
  2629. @enemypic.mirror = true if @holders && @item.bestiary_mirror && FantasyBestiary::Global_Mirror
  2630. end
  2631. #--------------------------------------------------------------------------
  2632. # * Clear Enemy Sprite
  2633. #--------------------------------------------------------------------------
  2634. def clear_sprite
  2635. @enemypic.dispose
  2636. @bb1pic.dispose if @bb1pic != nil
  2637. @bb2pic.dispose if @bb2pic != nil
  2638. end
  2639. end
  2640.  
  2641. #==============================================================================
  2642. # ** Scene_Bestiary
  2643. #------------------------------------------------------------------------------
  2644. # This class performs the Bestiary screen processing.
  2645. #==============================================================================
  2646.  
  2647. class Scene_Bestiary < Scene_MenuBase
  2648. #--------------------------------------------------------------------------
  2649. # * Start Processing
  2650. #--------------------------------------------------------------------------
  2651. def start
  2652. super
  2653. $game_party.check_nil_values
  2654. $game_party.hide_new_enemies_from_start
  2655. create_help_window if FantasyBestiary::Show_Desc_Window
  2656. create_completion_window if FantasyBestiary::Completion_Window
  2657. create_enemylist_window
  2658. @enemylist_window.activate
  2659. @enemylist_window.select(0)
  2660. create_enemyhorzlist_window
  2661. @playing_bgm = false
  2662. create_status_window
  2663. create_enemypic_window
  2664. end
  2665. #--------------------------------------------------------------------------
  2666. # * Frame Update
  2667. #--------------------------------------------------------------------------
  2668. def update
  2669. super
  2670. refresh_bgm if @old_index != @enemyhorzlist_window.index && @playing_bgm == true
  2671. end
  2672. #--------------------------------------------------------------------------
  2673. # * Refresh BGM
  2674. #--------------------------------------------------------------------------
  2675. def refresh_bgm
  2676. RPG::BGM.stop if @old_index == -2
  2677. @old_index = @enemyhorzlist_window.index
  2678. if @enemyhorzlist_window.current_item_enabled? and
  2679. (@name != @enemyhorzlist_window.item.bestiary_bgm or
  2680. @volume != @enemyhorzlist_window.item.bgm_volume or
  2681. @pitch != @enemyhorzlist_window.item.bgm_pitch)
  2682. @name = @enemyhorzlist_window.item.bestiary_bgm
  2683. @volume = @enemyhorzlist_window.item.bgm_volume
  2684. @pitch = @enemyhorzlist_window.item.bgm_pitch
  2685. end
  2686. RPG::BGM.new(@name, @volume, @pitch).play rescue nil
  2687. if @name == nil && FantasyBestiary::Replay_Map_BGM && @old_index != -3
  2688. @map_bgm.replay
  2689. @map_bgs.replay
  2690. else if @name == nil && !FantasyBestiary::Replay_Map_BGM && @old_index != -3
  2691. RPG::BGM.stop
  2692. end
  2693. end
  2694. end
  2695. #--------------------------------------------------------------------------
  2696. # * Create Enemy List Window
  2697. #--------------------------------------------------------------------------
  2698. def create_enemylist_window
  2699. wh = Graphics.height - @completion_window.height if FantasyBestiary::Completion_Window
  2700. wh = Graphics.height if !FantasyBestiary::Completion_Window
  2701. @enemylist_window = Window_EnemyList.new(0, 0, Graphics.width, wh)
  2702. @enemylist_window.viewport = @viewport
  2703. @enemylist_window.set_handler(:ok, method(:on_enemylist_ok))
  2704. @enemylist_window.set_handler(:cancel, method(:return_scene))
  2705. end
  2706. #--------------------------------------------------------------------------
  2707. # * Create Enemy Horz List Window
  2708. #--------------------------------------------------------------------------
  2709. def create_enemyhorzlist_window
  2710. ww = Graphics.width - FantasyBestiary::Status_Page_Width
  2711. @enemyhorzlist_window = Window_EnemyHorzList.new(0, 0, ww)
  2712. @enemyhorzlist_window.viewport = @viewport
  2713. @enemyhorzlist_window.help_window = @help_window
  2714. @enemyhorzlist_window.set_handler(:ok, method(:on_enemyhorzlist_ok)) if FantasyBestiary::Pages.size > 1
  2715. @enemyhorzlist_window.set_handler(:cancel, method(:on_enemyhorzlist_cancel))
  2716. @enemyhorzlist_window.hide.deactivate
  2717. end
  2718. #--------------------------------------------------------------------------
  2719. # * Create Status Window
  2720. #--------------------------------------------------------------------------
  2721. def create_status_window
  2722. wx = Graphics.width - FantasyBestiary::Status_Page_Width
  2723. ww = FantasyBestiary::Status_Page_Width
  2724. wh = Graphics.height - @help_window.height if FantasyBestiary::Show_Desc_Window
  2725. wh = Graphics.height if !FantasyBestiary::Show_Desc_Window
  2726. @status_window = Window_BestiaryStatus.new(wx, 0, ww, wh, @enemyhorzlist_window)
  2727. @status_window.viewport = @viewport
  2728. @status_window.hide
  2729. end
  2730. #--------------------------------------------------------------------------
  2731. # * Create Enemy Picture Window
  2732. #--------------------------------------------------------------------------
  2733. def create_enemypic_window
  2734. wy = @enemyhorzlist_window.y + @enemyhorzlist_window.height
  2735. ww = @enemyhorzlist_window.width
  2736. wh = Graphics.height - wy - @help_window.height if FantasyBestiary::Show_Desc_Window
  2737. wh = Graphics.height - wy if !FantasyBestiary::Show_Desc_Window
  2738. @enemypic_window = Window_BestiaryPic.new(0, wy, ww, wh, @enemyhorzlist_window)
  2739. @enemypic_window.viewport = @viewport
  2740. @enemypic_window.hide
  2741. end
  2742. #--------------------------------------------------------------------------
  2743. # * Create Help Window
  2744. #--------------------------------------------------------------------------
  2745. def create_help_window
  2746. @help_window = Window_BestiaryHelp.new
  2747. @help_window.y = Graphics.height - @help_window.height
  2748. @help_window.viewport = @viewport
  2749. @help_window.hide
  2750. end
  2751. #--------------------------------------------------------------------------
  2752. # * Create Completion Window
  2753. #--------------------------------------------------------------------------
  2754. def create_completion_window
  2755. @completion_window = Window_Completion.new
  2756. @completion_window.y = Graphics.height - @completion_window.height
  2757. @completion_window.viewport = @viewport
  2758. end
  2759. #--------------------------------------------------------------------------
  2760. # * Enemy List [OK]
  2761. #--------------------------------------------------------------------------
  2762. def on_enemylist_ok
  2763. @selected = @enemylist_window.index
  2764. @enemylist_window.hide.deactivate
  2765. @completion_window.hide if FantasyBestiary::Completion_Window
  2766. @enemyhorzlist_window.show.activate
  2767. @enemyhorzlist_window.select(@selected)
  2768. @status_window.show
  2769. @enemypic_window.show
  2770. @help_window.show if FantasyBestiary::Show_Desc_Window
  2771. @playing_bgm = true
  2772. @map_bgm = RPG::BGM.last
  2773. @map_bgs = RPG::BGS.last
  2774. refresh_bgm
  2775. end
  2776. #--------------------------------------------------------------------------
  2777. # * Enemy Horz List [OK]
  2778. #--------------------------------------------------------------------------
  2779. def on_enemyhorzlist_ok
  2780. @status_window.refresh2
  2781. @enemyhorzlist_window.activate
  2782. end
  2783. #--------------------------------------------------------------------------
  2784. # * Enemy Horz List [Cancel]
  2785. #--------------------------------------------------------------------------
  2786. def on_enemyhorzlist_cancel
  2787. @selected = @enemyhorzlist_window.index
  2788. @enemyhorzlist_window.unselect
  2789. @enemyhorzlist_window.hide.deactivate
  2790. @status_window.hide
  2791. @status_window.resetpage_num
  2792. @old_index = -2
  2793. @old_index = -3 if @name == nil && FantasyBestiary::Replay_Map_BGM
  2794. @playing_bgm = false
  2795. @enemypic_window.clear_sprite
  2796. @enemypic_window.hide
  2797. @help_window.hide if FantasyBestiary::Show_Desc_Window
  2798. @completion_window.show if FantasyBestiary::Completion_Window
  2799. @enemylist_window.show.activate
  2800. @enemylist_window.select(@selected)
  2801. @map_bgm.replay
  2802. @map_bgs.replay
  2803. end
  2804. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement