CyberForte

DoW Multiact

Oct 10th, 2017
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.74 KB | None | 0 0
  1. # Enemy Multiact
  2. # v 1.0
  3. # By Mithran
  4. # Requested by Flood_Master / Netmonmatt
  5. # Allows an enemy to act more than once per round
  6. # Rules:
  7. # Actors do not get extra turns
  8. # Turn-based auto removal of states occurs only after the FINAL action
  9. # Extra turns do not decrement state counter (only the final turn)
  10. # For default battle system only.
  11.  
  12. # Add the following to the note section:
  13. # <enemy extra actions n>
  14. # Where n is the number of extra actions you want an enemy to have.
  15. # The note tag can be given to an enemy note or a states note.
  16. # Extra actions through notes and state notes stack.
  17.  
  18. # Install: Place in materials section above main.
  19. # Please do not redistribute without asking!
  20.  
  21. class Scene_Battle
  22.  
  23.   alias process_action_orig_mith_multiact process_action unless $@
  24.   def process_action
  25.     @extra_action_number_mith_multiact = 0
  26.     @extra_actions_mith_multiact = false
  27.     process_action_orig_mith_multiact
  28.     return if @active_battler.nil?
  29.     return unless @active_battler.extra_actions_mith_multiact > 0
  30.     @extra_actions_mith_multiact = true
  31.     @extra_action_number_mith_multiact = @active_battler.extra_actions_mith_multiact
  32.     for i in 1..@active_battler.extra_actions_mith_multiact
  33.       process_battle_event
  34.       @active_battler.make_action
  35.       @last_battler_mith_multiact = @active_battler
  36.       process_action_orig_mith_multiact
  37.       @active_battler = @last_battler_mith_multiact
  38.       process_battle_event
  39.       @extra_action_number_mith_multiact -= 1
  40.     end
  41.     @extra_actions_mith_multiact = false
  42.   end
  43.  
  44.   alias set_next_active_battler_orig_mith_multiact set_next_active_battler unless $@
  45.   def set_next_active_battler
  46.     if @extra_actions_mith_multiact
  47.       if $game_troop.forcing_battler != nil
  48.         @last_battler_mith_multiact = @active_battler
  49.         @active_battler = $game_troop.forcing_battler
  50.         $game_troop.forcing_battler = nil
  51.       end
  52.     else
  53.       set_next_active_battler_orig_mith_multiact
  54.     end
  55.   end
  56.  
  57.   alias remove_states_auto_orig_mith_multiact remove_states_auto unless $@
  58.   def remove_states_auto
  59.     if @active_battler.extra_actions_mith_multiact <= 0
  60.       remove_states_auto_orig_mith_multiact
  61.       # Remove states auto on original turn if no multiactions
  62.     elsif @extra_actions_mith_multiact && @extra_action_number_mith_multiact <= 1
  63.       remove_states_auto_orig_mith_multiact
  64.       # Otherwise, remove states auto if on last multiaction
  65.     end
  66.   end
  67.  
  68. end
  69.  
  70. class Game_Battler
  71.  
  72.   def extra_actions_mith_multiact
  73.     return 0 if actor?
  74.     n = 0
  75.     n += $1.to_i if enemy.note =~ /<enemy extra actions (\d+)>/i
  76.     for state in states
  77.       n += $1.to_i if state.note =~ /<enemy extra actions (\d+)>/i
  78.     end
  79.     return n
  80.   end
  81.  
  82. end
Advertisement
Add Comment
Please, Sign In to add comment