Inheritance: BaseCreature
Example #1
0
            //Type type = m_Owner.GetType();
            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                IPooledEnumerable eable = m_Owner.GetMobilesInRange(10);

                foreach (Mobile m in eable)
                {
                    if (m == null || !(m is PlayerMobile))
                    {
                        continue;
                    }

                    if (m_Owner.CanBeHarmful(m) && m_Owner.Mana >= 100)
                    {
                        m_Owner.Mana -= 50;
                        int    ownerlocX = m_Owner.Location.X + Utility.RandomMinMax(-5, 5);
                        int    ownerlocY = m_Owner.Location.Y + Utility.RandomMinMax(-5, 5);
                        int    ownerlocZ = m_Owner.Location.Z;
                        Efreet NewMobile = new Efreet();
                        NewMobile.MoveToWorld(new Point3D(ownerlocX, ownerlocY, ownerlocZ), m_Owner.Map);
                        NewMobile.Combatant = m;
                    }
                }

                eable.Free();
            }
			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();
			}
Example #3
0
        public void SummonCritters()
        {
            int    SummonRange;
            Mobile SummonTarget;
            Map    map = this.Map;

            if (map == null)
            {
                return;
            }

            int CritterNum  = Utility.Random(8);
            int newCritters = Utility.RandomMinMax(4, 8);
            int critters    = 0;

            foreach (Mobile m in this.GetMobilesInRange(15))
            {
                if (m is PredatorHellCat || m is FireSteed || m is Nightmare ||
                    m is FireGargoyle || m is HellHound || m is Gargoyle ||
                    m is LavaElemental || m is Efreet)
                {
                    ++critters;
                }
            }

            if (critters < 16)
            {
                for (int i = 0; i < newCritters; ++i)
                {
                    BaseCreature critter;

                    switch (CritterNum)
                    {
                    default:
                    case 0: critter = new PredatorHellCat(); break;

                    case 1: critter = new FireSteed(); break;

                    case 2: critter = new Nightmare(); break;

                    case 3: critter = new FireGargoyle(); break;

                    case 4: critter = new HellHound(); break;

                    case 5: critter = new Gargoyle(); break;

                    case 6: critter = new LavaElemental(); break;

                    case 7: critter = new Efreet(); break;
                    }

                    critter.Team = this.Team;

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

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

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

                    critter.MoveToWorld(loc, map);
                }
            }
        }