public static void combat(Adventurer[] player, Adventurer opp){ Scanner in = new Scanner(System.in); for (int i=0;i<(player.length);i++){ while (true){ System.out.println("Choose an action: \n A: attack \n S: special attack"); String act2 = in.next(); if (act2.equals("A")){ player[i].attack(opp); break; }else if (act2.equals("S")){ player[i].specialAttack(opp); break; }else{ System.out.println("Please input choice again."); } } if (opp.getHP() <= 0){ break; } } Random rand = new Random(); Random rand2 = new Random(); int target = rand2.nextInt(3); while (opp.getHP() > 0){ if (player[target].getHP() > 0){ if (rand.nextDouble() < .3){ opp.specialAttack(player[target]); System.out.println(); break; }else{ opp.attack(player[target]); System.out.println(); break; } }else{ target = rand2.nextInt(3); } } }