Example #1
0
        /// <summary>
        /// Creates a copy of this object.
        /// </summary>
        /// <returns>Returns the copy.</returns>
        public Trap Copy()
        {
            Trap t = new Trap();

            t.ID          = fID;
            t.Type        = fType;
            t.Name        = fName;
            t.Level       = fLevel;
            t.Role        = fRole.Copy();
            t.ReadAloud   = fReadAloud;
            t.Description = fDescription;
            t.Details     = fDetails;

            foreach (TrapSkillData tsd in fSkills)
            {
                t.Skills.Add(tsd.Copy());
            }

            t.Initiative = fInitiative;
            t.Trigger    = fTrigger;

            t.Attack = fAttack != null?fAttack.Copy() : null;

            foreach (TrapAttack ta in fAttacks)
            {
                t.Attacks.Add(ta.Copy());
            }

            foreach (string cm in fCountermeasures)
            {
                t.Countermeasures.Add(cm);
            }

            return(t);
        }
Example #2
0
        public Trap Copy()
        {
            TrapAttack trapAttack;
            Trap       trap = new Trap()
            {
                ID          = this.fID,
                Type        = this.fType,
                Name        = this.fName,
                Level       = this.fLevel,
                Role        = this.fRole.Copy(),
                ReadAloud   = this.fReadAloud,
                Description = this.fDescription,
                Details     = this.fDetails
            };

            foreach (TrapSkillData fSkill in this.fSkills)
            {
                trap.Skills.Add(fSkill.Copy());
            }
            trap.Initiative = this.fInitiative;
            trap.Trigger    = this.fTrigger;
            Trap trap1 = trap;

            if (this.fAttack != null)
            {
                trapAttack = this.fAttack.Copy();
            }
            else
            {
                trapAttack = null;
            }
            trap1.Attack = trapAttack;
            foreach (TrapAttack fAttack in this.fAttacks)
            {
                trap.Attacks.Add(fAttack.Copy());
            }
            foreach (string fCountermeasure in this.fCountermeasures)
            {
                trap.Countermeasures.Add(fCountermeasure);
            }
            trap.URL = this.fURL;
            return(trap);
        }