Inheritance: BaseCreature
        public void SpawnSnowmen(Mobile target)
        {
            Map map = this.Map;

            if (map == null)
            {
                return;
            }

            int IceElm = 0;

            foreach (Mobile m in this.GetMobilesInRange(10))
            {
                if (m is IceElemental)
                {
                    ++IceElm;
                }
            }

            if (IceElm < 6)
            {
                int newIceElm = Utility.RandomMinMax(2, 3);

                for (int i = 0; i < newIceElm; ++i)
                {
                    BaseCreature sn;

                    switch (Utility.Random(3))
                    {
                    default:
                    case 0:
                    case 1: sn = new IceElemental(); break;

                    case 2: sn = new SnowElemental(); break;
                    }

                    bool    validLocation = false;
                    Point3D loc           = this.Location;

                    for (int j = 0; !validLocation && j < 10; ++j)
                    {
                        int x = X + Utility.Random(3) - 1;
                        int y = Y + Utility.Random(3) - 1;
                        int z = map.GetAverageZ(x, y);

                        if (validLocation = map.CanFit(x, y, this.Z, 16, false, false))
                        {
                            loc = new Point3D(x, y, Z);
                        }
                        else if (validLocation = map.CanFit(x, y, z, 16, false, false))
                        {
                            loc = new Point3D(x, y, z);
                        }
                    }

                    sn.MoveToWorld(loc, map);
                    sn.Combatant = target;
                }
            }
        }
Example #2
0
        public void DoSummon()
        {
            if (this.Map != null)
            {
                Map map    = this.Map;
                int amount = Utility.RandomMinMax(1, 3);

                for (int l = 0; l < amount; ++l)
                {
                    for (int k = 0; k < 1; ++k)
                    {
                        bool    validLocation = false;
                        Point3D loc           = this.Location;
                        for (int j = 0; !validLocation && j < 10; ++j)
                        {
                            int x = X + Utility.Random(11) - 5;
                            int y = Y + Utility.Random(11) - 5;
                            int z = map.GetAverageZ(x, y);

                            if (validLocation = map.CanFit(x, y, this.Z, 16, false, false))
                            {
                                loc = new Point3D(x, y, Z);
                            }
                            else if (validLocation = map.CanFit(x, y, z, 16, false, false))
                            {
                                loc = new Point3D(x, y, z);
                            }
                        }
                        switch (Utility.Random(4))
                        {
                        case 0: IceSerpent serpent = new IceSerpent();
                            serpent.MoveToWorld(loc, map);
                            break;

                        case 1: IceFiend fiend = new IceFiend();
                            fiend.MoveToWorld(loc, map);
                            break;

                        case 2: IceElemental ice = new IceElemental();
                            ice.MoveToWorld(loc, map);
                            break;

                        case 3: SnowElemental snow = new SnowElemental();
                            snow.MoveToWorld(loc, map);
                            break;
                        }
                    }
                }
            }
        }
			protected override void OnTick()
			{
				if ( m_Item.Deleted )
					return;

				Mobile spawn;

				switch ( Utility.Random( 10 ) )
				{
					default:
					case 0: spawn = new AirElemental(); break;
					case 1: spawn = new EarthElemental(); break;
					case 2: spawn = new WaterElemental(); break;
					case 3: spawn = new FireElemental(); break;
					case 4: spawn = new IceElemental(); break;
					case 5: spawn = new SnowElemental(); break;
					case 6: spawn = new Efreet(); break;
					case 7: spawn = new BloodElemental(); break;
					case 8: spawn = new PoisonElemental(); break;
				}

				spawn.MoveToWorld( m_Item.Location, m_Item.Map );

				m_Item.Delete();
			}