I will try to help you out. Try doing this:
In Scene_Battle 4 Add this line:
contador = 0
while target.states.include?(2) == true and contador < 9
target = $game_party.smooth_target_actor(rand($game_party.actors.size))
contador += 1
end
if contador == 9
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
Just after this one:
# If action battler is enemy
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
In Scene_Battle 3, after this:
#--------------------------------------------------------------------------
# * Frame Updat (actor command phase : enemy selection)
#--------------------------------------------------------------------------
change the whole code block, to this one:
def update_phase3_enemy_select
# Update enemy arrow
@enemy_arrow.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End enemy selection
end_enemy_select
return
end
# If C button was pressed
if Input.trigger?(Input::C) and $game_troop.enemies[@enemy_arrow.index].states.include?("put the id of your state") != true
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.target_index = @enemy_arrow.index
# End enemy selection
end_enemy_select
# If skill window is showing
if @skill_window != nil
# End skill selection
end_skill_select
end
# If item window is showing
if @item_window != nil
# End item selection
end_item_select
end
# Go to command input for next actor
phase3_next_actor
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.cancel_se)
end
end
Now, in those code, just change the part that says: "put the id of your state" to whatever you like.
The enemies will not attack any party member who have the state effect of your choice. Also, the player will not be able to attack an enemy with the state effect.