Beispiel #1
0
        public static void DenyDrops(Action <Chest> orig, Chest self)
        {
            PlayerController player = (GameManager.Instance.PrimaryPlayer);
            bool             flag   = player.HasPickupID(Game.Items["bny:sacrifice"].PickupObjectId);

            if (flag)
            {
                GameObject          obj  = new GameObject();
                ArtifactOfSacrifice f**k = obj.AddComponent <ArtifactOfSacrifice>();
                f**k.GetRidOfBowler();
                if (self.ChestIdentifier == Chest.SpecialChestIdentifier.SECRET_RAINBOW)
                {
                    self.RevealSecretRainbow();
                }
                if (self.ChestIdentifier == Chest.SpecialChestIdentifier.SECRET_RAINBOW || self.IsRainbowChest || self.breakAnimName.Contains("redgold") || self.breakAnimName.Contains("black"))
                {
                    GameStatsManager.Instance.SetFlag(GungeonFlags.ITEMSPECIFIC_GOLD_JUNK, true);
                }
                self.spriteAnimator.Play(string.IsNullOrEmpty(f**k.overrideBreakAnimName) ? f**k.breakAnimName : f**k.overrideBreakAnimName);
                self.specRigidbody.enabled = false;
                self.IsBroken = true;
                IntVector2 intVector  = self.specRigidbody.UnitBottomLeft.ToIntVector2(VectorConversions.Floor);
                IntVector2 intVector2 = self.specRigidbody.UnitTopRight.ToIntVector2(VectorConversions.Floor);
                for (int i = intVector.x; i <= intVector2.x; i++)
                {
                    for (int j = intVector.y; j <= intVector2.y; j++)
                    {
                        GameManager.Instance.Dungeon.data[new IntVector2(i, j)].isOccupied = false;
                    }
                }
                if (self.LockAnimator != null && self.LockAnimator)
                {
                    UnityEngine.Object.Destroy(self.LockAnimator.gameObject);
                }
                Transform transform = self.transform.Find("Shadow");
                if (transform != null)
                {
                    UnityEngine.Object.Destroy(transform.gameObject);
                }

                for (int k = 0; k < GameManager.Instance.AllPlayers.Length; k++)
                {
                    if (GameManager.Instance.AllPlayers[k].OnChestBroken != null)
                    {
                        GameManager.Instance.AllPlayers[k].OnChestBroken(GameManager.Instance.AllPlayers[k], self);
                    }
                }
            }
            else
            {
                orig(self);
            }
        }
Beispiel #2
0
        public static void DenyDrops(Action <Chest> orig, Chest self)
        {
            GameObject          obj  = new GameObject();
            ArtifactOfSacrifice f**k = obj.GetComponent <ArtifactOfSacrifice>();

            PlayerController player = (GameManager.Instance.PrimaryPlayer);
            bool             flag   = player.HasPickupID(Game.Items["bny:sacrifice"].PickupObjectId);

            if (flag)
            {
                f**k.GetRidOfBowler();
                if (self.ChestIdentifier == Chest.SpecialChestIdentifier.SECRET_RAINBOW)
                {
                    self.RevealSecretRainbow();
                }
                if (self.ChestIdentifier == Chest.SpecialChestIdentifier.SECRET_RAINBOW || self.IsRainbowChest || self.breakAnimName.Contains("redgold") || self.breakAnimName.Contains("black"))
                {
                    GameStatsManager.Instance.SetFlag(GungeonFlags.ITEMSPECIFIC_GOLD_JUNK, true);
                }
                self.spriteAnimator.Play(string.IsNullOrEmpty(f**k.overrideBreakAnimName) ? f**k.breakAnimName : f**k.overrideBreakAnimName);
                self.specRigidbody.enabled = false;
                self.IsBroken = true;
                IntVector2 intVector  = self.specRigidbody.UnitBottomLeft.ToIntVector2(VectorConversions.Floor);
                IntVector2 intVector2 = self.specRigidbody.UnitTopRight.ToIntVector2(VectorConversions.Floor);
                for (int i = intVector.x; i <= intVector2.x; i++)
                {
                    for (int j = intVector.y; j <= intVector2.y; j++)
                    {
                        GameManager.Instance.Dungeon.data[new IntVector2(i, j)].isOccupied = false;
                    }
                }
                if (self.LockAnimator != null && self.LockAnimator)
                {
                    UnityEngine.Object.Destroy(self.LockAnimator.gameObject);
                }
                Transform transform = self.transform.Find("Shadow");
                if (transform != null)
                {
                    UnityEngine.Object.Destroy(transform.gameObject);
                }

                for (int k = 0; k < GameManager.Instance.AllPlayers.Length; k++)
                {
                    if (GameManager.Instance.AllPlayers[k].OnChestBroken != null)
                    {
                        GameManager.Instance.AllPlayers[k].OnChestBroken(GameManager.Instance.AllPlayers[k], self);
                    }
                }
            }
            else
            {
                bool harderlotj = JammedSquire.NoHarderLotJ;
                if (harderlotj)
                {
                    orig(self);
                }
                else
                {
                    float num = 0f;
                    num = (player.stats.GetStatValue(PlayerStats.StatType.Curse));
                    orig(self);
                    f**k.random = UnityEngine.Random.Range(0.0f, 1.0f);
                    if (f**k.random <= (num / 10))
                    {
                        int id = BraveUtility.RandomElement <int>(ArtifactOfSacrifice.Lootdrops);
                        LootEngine.SpawnItem(PickupObjectDatabase.GetById(id).gameObject, self.specRigidbody.UnitCenter, Vector2.down, .7f, false, true, false);
                    }
                }
            }
        }