World Of Zuul
I am really struggling with the World of Zuul game. The take command simply will not work! The drop one is fine though. Any help would be appreciated?
public void doDrop(Command c) {
if (! c.hasSecondWord()) { // "DROP",but no object named
System.out.println("Drop what?");
return;
}
String s = c.getSecondWord();
Item i = findByName(s, inventory);
if (i == null) {
System.out.println("You don't have a " + s);
return;
}
inventory.remove(i);
currentRoom.addItem(i);
System.out.println("You have dropped the " + s);
}
/**
* doTake: doesn't do anything yet
*/
public void doTake(Command c)
{
if(! c.hasSecondWord()) {
// if there is no second word, we don't know what to take
System.out.println("Take what?");
return;
}
String s = c.getSecondWord();
Item i = inventory.currentRoom().addItem(i);
if (i == null) {
System.out.println("There is no " + s + " here.");
return;
}
player.addItem(i);
player.currentRoom().remove(i);
}

