public static int[] playersForRolesinTeam(Team t) { int[] nplayr = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; List<string> roles = new List<string>() { "PT", "DC", "DD", "DS", "CC", "CD", "CS", "AD", "AS", "AC" }; foreach (Player pl in t.getPlayers()) { int i = roles.IndexOf(pl.Role); if (i >= 0) nplayr[i] += 1; } return nplayr; }
public bool check(Team t, Module m) { foreach (Player pl in t.getPlayers()) { int i = roles.IndexOf(pl.Role); if (i >= 0) nplayr[i] += 1; } int length = nplayr.Count(); int[] needed = playerForRolesForModule(m.SelectedModule); for (int i = 0; i < length; i++) { if (nplayr[i] < needed[i]) return false; } return true; }