Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package GranCombat;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11. *
  12. * @author Marco, atafar
  13. */
  14. public class Vista {
  15.  
  16. static void fraseInicio() {
  17. System.out.println("Descripcio del Jugador:");
  18. }
  19.  
  20. static void fraseSigue() {
  21. System.out.println("Descripcio del nou Jugador:");
  22. }
  23.  
  24. public static boolean comprobarValores(int fue, int con, int tam, int des, int per) {
  25. if ((fue < 3) || (fue > 18) || (con < 3) || (con > 18) || (tam < 3)
  26. || (tam > 18) || (des < 3) || (des > 18) || (per < 3) || (per > 18)) {
  27. System.out.println("Les característiques han d'estar entre 3 i 18");
  28. return false;
  29. }
  30. if (fue + con + tam + des + per > Principal.maxCaract) {
  31. System.out.println("La suma de les característiques ha de ser menor o igual a" + Principal.maxCaract);
  32. return false;
  33. }
  34. return true;
  35. }
  36.  
  37. public static String obtenerNombreLuchador() {
  38. System.out.print("Nom del lluitador1: ");
  39. Scanner in = new Scanner(System.in);
  40. String nombre = in.nextLine();
  41. return nombre;
  42. }
  43.  
  44. public static String obtenerFUE() {
  45. Scanner in = new Scanner(System.in);
  46. System.out.print("Força: ");
  47. String entrada = in.nextLine();
  48. return entrada;
  49. }
  50.  
  51. public static String obtenerCON() {
  52. Scanner in = new Scanner(System.in);
  53. System.out.print("Constitució: ");
  54. String entrada = in.nextLine();
  55. return entrada;
  56. }
  57.  
  58. public static String obtenerTAM() {
  59. Scanner in = new Scanner(System.in);
  60. System.out.print("Tamany: ");
  61. String entrada = in.nextLine();
  62. return entrada;
  63. }
  64.  
  65. public static String obtenerDES() {
  66. Scanner in = new Scanner(System.in);
  67. System.out.print("Destresa: ");
  68. String entrada = in.nextLine();
  69.  
  70. return entrada;
  71. }
  72.  
  73. public static String obtenerPER() {
  74. Scanner in = new Scanner(System.in);
  75. System.out.print("Personalitat: ");
  76. String entrada = in.nextLine();
  77.  
  78. return entrada;
  79. }
  80.  
  81. public static int obtenerEscuela() {
  82. Scanner in = new Scanner(System.in);
  83. System.out.println("Escola: ");
  84. System.out.println(" 0 -- Follet Tortuga");
  85. System.out.println(" 1 -- Corb Genial");
  86. System.out.println(" 2 -- Hoi-Poi");
  87. System.out.println(" 3 -- Namac");
  88. System.out.println(" 4 -- Ninguna");
  89. String opcio = in.nextLine();
  90. int escola = Integer.parseInt(opcio);
  91.  
  92. return escola;
  93. }
  94.  
  95. /**
  96. * Función que pregunta al usuario si quiere continuar el combate
  97. *
  98. * @return devuelve su respuesta.
  99. */
  100. public static boolean repetir() {
  101. System.out.print("Deseas que el ganador se enfrente a un nuevo contrincante (S/N)?");
  102. Scanner in = new Scanner(System.in);
  103. String entrada = "";
  104. while (entrada.length() < 1) {
  105. entrada = in.nextLine();
  106. }
  107. return entrada.equals("N") || entrada.equals("n");
  108. }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement