One-Time Evasion

I wish to implement a state that adds 100% evasion, but is removed after 1 attack has been evaded. Is there a way to process eventing specifically upon successful evasion?
Here's my idea how it works. The first method is used to determine the chance to evade, so if you have the 100% evade state, it will remove the state and return 1 (highest in rand). The second method will call a common event I believe, but if you're planning to use the Troop Page, you can replace the common event reservation with a $game_switches[EVADECE] = true (Remember to turn off switch in page),

Code:
class Game_Battler < Game_BattlerBase
  alias :dl_100_item_eva :item_eva
  def item_eva(user, item)
    if state?(FULLEVADE) #Change these two to your evade state
      remove_state(FULLEVADE)
      return 1
    end
    return dl_100_item_eva(user, item)
  end

  alias :dl_100_item_apply :item_apply
  def item_apply(user, item)
    dl_100_item_apply(user, item)
     #Change EVADECE to Common Event ID
   $game_temp.reserve_common_event(EVADECE) if @result.evaded
   end
end
This works, thank you!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/one-time-evasion.94027/