コード例 #1
0
ファイル: SpellEffect.cs プロジェクト: XaferDev/Crystal
        public void LoadEffect()
        {
            if (this.Data == "-1" || this.Data == "")
            {
                return;
            }
            try
            {
                string[] data = this.Data.Split(';');

                this.Effect = (Enums.SpellsEffects) int.Parse(data[0]);

                this.Value  = int.Parse(data[1]);
                this.Value2 = int.Parse(data[2]);
                this.Value3 = int.Parse(data[3]);

                if (data.Length >= 5)
                {
                    this.Turn = int.Parse(data[4]);
                }

                if (data.Length >= 6)
                {
                    this.Chance = int.Parse(data[5]);
                }

                if (data.Length >= 7)
                {
                    this.StrEffet = data[6];
                }
                else
                {
                    this.StrEffet = "0d0+0";
                }

                if (data.Length >= 8)
                {
                    this.Targets = new SpellTarget(int.Parse(data[7]));
                }
                else
                {
                    this.Targets = new SpellTarget(23);
                }
            }
            catch (Exception e)
            {
                //Utilities.ConsoleStyle.Error("Cant load effect for spell '" + this.Engine.Spell.Name + "' : " + e.ToString());
            }
        }
コード例 #2
0
ファイル: SpellEffect.cs プロジェクト: nightwolf93/Crystal
        public void LoadEffect()
        {
            if (this.Data == "-1" || this.Data == "") return;
            try
            {
                string[] data = this.Data.Split(';');

                this.Effect = (Enums.SpellsEffects)int.Parse(data[0]);

                this.Value = int.Parse(data[1]);
                this.Value2 = int.Parse(data[2]);
                this.Value3 = int.Parse(data[3]);

                if (data.Length >= 5)
                {
                    this.Turn = int.Parse(data[4]);
                }

                if (data.Length >= 6)
                {
                    this.Chance = int.Parse(data[5]);
                }

                if (data.Length >= 7)
                {
                    this.StrEffet = data[6];
                }
                else
                {
                    this.StrEffet = "0d0+0";
                }

                if (data.Length >= 8)
                {
                    this.Targets = new SpellTarget(int.Parse(data[7]));
                }
                else
                {
                    this.Targets = new SpellTarget(23);
                }
            }
            catch (Exception e)
            {
                //Utilities.ConsoleStyle.Error("Cant load effect for spell '" + this.Engine.Spell.Name + "' : " + e.ToString());
            }
        }