1.
2. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
3. # Advanced Analyze System by Blizzard
4. # Version: 2.2b
5. # Type: Enemy Scan Window and Skill
6. # Date: 5.7.2006
7. # Date v1.1b: 31.8.2006
8. # Date v1.2b: 23.2.2007
9. # Date v1.3b: 7.7.2007
10. # Date v2.0b: 12.7.2007
11. # Date v2.1b: 6.8.2007
12. # Date v2.2b: 24.9.2007
13. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
14. #
15. # Compatibility:
16. #
17. # 96% compatible with SDK v1.x. 70% compatible with SDK v2.x. May cause
18. # incompatibility issues with exotic CBS-es. WILL corrupt your old savegames.
19. #
20. #
21. # Features:
22. #
23. # - make one or more skills to be able to analyze enemies
24. # - display of full data of enemies
25. # - option to disable different information
26. # - integrated support for my "Bestiary" script and option to override it and
27. # only add analyzed enemies
28. # - press SHIFT/ENTER to change the appearance of the analyze window
29. # - use LEFT/RIGHT/UP/DOWN to navigate through the information database
30. #
31. # new in v1.1b:
32. # - shorter, better and more simple code
33. # - fixed the bug where trying to use a skill in the menu caused loss of SP,
34. # no matter if the skill was used or could not be used
35. # - updates now the spriteset while the Analyze window is visible
36. #
37. # new in v1.2b:
38. # - improved coding (uses less RAM now and processes faster)
39. #
40. # new in v1.3b:
41. # - increased compatibility
42. #
43. # new in v2.0b:
44. # - completely overworked and fixed compatibility issues
45. #
46. # new in v2.1b:
47. # - added custom info possibility
48. #
49. # new in v2.2b:
50. # - rewritten conditions using classic syntax to avoid RGSS conditioning bug
51. # - improved coding
52. #
53. #
54. # Instructions:
55. #
56. # - Explanation:
57. #
58. # This script will allow your characters to retrieve information about
59. # enemies during battle and show them in a window. It also has built-in
60. # compatibility for my "Bestiary" script and allows adding enemies to it only
61. # if enemies were analyzed at least once. This script can easily be used for
62. # Pokémon typed games.
63. #
64. # - Configuration:
65. #
66. # Configure the part below and make one or more skills, that can analyze
67. # enemies. Add the IDs into the array called ANALYZE_IDS and separate them
68. # with commas. If you have one or more scripts using dummy elements (e.g. my
69. # EQUAP Skills, SephirothSpawn's Limit Break, etc.) be sure to include every
70. # dummy element ID in the array called ELM_DUMMIES, also separated by commas.
71. # With advanced configuration it is possible to disable different information
72. # display, even during the game. Also it can be set up, that an enemy is
73. # being rendered unanalyzeable or only partially unanalyzeable (e.g. disable
74. # display of extreme element weaknesses for an enemy, etc.). Put this script
75. # UNDER my "Bestiary" script if you use it.
76. #
77. # - For scripters:
78. #
79. # The variable $game_system.analyzed includes an array of enemy IDs from
80. # enemies, that were analyzed at least once during a fight. You can use this
81. # array to make your own bestiary script working together with this script
82. # and let only analyzed enemies be added into the bestiary. You can refer to
83. # the global variable $advanced_analyze to check if this script is there.
84. #
85. #
86. # Important notes:
87. #
88. # You MUST configure the part below if you have scripts that use dummy
89. # elements! Do NOT give your enemies MORE than 12 elements/status effects of
90. # one resistance type (e.g. 13 or more elements, that are absorbed), because
91. # they won't be displayed. If you target anyone else than enemies, the skill
92. # will analyze all enemies anyway.
93. #
94. #
95. # If you find any bugs, please report them here:
96. #
http://forum.chaos-project.com
97. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
98.
99. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
100. # START Configuration
101. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
102.
103. # basic configuration
104.
105. ANALYZE_IDS = [81] # IDs of analyzing skills
106. ELM_DUMMIES = [] # include EVERY dummy element ID that is used by other scripts
107. STA_DUMMIES = [] # include EVERY dummy status effect ID, that you use
108. EVASION = 'EVA' # word displayed for Evasion
109.
110. # set the value below to true to only ADD information of analyzed enemies into
111. # the bestiary if you use my Bestiary script
112.
113. $override_bestiary = true
114.
115. # set this value to true if you want the custom Analyze window information to
116. # be used in the bestiary as well, this way you use only one information for
117. # both systems
118.
119. $override_bestiary_info = false
120.
121. # enemy IDs from enemies, that can't be analyzed (e.g. bosses)
122.
123. CANT_ANALYZE = [] # overrides the IDs below and renders an enemy unanalyzeable
124.
125. CANT_ANALYZE_BASIC = [] # HP, SP, EXP, Gold, Item drop + chance
126. CANT_ANALYZE_STATS = [] # STR, DEX, INT, AGI
127. CANT_ANALYZE_EXTSTATS = [] # ATK, PDEF, MDEF
128. CANT_ANALYZE_XTRWEAK = [] # extreme element weakness
129. CANT_ANALYZE_WEAK = [] # element weakness
130. CANT_ANALYZE_RESIST = [] # element resistance
131. CANT_ANALYZE_NULLIFY = [] # element nullification
132. CANT_ANALYZE_ABSORB = [] # element absorbtion
133. CANT_ANALYZE_XTRWEAK_S = [] # extreme status effect weakness
134. CANT_ANALYZE_WEAK_S = [] # status effect weakness
135. CANT_ANALYZE_RESIST_S = [] # status effect resistance
136. CANT_ANALYZE_NULLIFY_S = [] # status effect nullification
137. CANT_ANALYZE_ABSORB_S = [] # status effect absorbtion
138. CANT_ANALYZE_CUSTOM = [] # custom info
139.
140. # If a display below is disabled, the appropriate part above will be overriden.
141. # The values below can also be changed during gameplay by just calling the
142. # "Call script" event command and changing the values like below
143. # DO NOT SET EVERYTHING TO true! THIS WILL BUG YOUR ANALYZE SKILL!
144.
145. # set to true to disable display of basic info
146. DISABLE_BASIC = false
147. # set to true to disable display of basic stats
148. DISABLE_STATS = true
149. # set to true to disable display of extended stats
150. DISABLE_EXTSTATS = true
151. # set to true to disable display of extreme elemental weakness
152. DISABLE_XTRWEAK = false
153. # set to true to disable display of elemental weakness
154. DISABLE_WEAK = false
155. # set to true to disable display of elemental resistance
156. DISABLE_RESIST = false
157. # set to true to disable display of elemental nullification
158. DISABLE_NULLIFY = false
159. # set to true to disable display of elemental absorbtion
160. DISABLE_ABSORB = true
161. # set to true to disable display of extremeal status effect weakness
162. DISABLE_XTRWEAK_S = false
163. # set to true to disable display of status effect weakness
164. DISABLE_WEAK_S = false
165. # set to true to disable display of status effect resistance
166. DISABLE_RESIST_S = false
167. # set to true to disable display of status effect nullification
168. DISABLE_NULLIFY_S = false
169. # set to true to disable display of status effect absorbtion
170. DISABLE_ABSORB_S = false
171. # set to false to enable custom display
172. DISABLE_CUSTOM_ANALYZE = false
173.
174. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
175. # END Configuration
176. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
177.
178. if $DUMMY_ELEMENTS == nil
179. $DUMMY_ELEMENTS = ELM_DUMMIES.clone
180. else
181. $DUMMY_ELEMENTS |= ELM_DUMMIES
182. end
183. ELM_DUMMIES = nil
184. if $DUMMY_STATES == nil
185. $DUMMY_STATES = STA_DUMMIES.clone
186. else
187. $DUMMY_STATES |= STA_DUMMIES
188. end
189. STA_DUMMIES = nil
190.
191. $advanced_analyze = true
192.
193. #==============================================================================
194. # Game_System
195. #==============================================================================
196.
197. class Game_System
198.
199. attr_accessor :analyze_mode
200. attr_accessor :analyzed
201.
202. def get_analyze_info(id)
203. case id
204. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
205. # START Custom Analyze Info Database
206. #
207. # Use following template to add custom information about monsters:
208. #
209. # when ID then return "STRING"
210. #
211. # ID is the enemy ID and STRING is a string with the information that should be
212. # displayed. Type all the information into one string, the script will slice
213. # the text by itself. Note that special characters like a " (double quote)
214. # need the use of the escape character \ (backslash). If you get and error
215. # with your string or the character doesn't appear right on the screen, try to
216. # use the escape character (i.e. for a " it would be \" instead of just ").
217. # The backslash itself needs an escape character (i.e. \\).
218. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
219. when 1 then return "Looks like heavy armor. It will be hard to penetrate through his defenses."
220. when 2 then return "He is agile and balanced. His strikes are quick, but he has no range."
221. when 3 then return "This demon ridder appears to know the art of the elements. She will most likely use spells that control or distort the elements to her liking."
222. when 4 then return "A clerical demon ridder, this would be the one to heal allies and cast passive supporting spells."
223. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
224. # END Custom Analyze Info Database
225. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
226. end
227. return 'Unknown'
228. end
229.
230. alias init_aas_later initialize
231. def initialize
232. init_aas_later
233. @analyze_mode = 0
234. # bestiary support
235. @analyzed = []
236. end
237.
238. end
239.
240. #==============================================================================
241. # Game_Battler
242. #==============================================================================
243.
244. class Game_Battler
245.
246. alias skill_effect_aas_later skill_effect
247. def skill_effect(user, skill)
248. last_sr = self.sr if $crls && self.is_a?(Game_Actor)
249. last_hp = self.hp
250. result = skill_effect_aas_later(user, skill)
251. if ANALYZE_IDS.include?(skill.id)
252. self.damage = nil
253. self.sr = last_sr if $crls && self.is_a?(Game_Actor)
254. self.hp = last_hp
255. end
256. return result
257. end
258.
259. end
260.
261. #==============================================================================
262. # Window_Base
263. #==============================================================================
264.
265. class Window_Base
266.
267. def slice_text(text, width)
268. result, last_word, current_text = [], 0, ''
269. (0..text.size).each {|i|
270. if text[i, 1] == ' ' || i == text.size
271. word = text[last_word, i-last_word]
272. if self.contents.text_size("#{current_text} #{word}").width > width
273. result.push(current_text)
274. current_text = word
275. else
276. current_text += (current_text == '' ? word : " #{word}")
277. end
278. last_word = i+1
279. end}
280. result.push("#{current_text} #{text[last_word, text.size-last_word]}")
281. return result
282. end
283.
284. end
285.
286. #==============================================================================
287. # Window_Analyze
288. #==============================================================================
289.
290. class Window_Analyze < Window_Base
291.
292. attr_accessor :mode
293.
294. def initialize
295. super(0, 0, 576, 224)
296. @index_enemy = @index_page = 0
297. @d = [DISABLE_BASIC, DISABLE_STATS, DISABLE_EXTSTATS, DISABLE_XTRWEAK,
298. DISABLE_WEAK, DISABLE_RESIST, DISABLE_NULLIFY, DISABLE_ABSORB,
299. DISABLE_XTRWEAK_S, DISABLE_WEAK_S, DISABLE_RESIST_S,
300. DISABLE_NULLIFY_S, DISABLE_ABSORB_S, DISABLE_CUSTOM_ANALYZE]
301. @pages = 14 - ((0..13).find_all {|i| @d
}).size
302. @mode = $game_system.analyze_mode
303. self.contents = Bitmap.new(width - 32, height - 32)
304. if $fontface != nil
305. self.contents.font.name = $fontface
306. self.contents.font.size = $fontsize
307. elsif $defaultfonttype != nil
308. self.contents.font.name = $defaultfonttype
309. self.contents.font.size = $defaultfontsize
310. end
311. self.x, self.y = 320 - self.width / 2, 160 - self.height / 2
312. self.visible = self.active = false
313. refresh
314. end
315.
316. def update
317. if Input.trigger?(Input::RIGHT)
318. $game_system.se_play($data_system.cursor_se)
319. @index_enemy = (@index_enemy + 1) % @enemies.size
320. refresh
321. elsif Input.trigger?(Input::LEFT)
322. $game_system.se_play($data_system.cursor_se)
323. @index_enemy = (@index_enemy + @enemies.size - 1) % @enemies.size
324. refresh
325. elsif Input.trigger?(Input::DOWN)
326. $game_system.se_play($data_system.cursor_se)
327. @index_page = (@index_page + 1) % @pages
328. refresh
329. elsif Input.trigger?(Input::UP)
330. $game_system.se_play($data_system.cursor_se)
331. @index_page = (@index_page + @pages - 1) % @pages
332. refresh
333. end
334. end
335.
336. def refresh
337. case @mode
338. when 0 then self.opacity = self.back_opacity = 255
339. when 1 then self.back_opacity = 128
340. when 2 then self.opacity = 0
341. end
342. self.contents.clear
343. x = 4
344. ox = x + 128
345. ax = 100
346. bx = ax + 144
347. @enemies = []
348. $game_troop.enemies.each {|enemy| @enemies.push(enemy) if enemy.exist?}
349. @enemies.each {|enemy|
350. unless $game_system.analyzed.include?(enemy.id)
351. $game_system.analyzed.push(enemy.id)
352. $game_system.enable(enemy.id) if $bestiary_enabled
353. end}
354. $game_system.analyzed.sort!
355. enemy = @enemies[@index_enemy]
356. w = self.width - self.contents.text_size(enemy.name).width
357. name = "#{enemy.name} #{make_battler_state_text(enemy, w, false)}"
358. name = "#{@index_enemy+1}. #{name}" if @enemies.size > 1
359. self.contents.draw_text(0, 0, 544, 32, name, 1)
360. unless CANT_ANALYZE.include?(enemy.id)
361. case @index_page
362. when (0 - ((0..0).find_all {|i| @d}).size)
363. if enemy.item_id > 0
364. drop = $data_items[enemy.item_id]
365. t = "#{drop.name} (#{enemy.treasure_prob}% chance)"
366. elsif enemy.weapon_id > 0
367. drop = $data_weapons[enemy.weapon_id]
368. t = "#{drop.name} (#{enemy.treasure_prob}% chance)"
369. elsif enemy.armor_id > 0
370. drop = $data_armors[enemy.armor_id]
371. t = "#{drop.name} (#{enemy.treasure_prob}% chance)"
372. end
373. self.contents.draw_text(ax, 32, 128, 32, $data_system.words.hp, 2)
374. self.contents.draw_text(ax, 64, 128, 32, $data_system.words.sp, 2)
375. self.contents.draw_text(ax, 128, 128, 32, $data_system.words.gold, 2)
376. self.contents.draw_text(ax, 160, 128, 32, 'Drops', 2)
377. unless CANT_ANALYZE_BASIC.include?(enemy.id)
378. self.contents.draw_text(bx, 32, 256, 32, "#{enemy.hp} / #{enemy.maxhp}")
379. self.contents.draw_text(bx, 64, 256, 32, "#{enemy.sp} / #{enemy.maxsp}")
380. self.contents.draw_text(bx, 128, 256, 32, enemy.gold.to_s)
381. self.contents.draw_text(bx, 160, 256, 32, (drop != nil ? t : 'nothing'))
382. else
383. (0...5).each {|i|
384. self.contents.draw_text(bx, 32 + i*32, 544, 32, 'Cannot analyze this')}
385. end
386. when (1 - ((0..1).find_all {|i| @d}).size)
387. self.contents.draw_text(ax, 32, 128, 32, $data_system.words.str, 2)
388. self.contents.draw_text(ax, 64, 128, 32, $data_system.words.dex, 2)
389. self.contents.draw_text(ax, 96, 128, 32, $data_system.words.agi, 2)
390. self.contents.draw_text(ax, 128, 128, 32, $data_system.words.int, 2)
391. unless CANT_ANALYZE_STATS.include?(enemy.id)
392. self.contents.draw_text(bx, 32, 256, 32, enemy.str.to_s)
393. self.contents.draw_text(bx, 64, 256, 32, enemy.dex.to_s)
394. self.contents.draw_text(bx, 96, 256, 32, enemy.agi.to_s)
395. self.contents.draw_text(bx, 128, 256, 32, enemy.int.to_s)
396. else
397. (0...4).each {|i|
398. self.contents.draw_text(bx, 32 + i*32, 544, 32, 'Cannot analyze this')}
399. end
400. when (2 - ((0..2).find_all {|i| @d}).size)
401. self.contents.draw_text(ax, 32, 128, 32, $data_system.words.atk, 2)
402. self.contents.draw_text(ax, 64, 128, 32, $data_system.words.pdef, 2)
403. self.contents.draw_text(ax, 96, 128, 32, $data_system.words.mdef, 2)
404. self.contents.draw_text(ax, 128, 128, 32, EVASION, 2)
405. unless CANT_ANALYZE_EXTSTATS.include?(enemy.id)
406. self.contents.draw_text(bx, 32, 256, 32, enemy.atk.to_s)
407. self.contents.draw_text(bx, 64, 256, 32, enemy.pdef.to_s)
408. self.contents.draw_text(bx, 96, 256, 32, enemy.mdef.to_s)
409. self.contents.draw_text(bx, 128, 256, 32, enemy.eva.to_s)
410. else
411. (0...4).each {|i|
412. self.contents.draw_text(bx, 32 + i*32, 544, 32, 'Cannot analyze this')}
413. end
414. when (3 - ((0..3).find_all {|i| @d}).size)
415. self.contents.draw_text(x, 32, 544, 32, 'Extremely efficient elements:')
416. draw_elements(enemy, x, 1, CANT_ANALYZE_XTRWEAK.include?(enemy.id))
417. when (4 - ((0..4).find_all {|i| @d}).size)
418. self.contents.draw_text(x, 32, 544, 32, 'Efficient elements:')
419. draw_elements(enemy, x, 2, CANT_ANALYZE_WEAK.include?(enemy.id))
420. when (5 - ((0..5).find_all {|i| @d}).size)
421. self.contents.draw_text(x, 32, 544, 32, 'Elemental resistances:')
422. draw_elements(enemy, x, 4, CANT_ANALYZE_RESIST.include?(enemy.id))
423. when (6 - ((0..6).find_all {|i| @d}).size)
424. self.contents.draw_text(x, 32, 544, 32, 'Elemental nullifications:')
425. draw_elements(enemy, x, 5, CANT_ANALYZE_NULLIFY.include?(enemy.id))
426. when (7 - ((0..7).find_all {|i| @d}).size)
427. self.contents.draw_text(x, 32, 544, 32, 'Elemental absorbtions:')
428. draw_elements(enemy, x, 6, CANT_ANALYZE_ABSORB.include?(enemy.id))
429. when (8 - ((0..8).find_all {|i| @d}).size)
430. self.contents.draw_text(x, 32, 544, 32, 'Extremely efficient status effects:')
431. draw_states(enemy, x, 1, CANT_ANALYZE_XTRWEAK_S.include?(enemy.id))
432. when (9 - ((0..9).find_all {|i| @d}).size)
433. self.contents.draw_text(x, 32, 544, 32, 'Efficient status effects:')
434. draw_states(enemy, x, 2, CANT_ANALYZE_WEAK_S.include?(enemy.id))
435. when (10 - ((0..10).find_all {|i| @d}).size)
436. self.contents.draw_text(x, 32, 544, 32, 'Status effect resistances:')
437. draw_states(enemy, x, 4, CANT_ANALYZE_RESIST_S.include?(enemy.id))
438. when (11 - ((0..11).find_all {|i| @d}).size)
439. self.contents.draw_text(x, 32, 544, 32, 'Strong status effect resistances:')
440. draw_states(enemy, x, 5, CANT_ANALYZE_NULLIFY_S.include?(enemy.id))
441. when (12 - ((0..12).find_all {|i| @d}).size)
442. self.contents.draw_text(x, 32, 544, 32, 'Status effect immunities:')
443. draw_states(enemy, x, 6, CANT_ANALYZE_ABSORB_S.include?(enemy.id))
444. when (13 - ((0..13).find_all {|i| @d}).size)
445. self.contents.draw_text(x, 32, 544, 32, 'Information:')
446. draw_info(enemy, x, CANT_ANALYZE_CUSTOM.include?(enemy.id))
447. end
448. else
449. self.contents.draw_text(0, 64, 544, 32, 'Cannot analyze this enemy', 1)
450. end
451. end
452.
453. def draw_elements(enemy, x, index, check)
454. unless check
455. elements = []
456. (1...$data_system.elements.size).each {|id|
457. if !$DUMMY_ELEMENTS.include?(id) &&
458. index == $data_enemies[@enemies[@index_enemy].id].element_ranks[id]
459. elements.push($data_system.elements[id])
460. end}
461. elements = ['Nothing'] if elements.size == 0
462. elements.each_index {|i|
463. self.contents.draw_text(x + i/4*180, 64 + i%4*32, 176, 32, elements)}
464. else
465. self.contents.draw_text(x, 64, 544, 32, 'Cannot analyze this')
466. end
467. end
468.
469. def draw_states(enemy, x, index, check)
470. unless check
471. states = []
472. (1...$data_states.size).each {|id|
473. if !$DUMMY_STATES.include?(id) &&
474. index == $data_enemies[@enemies[@index_enemy].id].state_ranks[id]
475. states.push($data_states[id].name)
476. end}
477. states = ['Nothing'] if states.size == 0
478. states.each_index {|i|
479. self.contents.draw_text(x + i/4*180, 64 + i%4*32, 176, 32, states)}
480. else
481. self.contents.draw_text(x, 64, 544, 32, 'Cannot analyze this')
482. end
483. end
484.
485. def draw_info(enemy, x, check)
486. unless check
487. text = slice_text($game_system.get_analyze_info(enemy.id), 528)
488. text.each_index {|i|
489. self.contents.draw_text(x, 64 + i*32, 544, 32, text)}
490. else
491. self.contents.draw_text(x, 64, 544, 32, 'Cannot analyze this')
492. end
493. end
494.
495. end
496.
497. #==============================================================================
498. # Scene_Battle
499. #==============================================================================
500.
501. class Scene_Battle
502.
503.
504. alias make_skill_action_result_aas_later make_skill_action_result
505. def make_skill_action_result
506. make_skill_action_result_aas_later
507. @analyze_window = Window_Analyze.new if ANALYZE_IDS.include?(@skill.id)
508. end
509.
510. alias update_phase4_step5_aas_later update_phase4_step5
511. def update_phase4_step5
512. update_phase4_step5_aas_later
513. if @analyze_window != nil
514. Graphics.freeze
515. @analyze_window.visible = true
516. Graphics.transition(10)
517. loop do
518. Graphics.update
519. Input.update
520. @analyze_window.update
521. @spriteset.update
522. $game_screen.update
523. if Input.trigger?(Input::A) || Input.trigger?(Input::C)
524. $game_system.se_play($data_system.cursor_se)
525. Graphics.freeze
526. case @analyze_window.mode
527. when 0 then @analyze_window.back_opacity = 128
528. when 1 then @analyze_window.opacity = 0
529. when 2 then @analyze_window.opacity = @analyze_window.back_opacity = 255
530. end
531. $game_system.analyze_mode = ($game_system.analyze_mode+1) % 3
532. @analyze_window.mode = $game_system.analyze_mode
533. Graphics.transition(5)
534. end
535. break if Input.trigger?(Input::B)
536. end
537. Graphics.freeze
538. $game_system.se_play($data_system.cancel_se)
539. @analyze_window.dispose
540. @analyze_window = nil
541. Graphics.transition(10)
542. end
543. end
544.
545. end
546.