예제 #1
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);
            }
        }