Exemple #1
0
        public FeatInfo AddFeatInfo(string name, string info)
        {
            FeatInfo featInfo = new FeatInfo();

            featInfo.Name = name;
            featInfo.Info = info;
            return(featInfo);
        }
Exemple #2
0
        //z resourca
        private List <FeatInfo> AddFeatFromResource(string data)
        {
            string          name    = "";
            string          info    = "";
            List <FeatInfo> theList = new List <FeatInfo>();

            string[] feats = data.Split(new string[] { "\r\n\r\n" }, StringSplitOptions.None);
            foreach (var feat in feats)
            {
                string[] part = feat.Split(new string[] { "\r\n" }, StringSplitOptions.None);
                if (part[0] == "" || part[1] == "")
                {
                    break;
                }
                name = part[0];
                info = part[1];
                FeatInfo featParsed = AddFeatInfo(name, info);
                theList.Add(featParsed);
            }
            return(theList);
        }
Exemple #3
0
        //zapelnianie listy featow z pliku
        public List <FeatInfo> CreateFeatInfo(string file)
        {
            string name;
            string info = "";

            List <FeatInfo> theList = new List <FeatInfo>();

            try
            {
                using (StreamReader sr = new StreamReader(file))
                {
                    string line;

                    line = sr.ReadLine();

                    while (line != null)
                    {
                        info = "";
                        if (String.IsNullOrEmpty(line))
                        {
                            line = sr.ReadLine();
                        }
                        name = line;
                        while (!String.IsNullOrEmpty(line = sr.ReadLine()))
                        {
                            info = info + line + Environment.NewLine;
                        }
                        FeatInfo feat = AddFeatInfo(name, info);
                        theList.Add(feat);
                    }
                }
            }
            catch (Exception e)
            {
                // Let the user know what went wrong.
                Console.WriteLine("The file could not be read:");
                Console.WriteLine(e.Message);
            }
            return(theList);
        }
        public int GetSkillCost( FeatInfo.FeatCost cost, int skill )
        {
            int first = 0;
            int second = 0;
            int third = 0;

            if( cost == FeatInfo.FeatCost.Low )
            {
                first = 500;
                second = 1500;
                third = 3000;
            }

            else if( cost == FeatInfo.FeatCost.Medium )
            {
                first = 1000;
                second = 3000;
                third = 6000;
            }

            else if( cost == FeatInfo.FeatCost.High )
            {
                first = 2000;
                second = 6000;
                third = 12000;
            }

            if( skill == 1 )
                return first;

            if( skill == 2 )
                return second;

            if( skill == 3 )
                return third;

            return 0;
        }
        public void FixSkillCost( FeatInfo.FeatCost oldCost, FeatInfo.FeatCost newCost, int skill )
        {
            if( oldCost == newCost || skill == 0 || skill < 0 || skill > 3 )
                return;

            int realOldCost = GetSkillCost( oldCost, skill );
            int realNewCost = GetSkillCost( newCost, skill );
            int refund = realOldCost - realNewCost;
            CPSpent -= refund;
            FeatSlots -= refund;
            CP += refund;
        }