Ejemplo n.º 1
0
        protected override bool TryOpen(Entity entity)
        {
            var item = Scourge.GenerateItemId();

            if (item != null)
            {
                Timer.Add(() => entity.GetComponent <InventoryComponent>().Pickup(Items.CreateAndAdd(item, entity.Area)), 0.3f);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public override void Paint(Level level)
        {
            Painter.Fill(level, this, 1, Tile.EvilFloor);

            var stand = new ScourgedStand();

            level.Area.Add(stand);
            stand.Center = GetCenter() * 16 + new Vector2(8);

            stand.SetItem(Items.CreateAndAdd(Scourge.GenerateItemId(), level.Area), stand);
        }
Ejemplo n.º 3
0
        public static void Place(Vector2 where, Area area)
        {
            where.Y -= 16;

            var goblin = new TrashGoblin();

            area.Add(goblin);
            goblin.BottomCenter = where;
            goblin.X           += 1;

            var stand = new TrashGoblinStand();

            area.Add(stand);
            stand.Center = where + new Vector2(0, 4 + stand.Height);

            stand.SetItem(Items.CreateAndAdd(Scourge.GenerateItemId(), area, false), null);
        }
Ejemplo n.º 4
0
        protected override bool TryPay(Entity entity)
        {
            if (base.TryPay(entity))
            {
                var scourge = Scourge.GenerateItemId();

                if (scourge != null)
                {
                    Timer.Add(() => {
                        entity.GetComponent <InventoryComponent>().Pickup(Items.CreateAndAdd(scourge, entity.Area));
                    }, 2f);
                }

                return(true);
            }

            return(false);
        }
Ejemplo n.º 5
0
        static HappeningRegistry()
        {
            // Bad
            Add("omega_hurt", new HurtHappening(3));
            Add("confused", new BuffHappening(ConfusedBuff.Id, 30));
            Add("snail", new BuffHappening(SlowBuff.Id, 30));
            Add("broken", new BuffHappening(BrokenArmorBuff.Id, 30));
            Add("darkness", new DarknessHappening());
            Add("scourge_token", new ItemGiveHappening(() => Scourge.GenerateItemId()));
            Add("risk", new ItemGiveHappening(() => "bk:scourge_of_risk"));
            Add("double_trouble", new ItemGiveHappening(() => "bk:scourge_of_blood"));
            Add("rage", new BkRageHappening());
            Add("regular_tp", new TeleportHappening(RoomType.Regular, RoomType.Trap));
            Add("reset", new FloorResetHappening());
            Add("sudoku", new BombHappening());
            Add("items_hurt", new MakeItemsDamageUse());
            Add("scourged", new ScourgeHappening(3));
            Add("reroll_items", new RerollHappening(false, true));
            Add("reroll_weapon", new RerollHappening(true, false));
            Add("nerf", new ModifyMaxHpHappening(-2));
            Add("rob", new ModifyCoinsHappening(-10));
            Add("steal", new StealWeaponHappening());
            Add("bomb", new BombingHappening());
            Add("slide", new SlideHappening());

            // Good
            Add("give_random_consumable", new RandomItemHappening(ItemPool.Consumable));
            Add("invincible", new BuffHappening(InvincibleBuff.Id, 30));
            Add("heal", new HealHappening(2));
            Add("cleanse", new ScourgeHappening(-3));
            Add("chest", new ChestHappening());
            Add("gift", new ModifyCoinsHappening(10));

            // Neutral
            // Add("entrance_tp", new TeleportHappening(RoomType.Entrance));
            // Add("exit_tp", new TeleportHappening(RoomType.Exit, RoomType.Boss));
        }
Ejemplo n.º 6
0
        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;
            }
            }
        }
Ejemplo n.º 7
0
        public override void AddComponents()
        {
            base.AddComponents();

            Width  = 31;
            Height = 33;

            AddComponent(new AnimationComponent("emerald_golem"));
            AddComponent(new SensorBodyComponent(-Npc.Padding, -Npc.Padding, Width + Npc.Padding * 2, Height + Npc.Padding, BodyType.Static));
            AddComponent(new RectBodyComponent(2, 17, 27, 16, BodyType.Static));

            AddComponent(new InteractableComponent(Interact)
            {
                CanInteract = e => !broken
            });

            GetComponent <DialogComponent>().Dialog.Voice = 15;

            Dialogs.RegisterCallback("eg_0", (d, c) => {
                if (broken)
                {
                    return(null);
                }

                if (((ChoiceDialog)d).Choice == 0)
                {
                    Timer.Add(() => {
                        GetComponent <DialogComponent>().StartAndClose(Locale.Get("eg_1"), 3);
                    }, 0.2f);

                    var inv = c.To.GetComponent <InventoryComponent>();
                    var a   = c.To.Area;

                    for (var i = 0; i < Amount; i++)
                    {
                        inv.Pickup(Items.CreateAndAdd("bk:emerald", a));
                    }

                    Timer.Add(() => {
                        inv.Pickup(Items.CreateAndAdd(Scourge.GenerateItemId(), a));
                    }, 1f);

                    Timer.Add(() => {
                        GetComponent <AnimationComponent>().Animate(() => {
                            Done = true;
                            Engine.Instance.Flash = 1f;
                            Camera.Instance.Shake(8);

                            for (var i = 0; i < 4; i++)
                            {
                                var part = new ParticleEntity(Particles.Dust());

                                part.Position       = Center + Rnd.Vector(-16, 16);
                                part.Particle.Scale = Rnd.Float(1f, 2f);
                                Run.Level.Area.Add(part);
                                part.Depth = 1;
                            }
                        });
                    }, 4f);

                    broken = true;
                    return(null);
                }
                else if (GlobalSave.IsTrue("bk:emerald_gun"))
                {
                    Timer.Add(() => {
                        GetComponent <DialogComponent>().StartAndClose(Locale.Get("eg_1"), 3);
                    }, 0.2f);

                    var inv = c.To.GetComponent <InventoryComponent>();
                    var a   = c.To.Area;

                    inv.Pickup(Items.CreateAndAdd("bk:emerald_gun", a));

                    Timer.Add(() => {
                        inv.Pickup(Items.CreateAndAdd(Scourge.GenerateItemId(), a));
                    }, 1f);

                    Timer.Add(() => {
                        GetComponent <AnimationComponent>().Animate(() => {
                            Done = true;
                            Engine.Instance.Flash = 1f;
                            Camera.Instance.Shake(8);

                            for (var i = 0; i < 4; i++)
                            {
                                var part = new ParticleEntity(Particles.Dust());

                                part.Position       = Center + Rnd.Vector(-16, 16);
                                part.Particle.Scale = Rnd.Float(1f, 2f);
                                Run.Level.Area.Add(part);
                                part.Depth = 1;
                            }
                        });
                    }, 4f);

                    broken = true;
                    return(null);
                }

                return(null);
            });

            Subscribe <RoomChangedEvent>();
        }