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); }
public DamageDealt GetHighestDamageDealerInTeam(List <ParticipantDto> participants, int teamId, int participantId) { DamageDealt highestInTeam = new DamageDealt(); participants.ForEach(delegate(ParticipantDto participant) { if ((participant.stats.totalDamageDealtToChampions > highestInTeam.averageDmgToChampions) && (participant.participantId != participantId) && (participant.teamId == teamId)) { highestInTeam.ReplaceDamage(participant.stats.totalDamageDealtToChampions, participant.stats.damageDealtToTurrets); } }); return(highestInTeam); }