예제 #1
0
        /// <summary>
        /// Suranda vienodus veikėjus
        /// </summary>
        /// <param name="branchContainer"></param>
        /// <returns>Vienodus veikėjus</returns>
        private static Dictionary <string, int> FilterPlayers(BranchContainer branchContainer)
        {
            var samePlayers = new Dictionary <string, int>();

            for (int i = 0; i < branchContainer.Count; i++)
            {
                for (var j = 0; j < branchContainer.GetBranch(i).Heroes.Count; j++)
                {
                    if (samePlayers.ContainsKey(branchContainer.GetBranch(i).Heroes.GetHero(j).Name))
                    {
                        samePlayers[branchContainer.GetBranch(i).Heroes.GetHero(j).Name]++;
                    }
                    else
                    {
                        samePlayers.Add(branchContainer.GetBranch(i).Heroes.GetHero(j).Name, 1);
                    }
                }

                for (var j = 0; j < branchContainer.GetBranch(i).NPCs.Count; j++)
                {
                    if (samePlayers.ContainsKey(branchContainer.GetBranch(i).NPCs.GetNPC(j).Name))
                    {
                        samePlayers[branchContainer.GetBranch(i).NPCs.GetNPC(j).Name]++;
                    }
                    else
                    {
                        samePlayers.Add(branchContainer.GetBranch(i).NPCs.GetNPC(j).Name, 1);
                    }
                }
            }
            return(samePlayers);
        }
예제 #2
0
        /// <summary>
        /// Suranda populiariausią klasę
        /// </summary>
        /// <param name="branchContainer"></param>
        /// <returns>Populiariausią klasę</returns>
        private static Dictionary <string, int> FindMostPopular(BranchContainer branchContainer)
        {
            var mostPopularRole = new Dictionary <string, int>();

            for (int i = 0; i < branchContainer.Count; i++)
            {
                for (var j = 0; j < branchContainer.GetBranch(i).Heroes.Count; j++)
                {
                    if (mostPopularRole.ContainsKey(branchContainer.GetBranch(i).Heroes.GetHero(j).Role))
                    {
                        mostPopularRole[branchContainer.GetBranch(i).Heroes.GetHero(j).Role]++;
                    }
                    else
                    {
                        mostPopularRole.Add(branchContainer.GetBranch(i).Heroes.GetHero(j).Role, 1);
                    }
                }

                for (var j = 0; j < branchContainer.GetBranch(i).NPCs.Count; j++)
                {
                    if (mostPopularRole.ContainsKey(branchContainer.GetBranch(i).NPCs.GetNPC(j).Role))
                    {
                        mostPopularRole[branchContainer.GetBranch(i).NPCs.GetNPC(j).Role]++;
                    }
                    else
                    {
                        mostPopularRole.Add(branchContainer.GetBranch(i).NPCs.GetNPC(j).Role, 1);
                    }
                }
            }
            return(mostPopularRole);
        }
예제 #3
0
        /// <summary>
        /// Suranda herojus kurie atitinka tanko parametrus
        /// </summary>
        /// <param name="branches">masyvas su visu rasiu duomenis</param>
        /// <returns>Gražina tankus</returns>
        public static Branch FindTanks(BranchContainer branchContainer)
        {
            var tanks = new Branch();

            for (int i = 0; i < branchContainer.Count; i++)
            {
                for (int j = 0; j < branchContainer.GetBranch(i).Heroes.Count; j++)
                {
                    if (branchContainer.GetBranch(i).Heroes.GetHero(j).IsTank(TankHealth, TankDefence))
                    {
                        tanks.AddHero(branchContainer.GetBranch(i).Heroes.GetHero(j));
                    }
                }

                for (int j = 0; j < branchContainer.GetBranch(i).NPCs.Count; j++)
                {
                    if (branchContainer.GetBranch(i).NPCs.GetNPC(j).IsTank(TankHealth, TankDefence))
                    {
                        tanks.AddNPC(branchContainer.GetBranch(i).NPCs.GetNPC(j));
                    }
                }
            }
            return(tanks);
        }
