Exemplo n.º 1
0
        public static int GladiatorDamageCalculator(Gladiator attacker, Gladiator defender)
        {
            int weaponDamage = RandomNumberGenerator.RandomNumber(attacker.WeaponEquipped.MinDamage, attacker.WeaponEquipped.MaxDamage);
            int damageDealt  = (attacker.AttackDamage) * weaponDamage;
            int damageTaken  = damageDealt / defender.ArmourEquipped.ArmourValue;

            defender.CurrentHP -= damageTaken;
            return(damageTaken);
        }
Exemplo n.º 2
0
        public static List <Gladiator> PopulateListOfGladiators(int numberOfGladiators, int townID, string exp, string weapons, string armours)
        {
            List <Gladiator> list = new List <Gladiator>();

            StreamReader  readerName = new StreamReader("gladiatorNamesList" + townID + ".txt");
            List <string> names      = new List <string>();

            while (!readerName.EndOfStream)
            {
                names.Add(readerName.ReadLine());
            }
            readerName.Close();

            StreamReader  readerDescription = new StreamReader("gladiatorDescriptionList" + townID + ".txt");
            List <string> descriptions      = new List <string>();

            while (!readerDescription.EndOfStream)
            {
                descriptions.Add(readerDescription.ReadLine());
            }

            string[]   stringEXPs = exp.Split('|');
            List <int> EXPs       = new List <int>();

            foreach (string exps in stringEXPs)
            {
                EXPs.Add(Int32.Parse(exps));
            }
            char[] WeaponIDs = weapons.ToCharArray();
            char[] ArmourIDS = armours.ToCharArray();


            for (int i = 0; i < numberOfGladiators; i++)
            {
                int       nameNumber        = RandomNumberGenerator.RandomNumber(0, names.Count - 1);
                int       descriptionNumber = RandomNumberGenerator.RandomNumber(0, descriptions.Count - 1);
                Gladiator tempGlad          = new Gladiator(names[nameNumber], descriptions[descriptionNumber]);
                tempGlad.EXP = EXPs[i];
                tempGlad.LevelUpGladiator();
                tempGlad.WeaponEquipped = WeaponByID((int)Char.GetNumericValue(WeaponIDs[i]));
                tempGlad.ArmourEquipped = ArmourByID((int)Char.GetNumericValue(ArmourIDS[i]));
                list.Add(tempGlad);
            }
            return(list);
        }