public GamesSummary ComputeGamesSummary(List <MatchDto> matchHistory, long accountId)
        {
            GamesSummary gamesSummary  = new GamesSummary();
            DamageDealt  byPlayer      = new DamageDealt();
            DamageDealt  highestInTeam = new DamageDealt();
            PlayerScores playerScores  = new PlayerScores();

            ScoreService scoreService = new ScoreService();

            DamageService damageService = new DamageService();

            matchHistory.ForEach(delegate(MatchDto match)
            {
                int participantId = Retrieve.ParticipantIdForCurrentMatch(match.participantsIdentities, accountId);
                int teamId        = Retrieve.PlayerTeamId(match.participants, participantId);

                Boolean hasWon = HasWon(match.participants, participantId);

                playerScores.ReplaceScores(scoreService.GetPlayerScoresForCurrentMatch(match.participants, participantId));

                byPlayer.ReplaceDamage(damageService.ComputeDamageDealtByPlayer(match.participants, participantId));
                highestInTeam.ReplaceDamage(damageService.GetHighestDamageDealerInTeam(match.participants, teamId, participantId));
                gamesSummary.Add(
                    HasCarried(byPlayer, highestInTeam, hasWon) ? 1 : 0,
                    HasFed(playerScores) ? 1 : 0,
                    HasGottenCarried(playerScores, byPlayer, highestInTeam, hasWon) ? 1 : 0
                    );
            });

            return(gamesSummary);
        }
Beispiel #2
0
        public DamageDealt ComputeDamageDealtByTeam(List <MatchDto> matches, long accountId, Boolean isPlayerTeam)
        {
            DamageDealt dmgDealtByTeam = new DamageDealt();

            matches.ForEach(delegate(MatchDto match)
            {
                int playerParticipantId = Retrieve.ParticipantIdForCurrentMatch(match.participantsIdentities, accountId);

                int playerTeamId = Retrieve.PlayerTeamId(match.participants, playerParticipantId);

                dmgDealtByTeam.Add(ComputeDamageDealtByTeam(match.participants, playerTeamId, playerParticipantId));
            });

            dmgDealtByTeam.Normalize(matches.Count * (isPlayerTeam ? 4 : 5));

            return(dmgDealtByTeam);
        }