Exemplo n.º 1
0
        public string GetAptitudeDescription(Race aRace, int skill)
        {
            int raceIA;
            string description = "Average";

            raceIA = aRace.GetInherentAptitude(skill);
            switch (raceIA)
            {
                case 0:
                    description = "Poor";
                    break;
                case 10:
                    description = "Average";
                    break;
                case 30:
                    description = "Good";
                    break;
                case 50:
                    description = "Excellent";
                    break;
                default:
                    description = "Average";
                    break;
            }

            return description;
        }
Exemplo n.º 2
0
 public void AddRace(Race raceToAdd)
 {
     raceList.Add(raceToAdd);
 }
Exemplo n.º 3
0
        public bool LoadRaces(string racefile)
        {
            bool returnValue = false;

            // Load all races in this universe from the file at path location in racefile param
            // Return true if successful, false otherwise
            DataSet raceDataSet = new DataSet();

            raceDataSet.ReadXml(racefile);

            foreach (DataRow row in raceDataSet.Tables["Race"].Rows)
            {
                Race aRace = new Race();
                string strIA;

                returnValue = true;

                aRace.Key = GetNextKey();
                aRace.Name = row[0].ToString();
                aRace.LearningRate = Convert.ToInt32(row[1]);
                aRace.Durability = Convert.ToInt32(row[2]);

                strIA = row[3].ToString();

                aRace.SetInherentAptitude(0, Convert.ToInt32(strIA.Substring(0, 1)));
                aRace.SetInherentAptitude(1, Convert.ToInt32(strIA.Substring(1, 1)));
                aRace.SetInherentAptitude(2, Convert.ToInt32(strIA.Substring(2, 1)));
                aRace.SetInherentAptitude(3, Convert.ToInt32(strIA.Substring(3, 1)));
                aRace.SetInherentAptitude(4, Convert.ToInt32(strIA.Substring(4, 1)));

                aRace.Description = row[4].ToString();

                AddRace(aRace);
            }

            return returnValue;
        }
Exemplo n.º 4
0
        public void ReplaceRace(int oldRaceKey, Race newRace)
        {
            Race oldRace = GetRace(oldRaceKey);

            int index = raceList.IndexOf(oldRace);
            if (index >= 0 && index < raceList.Count)
            {
                raceList[index] = newRace;
            }
        }
Exemplo n.º 5
0
        public int GetMaxTrainingLevel(Race aRace, int skill)
        {
            int raceAptitudeForSkill;
            int maxLevel = 100;

            raceAptitudeForSkill = aRace.GetInherentAptitude(skill);
            switch (raceAptitudeForSkill)
            {
                case 4:
                    maxLevel = 100;
                    break;
                case 3:
                    maxLevel = 150;
                    break;
                case 2:
                    maxLevel = 200;
                    break;
                case 1:
                    maxLevel = 250;
                    break;
            }

            return maxLevel;
        }