Exemple #1
0
 public void RemoveYuhun(YuHun yh)
 {
     try
     {
         YuhunList.Remove(yh);
     }
     catch { }
 }
Exemple #2
0
        public void Init()
        {
            if (Yuhuns != null)
            {
                return;
            }
            try
            {
                Yuhuns       = new YuHun[6];
                YuhunDisplay = "";
                int i = 0;

                var set = new Dictionary <string, int>();

                Sijiantao = "散件";
                foreach (var x in GuidSet)
                {
                    var yh = App.db.YuhunList.First(y => y.GUID == x);
                    Yuhuns[i++] = yh;
                    if (set.ContainsKey(yh.TypeName))
                    {
                        set[yh.TypeName]++;
                    }
                    else
                    {
                        set[yh.TypeName] = 1;
                    }

                    if (set[yh.TypeName] == 4)
                    {
                        Sijiantao = yh.TypeName;
                    }

                    YuhunDisplay += yh.Display + "\n";
                }

                LimitDisplay = "";
                foreach (var x in Limits)
                {
                    LimitDisplay += x.ToString();
                }
            }
            catch
            { }
        }
Exemple #3
0
 bool isequal(YuHun y1, YuHun y2)
 {
     if (y1.TypeName != y2.TypeName)
     {
         return(false);
     }
     if (y1.Index != y2.Index)
     {
         return(false);
     }
     for (int i = 0; i < 5; i++)
     {
         if (y1[i].Name != y2[i].Name ||
             Math.Abs(y1[i].Val - y2[i].Val) > 0.005)
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #4
0
        void calYuhun(Dictionary <string, double> d, YuHun yh, int nSameType, char c, Shishen ss)
        {
            int param = 1;

            if (c == '-')
            {
                param = -1;
            }

            if (nSameType == 1 || nSameType == 5)
            {
                d[yh.Type.ShuxingName] += yh.Type.Val * param;
            }

            foreach (var x in yh.Shuxings)
            {
                switch (x.Name)
                {
                case "攻击":
                    d["攻击加成"] += 100 * (x.Val / ss.Gongji) * param;
                    break;

                case "防御":
                    d["防御加成"] += 100 * (x.Val / ss.Fangyu) * param;
                    break;

                case "生命":
                    d["生命加成"] += 100 * (x.Val / ss.Shengming) * param;
                    break;

                default:
                    d[x.Name] += x.Val * param;
                    break;
                }
            }
        }
Exemple #5
0
        void import()
        {
            var ft = "类型.txt";
            var f  = "御魂.txt";
            var fs = "式神.txt";

            var t  = File.ReadAllText(f);
            var tt = File.ReadAllText(ft);
            var ts = File.ReadAllText(fs);


            var sslist = App.Settings.ShishenList;

            foreach (var x in ts.Split(new char[] { '\r', '\n' }))
            {
                if (string.IsNullOrWhiteSpace(x))
                {
                    continue;
                }
                var a = splitString(x);
                if (a == null)
                {
                    continue;
                }

                if (sslist.Any(xx => xx.Name == a[0]))
                {
                    continue;
                }

                var ss = new Shishen()
                {
                    Name      = a[0],
                    Gongji    = Convert.ToInt32(a[1]),
                    Shengming = Convert.ToInt32(a[2]),
                    Fangyu    = Convert.ToInt32(a[3]),
                    Sudu      = Convert.ToInt32(a[4]),
                    Baoji     = Convert.ToInt32(a[5]),
                    Baoshang  = Convert.ToInt32(a[6]),
                    Mingzhong = Convert.ToInt32(a[7]),
                    Dikang    = Convert.ToInt32(a[8]),
                };
                sslist.Add(ss);
            }


            var tlist = App.Settings.YuhunTypeList;

            foreach (var x in tt.Split(new char[] { '\r', '\n' }))
            {
                if (string.IsNullOrWhiteSpace(x))
                {
                    continue;
                }

                var a = splitString(x);
                if (a == null)
                {
                    continue;
                }

                if (tlist.Any(xx => xx.Name == a[0]))
                {
                    var re = tlist.First(yy => yy.Name == a[0]);
                    re.SetColor(a[1]);
                    continue;
                }

                var yt = new YuHunType();
                yt.Name = a[0];
                yt.SetColor(a[1]);
                yt.Note        = a[2];
                yt.Val         = Convert.ToInt32(a[3]);
                yt.ShuxingName = a[4];
                tlist.Add(yt);
            }

            var yl = App.db.YuhunList;

            foreach (var x in t.Split(new char[] { '\r', '\n' }))
            {
                if (string.IsNullOrWhiteSpace(x))
                {
                    continue;
                }
                var a = splitString(x);
                if (a == null)
                {
                    continue;
                }


                var yh = new YuHun();
                yh.Index    = Convert.ToInt32(a[0]) - 1;
                yh.TypeName = a[1];
                for (int i = 0; i < 5; i++)
                {
                    yh.Shuxings[i].Name = a[2 + i];
                }

                for (int i = 1; i < 5; i++)
                {
                    yh.Shuxings[i].Val = Convert.ToInt32(a[6 + i]) / 10.0;
                }

                int ind    = Convert.ToInt32(a[11]) - 1;
                var sxname = yh.Shuxings[0].Name;

                if (AppSettings.ZhushuxingDict.ContainsKey(sxname))
                {
                    var d = AppSettings.ZhushuxingDict[sxname];
                    yh.Shuxings[0].Val = d[ind];
                }
                else
                {
                    yh.Shuxings[0].Val = 55;
                }

                if (yl.Any(xx => isequal(xx, yh)))
                {
                    continue;
                }
                yh.Type = App.Settings.YuhunTypeList.First(xx => xx.Name == yh.TypeName);
                yl.Add(yh);
            }
        }
Exemple #6
0
 public void AddYuhun(YuHun y)
 {
     YuhunList.Add(y);
 }
Exemple #7
0
 void calYuhun(Dictionary <string, double> d, YuHun yh, int nSameType)
 {
     calYuhun(d, yh, nSameType, '+', tempShishen);
 }