Skip to content

Commit 52fb291

Browse files
authored
Draw a card on the next player round (#455)
1 parent 9a5e359 commit 52fb291

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

osu.Server.Spectator.Tests/RankedPlay/Stages/RoundWarmupStageTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,20 @@ public async Task RoundMultiplierAdjustment()
6969
await MatchController.GotoStage(RankedPlayStage.RoundWarmup);
7070
}
7171
}
72+
73+
[Fact]
74+
public async Task CardDrawnOnNextPlayerRound()
75+
{
76+
// First round for each player doesn't draw any cards.
77+
int[] expectedCardCounts = [5, 5, 6, 6, 7, 7];
78+
79+
for (int i = 0; i < expectedCardCounts.Length; i++)
80+
{
81+
Assert.Equal(expectedCardCounts[i], RoomState.Users[RoomState.ActiveUserId!.Value].Hand.Count);
82+
83+
// Go to the next round, for the next iteration.
84+
await MatchController.GotoStage(RankedPlayStage.RoundWarmup);
85+
}
86+
}
7287
}
7388
}

osu.Server.Spectator/Hubs/Multiplayer/Matchmaking/RankedPlay/Stages/RoundWarmupStage.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ protected override async Task Begin()
3131
State.CurrentRound++;
3232
State.DamageMultiplier = computeDamageMultiplier(State.CurrentRound);
3333

34-
// For the first round, the active user is set during room initialisation.
35-
if (State.CurrentRound > 1)
34+
// Activate the next player.
35+
// For the first round, this is set during room initialisation.
36+
if (State.CurrentRound >= 2)
3637
State.ActiveUserId = Controller.UserIdsByTurnOrder.Concat(Controller.UserIdsByTurnOrder).SkipWhile(u => u != State.ActiveUserId).Skip(1).First();
38+
39+
// Draw a card on the player's next (non-first) turn.
40+
if (State.CurrentRound >= 3)
41+
await Controller.AddCards(State.ActiveUserId!.Value, 1);
3742
}
3843

3944
protected override async Task Finish()

0 commit comments

Comments
 (0)