Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Random;
- public class castlevania {
- public static void main(String[] args) {
- /* Variable Declaration
- * shopChoice is assigned to shopMenu to display the game menu
- * gold is assigned to the newly instantiated Random object
- * goldAmount is assigned to a set range field of 1 - 500,000 gold
- */
- int shopChoice = shopMenu();
- Random gold = new Random();
- int goldAmount = gold.nextInt(500000) + 1;
- while(shopChoice != 5) {
- switch(shopChoice) {
- case 1:
- purchaseMedicine(goldAmount);
- break;
- case 2:
- break;
- case 3:
- break;
- case 4:
- break;
- default:
- break;
- }
- shopChoice = shopMenu();
- }
- }
- public static int shopMenu() {
- int displayOption = 0;
- System.out.println("Master Librarian\n Oh it's you, \n Master Alucard. \n What do you need?\n");
- System.out.println("1. Buy item");
- System.out.println("2. Sell gem");
- System.out.println("3. Tactics");
- System.out.println("4. Enemy list");
- System.out.println("5. Exit");
- Scanner myInput = new Scanner(System.in);
- displayOption = myInput.nextInt();
- return displayOption;
- }
- public static int purchaseMedicine(int goldAmount) {
- int[] medicinePrices = {500, 800, 2000, 8000, 4000, 200, 200};
- String[] medicineNames = {"Jewel of Open,Potion, High Potion, Elixir, Manna Prism, Antivenom, Uncurse, Hammer, Library Card"};
- int index;
- for(index = 0; index < medicinePrices.length; index++) {
- System.out.printf("%s%d\n", medicineNames[index] + medicinePrices[index]);
- }
- System.out.printf("\tGold %d\n\n", goldAmount);
- return index; // Returns the instances of medicineList
- }
- public static int purchaseProjectiles(int goldAmount) {
- int[] projectileList = {300, 400, 500, 1000, 800, 2400, 5000, 8000, 15000};
- int i;
- for(i = 0; i < projectileList.length; i++) {
- System.out.printf("Magic Missile %d\n", projectileList[0]);
- System.out.printf("Bwaka Knife %d\n", projectileList[1]);
- System.out.printf("Boomerang %d\n", projectileList[2]);
- System.out.printf("Fire Boomerang %d\n", projectileList[3]);
- System.out.printf("Javelin %d\n", projectileList[4]);
- System.out.printf("Shuriken %d\n", projectileList[5]);
- System.out.printf("Cross Shuriken %d\n", projectileList[6]);
- System.out.printf("Buffalo Star %d\n", projectileList[7]);
- System.out.printf("Flame Star %d\n\n", projectileList[8]);
- }
- System.out.printf("\tGold %d\n\n", goldAmount);
- return i; // Returns the instances of projectileList
- }
- public static int purchaseSwords(int goldAmount) {
- int[] swordsList = {4000, 10000, 10000, 10000, 12000};
- int i;
- for(i = 0; i < swordsList.length; i++) {
- System.out.printf("Damascus Sword %d\n", swordsList[0]);
- System.out.printf("Firebrand %d\n", swordsList[1]);
- System.out.printf("Icebrand %d\n", swordsList[2]);
- System.out.printf("Thunderbran %d\n", swordsList[3]);
- }
- System.out.printf("\tGold %d\n\n", goldAmount);
- return i; // Returns the instances of swordsList
- }
- public static int purchaseShields(int goldAmount) {
- int[] shieldsList = {400, 3980};
- int i;
- for(i = 0; i < shieldsList.length; i++) {
- System.out.printf("Leather Shield %d\n", shieldsList[0]);
- System.out.printf("Iron Shield %d\n", shieldsList[1]);
- }
- System.out.printf("\tGold %d\n\n", goldAmount);
- return i;
- }
- public static int purchaseHeadGear(int goldAmount) {
- int[] headGearList = {400, 1000, 4000, 12000};
- int i;
- for(i = 0; i < headGearList.length; i++) {
- System.out.printf("Velvet Hat %d\n", headGearList[0]);
- System.out.printf("Leather Hat %d\n", headGearList[0]);
- System.out.printf("Circlet %d\n", headGearList[0]);
- System.out.printf("Silver Crown %d\n", headGearList[0]);
- }
- System.out.printf("\tGold %d\n\n", goldAmount);
- return i;
- }
- public static int purchaseBodyGear(int goldAmount) {
- int[] bodyGearList = {1500, 4000, 12000};
- int i;
- for(i = 0; i < bodyGearList.length; i++) {
- System.out.printf("Iron Cuirass %d\n", bodyGearList[0]);
- System.out.printf("Steel Cuirass %d\n", bodyGearList[1]);
- System.out.printf("Diamond Plate %d\n", bodyGearList[2]);
- }
- System.out.printf("\tGold %d\n\n", goldAmount);
- return i;
- }
- public static int purchaseCloaks(int goldAmount) {
- int[] cloaksList = {2000, 3000, 30000};
- int i;
- for(i = 0; i < cloaksList.length; i++) {
- System.out.printf("Reverse Cloak %d\n", cloaksList[0]);
- System.out.printf("Elven Cloak %d\n", cloaksList[1]);
- System.out.printf("Joseph's Cloak %d\n", cloaksList[2]);
- }
- System.out.printf("\tGold %d\n\n", goldAmount);
- return i;
- }
- public static int purchaseAccessories(int goldAmount) {
- int[] accessoryList = {3000, 4000, 8000, 500000};
- int i;
- for(i = 0; i < accessoryList.length; i++) {
- System.out.printf("Medal %d\n", accessoryList[0]);
- System.out.printf("Ring of Pales %d\n", accessoryList[1]);
- System.out.printf("Gauntlet %d\n", accessoryList[2]);
- System.out.printf("Duplicator %d\n", accessoryList[3]);
- }
- System.out.printf("\tGold %d\n\n", goldAmount);
- return i;
- }
- public static int purchaseScrolls(int goldAmount) {
- int[] scrollsList = new int[5];
- int i;
- for(i = 0; i < scrollsList.length; i++) {
- System.out.printf("Summon Spirit %d\n", scrollsList[0]);
- System.out.printf("Dark metamorphosis %d\n", scrollsList[1]);
- System.out.printf("Hellfire %d\n", scrollsList[2]);
- System.out.printf("Tetra Spirit %d\n", scrollsList[3]);
- System.out.printf("Soul Steal %d\n", scrollsList[4]);
- }
- System.out.printf("\tGold %d\n\n", goldAmount);
- return i;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement