Exemple #1
0
 public void AddSpawn(BaseCreature bc)
 {
     Spawn.Add(bc);
 }
Exemple #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            Armor          = new List <Item>();
            DestroyedArmor = new List <Item>();
            Items          = new List <Item>();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                Item it = reader.ReadItem();

                if (it != null)
                {
                    if (it is CursedSuitOfArmor)
                    {
                        ((CursedSuitOfArmor)it).Encounter = this;
                    }

                    Armor.Add(it);
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                Item it = reader.ReadItem();

                if (it != null)
                {
                    DestroyedArmor.Add(it);
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                if (Spawn == null)
                {
                    Spawn = new List <BaseCreature>();
                }

                BaseCreature bc = reader.ReadMobile() as BaseCreature;
                if (bc != null)
                {
                    if (bc is EnsorcelledArmor)
                    {
                        ((EnsorcelledArmor)bc).Encounter = this;
                    }

                    Spawn.Add(bc);
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                if (Items == null)
                {
                    Items = new List <Item>();
                }

                Item item = reader.ReadItem();
                if (item != null)
                {
                    Items.Add(item);
                }
            }

            if (Spawn == null || Spawn.Count < 4)
            {
                int toSpawn = Spawn == null ? 4 : 4 - Spawn.Count;
                for (int i = 0; i < toSpawn; i++)
                {
                    if (Spawn == null)
                    {
                        Spawn = new List <BaseCreature>();
                    }

                    SpawnRandom();
                }
            }
        }