Exemple #1
0
        public override void Paint(Level level)
        {
            base.Paint(level);
            Painter.Fill(level, this, 1, Tile.Chasm);
            Painter.Fill(level, this, Rnd.Int(2, 4), Tiles.RandomFloor());

            PaintTunnel(level, Tiles.RandomFloor(), GetCenterRect());

            var chest = new ProtoChest();

            level.Area.Add(chest);
            chest.BottomCenter = GetTileCenter() * 16 + new Vector2(8);
        }
Exemple #2
0
        public override void Paint(Level level)
        {
            Entity chest = null;

            if (Rnd.Chance(10))
            {
                chest = new ProtoChest();
            }
            else
            {
                try {
                    chest = ChestRegistry.PlaceRandom(Vector2.Zero, level.Area);
                } catch (Exception e) {
                    Log.Error(e);
                    chest = new WoodenChest();
                }
            }

            level.Area.Add(chest);
            chest.BottomCenter = GetCenter() * 16 + new Vector2(8, 8);
        }
        public override void Paint(Level level)
        {
            if (LevelSave.BiomeGenerated is IceBiome)
            {
                var clip = Painter.Clip;
                Painter.Clip = null;
                Painter.Rect(level, this, 0, Tile.WallB);
                Painter.Clip = clip;
            }

            var t = Tiles.Pick(Tile.Chasm, Tile.WallA, Tile.WallB, Tile.Planks);

            if (Rnd.Chance())
            {
                Painter.Set(level, new Dot(Left + 1, Top + 1), t);
                Painter.Set(level, new Dot(Right - 1, Bottom - 1), t);
            }

            if (Rnd.Chance())
            {
                Painter.Set(level, new Dot(Right - 1, Top + 1), t);
                Painter.Set(level, new Dot(Left + 1, Bottom - 1), t);
            }

            if (Rnd.Chance(10 + Run.Scourge * 5))
            {
                var cn = GetCenter() * 16;
                var c  = Rnd.Int(2, 4);

                for (var i = 0; i < c; i++)
                {
                    var stand = new ScourgedStand();
                    level.Area.Add(stand);
                    stand.Center = cn + new Vector2(16 + (i - c / 2f) * 32, 8);

                    stand.SetItem(Items.CreateAndAdd(Scourge.GenerateItemId(), level.Area), stand);
                }

                return;
            }

            var center = GetCenter() * 16 + new Vector2(8);

            if (Rnd.Chance(5))
            {
                var chest = new ProtoChest();
                level.Area.Add(chest);
                chest.BottomCenter = center;

                return;
            }

            switch (Rnd.Int(GlobalSave.IsTrue(ShopNpc.Gobetta) ? 6 : 5))
            {
            case 0: {
                for (var i = 0; i < Rnd.Int(1, 3); i++)
                {
                    Items.CreateAndAdd("bk:heart", level.Area).Center = center;
                }

                break;
            }

            case 1: {
                for (var i = 0; i < Rnd.Int(1, 4); i++)
                {
                    Items.CreateAndAdd("bk:shield", level.Area).Center = center;
                }

                break;
            }

            case 2: {
                var stand = new ItemStand();
                level.Area.Add(stand);
                stand.BottomCenter = center;
                stand.SetItem(Items.CreateAndAdd(Items.Generate(ItemPool.Treasure), level.Area), null);

                break;
            }

            case 3: {
                var a = Rnd.Chance();
                var c = Rnd.Int(1, a ? 3 : 4);

                for (var i = 0; i < c; i++)
                {
                    var chest = a ? (Chest) new StoneChest() : new RedChest();
                    level.Area.Add(chest);
                    chest.BottomCenter = center - new Vector2((c / 2f - i) * 20, 0);
                }

                break;
            }

            case 4: {
                for (var i = 0; i < Rnd.Int(6, 12); i++)
                {
                    Items.CreateAndAdd("bk:coin", level.Area).Center = center;
                }

                break;
            }

            case 5: {
                Gobetta.Place(GetTileCenter() * 16 + new Vector2(8, 8), level.Area);
                break;
            }
            }
        }