예제 #1
0
        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 GetGladitorWithHighestWeaponPower()
        {
            Gladiator best = gladiators[0];

            foreach (var gladiator in gladiators)
            {
                if (gladiator.GetWeaponPower() > best.GetWeaponPower())
                {
                    best = gladiator;
                }
            }
            return(best);
        }
예제 #3
0
        public Gladiator GetGladitorWithHighestWeaponPower()
        {
            Gladiator highestWeapon = gladiators[0];

            foreach (var glad in gladiators)
            {
                if (glad.GetWeaponPower() > highestWeapon.GetWeaponPower())
                {
                    highestWeapon = glad;
                }
            }
            return(highestWeapon);
        }
예제 #4
0
        public Gladiator GetGladitorWithHighestWeaponPower()
        {
            Gladiator bestGladiator = gladiators[0];

            foreach (var item in gladiators)
            {
                if (bestGladiator.GetWeaponPower() < item.GetWeaponPower())
                {
                    bestGladiator = item;
                }
            }
            return(bestGladiator);
        }
예제 #5
0
        public Gladiator GetGladitorWithHighestWeaponPower()
        {
            Gladiator biggestGlad = gladiators.FirstOrDefault();

            for (int i = 0; i < gladiators.Count; i++)
            {
                if (gladiators[i].GetWeaponPower() > biggestGlad.GetWeaponPower())
                {
                    biggestGlad = gladiators[i];
                }
            }

            return(biggestGlad);
        }
예제 #6
0
        public Gladiator GetGladitorWithHighestWeaponPower()
        {
            Gladiator highest = gladiators[0];

            for (int i = 0; i < gladiators.Count; i++)
            {
                if (gladiators[i].GetWeaponPower() > highest.GetWeaponPower())
                {
                    highest = gladiators[i];
                }
            }

            return(highest);
        }