Advertisement
TheSixth

Bestiary Patch Updated

Jul 15th, 2016
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.04 KB | None | 0 0
  1. module BestiaryPatch
  2.  
  3.   # Background settings for the battle scan window.
  4.   # It is automatically centered on the enemy stat window, but you can
  5.   # offset this position in the settings.
  6.   # The image used must be in the "Graphics/Pictures/" folder!
  7.   Back = {
  8.     :img => "Title",   # Image name.
  9.     :offset => [0,0],  # Offset values. Format: [x,y] .
  10.     :opa => 100,       # Opacity.
  11.   }
  12.  
  13. end
  14.  
  15. class Window_BestiaryStatSelection < Window_Selectable
  16.  
  17.   def initialize(x, y, width, height)
  18.     yy = SceneManager.scene_is?(Scene_Bestiary) ? 66 : y
  19.     super(x, yy, width, height)
  20.     set_windowskin
  21.     select(0)
  22.     hide
  23.     refresh
  24.   end
  25.  
  26. end
  27.  
  28. class Window_BestiaryStats < Window_Base
  29.  
  30.   def initialize(x, y, width, height)
  31.     @win_height = height
  32.     yy = SceneManager.scene_is?(Scene_Bestiary) ? 90 : y
  33.     super(x, yy, width, height)
  34.     self.opacity = 0
  35.     @enemy = nil
  36.     init_back_img if SceneManager.scene_is?(Scene_Battle)
  37.     hide
  38.   end
  39.  
  40.   def init_back_img
  41.     @back = Sprite.new
  42.     @back.bitmap = Cache.picture(BestiaryPatch::Back[:img])
  43.     @back.x = self.x + self.width / 2 + BestiaryPatch::Back[:offset][0]
  44.     @back.y = self.y + self.height / 2 + BestiaryPatch::Back[:offset][1]
  45.     @back.ox = @back.bitmap.width/2
  46.     @back.oy = @back.bitmap.height/2
  47.     @back.viewport = self.viewport
  48.     @back.z = self.z - 1
  49.     @back.opacity = BestiaryPatch::Back[:opa]
  50.   end
  51.  
  52.   def hide
  53.     super
  54.     @back.visible = false if @back
  55.   end
  56.  
  57.   def show
  58.     super
  59.     @back.visible = true if @back
  60.   end
  61.  
  62.   def draw_basic_stats
  63.     elements = Venka::Bestiary::Elements.size
  64.     states = Venka::Bestiary::States.size
  65.     height = (elements / 2 + elements % 2) + (states / 2 + states % 2) + 10
  66.     height += 6 if Venka::Bestiary::Show_Debuff_Info
  67.     determine_window_height(height)
  68.     yy = SceneManager.scene_is?(Scene_Bestiary) ? 12 : 5
  69.     draw_line(yy)
  70.     @y = 12
  71.     draw_main_stats
  72.     draw_line(@y + 5)
  73.     @y += 12
  74.     get_revealed_resists
  75.     draw_elements
  76.     draw_line(@y + 5)
  77.     @y += 12
  78.     draw_states
  79.     return unless Venka::Bestiary::Show_Debuff_Info
  80.     draw_line(@y + 5)
  81.     @y += 12
  82.     draw_debuffs
  83.   end
  84.  
  85.   def draw_other_info
  86.     drops = @enemy.drop_items.select {|d| d.kind > 0 }
  87.     ids = []
  88.     @enemy.actions.each do |action|
  89.       ids << action.skill_id unless ids.include?(action.skill_id)
  90.     end
  91.     height = 5 + drops.size + ids.size
  92.     determine_window_height(height)
  93.     yy = SceneManager.scene_is?(Scene_Bestiary) ? 12 : 5
  94.     draw_line(yy)
  95.     @y = 12
  96.     set_bestiary_font(:header_font)
  97.     draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Loot_Text, 1)
  98.     @y += font_height
  99.     draw_exp_and_gold
  100.     draw_drops
  101.     draw_skills
  102.   end
  103.  
  104.   def dispose
  105.     super
  106.     if @back
  107.       @back.bitmap.dispose
  108.       @back.dispose
  109.     end
  110.   end
  111.  
  112. end
  113.  
  114. class Scene_Bestiary < Scene_MenuBase
  115.  
  116.   def terminate
  117.     super
  118.     if @map_bgm
  119.       fadeout_all(60)
  120.       @map_bgm.replay
  121.     end
  122.     dispose_enemy_image
  123.   end
  124.  
  125. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement