示例#1
0
        public CreatureTemplate Copy()
        {
            Masterplan.Data.Regeneration regeneration;
            CreatureTemplate             creatureTemplate = new CreatureTemplate()
            {
                Name       = this.fName,
                ID         = this.fID,
                Type       = this.fType,
                Role       = this.fRole,
                Leader     = this.fLeader,
                Senses     = this.fSenses,
                Movement   = this.fMovement,
                HP         = this.fHP,
                Initiative = this.fInitiative,
                AC         = this.fAC,
                Fortitude  = this.fFortitude,
                Reflex     = this.fReflex,
                Will       = this.fWill
            };
            CreatureTemplate creatureTemplate1 = creatureTemplate;

            if (this.fRegeneration != null)
            {
                regeneration = this.fRegeneration.Copy();
            }
            else
            {
                regeneration = null;
            }
            creatureTemplate1.Regeneration = regeneration;
            foreach (Aura fAura in this.fAuras)
            {
                creatureTemplate.Auras.Add(fAura.Copy());
            }
            foreach (CreaturePower fCreaturePower in this.fCreaturePowers)
            {
                creatureTemplate.CreaturePowers.Add(fCreaturePower.Copy());
            }
            foreach (DamageModifierTemplate fDamageModifierTemplate in this.fDamageModifierTemplates)
            {
                creatureTemplate.DamageModifierTemplates.Add(fDamageModifierTemplate.Copy());
            }
            creatureTemplate.Resist     = this.fResist;
            creatureTemplate.Vulnerable = this.fVulnerable;
            creatureTemplate.Immune     = this.fImmune;
            creatureTemplate.Tactics    = this.fTactics;
            return(creatureTemplate);
        }
示例#2
0
        /// <summary>
        /// Creates a copy of the template.
        /// </summary>
        /// <returns>Returns the copy.</returns>
        public CreatureTemplate Copy()
        {
            CreatureTemplate t = new CreatureTemplate();

            t.Name     = fName;
            t.ID       = fID;
            t.Type     = fType;
            t.Role     = fRole;
            t.Leader   = fLeader;
            t.Senses   = fSenses;
            t.Movement = fMovement;

            t.HP         = fHP;
            t.Initiative = fInitiative;
            t.AC         = fAC;
            t.Fortitude  = fFortitude;
            t.Reflex     = fReflex;
            t.Will       = fWill;

            t.Regeneration = (fRegeneration != null) ? fRegeneration.Copy() : null;

            foreach (Aura aura in fAuras)
            {
                t.Auras.Add(aura.Copy());
            }

            foreach (CreaturePower cp in fCreaturePowers)
            {
                t.CreaturePowers.Add(cp.Copy());
            }

            foreach (DamageModifierTemplate dmt in fDamageModifierTemplates)
            {
                t.DamageModifierTemplates.Add(dmt.Copy());
            }

            t.Resist     = fResist;
            t.Vulnerable = fVulnerable;
            t.Immune     = fImmune;
            t.Tactics    = fTactics;

            return(t);
        }
示例#3
0
        public CreatureTemplate FindTemplate(Guid template_id)
        {
            CreatureTemplate creatureTemplate;

            List <CreatureTemplate> .Enumerator enumerator = this.fTemplates.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    CreatureTemplate current = enumerator.Current;
                    if (current == null || !(current.ID == template_id))
                    {
                        continue;
                    }
                    creatureTemplate = current;
                    return(creatureTemplate);
                }
                return(null);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
        }