synonyms, and take all command

This commit is contained in:
jslightham
2019-05-29 10:56:22 -04:00
parent 2d40e5954a
commit bad3490b1e
6 changed files with 90 additions and 6 deletions

View File

@@ -330,7 +330,24 @@ class Game {
}
break;
case "take":
if(command.hasItem()) {
boolean hasAll = false;
for(String a : command.getOtherWords()) {
if(a.equals("all"))
hasAll = true;
}
if(hasAll){
for(int i =0; i<currentRoom.getItems().size(); i++) {
if(player.addToInventory(currentRoom.getItem(i))) {
currentRoom.removeItem(i);
i--;
}else {
System.out.println("You can't carry any more!");
break;
}
System.out.println("Taken");
}
}
else if(command.hasItem()) {
Class<?> clazz;
Item object;
try {
@@ -445,11 +462,9 @@ class Game {
}else {
System.out.println("That enemy is not in this room!");
}
}else {
System.out.println("Attack what?");
}
} else {
if(command.hasItem()) {
boolean has = false;
@@ -468,6 +483,7 @@ class Game {
break;
case "read":
break;
default:
return false;
}