dsun

Untitled

Jan 25th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3. class test{
  4.  
  5. public static void main(String[] args){
  6.  
  7. Random ran = new Random();
  8. int mana = 15;
  9. int totalMana = 15;
  10. int dmg;
  11. int health = 10;
  12. int s_health = 10;
  13.  
  14. System.out.println("A skeleton appears");
  15.  
  16. for(int i = 0; i < 15; i++){
  17.  
  18.  
  19.  
  20. dmg = 1+ran.nextInt(3);
  21. System.out.println("\nYou cast a fire spell...");
  22. mana -= dmg;
  23. System.out.println("You inflict " + dmg + " damage");
  24. System.out.println("Mana: " + mana + "/" + totalMana);
  25. s_health -= dmg;
  26. System.out.println("The skeleton has " + s_health + " health left");
  27.  
  28. if(mana <= 0){
  29. System.out.println("You're out of mana! ");
  30. mana = 0;
  31. i = 15;
  32. }
  33.  
  34. if(s_health <= 0){
  35. System.out.println("The skeleton died!");
  36. i = 15;
  37. }
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment