コード例 #1
0
ファイル: PatriarchWyrm.cs プロジェクト: ITLongwell/Ulmeta
        public void SpawnDragons( Mobile target )
        {
            Map map = this.Map;
            if( map == null )
                return;

            int newDragons = Utility.RandomMinMax( 1, 2 );

            for( int i = 0; i < newDragons; ++i )
            {
                switch( Utility.Random( 3 ) )
                {
                    default:
                    case 0:
                        {
                            Dragon dragon = new Dragon();

                            dragon.Team = this.Team;
                            dragon.FightMode = this.FightMode;

                            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 );
                            }

                            dragon.MoveToWorld( loc, map );
                            dragon.Combatant = target;

                            break;
                        }
                    case 1:
                        {
                            IronDragon idragon = new IronDragon();

                            idragon.Team = this.Team;
                            idragon.FightMode = this.FightMode;

                            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 );
                            }

                            idragon.MoveToWorld( loc, map );
                            idragon.Combatant = target;

                            break;
                        }
                    case 2:
                        {
                            GreenDiamondDragon gdragon = new GreenDiamondDragon();

                            gdragon.Team = this.Team;
                            gdragon.FightMode = this.FightMode;

                            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 );
                            }

                            gdragon.MoveToWorld( loc, map );
                            gdragon.Combatant = target;

                            break;
                        }
                }
            }
        }
コード例 #2
0
        public void SpawnDragons(Mobile target)
        {
            Map map = this.Map;

            if (map == null)
            {
                return;
            }

            int newDragons = Utility.RandomMinMax(1, 2);

            for (int i = 0; i < newDragons; ++i)
            {
                switch (Utility.Random(3))
                {
                default:
                case 0:
                {
                    Dragon dragon = new Dragon();

                    dragon.Team      = this.Team;
                    dragon.FightMode = this.FightMode;

                    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);
                        }
                    }

                    dragon.MoveToWorld(loc, map);
                    dragon.Combatant = target;

                    break;
                }

                case 1:
                {
                    IronDragon idragon = new IronDragon();

                    idragon.Team      = this.Team;
                    idragon.FightMode = this.FightMode;

                    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);
                        }
                    }

                    idragon.MoveToWorld(loc, map);
                    idragon.Combatant = target;

                    break;
                }

                case 2:
                {
                    GreenDiamondDragon gdragon = new GreenDiamondDragon();

                    gdragon.Team      = this.Team;
                    gdragon.FightMode = this.FightMode;

                    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);
                        }
                    }

                    gdragon.MoveToWorld(loc, map);
                    gdragon.Combatant = target;

                    break;
                }
                }
            }
        }