Advertisement
AngryPacman

PAC Battle Addons 1.7c

Jun 11th, 2011
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 114.05 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Pacman Advanced Creative (PAC) Engine - Battle Addons 1.7c
  4. # Last updated: 25/02/2012
  5. # Type: Battle
  6. # Installation: Requires: PAC Battle Addons Setup 1.7c or higher.
  7. # Level: Simple, Average, Difficult, Insane
  8. # With: Shanghai, Modern Algebra, MOG, Cozziekuns, LoganForrests, Minto
  9. #
  10. #===============================================================================
  11. #
  12. # Hello there. This script may seem a bit daunting at first, but it's actually
  13. # just a collection of a lot smaller scripts. Before we can begin, I'm
  14. # oblidged to inform you that this script REQUIRES PAC Battle Addons Setup 1.7
  15. # or higher. It must go above this script in the editor.
  16. # Now that that's out of the way, I'll tell you some important stuff about
  17. # the features.
  18. #
  19. #===============================================================================
  20. #
  21. # For the Enemy Stats feature, use the following notes in an enemy's notebox
  22. # to perform the coupled function.
  23. # UNKNOWN_STATUS    -   Nothing will be displayed.
  24. # UNKNOWN_NAME      -   The name will not be displayed.
  25. # UNKNOWN_HP        -   The HP will not be displayed.
  26. # UNKNOWN_MP        -   The MP will not be displayed.
  27. # UNKNOWN_STATE     -   The states will not be displayed.
  28. #
  29. #===============================================================================
  30. #
  31. # For the Death Events feature, use the tag:
  32. # <death event: x>
  33. # in an enemy's notebox to perform the common event ID x upon that enemy's
  34. # death.
  35. #
  36. #===============================================================================
  37. #
  38. # For the linked death feature, use the tag:
  39. # <linked death: x>
  40. # in an enemy's notebox to make the enemy/ies with the ID/IDs x die when the
  41. # enemy with the tag dies. Use:
  42. # <linked death all>
  43. # to make all other enemies die when this enemy dies, regardless of anything.
  44. #
  45. #===============================================================================
  46. #
  47. # For the Counterattack feature, use the tag:
  48. # <counterattack>
  49. # in a state's notebox to give it the counterattack function.
  50. #
  51. #===============================================================================
  52. #
  53. # For the friendly enemies feature, use the tag:
  54. # <friendly>
  55. # in an enemy's notebox to make it a friendly enemies (i.e. attacks other
  56. # enemies and is attacked by other enemies). Use the tags:
  57. # <friendly exp: x>
  58. # <friendly gold: x>
  59. # to, respectively, give the player x more exp and gold if the friendly enemy
  60. # is still alive at the end of the battle. Use:
  61. # <friendly i: x>
  62. # <friendly w: x>
  63. # <friendly a: x>
  64. # to give the player the item (i), weapon(w) or armour(a) with the ID x. You can
  65. # place multiples, like so:
  66. # <friendly w: x, x, x>
  67. #
  68. #===============================================================================
  69. #
  70. # For the overkill feature, use the tag:
  71. # <overkill require: x>
  72. # In an enemy's notebox to set the amount of damage you need to overkill the
  73. # enemy by to activate the overkill function.
  74. # <overkill exp: +x>
  75. # The extra amount of exp recieved when the enemy is overkilled.
  76. # <overkill gold: x>
  77. # The extra amount of gold recieved when the enemy is overkilled.
  78. # <overkill item: x>
  79. # <overkill weapon: x>
  80. # <overkill armor: x>
  81. # The IDs of item, weapon or armor recieved when enemy is overkilled. Use the
  82. # tag more than once if you want more stuff dropped. Do not put multiple values
  83. # in the tag. These drop %100 of the time if overkilled. All of these go in
  84. # the enemy notebox.
  85. #
  86. #===============================================================================
  87. #
  88. # For the auto-states function, put:
  89. # <autostate: x> or
  90. # <autostates: x, x, x>
  91. # in an enemy's notebox to give them the state ID/IDs x.
  92. #
  93. #===============================================================================
  94. #
  95. # For the Vampirism and Siphonism script, put:
  96. # <vampiric: x%>
  97. # in a weapon's notebox to give it vampiric properties (deals and absorbs x%
  98. # of the damage dealt), it also works with enemy noteboxes. Use:
  99. # <siphonic: x%>
  100. # into a weapon's notebox to make it siphonic: it will deal mp damage with
  101. # attacks, and the attacker will gain that damage back themselves. It also
  102. # works for enemies.
  103. #
  104. #===============================================================================
  105. #
  106. # For the Weapon Attack Replace function, use:
  107. # <attack skill: x>
  108. # <attack skill: x, x, x>
  109. # inside a weapon's notebox to make the skill with the ID x replace the default
  110. # attack. If more than one ID is placed, one will be randomly selected each
  111. # time a regular attack is made. Isn't that cool?
  112. #
  113. #===============================================================================
  114. #
  115. # For the Wereforms function, use:
  116. # <wereform: x>
  117. # in a skill or item notebox to transform the actor that it is being used on's
  118. # skillset to that of the enemy with the ID x. They will revert as soon as
  119. # battle is over or the revert function is called.
  120. # <wereimage: string, x>
  121. # If this tag is used in a skill or item notebox, the actor will also change
  122. # image. This is for CBSs. For this to work, you must use the following tag.
  123. # <wereface: string, x>
  124. # If this tag is used in a skill or item notebox, the actor will also change
  125. # face. This is for CBSs. For the to work, you must use the previous tag.
  126. # <wereform revert>
  127. # If this tag is used and the actor is currently in a wereform, the actor will
  128. # revert to their original skillset.
  129. #
  130. #===============================================================================
  131. #
  132. # For the Actor-Dependent Enemy Stats feature,
  133. # Use the following syntax in the enemy's notebox to alter their stats
  134. # accordingly.
  135. # HP=50
  136. # MP=50
  137. # ATK=50
  138. # DEF=50
  139. # SPI=50
  140. # AGI=50
  141. # Actor=1
  142. # In this example, all the enemy's stats would be 50% higher than those of the
  143. # Actor with ID 1. Note that the percentage applies to the actor's base stats,
  144. # not taking equipment into consideration. For any tag you don't enter, the
  145. # default editor value will be used. You may only enter one actor.
  146. #
  147. #===============================================================================
  148. #
  149. # For the Special Collapse function, the following tags in an enemy's notebox:
  150. # \collapse_anim[n] - n = ID of animation used upon collapse. If 0, no animation.
  151. # \collapse_type[n] - n = ID of collapse effect to use. Listing as follows:
  152. #           0  => Default Collapse Effect
  153. #           1  => Shrink
  154. #           2  => Horizontal Expansion
  155. #           3  => Vertical Expansion
  156. #           4  => Contract and Ascend
  157. #           5  => Rotate
  158. #           6  => Shake and Descend
  159. #           7  => Divides Vertically and Separates Vertically
  160. #           8  => Divides Horizontally and Separates Horizontally
  161. #           9  => Divides Vertically and Separates Horizontally
  162. #           10 => Divides Horizontally and Separates Vertically
  163. #           11 => Wave
  164. #           12 => Blur
  165. #           13 => Rotate Fast & Shrink
  166. #           14 => Eraser
  167. #           15 => Pixel Eraser
  168. # \collapse_type_random - the collapse effect will be chosen randomly.
  169. # \collapse_color[#hexcode] - #hexcode = the colour in hexadecimal code the
  170. #           enemy will change to upon collapsing. Ex:
  171. #           \collapse_color[#FFFFFF] = black
  172. #           \collapse_color[#FF808080] = default
  173. # \collapse_blend[n] - n = the blend type: 0 => Normal, 1 => Addition,
  174. #           2 => Subraction. Default is 1.
  175. #
  176. #===============================================================================
  177. #
  178. # For the enemies swap feature,
  179. # <PACswap: x> or <PACswaps: x, x, x>
  180. # Place one of these into an enemy's notebox to swap it with enemy/ies with the
  181. # ID x. Example:
  182. # <PACswaps: 29, 25, 27>
  183. # Will make the enemy change into the enemies with the IDs 29, 25 and 27.
  184. #
  185. #===============================================================================
  186. #
  187. # For the damage popup feature, use the following script commands:
  188. # $game_system.battle_popup_size = x          - Changes the popup size to x
  189. # $game_system.battle_popup_font = "name"     - Changes the popup font to "name"
  190. # $game_system.battle_popup_colour = :tag     - Changes the popup colour to :tag
  191. # $game_system.battle_popup_colour = [x, x, x]- Changes the popup colour to RGB
  192. #                                               values [x, x, x]
  193. # For suitable tags for the colour, see the coupled setup script.
  194. #
  195. #===============================================================================
  196. #
  197. # For the battle count feature, use the following script commands.
  198. # reset_battle_count    - Resets the battle counter
  199. # get_battle_count(ID)  - Gets the battle count and stores it in variable ID.
  200. # get_victory_count(ID) - Gets the victory "                               ".
  201. # get_escape_count(ID)  - Gets the escape "                                ".
  202. # get_lose_count(ID)    - Gets the loss   "                                ".
  203. # get_defeat_count(ID1, ID2) - Gets the number of times enemy ID1 has been
  204. #         defeated and stores it in variable ID2.
  205. # get_total_defeat_count(ID) - Stores the defeat count of all enemies in
  206. #         variable ID.
  207. # get_dead_count(ID1, ID2)   - Gets the number of times actor ID1 has been
  208. #         killed and stores it in variable ID2.
  209. # get_total_dead_count(ID)   - Stores the dead count of all actors in variable
  210. #         ID.
  211. #
  212. #===============================================================================
  213. #
  214. # For all other information, see the coupled Setup script.
  215. #
  216. #===============================================================================
  217. #
  218. # BEGIN PAC BATTLE ADDONS V1.7
  219. #
  220. #===============================================================================
  221.  
  222. $pac ||= {}
  223. $pac["Battle Addons"] = [1.7, :c]
  224.  
  225. #===============================================================================
  226. #
  227. # PAC Escape Bar Removal
  228. #
  229. #===============================================================================
  230.  
  231. if PAC::BATTLE::REMOVE_ESCAPE_BAR
  232.  
  233. #==============================================================================
  234. # ** Scene_Battle
  235. #------------------------------------------------------------------------------
  236. #  This class performs battle screen processing.
  237. #==============================================================================
  238.  
  239. class Scene_Battle < Scene_Base
  240.   #--------------------------------------------------------------------------
  241.   # * Frame Update
  242.   #--------------------------------------------------------------------------
  243.   def update
  244.     super
  245.     update_basic(true)
  246.     update_info_viewport                  # Update information viewport
  247.     if $game_message.visible
  248.       @info_viewport.visible = false
  249.       @message_window.visible = true
  250.     end
  251.     unless $game_message.visible          # Unless displaying a message
  252.       return if judge_win_loss            # Determine win/loss results
  253.       update_scene_change
  254.       if @target_enemy_window != nil
  255.         update_target_enemy_selection     # Select target enemy
  256.       elsif @target_actor_window != nil
  257.         update_target_actor_selection     # Select target actor
  258.       elsif @skill_window != nil
  259.         update_skill_selection            # Select skill
  260.       elsif @item_window != nil
  261.         update_item_selection             # Select item
  262.       elsif @actor_command_window.active
  263.         update_actor_command_selection    # Select actor command
  264.       else
  265.         process_battle_event              # Battle event processing
  266.         process_action                    # Battle action
  267.         process_battle_event              # Battle event processing
  268.       end
  269.     end
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # * Create Information Display Viewport
  273.   #--------------------------------------------------------------------------
  274.   def create_info_viewport
  275.     @info_viewport = Viewport.new(0, 288, 544, 128)
  276.     @info_viewport.z = 100
  277.     @status_window = Window_BattleStatus.new
  278.     @actor_command_window = Window_ActorCommand.new
  279.     @status_window.viewport = @info_viewport
  280.     @actor_command_window.viewport = @info_viewport
  281.     @status_window.x = 0
  282.     @actor_command_window.x = 416
  283.     @info_viewport.visible = false
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # * Dispose of Information Display Viewport
  287.   #--------------------------------------------------------------------------
  288.   def dispose_info_viewport
  289.     @status_window.dispose
  290.     @actor_command_window.dispose
  291.     @info_viewport.dispose
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # * Update Information Display Viewport
  295.   #--------------------------------------------------------------------------
  296.   def update_info_viewport
  297.     @actor_command_window.update
  298.     @status_window.update
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # * Start Party Command Selection
  302.   #--------------------------------------------------------------------------
  303.   def start_party_command_selection
  304.     if $game_temp.in_battle
  305.       @status_window.refresh
  306.       @status_window.index = @actor_index = -1
  307.       @active_battler = nil
  308.       @info_viewport.visible = true
  309.       @message_window.visible = false
  310.       $game_party.clear_actions
  311.       if $game_troop.surprise or not $game_party.inputable?
  312.         start_main
  313.       end
  314.       next_actor
  315.     end
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # * Start Actor Command Selection
  319.   #--------------------------------------------------------------------------
  320.   def start_actor_command_selection
  321.     @actor_command_window.setup(@active_battler)
  322.     @actor_command_window.active = true
  323.     @actor_command_window.index = 0
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # * Start Execution of Battle Processing
  327.   #--------------------------------------------------------------------------
  328.   def start_main
  329.     $game_troop.increase_turn
  330.     @info_viewport.visible = false
  331.     @info_viewport.ox = 0
  332.     @message_window.visible = true
  333.     @actor_command_window.active = false
  334.     @status_window.index = @actor_index = -1
  335.     @active_battler = nil
  336.     @message_window.clear
  337.     $game_troop.make_actions
  338.     make_action_orders
  339.     wait(20)
  340.   end
  341. end
  342. end
  343.  
  344. #===============================================================================
  345. #
  346. # PAC Battle HUD
  347. #
  348. #===============================================================================
  349.  
  350. if PAC::BATTLE::USE_PAC_HUD == true
  351.  
  352. #===============================================================================
  353. # ** Window_BattleStatus
  354. #------------------------------------------------------------------------------
  355. #  This window displays the status of all party members on the battle screen.
  356. #==============================================================================
  357.  
  358. class Window_BattleStatus < Window_Selectable
  359.   #----------------------------------------------------------------------------
  360.   # alias listing
  361.   #----------------------------------------------------------------------------
  362.   alias pacman_WBS_ini initialize
  363.   #----------------------------------------------------------------------------
  364.   # * Object Initialization
  365.   #----------------------------------------------------------------------------
  366.   def initialize
  367.     super(0, 0, 416, 128, 1)
  368.     @column_max = $game_party.members.size
  369.     refresh
  370.     self.active = false
  371.     self.opacity = 255
  372.     self.cursor_rect.set(0, self.index * 96, 90, 90)
  373.   end
  374.   #----------------------------------------------------------------------------
  375.   # * Draw Item
  376.   #----------------------------------------------------------------------------
  377.   def draw_item(index)
  378.     rect = item_rect(index)
  379.     rect.x += 4
  380.     rect.width -= 8
  381.     rect.height = 96
  382.     self.contents.clear_rect(rect)
  383.     self.contents.font.color = normal_color
  384.     actor = $game_party.members[index]
  385.     draw_actor_face2(actor, index * 96, 0, 80)
  386.     self.contents.font.size = 14
  387.     draw_actor_name(actor, index * 96 + 8, 0)
  388.     draw_actor_state(actor, index * 96 + 4, 32, 20)
  389.     draw_hp_and_mp(actor, index * 96, 50, 90)
  390.     self.contents.font.size = 17
  391.   end
  392.   #----------------------------------------------------------------------------
  393.   # * Update Cursor
  394.   #----------------------------------------------------------------------------
  395.   def update_cursor
  396.     if @index < 0
  397.       self.cursor_rect.empty
  398.     else
  399.       self.cursor_rect.set(index * 96, 0, 90, 96)
  400.     end
  401.   end
  402. end
  403.  
  404. #==============================================================================
  405. # ** Window_Base
  406. #------------------------------------------------------------------------------
  407. #  This is a superclass of all windows in the game.
  408. #==============================================================================
  409.  
  410. class Window_Base < Window
  411.   #----------------------------------------------------------------------------
  412.   # * Draw Actor Face (2)
  413.   #----------------------------------------------------------------------------
  414.   def draw_actor_face2(actor, x, y, width = 96, height = 96)
  415.     draw_face2(actor.face_name, actor.face_index, x, y, width, height)
  416.   end # draw_actor_face2(actor, x, y, width = 96, height = 96)
  417.   #----------------------------------------------------------------------------
  418.   # * Draw Face (2)
  419.   #----------------------------------------------------------------------------
  420.   def draw_face2(face_name, face_index, x, y, width = 96, height = 96)
  421.     bitmap = Cache.face(face_name)
  422.     rect = Rect.new(0, 0, 0, 0)
  423.     rect.x = face_index % 4 * 96 + (96 - width) / 2
  424.     rect.y = face_index / 4 * 96 + (96 - height) / 2
  425.     rect.width = width
  426.     rect.height = height -10
  427.     self.contents.blt(x+5, y+5, bitmap, rect, PAC::BATTLE::Face_Opacity)
  428.     bitmap.dispose
  429.   end # draw_face2(face_name, face_index, x, y, width = 96, height = 96)
  430.   #----------------------------------------------------------------------------
  431.   # * Draw Hp and Mp gauges
  432.   #----------------------------------------------------------------------------
  433.   def draw_hp_and_mp(actor, x, y, width)
  434.     back_color = Color.new(39, 58, 83, 255)
  435.     unless PAC::BATTLE::USE_DEFAULT_COLORS
  436.       hp_color1 = Color.new(66, 114, 164, 255)
  437.       hp_color2 = Color.new(122, 175, 229, 255)
  438.       mp_color1 = Color.new(93, 50, 158, 255)
  439.       mp_color2 = Color.new(145, 122, 229, 255)
  440.     else
  441.       hp_color1 = hp_gauge_color1
  442.       hp_color2 = hp_gauge_color2
  443.       mp_color1 = mp_gauge_color1
  444.       mp_color2 = mp_gauge_color2
  445.     end
  446.     self.contents.fill_rect(x+5, y+15, width-10, 7, back_color)
  447.     self.contents.gradient_fill_rect(x+7, y+17,
  448.      (width-14) * actor.hp / actor.maxhp, 3, hp_color1, hp_color2)
  449.     self.contents.draw_text(x+5, y, width-10, 20, Vocab::hp, 0)
  450.     self.contents.draw_text(x+5, y, width-10, 20,
  451.      actor.hp.to_s + "/" + actor.maxhp.to_s, 2)
  452.     self.contents.fill_rect(x+5, y+35, width-10, 7, back_color)
  453.     self.contents.gradient_fill_rect(x+7, y+37,
  454.      (width-14) * actor.mp / actor.maxmp, 3, mp_color1, mp_color2)
  455.     self.contents.draw_text(x+5, y+20, width-10, 20, Vocab::mp, 0)
  456.     self.contents.draw_text(x+5, y+20, width-10, 20,
  457.      actor.mp.to_s + "/" + actor.maxmp.to_s, 2)
  458.   end # draw_hp_and_mp(actor,x,y,width)
  459. end # Window_Base < Window
  460. end
  461.  
  462. #===============================================================================
  463. #
  464. # PAC Auto-Command
  465. #
  466. #===============================================================================
  467.  
  468. if PAC::BATTLE::USE_AUTO
  469.  
  470. #==============================================================================
  471. # ** Window_ActorCommand
  472. #------------------------------------------------------------------------------
  473. #  This window is used to select actor commands, such as "Attack" or "Skill".
  474. #==============================================================================
  475.  
  476. class Window_ActorCommand < Window_Command
  477.  
  478.   alias setup_pac_window_actorcommand setup unless $@
  479.   def setup(actor)
  480.     setup_pac_window_actorcommand(actor)
  481.     @commands.insert(1, PAC::BATTLE::AUTOBATTLE_COMMAND)
  482.     @item_max = @commands.size
  483.     create_contents
  484.     refresh
  485.     self.index = 0
  486.   end
  487. end
  488.  
  489. #==============================================================================
  490. # ** Scene_Battle
  491. #------------------------------------------------------------------------------
  492. #  This class performs battle screen processing.
  493. #==============================================================================
  494.  
  495. class Scene_Battle < Scene_Base
  496.  
  497.   alias update_actor_command_selection_pac_ab update_actor_command_selection
  498.   def update_actor_command_selection
  499.     if Input.trigger?(Input::C)
  500.       case @actor_command_window.index
  501.       when 0  # Attack
  502.         Sound.play_decision
  503.         @active_battler.action.set_attack
  504.         start_target_enemy_selection
  505.       when 1  # Auto
  506.         Sound.play_decision
  507.         @active_battler.make_action
  508.         next_actor
  509.       when 2  # Skill
  510.         Sound.play_decision
  511.         start_skill_selection
  512.       when 3  # Guard
  513.         Sound.play_decision
  514.         @active_battler.action.set_guard
  515.         next_actor
  516.       when 4  # Item
  517.         Sound.play_decision
  518.         start_item_selection
  519.       end
  520.     else
  521.       update_actor_command_selection_pac_ab
  522.     end
  523.   end
  524.  
  525.   def make_auto_command
  526.     @selected_battler.make_action
  527.     @status_window.draw_item(@selected_battler.index)
  528.     if $scene.dtb?
  529.       next_actor if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:next_actor_sw]]
  530.     elsif $scene.ptb?
  531.       perform_instant_action
  532.     elsif $scene.atb?
  533.       make_action_orders
  534.       if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:next_actor_sw]]
  535.         @actor_index = -1 if @actor_index == $game_party.members.size - 1
  536.         next_actor
  537.       end
  538.     elsif $scene.ctb?
  539.       if @selected_battler.ctb_active?
  540.         $game_troop.ctb_ready.shift
  541.         $game_troop.clear_ctb_cache
  542.         make_action_orders
  543.         update_ctb_clockticks
  544.         return
  545.       end
  546.       make_action_orders
  547.       if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:next_actor_sw]]
  548.         @actor_index = -1 if @actor_index == $game_party.members.size - 1
  549.         next_actor
  550.       end
  551.     end
  552.   end
  553. end
  554. end
  555.  
  556. #===============================================================================
  557. #
  558. # PAC Enemy Stats
  559. #
  560. #===============================================================================
  561.  
  562. if PAC::BATTLE::USE_ENSTATS
  563.  
  564. #==============================================================================
  565. # ** Window_TargetEnemy
  566. #------------------------------------------------------------------------------
  567. #  Window for selecting the enemy who is the action target on the battle
  568. # screen.
  569. #==============================================================================
  570.  
  571. class Window_TargetEnemy < Window_Command
  572.   #-----------------------------------------------------------------------------
  573.   # rewrite method: initialize
  574.   #-----------------------------------------------------------------------------
  575.   def initialize
  576.     @enemies = []
  577.     commands = []
  578.     $game_troop.members.each do |enemy|
  579.       next unless enemy.exist?
  580.       @enemies.push(enemy)
  581.       commands.push(enemy.name)
  582.     end
  583.     super(416, commands)
  584.     self.height = 128
  585.   end
  586.   #-----------------------------------------------------------------------------
  587.   # rewrite method: enemy
  588.   #-----------------------------------------------------------------------------
  589.   def enemy
  590.     return @enemies[@index]
  591.   end
  592.   #-----------------------------------------------------------------------------
  593.   # write method: draw_item
  594.   #-----------------------------------------------------------------------------
  595.   def draw_item(index)
  596.     rect = item_rect(index)
  597.     rect.x += 4
  598.     rect.width -= 8
  599.     self.contents.clear_rect(rect)
  600.     self.contents.font.color = normal_color
  601.     actor = @enemies[index]
  602.     unless actor.stat_note?('UNKNOWN_STATUS')
  603.       draw_actor_name(actor, 4, rect.y) unless actor.stat_note?('UNKNOW_NAME')
  604.       unless actor.stat_note?('UNKNOWN_STATUS')
  605.         draw_actor_state(actor, 114, rect.y, 48)
  606.       end
  607.       unless actor.stat_note?('UNKNOWN_HP')
  608.         draw_actor_hp(actor, 174, rect.y, 120)
  609.       end
  610.       unless actor.stat_note?('UNKNOWN_MP')
  611.         draw_actor_mp(actor, 310, rect.y, 70)
  612.       end
  613.     end
  614.   end
  615. end # Window_TargetEnemy
  616.  
  617. #==============================================================================
  618. # ** Game_Enemy
  619. #------------------------------------------------------------------------------
  620. #  This class handles enemy characters. It's used within the Game_Troop class
  621. # ($game_troop).
  622. #==============================================================================
  623.  
  624. class Game_Enemy < Game_Battler
  625.   attr_reader :status_note
  626.  
  627.   #-----------------------------------------------------------------------------
  628.   # alias method: initialize
  629.   #-----------------------------------------------------------------------------
  630.  
  631.   alias pac_unstat_ini initialize
  632.   def initialize(*args)
  633.     pac_unstat_ini(*args)
  634.     @status_note = enemy.note
  635.   end
  636.  
  637.   #-----------------------------------------------------------------------------
  638.   # new method: state_note?
  639.   #-----------------------------------------------------------------------------
  640.  
  641.   def stat_note?(note)
  642.     return @status_note.include?(note)
  643.   end
  644. end # Game_Enemy
  645. end
  646.  
  647. #===============================================================================
  648. #
  649. # PAC Death Events
  650. #
  651. #===============================================================================
  652.  
  653. #==============================================================================
  654. # ** RPG::Enemy
  655. #------------------------------------------------------------------------------
  656. #  Data class for enemies.
  657. #==============================================================================
  658.  
  659. class RPG::Enemy
  660.  
  661.   def death_event
  662.     return @death_event if @death_event != nil
  663.     @death_event = 0
  664.     self.note.split(/[\r\n]+/).each { |line|
  665.    
  666.       case line
  667.       when /<(?:DEATH_EVENT|death event):[ ](\d+)>/i
  668.         @death_event = $1.to_i
  669.       end
  670.     }
  671.     return @death_event
  672.   end
  673. end
  674.  
  675. #==============================================================================
  676. # ** Game_Actor
  677. #------------------------------------------------------------------------------
  678. #  This class handles actors. It's used within the Game_Actors class
  679. # ($game_actors) and referenced by the Game_Party class ($game_party).
  680. #==============================================================================
  681.  
  682. class Game_Actor < Game_Battler
  683.  
  684.   alias pac_de_perform_actor_collapse perform_collapse unless $@
  685.   def perform_collapse
  686.     pac_de_perform_actor_collapse
  687.     if $game_temp.in_battle and dead?
  688.       if PAC::BATTLE::ACTOR_DEATH_EVENTS.include?(@actor_id)
  689.         $death_events.push(PAC::BATTLE::ACTOR_DEATH_EVENTS[@actor_id])
  690.       elsif PAC::BATTLE::CLASS_DEATH_EVENTS.include(@actor_id)
  691.         $death_events.push(PAC::BATLLE::CLASS_DEATH_EVENTS[@actor_id])
  692.       end
  693.     end
  694.   end
  695. end
  696.  
  697. #==============================================================================
  698. # ** Game_Enemy
  699. #------------------------------------------------------------------------------
  700. #  This class handles enemy characters. It's used within the Game_Troop class
  701. # ($game_troop).
  702. #==============================================================================
  703.  
  704. class Game_Enemy < Game_Battler
  705.  
  706.   alias pac_de_perform_enemy_collapse perform_collapse unless $@
  707.   def perform_collapse
  708.     pac_de_perform_enemy_collapse
  709.     if $game_temp.in_battle and dead?
  710.       $death_events.push(enemy.death_event) if enemy.death_event > 0
  711.     end
  712.   end
  713. end
  714.  
  715. #==============================================================================
  716. # ** Scene_Title
  717. #------------------------------------------------------------------------------
  718. #  This class performs the title screen processing.
  719. #==============================================================================
  720.  
  721. class Scene_Title < Scene_Base
  722.  
  723.   alias pac_de_main main
  724.   def main
  725.     $death_events = []
  726.     pac_de_main
  727.   end
  728. end
  729.  
  730. #==============================================================================
  731. # ** Scene_Battle
  732. #------------------------------------------------------------------------------
  733. #  This class performs battle screen processing.
  734. #==============================================================================
  735.  
  736. class Scene_Battle < Scene_Base
  737.  
  738.   alias pac_de_execute_action execute_action unless $@
  739.   def execute_action
  740.     pac_de_execute_action
  741.     run_death_common_events
  742.   end
  743.  
  744.   def run_death_common_events
  745.     for common_event_id in $death_events
  746.       next if $data_common_events[common_event_id].nil?
  747.       $game_temp.common_event_id = common_event_id
  748.       process_battle_event
  749.     end
  750.     $death_events = []
  751.   end
  752.  
  753.   alias pac_de_battle_end battle_end unless $@
  754.   def battle_end(result)
  755.     $death_events = []
  756.     pac_de_battle_end(result)
  757.   end
  758. end
  759.  
  760. #===============================================================================
  761. #
  762. # PAC Linked Deaths
  763. #
  764. #===============================================================================
  765.  
  766. class RPG::Enemy  # RPG::Enemy
  767.  
  768.   #--------------------------------------------------------------------------
  769.   # linked_death
  770.   #--------------------------------------------------------------------------
  771.   def linked_death
  772.     return @linked_death if @linked_death != nil
  773.     @linked_death = []
  774.     self.note.split(/[\r\n]+/).each { |line|
  775.       case line
  776.       when /<(?:LINKED DEATH|link death):[ ](\d+(?:\s*,\s*\d+)*)>/i
  777.         $1.scan(/\d+/).each { |num|
  778.         @linked_death.push(num.to_i) if num.to_i > 0 }
  779.       end
  780.     }
  781.     return @linked_death
  782.   end
  783.   #--------------------------------------------------------------------------
  784.   # linked_death_all
  785.   #--------------------------------------------------------------------------
  786.   def linked_death_all
  787.     return @linked_death_all if @linked_death_all != nil
  788.     @linked_death_all = false
  789.     self.note.split(/[\r\n]+/).each { |line|
  790.       case line
  791.       when /<(?:LINKED DEATH ALL|link death everything)>/i
  792.         @linked_death_all = true
  793.       end
  794.     }
  795.     return @linked_death_all
  796.   end
  797. end
  798.  
  799. class Game_Enemy < Game_Battler
  800.   #--------------------------------------------------------------------------
  801.   # * Perform Collapse
  802.   #--------------------------------------------------------------------------
  803.   alias pac_linked_death_perform_collapse perform_collapse
  804.   def perform_collapse
  805.     pac_linked_death_perform_collapse
  806.     perform_linked_deaths if $game_temp.in_battle and dead?
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # * Perform Linked Deaths
  810.   #--------------------------------------------------------------------------
  811.   def perform_linked_deaths
  812.     unless enemy.linked_death.empty?
  813.       for member in $game_troop.existing_members
  814.         next unless enemy.linked_death.include?(member.enemy_id)
  815.         member.add_state(1)
  816.         member.perform_collapse
  817.       end
  818.     end
  819.     if enemy.linked_death_all
  820.       for member in $game_troop.existing_members
  821.         member.add_state(1)
  822.         member.perform_collapse
  823.       end
  824.     end
  825.   end
  826. end
  827.  
  828. #===============================================================================
  829. #
  830. # PAC Counterattack
  831. #
  832. #===============================================================================
  833.  
  834. #==============================================================================
  835. # ** RPG::State
  836. #------------------------------------------------------------------------------
  837. #  Data class for State.
  838. #==============================================================================
  839.  
  840. class RPG::State
  841.   #-----------------------------------------------------------------------------
  842.   # new method: ca (counterattack)
  843.   #-----------------------------------------------------------------------------
  844.   def ca
  845.     return @ca unless @ca.nil?
  846.     @ca = false
  847.     self.note.split(/[\r\n]+/).each { |line|
  848.       case line
  849.       when /<(?:COUNTERATTACK|counter attack)>/i
  850.         @ca = true
  851.       end
  852.     }
  853.     return @ca
  854.   end
  855. end
  856.  
  857. #==============================================================================
  858. # ** Game_Battler
  859. #------------------------------------------------------------------------------
  860. #  This class deals with battlers. It's used as a superclass of the Game_Actor
  861. # and Game_Enemy classes.
  862. #==============================================================================
  863.  
  864. class Game_Battler
  865.   #-----------------------------------------------------------------------------
  866.   # Public Instance Varliables
  867.   #-----------------------------------------------------------------------------
  868.   attr_accessor :action
  869.   attr_accessor :ca
  870.   #-----------------------------------------------------------------------------
  871.   # * Damage Reflection
  872.   #-----------------------------------------------------------------------------
  873.   alias execute_damage_pac_ca execute_damage unless $@
  874.   def execute_damage(user)
  875.     execute_damage_pac_ca(user)
  876.     create_ca if @hp_damage > 0
  877.   end
  878.   #-----------------------------------------------------------------------------
  879.   # * create_ca
  880.   #-----------------------------------------------------------------------------
  881.   def create_ca
  882.     return if !$scene.is_a?(Scene_Battle)
  883.     return if !exist?
  884.     return if $scene.active_battler.actor? == self.actor?
  885.     for state in states
  886.       next if !state.ca
  887.       @ca = true
  888.       break
  889.     end
  890.   end
  891. end
  892.  
  893. #==============================================================================
  894. # ** Scene_Battle
  895. #------------------------------------------------------------------------------
  896. #  This class performs battle screen processing.
  897. #==============================================================================
  898.  
  899. class Scene_Battle < Scene_Base
  900.   #-----------------------------------------------------------------------------
  901.   # public instance variables
  902.   #-----------------------------------------------------------------------------
  903.   attr_accessor :active_battler
  904.   #-----------------------------------------------------------------------------
  905.   # * Execute Battle Actions
  906.   #-----------------------------------------------------------------------------
  907.   alias execute_action_pac_ca execute_action unless $@
  908.   def execute_action
  909.     execute_action_pac_ca
  910.     process_ca if !@process_ca
  911.   end
  912.   #-----------------------------------------------------------------------------
  913.   # * process_ca
  914.   #-----------------------------------------------------------------------------
  915.   def process_ca
  916.     @process_ca = true
  917.     for member in ($game_party.existing_members + $game_troop.existing_members)
  918.       break if !@active_battler.exist?
  919.       next if member == nil
  920.       next if !member.ca
  921.       next unless rand(100) <= PAC::BATTLE::CA_CHANCE
  922.       last_action = member.action.clone
  923.       last_battler = @active_battler
  924.       member.action.set_attack
  925.       member.action.target_index = @active_battler.index
  926.       @active_battler = member
  927.       inside_performed_actors = false
  928.       if @performed_actors != nil
  929.         inside_performed_actors = true if @performed_actors.include?(member)
  930.       end
  931.       @message_window.clear
  932.       execute_action
  933.       if @performed_actors != nil and !inside_performed_actors
  934.         @performed_actors.delete(@active_battler)
  935.       end
  936.       @active_battler = last_battler
  937.       member.action = last_action
  938.       member.ca = nil
  939.     end
  940.     @process_ca = false
  941.   end
  942. end
  943.  
  944. #===============================================================================
  945. #
  946. # PAC FRIENDLY ENEMIES
  947. #
  948. #===============================================================================
  949.  
  950. #==============================================================================
  951. # RPG::Enemy
  952. #==============================================================================
  953.  
  954. class RPG::Enemy
  955.   #--------------------------------------------------------------------------
  956.   # * Friendly Monster
  957.   #--------------------------------------------------------------------------
  958.   def friendly_monster
  959.     return @friendly_monster if @friendly_monster != nil
  960.     @friendly_monster = false
  961.     self.note.split(/[\r\n]+/).each { |line|
  962.       case line
  963.       when /<(?:FRIENDLY|friendly monster)>/i
  964.         @friendly_monster = true
  965.       end
  966.     }
  967.     return @friendly_monster
  968.   end
  969.   #--------------------------------------------------------------------------
  970.   # * Friendly EXP
  971.   #--------------------------------------------------------------------------
  972.   def friendly_exp
  973.     return @friendly_exp if @friendly_exp != nil
  974.     @friendly_exp = @exp * 2
  975.     self.note.split(/[\r\n]+/).each { |line|
  976.       case line
  977.       when /<(?:FRIENDLY_EXP|friendly exp):[ ](\d+)>/i
  978.         @friendly_exp = $1.to_i
  979.       end
  980.     }
  981.     return @friendly_exp
  982.   end
  983.   #--------------------------------------------------------------------------
  984.   # * Friendly Gold
  985.   #--------------------------------------------------------------------------
  986.   def friendly_gold
  987.     return @friendly_gold if @friendly_gold != nil
  988.     @friendly_gold = @gold * 2
  989.     self.note.split(/[\r\n]+/).each { |line|
  990.       case line
  991.       when /<(?:FRIENDLY_GOLD|friendly gold):[ ](\d+)>/i
  992.         @friendly_gold = $1.to_i
  993.       end
  994.     }
  995.     return @friendly_gold
  996.   end
  997.   #--------------------------------------------------------------------------
  998.   # * Friendly Drops
  999.   #--------------------------------------------------------------------------
  1000.   def friendly_drops
  1001.     return @friendly_drops if @friendly_drops != nil
  1002.     @friendly_drops = []
  1003.     self.note.split(/[\r\n]+/).each { |line|
  1004.       case line
  1005.       when /<(?:FRIENDLY_ITEM|friendly item|friendly i):[ ]*(\d+)>/i
  1006.         @friendly_drops.push($data_items[$1.to_i])
  1007.       when /<(?:FRIENDLY_WEP|friendly wep|friendly w):[ ]*(\d+)>/i
  1008.         @friendly_drops.push($data_weapons[$1.to_i])
  1009.       when /<(?:FRIENDLY_ARM|friendly arm|friendly a):[ ]*(\d+)>/i
  1010.         @friendly_drops.push($data_armors[$1.to_i])
  1011.       end
  1012.     }
  1013.     return @friendly_drops.compact
  1014.   end
  1015. end
  1016.  
  1017. #==============================================================================
  1018. # ** Game_Temp
  1019. #==============================================================================
  1020.  
  1021. class Game_Temp
  1022.   #--------------------------------------------------------------------------
  1023.   # * Public Instance Variables
  1024.   #--------------------------------------------------------------------------
  1025.   attr_accessor :friendly_monster
  1026. end
  1027.  
  1028. #==============================================================================
  1029. # ** Game_Enemy
  1030. #==============================================================================
  1031.  
  1032. class Game_Enemy < Game_Battler
  1033.   #--------------------------------------------------------------------------
  1034.   # * states
  1035.   #--------------------------------------------------------------------------
  1036.   def friendly?
  1037.     return enemy.friendly_monster
  1038.   end
  1039.   #--------------------------------------------------------------------------
  1040.   # * Create Battle Action
  1041.   #--------------------------------------------------------------------------
  1042.   alias make_action_pac_friendly_monsters make_action unless $@
  1043.   def make_action
  1044.     $game_temp.friendly_monster = true
  1045.     make_action_pac_friendly_monsters
  1046.     $game_temp.friendly_monster = false
  1047.   end
  1048. end
  1049.  
  1050. #==============================================================================
  1051. # ** Game_BattleAction
  1052. #==============================================================================
  1053.  
  1054. class Game_BattleAction
  1055.   #--------------------------------------------------------------------------
  1056.   # * Get Allied Units
  1057.   #--------------------------------------------------------------------------
  1058.   alias friends_unit_pac_friendly_monsters friends_unit unless $@
  1059.   def friends_unit
  1060.     if !battler.actor? and battler.friendly?
  1061.       return $game_party
  1062.     else
  1063.       return friends_unit_pac_friendly_monsters
  1064.     end
  1065.   end
  1066.   #--------------------------------------------------------------------------
  1067.   # * Get Enemy Units
  1068.   #--------------------------------------------------------------------------
  1069.   alias opponents_unit_pac_friendly_monsters opponents_unit unless $@
  1070.   def opponents_unit
  1071.     if !battler.actor? and battler.friendly?
  1072.       return $game_troop
  1073.     else
  1074.       return opponents_unit_pac_friendly_monsters
  1075.     end
  1076.   end
  1077.   #--------------------------------------------------------------------------
  1078.   # * Create Normal Attack Targets
  1079.   #--------------------------------------------------------------------------
  1080.   alias make_attack_targets_pac_friendly_monsters make_attack_targets unless $@
  1081.   def make_attack_targets
  1082.     $game_temp.friendly_monster = true if !battler.actor?
  1083.     result = make_attack_targets_pac_friendly_monsters
  1084.     $game_temp.friendly_monster = false
  1085.     return result
  1086.   end
  1087.   #--------------------------------------------------------------------------
  1088.   # * Create Normal Attack Targets
  1089.   #--------------------------------------------------------------------------
  1090.   alias make_obj_targets_pac_friendly_monsters make_obj_targets unless $@
  1091.   def make_obj_targets(obj)
  1092.     $game_temp.friendly_monster = true if !battler.actor?
  1093.     result = make_obj_targets_pac_friendly_monsters(obj)
  1094.     $game_temp.friendly_monster = false
  1095.     return result
  1096.   end
  1097. end
  1098.  
  1099. #==============================================================================
  1100. # ** Game_Troop
  1101. #==============================================================================
  1102.  
  1103. class Game_Troop < Game_Unit
  1104.   #--------------------------------------------------------------------------
  1105.   # * Members
  1106.   #--------------------------------------------------------------------------
  1107.   alias members_troop_pac_friendly_monsters members unless $@
  1108.   def members
  1109.     result = members_troop_pac_friendly_monsters
  1110.     result -= $game_troop.friendlies if $game_temp.friendly_monster
  1111.     return result
  1112.   end
  1113.   #--------------------------------------------------------------------------
  1114.   # * Friendlies
  1115.   #--------------------------------------------------------------------------
  1116.   def friendlies
  1117.     result = []
  1118.     for member in members_troop_pac_friendly_monsters
  1119.       result.push(member) if member.friendly?
  1120.     end
  1121.     return result.compact
  1122.   end
  1123.   #--------------------------------------------------------------------------
  1124.   # * Friendlies Alive?
  1125.   #--------------------------------------------------------------------------
  1126.   def friendlies_alive?
  1127.     for member in friendlies
  1128.       return true unless member.dead?
  1129.     end
  1130.     return false
  1131.   end
  1132.   #--------------------------------------------------------------------------
  1133.   # * Determine Everyone is Dead
  1134.   #--------------------------------------------------------------------------
  1135.   def all_dead?
  1136.     n = existing_members
  1137.     n -= $game_troop.friendlies
  1138.     return n.empty?
  1139.   end
  1140.   #--------------------------------------------------------------------------
  1141.   # * Calculate Total Experience
  1142.   #--------------------------------------------------------------------------
  1143.   alias exp_total_pac_friendly_monsters exp_total unless $@
  1144.   def exp_total
  1145.     n = exp_total_pac_friendly_monsters
  1146.     for member in $game_troop.friendlies
  1147.       next if member.dead?
  1148.       n += member.enemy.friendly_exp
  1149.     end
  1150.     return n
  1151.   end
  1152.   #--------------------------------------------------------------------------
  1153.   # * Calculate Total Gold
  1154.   #--------------------------------------------------------------------------
  1155.   alias gold_total_pac_friendly_monsters gold_total unless $@
  1156.   def gold_total
  1157.     n = gold_total_pac_friendly_monsters
  1158.     for member in $game_troop.friendlies
  1159.       next if member.dead?
  1160.       n += member.enemy.friendly_exp
  1161.     end
  1162.     return n
  1163.   end
  1164.   #--------------------------------------------------------------------------
  1165.   # * Create Array of Dropped Items
  1166.   #--------------------------------------------------------------------------
  1167.   alias make_drop_items_pac_friendly_monsters make_drop_items unless $@
  1168.   def make_drop_items
  1169.     n = make_drop_items_pac_friendly_monsters
  1170.     for member in $game_troop.friendlies
  1171.       next if member.dead?
  1172.       n += member.enemy.friendly_drops
  1173.     end
  1174.     return n
  1175.   end
  1176. end
  1177.  
  1178. #==============================================================================
  1179. # ** Game_Party
  1180. #==============================================================================
  1181.  
  1182. class Game_Party < Game_Unit
  1183.   #--------------------------------------------------------------------------
  1184.   # * Members
  1185.   #--------------------------------------------------------------------------
  1186.   alias members_party_pac_friendly_monsters members unless $@
  1187.   def members
  1188.     result = members_party_pac_friendly_monsters
  1189.     if $game_temp.friendly_monster and $game_troop.friendlies_alive?
  1190.       return $game_troop.friendlies
  1191.     end
  1192.     return result
  1193.   end
  1194. end
  1195.  
  1196. #===============================================================================
  1197. #
  1198. # PAC Large Troop
  1199. #
  1200. #===============================================================================
  1201.  
  1202. class RPG::Troop # RPG::Troop
  1203.  
  1204.   #-----------------------------------------------------------------------------
  1205.   # rewrite method: members
  1206.   #-----------------------------------------------------------------------------
  1207.  
  1208.   def members
  1209.     return @members if @added_extra_members
  1210.     @added_extra_members = true
  1211.     return @members unless PAC::BATTLE::LARGE_TROOP.include?(@id)
  1212.     new_members = PAC::BATTLE::LARGE_TROOP[@id]
  1213.     for array in new_members
  1214.       new_member = RPG::Troop::Member.new
  1215.       new_member.enemy_id = array[0]
  1216.       new_member.x = array[1]
  1217.       new_member.y = array[2]
  1218.       new_member.hidden = array[3]
  1219.       new_member.immortal = array[4]
  1220.       @members.push(new_member)
  1221.     end
  1222.     return @members
  1223.   end
  1224. end # RPG::Troop
  1225.  
  1226. #==============================================================================
  1227. # ** Window_TargetEnemy
  1228. #------------------------------------------------------------------------------
  1229. #  Window for selecting the enemy who is the action target on the battle
  1230. # screen.
  1231. #==============================================================================
  1232.  
  1233. class Window_TargetEnemy < Window_Command
  1234.  
  1235.   #-----------------------------------------------------------------------------
  1236.   # rewrite method: initialize
  1237.   #-----------------------------------------------------------------------------
  1238.   unless PAC::BATTLE::USE_ENSTATS
  1239.     def initialize
  1240.       commands = []
  1241.       @enemies = []
  1242.       for enemy in $game_troop.members
  1243.         next unless enemy.exist?
  1244.         commands.push(enemy.name)
  1245.         @enemies.push(enemy)
  1246.       end
  1247.       super(Graphics.width-128, commands, 2)
  1248.       self.height = 128
  1249.     end
  1250.   end
  1251. end # Window_TargetEnemy
  1252.  
  1253. #===============================================================================
  1254. #
  1255. # PAC Slip Damage
  1256. #
  1257. #===============================================================================
  1258.  
  1259. #==============================================================================
  1260. # ** Game_Battler
  1261. #------------------------------------------------------------------------------
  1262. #  This class deals with battlers. It's used as a superclass of the Game_Actor
  1263. # and Game_Enemy classes.
  1264. #==============================================================================
  1265.  
  1266. class Game_Battler
  1267.   #--------------------------------------------------------------------------
  1268.   # * Public Instance Variables
  1269.   #--------------------------------------------------------------------------
  1270.   attr_accessor :slip_damage_message # message for slip damage
  1271.   #--------------------------------------------------------------------------
  1272.   # * Application of Slip Damage Effects
  1273.   #--------------------------------------------------------------------------
  1274.   def slip_damage_effect
  1275.     if slip_damage? and @hp > 0
  1276.       @hp_damage = apply_variance(maxhp / 20, 10)
  1277.       @hp_damage = @hp - 1 if @hp_damage >= @hp
  1278.       self.hp -= @hp_damage
  1279.       ext_txt = PAC::BATTLE::SDAMAGE_TEXT # To save space.
  1280.       @slip_damage_message = "#{self.name} took #{self.hp_damage}" + ext_txt
  1281.     end
  1282.   end
  1283. end
  1284.  
  1285. #==============================================================================
  1286. # ** Scene_Battle
  1287. #------------------------------------------------------------------------------
  1288. #  This class performs battle screen processing.
  1289. #==============================================================================
  1290.  
  1291. class Scene_Battle < Scene_Base
  1292.   #--------------------------------------------------------------------------
  1293.   # * End Turn
  1294.   #--------------------------------------------------------------------------
  1295.   def turn_end
  1296.     $game_troop.turn_ending = true
  1297.     $game_party.slip_damage_effect
  1298.     m = $game_party.members
  1299.     for i in 0...m.size
  1300.       for state in m[i].states
  1301.         if state.slip_damage
  1302.           unless m[i].dead?
  1303.             $game_troop.screen.start_shake(5, 5, 10)
  1304.             @message_window.replace_instant_text(m[i].slip_damage_message)
  1305.             Sound.play_actor_damage
  1306.             wait(PAC::BATTLE::WAIT)
  1307.           end
  1308.         end
  1309.       end
  1310.     end
  1311.     $game_troop.slip_damage_effect
  1312.     t = $game_troop.members
  1313.     for i in 0...t.size
  1314.       for state in t[i].states
  1315.         if state.slip_damage
  1316.           unless t[i].dead?
  1317.             t[i].blink = true
  1318.             @message_window.replace_instant_text(t[i].slip_damage_message)
  1319.             Sound.play_enemy_damage
  1320.             wait(PAC::BATTLE::WAIT)
  1321.             t[i].slip_damage_message = nil
  1322.           end
  1323.         end
  1324.       end
  1325.     end
  1326.     $game_party.do_auto_recovery
  1327.     $game_troop.preemptive = false
  1328.     $game_troop.surprise = false
  1329.     process_battle_event
  1330.     $game_troop.turn_ending = false
  1331.     start_party_command_selection
  1332.   end
  1333. end
  1334.  
  1335. #===============================================================================
  1336. #
  1337. # PAC Overkill
  1338. #
  1339. #===============================================================================
  1340.  
  1341. #==============================================================================
  1342. # ** RPG::Enemy
  1343. #==============================================================================
  1344.  
  1345. class RPG::Enemy
  1346.   #--------------------------------------------------------------------------
  1347.   # overkill_requirement
  1348.   #--------------------------------------------------------------------------
  1349.   def overkill_requirement
  1350.     return @overkill_requirement if @overkill_requirement != nil
  1351.     @overkill_requirement = @maxhp * 3 / 2
  1352.     self.note.split(/[\r\n]+/).each { |line|
  1353.       case line
  1354.       when /<(?:OVERKILL_REQUIRE|overkill_require):[ ](\d+)>/i
  1355.         @overkill_requirement = $1.to_i
  1356.       end
  1357.     }
  1358.     return @overkill_requirement
  1359.   end
  1360.   #--------------------------------------------------------------------------
  1361.   # overkill_exp
  1362.   #--------------------------------------------------------------------------
  1363.   def overkill_exp
  1364.     return @overkill_exp if @overkill_exp != nil
  1365.     @overkill_exp = @exp / 2
  1366.     self.note.split(/[\r\n]+/).each { |line|
  1367.       case line
  1368.       when /<(?:OVERKILL_EXP|overkill exp):[ ]([\+\-]\d+)>/i
  1369.         @overkill_exp = $1.to_i
  1370.       end
  1371.     }
  1372.     return @overkill_exp
  1373.   end
  1374.   #--------------------------------------------------------------------------
  1375.   # overkill_gold
  1376.   #--------------------------------------------------------------------------
  1377.   def overkill_gold
  1378.     return @overkill_gold if @overkill_gold != nil
  1379.     @overkill_gold = @exp / 2
  1380.     self.note.split(/[\r\n]+/).each { |line|
  1381.       case line
  1382.       when /<(?:OVERKILL_GOLD|overkill gold):[ ]([\+\-]\d+)>/i
  1383.         @overkill_gold = $1.to_i
  1384.       end
  1385.     }
  1386.     return @overkill_gold
  1387.   end
  1388.   #--------------------------------------------------------------------------
  1389.   # overkill_items
  1390.   #--------------------------------------------------------------------------
  1391.   def overkill_items
  1392.     return @overkill_items.compact if @overkill_items != nil
  1393.     @overkill_items = []
  1394.     self.note.split(/[\r\n]+/).each { |line|
  1395.       case line
  1396.       when /<(?:OVERKILL_ITEM|overkill item):[ ](\d+)>/i
  1397.         @overkill_items.push($data_items[$1.to_i])
  1398.       when /<(?:OVERKILL_WEAPON|overkill weapon):[ ](\d+)>/i
  1399.         @overkill_items.push($data_weapons[$1.to_i])
  1400.       when /<(?:OVERKILL_ARMOR|overkill armor):[ ](\d+)>/i
  1401.         @overkill_items.push($data_armors[$1.to_i])
  1402.       end
  1403.     }
  1404.     return @overkill_items.compact
  1405.   end
  1406. end
  1407.  
  1408. #==============================================================================
  1409. # ** Game_Enemy
  1410. #==============================================================================
  1411.  
  1412. class Game_Enemy < Game_Battler
  1413.   #--------------------------------------------------------------------------
  1414.   # * Public Instance Variables
  1415.   #--------------------------------------------------------------------------
  1416.   attr_accessor :overkill
  1417.   #--------------------------------------------------------------------------
  1418.   # * Activate Overkill
  1419.   #--------------------------------------------------------------------------
  1420.   def activate_overkill
  1421.     return unless @hp_damage >= enemy.overkill_requirement
  1422.     return unless @hp_damage >= @hp
  1423.     return unless @hp == 0
  1424.     return if @overkill
  1425.     @overkill = true
  1426.     if $scene.is_a?(Scene_Battle) and not $scene.message_window.nil?
  1427.       text = sprintf(PAC::BATTLE::OVERKILL_MESSAGE, name)
  1428.       $scene.message_window.add_instant_text(text)
  1429.     end
  1430.     PAC::BATTLE::OVERKILL_SOUND.play
  1431.   end
  1432.   #--------------------------------------------------------------------------
  1433.   # * Get Experience
  1434.   #--------------------------------------------------------------------------
  1435.   alias exp_pac_overkill exp unless $@
  1436.   def exp
  1437.     n = exp_pac_overkill
  1438.     n += enemy.overkill_exp if @overkill
  1439.     return n
  1440.   end
  1441.   #--------------------------------------------------------------------------
  1442.   # * Get Gold
  1443.   #--------------------------------------------------------------------------
  1444.   alias gold_pac_overkill gold unless $@
  1445.   def gold
  1446.     n = gold_pac_overkill
  1447.     n += enemy.overkill_gold if @overkill
  1448.     return n
  1449.   end
  1450. end
  1451.  
  1452. #==============================================================================
  1453. # ** Game_Battler
  1454. #==============================================================================
  1455.  
  1456. class Game_Battler
  1457.   #--------------------------------------------------------------------------
  1458.   # * Damage Reflection
  1459.   #--------------------------------------------------------------------------
  1460.   alias execute_damage_pac_overkill execute_damage unless $@
  1461.   def execute_damage(user)
  1462.     execute_damage_pac_overkill(user)
  1463.     return unless user.actor? and self.is_a?(Game_Enemy)
  1464.     activate_overkill
  1465.   end
  1466. end
  1467.  
  1468. #==============================================================================
  1469. # ** Game_Troop
  1470. #==============================================================================
  1471.  
  1472. class Game_Troop < Game_Unit
  1473.   #--------------------------------------------------------------------------
  1474.   # * Create Array of Dropped Items
  1475.   #--------------------------------------------------------------------------
  1476.   alias make_drop_items_pac_overkill make_drop_items unless $@
  1477.   def make_drop_items
  1478.     n = make_drop_items_pac_overkill
  1479.     for member in dead_members
  1480.       next unless member.overkill
  1481.       n += member.enemy.overkill_items
  1482.     end
  1483.     return n
  1484.   end
  1485. end
  1486.  
  1487. #==============================================================================
  1488. # ** Scene_Battle
  1489. #==============================================================================
  1490.  
  1491. class Scene_Battle < Scene_Base
  1492.   #--------------------------------------------------------------------------
  1493.   # * Public Instance Variables
  1494.   #--------------------------------------------------------------------------
  1495.   attr_accessor :message_window
  1496. end
  1497.  
  1498. #===============================================================================
  1499. #
  1500. # PAC Autostates
  1501. #
  1502. #===============================================================================
  1503.  
  1504. class RPG::Enemy
  1505.   #--------------------------------------------------------------------------
  1506.   # autostates
  1507.   #--------------------------------------------------------------------------
  1508.   def autostates
  1509.     return @autostates if @autostates != nil
  1510.     @autostates = []
  1511.     self.note.split(/[\r\n]+/).each { |line|
  1512.       case line
  1513.       when /<(?:AUTOSTATE|autostates):[ ](\d+(?:\s*,\s*\d+)*)>/i
  1514.         $1.scan(/\d+/).each { |num|
  1515.         @autostates.push($data_states[num.to_i]) if num.to_i > 0 }
  1516.       end
  1517.     }
  1518.     return @autostates
  1519.   end
  1520. end
  1521.  
  1522. #==============================================================================
  1523. # ** Game_Enemy
  1524. #==============================================================================
  1525.  
  1526. class Game_Enemy < Game_Battler
  1527.   #--------------------------------------------------------------------------
  1528.   # * states
  1529.   #--------------------------------------------------------------------------
  1530.   def states
  1531.     st = super
  1532.     for state in enemy.autostates
  1533.       st.push(state) unless state.nil?
  1534.     end
  1535.     return st.uniq
  1536.   end
  1537. end
  1538.  
  1539. #===============================================================================
  1540. #
  1541. # PAC VAPMIRISM AND SIPHONISM
  1542. #
  1543. #===============================================================================
  1544.  
  1545. #==============================================================================
  1546. # RPG::Weapon
  1547. #==============================================================================
  1548.  
  1549. class RPG::Weapon < RPG::BaseItem
  1550.   #--------------------------------------------------------------------------
  1551.   # * Vampiric
  1552.   #--------------------------------------------------------------------------
  1553.   def vampiric
  1554.     return @vampiric if @vampiric != nil
  1555.     @vampiric = 0
  1556.     self.note.split(/[\r\n]+/).each { |line|
  1557.       case line
  1558.       when /<(?:VAMPIRIC|vampire):[ ]*(\d+)([%ï¼…])>/i
  1559.         @vampiric = $1.to_i
  1560.       end
  1561.     }
  1562.     return @vampiric
  1563.   end
  1564.   #--------------------------------------------------------------------------
  1565.   # * Siphonic
  1566.   #--------------------------------------------------------------------------
  1567.   def siphonic
  1568.     return @siphonic if @siphonic != nil
  1569.     @siphonic = 0
  1570.     self.note.split(/[\r\n]+/).each { |line|
  1571.       case line
  1572.       when /<(?:SIPHONIC|siphon):[ ]*(\d+)>/i
  1573.         @siphonic = $1.to_i
  1574.       end
  1575.     }
  1576.     return @siphonic
  1577.   end
  1578. end
  1579.  
  1580. #==============================================================================
  1581. # RPG::Enemy
  1582. #==============================================================================
  1583.  
  1584. class RPG::Enemy
  1585.   #--------------------------------------------------------------------------
  1586.   # * Vampiric
  1587.   #--------------------------------------------------------------------------
  1588.   def vampiric
  1589.     return @vampiric if @vampiric != nil
  1590.     @vampiric = 0
  1591.     self.note.split(/[\r\n]+/).each { |line|
  1592.       case line
  1593.       when /<(?:VAMPIRIC|vampire):[ ]*(\d+)([%ï¼…])>/i
  1594.         @vampiric = $1.to_i
  1595.       end
  1596.     }
  1597.     return @vampiric
  1598.   end
  1599.   #--------------------------------------------------------------------------
  1600.   # * Siphonic
  1601.   #--------------------------------------------------------------------------
  1602.   def siphonic
  1603.     return @siphonic if @siphonic != nil
  1604.     @siphonic = 0
  1605.     self.note.split(/[\r\n]+/).each { |line|
  1606.       case line
  1607.       when /<(?:SIPHONIC|siphon):[ ]*(\d+)>/i
  1608.         @siphonic = $1.to_i
  1609.       end
  1610.     }
  1611.     return @siphonic
  1612.   end
  1613. end
  1614.  
  1615. #==============================================================================
  1616. # ** Game_Battler
  1617. #==============================================================================
  1618.  
  1619. class Game_Battler
  1620.   #--------------------------------------------------------------------------
  1621.   # * Clear Variable for Storing Action Results
  1622.   #--------------------------------------------------------------------------
  1623.   alias clear_action_results_pac_vampire_weapons clear_action_results unless $@
  1624.   def clear_action_results
  1625.     clear_action_results_pac_vampire_weapons
  1626.     @vampiric = 0
  1627.     @siphonic = 0
  1628.   end
  1629.   #--------------------------------------------------------------------------
  1630.   # * Calculation of Damage From Normal Attack
  1631.   #--------------------------------------------------------------------------
  1632.   alias make_attack_damage_value_pac_vampire_weapons make_attack_damage_value
  1633.   def make_attack_damage_value(attacker)
  1634.     make_attack_damage_value_pac_vampire_weapons(attacker)
  1635.     @vampiric = [@hp_damage * attacker.vampiric_rate / 100, self.hp].min
  1636.     @mp_damage += attacker.siphonic_rate
  1637.     @siphonic = [@mp_damage, self.mp, attacker.siphonic_rate].min
  1638.   end
  1639.   #--------------------------------------------------------------------------
  1640.   # * Calculation of Damage Caused by Skills or Items
  1641.   #--------------------------------------------------------------------------
  1642.   alias make_obj_damage_value_pac_vampire_weapons make_obj_damage_value
  1643.   def make_obj_damage_value(user, obj)
  1644.     make_obj_damage_value_pac_vampire_weapons(user, obj)
  1645.     return if @absorbed
  1646.     return unless obj.physical_attack
  1647.     @vampiric = [@hp_damage * user.vampiric_rate / 100, self.hp].min
  1648.     @mp_damage += user.siphonic_rate
  1649.     @siphonic = [@mp_damage, self.mp, user.siphonic_rate].min
  1650.   end
  1651.   #--------------------------------------------------------------------------
  1652.   # * Damage Reflection
  1653.   #--------------------------------------------------------------------------
  1654.   alias execute_damage_pac_vampire_weapons execute_damage unless $@
  1655.   def execute_damage(user)
  1656.     execute_damage_pac_vampire_weapons(user)
  1657.     user.hp += @vampiric if @vampiric > 0
  1658.     user.mp += @siphonic if @siphonic > 0
  1659.   end
  1660. end
  1661.  
  1662. #==============================================================================
  1663. # ** Game_Actor
  1664. #==============================================================================
  1665.  
  1666. class Game_Actor < Game_Battler
  1667.   #--------------------------------------------------------------------------
  1668.   # * Vampiric Rate
  1669.   #--------------------------------------------------------------------------
  1670.   def vampiric_rate
  1671.     result = 0
  1672.     for weapon in weapons.compact
  1673.       result += weapon.vampiric
  1674.     end
  1675.     return [result, 0].max
  1676.   end
  1677.   #--------------------------------------------------------------------------
  1678.   # * Siphonic Rate
  1679.   #--------------------------------------------------------------------------
  1680.   def siphonic_rate
  1681.     result = 0
  1682.     for weapon in weapons.compact
  1683.       result += weapon.siphonic
  1684.     end
  1685.     return [result, 0].max
  1686.   end
  1687. end
  1688.  
  1689. #==============================================================================
  1690. # ** Game_Enemy
  1691. #==============================================================================
  1692.  
  1693. class Game_Enemy < Game_Battler
  1694.   #--------------------------------------------------------------------------
  1695.   # * Vampiric Rate
  1696.   #--------------------------------------------------------------------------
  1697.   def vampiric_rate
  1698.     return [enemy.vampiric, 0].max
  1699.   end
  1700.   #--------------------------------------------------------------------------
  1701.   # * Siphonic Rate
  1702.   #--------------------------------------------------------------------------
  1703.   def siphonic_rate
  1704.     return [enemy.siphonic, 0].max
  1705.   end
  1706. end
  1707.  
  1708. #===============================================================================
  1709. #
  1710. # PAC Weapon Attack Replace
  1711. #
  1712. #===============================================================================
  1713.  
  1714. #==============================================================================
  1715. # RPG::Weapon
  1716. #==============================================================================
  1717.  
  1718. class RPG::Weapon < RPG::BaseItem
  1719.   #--------------------------------------------------------------------------
  1720.   # # Attack Skills
  1721.   #--------------------------------------------------------------------------
  1722.   def attack_skills
  1723.     return @attack_skills if @attack_skills != nil
  1724.     @attack_skills = []
  1725.     self.note.split(/[\r\n]+/).each { |line|
  1726.       case line
  1727.       when /<(?:ATTACK_SKILL|attack skill):[ ](\d+(?:\s*,\s*\d+)*)>/i
  1728.         $1.scan(/\d+/).each { |num| @attack_skills.push(num.to_i) }
  1729.       end
  1730.     }
  1731.     return @attack_skills
  1732.   end
  1733. end
  1734.  
  1735. #==============================================================================
  1736. # ** Game_Actor
  1737. #==============================================================================
  1738.  
  1739. class Game_Actor < Game_Battler
  1740.   #--------------------------------------------------------------------------
  1741.   # * Attack Skills
  1742.   #--------------------------------------------------------------------------
  1743.   def attack_skills
  1744.     n = []
  1745.     for weapon in weapons.compact do n += weapon.attack_skills end
  1746.     return n
  1747.   end
  1748. end
  1749.  
  1750. #==============================================================================
  1751. # ** Scene_Battle
  1752. #==============================================================================
  1753.  
  1754. class Scene_Battle < Scene_Base
  1755.   #--------------------------------------------------------------------------
  1756.   # * Execute Battle Action: Attack
  1757.   #--------------------------------------------------------------------------
  1758.   unless $@
  1759.     alias execute_action_attack_pac_weapon_replace execute_action_attack
  1760.   end
  1761.   def execute_action_attack
  1762.     if @active_battler.actor? and not @active_battler.attack_skills.empty?
  1763.       attack_skills = @active_battler.attack_skills
  1764.       skill_id = attack_skills[rand(attack_skills.size)]
  1765.       @active_battler.action.set_skill(skill_id)
  1766.       execute_action_skill
  1767.     else
  1768.       execute_action_attack_pac_weapon_replace
  1769.     end
  1770.   end
  1771. end
  1772.  
  1773. #===============================================================================
  1774. #
  1775. # PAC WEREFORMS
  1776. #
  1777. #===============================================================================
  1778.  
  1779. #==============================================================================
  1780. # RPG::UsableItem
  1781. #==============================================================================
  1782.  
  1783. class RPG::UsableItem < RPG::BaseItem
  1784.   #--------------------------------------------------------------------------
  1785.   # # Wereform
  1786.   #--------------------------------------------------------------------------
  1787.   def wereform
  1788.     return @wereform if @wereform != nil
  1789.     @wereform = 0
  1790.     self.note.split(/[\r\n]+/).each { |line|
  1791.       case line
  1792.       when /<(?:WEREFORM|metamorph):[ ](\d+)>/i
  1793.         @wereform = $1.to_i
  1794.       end
  1795.     }
  1796.     return @wereform
  1797.   end
  1798.   #--------------------------------------------------------------------------
  1799.   # # Wereform Image
  1800.   #--------------------------------------------------------------------------
  1801.   def wereform_image
  1802.     return @wereform_image if @wereform_image != nil
  1803.     @wereform_image = [nil, 0]
  1804.     self.note.split(/[\r\n]+/).each { |line|
  1805.       case line
  1806.       when /<(?:WEREIMAGE|morphimage):[ ](.*),[ ](\d+)>/i
  1807.         @wereform_image[0] = $1.to_s
  1808.         @wereform_image[1] = $2.to_i
  1809.       end
  1810.     }
  1811.     return @wereform_image
  1812.   end
  1813.   #--------------------------------------------------------------------------
  1814.   # # Wereform Face
  1815.   #--------------------------------------------------------------------------
  1816.   def wereform_face
  1817.     return @wereform_face if @wereform_face != nil
  1818.     @wereform_face = [nil, 0]
  1819.     self.note.split(/[\r\n]+/).each { |line|
  1820.       case line
  1821.       when /<(?:WEREFACE|morphface):[ ](.*),[ ](\d+)>/i
  1822.         @wereform_face[0] = $1.to_s
  1823.         @wereform_face[1] = $2.to_i
  1824.       end
  1825.     }
  1826.     return @wereform_face
  1827.   end
  1828.   #--------------------------------------------------------------------------
  1829.   # # Wereform Revert
  1830.   #--------------------------------------------------------------------------
  1831.   def wereform_revert
  1832.     return @wereform_revert if @wereform_revert != nil
  1833.     @wereform_revert = false
  1834.     self.note.split(/[\r\n]+/).each { |line|
  1835.       case line
  1836.       when /<(?:WEREFORM REVERT|metamorph revert)>/i
  1837.         @wereform_revert = true
  1838.       end
  1839.     }
  1840.     return @wereform_revert
  1841.   end
  1842. end
  1843.  
  1844. #==============================================================================
  1845. # ** Game_Battler
  1846. #==============================================================================
  1847.  
  1848. class Game_Battler
  1849.   #--------------------------------------------------------------------------
  1850.   # * Apply Skill Effects
  1851.   #--------------------------------------------------------------------------
  1852.   alias skill_effect_pac_wereform skill_effect unless $@
  1853.   def skill_effect(user, skill)
  1854.     skill_effect_pac_wereform(user, skill)
  1855.     user.wereform_effect(skill)
  1856.     user.clear_wereforms if skill.wereform_revert
  1857.   end
  1858.   #--------------------------------------------------------------------------
  1859.   # * Apply Item Effects
  1860.   #--------------------------------------------------------------------------
  1861.   alias item_effect_pac_wereform item_effect unless $@
  1862.   def item_effect(user, item)
  1863.     item_effect_pac_wereform(user, item)
  1864.     user.wereform_effect(item)
  1865.     user.clear_wereforms if item.wereform_revert
  1866.   end
  1867.   #--------------------------------------------------------------------------
  1868.   # * Wereform Effect
  1869.   #--------------------------------------------------------------------------
  1870.   def wereform_effect(obj)
  1871.     return if obj.nil?
  1872.     return unless actor?
  1873.     return unless $game_temp.in_battle
  1874.     return unless obj.wereform > 0
  1875.     @wereform = obj.wereform
  1876.     if @wereimage.nil?
  1877.       @wereimage = @character_name
  1878.       @wereindex = @character_index
  1879.       @wereface  = @face_name
  1880.       @werefndex = @face_index
  1881.     end
  1882.     if obj.wereform_image[0] != nil and obj.wereform_face[0] != nil
  1883.       a1 = obj.wereform_image[0]
  1884.       a2 = obj.wereform_image[1]
  1885.       b1 = obj.wereform_face[0]
  1886.       b2 = obj.wereform_face[1]
  1887.       set_graphic(a1, a2, b1, b2)
  1888.     end
  1889.   end
  1890.   #--------------------------------------------------------------------------
  1891.   # * Clear Wereforms
  1892.   #--------------------------------------------------------------------------
  1893.   def clear_wereforms
  1894.     return if @wereform.nil?
  1895.     @wereform = nil
  1896.     unless @wereimage.nil?
  1897.       set_graphic(@wereimage, @wereindex, @wereface, @werefndex)
  1898.       @wereimage = nil
  1899.       @wereindex = nil
  1900.       @wereface  = nil
  1901.       @werefndex = nil
  1902.       $game_player.refresh
  1903.     end
  1904.   end
  1905. end
  1906.  
  1907. #==============================================================================
  1908. # ** Game_Actor
  1909. #==============================================================================
  1910.  
  1911. class Game_Actor < Game_Battler
  1912.   #--------------------------------------------------------------------------
  1913.   # * Get Skill Object Array
  1914.   #--------------------------------------------------------------------------
  1915.   alias skills_pac_wereform skills unless $@
  1916.   def skills
  1917.     if @wereform != nil and @wereform > 0
  1918.       enemy = $data_enemies[@wereform]
  1919.       return skills_pac_wereform if enemy.nil?
  1920.       return enemy_skills(enemy)
  1921.     else
  1922.       return skills_pac_wereform
  1923.     end
  1924.   end
  1925.   #--------------------------------------------------------------------------
  1926.   # * Determine Usable Skills
  1927.   #--------------------------------------------------------------------------
  1928.   def skill_can_use?(skill)
  1929.     return super(skill)
  1930.   end
  1931.   #--------------------------------------------------------------------------
  1932.   # * Enemy Skills
  1933.   #--------------------------------------------------------------------------
  1934.   def enemy_skills(enemy)
  1935.     result = []
  1936.     for action in enemy.actions
  1937.       next unless action.kind == 1
  1938.       skill = $data_skills[action.skill_id]
  1939.       result.push(skill) unless result.include?(skill)
  1940.     end
  1941.     result.sort! { |a,b| a.id <=> b.id }
  1942.     return result.uniq
  1943.   end
  1944. end
  1945.  
  1946. #==============================================================================
  1947. # ** Scene_Battle
  1948. #==============================================================================
  1949.  
  1950. class Scene_Battle < Scene_Base
  1951.   #--------------------------------------------------------------------------
  1952.   # * Start processing
  1953.   #--------------------------------------------------------------------------
  1954.   alias start_pac_wereform start unless $@
  1955.   def start
  1956.     for member in $game_party.members do member.clear_wereforms end
  1957.     start_pac_wereform
  1958.   end
  1959.   #--------------------------------------------------------------------------
  1960.   # * End Battle
  1961.   #--------------------------------------------------------------------------
  1962.   alias battle_end_pac_wereform battle_end unless $@
  1963.   def battle_end(result)
  1964.     for member in $game_party.members do member.clear_wereforms end
  1965.     battle_end_pac_wereform(result)
  1966.   end
  1967. end
  1968.  
  1969. #===============================================================================
  1970. #
  1971. # PAC ACTOR-DEPENDENT STATS
  1972. #
  1973. #===============================================================================
  1974.  
  1975. #==============================================================================
  1976. # ** Game_Enemy
  1977. #==============================================================================
  1978.  
  1979. class Game_Enemy < Game_Battler
  1980.   #--------------------------------------------------------------------------
  1981.   # * Determine tags
  1982.   #--------------------------------------------------------------------------
  1983.   def tags
  1984.     return enemy.note.split("\r\n")
  1985.   end
  1986.   #--------------------------------------------------------------------------
  1987.   # * Get Basic Maximum HP
  1988.   #--------------------------------------------------------------------------
  1989.   def base_maxhp
  1990.     percent = actor_id = final_value = nil
  1991.     dynamic = false
  1992.     tags.each {|str|
  1993.       if str.include?('HP')
  1994.         dynamic = true
  1995.         percent = (str.gsub(/\D/,'').to_i/(str.include?('-')? -100.0 : 100.0))
  1996.       elsif str.include?('Actor')
  1997.         actor_id = (str.gsub(/\D/,'')).to_i
  1998.       end
  1999.     }
  2000.     if dynamic
  2001.       final_value = $game_actors[actor_id].base_maxhp
  2002.       final_value += ($game_actors[actor_id].base_maxhp * percent).round
  2003.       return final_value
  2004.     end
  2005.     return enemy.maxhp
  2006.   end
  2007.   #--------------------------------------------------------------------------
  2008.   # * Get Basic Maximum MP
  2009.   #--------------------------------------------------------------------------
  2010.   def base_maxmp
  2011.     percent = actor_id = final_value = nil
  2012.     dynamic = false
  2013.     tags.each {|str|
  2014.       if str.include?('MP')
  2015.         dynamic = true
  2016.         percent = (str.gsub(/\D/,'').to_i/(str.include?('-') ? -100.0 : 100.0))
  2017.       elsif str.include?('Actor')
  2018.         actor_id = (str.gsub(/\D/,'')).to_i
  2019.       end
  2020.     }
  2021.     if dynamic
  2022.       final_value = $game_actors[actor_id].base_maxmp
  2023.       final_value += ($game_actors[actor_id].base_maxmp * percent).round
  2024.       return final_value
  2025.     end
  2026.     return enemy.maxmp
  2027.   end
  2028.   #--------------------------------------------------------------------------
  2029.   # * Get Basic Maximum attack
  2030.   #--------------------------------------------------------------------------
  2031.   def base_atk
  2032.     percent = actor_id = final_value = nil
  2033.     dynamic = false
  2034.     tags.each {|str|
  2035.       if str.include?('ATK')
  2036.         dynamic = true
  2037.         percent = (str.gsub(/\D/,'').to_i/(str.include?('-') ? -100.0 : 100.0))
  2038.       elsif str.include?('Actor')
  2039.         actor_id = (str.gsub(/\D/,'')).to_i
  2040.       end
  2041.     }
  2042.     if dynamic
  2043.       final_value = $game_actors[actor_id].base_atk
  2044.       final_value += ($game_actors[actor_id].base_atk * percent).round
  2045.       return final_value
  2046.     end
  2047.     return enemy.atk
  2048.   end
  2049.   #--------------------------------------------------------------------------
  2050.   # * Get Basic defense
  2051.   #--------------------------------------------------------------------------
  2052.   def base_def
  2053.     percent = actor_id = final_value = nil
  2054.     dynamic = false
  2055.     tags.each {|str|
  2056.       if str.include?('DEF')
  2057.         dynamic = true
  2058.         percent = (str.gsub(/\D/,'').to_i/(str.include?('-') ? -100.0 : 100.0))
  2059.       elsif str.include?('Actor')
  2060.         actor_id = (str.gsub(/\D/,'')).to_i
  2061.       end
  2062.     }
  2063.     if dynamic
  2064.       final_value = $game_actors[actor_id].base_def
  2065.       final_value += ($game_actors[actor_id].base_def * percent).round
  2066.       return final_value
  2067.     end
  2068.     return enemy.def
  2069.   end
  2070.   #--------------------------------------------------------------------------
  2071.   # * Get Basic spirit
  2072.   #--------------------------------------------------------------------------
  2073.   def base_spi
  2074.     percent = actor_id = final_value = nil
  2075.     dynamic = false
  2076.     tags.each {|str|
  2077.       if str.include?('SPI')
  2078.         dynamic = true
  2079.         percent = (str.gsub(/\D/,'').to_i/(str.include?('-') ? -100.0 : 100.0))
  2080.       elsif str.include?('Actor')
  2081.         actor_id = (str.gsub(/\D/,'')).to_i
  2082.       end
  2083.     }
  2084.     if dynamic
  2085.       final_value = $game_actors[actor_id].base_spi
  2086.       final_value += ($game_actors[actor_id].base_spi * percent).round
  2087.       return final_value
  2088.     end
  2089.     return enemy.spi
  2090.   end
  2091.   #--------------------------------------------------------------------------
  2092.   # * Get Basic agility
  2093.   #--------------------------------------------------------------------------
  2094.   def base_agi
  2095.     percent = actor_id = final_value = nil
  2096.     dynamic = false
  2097.     tags.each {|str|
  2098.       if str.include?('AGI')
  2099.         dynamic = true
  2100.         percent = (str.gsub(/\D/,'').to_i/(str.include?('-') ? -100.0 : 100.0))
  2101.       elsif str.include?('Actor')
  2102.         actor_id = (str.gsub(/\D/,'')).to_i
  2103.       end
  2104.     }
  2105.     if dynamic
  2106.       final_value = $game_actors[actor_id].base_agi
  2107.       final_value += ($game_actors[actor_id].base_agi * percent).round
  2108.       return final_value
  2109.     end
  2110.     return enemy.agi
  2111.   end
  2112. end
  2113.  
  2114. #===============================================================================
  2115. #
  2116. # PAC FLASH ENEMY
  2117. #
  2118. #===============================================================================
  2119.  
  2120. #==============================================================================
  2121. # ** Game_Battler
  2122. #------------------------------------------------------------------------------
  2123. #  This class deals with battlers. It's used as a superclass of the Game_Actor
  2124. # and Game_Enemy classes.
  2125. #==============================================================================
  2126.  
  2127. class Game_Battler
  2128.   #--------------------------------------------------------------------------
  2129.   # * Public Instance Variables
  2130.   #--------------------------------------------------------------------------
  2131.   attr_accessor :stop_effect  # boolean to turn off any effect.
  2132.   #--------------------------------------------------------------------------
  2133.   # alias listing
  2134.   #--------------------------------------------------------------------------
  2135.   alias pac_fe_initialize initialize
  2136.   #--------------------------------------------------------------------------
  2137.   # * Object Initialization
  2138.   #--------------------------------------------------------------------------
  2139.   def initialize(*args)
  2140.     @stop_effect = false
  2141.     pac_fe_initialize
  2142.   end
  2143. end
  2144.  
  2145. #==============================================================================
  2146. # ** Sprite_Battler
  2147. #------------------------------------------------------------------------------
  2148. #  This sprite is used to display battlers. It observes a instance of the
  2149. # Game_Battler class and automatically changes sprite conditions.
  2150. #==============================================================================
  2151.  
  2152. class Sprite_Battler
  2153.   #--------------------------------------------------------------------------
  2154.   # alias listing
  2155.   #--------------------------------------------------------------------------
  2156.   alias pac_fe_update_effect update_effect
  2157.   #--------------------------------------------------------------------------
  2158.   # * Update Effect
  2159.   #--------------------------------------------------------------------------
  2160.   def update_effect(*args)
  2161.     if @battler.stop_effect
  2162.       @effect_duration = 1
  2163.       @battler.stop_effect = false
  2164.     end
  2165.     pac_fe_update_effect(*args)
  2166.   end
  2167. end
  2168.  
  2169. #==============================================================================
  2170. # ** Scene_Battle
  2171. #------------------------------------------------------------------------------
  2172. #  This class performs battle screen processing.
  2173. #==============================================================================
  2174.  
  2175. class Scene_Battle < Scene_Base
  2176.   #--------------------------------------------------------------------------
  2177.   # alias listing
  2178.   #--------------------------------------------------------------------------
  2179.   alias pac_fe_start_target_enemy_selection start_target_enemy_selection
  2180.   alias pac_fe_update_target_enemy_selection update_target_enemy_selection
  2181.   #--------------------------------------------------------------------------
  2182.   # * Start Target Enemy Selection
  2183.   #--------------------------------------------------------------------------
  2184.   def start_target_enemy_selection(*args)
  2185.     @fe_effect_frames = PAC::BATTLE::FLASH_TYPE == 1 ? 16 : 20
  2186.     @blink_frames = @fe_effect_frames + PAC::BATTLE::REST_FRAMES
  2187.     pac_fe_start_target_enemy_selection
  2188.   end
  2189.   #--------------------------------------------------------------------------
  2190.   # * Update Target Enemy Selection
  2191.   #--------------------------------------------------------------------------
  2192.   def update_target_enemy_selection
  2193.     old_enemy = @target_enemy_window.enemy
  2194.     pac_fe_update_target_enemy_selection
  2195.     if @target_enemy_window.nil? || old_enemy != @target_enemy_window.enemy
  2196.       old_enemy.stop_effect = true
  2197.       return if @target_enemy_window.nil?
  2198.       @blink_frames = @fe_effect_frames + PAC::BATTLE::REST_FRAMES
  2199.     end
  2200.     if @blink_frames >= @fe_effect_frames + PAC::BATTLE::REST_FRAMES
  2201.       @blink_frames = 0
  2202.       if PAC::BATTLE::FLASH_TYPE == 1
  2203.         @target_enemy_window.enemy.white_flash = true
  2204.       elsif PAC::BATTLE::FLASH_TYPE == 2
  2205.         @target_enemy_window.enemy.blink = true
  2206.       else
  2207.         p "PAC Flash Enemy: FLASH_TYPE not set to 1 or 2. Prepare for death."
  2208.         exit
  2209.       end
  2210.     end
  2211.     @blink_frames += 1
  2212.   end
  2213. end
  2214.  
  2215. #===============================================================================
  2216. #
  2217. # PAC VICTORY WINDOW
  2218. #
  2219. #===============================================================================
  2220.  
  2221. if PAC::BATTLE::USE_VICTORY == true
  2222.  
  2223. #==============================================================================
  2224. # ** Window_Victory
  2225. #------------------------------------------------------------------------------
  2226. #  This window displays the actors' status at the end of battle.
  2227. #==============================================================================
  2228.  
  2229. class Window_Victory < Window_Base
  2230.   #--------------------------------------------------------------------------
  2231.   # * Object Initialization
  2232.   #--------------------------------------------------------------------------
  2233.   def initialize(result)
  2234.     super(0, 0, 546, 32 + (WLH * ($game_party.members.size + 2)) )
  2235.     self.z = 10001
  2236.     self.contents.font.color = normal_color
  2237.     self.contents.draw_text(0, 0, self.contents.width, WLH, result[0])
  2238.     self.contents.draw_text(0, WLH, self.contents.width, WLH, result[1])
  2239.     $game_party.members.each_index do |i|
  2240.       actor = $game_party.members[i]
  2241.       ty = WLH * (i + 2)
  2242.       draw_actor_name(actor, 0, ty)
  2243.       draw_actor_hp(actor, 70, ty)
  2244.       draw_actor_mp(actor, 192, ty)
  2245.       text = sprintf(Vocab::ExpNext, Vocab::level)
  2246.       tw = contents.text_size(text).width
  2247.       self.contents.draw_text(320, ty, contents.width, WLH, text)
  2248.       self.contents.font.color = normal_color
  2249.       self.contents.draw_text(320 + tw + 16, ty,
  2250.        contents.width, WLH, actor.next_exp_s)
  2251.     end
  2252.   end
  2253. end
  2254.  
  2255. #==============================================================================
  2256. # ** Scene_Battle
  2257. #------------------------------------------------------------------------------
  2258. #  This class performs battle screen processing.
  2259. #==============================================================================
  2260.  
  2261. class Scene_Battle < Scene_Base
  2262.   #--------------------------------------------------------------------------
  2263.   # alias listing
  2264.   #--------------------------------------------------------------------------
  2265.   alias pac_vicwindow_battle_end battle_end
  2266.   alias pac_vicwindow_display_exp_and_gold display_exp_and_gold
  2267.   #--------------------------------------------------------------------------
  2268.   # * End Battle
  2269.   #     result : Results (0: win, 1: escape, 2: lose)
  2270.   #--------------------------------------------------------------------------
  2271.   def battle_end(result)
  2272.     @victory_window.dispose if result == 0
  2273.     pac_vicwindow_battle_end(result)
  2274.   end
  2275.   #--------------------------------------------------------------------------
  2276.   # * Display Gained Experince and Gold
  2277.   #--------------------------------------------------------------------------
  2278.   def display_exp_and_gold
  2279.     result = [sprintf(Vocab::ObtainExp, $game_troop.exp_total),
  2280.       sprintf(Vocab::ObtainGold, $game_troop.gold_total, Vocab::gold)]
  2281.     @victory_window = Window_Victory.new(result)
  2282.     pac_vicwindow_display_exp_and_gold
  2283.   end
  2284. end
  2285. end
  2286.  
  2287. #===============================================================================
  2288. #
  2289. # PAC SPECIAL COLLAPSE
  2290. #
  2291. #===============================================================================
  2292.  
  2293. #==============================================================================
  2294. # ** RPG::Enemy
  2295. #------------------------------------------------------------------------------
  2296. #  Data class for enemies.
  2297. #==============================================================================
  2298.  
  2299. class RPG::Enemy
  2300.   #--------------------------------------------------------------------------
  2301.   # * Collapse Animation
  2302.   #--------------------------------------------------------------------------
  2303.   def collapse_animation
  2304.     collapse_note = self.note[/\\COLLAPSE_ANIM\[(\d+)\]/i]
  2305.     @collapse_anim = collapse_note != nil ? $1.to_i : 0 if @collapse_anim.nil?
  2306.     return @collapse_anim
  2307.   end
  2308.   #--------------------------------------------------------------------------
  2309.   # * Collapse Type
  2310.   #--------------------------------------------------------------------------
  2311.   def collapse_type
  2312.     return $1.to_i if self.note[/\\COLLAPSE_TYPE\[(\d+)\]/i] != nil
  2313.     array = self.effect_ids
  2314.     if self.note[/\\COLLAPSE_TYPE_RANDOM/i] != nil
  2315.       return array[rand(array.size)]
  2316.     end
  2317.     return 0
  2318.   end
  2319.   #--------------------------------------------------------------------------
  2320.   # * Collapse Colour
  2321.   #--------------------------------------------------------------------------
  2322.   def collapse_color
  2323.     r, g, b, a = 255, 128, 128, 128
  2324.     if self.note[/\\COLLAPSE_COLOU?R\[#([\dABCDEF]+)\]/i] != nil
  2325.       r = $1[0, 2].to_i(16) if $1.size >= 2
  2326.       g = $1[2, 2].to_i(16) if $1.size >= 4
  2327.       b = $1[4, 2].to_i(16) if $1.size >= 6
  2328.       a = $1[6, 2].to_i(16) if $1.size >= 8
  2329.     end
  2330.     return r, g, b, a
  2331.   end
  2332.   #--------------------------------------------------------------------------
  2333.   # * Collapse Blend
  2334.   #--------------------------------------------------------------------------
  2335.   def collapse_blend
  2336.     return $1.to_i % 3 if self.note[/\\COLLAPSE_BLEND\[(\d+)\]/i] != nil
  2337.     return 1
  2338.   end
  2339.   #--------------------------------------------------------------------------
  2340.   # * Effect IDs
  2341.   #--------------------------------------------------------------------------
  2342.   def effect_ids
  2343.     effects = []
  2344.     for i in 0...16 do effects.push (i) end
  2345.     return effects
  2346.   end
  2347. end
  2348.  
  2349. #==============================================================================
  2350. # ** Game_Enemy
  2351. #------------------------------------------------------------------------------
  2352. #  This class handles enemy characters. It's used within the Game_Troop class
  2353. # ($game_troop).
  2354. #==============================================================================
  2355.  
  2356. class Game_Enemy
  2357.   #--------------------------------------------------------------------------
  2358.   # * Public Instance Variable
  2359.   #--------------------------------------------------------------------------
  2360.   attr_reader   :collapse_type
  2361.   #--------------------------------------------------------------------------
  2362.   # alias listing
  2363.   #--------------------------------------------------------------------------
  2364.   alias pac_spec_collapse_perform_collapse perform_collapse
  2365.   #--------------------------------------------------------------------------
  2366.   # * Perform Collapse
  2367.   #--------------------------------------------------------------------------
  2368.   def perform_collapse(*args)
  2369.     if enemy.collapse_animation > 0 and $game_temp.in_battle and dead?
  2370.       @collapse = true
  2371.       self.animation_id = enemy.collapse_animation
  2372.     else
  2373.       pac_spec_collapse_perform_collapse(*args)
  2374.     end
  2375.     @collapse_type = enemy.collapse_type
  2376.   end
  2377. end
  2378.  
  2379. #==============================================================================
  2380. # ** Sprite_Battler
  2381. #------------------------------------------------------------------------------
  2382. #  This sprite is used to display battlers. It observes a instance of the
  2383. # Game_Battler class and automatically changes sprite conditions.
  2384. #==============================================================================
  2385.  
  2386. class Sprite_Battler
  2387.   #--------------------------------------------------------------------------
  2388.   # alias listing
  2389.   #--------------------------------------------------------------------------
  2390.   alias pac_spec_collapse_update_collapse update_collapse
  2391.   alias pac_spec_collapse_setx x= unless $@
  2392.   alias pac_spec_collapse_sety y= unless $@
  2393.   #--------------------------------------------------------------------------
  2394.   # * Update Collapse
  2395.   #--------------------------------------------------------------------------
  2396.   def update_collapse(*args)
  2397.     if @battler.actor?
  2398.       pac_spec_collapse_update_collapse(*args) # Run Original Method
  2399.       return
  2400.     end
  2401.     # If animation, hold off on executing collapse
  2402.     if self.animation?
  2403.       # Restore lost time
  2404.       @effect_duration += 1
  2405.       return
  2406.     end
  2407.     execute_special_collapse (@battler.collapse_type)
  2408.     pac_spec_collapse_update_collapse(*args) # Run Original Method
  2409.     self.color.set(*@battler.enemy.collapse_color)
  2410.     self.blend_type = @battler.enemy.collapse_blend
  2411.     # Update Duplicate Sprite Opacity
  2412.     @dup_sprite.opacity = self.opacity if @dup_sprite != nil
  2413.     # If Ending the effect
  2414.     if @effect_duration == 0
  2415.       # Restore Zoom
  2416.       self.zoom_x = 1
  2417.       self.zoom_y = 1
  2418.       # Free @dup_sprite (not dispose because of Cache)
  2419.       @dup_sprite = nil
  2420.     elsif @effect_duration == 47 && @battler.enemy.collapse_animation > 0
  2421.       # Play Collapse SE once animation has finished.
  2422.       Sound.play_enemy_collapse
  2423.     end
  2424.   end
  2425.   #--------------------------------------------------------------------------
  2426.   # * Set X
  2427.   #--------------------------------------------------------------------------
  2428.   def x=(n, *args)
  2429.     # Override general x setting when collapsing
  2430.     return if @effect_type == COLLAPSE and n == @battler.screen_x
  2431.     pac_spec_collapse_setx(n, *args)
  2432.   end
  2433.   #--------------------------------------------------------------------------
  2434.   # * Set Y
  2435.   #--------------------------------------------------------------------------
  2436.   def y=(n, *args)
  2437.     # Override general y setting when collapsing
  2438.     return if @effect_type == COLLAPSE and n == @battler.screen_y
  2439.     pac_spec_collapse_sety(n, *args)
  2440.   end
  2441.   #--------------------------------------------------------------------------
  2442.   # * Create Duplicate Sprite
  2443.   #--------------------------------------------------------------------------
  2444.   def create_dup_sprite (split_type = 0)
  2445.     # Create new sprite of the same class and set components
  2446.     @dup_sprite = self.class.new (self.viewport, @battler)
  2447.     @dup_sprite.x, @dup_sprite.y = self.x, self.y
  2448.     @dup_sprite.blend_type = 1
  2449.     @dup_sprite.color.set(255, 128, 128, 128)
  2450.     @dup_sprite.update
  2451.     if split_type == 0 # Vertical Split
  2452.       @dup_sprite.src_rect.width = @dup_sprite.ox
  2453.       self.src_rect.x = self.ox
  2454.       self.x += self.ox
  2455.     elsif split_type == 1 # Horizontal Split
  2456.       @dup_sprite.src_rect.height = @dup_sprite.oy / 2
  2457.       self.src_rect.y = self.oy / 2
  2458.       self.y += self.oy / 2
  2459.     end
  2460.   end
  2461.   #--------------------------------------------------------------------------
  2462.   # * Execute Special Collapse
  2463.   #    collapse_type (type of collapse)
  2464.   #--------------------------------------------------------------------------
  2465.   def execute_special_collapse (collapse_type)
  2466.     case collapse_type
  2467.     when 1 # Shrink
  2468.       self.zoom_x -= 0.02
  2469.       self.zoom_y -= 0.02
  2470.       self.y -= (0.01*self.height)
  2471.     when 2 # Horizontal Expansion
  2472.       self.zoom_x += 0.05
  2473.       self.zoom_y -= 0.02
  2474.     when 3 # Vertical Expansion
  2475.       self.zoom_y += 0.05
  2476.       self.zoom_x -= 0.02
  2477.     when 4 # Spring Ascent
  2478.       if @effect_duration >= 24 then
  2479.         self.zoom_y = [self.zoom_y - 0.02, 0].max
  2480.         self.zoom_x = [self.zoom_x + 0.01, 1.24].min
  2481.       else
  2482.         self.zoom_x -= 0.115
  2483.         self.zoom_y += 0.6
  2484.       end
  2485.     when 5 # Rotate
  2486.       self.zoom_x -= 0.03
  2487.       self.zoom_y += 0.05
  2488.       self.angle += 7.5
  2489.     when 6 # Shake Descent
  2490.       if @effect_duration >= 44
  2491.         self.ox -= 1
  2492.       else
  2493.         self.ox += ((@effect_duration / 4) % 2) == 0 ? 2 : -2
  2494.       end
  2495.       self.src_rect.y -= self.bitmap.rect.height / 48
  2496.     when 7 # Vertical Division; Vertical Movement
  2497.       create_dup_sprite (0) if @effect_duration == 47 # Split Vertically
  2498.       self.y += [self.oy / 96, 1].max
  2499.       @dup_sprite.y -= [@dup_sprite.oy / 96, 1].max
  2500.     when 8 # Horizontal Division; Horizontal Movement
  2501.       create_dup_sprite (1) if @effect_duration == 47 # Split Horizontally
  2502.       self.x += [self.ox / 48, 1].max
  2503.       @dup_sprite.x -= [@dup_sprite.ox / 48, 1].max
  2504.     when 9 # Vertical Division; Horizontal Movement
  2505.       create_dup_sprite (0) if @effect_duration == 47 # Split Vertically
  2506.       self.x += [self.ox / 48, 1].max
  2507.       @dup_sprite.x -= [@dup_sprite.ox / 48, 1].max
  2508.     when 10 # Horizontal Division; Vertical Movement
  2509.       create_dup_sprite (1) if @effect_duration == 47 # Split Horizontally
  2510.       self.y += [self.oy / 96, 1].max
  2511.       @dup_sprite.y -= [@dup_sprite.oy / 96, 1].max
  2512.     when 11 # Wave
  2513.       self.wave_amp += 1
  2514.     when 12 # Blur
  2515.       self.bitmap = self.bitmap.dup if @effect_duration == 47
  2516.       self.bitmap.blur if @effect_duration % 4 == 0
  2517.     when 13 # Fast Rotate and Shrink
  2518.       self.angle += 48 - @effect_duration
  2519.       execute_special_collapse (1)
  2520.     when 14 # Eraser
  2521.       self.bush_opacity = 0
  2522.       self.bush_depth += (self.height / 48.0).ceil
  2523.     when 15 # Pixel Eraser
  2524.       if @effect_duration == 47
  2525.         self.bitmap = self.bitmap.dup
  2526.         @pixels_to_erase = []
  2527.         for i in 0...self.bitmap.width
  2528.           for j in 0...self.bitmap.height
  2529.             @pixels_to_erase.push ([i, j])
  2530.           end
  2531.         end
  2532.         @pixel_erase_rate = @pixels_to_erase.size / 48
  2533.       end
  2534.       erase_color = Color.new (255, 255, 255, 0)
  2535.       @pixel_erase_rate.times do
  2536.         x, y = @pixels_to_erase.delete_at (rand (@pixels_to_erase.size))
  2537.         self.bitmap.set_pixel (x, y, erase_color)
  2538.       end
  2539.     end
  2540.   end
  2541. end
  2542.  
  2543. #==============================================================================
  2544. # ** RPG::Enemy
  2545. #------------------------------------------------------------------------------
  2546. #  Data class for enemies.
  2547. #==============================================================================
  2548.  
  2549. class RPG::Enemy
  2550.   #--------------------------------------------------------------------------
  2551.   # public instance variables
  2552.   #--------------------------------------------------------------------------
  2553.   attr_accessor :swaps
  2554.   #--------------------------------------------------------------------------
  2555.   # common cache: pac_cache_enemy_ae
  2556.   #--------------------------------------------------------------------------
  2557.   def pac_cache_enemy_ae
  2558.     return if @cached_enemy_ae; @cached_enemy_ae = true
  2559.     @swaps = []
  2560.     self.note.split(/[\r\n]+/).each { |line|
  2561.       case line
  2562.       when /<(?:SWAP|PACswaps):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  2563.         $1.scan(/\d+/).each { |num| @swaps.push(num.to_i) if num.to_i > 0 }
  2564.       end
  2565.     }
  2566.   end
  2567. end
  2568.  
  2569. #==============================================================================
  2570. # ** Scene_Title
  2571. #------------------------------------------------------------------------------
  2572. #  This class performs the title screen processing.
  2573. #==============================================================================
  2574.  
  2575. class Scene_Title < Scene_Base
  2576.   #--------------------------------------------------------------------------
  2577.   # alias listing
  2578.   #--------------------------------------------------------------------------
  2579.   alias load_bt_database_ae load_bt_database unless $@
  2580.   alias load_database_ae load_database unless $@
  2581.   #--------------------------------------------------------------------------
  2582.   # * Load Battle Test Database
  2583.   #--------------------------------------------------------------------------
  2584.   def load_bt_database
  2585.     load_bt_database_ae
  2586.     load_ae_cache
  2587.   end
  2588.   #--------------------------------------------------------------------------
  2589.   # * Load Database
  2590.   #--------------------------------------------------------------------------
  2591.   def load_database
  2592.     load_database_ae
  2593.     load_ae_cache
  2594.   end
  2595.   #--------------------------------------------------------------------------
  2596.   # * Load Advanced Enemies Cache
  2597.   #--------------------------------------------------------------------------
  2598.   def load_ae_cache
  2599.     groups = [$data_enemies]
  2600.     for group in groups
  2601.       for obj in group
  2602.         next if obj == nil
  2603.         obj.pac_cache_enemy_ae if obj.is_a?(RPG::Enemy)
  2604.       end
  2605.     end
  2606.   end
  2607. end
  2608.  
  2609. #===============================================================================
  2610. #
  2611. # PAC DAMAGE POPUP
  2612. #
  2613. #===============================================================================
  2614.  
  2615. if PAC::BATTLE::USE_POPUP
  2616.  
  2617. #==============================================================================
  2618. # ** Game_System
  2619. #------------------------------------------------------------------------------
  2620. #  This class handles system-related data. Also manages vehicles and BGM, etc.
  2621. # The instance of this class is referenced by $game_system.
  2622. #==============================================================================
  2623.  
  2624. class Game_System
  2625.   #--------------------------------------------------------------------------
  2626.   # Public Instance Variables
  2627.   #--------------------------------------------------------------------------
  2628.   attr_accessor :battle_popup_font
  2629.   attr_accessor :battle_popup_size
  2630.   attr_accessor :battle_popup_colour
  2631.   #--------------------------------------------------------------------------
  2632.   # Alias listing
  2633.   #--------------------------------------------------------------------------
  2634.   alias pac_damage_popup_initialize initialize
  2635.   #--------------------------------------------------------------------------
  2636.   # * Object Initialization
  2637.   #--------------------------------------------------------------------------
  2638.   def initialize
  2639.     pac_damage_popup_initialize # Usual method
  2640.     @battle_popup_font = PAC::BATTLE::POPUP_FONT  # Initialize font.
  2641.     @battle_popup_size = PAC::BATTLE::POPUP_SIZE  # Initialize size.
  2642.     @battle_popup_colour = PAC::BATTLE::POPUP_COLOUR  # Initialize colour.
  2643.   end
  2644. end
  2645.  
  2646. #==============================================================================
  2647. # ** Sprite_Base
  2648. #------------------------------------------------------------------------------
  2649. #  A sprite class with animation display processing added.
  2650. #==============================================================================
  2651.  
  2652. class Sprite_Base < Sprite
  2653.   #--------------------------------------------------------------------------
  2654.   # alias listing
  2655.   #--------------------------------------------------------------------------
  2656.   alias pac_popup_initialize initialize
  2657.   alias pac_popup_update update
  2658.   #--------------------------------------------------------------------------
  2659.   # * Object Initialization
  2660.   #--------------------------------------------------------------------------
  2661.   def initialize(*args)
  2662.     pac_popup_initialize(*args)
  2663.     @_damage_duration = 0
  2664.   end
  2665.   #--------------------------------------------------------------------------
  2666.   # * Frame Update
  2667.   #--------------------------------------------------------------------------
  2668.   def update
  2669.     pac_popup_update
  2670.     if @_damage_duration > 0
  2671.       @_damage_duration -= 1
  2672.       case @_damage_duration
  2673.       when 38..39
  2674.         @_damage_sprite.y -= 4
  2675.       when 36..37
  2676.         @_damage_sprite.y -= 2
  2677.       when 34..35
  2678.         @_damage_sprite.y += 2
  2679.       when 28..33
  2680.         @_damage_sprite.y += 4
  2681.       end
  2682.         @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
  2683.       if @_damage_duration == 0
  2684.         dispose_damage
  2685.       end
  2686.     end
  2687.   end
  2688.   #--------------------------------------------------------------------------
  2689.   # * Display Damage
  2690.   #--------------------------------------------------------------------------
  2691.   def damage(value)
  2692.     dispose_damage
  2693.     damage_string = value.is_a?(Numeric) ? value.abs.to_s : value.to_s
  2694.     bitmap = Bitmap.new(160, 48)
  2695.     bitmap.font.name = $game_system.battle_popup_font
  2696.     bitmap.font.size = $game_system.battle_popup_size
  2697.     bitmap.font.color.set(0, 0, 0)
  2698.     #--------------------------------------------------------------------------
  2699.     bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  2700.     bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  2701.     bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  2702.     bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  2703.     #--------------------------------------------------------------------------
  2704.     if value.is_a?(Numeric) and value < 0
  2705.       bitmap.font.color.set(176, 255, 144)
  2706.     else
  2707.       if $game_system.battle_popup_colour.is_a?(Array)
  2708.         a = $game_system.battle_popup_colour
  2709.         bitmap.font.color.set(*a)
  2710.       else
  2711.         case $game_system.battle_popup_colour
  2712.         when :red; bitmap.font.color.set(255, 0, 0)
  2713.         when :white; bitmap.font.color.set(255, 255, 255)
  2714.         when :black; bitmap.font.color.set(0, 0, 0)
  2715.         when :green; bitmap.font.color.set(0, 255, 0)
  2716.         when :blue; bitmap.font.color.set(0, 0, 255)
  2717.         when :grey; bitmap.font.color.set(125, 125, 125)
  2718.         when :brown; bitmap.font.color.set(128, 64, 32)
  2719.         when :orange; bitmap.font.color.set(255, 99, 20)
  2720.         when :yellow; bitmap.font.color.set(255, 255, 0)
  2721.         when :cyan; bitmap.font.color.set(0, 255, 255)
  2722.         when :turquoise; bitmap.font.color.set(0, 255, 128)
  2723.         when :purple; bitmap.font.color.set(128, 0, 255)
  2724.         when :pink; bitmap.font.color.set(255, 0, 255)
  2725.         else; bitmap.font.color.set(255, 255, 255)
  2726.         end
  2727.       end
  2728.     end
  2729.     #--------------------------------------------------------------------------
  2730.     bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  2731.     #--------------------------------------------------------------------------
  2732.     @_damage_sprite = Sprite.new(self.viewport)
  2733.     @_damage_sprite.bitmap = bitmap
  2734.     @_damage_sprite.ox = 80
  2735.     @_damage_sprite.oy = 20
  2736.     @_damage_sprite.x = self.x + PAC::BATTLE::POPUP_XPLUS
  2737.     @_damage_sprite.y = (self.y - self.oy / 2) + PAC::BATTLE::POPUP_YPLUS
  2738.     @_damage_sprite.z = 3000
  2739.     @_damage_duration = 40
  2740.   end
  2741.   #--------------------------------------------------------------------------
  2742.   # * Dispose of Damage Sprite
  2743.   #--------------------------------------------------------------------------
  2744.   def dispose_damage
  2745.     if @_damage_sprite != nil
  2746.       @_damage_sprite.bitmap.dispose
  2747.       @_damage_sprite.dispose
  2748.       @_damage_sprite = nil
  2749.       @_damage_duration = 0
  2750.     end
  2751.   end
  2752. end
  2753.  
  2754. #==============================================================================
  2755. # ** Game_Battler
  2756. #------------------------------------------------------------------------------
  2757. #  This class deals with battlers. It's used as a superclass of the Game_Actor
  2758. # and Game_Enemy classes.
  2759. #==============================================================================
  2760.  
  2761. class Game_Battler
  2762.   #--------------------------------------------------------------------------
  2763.   # Public Instance Variables
  2764.   #--------------------------------------------------------------------------
  2765.   attr_accessor :damage
  2766.   #--------------------------------------------------------------------------
  2767.   # alias listing
  2768.   #--------------------------------------------------------------------------
  2769.   alias pac_popup_clear_sprite_effects clear_sprite_effects
  2770.   #--------------------------------------------------------------------------
  2771.   # * Clear Variable Used for Sprite Communication
  2772.   #--------------------------------------------------------------------------
  2773.   def clear_sprite_effects
  2774.     @damage = 0
  2775.     pac_popup_clear_sprite_effects
  2776.   end
  2777. end
  2778.  
  2779. #==============================================================================
  2780. # ** Sprite_Battler
  2781. #------------------------------------------------------------------------------
  2782. #  This sprite is used to display battlers. It observes a instance of the
  2783. # Game_Battler class and automatically changes sprite conditions.
  2784. #==============================================================================
  2785.  
  2786. class Sprite_Battler < Sprite_Base
  2787.   #--------------------------------------------------------------------------
  2788.   # Constants
  2789.   #--------------------------------------------------------------------------
  2790.   DAMAGE = 7
  2791.   #--------------------------------------------------------------------------
  2792.   # alias listing
  2793.   #--------------------------------------------------------------------------
  2794.   alias pac_popup_setup_new_effect setup_new_effect
  2795.   #--------------------------------------------------------------------------
  2796.   # * Set New Effect
  2797.   #--------------------------------------------------------------------------
  2798.   def setup_new_effect
  2799.     pac_popup_setup_new_effect
  2800.     if @battler.damage != 0
  2801.       damage(@battler.damage)
  2802.       @effect_type = DAMAGE
  2803.       @battler.damage = 0
  2804.     end
  2805.   end
  2806. end
  2807.  
  2808. #==============================================================================
  2809. # ** Scene_Battle
  2810. #------------------------------------------------------------------------------
  2811. #  This class performs battle screen processing.
  2812. #==============================================================================
  2813.  
  2814. class Scene_Battle < Scene_Base
  2815.   #--------------------------------------------------------------------------
  2816.   # alias listing
  2817.   #--------------------------------------------------------------------------
  2818.   alias pac_popup_display_action_effects display_action_effects
  2819.   #--------------------------------------------------------------------------
  2820.   # * Show Action Results
  2821.   #     target : Target
  2822.   #     obj    : Skill or item
  2823.   #--------------------------------------------------------------------------
  2824.   def display_action_effects(target, *args)
  2825.     unless target.skipped
  2826.       target.damage = target.hp_damage if target.is_a?(Game_Enemy)
  2827.     end
  2828.     pac_popup_display_action_effects(target, *args)
  2829.   end
  2830. end
  2831. end
  2832.  
  2833. #===============================================================================
  2834. #
  2835. # PAC BATTLE COUNT
  2836. #
  2837. #===============================================================================
  2838.  
  2839. #==============================================================================
  2840. # ** Game_Interpreter
  2841. #------------------------------------------------------------------------------
  2842. #  An interpreter for executing event commands. This class is used within the
  2843. # Game_Map, Game_Troop, and Game_Event classes.
  2844. #==============================================================================
  2845.  
  2846. class Game_Interpreter
  2847.   #--------------------------------------------------------------------------
  2848.   # * Reset all battle counters
  2849.   #--------------------------------------------------------------------------
  2850.   def reset_battle_count
  2851.     $game_system.reset_battle_count
  2852.   end
  2853.   #--------------------------------------------------------------------------
  2854.   # * Simple Battle Count Commands
  2855.   #--------------------------------------------------------------------------
  2856.   battle_count_commands = ["battle", "victory", "escape", "lose",
  2857.     "total_defeat", "total_dead"]
  2858.   battle_count_commands.each { |command|
  2859.     battle_count_method = %Q(
  2860.     def get_#{command}_count(id = 0)
  2861.       n = $game_system.get_#{command}_count
  2862.       if id > 0
  2863.         $game_variables[id] = n
  2864.         $game_map.need_refresh = true
  2865.       end
  2866.       return n
  2867.     end
  2868.     )
  2869.     eval(battle_count_method)
  2870.   }
  2871.   #--------------------------------------------------------------------------
  2872.   # * Advanced Battle Count Commands
  2873.   #--------------------------------------------------------------------------
  2874.   advanced_count_commands = ["defeat", "dead"]
  2875.   advanced_count_commands.each { |command|
  2876.     advanced_count_method = %Q(
  2877.     def get_#{command}_count(id1, id2 = 0)
  2878.       n = $game_system.get_#{command}_count(id1)
  2879.       if id2 > 0
  2880.         $game_variables[id2] = n
  2881.         $game_map.need_refresh = true
  2882.       end
  2883.       return n
  2884.     end
  2885.     )
  2886.     eval(advanced_count_method)
  2887.   }
  2888. end
  2889.  
  2890. #==============================================================================
  2891. # ** Game_System
  2892. #------------------------------------------------------------------------------
  2893. #  This class handles system-related data. Also manages vehicles and BGM, etc.
  2894. # The instance of this class is referenced by $game_system.
  2895. #==============================================================================
  2896.  
  2897. class Game_System
  2898.   #--------------------------------------------------------------------------
  2899.   # Public Instance Variables
  2900.   #--------------------------------------------------------------------------
  2901.   attr_accessor :battle_count
  2902.   attr_accessor :victory_count
  2903.   attr_accessor :escape_count
  2904.   attr_accessor :lose_count
  2905.   attr_accessor :defeat_count
  2906.   attr_accessor :dead_count
  2907.   #--------------------------------------------------------------------------
  2908.   # Alias listing
  2909.   #--------------------------------------------------------------------------
  2910.   alias pac_battle_counter_initialize initialize
  2911.   #--------------------------------------------------------------------------
  2912.   # * Object Initialization
  2913.   #--------------------------------------------------------------------------
  2914.   def initialize
  2915.     pac_battle_counter_initialize
  2916.     reset_battle_counter
  2917.   end
  2918.   #--------------------------------------------------------------------------
  2919.   # * Clear all battle counters
  2920.   #--------------------------------------------------------------------------
  2921.   def reset_battle_counter
  2922.     @battle_count = 0
  2923.     @victory_count = 0
  2924.     @escape_count = 0
  2925.     @lose_count = 0
  2926.     @defeat_count = []
  2927.     @dead_count = []
  2928.   end
  2929.   #--------------------------------------------------------------------------
  2930.   # * Simple Battle Count Commands
  2931.   #--------------------------------------------------------------------------
  2932.   battle_count_commands = ["battle", "victory", "escape", "lose"]
  2933.   battle_count_commands.each { |command|
  2934.     battle_count_method = %Q(
  2935.     def get_#{command}_count
  2936.       reset_battle_counter if @#{command}_count == nil
  2937.       return @#{command}_count
  2938.     end
  2939.     )
  2940.     eval(battle_count_method)
  2941.   }
  2942.   #--------------------------------------------------------------------------
  2943.   # * Advanced Battle Count Commands
  2944.   #--------------------------------------------------------------------------
  2945.   advanced_count_commands = [["defeat", "enemies"], ["dead", "actors"]]
  2946.   advanced_count_commands.each { |command|
  2947.     advanced_count_methods = %Q(
  2948.     def get_#{command[0]}_count(id)
  2949.       reset_battle_counter if #{command[0]} == nil
  2950.       @#{command[0]}_count[id] = 0 if @#{command[0]}_count[id] == nil
  2951.       return @#{command[0]}_count[id]
  2952.     end
  2953.     def add_#{command[0]}_count(id)
  2954.       reset_battle_counter if @#{command[0]}_count[id] == nil
  2955.       @#{command[0]}_count[id] = 0 if @#{command[0]}_count[id] == nil
  2956.       @#{command[0]}_count[id] += 1
  2957.     end
  2958.     def total_#{command[0]}_count
  2959.       n = 0
  2960.       for i in 1...$data_#{command[1]}.size
  2961.         n += get_#{command[0]}_count(i)
  2962.       end
  2963.       return n
  2964.     end
  2965.     )
  2966.     eval(advanced_count_methods)
  2967.   }
  2968. end
  2969.  
  2970. #==============================================================================
  2971. # ** Scene_Battle
  2972. #------------------------------------------------------------------------------
  2973. #  This class performs battle screen processing.
  2974. #==============================================================================
  2975.  
  2976. class Scene_Battle < Scene_Base
  2977.   #--------------------------------------------------------------------------
  2978.   # Alias listing
  2979.   #--------------------------------------------------------------------------
  2980.   alias pac_battle_counter_post_start post_start
  2981.   alias pac_battle_counter_battle_end battle_end
  2982.   alias pac_battle_counter_execute_action execute_action
  2983.   #--------------------------------------------------------------------------
  2984.   # * Post-Start Processing
  2985.   #--------------------------------------------------------------------------
  2986.   def post_start(*args)
  2987.     $game_system.battle_count += 1
  2988.     pac_battle_counter_post_start(*args)
  2989.   end
  2990.   #--------------------------------------------------------------------------
  2991.   # * End Battle
  2992.   #     result : Results (0: win, 1: escape, 2:lose)
  2993.   #--------------------------------------------------------------------------
  2994.   def battle_end(result, *args)
  2995.     unless @battle_count_added
  2996.       case result
  2997.       when 0  # Victory
  2998.         $game_system.victory_count += 1
  2999.       when 1  # Escape
  3000.         $game_system.escape_count += 1
  3001.       when 2  # Defeat
  3002.         $game_system.lose_count += 1
  3003.       end
  3004.       $game_troop.dead_members.each { |enemy|
  3005.         $game_system.add_defeat_count(enemy.enemy.id)
  3006.       }
  3007.       @battle_count_added = true
  3008.     end
  3009.     pac_battle_counter_battle_end(result, *args)
  3010.   end
  3011.   #--------------------------------------------------------------------------
  3012.   # * Execute Battle Actions
  3013.   #--------------------------------------------------------------------------
  3014.   def execute_action(*args)
  3015.     last_exist_actors = $game_party.existing_members
  3016.     pac_battle_counter_execute_action(*args)
  3017.     dead_actors = last_exist_actors - $game_party.existing_members
  3018.     dead_actors.each { |actor|
  3019.       $game_system.add_dead_count(actor.id)
  3020.     }
  3021.   end
  3022. end
  3023.  
  3024. if !$pac["Battle Addons Setup"] || !$pac["Battle Addons Setup"].is_a?(Array) ||
  3025.  $pac["Battle Addons Setup"][0] < 1.7
  3026.   p "You require PAC Battle Addons Setup 1.7 or higher."
  3027.   exit
  3028. end
  3029.  
  3030. #===============================================================================
  3031. #
  3032. # END OF SCRIPT
  3033. #
  3034. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement