Esempio n. 1
0
        void _set_random_path_position()
        {
            if (prev_floor_structure != null)
                start_direction = Direction.GetOppositeDirection(prev_floor_structure.start_direction);
            else
                start_direction = Direction.Down;
            maze_generator.setStartDir = start_direction;
            MTRandom mt = dungeon_structure.MT_maze;
            if (HasBossRoom)
            {
                if (dungeon_structure.option.Contains("largebossroom=" + '"' + "true"))  // <option largebossroom="true" />
                {
                    while (true)
                    {
                        pos.X = (int)(mt.GetUInt32() % (width - 2) + 1);
                        pos.Y = (int)(mt.GetUInt32() % (height - 3) + 1);
                        if (maze_generator.isFree(pos))
                            if (maze_generator.isFree(new Position(pos.X - 1, pos.Y)))
                                if (maze_generator.isFree(new Position(pos.X + 1, pos.Y)))
                                    if (maze_generator.isFree(new Position(pos.X, pos.Y + 1)))
                                        if (maze_generator.isFree(new Position(pos.X - 1, pos.Y + 1)))
                                            if (maze_generator.isFree(new Position(pos.X + 1, pos.Y + 1)))
                                                if (maze_generator.isFree(new Position(pos.X, pos.Y + 2)))
                                                    if (maze_generator.isFree(new Position(pos.X - 1, pos.Y + 2)))
                                                        if (maze_generator.isFree(new Position(pos.X + 1, pos.Y + 2)))
                                                            break;
                    }
                    maze_generator.markReservedPosition(new Position(pos.X - 1, pos.Y));
                    maze_generator.markReservedPosition(new Position(pos.X + 1, pos.Y));
                    maze_generator.markReservedPosition(new Position(pos.X, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X - 1, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X + 1, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X, pos.Y + 2));
                    maze_generator.markReservedPosition(new Position(pos.X - 1, pos.Y + 2));
                    maze_generator.markReservedPosition(new Position(pos.X + 1, pos.Y + 2));
                }

                else
                {
                    while (true)
                    {
                        pos.X = (int)(mt.GetUInt32() % (width - 2) + 1);
                        pos.Y = (int)(mt.GetUInt32() % (height - 3) + 1);
                        if (maze_generator.isFree(pos))
                            if (maze_generator.isFree(new Position(pos.X - 1, pos.Y)))
                                if (maze_generator.isFree(new Position(pos.X + 1, pos.Y)))
                                    if (maze_generator.isFree(new Position(pos.X, pos.Y + 1)))
                                        if (maze_generator.isFree(new Position(pos.X - 1, pos.Y + 1)))
                                            if (maze_generator.isFree(new Position(pos.X + 1, pos.Y + 1)))
                                                if (maze_generator.isFree(new Position(pos.X, pos.Y + 2)))
                                                    break;
                    }
                    maze_generator.markReservedPosition(new Position(pos.X - 1, pos.Y));
                    maze_generator.markReservedPosition(new Position(pos.X + 1, pos.Y));
                    maze_generator.markReservedPosition(new Position(pos.X, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X - 1, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X + 1, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X, pos.Y + 2));
                }
            }
            else
            {
                bool free = false;
                while (!free)
                {
                    pos.X = (int)(mt.GetUInt32() % width);
                    pos.Y = (int)(mt.GetUInt32() % height);
                    free = maze_generator.isFree(pos);
                }
            }
            if (!IsLastFloor && !HasBossRoom)
            {
                RandomDirection rnd_dir = new RandomDirection();
                while (true)
                {
                    int direction = rnd_dir.getDirection(mt);
                    if (_set_traits(pos, direction, 3100))
                    {
                        start_direction = direction;
                        break;
                    }
                    //			# core::ICommonAPI::stdapi_SetNPCDirection();  // Server stuff?
                }
            }
            maze_generator.setPathPosition(pos);
        }
