Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

hero 5.1

By: ace on May 2nd, 2010  |  syntax: None  |  size: 1.47 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.util.HashMap;
  2.  
  3. /**
  4.  * Write a description of class Hero here.
  5.  *
  6.  * @author (your name)
  7.  * @version (a version number or a date)
  8.  */
  9. public class Hero
  10. {
  11.     // instance variables - replace the example below with your own
  12.  
  13.     private HashMap<String, Potion> potions;
  14.     private HashMap<String, Scroll> scrolls;
  15.     private HashMap <String, Spell> spells;
  16.    
  17.     /**
  18.      * Constructor for objects of class Hero
  19.      */
  20.     public Hero()
  21.     {
  22.         potions = new HashMap<String, Potion>();
  23.         scrolls = new HashMap<String, Scroll>();
  24.         spells = new HashMap <String, Spell>();
  25.        
  26.     }
  27.  
  28.     /**
  29.      * An example of a method - replace this comment with your own
  30.      *
  31.      * @param  y   a sample parameter for a method
  32.      * @return     the sum of x and y
  33.      */
  34.     public Potion getPotion(String description)
  35.     {
  36. Alchemist alchemist = new Alchemist();
  37. potions.put(description, alchemist.requestPotion(description));
  38. Potion p = potions.get(description);
  39. return p;
  40.  
  41. }
  42.  
  43. public Scroll getScroll(String description)
  44. {
  45. Scribe scribe = new Scribe();
  46. scrolls.put(description, scribe.requestScroll(description));
  47. Scroll s = scrolls.get(description);
  48. return s;
  49. }
  50.  
  51.  
  52. public Spell getSpell()
  53. {
  54. Magician magician = new Magician();
  55. spells.put("dragon descaler", magician.getDragonDescaler(getPotion("piss and vinegar"),
  56. getScroll("knowlege")));
  57. Spell spell = spells.get("dragon descaler");
  58. return spell;
  59.  
  60. }
  61.  
  62.  
  63.  
  64. }