29 lines
684 B
Java
29 lines
684 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 "Game Over" action marks the end of the game.
|
|
*/
|
|
public class GameOverAction implements Action {
|
|
@Override
|
|
public boolean matchesInput(List<String> arguments) {
|
|
return arguments.get(0).equals("Game") && arguments.get(1).equals("Over");
|
|
}
|
|
|
|
@Override
|
|
public int getMinimumArgCount() {
|
|
return 2;
|
|
}
|
|
|
|
@Override
|
|
public boolean run(ZorkGame game, List<String> arguments) {
|
|
game.stream.println("Victory!");
|
|
game.setGameOver();
|
|
return true;
|
|
}
|
|
}
|