Пример #1
0
 public static List <PersonalBurstingBoilAssignment> ListAssignments(BurstingBoilAssignment assignments)
 {
     return(assignments.Sides.SelectMany(s => s.Value.Select(p => new PersonalBurstingBoilAssignment
     {
         Area = s.Key,
         Player = p
     })).ToList());
 }
Пример #2
0
        public static BurstingBoilAssignment AssignBurstingBoilAreas(List <OrbAssignment> orbAssignments)
        {
            var playersLeft     = orbAssignments;
            var boilAssignments = new BurstingBoilAssignment();

            playersLeft = AssignLeftThrowers(playersLeft, boilAssignments);
            playersLeft = AssignRightThrowers(playersLeft, boilAssignments);
            playersLeft = AssignHealers(playersLeft, boilAssignments);
            AssignRest(playersLeft, boilAssignments);

            return(boilAssignments);
        }
Пример #3
0
        private static void AssignRest(List <OrbAssignment> playersLeft, BurstingBoilAssignment boilAssignments)
        {
            var numMoon    = boilAssignments.Sides[BurstingBoilArea.Moon].Count();
            var numDiamond = boilAssignments.Sides[BurstingBoilArea.Diamond].Count();

            foreach (var assignment in playersLeft)
            {
                if (numMoon < MaxMoon && assignment.Side == OrbSide.Left)
                {
                    boilAssignments.Sides[BurstingBoilArea.Moon].Add(assignment.Player);
                    numMoon++;
                    continue;
                }
                if (numDiamond < DiamondMax && assignment.Side == OrbSide.Right)
                {
                    boilAssignments.Sides[BurstingBoilArea.Diamond].Add(assignment.Player);
                    numDiamond++;
                    continue;
                }
                boilAssignments.Sides[BurstingBoilArea.Star].Add(assignment.Player);
            }
        }
Пример #4
0
        private static List <OrbAssignment> AssignHealers(List <OrbAssignment> playersLeft, BurstingBoilAssignment boilAssignments)
        {
            var numMoonHealers    = boilAssignments.Sides[BurstingBoilArea.Moon].Count(p => p.Role == Players.PlayerRole.Healer);
            var numDiamondHealers = boilAssignments.Sides[BurstingBoilArea.Diamond].Count(p => p.Role == Players.PlayerRole.Healer);
            var healersLeft       = playersLeft.Where(a => a.Player.Role == Players.PlayerRole.Healer).ToList();

            foreach (var healer in healersLeft)
            {
                if (numMoonHealers < 2 && healer.Side == OrbSide.Left)
                {
                    boilAssignments.Sides[BurstingBoilArea.Moon].Add(healer.Player);
                    numMoonHealers++;
                    continue;
                }
                if (numDiamondHealers < 2 && healer.Side == OrbSide.Right)
                {
                    boilAssignments.Sides[BurstingBoilArea.Diamond].Add(healer.Player);
                    numDiamondHealers++;
                    continue;
                }
                boilAssignments.Sides[BurstingBoilArea.Star].Add(healer.Player);
            }

            return(playersLeft.Except(healersLeft).ToList());
        }
Пример #5
0
        private static List <OrbAssignment> AssignRightThrowers(List <OrbAssignment> playersLeft, BurstingBoilAssignment boilAssignments)
        {
            var rightThrowers = playersLeft.Where(a => a.Side == OrbSide.Right && a.Role == OrbRole.Thrower).ToList();

            boilAssignments.Sides[BurstingBoilArea.Diamond] = rightThrowers.Select(a => a.Player).ToList();

            return(playersLeft.Except(rightThrowers).ToList());
        }
Пример #6
0
        private static List <OrbAssignment> AssignLeftThrowers(List <OrbAssignment> playersLeft, BurstingBoilAssignment boilAssignments)
        {
            var leftThrowers = playersLeft.Where(a => a.Side == OrbSide.Left && a.Role == OrbRole.Thrower).ToList();

            boilAssignments.Sides[BurstingBoilArea.Moon] = leftThrowers.Select(a => a.Player).ToList();

            return(playersLeft.Except(leftThrowers).ToList());
        }