Ejemplo n.º 1
0
        public void DamageDealt_Constructor()
        {
            DamageDealt damageDealt = new DamageDealt(DamageType.Force, 10);

            Assert.AreEqual(DamageType.Force, damageDealt.DamageType);
            Assert.AreEqual(10, damageDealt.Amount);
        }
Ejemplo n.º 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (activePokemon_ != null)
            {
                hash ^= ActivePokemon.GetHashCode();
            }
            if (trainerPublicProfile_ != null)
            {
                hash ^= TrainerPublicProfile.GetHashCode();
            }
            hash ^= reversePokemon_.GetHashCode();
            hash ^= defeatedPokemon_.GetHashCode();
            hash ^= lobbyPokemon_.GetHashCode();
            if (DamageDealt != 0)
            {
                hash ^= DamageDealt.GetHashCode();
            }
            if (SuperEffectiveChargeMove != false)
            {
                hash ^= SuperEffectiveChargeMove.GetHashCode();
            }
            if (WeatherBoosted != false)
            {
                hash ^= WeatherBoosted.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        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);
        }
Ejemplo n.º 4
0
        private DamageDealt ComputeDamageDealtByTeam(List <ParticipantDto> participants, int teamId, int playerParticipantId)
        {
            DamageDealt dmgDealt = new DamageDealt();

            participants.ForEach(delegate(ParticipantDto participant)
            {
                if (participant.teamId == teamId && participant.participantId != playerParticipantId)
                {
                    dmgDealt.Add(participant.stats.totalDamageDealtToChampions, participant.stats.damageDealtToTurrets);
                }
            });

            return(dmgDealt);
        }
Ejemplo n.º 5
0
        public DamageDealt ComputeDamageDealtByPlayer(List <ParticipantDto> participants, int participantId)
        {
            DamageDealt dmg = new DamageDealt();

            participants.ForEach(delegate(ParticipantDto participant)
            {
                if (participant.participantId == participantId)
                {
                    dmg.Add(participant.stats.totalDamageDealtToChampions, participant.stats.damageDealtToTurrets);
                }
            });

            return(dmg);
        }
Ejemplo n.º 6
0
        public DamageDealt ComputeAverageDamageDealtByPlayer(List <MatchDto> matches, long accountId)
        {
            DamageDealt dmgDealtByPlayer = new DamageDealt();
            int         totalGames       = matches.Count;

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

                dmgDealtByPlayer.Add(ComputeDamageDealtByPlayer(match.participants, playerParticipantId));
            });

            dmgDealtByPlayer.Normalize(matches.Count);

            return(dmgDealtByPlayer);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
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);
        }
 private Boolean HasGottenCarried(PlayerScores playerScores, DamageDealt byPlayer, DamageDealt highestInTeam, Boolean hasWon)
 {
     return(hasWon &&
            HasFed(playerScores) &&
            (byPlayer.averageDmgToChampions * 1.30 < highestInTeam.averageDmgToChampions));
 }
 private Boolean HasCarried(DamageDealt byPlayer, DamageDealt highestInTeam, Boolean hasWon)
 {
     return(hasWon && byPlayer.averageDmgToChampions > (highestInTeam.averageDmgToChampions * 1.45));
 }
Ejemplo n.º 11
0
 public void ShowHealing(float damageDealt, BattleObject parent)
 {
     P_currentDamageDealt = Instantiate(P_DamageDealt) as DamageDealt;
     P_currentDamageDealt.Init(damageDealt, parent, true);
 }