Skip to content

Commit

Permalink
mappool mode
Browse files Browse the repository at this point in the history
  • Loading branch information
cdwcgt committed Jul 14, 2024
1 parent d2e9908 commit f883b09
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,32 +170,41 @@ private void setNextMode()
if (CurrentMatch.Value?.Round.Value == null)
return;

// just for now
int totalProtectsRequired = 2;

Check failure on line 174 in osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Convert into constant in osu.Game.Tournament\Screens\MapPool\MapPoolScreen.cs on line 174

int totalBansRequired = CurrentMatch.Value.Round.Value.BanCount.Value * 2;

TeamColour lastPickColour = CurrentMatch.Value.PicksBans.LastOrDefault()?.Team ?? TeamColour.Red;

TeamColour nextColour;

//bool hasAllProtected = CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Protected) >= 2;
bool hasAllProtected = CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Protected) >= totalProtectsRequired;

bool hasAllBans = CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= totalBansRequired;

if (!hasAllBans)
if (!hasAllProtected)
{
// Ban phase: switch teams every second ban.
// Protect phase: ?.
nextColour = CurrentMatch.Value.PicksBans.Count % 2 == 1
? getOppositeTeamColour(lastPickColour)
: lastPickColour;
}
else
else if (!hasAllBans)
{
// Pick phase : switch teams every pick, except for the first pick which generally goes to the team that placed the last ban.
nextColour = pickType == ChoiceType.Pick
// Ban phase: switch teams every second ban.
nextColour = CurrentMatch.Value.PicksBans.Count % 2 == 1
? getOppositeTeamColour(lastPickColour)
: lastPickColour;
}
else
{
// Pick phase : switch teams every pick, except for the first pick which generally goes to the team that placed the last ban (not for MCNC).
nextColour = getOppositeTeamColour(lastPickColour);
}

ChoiceType nextMode = !hasAllBans ? ChoiceType.Ban : ChoiceType.Pick;
ChoiceType nextMode = !hasAllProtected ? ChoiceType.Protected
: !hasAllBans ? ChoiceType.Ban : ChoiceType.Pick;

setMode(nextColour, nextMode);

Expand All @@ -213,7 +222,7 @@ protected override bool OnMouseDown(MouseDownEvent e)
addForBeatmap(map.Beatmap.OnlineID);
else
{
var existing = CurrentMatch.Value?.PicksBans.FirstOrDefault(p => p.BeatmapID == map.Beatmap?.OnlineID);
var existing = CurrentMatch.Value?.PicksBans.LastOrDefault(p => p.BeatmapID == map.Beatmap?.OnlineID);

if (existing != null)
{
Expand Down

0 comments on commit f883b09

Please sign in to comment.