Esempio n. 2
0
        void _set_random_path_position()
        {
            if (prev_floor_structure != null)
            {
                start_direction = Direction.GetOppositeDirection(prev_floor_structure.start_direction);
            }
            else
            {
                start_direction = Direction.Down;
            }
            maze_generator.setStartDir = start_direction;
            MTRandom mt = dungeon_structure.MT_maze;

            if (HasBossRoom)
            {
                if (dungeon_structure.option.Contains("largebossroom=" + '"' + "true"))                  // <option largebossroom="true" />
                {
                    while (true)
                    {
                        pos.X = (int)(mt.GetUInt32() % (width - 2) + 1);
                        pos.Y = (int)(mt.GetUInt32() % (height - 3) + 1);
                        if (maze_generator.isFree(pos))
                        {
                            if (maze_generator.isFree(new Position(pos.X - 1, pos.Y)))
                            {
                                if (maze_generator.isFree(new Position(pos.X + 1, pos.Y)))
                                {
                                    if (maze_generator.isFree(new Position(pos.X, pos.Y + 1)))
                                    {
                                        if (maze_generator.isFree(new Position(pos.X - 1, pos.Y + 1)))
                                        {
                                            if (maze_generator.isFree(new Position(pos.X + 1, pos.Y + 1)))
                                            {
                                                if (maze_generator.isFree(new Position(pos.X, pos.Y + 2)))
                                                {
                                                    if (maze_generator.isFree(new Position(pos.X - 1, pos.Y + 2)))
                                                    {
                                                        if (maze_generator.isFree(new Position(pos.X + 1, pos.Y + 2)))
                                                        {
                                                            break;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    maze_generator.markReservedPosition(new Position(pos.X - 1, pos.Y));
                    maze_generator.markReservedPosition(new Position(pos.X + 1, pos.Y));
                    maze_generator.markReservedPosition(new Position(pos.X, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X - 1, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X + 1, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X, pos.Y + 2));
                    maze_generator.markReservedPosition(new Position(pos.X - 1, pos.Y + 2));
                    maze_generator.markReservedPosition(new Position(pos.X + 1, pos.Y + 2));
                }

                else
                {
                    while (true)
                    {
                        pos.X = (int)(mt.GetUInt32() % (width - 2) + 1);
                        pos.Y = (int)(mt.GetUInt32() % (height - 3) + 1);
                        if (maze_generator.isFree(pos))
                        {
                            if (maze_generator.isFree(new Position(pos.X - 1, pos.Y)))
                            {
                                if (maze_generator.isFree(new Position(pos.X + 1, pos.Y)))
                                {
                                    if (maze_generator.isFree(new Position(pos.X, pos.Y + 1)))
                                    {
                                        if (maze_generator.isFree(new Position(pos.X - 1, pos.Y + 1)))
                                        {
                                            if (maze_generator.isFree(new Position(pos.X + 1, pos.Y + 1)))
                                            {
                                                if (maze_generator.isFree(new Position(pos.X, pos.Y + 2)))
                                                {
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    maze_generator.markReservedPosition(new Position(pos.X - 1, pos.Y));
                    maze_generator.markReservedPosition(new Position(pos.X + 1, pos.Y));
                    maze_generator.markReservedPosition(new Position(pos.X, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X - 1, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X + 1, pos.Y + 1));
                    maze_generator.markReservedPosition(new Position(pos.X, pos.Y + 2));
                }
            }
            else
            {
                bool free = false;
                while (!free)
                {
                    pos.X = (int)(mt.GetUInt32() % width);
                    pos.Y = (int)(mt.GetUInt32() % height);
                    free  = maze_generator.isFree(pos);
                }
            }
            if (!IsLastFloor && !HasBossRoom)
            {
                RandomDirection rnd_dir = new RandomDirection();
                while (true)
                {
                    int direction = rnd_dir.getDirection(mt);
                    if (_set_traits(pos, direction, 3100))
                    {
                        start_direction = direction;
                        break;
                    }
                    //			# core::ICommonAPI::stdapi_SetNPCDirection();  // Server stuff?
                }
            }
            maze_generator.setPathPosition(pos);
        }