This repository has been archived on 2022-12-21. You can view files and clone it, but cannot push or open issues or pull requests.
2022-11-21 15:36:38 +00:00
|
|
|
package com.github.dtschust.zork.repl.actions;
|
|
|
|
|
2022-11-22 08:55:26 +00:00
|
|
|
import com.github.dtschust.zork.ZorkGame;
|
2022-11-21 15:36:38 +00:00
|
|
|
import com.github.dtschust.zork.repl.Action;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The "Game Over" action marks the end of the game.
|
|
|
|
*/
|
2022-11-21 23:46:20 +00:00
|
|
|
public class GameOverAction implements Action {
|
2022-11-21 15:36:38 +00:00
|
|
|
@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
|
2022-11-22 17:03:09 +00:00
|
|
|
public boolean run(ZorkGame game, List<String> arguments) {
|
|
|
|
game.stream.println("Victory!");
|
2022-11-21 15:36:38 +00:00
|
|
|
game.setGameOver();
|
2022-11-22 15:46:23 +00:00
|
|
|
return true;
|
2022-11-21 15:36:38 +00:00
|
|
|
}
|
|
|
|
}
|