36 lines
940 B
Java
36 lines
940 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;
|
|
|
|
|
|
/**
|
|
* Add: figure out what type the destination is, then what type the object is. Then add object to destination if it makes sense
|
|
*/
|
|
public class StartGameAction implements Action {
|
|
@Override
|
|
public boolean matchesInput(List<String> arguments) {
|
|
return arguments.get(0).equals("Start") && arguments.get(1).equals("at");
|
|
}
|
|
|
|
@Override
|
|
public int getMinimumArgCount() {
|
|
return 3;
|
|
}
|
|
|
|
@Override
|
|
public boolean run(ZorkGame game, List<String> arguments) {
|
|
final String room = arguments.get(2);
|
|
|
|
if(!game.isRunning()){
|
|
if(game.changeRoom(room)){
|
|
game.stream.println(game.getCurrentRoom().getDescription());
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|