cooldoode325

Yami's EnemyCharSet

Jan 9th, 2014
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.33 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ¥ Yami Engine Symphony - Add-on: Enemy Character Set
  4. # -- Last Updated: 2012.10.20
  5. # -- Level: Nothing
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["BattleSymphony-EnemyCharset"] = true
  12.  
  13. #==============================================================================
  14. # ¥ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.10.20 - Finished Script.
  17. # 2012.07.01 - Started Script.
  18. #
  19. #==============================================================================
  20. # ¥ Compatibility
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  23. # it will run with RPG Maker VX without adjusting.
  24. # Remember to put this script under Battle Symphony.
  25. #
  26. #==============================================================================
  27.  
  28. #==============================================================================
  29. # ¡ Regular Expression
  30. #==============================================================================
  31.  
  32. module REGEXP
  33. module SYMPHONY
  34.  
  35. CHARSET = /<(?:BATTLER_SET|battler set):[ ]*(.*)>/i
  36. WEAPON1 = /<(?:WEAPON_1|weapon 1):[ ]*(\d+)>/i
  37. WEAPON2 = /<(?:WEAPON_2|weapon 2):[ ]*(\d+)>/i
  38. SHIELD = /<(?:SHIELD):[ ]*(\d+)>/i
  39.  
  40. end
  41. end
  42.  
  43. #==============================================================================
  44. # ¡ DataManager
  45. #==============================================================================
  46.  
  47. module DataManager
  48.  
  49. #--------------------------------------------------------------------------
  50. # alias method: load_database
  51. #--------------------------------------------------------------------------
  52. class <<self; alias load_database_bes_ec load_database; end
  53. def self.load_database
  54. load_database_bes_ec
  55. load_notetags_bes_ec
  56. end
  57.  
  58. #--------------------------------------------------------------------------
  59. # new method: load_notetags_bes_ec
  60. #--------------------------------------------------------------------------
  61. def self.load_notetags_bes_ec
  62. groups = [$data_enemies]
  63. groups.each { |group|
  64. group.each { |obj|
  65. next if obj.nil?
  66. obj.battle_symphony_enemy_charset
  67. }
  68. }
  69. end
  70.  
  71. end # DataManager
  72.  
  73. #==============================================================================
  74. # ¡ RPG::BaseItem
  75. #==============================================================================
  76.  
  77. class RPG::BaseItem
  78.  
  79. #--------------------------------------------------------------------------
  80. # * Public Instance Variables
  81. #--------------------------------------------------------------------------
  82. attr_accessor :character_name
  83. attr_accessor :character_index
  84. attr_accessor :eweapon_1
  85. attr_accessor :eweapon_2
  86. attr_accessor :eshield
  87.  
  88. #--------------------------------------------------------------------------
  89. # new method: battle_symphony_enemy_charset
  90. #--------------------------------------------------------------------------
  91. def battle_symphony_enemy_charset
  92. self.note.split(/[\r\n]+/).each { |line|
  93. case line
  94. when REGEXP::SYMPHONY::CHARSET
  95. str_scan = $1.scan(/[^,]+/i)
  96. @character_name = str_scan[0]
  97. @character_index = str_scan[1].to_i
  98. when REGEXP::SYMPHONY::WEAPON1
  99. @eweapon_1 = $1.to_i
  100. when REGEXP::SYMPHONY::WEAPON2
  101. @eweapon_2 = $1.to_i
  102. when REGEXP::SYMPHONY::SHIELD
  103. @eshield = $1.to_i
  104. end
  105. }
  106. end
  107.  
  108. end # RPG::BaseItem
  109.  
  110. #==============================================================================
  111. # ¡ Game_Enemy
  112. #==============================================================================
  113.  
  114. class Game_Enemy < Game_Battler
  115.  
  116. #--------------------------------------------------------------------------
  117. # * Public Instance Variables
  118. #--------------------------------------------------------------------------
  119. attr_reader :character_name
  120. attr_reader :character_index
  121.  
  122. #--------------------------------------------------------------------------
  123. # alias method: initialize
  124. #--------------------------------------------------------------------------
  125. alias bes_ec_initialize initialize
  126. def initialize(index, enemy_id)
  127. bes_ec_initialize(index, enemy_id)
  128. @character_name = enemy.character_name
  129. @character_index = enemy.character_index
  130. end
  131.  
  132. #--------------------------------------------------------------------------
  133. # alias method: use_charset?
  134. #--------------------------------------------------------------------------
  135. alias bes_ec_use_charset? use_charset?
  136. def use_charset?
  137. flag = @character_name.nil? && @character_index.nil?
  138. return true if !flag
  139. return bes_ec_use_charset?
  140. end
  141.  
  142. #--------------------------------------------------------------------------
  143. # new method: use_8d?
  144. #--------------------------------------------------------------------------
  145. def use_8d?
  146. return @character_name =~ /(_8D)/i if use_charset?
  147. end
  148.  
  149. #--------------------------------------------------------------------------
  150. # new method: dual_wield?
  151. #--------------------------------------------------------------------------
  152. def dual_wield?
  153. self.enemy.eweapon_1 && self.enemy.eweapon_2
  154. end
  155.  
  156. #--------------------------------------------------------------------------
  157. # new method: weapons
  158. #--------------------------------------------------------------------------
  159. def weapons
  160. result = []
  161. result.push($data_weapons[self.enemy.eweapon_1]) if self.enemy.eweapon_1
  162. result.push($data_weapons[self.enemy.eweapon_2]) if self.enemy.eweapon_2
  163. result
  164. end
  165.  
  166. #--------------------------------------------------------------------------
  167. # new method: equips
  168. #--------------------------------------------------------------------------
  169. def equips
  170. result = []
  171. result.push($data_armors[self.enemy.eshield]) if self.enemy.eshield
  172. end
  173.  
  174. end # Game_Enemy
  175.  
  176. #===============================================================================
  177. #
  178. # END OF FILE
  179. #
  180. #===============================================================================
Add Comment
Please, Sign In to add comment