Advertisement
dford20

Untitled

Feb 16th, 2012
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.82 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Random;
  3.  
  4.  
  5. public class castlevania {
  6.  
  7.     public static void main(String[] args) {
  8.        
  9.         /*      Variable Declaration
  10.          * shopChoice is assigned to shopMenu to display the game menu
  11.          * gold is assigned to the newly instantiated Random object
  12.          * goldAmount is assigned to a set range field of 1 - 500,000 gold
  13.          */
  14.        
  15.         int shopChoice = shopMenu();
  16.         Random gold = new Random();
  17.         int goldAmount = gold.nextInt(500000) + 1;
  18.        
  19.         while(shopChoice != 5) {
  20.             switch(shopChoice) {
  21.             case 1:
  22.                 purchaseMedicine(goldAmount);
  23.                 break;
  24.             case 2:
  25.                 break;
  26.             case 3:
  27.                 break;
  28.             case 4:
  29.                 break;
  30.             default:
  31.                 break;
  32.             }
  33.            
  34.             shopChoice = shopMenu();
  35.         }
  36.     }
  37.    
  38.     public static int shopMenu() {
  39.        
  40.         int displayOption = 0;
  41.        
  42.         System.out.println("Master Librarian\n  Oh it's you, \n  Master Alucard. \n  What do you need?\n");
  43.        
  44.         System.out.println("1. Buy item");
  45.         System.out.println("2. Sell gem");
  46.         System.out.println("3. Tactics");
  47.         System.out.println("4. Enemy list");
  48.         System.out.println("5. Exit");
  49.        
  50.         Scanner myInput = new Scanner(System.in);
  51.         displayOption = myInput.nextInt();
  52.        
  53.         return displayOption;
  54.     }
  55.    
  56.     public static int purchaseMedicine(int goldAmount) {
  57.        
  58.         int[] medicinePrices = {500, 800, 2000, 8000, 4000, 200, 200};
  59.         String[] medicineNames = {"Jewel of Open,Potion, High Potion, Elixir, Manna Prism, Antivenom, Uncurse, Hammer, Library Card"};
  60.         int index;
  61.        
  62.         for(index = 0; index < medicinePrices.length; index++) {
  63.            
  64.             System.out.printf("%s%d\n", medicineNames[index] + medicinePrices[index]);
  65.         }
  66.        
  67.         System.out.printf("\tGold %d\n\n", goldAmount);
  68.         return index; // Returns the instances of medicineList
  69.     }
  70.    
  71.     public static int purchaseProjectiles(int goldAmount) {
  72.        
  73.         int[] projectileList = {300, 400, 500, 1000, 800, 2400, 5000, 8000, 15000};
  74.         int i;
  75.        
  76.         for(i = 0; i < projectileList.length; i++) {
  77.            
  78.             System.out.printf("Magic Missile %d\n", projectileList[0]);
  79.             System.out.printf("Bwaka Knife %d\n", projectileList[1]);
  80.             System.out.printf("Boomerang %d\n", projectileList[2]);
  81.             System.out.printf("Fire Boomerang %d\n", projectileList[3]);
  82.             System.out.printf("Javelin %d\n", projectileList[4]);
  83.             System.out.printf("Shuriken %d\n", projectileList[5]);
  84.             System.out.printf("Cross Shuriken %d\n", projectileList[6]);
  85.             System.out.printf("Buffalo Star %d\n", projectileList[7]);
  86.             System.out.printf("Flame Star %d\n\n", projectileList[8]);
  87.            
  88.         }
  89.        
  90.         System.out.printf("\tGold %d\n\n", goldAmount);
  91.         return i; // Returns the instances of projectileList
  92.     }
  93.    
  94.     public static int purchaseSwords(int goldAmount) {
  95.        
  96.         int[] swordsList = {4000, 10000, 10000, 10000, 12000};
  97.         int i;
  98.        
  99.         for(i = 0; i < swordsList.length; i++) {
  100.            
  101.             System.out.printf("Damascus Sword %d\n", swordsList[0]);
  102.             System.out.printf("Firebrand %d\n", swordsList[1]);
  103.             System.out.printf("Icebrand %d\n", swordsList[2]);
  104.             System.out.printf("Thunderbran %d\n", swordsList[3]);
  105.            
  106.         }
  107.        
  108.         System.out.printf("\tGold %d\n\n", goldAmount);
  109.         return i; // Returns the instances of swordsList
  110.     }
  111.    
  112.     public static int purchaseShields(int goldAmount) {
  113.        
  114.         int[] shieldsList = {400, 3980};
  115.         int i;
  116.        
  117.         for(i = 0; i < shieldsList.length; i++) {
  118.            
  119.             System.out.printf("Leather Shield %d\n", shieldsList[0]);
  120.             System.out.printf("Iron Shield %d\n", shieldsList[1]);
  121.            
  122.         }
  123.        
  124.         System.out.printf("\tGold %d\n\n", goldAmount);
  125.         return i;
  126.     }
  127.    
  128.     public static int purchaseHeadGear(int goldAmount) {
  129.        
  130.         int[] headGearList = {400, 1000, 4000, 12000};
  131.         int i;
  132.        
  133.         for(i = 0; i < headGearList.length; i++) {
  134.            
  135.             System.out.printf("Velvet Hat %d\n", headGearList[0]);
  136.             System.out.printf("Leather Hat %d\n", headGearList[0]);
  137.             System.out.printf("Circlet %d\n", headGearList[0]);
  138.             System.out.printf("Silver Crown %d\n", headGearList[0]);
  139.            
  140.         }
  141.        
  142.         System.out.printf("\tGold %d\n\n", goldAmount);
  143.         return i;
  144.     }
  145.    
  146.     public static int purchaseBodyGear(int goldAmount) {
  147.        
  148.         int[] bodyGearList = {1500, 4000, 12000};
  149.         int i;
  150.        
  151.         for(i = 0; i < bodyGearList.length; i++) {
  152.            
  153.             System.out.printf("Iron Cuirass %d\n", bodyGearList[0]);
  154.             System.out.printf("Steel Cuirass %d\n", bodyGearList[1]);
  155.             System.out.printf("Diamond Plate %d\n", bodyGearList[2]);
  156.            
  157.         }
  158.        
  159.         System.out.printf("\tGold %d\n\n", goldAmount);
  160.         return i;
  161.     }
  162.    
  163.     public static int purchaseCloaks(int goldAmount) {
  164.        
  165.         int[] cloaksList = {2000, 3000, 30000};
  166.         int i;
  167.        
  168.         for(i = 0; i < cloaksList.length; i++) {
  169.            
  170.             System.out.printf("Reverse Cloak %d\n", cloaksList[0]);
  171.             System.out.printf("Elven Cloak %d\n", cloaksList[1]);
  172.             System.out.printf("Joseph's Cloak %d\n", cloaksList[2]);
  173.         }
  174.        
  175.         System.out.printf("\tGold %d\n\n", goldAmount);
  176.         return i;
  177.     }
  178.    
  179.     public static int purchaseAccessories(int goldAmount) {
  180.        
  181.         int[] accessoryList = {3000, 4000, 8000, 500000};
  182.         int i;
  183.        
  184.         for(i = 0; i < accessoryList.length; i++) {
  185.            
  186.             System.out.printf("Medal %d\n", accessoryList[0]);
  187.             System.out.printf("Ring of Pales %d\n", accessoryList[1]);
  188.             System.out.printf("Gauntlet %d\n", accessoryList[2]);
  189.             System.out.printf("Duplicator %d\n", accessoryList[3]);
  190.            
  191.         }
  192.        
  193.         System.out.printf("\tGold %d\n\n", goldAmount);
  194.         return i;
  195.     }
  196.    
  197.     public static int purchaseScrolls(int goldAmount) {
  198.        
  199.         int[] scrollsList = new int[5];
  200.         int i;
  201.        
  202.         for(i = 0; i < scrollsList.length; i++) {
  203.            
  204.             System.out.printf("Summon Spirit %d\n", scrollsList[0]);
  205.             System.out.printf("Dark metamorphosis %d\n", scrollsList[1]);
  206.             System.out.printf("Hellfire %d\n", scrollsList[2]);
  207.             System.out.printf("Tetra Spirit %d\n", scrollsList[3]);
  208.             System.out.printf("Soul Steal %d\n", scrollsList[4]);
  209.         }
  210.        
  211.         System.out.printf("\tGold %d\n\n", goldAmount);
  212.         return i;
  213.     }
  214. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement