Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,20 @@ public async Task RoundMultiplierAdjustment()
await MatchController.GotoStage(RankedPlayStage.RoundWarmup);
}
}

[Fact]
public async Task CardDrawnOnNextPlayerRound()
{
// First round for each player doesn't draw any cards.
int[] expectedCardCounts = [5, 5, 6, 6, 7, 7];

for (int i = 0; i < expectedCardCounts.Length; i++)
{
Assert.Equal(expectedCardCounts[i], RoomState.Users[RoomState.ActiveUserId!.Value].Hand.Count);

// Go to the next round, for the next iteration.
await MatchController.GotoStage(RankedPlayStage.RoundWarmup);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ protected override async Task Begin()
State.CurrentRound++;
State.DamageMultiplier = computeDamageMultiplier(State.CurrentRound);

// For the first round, the active user is set during room initialisation.
if (State.CurrentRound > 1)
// Activate the next player.
// For the first round, this is set during room initialisation.
if (State.CurrentRound >= 2)
State.ActiveUserId = Controller.UserIdsByTurnOrder.Concat(Controller.UserIdsByTurnOrder).SkipWhile(u => u != State.ActiveUserId).Skip(1).First();

// Draw a card on the player's next (non-first) turn.
if (State.CurrentRound >= 3)
await Controller.AddCards(State.ActiveUserId!.Value, 1);
}

protected override async Task Finish()
Expand Down
Loading