Ejemplo n.º 1
0
        private void listSquad(PlayerSquad sq) {
            List<PlayerProfile> members = sq.getMembers();

            DebugWrite("Team(^b" + TN(sq.getTeamId()) + "^n).Squad(^b" + SQN(sq.getSquadId()) + "^n): " + sq.getCount() + " players", 3);
            int count = 1;
            foreach (PlayerProfile pp in members)
                DebugWrite("    " + count++ + ".  ^b" + pp + "^n", 3);
        }
Ejemplo n.º 2
0
        private int mergeSquadWithPool(PlayerSquad squad, List<PlayerSquad> squads) {

            int players_moved = 0;
            if (squad == null)
                return 0;

            int squad_max_sz = 4;

            List<PlayerProfile> squad_players = squad.getMembers();


            /* sort the squads in increasing order of player count */

            squads.Sort(new Comparison<PlayerSquad>(squad_count_asc_cmp));

            for (int i = 0; i < squads.Count; i++) {
                PlayerSquad sorted_squad = squads[i];
                if (squad.getTeamId() == sorted_squad.getTeamId() &&
                    squad.getSquadId() == sorted_squad.getSquadId())
                    continue;

                while (sorted_squad.getFreeSlots() > 0 && squad_players.Count > 0) {
                    PlayerProfile squad_player = squad_players[0];
                    squad_players.RemoveAt(0);
                    if (movePlayer(squad_player, sorted_squad.getTeamId(), sorted_squad.getSquadId())) {
                        DebugWrite(squad_player + " moved to Team(" + TN(squad_player.getTeamId()) + ").Squad(" + SQN(squad_player.getSquadId()) + ")", 3);
                        sorted_squad.addPlayer(squad_player);
                        players_moved++;
                    }
                }
            }

            return players_moved;
        }