Professional Documents
Culture Documents
Scanner;
int life,assault,block,blocks,damage,height;
assault = 1;
life = 100;
blocks = 1;
damage = 1;
if (block != height) {
damage = (int) (Math.random() * 30);
System.out.println("\r\n" + "You didn't block the blow");
System.out.println("- Damage received: " + damage);
life = life - damage;
System.out.println("- Remaining life: " + life + "\r\n" +
"--------------\r\n" + "\r\n");
blocks = 1;
}
else if (block == height) {
System.out.println("\r\n" + "You blocked the blow!");
System.out.println("- Remaining life: " + life + "\r\
n"+"--------------\r\n" + "\r\n");
blocks++;
if (blocks == 3) {
life = life + 5;
blocks = 1;
}
}
if (life <= 0 || assault >= 15) {
finish = true;
}
else {
assault++;
}
}
System.out.println("End of game.");
System.out.println("Remaining life: " + life);
System.out.println("Remaining rounds: " + assault);
}
}