Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Engine: Remove UNKNOWN_LANE OperationError #23

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions BinaryMatrixEngine/GameExecution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public enum OperationError {
BREAK_ON_EMPTY,
DOUBLE_FACEUP_BREAK_IN_DEFENSE,
WRONG_ROLE,
UNKNOWN_CARD,
UNKNOWN_LANE
UNKNOWN_CARD
}

public static class GameExecution {
Expand Down Expand Up @@ -94,7 +93,7 @@ public static OperationError ExecutePlayerAction(GameContext context, Player pla
} break;
case ActionType.PLAY:
case ActionType.FACEUP_PLAY: {
if(action.lane == ActionSet.LANE_A) return OperationError.UNKNOWN_LANE;
Debug.Assert(action.lane != ActionSet.LANE_A);
Indexed<Card>? result = ResolveCard(action.card!, player);
if(result == null) return OperationError.UNKNOWN_CARD;

Expand Down Expand Up @@ -169,7 +168,7 @@ public static OperationError ExecutePlayerAction(GameContext context, Player pla
}
} break;
case ActionType.COMBAT: {
if(action.lane == ActionSet.LANE_A) return OperationError.UNKNOWN_LANE;
Debug.Assert(action.lane != ActionSet.LANE_A);
if(player.Role == PlayerRole.DEFENDER) return OperationError.WRONG_ROLE;
Lane lane = context.board.GetLane(action.lane);
if(lane.attackerStack.cards.Count == 0) return OperationError.EMPTY_STACK;
Expand Down
Loading