LiTTleDRAgo

[RGSS] Blizz-ABS Enemy HP Meter

Oct 21st, 2011
664
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # Blizz ABS ENEMY HP METER                                                  
  3. # Version: 1.02
  4. # Author : LiTTleDRAgo
  5. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  6. #
  7. # Explanation :
  8. # This part of the HUD only appears when you hit an enemy.                    
  9. # It shows how much HP (or Health Points) an enemy has remaining.        
  10. #==============================================================================
  11. # You can turn this feature on and off using SWITCH 48 (Default).          
  12. #==============================================================================
  13. # To change the appearance of the meter in preparation for a boss fight  
  14. # you must first pull up a SCRIPT command window and complete the following:  
  15. #                                                                        
  16. # Name of Boss:                                                          
  17. # $game_temp.enemy_name = "Name"                                          
  18. #                                                                        
  19. # Amount of HP:                                                          
  20. # $game_temp.enemy_maxhp = X                                              
  21. # $game_temp.enemy_hp = X                                                
  22. #                                                                        
  23. # Position of the HUD:                                                    
  24. # $blizzabs_enemy_boss_wind_x = X                                              
  25. # $blizzabs_enemy_boss_wind_y = X    
  26. #==============================================================================
  27. # Once you've done that simply turn on the Boss Mode Meter                
  28. # using SWITCH 49 (Default).                                              
  29. #==============================================================================
  30. #                                                                        
  31. # Graphics required:                                                      
  32. #                                                                        
  33. # E_HP                                                                    
  34. # E_HP_BOSS                                                              
  35. # E_HP_Number                                                            
  36. # E_Layout                                                                
  37. # E_Layout_BOSS                                                          
  38. #                                                                        
  39. # All images must be in the Windowskin folder.  
  40. #
  41. # Special Thanks:
  42. # Moghunter
  43. #                                                                        
  44. #==============================================================================
  45.  
  46. module LiTTleDRAgo
  47.    
  48. # Switch ID to disable the Enemy HP meter
  49.   INFO_DISABLE_SWITCH_ID = 48  
  50. # Time info is displayed on-screen
  51.   ENEMY_INFO_FADE_TIME = 2 #(second)
  52. # Position of the Enemy HP HUD
  53.   E_HUD_X = 0     + 250
  54.   E_HUD_Y = 0     + 10
  55. # Position of the Enemy HP layout
  56.   E_LAYOUT_X = 0  + 250
  57.   E_LAYOUT_Y = 0  + 10
  58. # Position of the Enemy HP number
  59.   E_NUMBER_X = 30 + 250
  60.   E_NUMBER_Y = 15 + 10
  61. # Position of the Enemy HP meter
  62.   E_METER_X = 28  + 250
  63.   E_METER_Y = 16  + 10
  64. # Position of the Enemy's name
  65.   E_NAME_X = 60   + 250
  66.   E_NAME_Y = -10  + 10
  67.  
  68. #==============================================================================
  69. #.................................[BOSS MODE]..................................
  70. #==============================================================================
  71.  
  72. # Switch ID to enable the Boss Mode.....................................[SWITCH]
  73.   BOSS_INFO_SWITCH_ID = 49    
  74. # Position of the Boss HP layout
  75.   E_LAYOUT_BOSS_X = 0
  76.   E_LAYOUT_BOSS_Y = 0
  77. # Position of the Boss HP number
  78.   E_NUMBER_BOSS_X = 210
  79.   E_NUMBER_BOSS_Y = 22
  80. # Position of the Boss HP meter
  81.   E_METER_BOSS_X  = 2
  82.   E_METER_BOSS_Y  = 18
  83. # Position of the Boss' name
  84.   E_NAME_BOSS_X   = 70
  85.   E_NAME_BOSS_Y   = -10
  86. # Enemy Meter Shake
  87.   E_METER_SHAKE   = true
  88. #--------------------------------------------------------------------------
  89. # CONFIG END
  90. #--------------------------------------------------------------------------
  91. end
  92.  
  93. class Map_Battler < Game_Character
  94.   if BlizzABS::VERSION >= 2.7
  95.   #--------------------------------------------------------------------------
  96.   # Action Effect
  97.   #--------------------------------------------------------------------------
  98.    alias action_enemyhp_earlier action_effect
  99.    def action_effect(action)
  100.       action_enemyhp_earlier(action)
  101.       enemyhp_displayer(action)
  102.    end
  103.   #--------------------------------------------------------------------------
  104.   # Enemy HP Displayer
  105.   #--------------------------------------------------------------------------
  106.     def enemyhp_displayer(value = 0)
  107.       if self.damage_done?
  108.         if !@battler.is_a?(Game_Actor)
  109.           $game_temp.enemy_name  = @battler.name
  110.           $game_temp.enemy_hp    = @battler.hp
  111.           $game_temp.enemy_maxhp = @battler.maxhp
  112.         end
  113.       end
  114.     end
  115.   end
  116. end
  117.  
  118.  
  119. #==============================================================================
  120. # Enemy_HP_Sprite
  121. #==============================================================================
  122. class Enemy_HP_Sprite < Sprite  
  123.   include LiTTleDRAgo
  124. #--------------------------------------------------------------------------
  125. # Initialize
  126. #--------------------------------------------------------------------------
  127.   def initialize
  128.     @viewport = Viewport.new(0, 0, 640, 480)
  129.     @viewport.z = 6000    
  130.     super(@viewport)
  131.     @name = $game_temp.enemy_name
  132.     @hp = $game_temp.enemy_hp
  133.     @maxhp = $game_temp.enemy_maxhp
  134.     @hp_ref = @hp
  135.     @boss_mode = $game_switches[LiTTleDRAgo::BOSS_INFO_SWITCH_ID]
  136.     # Layout -------------------------------------------------------------------
  137.     if @boss_mode == true
  138.       @layout_image = RPG::Cache.windowskin("E_Layout_BOSS")
  139.       @layout_bitmap = Bitmap.new(@layout_image.width,@layout_image.height)
  140.       @layout_sprite = Sprite.new
  141.       @layout_sprite.bitmap = @layout_bitmap
  142.       @layout_src_rect_back = Rect.new(0, 0,@layout_image.width, @layout_image.height)
  143.       @layout_bitmap.blt(0,0, @layout_image, @layout_src_rect_back)      
  144.       @layout_sprite.z = 5007
  145.       @layout_sprite.x = E_LAYOUT_BOSS_X + $blizzabs_enemy_boss_wind_x
  146.       @layout_sprite.y = E_LAYOUT_BOSS_Y + $blizzabs_enemy_boss_wind_y      
  147.       @layout_sprite.opacity = $game_temp.enemy_hud_opa          
  148.     else
  149.       @layout_image = RPG::Cache.windowskin("E_Layout")
  150.       @layout_bitmap = Bitmap.new(@layout_image.width,@layout_image.height)
  151.       @layout_sprite = Sprite.new
  152.       @layout_sprite.bitmap = @layout_bitmap
  153.       @layout_src_rect_back = Rect.new(0, 0,@layout_image.width, @layout_image.height)
  154.       @layout_bitmap.blt(0,0, @layout_image, @layout_src_rect_back)      
  155.       @layout_sprite.z = 5007
  156.       @layout_sprite.x = E_HUD_X + E_LAYOUT_X + $game_temp.enemy_hud_x
  157.       @layout_sprite.y = E_HUD_Y + E_LAYOUT_Y + $game_temp.enemy_hud_y      
  158.       @layout_sprite.opacity = $game_temp.enemy_hud_opa
  159.     end
  160.     # HP ---------------------------------------------------------------------
  161.     @hp_number_image = RPG::Cache.windowskin("E_HP_Number")
  162.     @hp_number_bitmap = Bitmap.new(@hp_number_image.width,@hp_number_image.height)
  163.     @hp_number_sprite = Sprite.new
  164.     @hp_number_sprite.bitmap = @hp_number_bitmap
  165.     @hp_number_sprite.z = 5009
  166.     @hp_number_sprite.x = E_HUD_X + E_NUMBER_X + $game_temp.enemy_hud_x
  167.     @hp_number_sprite.y = E_HUD_Y + E_NUMBER_Y + $game_temp.enemy_hud_y
  168.     @hp_number_sprite.opacity = $game_temp.enemy_hud_opa
  169.     @im_cw = @hp_number_image.width / 10
  170.     @im_ch = @hp_number_image.height
  171.     @hp_src_rect = Rect.new(@im_cw,0, @im_cw, @im_ch)
  172.     @hp_number_text = @hp.abs.to_s.split(//)
  173.     for r in 0..@hp_number_text.size - 1        
  174.          @hp_number_abs = @hp_number_text[r].to_i
  175.          @hp_src_rect = Rect.new(@im_cw * @hp_number_abs, 0, @im_cw, @im_ch)
  176.          @hp_number_bitmap.blt(((@im_cw - 7) *  r), 0, @hp_number_image, @hp_src_rect)        
  177.     end
  178.       @hp_flow = 0
  179.       @hp_damage_flow = 0    
  180.    if @boss_mode == true  
  181.       @hp_image = RPG::Cache.windowskin("E_HP_BOSS")
  182.       @hp_bitmap = Bitmap.new(@hp_image.width,@hp_image.height)
  183.       @hp_range = @hp_image.width / 3
  184.       @hp_width = @hp_range  * @hp / @maxhp
  185.       @hp_height = @hp_image.height / 2
  186.       @hp_width_old = @hp_width
  187.       @hp_src_rect = Rect.new(@hp_range, 0, @hp_width, @hp_height)
  188.       @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect)
  189.       @hp_sprite = Sprite.new
  190.       @hp_sprite.bitmap = @hp_bitmap
  191.       @hp_sprite.z = 5008
  192.       @hp_sprite.x = E_METER_BOSS_X + $blizzabs_enemy_boss_wind_x
  193.       @hp_sprite.x = E_METER_BOSS_Y + $blizzabs_enemy_boss_wind_y
  194.       @hp_sprite.opacity = $game_temp.enemy_hud_opa      
  195.     else  
  196.       @hp_image = RPG::Cache.windowskin("E_HP")
  197.       @hp_bitmap = Bitmap.new(@hp_image.width,@hp_image.height)
  198.       @hp_range = @hp_image.width / 3
  199.       @hp_width = @hp_range  * @hp / @maxhp
  200.       @hp_height = @hp_image.height / 2
  201.       @hp_width_old = @hp_width
  202.       @hp_src_rect = Rect.new(@hp_range, 0, @hp_width, @hp_height)
  203.       @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect)
  204.       @hp_sprite = Sprite.new
  205.       @hp_sprite.bitmap = @hp_bitmap
  206.       @hp_sprite.z = 5008
  207.       @hp_sprite.x = E_HUD_X + E_METER_X + $game_temp.enemy_hud_x
  208.       @hp_sprite.y = E_HUD_Y + E_METER_Y + $game_temp.enemy_hud_y
  209.       @hp_sprite.opacity = $game_temp.enemy_hud_opa
  210.     end    
  211.     hp_flow_update
  212.     #Enemy_Name --------------------------------------
  213.     @ename = Sprite.new
  214.     @ename.bitmap = Bitmap.new(160,100)
  215.     @ename.x = E_HUD_X + E_NAME_X + $game_temp.enemy_hud_x
  216.     @ename.y = E_HUD_Y + E_NAME_Y + $game_temp.enemy_hud_y
  217.     @ename.opacity = $game_temp.enemy_hud_opa
  218.     @ename.z = 5009
  219.     @ename.bitmap.font.size = 14
  220.     @ename.bitmap.font.bold = true
  221.     @ename.bitmap.font.italic = true
  222.     @ename.bitmap.draw_hemming_text(0, 0, 100, 32, @name,0)
  223.     e_hud_pos
  224.     e_hud_visible
  225.   end
  226.  
  227. #--------------------------------------------------------------------------
  228. # Dispose
  229. #--------------------------------------------------------------------------
  230.   def dispose
  231.     #Hp Number Dispose
  232.     [@hp_number_sprite.bitmap, @hp_number_sprite, @hp_number_bitmap].each {|s| s.dispose if s != nil}
  233.     [@hp_number_sprite.bitmap, @hp_number_sprite, @hp_number_bitmap].each {|s| s = nil if s != nil}
  234.     #HP Meter Dispose
  235.     [@hp_sprite.bitmap, @hp_sprite, @hp_bitmap].each {|s| s.dispose if s != nil}
  236.     [@hp_sprite.bitmap, @hp_sprite, @hp_bitmap].each {|s| s = nil if s != nil}
  237.     #Ename Dispose
  238.     [@ename.bitmap, @ename].each {|s| s.dispose if s != nil}
  239.     [@ename.bitmap, @ename].each {|s| s = nil if s != nil}
  240.     #Layout Dispose
  241.     [@layout_sprite.bitmap, @layout_sprite, @layout_bitmap].each {|s| s.dispose if s != nil}
  242.     [@layout_sprite.bitmap, @layout_sprite, @layout_bitmap].each {|s| s = nil if s != nil}    
  243.   end
  244.  
  245. #--------------------------------------------------------------------------
  246. # Update
  247. #--------------------------------------------------------------------------
  248.   def update
  249.      e_hud_visible
  250.      name_refresh      if @name != $game_temp.enemy_name
  251.      hp_number_refresh if @hp != $game_temp.enemy_hp or @maxhp != $game_temp.enemy_maxhp
  252.      hp_flow_update
  253.      e_hud_pos
  254.      e_hud_slide      
  255.      e_boss_mode_check if @boss_mode != $game_switches[LiTTleDRAgo::BOSS_INFO_SWITCH_ID]
  256.   end
  257.    
  258. #--------------------------------------------------------------------------
  259. # E Boss Mode Check
  260. #--------------------------------------------------------------------------
  261.   def e_boss_mode_check
  262.     @boss_mode = $game_switches[LiTTleDRAgo::BOSS_INFO_SWITCH_ID]
  263.     #HP Meter Dispose
  264.     [@hp_sprite.bitmap, @hp_sprite, @hp_bitmap].each {|s| s.dispose if s != nil}
  265.     [@hp_sprite.bitmap, @hp_sprite, @hp_bitmap].each {|s| s = nil if s != nil}
  266.     #Layout Dispose
  267.     [@layout_sprite.bitmap, @layout_sprite, @layout_bitmap].each {|s| s.dispose if s != nil}
  268.     [@layout_sprite.bitmap, @layout_sprite, @layout_bitmap].each {|s| s = nil if s != nil}    
  269.      if @boss_mode
  270.         #Boss
  271.         @layout_image = RPG::Cache.windowskin("E_Layout_BOSS")
  272.         @layout_bitmap = Bitmap.new(@layout_image.width,@layout_image.height)
  273.         @layout_sprite = Sprite.new
  274.         @layout_sprite.bitmap = @layout_bitmap
  275.         @layout_src_rect_back = Rect.new(0, 0,@layout_image.width, @layout_image.height)
  276.         @layout_bitmap.blt(0,0, @layout_image, @layout_src_rect_back)      
  277.         @layout_sprite.z = 5007
  278.         @layout_sprite.x = E_LAYOUT_BOSS_X + $blizzabs_enemy_boss_wind_x
  279.         @layout_sprite.y = E_LAYOUT_BOSS_Y + $blizzabs_enemy_boss_wind_y      
  280.         @layout_sprite.opacity = $game_temp.enemy_hud_opa        
  281.         @hp_image = RPG::Cache.windowskin("E_HP_BOSS")
  282.         @hp_bitmap = Bitmap.new(@hp_image.width,@hp_image.height)
  283.         @hp_range = @hp_image.width / 3
  284.         @hp_width = @hp_range  * @hp / @maxhp
  285.         @hp_height = @hp_image.height / 2
  286.         @hp_width_old = @hp_width
  287.         @hp_src_rect = Rect.new(@hp_range, 0, @hp_width, @hp_height)
  288.         @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect)
  289.         @hp_sprite = Sprite.new
  290.         @hp_sprite.bitmap = @hp_bitmap
  291.         @hp_sprite.z = 5008
  292.         @hp_sprite.x = E_METER_BOSS_X + $blizzabs_enemy_boss_wind_x
  293.         @hp_sprite.x = E_METER_BOSS_Y + $blizzabs_enemy_boss_wind_y
  294.         @hp_sprite.opacity = $game_temp.enemy_hud_opa
  295.         e_hud_pos
  296.      else
  297.         #Normal
  298.         @layout_image = RPG::Cache.windowskin("E_Layout")
  299.         @layout_bitmap = Bitmap.new(@layout_image.width,@layout_image.height)
  300.         @layout_sprite = Sprite.new
  301.         @layout_sprite.bitmap = @layout_bitmap
  302.         @layout_src_rect_back = Rect.new(0, 0,@layout_image.width, @layout_image.height)
  303.         @layout_bitmap.blt(0,0, @layout_image, @layout_src_rect_back)      
  304.         @layout_sprite.z = 5007
  305.         @layout_sprite.x = E_HUD_X + E_LAYOUT_X + $game_temp.enemy_hud_x
  306.         @layout_sprite.y = E_HUD_Y + E_LAYOUT_Y + $game_temp.enemy_hud_y      
  307.         @layout_sprite.opacity = $game_temp.enemy_hud_opa        
  308.         @hp_image = RPG::Cache.windowskin("E_HP")
  309.         @hp_bitmap = Bitmap.new(@hp_image.width,@hp_image.height)
  310.         @hp_range = @hp_image.width / 3
  311.         @hp_width = @hp_range  * @hp / @maxhp
  312.         @hp_height = @hp_image.height / 2
  313.         @hp_width_old = @hp_width
  314.         @hp_src_rect = Rect.new(@hp_range, 0, @hp_width, @hp_height)
  315.         @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect)
  316.         @hp_sprite = Sprite.new
  317.         @hp_sprite.bitmap = @hp_bitmap
  318.         @hp_sprite.z = 5008
  319.         @hp_sprite.x = E_HUD_X + E_METER_X + $game_temp.enemy_hud_x
  320.         @hp_sprite.y = E_HUD_Y + E_METER_Y + $game_temp.enemy_hud_y
  321.         @hp_sprite.opacity = $game_temp.enemy_hud_opa      
  322.         [$game_temp.enemy_hud_opa, $game_temp.enemy_info_ref,
  323.         $game_temp.enemy_hud_x].each {|s| s = 0}
  324.         e_hud_pos
  325.      end
  326.   end
  327.  
  328. #--------------------------------------------------------------------------
  329. # E Hud Visible
  330. #--------------------------------------------------------------------------
  331.   def e_hud_visible
  332.     [@ename, @hp_sprite, @hp_number_sprite, @layout_sprite].each {|s|
  333.       s.visible = false} if $game_switches[LiTTleDRAgo::INFO_DISABLE_SWITCH_ID]
  334.     [@ename, @hp_sprite, @hp_number_sprite, @layout_sprite].each {|s|
  335.       s.visible = true} if !$game_switches[LiTTleDRAgo::INFO_DISABLE_SWITCH_ID]
  336.   end
  337.  
  338. #--------------------------------------------------------------------------
  339. # E Hud Slide
  340. #--------------------------------------------------------------------------
  341.   def e_hud_slide
  342.     $game_temp.enemy_info_ref -= 1  if $game_temp.enemy_info_ref > 0
  343.     $game_temp.enemy_hud_shake -= 1 if $game_temp.enemy_hud_shake > 0
  344.     if $game_temp.enemy_info_ref == 0 &&
  345.        $game_temp.enemy_hud_opa > 0 &&
  346.        !$game_switches[LiTTleDRAgo::BOSS_INFO_SWITCH_ID]
  347.        $game_temp.enemy_hud_x += 1
  348.        $game_temp.enemy_hud_opa -= 10
  349.      elsif $game_temp.enemy_info_ref > 0 ||
  350.        $game_switches[LiTTleDRAgo::BOSS_INFO_SWITCH_ID]
  351.        $game_temp.enemy_hud_opa += 10 if $game_temp.enemy_hud_opa < 255
  352.        $game_temp.enemy_hud_x += 1    if $game_temp.enemy_hud_x < 0
  353.     end
  354.   end
  355.  
  356. #--------------------------------------------------------------------------
  357. # E Hud Pos
  358. #--------------------------------------------------------------------------
  359.   def e_hud_pos
  360.     if $game_switches[LiTTleDRAgo::BOSS_INFO_SWITCH_ID]      
  361.       if $game_temp.enemy_hud_shake > 0 && LiTTleDRAgo::E_METER_SHAKE
  362.         @layout_sprite.x = E_LAYOUT_BOSS_X + $blizzabs_enemy_boss_wind_x
  363.         @layout_sprite.y = E_LAYOUT_BOSS_Y + $blizzabs_enemy_boss_wind_y + rand(4)
  364.         @hp_sprite.x = E_METER_BOSS_X + $blizzabs_enemy_boss_wind_x
  365.         @hp_sprite.y = E_METER_BOSS_Y + $blizzabs_enemy_boss_wind_y + rand(4)
  366.       else
  367.         @layout_sprite.x = E_LAYOUT_BOSS_X + $blizzabs_enemy_boss_wind_x
  368.         @layout_sprite.y = E_LAYOUT_BOSS_Y + $blizzabs_enemy_boss_wind_y
  369.         @hp_sprite.x = E_METER_BOSS_X + $blizzabs_enemy_boss_wind_x
  370.         @hp_sprite.y = E_METER_BOSS_Y + $blizzabs_enemy_boss_wind_y
  371.       end
  372.       @hp_number_sprite.x = E_NUMBER_BOSS_X + $blizzabs_enemy_boss_wind_x
  373.       @hp_number_sprite.y = E_NUMBER_BOSS_Y + $blizzabs_enemy_boss_wind_y
  374.       @ename.x = E_NAME_BOSS_X + $blizzabs_enemy_boss_wind_x
  375.       @ename.y = E_NAME_BOSS_Y + $blizzabs_enemy_boss_wind_y
  376.     else
  377.       @layout_sprite.x = E_HUD_X + E_LAYOUT_X + $game_temp.enemy_hud_x
  378.       @layout_sprite.y = E_HUD_Y + E_LAYOUT_Y + $game_temp.enemy_hud_y
  379.       @hp_number_sprite.x = E_HUD_X + E_NUMBER_X + $game_temp.enemy_hud_x
  380.       @hp_number_sprite.y = E_HUD_Y + E_NUMBER_Y + $game_temp.enemy_hud_y
  381.       @hp_sprite.x = E_HUD_X + E_METER_X + $game_temp.enemy_hud_x
  382.       @hp_sprite.y = E_HUD_Y + E_METER_Y + $game_temp.enemy_hud_y
  383.       @ename.x = E_HUD_X + E_NAME_X + $game_temp.enemy_hud_x
  384.       @ename.y = E_HUD_Y + E_NAME_Y + $game_temp.enemy_hud_y
  385.     end
  386.     [@hp_number_sprite, @layout_sprite, @hp_sprite,
  387.     @ename].each {|s| s.opacity = $game_temp.enemy_hud_opa}
  388.   end  
  389.  
  390. #--------------------------------------------------------------------------
  391. # Name Refresh
  392. #--------------------------------------------------------------------------
  393.   def name_refresh
  394.     @ename.bitmap.clear
  395.     @name = $game_temp.enemy_name
  396.     @ename.bitmap.draw_hemming_text(0, 0, 100, 32, @name)
  397.   end
  398.  
  399. #--------------------------------------------------------------------------
  400. # HP Number Refresh
  401. #--------------------------------------------------------------------------
  402.   def hp_number_refresh
  403.      
  404.       $game_temp.enemy_hud_x = -20    if $game_temp.enemy_hud_opa < 100
  405.       $game_temp.enemy_hud_x = 0      if $game_temp.enemy_hud_opa >= 100
  406.       $game_temp.enemy_info_ref = 40 * ENEMY_INFO_FADE_TIME
  407.       @hp_number_sprite.bitmap.clear
  408.       $game_temp.enemy_hud_shake = 30 if @hp > $game_temp.enemy_hp
  409.       @hp = $game_temp.enemy_hp
  410.       @maxhp = $game_temp.enemy_maxhp      
  411.       @hp_number_text = @hp.abs.to_s.split(//)
  412.       for r in 0..@hp_number_text.size - 1        
  413.          @hp_number_abs = @hp_number_text[r].to_i
  414.          @hp_src_rect = Rect.new(@im_cw * @hp_number_abs, 0, @im_cw, @im_ch)
  415.          @hp_number_bitmap.blt(((@im_cw - 7) *  r) , 0, @hp_number_image, @hp_src_rect)        
  416.        end  
  417.      end  
  418.  
  419. #--------------------------------------------------------------------------
  420. # HP Old
  421. #--------------------------------------------------------------------------
  422.   def hp_old
  423.     @hp_width_old = @hp_range  * $game_temp.enemy_oldhp / $game_temp.enemy_maxhp
  424.     $game_temp.enemy_refresh_old = false
  425.   end
  426.  
  427. #--------------------------------------------------------------------------
  428. # HP Flow Update
  429. #--------------------------------------------------------------------------
  430.   def hp_flow_update
  431.       @hp_sprite.bitmap.clear
  432.       @hp_width = @hp_range  * $game_temp.enemy_hp / $game_temp.enemy_maxhp
  433.       hp_old if $game_temp.enemy_refresh_old
  434.       #HP Damage---------------------------------
  435.         if @hp_width_old != @hp_width
  436.           valor = (@hp_width_old - @hp_width) * 3 / 100
  437.           valor = 0.5               if valor < 1
  438.           @hp_width_old -= valor    if @hp_width_old > @hp_width  
  439.           @hp_width_old = @hp_width if @hp_width_old < @hp_width    
  440.           @hp_src_rect_old = Rect.new(@hp_flow, @hp_height,@hp_width_old, @hp_height)
  441.           @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect_old)      
  442.         end        
  443.       #HP Real------------------------------------
  444.       @hp_src_rect = Rect.new(@hp_flow, 0,@hp_width, @hp_height)
  445.       @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect)          
  446.       @hp_flow += 5  
  447.       @hp_flow = 0  if @hp_flow >= @hp_image.width - @hp_range
  448.   end  
  449. end  
  450. #==============================================================================
  451. # Scene_Map
  452. #==============================================================================
  453. class Scene_Map
  454.  
  455. #--------------------------------------------------------------------------
  456. # Main
  457. #--------------------------------------------------------------------------
  458.   alias drago_enhp_main main
  459.   def main
  460.     @enhp = Enemy_HP_Sprite.new
  461.     drago_enhp_main  
  462.     [@enhp].each {|s| s.dispose if s != nil}
  463.     [@enhp].each {|s| s = nil if s != nil}
  464.   end  
  465. #--------------------------------------------------------------------------
  466. # Update
  467. #--------------------------------------------------------------------------
  468.   alias drago_enhp_update update
  469.   def update
  470.     drago_enhp_update
  471.     [@enhp].each {|s| s.update if s != nil}
  472.   end  
  473. end
  474. #==============================================================================
  475. # Bitmap
  476. #==============================================================================
  477. class Bitmap
  478.   def draw_hemming_text(x, y, w, h, t, a = 0)
  479.     original_color = self.font.color.dup;  self.font.color = Color.new(0,0,0,255)
  480.     self.draw_text(x , y , w, h, t, a);    self.draw_text(x , y+2, w, h, t, a)    
  481.     self.draw_text(x+2, y+2, w, h, t, a);  self.draw_text(x+2, y , w, h, t, a)  
  482.     self.font.color = original_color;      self.draw_text(x+1, y+1, w, h, t, a)
  483.   end
  484. end
  485. #==============================================================================
  486. # Game_Temp
  487. #==============================================================================
  488. class Game_Temp
  489.   attr_accessor :enemy_hp
  490.   attr_accessor :enemy_maxhp
  491.   attr_accessor :enemy_oldhp
  492.   attr_accessor :enemy_name
  493.   attr_accessor :enemy_hud_x
  494.   attr_accessor :enemy_hud_y
  495.   attr_accessor :enemy_hud_opa
  496.   attr_accessor :enemy_hud_shake
  497.   attr_accessor :enemy_info_ref
  498.   attr_accessor :enemy_refresh_old
  499.   attr_accessor :enemy_number_refresh
  500. #--------------------------------------------------------------------------
  501. # Initialize
  502. #--------------------------------------------------------------------------
  503.   alias enemy_hud_initialize initialize
  504.   def initialize
  505.     enemy_hud_initialize  
  506.      @enemy_hp, @enemy_oldhp, @enemy_hud_x, @enemy_hud_y, @enemy_hud_opa,
  507.      @enemy_hud_shake, @enemy_info_ref = 0,0,0,0,0,0,0
  508.      @enemy_refresh_old = @enemy_number_refresh = false
  509.      @enemy_maxhp = 1
  510.      @enemy_name = ""
  511.      $blizzabs_enemy_boss_wind_x = 190
  512.      $blizzabs_enemy_boss_wind_y = 30    
  513.   end
  514. end
  515.  
  516. $drago_blizzabs_enemy_hp = true
  517. $BlizzABS = BlizzABS::Processor.new
  518.  
RAW Paste Data