mirror of
https://github.com/ppy/osu.git
synced 2025-01-09 03:02:56 +08:00
Refactor for readability
This commit is contained in:
parent
43701c5d47
commit
ac67320b61
@ -154,7 +154,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSingleTeamBan()
|
public void TestPickBanOrder()
|
||||||
{
|
{
|
||||||
AddStep("set ban count", () => Ladder.CurrentMatch.Value!.Round.Value!.BanCount.Value = 1);
|
AddStep("set ban count", () => Ladder.CurrentMatch.Value!.Round.Value!.BanCount.Value = 1);
|
||||||
|
|
||||||
|
@ -151,9 +151,7 @@ namespace osu.Game.Tournament.Screens.MapPool
|
|||||||
|
|
||||||
int totalBansRequired = CurrentMatch.Value.Round.Value.BanCount.Value * 2;
|
int totalBansRequired = CurrentMatch.Value.Round.Value.BanCount.Value * 2;
|
||||||
|
|
||||||
const TeamColour roll_winner = TeamColour.Red; //todo: draw from match
|
TeamColour lastPickColour = CurrentMatch.Value.PicksBans.LastOrDefault()?.Team ?? TeamColour.Red;
|
||||||
|
|
||||||
var previousColour = CurrentMatch.Value.PicksBans.LastOrDefault()?.Team ?? roll_winner;
|
|
||||||
|
|
||||||
TeamColour nextColour;
|
TeamColour nextColour;
|
||||||
|
|
||||||
@ -161,22 +159,17 @@ namespace osu.Game.Tournament.Screens.MapPool
|
|||||||
|
|
||||||
if (!hasAllBans)
|
if (!hasAllBans)
|
||||||
{
|
{
|
||||||
// Ban phase.
|
// Ban phase: switch teams every second ban.
|
||||||
// Switch teams every second ban.
|
|
||||||
nextColour = CurrentMatch.Value.PicksBans.Count % 2 == 1
|
nextColour = CurrentMatch.Value.PicksBans.Count % 2 == 1
|
||||||
? getOppositeTeamColour(previousColour)
|
? getOppositeTeamColour(lastPickColour)
|
||||||
: previousColour;
|
: lastPickColour;
|
||||||
}
|
|
||||||
else if (pickType == ChoiceType.Ban)
|
|
||||||
{
|
|
||||||
// Switching from bans to picks - stay with the last team that was banning.
|
|
||||||
nextColour = pickColour;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Pick phase.
|
// Pick phase : switch teams every pick, except for the first pick which generally goes to the team that placed the last ban.
|
||||||
// Switch teams every pick.
|
nextColour = pickType == ChoiceType.Pick
|
||||||
nextColour = getOppositeTeamColour(previousColour);
|
? getOppositeTeamColour(lastPickColour)
|
||||||
|
: lastPickColour;
|
||||||
}
|
}
|
||||||
|
|
||||||
setMode(nextColour, hasAllBans ? ChoiceType.Pick : ChoiceType.Ban);
|
setMode(nextColour, hasAllBans ? ChoiceType.Pick : ChoiceType.Ban);
|
||||||
|
Loading…
Reference in New Issue
Block a user