Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Random;
  2. import java.util.Scanner;
  3. public class yeetyeet {
  4. // Copyright 2019 Alex Stinky Yuriaan
  5.     public static void main(String[] args) {
  6.        
  7.         //Beginning Prompt --- Ask for name.
  8.         System.out.println("Please Enter Your Name:");
  9.        
  10.         // Player (1)
  11.         //Name
  12.         boolean attackbool = false; // Never used (irrelevant)
  13.         boolean defendbool = false;  // Never used (irrelevant)
  14.         boolean hpbool = false;  // Never used (irrelevant)
  15.         boolean agebool = false;  // Never used (irrelevant)
  16.         int damageTaken;
  17.         //
  18.         String name;
  19.         Scanner keyboard = new Scanner(System.in);
  20.         name = keyboard.nextLine();
  21.         //Age (default set to 1)
  22.         int age = 1;
  23.         // Attack
  24.         int attack = 3;
  25.         // Defense
  26.         int defense = 1;
  27.         // Health
  28.         int hp = 10;
  29.        
  30.         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  31.        
  32.         // Enemy
  33.         // Enemy Age
  34.         Random rand1 = new Random();
  35.         int eage = rand1.nextInt(10);
  36.         eage += 1;
  37.         // Enemy Attack
  38.         Random rand2 = new Random();
  39.         int eAttack = rand2.nextInt(5);
  40.         eAttack += 1;
  41.         // Enemy Defense
  42.         Random rand3 = new Random();
  43.         int eDefense = rand3.nextInt(2);   
  44.         eDefense += 1;
  45.         // Enemy Health
  46.         Random rand4 = new Random();
  47.         int eHP = rand4.nextInt(15);
  48.         eHP += 1;
  49.         //////////////////////////////////////////////////////////////////
  50.        
  51.         // Setup
  52.  
  53.        
  54.         System.out.println("Welcome to the game " + name + ("!"));
  55.         System.out.println("Your Enemy is " + eage + " years old" );
  56.         System.out.println("Your Enemy has " + eAttack + " Attack");
  57.         System.out.println("Your Enemy has " + eDefense + " Defense");
  58.         System.out.println("Your Enemy has " + eHP + " HP");
  59.        
  60.         System.out.println("                               "); //space
  61.         System.out.println("You are 1, and you have 3 attack, 1 defense and 10hp");
  62.        
  63.         System.out.println("You will move first, please enter a number");
  64.         System.out.println("Attack -" + attack + " [1]");
  65.         System.out.println("Fortify +" + defense + " [2]");
  66.         System.out.println("Enjoy life (+3 age)" + " [3]");
  67.         System.out.println("Diet (+3hp)" + " [4]");
  68.        
  69.         // game
  70.        
  71.         //Loop for Whole Game LAMwxdxmoV3df8XSuOhJsmTZwRoR5ART4vCDxLgwxCXjwUPod9VXFpf06SJwzbK63XqX4GbDHguu76j6bae/lYsx9JroAA==
  72.        
  73.         boolean wholeloop = true;
  74.         while(wholeloop)
  75.         {
  76.        
  77.        
  78.        
  79.         //Incorrect Decision Loop
  80.         boolean loop = true;
  81.         while(loop)
  82.         {
  83.            
  84.        
  85.            
  86.            
  87.         if (eHP <= 0) {
  88.                 System.out.println("THE ENEMY IS DEAD YOU WIN!!!!!!!!!!!");
  89.                 return;
  90.         }
  91.            
  92.         if (hp <= 0) {
  93.                 System.out.println("YOU DIED!!!!!!!!");
  94.                 return;
  95.         }  
  96.            
  97.            
  98.         int choice;
  99.         choice = keyboard.nextInt();
  100.  
  101.    
  102.        
  103.        
  104.        
  105.         switch (choice) {
  106.             case 1:
  107.                 attackbool = true;
  108.                 damageTaken = attack - eDefense;
  109.                 eHP = eHP - damageTaken;
  110.                 System.out.println("You've dealt " + damageTaken + " damage to the enemy.");
  111.                 System.out.println("They now have " + eHP + " health left.");
  112.                 if (damageTaken <= 0) {
  113.                     System.out.println("Their defense is too high! Build up your attack");
  114.                 }
  115.                 System.out.println("Your training has paid off, your attack has raised by 2");
  116.                 attack = attack + 2;
  117.                
  118.                 damageTaken = 0;
  119.                 break;
  120.                
  121.             case 2:
  122.                 defendbool = true;
  123.                 defense = defense + 1;
  124.                 System.out.println("Your defense is now " + defense);
  125.                 break;
  126.                
  127.             case 3:
  128.                 agebool = true;
  129.                 age = age + 3;
  130.                 System.out.println("You are now " + age + " years old.");
  131.                 if (age == 20) {
  132.                     System.out.println("Adult Bonus (+2 attack)");
  133.                     attack = attack + 2;
  134.                 }
  135.                 if (age == 19) {
  136.                     System.out.println("Adult Bonus (+2 attack)");
  137.                     attack = attack + 2;
  138.                 }
  139.                 if (age == 18) {
  140.                     System.out.println("Adult Bonus (+2 attack)");
  141.                     attack = attack + 2;
  142.                 }
  143.                 break;
  144.                
  145.             case 4:
  146.                 hpbool = true;
  147.                 hp = hp + 3;
  148.                 System.out.println("Healed! You now have " + hp + " HP");
  149.                 break;
  150.            
  151.             default:
  152.                 System.out.println("Invalid Response, Please Try Again!");
  153.                 //Re-prompt
  154.            
  155.            
  156.        
  157.         }  
  158.         if (choice == 1) {
  159.             loop = false;
  160.         }
  161.         if (choice == 2) {
  162.             loop = false;
  163.         }
  164.         if (choice == 3) {
  165.             loop = false;
  166.         }
  167.         if (choice == 4) {
  168.             loop = false;
  169.         }
  170.        
  171.         }
  172.        
  173.         System.out.println("               ");             
  174.         System.out.println("Now It's your Enemy's turn to move.");
  175.         int eDamageGiven;
  176.        
  177.         Random randmove = new Random();
  178.         int eChoice = randmove.nextInt(4); 
  179.         eChoice += 1;
  180.        
  181.         switch (eChoice) {
  182.         case 1:
  183.             //Attack
  184.             eDamageGiven = eAttack - defense;
  185.             hp = hp - eDamageGiven;
  186.             System.out.println("Ouch! The Enemy has dealt " + eDamageGiven + " Damage to you. You now have " + hp + "HP");
  187.             if (eDamageGiven < 1) {
  188.                 System.out.println("Your enemy has grown much stronger (+5 Attack)");
  189.                 eAttack = eAttack + 5;
  190.             }
  191.             break;
  192.         case 2:
  193.             //Defense
  194.             eDefense = eDefense + 2;
  195.             System.out.println("The enemy grows stronger their defense has raised by 2, It's now " + eDefense);
  196.             break;
  197.             //Age
  198.         case 3:
  199.             eage = eage + 3;
  200.             System.out.println("Your Enemy has gone on vacation (+3 Age)");
  201.             if (age == 20) {
  202.                 eAttack = eAttack + 2;
  203.                 System.out.println("Your Enemy has become an adult (+2 Attack) Total: " + eAttack);
  204.             }
  205.             if (age == 19) {
  206.                 eAttack = eAttack + 2;
  207.                 System.out.println("Your Enemy has become an adult (+2 Attack) Total: " + eAttack);
  208.                
  209.             }
  210.             if (age == 18) {
  211.                 eAttack = eAttack + 2;
  212.                 System.out.println("Your Enemy has become an adult (+2 Attack) Total: " + eAttack);
  213.                
  214.             }
  215.             break;
  216.         case 4:
  217.             eHP = eHP + 3;
  218.             System.out.println("Your enemy has started eating healthier (+3 HP) Total: " + eHP);
  219.             break;
  220.            
  221.         default:
  222.             System.out.print("Looks like something went wrong... (Enemy choice system made a mistake) ");
  223.             System.out.println("Try restaring...");
  224.        
  225.            
  226.        
  227.        
  228.         }
  229.                
  230.                
  231.         }  
  232.        
  233.  
  234.        
  235.        
  236.        
  237.        
  238.  
  239.  
  240.     }
  241.  
  242. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement