Cant get if/else to work with bufferedreader
Mah bufferedreader is working when it uses the input to create the player name string, but I cant get it to make the if/then/else thang work =\. I feel like it is something decently obvious im missing, help with that or any other criticism would be helpful :D
Code:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.*;
import java.util.*;
public class Game {
public static void main(String[] args) throws Exception {
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(input);
String name = "";
System.out.println("What is your name?");
name = reader.readLine();
System.out.println("Welcome " + name + ".");
System.out.println("What would you like to do?");
int str = 100;
int lvl = 1;
int estr = 1;
int php = 200;
int ehp = 1;
int dmg = 1;
int xp = 0;
Random randdmg = new Random();
String in = "";
while(true){
in = reader.readLine();
if(in == "attack hannon follower"){
System.out.println("You: " + in + ".");
ehp = 50;
estr = 25;
while(php > 0 & ehp > 0){
//computer attack =\
dmg = randdmg.nextInt(estr);
System.out.println("The hannon follower (lvl 1) hits " + name + " for " + dmg + " damage!");
php = php - dmg;
System.out.println("" + name + " hp: " + php + "");
Thread.sleep(1000);
//player attack bro =\
dmg = randdmg.nextInt(str);
System.out.println("" + name + " hits The hannon follower (lvl 1) for " + dmg + " damage ");
ehp = ehp - dmg;
System.out.println("Hannon follower (lvl 1) hp: " + ehp + "");
Thread.sleep(1000);
}
if(php > 1){
System.out.println("" + name + " Wins the fight!");
xp = xp + ehp;
System.out.println("You gain " + ehp + " xp; you now have " + xp + "");
}
else if(ehp > 1){
System.out.println("Hannon Follower (lvl 1) wins the fight");
}
}
else if(in == "help"){
System.out.println("OUTPUT Bro");
}
}
} //end of while loop =\
}