コード例 #1
0
        protected internal override void CreateItems()
        {
            var keyPos = _anteroom.Random();

            while (!passable[keyPos])
            {
                keyPos = _anteroom.Random();
            }

            Drop(new IronKey(), keyPos).HeapType = Heap.Type.Chest;

            var item = Bones.Get();

            if (item == null)
            {
                return;
            }
            int pos;

            do
            {
                pos = RoomEntrance.Random();
            }while (pos == entrance || map[pos] == Terrain.SIGN);

            Drop(item, pos).HeapType = Heap.Type.Skeleton;
        }
コード例 #2
0
ファイル: SewerBossLevel.cs プロジェクト: zvinch/SharpDungeon
        protected internal override void Decorate()
        {
            var start = RoomExit.Top * Width + RoomExit.Left + 1;
            var end   = start + RoomExit.Width() - 1;

            for (var i = start; i < end; i++)
            {
                if (i != exit)
                {
                    map[i]         = Terrain.WALL_DECO;
                    map[i + Width] = Terrain.WATER;
                }
                else
                {
                    map[i + Width] = Terrain.EMPTY;
                }
            }

            while (true)
            {
                var pos = RoomEntrance.Random();

                if (pos == entrance)
                {
                    continue;
                }

                map[pos] = Terrain.SIGN;
                break;
            }
        }
コード例 #3
0
        protected internal override void Decorate()
        {
            for (var i = 0; i < Length; i++)
            {
                if (map[i] == Terrain.EMPTY && pdsharp.utils.Random.Int(10) == 0)
                {
                    map[i] = Terrain.EMPTY_DECO;
                }
                else
                if (map[i] == Terrain.WALL && pdsharp.utils.Random.Int(8) == 0)
                {
                    map[i] = Terrain.WALL_DECO;
                }
            }

            while (true)
            {
                var pos = RoomEntrance.Random();

                if (pos == entrance)
                {
                    continue;
                }

                map[pos] = Terrain.SIGN;
                break;
            }
        }
コード例 #4
0
ファイル: SewerBossLevel.cs プロジェクト: zvinch/SharpDungeon
        protected internal override void CreateItems()
        {
            var item = Bones.Get();

            if (item == null)
            {
                return;
            }

            int pos;

            do
            {
                pos = RoomEntrance.Random();
            }while (pos == entrance || map[pos] == Terrain.SIGN);

            Drop(item, pos).HeapType = Heap.Type.Skeleton;
        }
コード例 #5
0
ファイル: SewerLevel.cs プロジェクト: zvinch/SharpDungeon
        protected internal override void Decorate()
        {
            for (var i = 0; i < Width; i++)
            {
                if (map[i] == Terrain.WALL && map[i + Width] == Terrain.WATER && Random.Int(4) == 0)
                {
                    map[i] = Terrain.WALL_DECO;
                }
            }

            for (var i = Width; i < Length - Width; i++)
            {
                if (map[i] == Terrain.WALL && map[i - Width] == Terrain.WALL && map[i + Width] == Terrain.WATER && Random.Int(2) == 0)
                {
                    map[i] = Terrain.WALL_DECO;
                }
            }

            for (var i = Width + 1; i < Length - Width - 1; i++)
            {
                if (map[i] == Terrain.EMPTY)
                {
                    var count = (map[i + 1] == Terrain.WALL ? 1 : 0) + (map[i - 1] == Terrain.WALL ? 1 : 0) + (map[i + Width] == Terrain.WALL ? 1 : 0) + (map[i - Width] == Terrain.WALL ? 1 : 0);

                    if (Random.Int(16) < count * count)
                    {
                        map[i] = Terrain.EMPTY_DECO;
                    }
                }
            }

            while (true)
            {
                var pos = RoomEntrance.Random();

                if (pos == entrance)
                {
                    continue;
                }

                map[pos] = Terrain.SIGN;
                break;
            }
        }
コード例 #6
0
ファイル: HallsLevel.cs プロジェクト: zvinch/SharpDungeon
        protected internal override void Decorate()
        {
            for (var i = Width + 1; i < Length - Width - 1; i++)
            {
                switch (map[i])
                {
                case Terrain.EMPTY:
                {
                    var count = NEIGHBOURS8.Count(neighbour => (Terrain.Flags[map[i + neighbour]] & Terrain.PASSABLE) > 0);

                    if (pdsharp.utils.Random.Int(80) < count)
                    {
                        map[i] = Terrain.EMPTY_DECO;
                    }
                }
                break;

                case Terrain.WALL:
                {
                    var count = NEIGHBOURS4.Count(neighbour => map[i + neighbour] == Terrain.WATER);

                    if (pdsharp.utils.Random.Int(4) < count)
                    {
                        map[i] = Terrain.WALL_DECO;
                    }
                }
                break;
                }
            }

            while (true)
            {
                var pos = RoomEntrance.Random();

                if (pos == entrance)
                {
                    continue;
                }

                map[pos] = Terrain.SIGN;
                break;
            }
        }
コード例 #7
0
        protected internal override void Decorate()
        {
            foreach (var room in Rooms)
            {
                if (room.type != RoomType.STANDARD)
                {
                    continue;
                }

                if (room.Width() <= 3 || room.Height() <= 3)
                {
                    continue;
                }

                var s = room.Square();

                if (Random.Int(s) > 8)
                {
                    var corner = (room.Left + 1) + (room.Top + 1) * Width;
                    if (map[corner - 1] == Terrain.WALL && map[corner - Width] == Terrain.WALL)
                    {
                        map[corner] = Terrain.WALL;
                    }
                }

                if (Random.Int(s) > 8)
                {
                    var corner = (room.Right - 1) + (room.Top + 1) * Width;
                    if (map[corner + 1] == Terrain.WALL && map[corner - Width] == Terrain.WALL)
                    {
                        map[corner] = Terrain.WALL;
                    }
                }

                if (Random.Int(s) > 8)
                {
                    var corner = (room.Left + 1) + (room.Bottom - 1) * Width;
                    if (map[corner - 1] == Terrain.WALL && map[corner + Width] == Terrain.WALL)
                    {
                        map[corner] = Terrain.WALL;
                    }
                }

                if (Random.Int(s) > 8)
                {
                    var corner = (room.Right - 1) + (room.Bottom - 1) * Width;
                    if (map[corner + 1] == Terrain.WALL && map[corner + Width] == Terrain.WALL)
                    {
                        map[corner] = Terrain.WALL;
                    }
                }

                foreach (var n in room.Connected.Keys)
                {
                    if ((n.type == RoomType.STANDARD || n.type == RoomType.TUNNEL) && Random.Int(3) == 0)
                    {
                        Painter.Set(this, room.Connected[n], Terrain.EMPTY_DECO);
                    }
                }
            }

            for (var i = Width + 1; i < Length - Width; i++)
            {
                if (map[i] != Terrain.EMPTY)
                {
                    continue;
                }

                var n = 0;
                if (map[i + 1] == Terrain.WALL)
                {
                    n++;
                }

                if (map[i - 1] == Terrain.WALL)
                {
                    n++;
                }

                if (map[i + Width] == Terrain.WALL)
                {
                    n++;
                }

                if (map[i - Width] == Terrain.WALL)
                {
                    n++;
                }

                if (Random.Int(6) <= n)
                {
                    map[i] = Terrain.EMPTY_DECO;
                }
            }

            for (var i = 0; i < Length; i++)
            {
                if (map[i] == Terrain.WALL && Random.Int(12) == 0)
                {
                    map[i] = Terrain.WALL_DECO;
                }
            }

            while (true)
            {
                var pos = RoomEntrance.Random();

                if (pos == entrance)
                {
                    continue;
                }

                map[pos] = Terrain.SIGN;
                break;
            }

            if (Dungeon.BossLevel(Dungeon.Depth + 1))
            {
                return;
            }

            foreach (var r in Rooms)
            {
                if (r.type != RoomType.STANDARD)
                {
                    continue;
                }

                foreach (var n in r.Neigbours)
                {
                    if (n.type != RoomType.STANDARD || r.Connected.ContainsKey(n))
                    {
                        continue;
                    }

                    var w = r.Intersect(n);
                    if (w.Left == w.Right && w.Bottom - w.Top >= 5)
                    {
                        w.Top    += 2;
                        w.Bottom -= 1;

                        w.Right++;

                        Painter.Fill(this, w.Left, w.Top, 1, w.Height(), Terrain.CHASM);
                    }
                    else
                    if (w.Top == w.Bottom && w.Right - w.Left >= 5)
                    {
                        w.Left  += 2;
                        w.Right -= 1;

                        w.Bottom++;

                        Painter.Fill(this, w.Left, w.Top, w.Width(), 1, Terrain.CHASM);
                    }
                }
            }
        }
コード例 #8
0
        protected internal override void Decorate()
        {
            for (var i = Width + 1; i < Length - Width - 1; i++)
            {
                if (map[i] != Terrain.EMPTY)
                {
                    continue;
                }

                var c = 0.05f;
                if (map[i + 1] == Terrain.WALL && map[i + Width] == Terrain.WALL)
                {
                    c += 0.2f;
                }
                if (map[i - 1] == Terrain.WALL && map[i + Width] == Terrain.WALL)
                {
                    c += 0.2f;
                }
                if (map[i + 1] == Terrain.WALL && map[i - Width] == Terrain.WALL)
                {
                    c += 0.2f;
                }
                if (map[i - 1] == Terrain.WALL && map[i - Width] == Terrain.WALL)
                {
                    c += 0.2f;
                }

                if (pdsharp.utils.Random.Float() < c)
                {
                    map[i] = Terrain.EMPTY_DECO;
                }
            }

            for (var i = 0; i < Width; i++)
            {
                if (map[i] == Terrain.WALL && (map[i + Width] == Terrain.EMPTY || map[i + Width] == Terrain.EMPTY_SP) && pdsharp.utils.Random.Int(6) == 0)
                {
                    map[i] = Terrain.WALL_DECO;
                }
            }

            for (var i = Width; i < Length - Width; i++)
            {
                if (map[i] == Terrain.WALL && map[i - Width] == Terrain.WALL && (map[i + Width] == Terrain.EMPTY || map[i + Width] == Terrain.EMPTY_SP) && pdsharp.utils.Random.Int(3) == 0)
                {
                    map[i] = Terrain.WALL_DECO;
                }
            }

            while (true)
            {
                var pos = RoomEntrance.Random();

                if (pos == entrance)
                {
                    continue;
                }

                map[pos] = Terrain.SIGN;
                break;
            }
        }
コード例 #9
0
        protected internal override void Decorate()
        {
            for (var i = Width + 1; i < Length - Width - 1; i++)
            {
                if (map[i] != Terrain.EMPTY)
                {
                    continue;
                }

                var c = 0.15f;
                if (map[i + 1] == Terrain.WALL && map[i + Width] == Terrain.WALL)
                {
                    c += 0.2f;
                }
                if (map[i - 1] == Terrain.WALL && map[i + Width] == Terrain.WALL)
                {
                    c += 0.2f;
                }
                if (map[i + 1] == Terrain.WALL && map[i - Width] == Terrain.WALL)
                {
                    c += 0.2f;
                }
                if (map[i - 1] == Terrain.WALL && map[i - Width] == Terrain.WALL)
                {
                    c += 0.2f;
                }

                if (Random.Float() < c)
                {
                    map[i] = Terrain.EMPTY_DECO;
                }
            }

            for (var i = 0; i < Width; i++)
            {
                if (map[i] == Terrain.WALL && (map[i + Width] == Terrain.EMPTY || map[i + Width] == Terrain.EMPTY_SP) && Random.Int(4) == 0)
                {
                    map[i] = Terrain.WALL_DECO;
                }
            }

            for (var i = Width; i < Length - Width; i++)
            {
                if (map[i] == Terrain.WALL && map[i - Width] == Terrain.WALL && (map[i + Width] == Terrain.EMPTY || map[i + Width] == Terrain.EMPTY_SP) && Random.Int(2) == 0)
                {
                    map[i] = Terrain.WALL_DECO;
                }
            }

            while (true)
            {
                var pos = RoomEntrance.Random();

                if (pos == entrance)
                {
                    continue;
                }

                map[pos] = Terrain.SIGN;
                break;
            }

            var door = RoomExit.Entrance();

            _arenaDoor = door.X + door.Y * Width;
            Painter.Set(this, _arenaDoor, Terrain.LOCKED_DOOR);

            Painter.Fill(this, RoomExit.Left + 2, RoomExit.Top + 2, RoomExit.Width() - 3, RoomExit.Height() - 3, Terrain.INACTIVE_TRAP);
        }