Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. package Study;
  2.  
  3. import java.util.Random;
  4. import java.util.Scanner;
  5.  
  6. public class BattleHelper {
  7.  
  8. static Random random = new Random();
  9. static Scanner in = new Scanner(System.in);
  10.  
  11. public static BattleAction getBattleAction(Being user) {
  12. System.out.printf("%s's turn\n",user.getName());
  13. System.out.println("Select an action");
  14. System.out.println("1. Attack | 2. Heal");
  15.  
  16. int i;
  17.  
  18. do{
  19. i = in.nextInt();
  20.  
  21. } while(i != 1 && i !=2);
  22.  
  23. if(i == 1)
  24. return new AttackAction();
  25. else return new HealAction();
  26. }
  27.  
  28. public static void displayTurnOutcome(String outcomeText){
  29. System.out.printf("%s",outcomeText);
  30. }
  31.  
  32. public static int getRandom(double range)
  33. {
  34. return random.nextInt((int) range);
  35. }
  36.  
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement