player command

This commit is contained in:
2025-04-04 14:46:58 +02:00
parent 55774b4605
commit 873ffc05d3
6 changed files with 51 additions and 10 deletions

View File

@@ -19,6 +19,10 @@ public class CommandExecutor {
assert this.outputSystem != null : "No output system specified !";
CommandResult result = command.execute(this.game, this.outputSystem);
// non player commands are not supposed to return move result
assert result != CommandResult.Moved || command instanceof PlayerCommand;
processResult(command, result);
return result;
}
@@ -34,7 +38,7 @@ public class CommandExecutor {
if (!needsPromote)
this.game.switchPlayerTurn();
} else if (command instanceof PromoteCommand) {
} else if (command instanceof PlayerCommand) {
this.game.switchPlayerTurn();
}
}