예제 #1
0
        private void AdvanceTalents(bool focus)
        {
            TalentsAdvanced = new List <Talent>();
            Random advanceGen      = new Random();
            int    talentsAdvanced = 0;

            int advances = GenerateAdvanceNum(true);

            //int relevantTalents = CareerTemplate.CareerTalents.Where(t => Talent.IsRelevant(t)).Count();

            while (talentsAdvanced < advances)
            {
                Talent talentPick = new Talent(CareerTemplate.CareerTalents[advanceGen.Next(0, CareerTemplate.CareerTalents.Length)], Owner);

                int currentAdvances = Owner.TotalTalentAdvances(talentPick);

                /*// If focused and all relevant talents are taken
                 * if (focus && talentsAdvanced == relevantTalents)
                 *  focus = false;*/

                if (currentAdvances < talentPick.Max())    // && !(focus && !talentPick.IsRelevant())) // Don't consider it if we are focusing AND it's not relevant
                {
                    if (TalentsAdvanced.Contains(talentPick))
                    {
                        TalentsAdvanced.Find(t => t.Name == talentPick.Name).Advance();
                    }
                    else
                    {
                        TalentsAdvanced.Add(talentPick);
                    }
                    talentsAdvanced++;
                }
            }
        }