public void checkBattle() {
        if (noBattle == false) {
            if (stepscount >= rndwildmodify) {
                lastBGM = currentBGM;
                currentBGM.stop();
                currentBGM = wildbattle;
                currentBGM.start();
                enemylvl = (byte) (first.getLevel() * (9 / 10));
                if (r == 1) {
                    wildPokemon.create(198, enemylvl);
                } else if (r == 2) {
                    wildPokemon.create(4, enemylvl); //Creates a wild Charmander
                } else if (r == 3) {
                    wildPokemon.create(25, enemylvl);
                } else if (r == 4) {
                    wildPokemon.create(100, enemylvl);
                } else {
                    wildPokemon.create(101, enemylvl);
                }
                enemyparty[0] = wildPokemon;
                enemyparty[1] = null;
                enemyparty[2] = null;
                enemyparty[3] = null;
                enemyparty[4] = null;
                enemyparty[5] = null;
                wait(1);
                inBattle = true;
                PokedexIndex[wildPokemon.getNumber()][0]++;
                Battle = new Battle(this, pokemonparty, enemyparty, null, true);
                stepscount = 0;
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                }
            }
        }
    }