static void Main(string[] args) { int inputNum = int.Parse(Console.ReadLine()); string[] input = new string[inputNum]; for (int i = 0; i < inputNum; i++) { input[i] = Console.ReadLine(); } foreach (var item in input) { Dragon d = new Dragon(item); addDragon(d); } printNestStatistics(); }
static void addDragon(Dragon d) { if (dragonNest.Count == 0) { dragonNest.Add(d); } else { string[] dragonTest = checkDuplicates(d); if (dragonTest[0] == "true") { int i = int.Parse(dragonTest[1]); dragonNest[i].dragonHealth = d.dragonHealth; dragonNest[i].dragonDamage = d.dragonDamage; dragonNest[i].dragonArmor = d.dragonArmor; } else { dragonNest.Add(d); } } }