// Calculates champion statistics from personal and global history // dictionaries. public void CalcChampionStats() { foreach (int matchId in personalHistory.Keys) { PersonalParticipant personalParticipant = personalHistory[matchId]; foreach (int enemyChampionId in globalHistory[matchId]) { AddTally(personalParticipant.championId, enemyChampionId, Stats.Games); if (personalParticipant.isWin) { AddTally(personalParticipant.championId, enemyChampionId, Stats.Wins); } } } }
// Calculates personal win rate from personal history dictionary. public double CalcPersonalWinRate() { int wins = 0; int games = 0; foreach (int matchId in personalHistory.Keys) { games += 1; PersonalParticipant personalParticipant = personalHistory[matchId]; if (personalParticipant.isWin) { wins += 1; } } return(100d * wins / games); }