Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class Omega{
- public static void main(String[] args){
- Random rand = new Random();
- Scanner input = new Scanner(System.in);
- int playerHealth = 100;
- int playerMana = 100;
- int omegaHealth = 200;
- boolean gameRunning = true;
- boolean bossFightRunning = false;
- boolean inventoryRunning = false;
- boolean shopRunning = false;
- int mainMenuChoice;
- int bossMenuChoice;
- int swordDamage;
- int lunarDamage = 0;
- int omegaDamage;
- int healthPotions = 5;
- int manaPotions = 0;
- int ranarrSeeds = 0;
- int bones = 0;
- int staff = 0;
- int pet = 0;
- int lucky;
- int dropNumber;
- int killCount = 0;
- int deathCount = 0;
- int swordAttacksUsed = 0;
- int lunarAttacksUsed = 0;
- int manaPotionsUsed = 0;
- int healthPotionsUsed = 0;
- String userName;
- String password;
- System.out.println("Please type in your username: ");
- userName = input.nextLine();
- System.out.println("Please type in your password: ");
- password = input.nextLine();
- if(checkInfo(userName, password)){
- System.out.println("\nWelcome to Omega simulator!\n");
- while(gameRunning){
- mainMenu();
- mainMenuChoice = input.nextInt();
- switch(mainMenuChoice){
- case 1:
- backStory();
- bossFightRunning = true;
- while(bossFightRunning){
- if(playerHealth <= 0){
- System.out.println("Oh dear, you've died!");
- System.out.println("The water Nymphs nearby have risen you back to full health");
- System.out.println("but you better watch yourself next time\n");
- playerHealth = 100;
- omegaHealth = 200;
- deathCount++;
- bossFightRunning = false;
- break;
- }
- if(omegaHealth <= 0){
- bones++;
- System.out.println("Wow you've managed to slay the Omega!");
- System.out.println("His remains are in the form of werewolf bones...");
- omegaHealth = 200;
- killCount++;
- lucky = dropDrop();
- if(lucky == 0){
- System.out.println("The Omega didn't drop anything!");
- }else if(lucky == 1){
- System.out.println("You feel funny as if something is following you...");
- pet++;
- }else if(lucky == 2){
- System.out.println("The Omega dropped a Staff of the Moon!");
- staff++;
- }else if(lucky == 3){
- System.out.println("The Omega dropped three mana potions!");
- manaPotions+=3;
- }else if(lucky == 4){
- System.out.println("The Omega dropped a ranarr seed!");
- ranarrSeeds++;
- }else if(lucky == 5){
- System.out.println("The Omega dropped three health potions!");
- healthPotions+=3;
- }else if(lucky == 6){
- System.out.println("The Omega dropped one mana potion!");
- manaPotions++;
- }else if(lucky == 7){
- System.out.println("The Omega dropped two health potions!");
- healthPotions+=2;
- }
- bossFightRunning = false;
- break;
- }
- System.out.println();
- System.out.println("What do you want to do?");
- bossMenu();
- bossMenuChoice = input.nextInt();
- switch(bossMenuChoice){
- case 1:
- swordDamage = rand.nextInt(60);
- System.out.println("You swing your sword at Omega and hit him for " + swordDamage + " damage!" );
- omegaHealth -= swordDamage;
- System.out.println("Omega now has " + omegaHealth + " hitpoints.");
- omegaDamage = rand.nextInt(50);
- System.out.println("He claws you down for " + omegaDamage + " damage.");
- playerHealth -= omegaDamage;
- System.out.println("You now have " + playerHealth + " hitpoints.\n");
- System.out.println("You now have " + playerMana + " mana left");
- swordAttacksUsed++;
- break;
- case 2:
- if(staff == 0){
- System.out.println("You do not have the staff of the moon.");
- }else if(playerMana <25){
- System.out.println("You do not have enough mana to cast lunar seplls.");
- }else{
- lunarDamage = rand.nextInt(150);
- while(lunarDamage<80){
- lunarDamage = rand.nextInt(150);
- }
- playerMana-= 25;
- System.out.println("You cast a lunar spell at Omega and hit him for " + lunarDamage + " damage!" );
- omegaHealth -= lunarDamage;
- System.out.println("Omega now has " + omegaHealth + " hitpoints.");
- omegaDamage = rand.nextInt(50);
- System.out.println("He claws you down for " + omegaDamage + " damage.");
- playerHealth -= omegaDamage;
- System.out.println("You now have " + playerHealth + " hitpoints.");
- System.out.println("You now have " + playerMana + " mana left");
- lunarAttacksUsed++;
- }
- break;
- case 3:
- if(healthPotions <= 0){
- System.out.println("You don't have any health potions!\n");
- break;
- }else if(playerHealth >= 100){
- System.out.println("You already have max health!");
- }else if(playerHealth >= 51 && playerHealth <100){
- int healthDifference = 100 - playerHealth;
- System.out.println("You drink a health potion and restore" + healthDifference + "healthpoints.");
- playerHealth+= healthDifference;
- healthPotions--;
- healthPotionsUsed++;
- System.out.println("Your health is now " + playerHealth + " healthpoints");
- System.out.println("You now have " + healthPotions + " left.");
- }else{
- System.out.println("You drink a health potion and restore 50 healthpoints.");
- playerHealth+= 50;
- healthPotions--;
- healthPotionsUsed++;
- System.out.println("Your health is now " + playerHealth + " heathpoints.");
- System.out.println("You now have " + healthPotions + " left.");
- }
- break;
- case 4:
- if(manaPotions <= 0){
- System.out.println("You don't have any mana potions!\n");
- break;
- }else if(playerMana >= 100){
- System.out.println("You already have max mana!");
- }else if(playerMana >=51 && playerMana <100){
- int manaDifference = 100-playerMana;
- System.out.println("You drink a mana potion and restore" + manaDifference + " mana.");
- playerMana+= manaDifference;
- manaPotions--;
- manaPotionsUsed++;
- System.out.println("Your mana is now " + playerMana + " mana.");
- System.out.println("You now have " + manaPotions + " left.");
- }else{
- System.out.println("You drink a mana potion and restore 50 mana.");
- playerMana+= 50;
- manaPotions--;
- manaPotionsUsed++;
- System.out.println("Your mana is now " + playerMana + " mana.");
- System.out.println("You now have " + manaPotions + " left.");
- }
- break;
- case 5:
- System.out.println("You have surrendered\n");
- System.out.println("The nearby fairys decided to heal you up!");
- omegaHealth = 200;
- playerHealth = 100;
- bossFightRunning = false;
- break;
- default:
- break;
- }
- }
- break;
- case 2:
- System.out.println("#######Inventory and Statistics########\n");
- inventoryList(healthPotions, manaPotions, bones, staff, ranarrSeeds, pet, killCount, deathCount, swordAttacksUsed, lunarAttacksUsed, healthPotionsUsed, manaPotionsUsed);
- System.out.println("1. Return to main menu.");
- int leaveInventory = input.nextInt();
- if(leaveInventory == 1){
- break;
- }
- case 3:
- System.out.println("Shop is coming soon!");
- System.out.println("1. Return to main menu.");
- int leaveShop = input.nextInt();
- if(leaveShop == 1){
- break;
- }
- case 4:
- System.out.println("Good day!");
- gameRunning = false;
- break;
- default:
- break;
- }
- }
- }else{
- System.out.println("Your log-in information is not correct.");
- }
- }
- public static void backStory(){
- System.out.println("You approach the desolate, silent forest.");
- System.out.println("All that you possess is a mighty, lightbringing sword\nand five health potions.");
- System.out.println("An enormous werewolf suddenly emerges from the shrubs.");
- System.out.println("Rumour has it that killing this giant werewolf can yield");
- System.out.println("health potions, mana potions, ranarr seeds, and the staff of the moon");
- System.out.println("which can be used to cast magic spells requiring 25.");
- }
- public static void mainMenu(){
- System.out.println("1. Omega Fight");
- System.out.println("2. Inventory and Statistics");
- System.out.println("3. Shop");
- System.out.println("4. Leave the game!");
- }
- public static void bossMenu(){
- System.out.println("1. Attack Omega with your sword.");
- System.out.println("2. Attack Omega using lunar spells.");
- System.out.println("3. Drink a health potion.");
- System.out.println("4. Drink a mana potion.");
- System.out.println("5. Surrender the fight.");
- }
- public static boolean checkInfo(String u, String p){
- if(u.equals("Bricson") && p.equals("gotmilk17")){
- return true;
- }else{
- return false;
- }
- }
- public static void inventoryList(int h, int m, int b, int s, int r, int p, int kc, int dc, int sa, int la, int hu, int mu){
- System.out.println("Health Potions: " + h);
- System.out.println("Mana Potions: " + m);
- System.out.println("Werewolf Bones: " + b);
- System.out.println("Staff of the Moon: " + s);
- System.out.println("ranarr seeds: " + r);
- System.out.println("Werewolf Pet: " + p);
- System.out.println("");
- System.out.println("Killcount: " + kc);
- System.out.println("Deathcount: " + dc);
- System.out.println("Sword Attacks Used: " + sa);
- System.out.println("Lunar Attacks Used: " + la);
- System.out.println("Health Potions Used: " + hu);
- System.out.println("Mana Potions Used: " + mu);
- }
- public static int dropDrop(){
- int drop = 0;
- Random dropPercent = new Random();
- if((dropPercent.nextInt(100)+1) == 1){
- drop = 1;
- }else if((dropPercent.nextInt(100)+1) <= 20){
- drop = 2;
- }else if((dropPercent.nextInt(100)+1) <= 30){
- drop = 3;
- }else if((dropPercent.nextInt(100)+1) <= 35){
- drop = 4;
- }else if((dropPercent.nextInt(100)+1) <= 50){
- drop = 5;
- }else if((dropPercent.nextInt(100)+1) <= 65){
- drop = 6;
- }else if((dropPercent.nextInt(100)+1) <= 75){
- drop = 7;
- }
- return drop;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement