Advertisement
dsiver144

DSI Hide Enemy Stats In Battle

Jul 20th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.44 KB | None | 0 0
  1. #==============================================================================
  2. # DSI Hide Enemy Stats In Battle
  3. # -- Last Updated: 2017.07.20
  4. # -- Author: dsiver144
  5. # -- Level: Easy
  6. # -- Requires: n/a
  7. #==============================================================================
  8. $imported = {} if $imported.nil?
  9. $imported["DSI-HideEnemyStats"] = true
  10. #==============================================================================
  11. # + Updates
  12. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  13. # 2017.07.20 - Finish first version.
  14. #==============================================================================
  15. # + Instructions
  16. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  17. # To install this script, open up your script editor and copy/paste this script
  18. # to an open slot below ?? Materials/?f?? but above ?? Main. Remember to save.
  19. # * You should put this script below all script relate to drawing enemy stats.
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # Enemy's Notetags:
  22. # + <hide hp>
  23. # + <hide mp>
  24. # + <hide tp>
  25. # + <hide shield>
  26. # + <hide all>
  27. #==============================================================================
  28. module DSIVER144
  29. module HIDE_ENEMY_STATS
  30. Regexp = {}
  31. Regexp[1] = /<hide[ _]hp>/i
  32. Regexp[2] = /<hide[ _]mp>/i
  33. Regexp[3] = /<hide[ _]tp>/i
  34. Regexp[4] = /<hide[ _]shield>/i
  35. Regexp[5] = /<hide[ _]all>/i
  36. end # HIDE_ENEMY_STATS
  37. end # DSIVER144
  38.  
  39. class Game_System
  40. include DSIVER144::HIDE_ENEMY_STATS
  41. alias_method(:dsi_load_notetag_enemies_hide_stats, :initialize)
  42. #----------------------------------------------------------------------------
  43. # * alias method: update_hpmpinfo
  44. #----------------------------------------------------------------------------
  45. def initialize
  46. dsi_load_notetag_enemies_hide_stats
  47. $data_enemies.each do |enemy|
  48. next if enemy.nil?
  49. enemy.hide_stats ||= {}
  50. enemy.note.split(/[\r\n]+/).each do |line|
  51. [:hp,:mp,:tp,:shp].each_with_index do |key,index|
  52. if (line =~ Regexp[index + 1]) || (line =~ Regexp[5])
  53. enemy.hide_stats[key] = true
  54. end
  55. end
  56. end
  57. end
  58. end
  59. end
  60.  
  61. class RPG::Enemy
  62. attr_accessor :hide_stats
  63. end # RPG::Enemy
  64.  
  65. class Game_Enemy < Game_Battler
  66. #----------------------------------------------------------------------------
  67. # * new method: hide_stats
  68. #----------------------------------------------------------------------------
  69. def hide_stats
  70. $data_enemies[@enemy_id].hide_stats
  71. end
  72. end # Game_Enemy
  73.  
  74. class Sprite_Battler
  75. #----------------------------------------------------------------------------
  76. # * overwrite method: update_hpmpinfo
  77. #----------------------------------------------------------------------------
  78. def update_hpmpinfo
  79. create_ehpmpwindow if @ehpmp_window.nil?
  80. @ehpmp_window.visible = @battler.alive? || @battler.hidden?
  81. return if !@battler.alive? || !@ehpmp_window.visible
  82. @ehpmp_window.update
  83. @ehpmp_window.contents_opacity = self.opacity if @ehpmp_window.contents_opacity != self.opacity
  84. @ehpmp_window.y = self.y + EnemyHPMPIcons::Y_OFFSET - self.height - @ehpmp_window.height
  85. @ehpmp_window.y = 0 if @ehpmp_window.y < 0
  86. @ehpmp_window.contents.clear
  87. width = @ehpmp_window.contents.width - @ehpmp_window.padding
  88. if EnemyHPMPIcons::TEXTCOLOR.is_a?(Array)
  89. @ehpmp_window.contents.font.color.set(Color.new(EnemyHPMPIcons::TEXTCOLOR[0], EnemyHPMPIcons::TEXTCOLOR[1], EnemyHPMPIcons::TEXTCOLOR[2]))
  90. else
  91. @ehpmp_window.change_color(@ehpmp_window.text_color(EnemyHPMPIcons::TEXTCOLOR))
  92. end
  93. stat_y = 0
  94. index = 0
  95. if !@battler.hide_stats[:hp]
  96. offset_y = index == 0 ? 0 : EnemyHPMPIcons::Y_SPACING
  97. @ehpmp_window.draw_icon(EnemyHPMPIcons::HP_ICON, 0, stat_y + offset_y)
  98. @ehpmp_window.draw_text(24 + EnemyHPMPIcons::SPACING, stat_y, width, EnemyHPMPIcons::TEXT_SIZE, @battler.hp.to_s + "/" + @battler.mhp.to_s)
  99. stat_y += EnemyHPMPIcons::TEXT_SIZE
  100. index += 1
  101. end
  102. if !@battler.hide_stats[:mp]
  103. offset_y = index == 0 ? 0 : EnemyHPMPIcons::Y_SPACING
  104. @ehpmp_window.draw_icon(EnemyHPMPIcons::MP_ICON, 0, stat_y + offset_y)
  105. @ehpmp_window.draw_text(24 + EnemyHPMPIcons::SPACING, stat_y + offset_y, width, EnemyHPMPIcons::TEXT_SIZE, @battler.mp.to_s + "/" + @battler.mmp.to_s)
  106. stat_y += EnemyHPMPIcons::TEXT_SIZE
  107. index += 1
  108. end
  109. if !@battler.hide_stats[:tp]
  110. offset_y = index == 0 ? 0 : EnemyHPMPIcons::Y_SPACING
  111. @ehpmp_window.draw_icon(Icons::TP_Icon, 0, stat_y + offset_y)
  112. @ehpmp_window.draw_text(24 + EnemyHPMPIcons::SPACING, stat_y + offset_y, width, EnemyHPMPIcons::TEXT_SIZE, @battler.tp.to_i.to_s + "/" + 5.to_s)
  113. stat_y += EnemyHPMPIcons::TEXT_SIZE
  114. index += 1
  115. end
  116. if !@battler.hide_stats[:shp]
  117. offset_y = index == 0 ? 0 : EnemyHPMPIcons::Y_SPACING
  118. @ehpmp_window.draw_icon(Icons::SHIELD_Icon, 0, stat_y + offset_y)
  119. @ehpmp_window.draw_text(24 + EnemyHPMPIcons::SPACING, stat_y + offset_y, width, EnemyHPMPIcons::TEXT_SIZE, @battler.shp.to_s + "/" + @battler.mshp.to_s)
  120. stat_y += EnemyHPMPIcons::TEXT_SIZE
  121. index += 1
  122. end
  123. end
  124. end # Sprite_Battler
  125. #===============================================================================
  126. # * END OF FILE
  127. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement