#============================================================================== # ** ExEnemy_DoubleAction (MACKIE) #------------------------------------------------------------------------------ # This script allows enemy characters to act twice in one turn. #============================================================================== # Notebox string identifier for setting the probability of acting twice. # Enemies with "EXENM_DOUBLEACT_SIGNATURE [probability]" will act twice at # the given rate of probability, which is determined each turn. # (Example) *DOUBLE_ACTION[50] => enemy will act twice 50% of the time. EXENM_DOUBLEACT_SIGNATURE = "*DOUBLE_ACTION" # Default probability of acting twice. # Applies when no [probability] is given with "EXENM_DOUBLEACT_SIGNATURE". # Possible values are 1~100(%) EXENM_DOUBLEACT_PROBARITY = 100 #------------------------------------------------------------------------------ class Game_Enemy alias _exedblact_initialize initialize unless $@ #-------------------------------------------------------------------------- # * Public Instance Variables (Definition added) #-------------------------------------------------------------------------- attr_accessor :attacked # Secondary action flag #-------------------------------------------------------------------------- # * Object Initialization (Definition added) # index : index in troop # enemy_id : enemy ID #-------------------------------------------------------------------------- def initialize(index, enemy_id) _exedblact_initialize(index, enemy_id) @attacked = false end #-------------------------------------------------------------------------- # * Determine if a second action can be taken #-------------------------------------------------------------------------- def double_action? return false if @attacked sig = EXENM_DOUBLEACT_SIGNATURE return false unless enemy.note[/#{Regexp.quote sig}\[?(\d*)\]?/].to_a[0] prob = $1.to_i prob = EXENM_DOUBLEACT_PROBARITY if prob == 0 @attacked = true return rand(100) < prob end end class Game_Troop alias _exedblact_increase_turn increase_turn unless $@ #-------------------------------------------------------------------------- # * Increase Turns (Definition added) #-------------------------------------------------------------------------- def increase_turn _exedblact_increase_turn for enemy in members enemy.attacked = false end end end class Scene_Battle alias _exedblact_set_next_active_battler set_next_active_battler #-------------------------------------------------------------------------- # * Set Next Battler to Act (Definition added) # When the [Force Battle Action] event command is being performed, set # that battler and remove him from the list. Otherwise, get from top of # list. If an actor that is not currently in the party is obtained (may # occur if the index is nil, just after leaving via a battle event, etc.) # it is skipped. #-------------------------------------------------------------------------- def set_next_active_battler if @active_battler.is_a?(Game_Enemy) return @active_battler.make_action if @active_battler.double_action? end _exedblact_set_next_active_battler end end