Exemplo n.º 1
0
        public async Task<BoutResult> FightPersonal()
        {
            await Task.Delay(DELAY);

            var result = new BoutResult() { Category = "Personal" };

            result.Results.Add(FightString("Headline", Fighter1.title, Fighter2.title));
            result.Results.Add(FightString("Location", Fighter1.location, Fighter2.location));
            result.Results.Add(FightString("Website", Fighter1.website_link, Fighter2.website_link));
            result.Results.Add(FightString("Bio", Fighter1.bio, Fighter2.bio));

            result = CalculateWinner(result);

            return result;
        }
Exemplo n.º 2
0
        public async Task<BoutResult> FightGeneralCounts()
        {
            await Task.Delay(DELAY);

            var result = new BoutResult() { Category = "Statistics" };

            result.Results.Add(FightInt("Views", Fighter1.views, Fighter2.views));
            result.Results.Add(FightInt("Followers", Fighter1.follower_count, Fighter2.follower_count));
            result.Results.Add(FightInt("Following", Fighter1.following_count, Fighter2.following_count));
            result.Results.Add(FightInt("1 bit badges", Fighter1.one_bit_badges, Fighter2.one_bit_badges));
            result.Results.Add(FightInt("8 bit badges", Fighter1.eight_bit_badges, Fighter2.eight_bit_badges));
            result.Results.Add(FightInt("16 bit badges", Fighter1.sixteen_bit_badges, Fighter2.sixteen_bit_badges));
            result.Results.Add(FightInt("32 bit badges", Fighter1.thirty_two_bit_badges, Fighter2.thirty_two_bit_badges));
            result.Results.Add(FightInt("64 bit badges", Fighter1.sixty_four_bit_badges, Fighter2.sixty_four_bit_badges));

            result = CalculateWinner(result);

            return result;
        }
Exemplo n.º 3
0
        private BoutResult CalculateWinner(BoutResult boutResult)
        {
            var Fighter1Count = 0;
            var Fighter2Count = 0;
            foreach (var item in boutResult.Results)
            {
                if (item.Fighter1Hits > item.Fighter2Hits)
                    Fighter1Count += item.Fighter1Hits;
                else if (item.Fighter2Hits > item.Fighter1Hits)
                    Fighter2Count += item.Fighter2Hits;
            }

            if (Fighter1Count > Fighter2Count)
                boutResult.Fighter1Won = true;
            else if (Fighter2Count > Fighter1Count)
                boutResult.Fighter2Won = true;
            else
            {
                boutResult.Fighter1Won = true;
            }

            return boutResult;
        }
Exemplo n.º 4
0
        private async Task<BoutResult> FightApiModelStat(string category, List<ApiModel.Stat> firstStats, List<ApiModel.Stat> secondStats)
        {
            await Task.Delay(DELAY);

            var result = new BoutResult() { Category = category };

            result.Results.AddRange(FightSkills(firstStats, secondStats, true));
            result.Results.AddRange(FightSkills(secondStats, firstStats, false));

            result = CalculateWinner(result);

            return result;
        }