public static int enemySwitchPokemon()
	{
		System.out.println("Enemy Initiated Pokemon Switch");
		int temp=0;

		do
		{
			temp=(int)(Math.random()*enemyNumOfPokemon);
		}
		while(!Mechanics.isAlive(enemy[temp].health));

		enemy[enemyIndex].atkStage=0;
		enemy[enemyIndex].defStage=0;
		enemy[enemyIndex].speedStage=0;
		enemy[enemyIndex].spclStage=0;
		enemy[enemyIndex].evaStage=0;

		enemy[enemyIndex].substatus=Pokemon.Substatus.OK;
		Mechanics.hasSubstitute[1]=false;
		Mechanics.substituteHealth[1]=0;

		Mechanics.awayFromBattle[1]=false;
		Mechanics.turnsDisabled[1]=0;
		Mechanics.moveDisabled[1]=-1;


		//Restores user move ONLY if the enemy has fainted
		if(enemyFainted)
		{
			Mechanics.charging[0]=false;
			if(user[userIndex].move[userCmd]!=Pokemon.Move.RAGE)
			userLockedMove=-1;
		}

		Mechanics.turnsMultiTurn[0]=0;

		Mechanics.participationReset();

		//Unlocks enemy move
		Mechanics.turnsMultiTurn[1]=0;
		enemyLockedMove=-1;
		Mechanics.charging[1]=false;
		b1.enemySelected = enemyIndex;

		switchPkmn.play();
		b1.stopFlicker(1);
		return temp;

	}