Exemple #1
0
        /// <summary>
        /// Išspausdina veikėjų lentelę
        /// </summary>
        /// <param name="branchContainer">Filialų konteineris</param>
        /// <param name="file">Failas</param>
        private static void CreateReportTable(BranchContainer branchContainer, string file)
        {
            for (int i = 0; i < branchContainer.Count; i++)
            {
                using (var writer = new StreamWriter(file, true, Encoding.UTF8))
                {
                    writer.WriteLine("Duomenys apie rasę ir jos veikėjus");
                    writer.WriteLine(new string('-', 199));
                    writer.WriteLine("| Rasė: {0, -189} |", branchContainer.GetBranch(i).Race);
                    writer.WriteLine(new string('-', 199));
                    writer.WriteLine("| Miestas: {0, -186} |", branchContainer.GetBranch(i).Town);
                    writer.WriteLine(new string('-', 199));
                    writer.WriteLine("| {0, -15} | {1,-15} | {2,-15} | {3,-15} | {4,-15} | {5,-15} | {6,-15} | {7,-15} | {8,-15} | {9,-15} | {10,-15} |",
                                     "Vardas", "Klasė", "Gyvybės taškai", "Mana", "Žalos taškai ", "Gynybos taškai", "Jėga", "Vikrumas", "Intelektas", "Ypatinga galia", "Gildija");
                    writer.WriteLine(new string('-', 199));

                    for (int j = 0; j < branchContainer.GetBranch(i).Players.Count; j++)
                    {
                        writer.WriteLine(branchContainer.GetBranch(i).Players.GetPlayer(j));
                    }
                    writer.WriteLine(new string('-', 199));
                    writer.WriteLine();
                }
            }
        }
Exemple #2
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);
        }
Exemple #3
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);
        }
Exemple #4
0
 /// <summary>
 /// Suranda veikėjų rinktinę ir ideda į konteinerius
 /// </summary>
 /// <param name="branchContainer">Filialų konteineris</param>
 /// <param name="intelligenceLimit">Intelekto nurodytas dydis</param>
 /// <param name="damagePoint">Žalos taškų nurodytas dydis</param>
 /// <param name="selectionHeroes">Herojų rinktinės konteineris</param>
 /// <param name="selectionNPCs">NPCs rinktinės konteineris</param>
 public static void GeneralSelection(BranchContainer branchContainer, int intelligenceLimit, int damagePoint, out PlayerContainer selectionHeroes, out PlayerContainer selectionNPCs)
 {
     selectionHeroes = new PlayerContainer();
     selectionNPCs   = new PlayerContainer();
     for (int i = 0; i < branchContainer.Count; i++)
     {
         for (int j = 0; j < branchContainer.GetBranch(i).Players.Count; j++)
         {
             if ((branchContainer.GetBranch(i).GetPlayer(j) is Hero) && (branchContainer.GetBranch(i).GetPlayer(j) as Hero).Intelligence > intelligenceLimit)
             {
                 selectionHeroes.AddPlayer(branchContainer.GetBranch(i).GetPlayer(j));
             }
         }
         for (int j = 0; j < branchContainer.GetBranch(i).Players.Count; j++)
         {
             if ((branchContainer.GetBranch(i).GetPlayer(j) is NPC) && (branchContainer.GetBranch(i).GetPlayer(j) as NPC).Damage <= damagePoint)
             {
                 selectionNPCs.AddPlayer(branchContainer.GetBranch(i).GetPlayer(j));
             }
         }
     }
 }
Exemple #5
0
 /// <summary>
 /// Suranda veikėjus tankus ir ideda juos į konteinerius
 /// </summary>
 /// <param name="branchContainer">Filialų konteineris</param>
 /// <param name="filteredTanksHeroes">Herojų tankų konteineris</param>
 /// <param name="filteredTanksNPCs">Herojų NPCs konteineris</param>
 public static void FindTanks(BranchContainer branchContainer, out PlayerContainer filteredTanksHeroes, out PlayerContainer filteredTanksNPCs)
 {
     filteredTanksHeroes = new PlayerContainer();
     filteredTanksNPCs   = new PlayerContainer();
     for (int i = 0; i < branchContainer.Count; i++)
     {
         for (int j = 0; j < branchContainer.GetBranch(i).Players.Count; j++)
         {
             if ((branchContainer.GetBranch(i).GetPlayer(j) is Hero) && branchContainer.GetBranch(i).GetPlayer(j).IsTank(TankHealth, TankDefence))
             {
                 filteredTanksHeroes.AddPlayer(branchContainer.GetBranch(i).GetPlayer(j));
             }
         }
         for (int j = 0; j < branchContainer.GetBranch(i).Players.Count; j++)
         {
             if ((branchContainer.GetBranch(i).GetPlayer(j) is NPC) && branchContainer.GetBranch(i).GetPlayer(j).IsTank(TankHealth, TankDefence))
             {
                 filteredTanksNPCs.AddPlayer(branchContainer.GetBranch(i).GetPlayer(j));
             }
         }
     }
 }
Exemple #6
0
        public static Branch GeneralSelection(BranchContainer branchContainer, int intelligenceLimit, int damagePoint)
        {
            var selection = 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).IsIntelligence(intelligenceLimit))
                    {
                        selection.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).IsNotDamaged(damagePoint))
                    {
                        selection.AddNPC(branchContainer.GetBranch(i).NPCs.GetNPC(j));
                    }
                }
            }
            return(selection);
        }
Exemple #7
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);
        }
Exemple #8
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));
                }
            }
        }