|
@ -31,13 +31,19 @@ private boolean combat = false; |
|
|
player.setHp(hp); |
|
|
player.setHp(hp); |
|
|
} |
|
|
} |
|
|
//TODO get input from player |
|
|
//TODO get input from player |
|
|
do { |
|
|
|
|
|
|
|
|
COMBAT_LOOP:do { |
|
|
System.out.println("What do you want to do?"); |
|
|
System.out.println("What do you want to do?"); |
|
|
String input = scanner.nextLine(); |
|
|
String input = scanner.nextLine(); |
|
|
switch(input) { |
|
|
switch(input) { |
|
|
case "use": |
|
|
case "use": |
|
|
use(scanner, engine); |
|
|
use(scanner, engine); |
|
|
break; |
|
|
break; |
|
|
|
|
|
case "runaway": |
|
|
|
|
|
if(runawaySucceeds()) { |
|
|
|
|
|
combat = false; |
|
|
|
|
|
break COMBAT_LOOP; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
default: |
|
|
default: |
|
|
System.out.println("That is not a valid command."); |
|
|
System.out.println("That is not a valid command."); |
|
|
break; |
|
|
break; |
|
@ -46,6 +52,13 @@ private boolean combat = false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean runawaySucceeds() { |
|
|
|
|
|
int chance = (int)(Math.random()*100); |
|
|
|
|
|
if(chance < 50) |
|
|
|
|
|
return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public void use(Scanner scanner, TravelEngine engine) { |
|
|
public void use(Scanner scanner, TravelEngine engine) { |
|
|
System.out.println("Which item would you like to use?"); |
|
|
System.out.println("Which item would you like to use?"); |
|
|
String item = scanner.nextLine(); |
|
|
String item = scanner.nextLine(); |
|
|