Example #1
0
        public static Regeneration ConvertAura(string aura_details)
        {
            aura_details = aura_details.Trim();

            bool   parsing_value = true;
            string val_str       = "";
            string details       = "";

            foreach (char ch in aura_details)
            {
                if (!char.IsDigit(ch))
                {
                    parsing_value = false;
                }

                if (parsing_value)
                {
                    val_str += ch;
                }
                else
                {
                    details += ch;
                }
            }

            details = details.Trim();
            if (details.StartsWith("(") && details.EndsWith(")"))
            {
                details = details.Substring(1);
                details = details.Substring(0, details.Length - 1);

                details.Trim();
            }

            try
            {
                int value = (val_str != "") ? int.Parse(val_str) : 0;

                return(new Regeneration(value, details));
            }
            catch (Exception ex)
            {
                LogSystem.Trace(ex);

                return(null);
            }
        }
Example #2
0
        public static Regeneration ConvertAura(string aura_details)
        {
            Regeneration regeneration;

            aura_details = aura_details.Trim();
            bool   flag        = true;
            string str         = "";
            string str1        = "";
            string auraDetails = aura_details;

            for (int i = 0; i < auraDetails.Length; i++)
            {
                char chr = auraDetails[i];
                if (!char.IsDigit(chr))
                {
                    flag = false;
                }
                if (!flag)
                {
                    str1 = string.Concat(str1, chr);
                }
                else
                {
                    str = string.Concat(str, chr);
                }
            }
            str1 = str1.Trim();
            if (str1.StartsWith("(") && str1.EndsWith(")"))
            {
                str1 = str1.Substring(1);
                str1 = str1.Substring(0, str1.Length - 1);
                str1.Trim();
            }
            try
            {
                regeneration = new Regeneration((str != "" ? int.Parse(str) : 0), str1);
            }
            catch (Exception exception)
            {
                LogSystem.Trace(exception);
                regeneration = null;
            }
            return(regeneration);
        }
Example #3
0
        public static void CopyFields(ICreature copy_from, ICreature copy_to)
        {
            try
            {
                if (copy_from != null)
                {
                    copy_to.ID        = copy_from.ID;
                    copy_to.Name      = copy_from.Name;
                    copy_to.Details   = copy_from.Details;
                    copy_to.Size      = copy_from.Size;
                    copy_to.Origin    = copy_from.Origin;
                    copy_to.Type      = copy_from.Type;
                    copy_to.Keywords  = copy_from.Keywords;
                    copy_to.Level     = copy_from.Level;
                    copy_to.Role      = (copy_from.Role != null) ? copy_from.Role.Copy() : null;
                    copy_to.Senses    = copy_from.Senses;
                    copy_to.Movement  = copy_from.Movement;
                    copy_to.Alignment = copy_from.Alignment;
                    copy_to.Languages = copy_from.Languages;
                    copy_to.Skills    = copy_from.Skills;
                    copy_to.Equipment = copy_from.Equipment;
                    copy_to.Category  = copy_from.Category;

                    copy_to.Strength     = copy_from.Strength.Copy();
                    copy_to.Constitution = copy_from.Constitution.Copy();
                    copy_to.Dexterity    = copy_from.Dexterity.Copy();
                    copy_to.Intelligence = copy_from.Intelligence.Copy();
                    copy_to.Wisdom       = copy_from.Wisdom.Copy();
                    copy_to.Charisma     = copy_from.Charisma.Copy();

                    copy_to.HP         = copy_from.HP;
                    copy_to.Initiative = copy_from.Initiative;
                    copy_to.AC         = copy_from.AC;
                    copy_to.Fortitude  = copy_from.Fortitude;
                    copy_to.Reflex     = copy_from.Reflex;
                    copy_to.Will       = copy_from.Will;

                    copy_to.Regeneration = (copy_from.Regeneration != null) ? copy_from.Regeneration.Copy() : null;

                    copy_to.Auras.Clear();
                    foreach (Aura aura in copy_from.Auras)
                    {
                        copy_to.Auras.Add(aura.Copy());
                    }

                    copy_to.CreaturePowers.Clear();
                    foreach (CreaturePower cp in copy_from.CreaturePowers)
                    {
                        copy_to.CreaturePowers.Add(cp.Copy());
                    }

                    copy_to.DamageModifiers.Clear();
                    foreach (DamageModifier dm in copy_from.DamageModifiers)
                    {
                        copy_to.DamageModifiers.Add(dm.Copy());
                    }

                    copy_to.Resist     = copy_from.Resist;
                    copy_to.Vulnerable = copy_from.Vulnerable;
                    copy_to.Immune     = copy_from.Immune;
                    copy_to.Tactics    = copy_from.Tactics;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Trace(ex);
            }
        }