예제 #1
0
        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;
                }
            }
        }
예제 #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;
                        }
                    }
                }
            }
        }