Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. public static void Battle (boolean isBoss) {
  2. String attack = "";
  3.  
  4. if (isBoss) {
  5.  
  6. } else if (!isBoss) {
  7.  
  8. low = 400;
  9. high = 600;
  10. result = r.nextInt(high-low) + low;
  11. enemyHealth = result;
  12.  
  13. System.out.println("A knight has appeared!");
  14. while (health > 0 && enemyHealth > 0) {
  15. System.out.println("You have " + health + " hp.");
  16. System.out.println("---------------------");
  17. System.out.println("Your enemy has " + enemyHealth + " hp.");
  18. System.out.println("---------------------");
  19. System.out.println("Choose an attack: \n-Basic attack \n-Heavy attack \n-Fireball \n-Force pulse \n-Heal \n-Greater heal \n-Impale \n-Snipe \n-Slash");
  20. attack = scnr.nextLine().toLowerCase();
  21.  
  22. switch (attack) {
  23. case "basic attack": enemyHealth -= basicattack(0); break;
  24. case "heavy attack": enemyHealth -= heavyattack(0); break;
  25. case "fireball": enemyHealth -= fireball(0); break;
  26. case "force pulse": enemyHealth -= forcepulse(0); break;
  27. case "heal": enemyHealth -= heal(0); break;
  28. case "greater heal": enemyHealth -= greaterheal(0); break;
  29. case "impale": enemyHealth -= impale(0); break;
  30. case "snipe": enemyHealth -= snipe(0); break;
  31. case "slash": enemyHealth -= slash(0); break;
  32. }
  33.  
  34. low = 1;
  35. high = 3;
  36. result = r.nextInt(high-low) + low;
  37.  
  38. switch (result) {
  39. case 1: health -= basicattack(1); break;
  40. case 2: health -= heavyattack(1); break;
  41. case 3: health -= slash(1); break;
  42. }
  43.  
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement