Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class yeetyeet {
- // Copyright 2019 Alex Stinky Yuriaan
- public static void main(String[] args) {
- //Beginning Prompt --- Ask for name.
- System.out.println("Please Enter Your Name:");
- // Player (1)
- //Name
- boolean attackbool = false; // Never used (irrelevant)
- boolean defendbool = false; // Never used (irrelevant)
- boolean hpbool = false; // Never used (irrelevant)
- boolean agebool = false; // Never used (irrelevant)
- int damageTaken;
- //
- String name;
- Scanner keyboard = new Scanner(System.in);
- name = keyboard.nextLine();
- //Age (default set to 1)
- int age = 1;
- // Attack
- int attack = 3;
- // Defense
- int defense = 1;
- // Health
- int hp = 10;
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Enemy
- // Enemy Age
- Random rand1 = new Random();
- int eage = rand1.nextInt(10);
- eage += 1;
- // Enemy Attack
- Random rand2 = new Random();
- int eAttack = rand2.nextInt(5);
- eAttack += 1;
- // Enemy Defense
- Random rand3 = new Random();
- int eDefense = rand3.nextInt(2);
- eDefense += 1;
- // Enemy Health
- Random rand4 = new Random();
- int eHP = rand4.nextInt(15);
- eHP += 1;
- //////////////////////////////////////////////////////////////////
- // Setup
- System.out.println("Welcome to the game " + name + ("!"));
- System.out.println("Your Enemy is " + eage + " years old" );
- System.out.println("Your Enemy has " + eAttack + " Attack");
- System.out.println("Your Enemy has " + eDefense + " Defense");
- System.out.println("Your Enemy has " + eHP + " HP");
- System.out.println(" "); //space
- System.out.println("You are 1, and you have 3 attack, 1 defense and 10hp");
- System.out.println("You will move first, please enter a number");
- System.out.println("Attack -" + attack + " [1]");
- System.out.println("Fortify +" + defense + " [2]");
- System.out.println("Enjoy life (+3 age)" + " [3]");
- System.out.println("Diet (+3hp)" + " [4]");
- // game
- //Loop for Whole Game LAMwxdxmoV3df8XSuOhJsmTZwRoR5ART4vCDxLgwxCXjwUPod9VXFpf06SJwzbK63XqX4GbDHguu76j6bae/lYsx9JroAA==
- boolean wholeloop = true;
- while(wholeloop)
- {
- //Incorrect Decision Loop
- boolean loop = true;
- while(loop)
- {
- if (eHP <= 0) {
- System.out.println("THE ENEMY IS DEAD YOU WIN!!!!!!!!!!!");
- return;
- }
- if (hp <= 0) {
- System.out.println("YOU DIED!!!!!!!!");
- return;
- }
- int choice;
- choice = keyboard.nextInt();
- switch (choice) {
- case 1:
- attackbool = true;
- damageTaken = attack - eDefense;
- eHP = eHP - damageTaken;
- System.out.println("You've dealt " + damageTaken + " damage to the enemy.");
- System.out.println("They now have " + eHP + " health left.");
- if (damageTaken <= 0) {
- System.out.println("Their defense is too high! Build up your attack");
- }
- System.out.println("Your training has paid off, your attack has raised by 2");
- attack = attack + 2;
- damageTaken = 0;
- break;
- case 2:
- defendbool = true;
- defense = defense + 1;
- System.out.println("Your defense is now " + defense);
- break;
- case 3:
- agebool = true;
- age = age + 3;
- System.out.println("You are now " + age + " years old.");
- if (age == 20) {
- System.out.println("Adult Bonus (+2 attack)");
- attack = attack + 2;
- }
- if (age == 19) {
- System.out.println("Adult Bonus (+2 attack)");
- attack = attack + 2;
- }
- if (age == 18) {
- System.out.println("Adult Bonus (+2 attack)");
- attack = attack + 2;
- }
- break;
- case 4:
- hpbool = true;
- hp = hp + 3;
- System.out.println("Healed! You now have " + hp + " HP");
- break;
- default:
- System.out.println("Invalid Response, Please Try Again!");
- //Re-prompt
- }
- if (choice == 1) {
- loop = false;
- }
- if (choice == 2) {
- loop = false;
- }
- if (choice == 3) {
- loop = false;
- }
- if (choice == 4) {
- loop = false;
- }
- }
- System.out.println(" ");
- System.out.println("Now It's your Enemy's turn to move.");
- int eDamageGiven;
- Random randmove = new Random();
- int eChoice = randmove.nextInt(4);
- eChoice += 1;
- switch (eChoice) {
- case 1:
- //Attack
- eDamageGiven = eAttack - defense;
- hp = hp - eDamageGiven;
- System.out.println("Ouch! The Enemy has dealt " + eDamageGiven + " Damage to you. You now have " + hp + "HP");
- if (eDamageGiven < 1) {
- System.out.println("Your enemy has grown much stronger (+5 Attack)");
- eAttack = eAttack + 5;
- }
- break;
- case 2:
- //Defense
- eDefense = eDefense + 2;
- System.out.println("The enemy grows stronger their defense has raised by 2, It's now " + eDefense);
- break;
- //Age
- case 3:
- eage = eage + 3;
- System.out.println("Your Enemy has gone on vacation (+3 Age)");
- if (age == 20) {
- eAttack = eAttack + 2;
- System.out.println("Your Enemy has become an adult (+2 Attack) Total: " + eAttack);
- }
- if (age == 19) {
- eAttack = eAttack + 2;
- System.out.println("Your Enemy has become an adult (+2 Attack) Total: " + eAttack);
- }
- if (age == 18) {
- eAttack = eAttack + 2;
- System.out.println("Your Enemy has become an adult (+2 Attack) Total: " + eAttack);
- }
- break;
- case 4:
- eHP = eHP + 3;
- System.out.println("Your enemy has started eating healthier (+3 HP) Total: " + eHP);
- break;
- default:
- System.out.print("Looks like something went wrong... (Enemy choice system made a mistake) ");
- System.out.println("Try restaring...");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement