
hero 5.1
By:
ace on
May 2nd, 2010 | syntax:
None | size: 1.47 KB | hits: 22 | expires: Never
import java.util.HashMap;
/**
* Write a description of class Hero here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Hero
{
// instance variables - replace the example below with your own
private HashMap<String, Potion> potions;
private HashMap<String, Scroll> scrolls;
private HashMap <String, Spell> spells;
/**
* Constructor for objects of class Hero
*/
public Hero()
{
potions = new HashMap<String, Potion>();
scrolls = new HashMap<String, Scroll>();
spells = new HashMap <String, Spell>();
}
/**
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public Potion getPotion(String description)
{
Alchemist alchemist = new Alchemist();
potions.put(description, alchemist.requestPotion(description));
Potion p = potions.get(description);
return p;
}
public Scroll getScroll(String description)
{
Scribe scribe = new Scribe();
scrolls.put(description, scribe.requestScroll(description));
Scroll s = scrolls.get(description);
return s;
}
public Spell getSpell()
{
Magician magician = new Magician();
spells.put("dragon descaler", magician.getDragonDescaler(getPotion("piss and vinegar"),
getScroll("knowlege")));
Spell spell = spells.get("dragon descaler");
return spell;
}
}