add encounter_random_class function