public void wildEncounter()
	{
		BattleWindow bwindow;

		Pokemon fish=null;

		if(fishing)
		{
			fish=enemy[0];
		}

		int noEnc=(int)(Math.random()*100);
		if(!fishing&&noEnc>10)
			return;

		encounter=true;
		repaint();

		try
		{
			Thread.sleep(2000);
		}
		catch(Exception e){e.printStackTrace();}

		int randy=(int)(Math.random()*10);

		switch(area)
		{
			//Rarity, Level
			case Args_Harbor:
			case Binary_City:
			case Enumville:
			case Mount_Java:
			case Nested_Village:
			case Peach_City:
			case Cream_City:
			case Polymorph_Town:
			case Recursive_Hot_Springs:
			case Streamreader_Hotel:
			case Stringville:
			case Intville:
			if(surfing)
				defaultSurfEnc(randy);
			else
				enemy[0]=Mechanics.randomEncounter(Pokemon.Species.CATERPIE,20,5,Pokemon.Species.WEEDLE,20,5,Pokemon.Species.PIDGEY,20,5,
				Pokemon.Species.RATTATA,30,5,Pokemon.Species.SPEAROW,10,5);
				break;
			case Route_0:
				enemy[0]=Mechanics.randomEncounter(Pokemon.Species.CATERPIE,20,5,Pokemon.Species.WEEDLE,20,5,Pokemon.Species.PIDGEY,20,5,
				Pokemon.Species.RATTATA,30,5,Pokemon.Species.SPEAROW,10,5);
				break;
			case Route_1:
				if(!surfing)
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.CATERPIE,20,7,Pokemon.Species.WEEDLE,20,8,Pokemon.Species.PIDGEY,20,10,
					Pokemon.Species.RATTATA,30,11,Pokemon.Species.SPEAROW,10,9);
				else
					enemy[0]=new Pokemon(Pokemon.Species.MAGIKARP);
				break;
			case Route_2:
				if(!surfing)
				{
					if(randy<=4)
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.PIDGEY,20,15,Pokemon.Species.METAPOD,20,9,Pokemon.Species.KAKUNA,20,10,
					Pokemon.Species.RATTATA,30,16,Pokemon.Species.CATERPIE,10,7);
					else
					{
						if(VERSION.equals("Peaches"))
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.NIDORAN_M,30,12,Pokemon.Species.NIDORAN_F,30,12,Pokemon.Species.DROWZEE,20,10,
							Pokemon.Species.PIKACHU,5,16,Pokemon.Species.EKANS,15,7);
						else
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.NIDORAN_M,30,12,Pokemon.Species.NIDORAN_F,30,12,Pokemon.Species.DROWZEE,20,10,
							Pokemon.Species.PIKACHU,5,16,Pokemon.Species.SANDSHREW,15,13);

					}
				}
				else
				{
					if (randy!=0)
					enemy[0]=new Pokemon(Pokemon.Species.MAGIKARP,10);
					else
					enemy[0]=new Pokemon(Pokemon.Species.LAPRAS,16);
				}
				break;
			case Route_3:
				if(!surfing)
				{
					if(randy<=2)
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.PIDGEOTTO,30,18,Pokemon.Species.PARAS,30,16,Pokemon.Species.TAUROS,20,18,
					Pokemon.Species.AERODACTYL,5,20,Pokemon.Species.TANGELA,15,23);
					else
					{
						if(VERSION.equals("Peaches"))
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.ODDISH,30,15,Pokemon.Species.PARAS,30,16,Pokemon.Species.PONYTA,20,17,
							Pokemon.Species.OMANYTE,5,23,Pokemon.Species.KABUTO,15,23);
						else
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.RATICATE,30,21,Pokemon.Species.PARAS,30,16,Pokemon.Species.PONYTA,20,17,
							Pokemon.Species.OMANYTE,5,23,Pokemon.Species.KABUTO,15,23);

					}
				}
				else
				{
					if (randy!=0)
					enemy[0]=new Pokemon(Pokemon.Species.MAGIKARP,15);
					else
					enemy[0]=new Pokemon(Pokemon.Species.POLIWAG,16);
				}
				break;
			case Route_4:
				if (currentArea[location.x][location.y] == 187)
				{
					System.out.println(randy);
					if (randy == 0)
					{
						enemy[0]=new Pokemon(Pokemon.Species.JIGGLYPUFF, Pokemon.Move.BUBBLEBEAM, Pokemon.Move.HYPER_BEAM, Pokemon.Move.SOLARBEAM, Pokemon.Move.FLAMETHROWER, 1, 255, 255, 255, 255, 255,
						"JIGGLYBEAMZ", Pokemon.Status.OK, -1, "JUSTINIANFTW");
					}
					else if (randy == 1)
					{
						enemy[0]=new Pokemon(Pokemon.Species.CATERPIE, Pokemon.Move.SING, Pokemon.Move.SELFDESTRUCT, Pokemon.Move.NONE, Pokemon.Move.NONE, 1, 255, 255, 255, 255, 255,
						"TROLLERPIE", Pokemon.Status.OK, -1, "JUSTINIANFTW");
					}
					else if (randy == 2)
					{
						enemy[0]=new Pokemon(Pokemon.Species.PORYGON, Pokemon.Move.TAIL_WHIP, Pokemon.Move.LEER, Pokemon.Move.SCREECH, Pokemon.Move.CONFUSION, 1, 255, 255, 255, 255, 255,
						"FAILRYGON", Pokemon.Status.OK, -1, "JUSTINIANFTW");
					}
					else if (randy == 3)
					{
						enemy[0]=new Pokemon(Pokemon.Species.SNORLAX, Pokemon.Move.KARATE_CHOP, Pokemon.Move.LOW_KICK, Pokemon.Move.MEGA_PUNCH, Pokemon.Move.HI_JUMP_KICK, 1, 255, 255, 255, 255, 255,
						"EPICLAX", Pokemon.Status.OK, -1, "JUSTINIANFTW");
					}
					else if (randy == 4)
					{
						enemy[0]=new Pokemon(Pokemon.Species.BUTTERFREE, Pokemon.Move.SPORE, Pokemon.Move.POISONPOWDER, Pokemon.Move.SING, Pokemon.Move.THUNDER_WAVE, 1, 255, 255, 255, 255, 255,
						"MARGARINEFREE", Pokemon.Status.OK, -1, "JUSTINIANFTW");
					}
					else if (randy == 5)
					{
						enemy[0]=new Pokemon(Pokemon.Species.DITTO, Pokemon.Move.FIRE_BLAST, Pokemon.Move.HYDRO_PUMP, Pokemon.Move.SOLARBEAM, Pokemon.Move.TRANSFORM, 1, 255, 255, 255, 255, 255,
						"DITTOR", Pokemon.Status.OK, -1, "JUSTINIANFTW");
					}
					else if (randy == 6)
					{
						enemy[0]=new Pokemon(Pokemon.Species.DRAGONITE, Pokemon.Move.FIRE_BLAST, Pokemon.Move.EARTHQUAKE, Pokemon.Move.RECOVER, Pokemon.Move.DRAGON_RAGE, 1, 255, 255, 255, 255, 255,
						"ULTYNITE", Pokemon.Status.OK, -1, "JUSTINIANFTW");
					}
					else if (randy == 7)
					{
						enemy[0]=new Pokemon(Pokemon.Species.LAPRAS, Pokemon.Move.FLY, Pokemon.Move.DIG, Pokemon.Move.NONE, Pokemon.Move.NONE, 1, 255, 255, 255, 255, 255,
						"WTF", Pokemon.Status.OK, -1, "JUSTINIANFTW");
					}
					else if (randy == 8)
					{
						enemy[0]=new Pokemon(Pokemon.Species.CATERPIE, Pokemon.Move.SING, Pokemon.Move.SELFDESTRUCT, Pokemon.Move.NONE, Pokemon.Move.NONE, 1, 255, 255, 255, 255, 255,
						"TROLLERPIE", Pokemon.Status.OK, -1, "JUSTINIANFTW");
					}
					else if (randy == 9)
					{
						enemy[0]=new Pokemon(Pokemon.Species.PORYGON, Pokemon.Move.TAIL_WHIP, Pokemon.Move.LEER, Pokemon.Move.SCREECH, Pokemon.Move.CONFUSION, 1, 255, 255, 255, 255, 255,
						"FAILRYGON", Pokemon.Status.OK, -1, "JUSTINIANFTW");
					}
				}
				else
				{
					if(!surfing)
					{
						if(randy<=2)
						enemy[0]=Mechanics.randomEncounter(Pokemon.Species.RATICATE,20,22,Pokemon.Species.RATICATE,20,20,Pokemon.Species.PIDGEOTTO,20,18,
						Pokemon.Species.RATTATA,30,16,Pokemon.Species.FEAROW,10,24);
						else
						{
							if(VERSION.equals("Peaches"))
								enemy[0]=Mechanics.randomEncounter(Pokemon.Species.CLEFAIRY,20,17,Pokemon.Species.JIGGLYPUFF,20,19,Pokemon.Species.ZUBAT,20,12,
								Pokemon.Species.RATICATE,20,26,Pokemon.Species.FEAROW,20,24);
							else
								enemy[0]=Mechanics.randomEncounter(Pokemon.Species.CLEFAIRY,30,18,Pokemon.Species.JIGGLYPUFF,30,21,Pokemon.Species.ZUBAT,30,15,
								Pokemon.Species.MAGMAR,5,25,Pokemon.Species.VULPIX,15,18);
						}
					}
					else
						defaultSurfEnc(randy);
				}
				break;
			case Route_5:
				if(!surfing)
				{
					if(randy<=5)
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.DIGLETT,20,22,Pokemon.Species.MACHOP,20,14,Pokemon.Species.GEODUDE,20,15,
					Pokemon.Species.RATICATE,30,26,Pokemon.Species.ONIX,10,7);
					else
					{
						if(VERSION.equals("Peaches"))
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.ZUBAT,30,12,Pokemon.Species.GEODUDE,30,19,Pokemon.Species.MACHOP,20,14,
							Pokemon.Species.RHYHORN,15,26,Pokemon.Species.EKANS,15,17);
						else
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.ZUBAT,30,12,Pokemon.Species.NIDORINA,30,20,Pokemon.Species.MACHOP,20,18,
							Pokemon.Species.RHYHORN,15,26,Pokemon.Species.SANDSHREW,15,19);
					}
				}
				else
					defaultSurfEnc(randy);
				break;
			case Route_6:
			case Route_7:
				if(!surfing)
				{
					if(randy<=7)
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.SLOWPOKE,20,22,Pokemon.Species.MAGNEMITE,20,18,Pokemon.Species.SHELLDER,20,25,
					Pokemon.Species.NIDORINO,30,26,Pokemon.Species.MR_MIME,10,7);
					else
					{
						if(VERSION.equals("Peaches"))
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.SLOWPOKE,30,18,Pokemon.Species.MAGNEMITE,30,19,Pokemon.Species.SHELLDER,20,14,
							Pokemon.Species.ABRA,15,12,Pokemon.Species.JYNX,15,28);
						else
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.MEOWTH,30,19,Pokemon.Species.NIDORINA,30,20,Pokemon.Species.SHELLDER,20,18,
							Pokemon.Species.ABRA,15,12,Pokemon.Species.JYNX,15,28);
					}
				}
				else
					defaultSurfEnc(randy);
				break;
			case Route_8:
				enemy[0]=new Pokemon(Pokemon.Species.HORSEA,15);
				break;
			case Route_9:
				if(!surfing)
				{
					if(randy<=7)
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.PSYDUCK,20,27,Pokemon.Species.KRABBY,20,21,Pokemon.Species.CUBONE,20,18,
					Pokemon.Species.PIDGEOTTO,30,25,Pokemon.Species.MAGNEMITE,10,7);
					else
					{
						if(VERSION.equals("Peaches"))
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.SLOWPOKE,30,18,Pokemon.Species.KRABBY,30,26,Pokemon.Species.GROWLITHE,20,19,
							Pokemon.Species.POLIWHIRL,15,32,Pokemon.Species.SLOWPOKE,15,28);
						else
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.MEOWTH,30,23,Pokemon.Species.CUBONE,30,20,Pokemon.Species.PARASECT,20,16,
							Pokemon.Species.POLIWHIRL,15,32,Pokemon.Species.SLOWPOKE,15,28);
					}
				}
				else
					defaultSurfEnc(randy);
				break;
			case Route_10:
				if(!surfing)
				{
					if(randy<=4)
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.VOLTORB,20,27,Pokemon.Species.VOLTORB,20,21,Pokemon.Species.KOFFING,20,18,
					Pokemon.Species.GRAVELER,30,25,Pokemon.Species.DODUO,10,27);
					else
					{
						if(VERSION.equals("Peaches"))
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.MANKEY,30,25,Pokemon.Species.KRABBY,30,26,Pokemon.Species.GROWLITHE,20,24,
							Pokemon.Species.POLIWHIRL,15,12,Pokemon.Species.DITTO,15,28);
						else
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.BELLSPROUT,30,21,Pokemon.Species.CUBONE,30,20,Pokemon.Species.PARASECT,20,16,
							Pokemon.Species.PINSIR,15,26,Pokemon.Species.DITTO,15,28);
					}
				}
				else
					defaultSurfEnc(randy);
				break;
			case Route_11:
				if(!surfing)
				{
					if(randy<=7)
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.FARFETCH_D,20,35,Pokemon.Species.GRIMER,20,27,Pokemon.Species.EXEGGCUTE,20,28,
					Pokemon.Species.PORYGON,30,25,Pokemon.Species.EEVEE,10,7);
					else
					{
						if(VERSION.equals("Peaches"))
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.MACHOKE,30,34,Pokemon.Species.KRABBY,30,26,Pokemon.Species.RATICATE,20,29,
							Pokemon.Species.KANGASKHAN,15,32,Pokemon.Species.ELECTABUZZ,15,30);
						else
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.MACHOKE,30,33,Pokemon.Species.CUBONE,30,20,Pokemon.Species.PARASECT,20,36,
							Pokemon.Species.KANGASKHAN,15,32,Pokemon.Species.PORYGON,15,31);
					}
				}
				else
					defaultSurfEnc(randy);
				break;
			case Route_12:
				if(!surfing)
					enemy[0]=new Pokemon(Pokemon.Species.RATICATE,40);
				else
					enemy[0]=new Pokemon(Pokemon.Species.TENTACRUEL,35);
				break;
			case Route_13:
				enemy[0]=Mechanics.randomEncounter(Pokemon.Species.VOLTORB,20,37,Pokemon.Species.VOLTORB,20,31,Pokemon.Species.KOFFING,20,38,
					Pokemon.Species.GRAVELER,30,35,Pokemon.Species.DODUO,10,37);
				break;
			case Champions_Walk:
			case Route_14:
				if(!surfing)
				{
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.VOLTORB,20,37,Pokemon.Species.MAGNEMITE,20,31,Pokemon.Species.VOLTORB,20,38,
					Pokemon.Species.MAGNETON,30,35,Pokemon.Species.PIKACHU,10,37);
				}
				else
					defaultSurfEnc(randy);
					break;
			case Victory_Road:
			case Victory_Road_Cave:
			case Challenge_Cave:
				if(!surfing)
				{
					if(randy<=7)
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.GASTLY,20,18,Pokemon.Species.HITMONCHAN,20,47,Pokemon.Species.HITMONLEE,20,48,
					Pokemon.Species.CHANSEY,5,45,Pokemon.Species.STARYU,10,50);
					else
					{
						if(VERSION.equals("Peaches"))
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.LICKITUNG,30,54,Pokemon.Species.KADABRA,30,46,Pokemon.Species.RATICATE,20,59,
							Pokemon.Species.DRATINI,15,25,Pokemon.Species.SCYTHER,15,50);
						else
							enemy[0]=Mechanics.randomEncounter(Pokemon.Species.LICKITUNG,30,53,Pokemon.Species.KADABRA,30,59,Pokemon.Species.GRAVELER,20,56,
							Pokemon.Species.DRATINI,15,25,Pokemon.Species.GOLBAT,15,55);
					}
				}
				else
					defaultSurfEnc(randy);
				break;
			case Hexadecimal_Forest:
				if(!surfing)
				{
					enemy[0]=Mechanics.randomEncounter(Pokemon.Species.METAPOD,20,9,Pokemon.Species.BUTTERFREE,20,14,Pokemon.Species.VENONAT,20,8,
					Pokemon.Species.KAKUNA,5,8,Pokemon.Species.BEEDRILL,10,17);
				}
				else
					defaultSurfEnc(randy);
				break;
			case Public_Cave:
			case Java_Cave:
			case Class_Cave:
			case Articuno_Cave:
			case Moltres_Cave:
			case Primal_Cave:
				if (!surfing)
				enemy[0]=Mechanics.randomEncounter(Pokemon.Species.ZUBAT,20,26,Pokemon.Species.ONIX,20,31,Pokemon.Species.GEODUDE,20,17,
					Pokemon.Species.GRAVELER,30,25,Pokemon.Species.CLEFAIRY,10,24);
				else if (randy != 0)
				defaultSurfEnc(randy);
				else
				enemy[0]=new Pokemon(Pokemon.Species.LAPRAS,25);
				break;
			case Diglett_Cave:
				if (!surfing)
				enemy[0]=Mechanics.randomEncounter(Pokemon.Species.DIGLETT,20,26,Pokemon.Species.DUGTRIO,20,31,Pokemon.Species.DIGLETT,20,17,
					Pokemon.Species.DIGLETT,30,25,Pokemon.Species.DUGTRIO,10,40);
				else
				defaultSurfEnc(randy);
				break;
			case Route_ARRAYINDEXOUTOFBOUNDSEXCEPTION:
				defaultSurfEnc(randy);
				break;
			default:
				enemy[0]=new Pokemon(Pokemon.Species.MISSINGNO,80);
				break;
		}

		if(fish!=null)
			enemy[0]=fish;

		if(enemy[0]==null)
			enemy[0]=new Pokemon(Pokemon.Species.MISSINGNO,80);

		//Forces other 5 slots to null
		for(int i=1; i<6; i++)
			enemy[i]=null;

		bgm.stop();
		surfSong.stop();
		bikeSong.stop();
		jf.setVisible(false);

		bwindow=new BattleWindow(partyPokemon,enemy,"WILD");

		for(int i=0; i<6; i++)
		{
			partyPokemon[i]=Battle.getPokemon(i);
		}

		alreadyBattled=true;
		moving=false;

		bwindow.thread.interrupt();

		bwindow=null;

		encounter=false;
		System.gc();
		jf.setVisible(true);
		jf.toFront();

		if(surfing)
			surfSong.loop();
		else if(bicycling&&!forceBike)
			bikeSong.loop();
		else
			bgm.loop();

		fishing=false;
		handleCapturedPokemon();
	}