Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. while (health > 0 && enemyHealth > 0) {
  2. System.out.println("You have " + health + " hp.");
  3. System.out.println("---------------------");
  4. System.out.println("Your enemy has " + enemyHealth + " hp.");
  5. System.out.println("---------------------");
  6. 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");
  7. attack = scnr.nextLine().toLowerCase();
  8.  
  9. switch (attack) {
  10. case "basic attack": enemyHealth -= basicattack(0); break;
  11. case "heavy attack": enemyHealth -= heavyattack(0); break;
  12. case "fireball": enemyHealth -= fireball(0); break;
  13. case "force pulse": enemyHealth -= forcepulse(0); break;
  14. case "heal": enemyHealth -= heal(0); break;
  15. case "greater heal": enemyHealth -= greaterheal(0); break;
  16. case "impale": enemyHealth -= impale(0); break;
  17. case "snipe": enemyHealth -= snipe(0); break;
  18. case "slash": enemyHealth -= slash(0); break;
  19. }
  20.  
  21. low = 1;
  22. high = 3;
  23. result = r.nextInt(high-low) + low;
  24.  
  25. switch (result) {
  26. case 1: health -= basicattack(1); break;
  27. case 2: health -= heavyattack(1); break;
  28. case 3: health -= slash(1); break;
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement