public void Add(Gladiator gladiator) { if (!gladiators.ContainsKey(gladiator.Name)) { bool isValid = true; if (gladiators.Count > 0) { foreach (var item in gladiators) { int gladiatorStatPow = gladiator.GetStatPower(); int gladiatorWeaponPow = gladiator.GetWeaponPower(); int gladiatorTotalPow = gladiator.GetTotalPower(); int oponentStatPow = item.Value.GetStatPower(); int oponentWeaponPow = item.Value.GetWeaponPower(); int oponentTotalPow = item.Value.GetTotalPower(); if (gladiatorStatPow == oponentStatPow && gladiatorWeaponPow == oponentWeaponPow && gladiatorTotalPow == oponentTotalPow) { isValid = false; } } } if (isValid) { gladiators.Add(gladiator.Name, gladiator); } } }
public Gladiator GetGladitorWithHighestTotalPower() { Gladiator best = gladiators[0]; foreach (var gladiator in gladiators) { if (gladiator.GetTotalPower() > best.GetTotalPower()) { best = gladiator; } } return(best); }
public Gladiator GetGladitorWithHighestTotalPower() { Gladiator highestTotal = gladiators[0]; foreach (var glad in gladiators) { if (glad.GetTotalPower() > highestTotal.GetTotalPower()) { highestTotal = glad; } } return(highestTotal); }
public Gladiator GetGladitorWithHighestTotalPower() { Gladiator bestGladiator = gladiators[0]; foreach (var item in gladiators) { if (bestGladiator.GetTotalPower() < item.GetTotalPower()) { bestGladiator = item; } } return(bestGladiator); }
public Gladiator GetGladitorWithHighestTotalPower() { Gladiator biggestGlad = gladiators.FirstOrDefault(); for (int i = 0; i < gladiators.Count; i++) { if (gladiators[i].GetTotalPower() > biggestGlad.GetTotalPower()) { biggestGlad = gladiators[i]; } } return(biggestGlad); }
public Gladiator GetGladitorWithHighestTotalPower() { Gladiator highest = gladiators[0]; for (int i = 0; i < gladiators.Count; i++) { if (gladiators[i].GetTotalPower() > highest.GetTotalPower()) { highest = gladiators[i]; } } return(highest); }