31 lines
775 B
Java
31 lines
775 B
Java
package com.github.dtschust.zork.repl.actions;
|
|
|
|
import com.github.dtschust.zork.ZorkGame;
|
|
import com.github.dtschust.zork.repl.Action;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* The "Update" command figures out what type of item it is, and then change its status
|
|
*/
|
|
public class UpdateAction implements Action {
|
|
@Override
|
|
public boolean matchesInput(List<String> arguments) {
|
|
return arguments.get(0).equals("Update");
|
|
}
|
|
|
|
@Override
|
|
public int getMinimumArgCount() {
|
|
return 1;
|
|
}
|
|
|
|
@Override
|
|
public boolean run(ZorkGame game, List<String> arguments) {
|
|
final String objectName = arguments.get(1);
|
|
final String newStatus = arguments.get(3);
|
|
|
|
game.updateObjectStatus(objectName, newStatus);
|
|
return true;
|
|
}
|
|
}
|