예제 #4
0
        /// <summary>
        /// Išspausdina žaidėjų lentelę
        /// </summary>
        /// <param name="branchContainer"></param>
        /// <param name="file"></param>
        private static void CreateReportTable(BranchContainer branchContainer, string file)
        {
            using (var writer = new StreamWriter(file, true, Encoding.UTF8))
            {
                writer.WriteLine("Žaidėjų sąrašai");
                writer.WriteLine(new string('-', 181));
                for (int i = 0; i < branchContainer.Count; i++)
                {
                    writer.WriteLine(new string('-', 181));
                    writer.WriteLine("Naujas žaidėjo sąrašas");
                    writer.WriteLine(new string('-', 181));
                    writer.WriteLine("| {0,-10} | {1,-15} | ", "Rasė", "Miestas");
                    writer.WriteLine($"| {branchContainer.GetBranch(i).Race,-10} | {branchContainer.GetBranch(i).Town,-15} |");

                    writer.WriteLine(new string('-', 181));
                    writer.WriteLine("Herojai");
                    writer.WriteLine(new string('-', 181));
                    writer.WriteLine("| {0, -15} | {1,-15} | {2,-15} | {3,-15} | {4,-15} | {5,-15} | {6,-15} | {7,-15} | {8,-15} | {9,-15} |",
                                     "Vardas", "Klasė", "Gyvybės taškai", "Mana", "Žalos taškai ", "Gynybos taškai", "Jėga", "Vikrumas", "Intelektas", "Ypatinga galia");
                    writer.WriteLine(new string('-', 181));
                    for (int j = 0; j < branchContainer.GetBranch(i).Heroes.Count; j++)
                    {
                        writer.WriteLine($"| {branchContainer.GetBranch(i).Heroes.GetHero(j).Name,-15} | {branchContainer.GetBranch(i).Heroes.GetHero(j).Role,-15} | " +
                                         $"{branchContainer.GetBranch(i).Heroes.GetHero(j).HitPoints,15} | {branchContainer.GetBranch(i).Heroes.GetHero(j).Mana,15} | " +
                                         $"{branchContainer.GetBranch(i).Heroes.GetHero(j).Damage,15} | {branchContainer.GetBranch(i).Heroes.GetHero(j).Defence,15} | " +
                                         $"{branchContainer.GetBranch(i).Heroes.GetHero(j).Strength,15} | {branchContainer.GetBranch(i).Heroes.GetHero(j).Agility,15} | " +
                                         $"{branchContainer.GetBranch(i).Heroes.GetHero(j).Intelligence,15} | {branchContainer.GetBranch(i).Heroes.GetHero(j).Power,-15} |");
                    }

                    writer.WriteLine(new string('-', 181));
                    writer.WriteLine("NPC");
                    writer.WriteLine(new string('-', 181));
                    writer.WriteLine("| {0, -15} | {1,-15} | {2,-15} | {3,-15} | {4,-15} | {5,-15} | {6,-15} |",
                                     "Vardas", "Klasė", "Gyvybės taškai", "Mana", "Žalos taškai ", "Gynybos taškai", "Gildija");
                    writer.WriteLine(new string('-', 181));
                    for (int j = 0; j < branchContainer.GetBranch(i).NPCs.Count; j++)
                    {
                        writer.WriteLine($"| {branchContainer.GetBranch(i).NPCs.GetNPC(j).Name,-15} | {branchContainer.GetBranch(i).NPCs.GetNPC(j).Role,-15} | " +
                                         $"{branchContainer.GetBranch(i).NPCs.GetNPC(j).HitPoints,15} | {branchContainer.GetBranch(i).NPCs.GetNPC(j).Mana,15} | " +
                                         $"{branchContainer.GetBranch(i).NPCs.GetNPC(j).Damage,15} | {branchContainer.GetBranch(i).NPCs.GetNPC(j).Defence,15} | " +
                                         $"{branchContainer.GetBranch(i).NPCs.GetNPC(j).Guild,-15} |");
                    }
                    writer.WriteLine(new string('-', 181));
                }
            }
        }