Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- class test{
- public static void main(String[] args){
- Random ran = new Random();
- int mana = 15;
- int totalMana = 15;
- int dmg;
- int health = 10;
- int s_health = 10;
- System.out.println("A skeleton appears");
- for(int i = 0; i < 15; i++){
- dmg = 1+ran.nextInt(3);
- System.out.println("\nYou cast a fire spell...");
- mana -= dmg;
- System.out.println("You inflict " + dmg + " damage");
- System.out.println("Mana: " + mana + "/" + totalMana);
- s_health -= dmg;
- System.out.println("The skeleton has " + s_health + " health left");
- if(mana <= 0){
- System.out.println("You're out of mana! ");
- mana = 0;
- i = 15;
- }
- if(s_health <= 0){
- System.out.println("The skeleton died!");
- i = 15;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment