Ejemplo n.º 1
0
 public static void doEffect(Action <DebrisObject> orig, DebrisObject spawnedItem)
 {
     try
     {
         orig(spawnedItem);
         PickupObject itemness = spawnedItem.gameObject.GetComponent <PickupObject>();
         if (itemness != null)
         {
             if (itemness.PickupObjectId == 73 || itemness.PickupObjectId == 85)
             {
                 AttemptReroll(itemness);
             }
         }
     }
     catch (Exception e)
     {
         ETGModConsole.Log(e.Message);
         ETGModConsole.Log(e.StackTrace);
     }
 }
Ejemplo n.º 2
0
        private bool DetermineIfValid(DebrisObject thing)
        {
            PickupObject itemness = thing.gameObject.GetComponent <PickupObject>();

            if (itemness != null)
            {
                if (!invalidIDs.Contains(itemness.PickupObjectId))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 private void FindItem(PlayerController user)
 {
     pickupsInRoom.Clear();
     DebrisObject[] shitOnGround = FindObjectsOfType <DebrisObject>();
     foreach (DebrisObject debris in shitOnGround)
     {
         bool isValid = DetermineIfValid(debris);
         if (isValid && debris.transform.position.GetAbsoluteRoom() == user.CurrentRoom)
         {
             pickupsInRoom.Add(debris);
         }
     }
     if (pickupsInRoom.Any())
     {
         DebrisObject target = BraveUtility.GetClosestToPosition(pickupsInRoom, user.CenterPosition);
         if (target)
         {
             RerollItem(target);
         }
     }
     else
     {
         Gun[] gunsonground = FindObjectsOfType <Gun>();
         foreach (Gun gunDebris in gunsonground)
         {
             PickupObject itemness = gunDebris.gameObject.GetComponent <PickupObject>();
             if ((itemness != null) && gunDebris.CurrentOwner == null && gunDebris.gameObject.transform.position != Vector3.zero)
             {
                 gunsInRoom.Add(gunDebris);
             }
         }
         if (gunsInRoom.Any())
         {
             Gun targetGun = BraveUtility.GetClosestToPosition(gunsInRoom, user.CenterPosition);
             if (targetGun)
             {
                 RerollGun(targetGun);
             }
         }
     }
 }
        public void CheckForItem(DebrisObject targetDebris)
        {
            if (m_isExploded)
            {
                return;
            }
            if (!targetDebris | !targetDebris.IsPickupObject | !targetDebris.Static)
            {
                return;
            }
            PickupObject targetItem = targetDebris.GetComponentInChildren <PickupObject>();

            if (targetItem == null)
            {
                return;
            }
            if (!targetItem.CanBeSold)
            {
                return;
            }
            if (targetItem.IsBeingSold)
            {
                return;
            }
            if (targetItem is CurrencyPickup || targetItem is KeyBulletPickup || targetItem is HealthPickup)
            {
                return;
            }
            // if (specRigidbody.ContainsPoint(targetItem.sprite.WorldCenter, 2147483647, true)) { StartCoroutine(HandleSoldItem(targetItem)); } else { return; }
            // Use Magnitude calculation instead. Chaos modes may cause specRigidBody to not operate correctly with original method.
            float magnitude = (targetItem.sprite.WorldCenter - specRigidbody.UnitCenter).magnitude;

            if (magnitude < 1.8f)
            {
                StartCoroutine(HandleSoldItem(targetItem));
            }
            else
            {
                return;
            }
        }
Ejemplo n.º 5
0
        private void DoShake(bool explodeIdle)
        {
            if (!_running)
            {
                return;
            }

            if (!explodeIdle)
            {
                SetTimer(() =>
                {
                    DoShake(false);
                }, NewTime() * 1000);

                Zone.BroadcastMessage(new PlayEmbeddedEffectOnAllClientsNearObjectMessage
                {
                    Associate  = Self,
                    Radius     = ShakeRadius,
                    EffectName = FxName,
                    FromObject = Self
                });

                DebrisObject.PlayFX("Debris", "DebrisFall");

                var randomFx = _random.Next(0, 4);

                ShipFxObject.PlayFX("FX", $"shipboom{randomFx}", 559);

                SetTimer(() =>
                {
                    DoShake(true);
                }, 5000);

                ShipFxObject2.Animate("explosion");
            }
            else
            {
                ShipFxObject.Animate("idle");
                ShipFxObject2.Animate("idle");
            }
        }
		// Token: 0x06007CE5 RID: 31973 RVA: 0x00316054 File Offset: 0x00314254
		public void Interact(PlayerController interactor)
		{
			if (!PassiveItem.IsFlagSetAtAll(typeof(LootersGloves)))
			{
				return;
			}
			FloorRewardData currentRewardData = GameManager.Instance.RewardManager.CurrentRewardData;
			LootEngine.AmmoDropType ammoDropType = LootEngine.AmmoDropType.DEFAULT_AMMO;
			bool flag = LootEngine.DoAmmoClipCheck(currentRewardData, out ammoDropType);
			string path = (ammoDropType != LootEngine.AmmoDropType.SPREAD_AMMO) ? "Ammo_Pickup" : "Ammo_Pickup_Spread";
			float value = UnityEngine.Random.value;
			float num = currentRewardData.ChestSystem_ChestChanceLowerBound;
            if (value <= 0.2f)
            {
                IntVector2 bestRewardLocation = base.sprite.WorldCenter.ToIntVector2();
                LootEngine.SpawnItem((GameObject)BraveResources.Load(path, ".prefab"), bestRewardLocation.ToVector3(), Vector2.up, 1f, true, true, false);
            }
            else if (value <= 0.9f)
            {
				GameObject gameObject;
				if(value <= 0.55f)
                {
					gameObject = currentRewardData.SingleItemRewardTable.SelectByWeight(false);
				}
                else
                {
					gameObject = ((UnityEngine.Random.value >= 0.9f) ? GameManager.Instance.RewardManager.FullHeartPrefab.gameObject : GameManager.Instance.RewardManager.HalfHeartPrefab.gameObject);
				}
				DebrisObject debrisObject = LootEngine.SpawnItem(gameObject, base.sprite.WorldCenter.ToIntVector2().ToVector3() + new Vector3(0.25f, 0f, 0f), Vector2.up, 1f, true, true, false);
				AkSoundEngine.PostEvent("Play_OBJ_item_spawn_01", debrisObject.gameObject);
			}
            else
            {
				GameManager.Instance.RewardManager.SpawnTotallyRandomItem(base.sprite.WorldCenter);
			}
			this.m_room.DeregisterInteractable(this);
			SpriteOutlineManager.RemoveOutlineFromSprite(base.sprite, false);
			UnityEngine.Object.Destroy(base.gameObject);
		}
        private void DoSpawn(FlippableCover table)
        {
            Vector3 vector  = table.transform.position;
            Vector3 vector2 = table.specRigidbody.UnitCenter;

            if (vector.y > 0f)
            {
                vector2 += Vector3.up * 0.25f;
            }
            GameObject     gameObject2 = Instantiate <GameObject>(objectToSpawn, vector2, Quaternion.identity);
            tk2dBaseSprite component4  = gameObject2.GetComponent <tk2dBaseSprite>();

            if (component4)
            {
                component4.PlaceAtPositionByAnchor(vector2, tk2dBaseSprite.Anchor.MiddleCenter);
            }
            Vector2 vector3 = table.transform.position;

            vector3 = Quaternion.Euler(0f, 0f, 0f) * vector3;
            DebrisObject debrisObject = LootEngine.DropItemWithoutInstantiating(gameObject2, gameObject2.transform.position, vector3, 0, false, false, true, false);

            if (gameObject2.GetComponent <BlackHoleDoer>())
            {
                gameObject2.GetComponent <BlackHoleDoer>().coreDuration = 2f;
                debrisObject.PreventFallingInPits = true;
                debrisObject.PreventAbsorption    = true;
            }
            if (vector.y > 0f && debrisObject)
            {
                debrisObject.additionalHeightBoost = -1f;
                if (debrisObject.sprite)
                {
                    debrisObject.sprite.UpdateZDepth();
                }
            }
            debrisObject.IsAccurateDebris = true;
            debrisObject.Priority         = EphemeralObject.EphemeralPriority.Critical;
            debrisObject.bounceCount      = 0;
        }
        private void OnLanded()
        {
            this.m_hasBeenTriggered               = false;
            base.sprite.gameObject.layer          = LayerMask.NameToLayer("FG_Critical");
            base.sprite.renderer.sortingLayerName = "Background";
            base.sprite.IsPerpendicular           = false;
            base.sprite.HeightOffGround           = -1f;
            this.m_currentPosition.z              = -1f;
            base.spriteAnimator.Play(this.landedAnimationName);
            this.chuteAnimator.PlayAndDestroyObject(this.chuteLandedAnimationName, null);
            if (this.m_landingTarget)
            {
                SpawnManager.Despawn(this.m_landingTarget);
            }
            this.m_landingTarget = null;

            GameObject gameObject = PickupObjectDatabase.GetById(LootID).gameObject;

            DebrisObject spawned = LootEngine.SpawnItem(gameObject, base.sprite.WorldCenter.ToVector3ZUp(0f) + new Vector3(-0.5f, 0.5f, 0f), Vector2.zero, 0f, false, false, false);

            base.StartCoroutine(this.DestroyCrateWhenPickedUp(spawned));
        }
Ejemplo n.º 9
0
        public override DebrisObject Drop(PlayerController player)
        {
            DebrisObject debrisObject = base.Drop(player);

            if (debrisObject)
            {
                CursedBrick component = debrisObject.GetComponent <CursedBrick>();
                if (component)
                {
                    component.m_pickedUpThisRun = true;
                }
            }

            if (player)
            {
                m_owner = null;
            }

            ExpandPlaceWallMimic.PlayerHasWallMimicItem = false;

            return(debrisObject);
        }
Ejemplo n.º 10
0
        public override DebrisObject Drop(PlayerController player)
        {
            foreach (Gun gun in Owner.inventory.AllGuns)
            {
                if (gun.DefaultModule.shootStyle == ProjectileModule.ShootStyle.Beam)
                {
                    BeamController beamController = gun.DefaultModule.projectiles[0].GetComponent <BeamController>();
                    if (beamController != null)
                    {
                        beamController.usesChargeDelay = true;
                    }
                }

                if (Owner.inventory.ContainsGun(153) || Owner.inventory.ContainsGun(13))
                {
                    if (gun.PickupObjectId.Equals(153))
                    {
                        Gun shockGun1 = PickupObjectDatabase.GetById(153) as Gun;
                        gun.DefaultModule.cooldownTime        = shockGun1.DefaultModule.cooldownTime;
                        gun.DefaultModule.numberOfShotsInClip = shockGun1.DefaultModule.numberOfShotsInClip;
                        gun.reloadTime = shockGun1.reloadTime;
                        gun.DefaultModule.shootStyle = shockGun1.DefaultModule.shootStyle;
                    }

                    if (gun.PickupObjectId.Equals(13))
                    {
                        Gun shockGun2 = PickupObjectDatabase.GetById(13) as Gun;
                        gun.DefaultModule.cooldownTime        = shockGun2.DefaultModule.cooldownTime;
                        gun.DefaultModule.numberOfShotsInClip = shockGun2.DefaultModule.numberOfShotsInClip;
                        gun.reloadTime = shockGun2.reloadTime;
                        gun.DefaultModule.shootStyle = shockGun2.DefaultModule.shootStyle;
                    }
                }
            }
            DebrisObject debrisObject = base.Drop(player);

            player.healthHaver.damageTypeModifiers.Remove(this.m_electricityImmunity);
            return(debrisObject);
        }
Ejemplo n.º 11
0
        public override DebrisObject Drop(PlayerController player)
        {
            DestroyCompanion();
            player.OnNewFloorLoaded = (Action <PlayerController>)Delegate.Remove(player.OnNewFloorLoaded, new Action <PlayerController>(HandleNewFloor));
            DebrisObject drop = base.Drop(player);

            if (drop)
            {
                BabySitter component = drop.gameObject.GetComponent <BabySitter>();
                if (component)
                {
                    component.m_HasDied         = m_HasDied;
                    component.m_PickedUp        = true;
                    component.m_healthRemaining = m_healthRemaining;
                    if (component.m_HasDied)
                    {
                        component.m_pickedUpThisRun = true;
                        component.Break();
                    }
                }
            }
            return(drop);
        }
Ejemplo n.º 12
0
        private PickupObject OpenRandom(PlayerController user)
        {
            PickupObject.ItemQuality startQuality = PickupObject.ItemQuality.D;
            PickupObject.ItemQuality endQuality   = PickupObject.ItemQuality.S;
            PickupObject.ItemQuality itemQuality  = (PickupObject.ItemQuality)UnityEngine.Random.Range((int)startQuality, (int)(endQuality + 1));

            PickupObject itemOfTypeAndQuality = (UnityEngine.Random.value >= 0.5f) ? LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality, GameManager.Instance.RewardManager.GunsLootTable, false) : LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality, GameManager.Instance.RewardManager.ItemsLootTable, false);
            DebrisObject debrisObject         = LootEngine.SpawnItem(itemOfTypeAndQuality.gameObject, user.CenterPosition, Vector2.up, 1f, true, true, false);

            if (debrisObject)
            {
                Vector2    v          = (!debrisObject.sprite) ? (debrisObject.transform.position.XY() + new Vector2(0.5f, 0.5f)) : debrisObject.sprite.WorldCenter;
                GameObject gameObject = SpawnManager.SpawnVFX((GameObject)BraveResources.Load("Global VFX/VFX_BlackPhantomDeath", ".prefab"), v, Quaternion.identity, false);
                if (gameObject && gameObject.GetComponent <tk2dSprite>())
                {
                    tk2dSprite component = gameObject.GetComponent <tk2dSprite>();
                    component.HeightOffGround = 5f;
                    component.UpdateZDepth();
                }
                return(debrisObject.GetComponentInChildren <PickupObject>());
            }
            return(null);
        }
Ejemplo n.º 13
0
 private void HandleBlackHoleEffect(TableTechChaosEffectIdentifier identifier, FlippableCover obj)
 {
     if (identifier == TableTechChaosEffectIdentifier.BLACK_HOLE)
     {
         Vector3        vector2     = obj.specRigidbody.UnitCenter;
         GameObject     gameObject2 = UnityEngine.Object.Instantiate <GameObject>(SingularityObject, vector2, Quaternion.identity);
         tk2dBaseSprite component4  = gameObject2.GetComponent <tk2dBaseSprite>();
         if (component4)
         {
             component4.PlaceAtPositionByAnchor(vector2, tk2dBaseSprite.Anchor.MiddleCenter);
         }
         DebrisObject debrisObject = LootEngine.DropItemWithoutInstantiating(gameObject2, gameObject2.transform.position, Vector2.zero, 0f, false, false, true, false);
         if (gameObject2.GetComponent <BlackHoleDoer>())
         {
             debrisObject.PreventFallingInPits = true;
             debrisObject.PreventAbsorption    = true;
         }
         debrisObject.IsAccurateDebris = true;
         debrisObject.Priority         = EphemeralObject.EphemeralPriority.Critical;
         debrisObject.bounceCount      = 0;
         obj.DestroyCover();
     }
 }
        private void Update()
        {
            if (Dungeon.IsGenerating)
            {
                return;
            }
            if (m_isExploded)
            {
                HandleFlightCollider();
                return;
            }
            bool PlayerIsInRoom = false;

            // Only becomes active when player enters room this component is in
            for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++)
            {
                if (m_parentRoom != null && GameManager.Instance.AllPlayers[i].CurrentRoom == m_parentRoom)
                {
                    PlayerIsInRoom = true;
                    break;
                }
            }
            // DebrisObject class has method for loading original component to do this for us.
            // But this is a new component so we must now do this ourselves (much like how BabyDragunJailController does this)
            if (PlayerIsInRoom && !m_currentlySellingAnItem && !m_isExploded)
            {
                for (int j = 0; j < StaticReferenceManager.AllDebris.Count; j++)
                {
                    DebrisObject debrisObject = StaticReferenceManager.AllDebris[j];
                    if (debrisObject)
                    {
                        CheckForItem(debrisObject);
                    }
                }
            }
        }
Ejemplo n.º 15
0
 private void SpawnShellCasingAtPosition(Vector3 position)
 {
     if (this.leafObj != null && this.transform)
     {
         GameObject  gameObject = SpawnManager.SpawnDebris(this.leafObj, position.WithZ(this.transform.position.z), this.transform.rotation);
         ShellCasing component  = gameObject.GetComponent <ShellCasing>();
         if (component != null)
         {
             component.Trigger();
         }
         DebrisObject component2 = gameObject.GetComponent <DebrisObject>();
         if (component2 != null)
         {
             int     num           = (component2.transform.right.x <= 0f) ? -1 : 1;
             Vector3 vector        = Vector3.up * (UnityEngine.Random.value * 1.5f + 1f) + -1.5f * Vector3.right * (float)num * (UnityEngine.Random.value + 1.5f);
             Vector3 startingForce = new Vector3(vector.x, 0f, vector.y);
             if (this.transform.position.GetAbsoluteRoom() != null && this.transform.position.GetAbsoluteRoom().area.PrototypeRoomSpecialSubcategory == PrototypeDungeonRoom.RoomSpecialSubCategory.CATACOMBS_BRIDGE_ROOM)
             {
                 startingForce = (vector.x * (float)num * -1f * (this.transform.position.XY() - this.sprite.WorldCenter).normalized).ToVector3ZUp(vector.y);
             }
             float y    = this.transform.position.y;
             float num2 = position.y - this.transform.position.y + 0.2f;
             float num3 = component2.transform.position.y - y + UnityEngine.Random.value * 0.5f;
             component2.additionalHeightBoost = num2 - num3;
             if (this.CurrentAngle > 25f && this.CurrentAngle < 155f)
             {
                 component2.additionalHeightBoost += -0.25f;
             }
             else
             {
                 component2.additionalHeightBoost += 0.25f;
             }
             component2.Trigger(startingForce, num3, 1f);
         }
     }
 }
Ejemplo n.º 16
0
        public static void BuildWestBrosBossPrefabs(AssetBundle assetBundle)
        {
            // all 3 west bros animation sets are actually in their 3 cut guns (752,753,754), they all contain the same ones, so we just take the first one
            // 752 is nome
            // 753 is tuc
            // 754 is angel
            WestBrosGun = PickupObjectDatabase.GetById(752);

            Collection = WestBrosGun.gameObject.GetComponent <tk2dSprite>().Collection;
            Animation  = WestBrosGun.gameObject.GetComponent <tk2dSpriteAnimator>().Library;

            Shades       = ExpandCustomEnemyDatabase.GetOfficialEnemyByGuid("c00390483f394a849c36143eb878998f");
            ShadesDebris = Shades.GetComponentInChildren <ExplosionDebrisLauncher>().debrisSources[0];

            SetupHand(assetBundle, out WestBrosHandPrefab, ExpandCustomEnemyDatabase.WestBrosCollection.GetComponent <tk2dSpriteCollectionData>());

            BuildWestBrosHatPrefab(assetBundle, out WestBrosAngelHatPrefab, WestBros.Angel, Collection, ShadesDebris);
            BuildWestBrosHatPrefab(assetBundle, out WestBrosNomeHatPrefab, WestBros.Nome, Collection, ShadesDebris);
            BuildWestBrosHatPrefab(assetBundle, out WestBrosTucHatPrefab, WestBros.Tuc, Collection, ShadesDebris);

            BuildWestBrosBossPrefab(assetBundle, out WestBrosAngelPrefab, WestBros.Angel, false, Collection, Animation);
            BuildWestBrosBossPrefab(assetBundle, out WestBrosNomePrefab, WestBros.Nome, true, Collection, Animation, true);
            BuildWestBrosBossPrefab(assetBundle, out WestBrosTucPrefab, WestBros.Tuc, true, Collection, Animation);
        }
Ejemplo n.º 17
0
        public override DebrisObject Drop(PlayerController player)
        {
            DebrisObject debrisObject = base.Drop(player);

            return(debrisObject);
        }
Ejemplo n.º 18
0
        private static void BuildWestBrosHatPrefab(AssetBundle assetBundle, out GameObject outObject, WestBros whichBro, tk2dSpriteCollectionData spriteCollection, DebrisObject broDebris)
        {
            outObject = assetBundle.LoadAsset <GameObject>($"WestBrosHat_{whichBro}");

            string hatSpriteName = null;

            switch (whichBro)
            {
            case WestBros.Angel:
                hatSpriteName = "hat_angel";
                break;

            case WestBros.Nome:
                hatSpriteName = "hat_nome";
                break;

            case WestBros.Tuc:
                hatSpriteName = "hat_tuco";
                break;
            }

            tk2dSprite hatSprite = outObject.AddComponent <tk2dSprite>();

            hatSprite.SetSprite(spriteCollection, hatSpriteName);
            hatSprite.SortingOrder = 0;

            ExpandUtility.GenerateSpriteAnimator(outObject);

            DebrisObject debrisObject = outObject.AddComponent <DebrisObject>();

            // this is set seperately because we use DeclaredOnly for the reflection field copying and Priority is inherited from EphemeralObject
            debrisObject.Priority = broDebris.Priority;

            ExpandUtility.ReflectionShallowCopyFields(debrisObject, broDebris, (BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly));
        }
Ejemplo n.º 19
0
        private static void BuildWestBrosBossPrefab(AssetBundle assetBundle, out GameObject outObject, WestBros whichBro, bool isSmiley, tk2dSpriteCollectionData sourceSpriteCollection, tk2dSpriteAnimation sourceAnimations, bool keepIntroDoer = false)
        {
            GameObject prefab = ExpandCustomEnemyDatabase.GetOfficialEnemyByGuid(isSmiley
                ? "ea40fcc863d34b0088f490f4e57f8913"              // Smiley
                : "c00390483f394a849c36143eb878998f").gameObject; // Shades

            outObject = UnityEngine.Object.Instantiate(prefab, Vector3.zero, Quaternion.identity);

            try
            {
                string name = $"West Bros {whichBro}";

                outObject.SetActive(false);
                outObject.name = name;

                AIActor actor = outObject.GetComponent <AIActor>();

                actor.healthHaver.overrideBossName = "Western Bros";

                actor.EnemyId   = UnityEngine.Random.Range(100000, 999999);
                actor.ActorName = name;

                EncounterTrackable Encounterable = outObject.GetComponent <EncounterTrackable>();

                switch (whichBro)
                {
                case WestBros.Angel:
                    actor.EnemyGuid             = "275354563e244f558be87fcff4b07f9f";
                    Encounterable.EncounterGuid = "7d6e1faf682d4402b29535020313f383";
                    break;

                case WestBros.Nome:
                    actor.EnemyGuid             = "3a1a33a905bb4b669e7d798f20674c4c";
                    Encounterable.EncounterGuid = "78cb8889dc884dd9b3aafe64558d858e";
                    break;

                case WestBros.Tuc:
                    actor.EnemyGuid             = "d2e7ea9ea9a444cebadd3bafa0832cd1";
                    Encounterable.EncounterGuid = "1df53371ce084dafb46f6bcd5a6c1c5f";
                    break;
                }

                // TODO at some distant point in time
                Encounterable.journalData.PrimaryDisplayName           = name;
                Encounterable.journalData.NotificationPanelDescription = name;
                Encounterable.journalData.AmmonomiconFullEntry         = name;

                // x BroController
                // x BulletBroDeathController
                // x BulletBrosIntroDoer
                // x BulletBroSeekTargetBehavior // movement behaviour
                //   BulletBroRepositionBehavior // completely unused

                var oldBroController = outObject.GetComponent <BroController>();
                var newBroController = outObject.AddComponent <ExpandWesternBroController>();

                newBroController.enrageAnim          = oldBroController.enrageAnim;
                newBroController.enrageAnimTime      = oldBroController.enrageAnimTime;
                newBroController.enrageHealToPercent = oldBroController.enrageHealToPercent;
                newBroController.overheadVfx         = oldBroController.overheadVfx;
                newBroController.postEnrageMoveSpeed = oldBroController.postEnrageMoveSpeed;

                newBroController.whichBro = whichBro;
                newBroController.postSecondEnrageMoveSpeed = newBroController.postEnrageMoveSpeed;

                UnityEngine.Object.Destroy(oldBroController);

                UnityEngine.Object.Destroy(outObject.GetComponent <BulletBroDeathController>());
                outObject.AddComponent <ExpandWesternBroDeathController>();

                var newMovementBehavior = new ExpandWesternBroSeekTargetBehavior();
                var oldMovementBehavior = actor.behaviorSpeculator.MovementBehaviors.First() as BulletBroSeekTargetBehavior;

                newMovementBehavior.CustomRange     = oldMovementBehavior.CustomRange;
                newMovementBehavior.PathInterval    = oldMovementBehavior.PathInterval;
                newMovementBehavior.StopWhenInRange = oldMovementBehavior.StopWhenInRange;

                actor.behaviorSpeculator.MovementBehaviors = new List <MovementBehaviorBase>()
                {
                    newMovementBehavior
                };

                // only smiley has a bossIntroDoer, so the stuff after this would null reference if done with shade
                if (isSmiley)
                {
                    if (!keepIntroDoer)
                    {
                        UnityEngine.Object.Destroy(outObject.GetComponent <BulletBrosIntroDoer>());
                        UnityEngine.Object.Destroy(outObject.GetComponent <GenericIntroDoer>());
                    }
                    else
                    {
                        // BulletBrosIntroDoer is a SpecificIntroDoer; it does not inherent from GenericIntroDoer, it requires it to be present
                        BulletBrosIntroDoer bulletBrosIntroDoer = outObject.GetComponent <BulletBrosIntroDoer>();

                        // destroy it so we can add our own
                        UnityEngine.Object.Destroy(bulletBrosIntroDoer);

                        GenericIntroDoer genericIntroDoer = outObject.GetComponent <GenericIntroDoer>();

                        genericIntroDoer.portraitSlideSettings.bossNameString     = "Western Bros";
                        genericIntroDoer.portraitSlideSettings.bossSubtitleString = "Triple Tap";
                        genericIntroDoer.portraitSlideSettings.bossQuoteString    = string.Empty;

                        genericIntroDoer.portraitSlideSettings.bossArtSprite = assetBundle.LoadAsset <Texture2D>("WesternBrosBossCard");

                        genericIntroDoer.triggerType     = GenericIntroDoer.TriggerType.PlayerEnteredRoom;
                        genericIntroDoer.OnIntroFinished = () => { };

                        ExpandWesternBroIntroDoer specificIntroDoer = outObject.AddComponent <ExpandWesternBroIntroDoer>();
                    }
                }

                var animationsAsset = assetBundle.LoadAsset <GameObject>($"WestBrosAnimations_{whichBro}");

                List <tk2dSpriteAnimationClip> animationClips = new List <tk2dSpriteAnimationClip>();

                foreach (tk2dSpriteAnimationClip clip in sourceAnimations.clips)
                {
                    if (clip.name.StartsWith($"{whichBro.ToString().ToLower()}_"))
                    {
                        animationClips.Add(ExpandUtility.DuplicateAnimationClip(clip));
                    }
                }

                List <tk2dSpriteAnimationClip> clipsToAdd = new List <tk2dSpriteAnimationClip>();

                foreach (tk2dSpriteAnimationClip clip in animationClips)
                {
                    clip.name = clip.name.Replace($"{whichBro.ToString().ToLower()}_", string.Empty);

                    clip.name = clip.name.Replace("dash_front", "dash_forward");
                    clip.name = clip.name.Replace("move_front", "move_forward");

                    if (clip.name.EndsWith("_prime"))
                    {
                        clip.frames[5].eventAudio   = "Play_ENM_bullet_dash_01";
                        clip.frames[5].triggerEvent = true;
                    }
                    else if (clip.name.StartsWith("move_"))
                    {
                        clip.frames[2].eventAudio   = "PLay_FS_ENM";
                        clip.frames[2].triggerEvent = true;
                    }
                    else if (clip.name == "anger")
                    {
                        // we change the west bros anger animation from a loop to a loop section so the anger SFX only plays once.
                        // to do this we simply clone every frame once and make it loop at the first copied frame.

                        var angerFrames = clip.frames.ToList();

                        foreach (var frame in clip.frames)
                        {
                            tk2dSpriteAnimationFrame clonedFrame = new tk2dSpriteAnimationFrame();

                            ExpandUtility.ReflectionShallowCopyFields(clonedFrame, frame, BindingFlags.Public | BindingFlags.Instance);

                            angerFrames.Add(clonedFrame);
                        }

                        // it's important to do this before changing clip.frames
                        clip.loopStart              = clip.frames.Length;
                        clip.frames                 = angerFrames.ToArray();
                        clip.wrapMode               = tk2dSpriteAnimationClip.WrapMode.LoopSection;
                        clip.frames[0].eventAudio   = "Play_BOSS_bulletbros_anger_01";
                        clip.frames[0].triggerEvent = true;
                    }
                    else if (clip.name == "death_right")
                    {
                        clip.name = "die";

                        tk2dSpriteAnimationClip dieFrontRight = ExpandUtility.DuplicateAnimationClip(clip);
                        dieFrontRight.name = "die_front_right";
                        clipsToAdd.Add(dieFrontRight);
                    }
                    else if (clip.name == "death_left")
                    {
                        clip.name = "die_left";

                        tk2dSpriteAnimationClip dieFrontLeft = ExpandUtility.DuplicateAnimationClip(clip);
                        dieFrontLeft.name = "die_front_left";
                        clipsToAdd.Add(dieFrontLeft);
                    }
                    else if (clip.name == "idle_front")
                    {
                        clip.name = "idle";

                        tk2dSpriteAnimationClip bigShot = ExpandUtility.DuplicateAnimationClip(clip);
                        bigShot.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once;
                        bigShot.name     = "big_shot";
                        clipsToAdd.Add(bigShot);

                        tk2dSpriteAnimationClip charge = ExpandUtility.DuplicateAnimationClip(clip);
                        charge.wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop;
                        charge.name     = "charge";
                        clipsToAdd.Add(charge);

                        // not really necessary since it's nuked from the animator further down
                        tk2dSpriteAnimationClip appear = ExpandUtility.DuplicateAnimationClip(clip);
                        appear.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once;
                        appear.name     = "appear";
                        clipsToAdd.Add(appear);

                        tk2dSpriteAnimationClip introGunToggle = ExpandUtility.DuplicateAnimationClip(clip);
                        introGunToggle.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once;
                        introGunToggle.name     = "intro2";
                        clipsToAdd.Add(introGunToggle);

                        introGunToggle.frames[0].eventInfo    = "guntoggle";
                        introGunToggle.frames[0].triggerEvent = true;
                    }
                    else if (clip.name == "summon")
                    {
                        clip.name     = "whistle";
                        clip.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once;
                        // the summon vfx don't look right
                        // clip.frames[0].eventVfx = "summon_vfx";
                        // clip.frames[0].triggerEvent = true;
                    }
                    else if (clip.name == "pound")
                    {
                        clip.name = "jump_attack";
                        // Uses modified sound that plays faster on the first half to account for west bros having faster animation.
                        clip.frames[0].eventAudio   = "Play_EX_BOSS_westbros_slam_01";
                        clip.frames[0].triggerEvent = true;
                    }
                    else if (clip.name == "intro")
                    {
                        clip.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once;
                        // this is setup in case we want the intro to continue looping during the boss card instead of the idle animation
                        // requires to change the intro doer so it sets finished to true once it reaches the first loop

                        //if (whichBro == WestBros.Nome)
                        //{
                        //    // nome's intro animation wasn't looping at the end like the others
                        //    var list = clip.frames.ToList();

                        //    list.RemoveAt(20);
                        //    list.RemoveAt(20);

                        //    clip.frames = list.ToArray();

                        //    clip.loopStart = 23;

                        //    clip.frames[23] = clip.frames[0];
                        //    clip.frames[24] = clip.frames[1];
                        //    clip.frames[25] = clip.frames[2];
                        //    clip.frames[26] = clip.frames[3];
                        //}
                        //else if (whichBro == WestBros.Tuc)
                        //{
                        //    // tuc's intro animation was off by one frame compared to the others
                        //    var list = clip.frames.ToList();

                        //    list.RemoveAt(15);

                        //    clip.frames = list.ToArray();

                        //    clip.loopStart = 21;
                        //}
                    }
                }

                animationClips.AddRange(clipsToAdd);

                tk2dSpriteAnimation spriteAnimation = animationsAsset.AddComponent <tk2dSpriteAnimation>();

                spriteAnimation.clips = animationClips.ToArray();

                tk2dSpriteAnimator spriteAnimator = outObject.GetComponent <tk2dSpriteAnimator>();

                spriteAnimator.Library = spriteAnimation;

                tk2dSprite sprite = outObject.GetComponent <tk2dSprite>();
                sprite.SetSprite(sourceSpriteCollection, $"BB_{whichBro.ToString().ToLower()}_idle_front_001");
                sprite.PlaceAtPositionByAnchor(new Vector3(0f, 0f), tk2dBaseSprite.Anchor.LowerCenter);

                AIAnimator animator = outObject.GetComponent <AIAnimator>();
                // removes the 'appear' animation
                animator.OtherAnimations.RemoveAt(0);

                outObject.transform.Find("shadow").localPosition += new Vector3(1.52f, 0.02f, 0);

                var shooter = SetupAIShooter(outObject);
                shooter.handObject = WestBrosHandPrefab.GetComponent <PlayerHandController>();

                DebrisObject hatPrefab = null;

                switch (whichBro)
                {
                case WestBros.Angel:
                    shooter.gunAttachPoint.position = new Vector3(-1.05f, 0.5f);
                    WestBrosAngelGUID = actor.EnemyGuid;
                    hatPrefab         = WestBrosAngelHatPrefab.GetComponent <DebrisObject>();
                    break;

                case WestBros.Nome:
                    shooter.gunAttachPoint.position = new Vector3(-1.05f, 0.4f);
                    WestBrosNomeGUID = actor.EnemyGuid;
                    hatPrefab        = WestBrosNomeHatPrefab.GetComponent <DebrisObject>();
                    break;

                case WestBros.Tuc:
                    shooter.gunAttachPoint.position = new Vector3(-1.05f, 0.5f);
                    WestBrosTucGUID = actor.EnemyGuid;
                    hatPrefab       = WestBrosTucHatPrefab.GetComponent <DebrisObject>();
                    break;
                }

                shooter.equippedGunId = WestBrosRevolverGenerator.GetWestBrosRevolverID(whichBro);

                if (shooter.equippedGunId == -1)
                {
                    ETGModConsole.Log("The West Bros Gun ID should have been set at this point already, but it wasn't. Assigning fallback gun.");
                    shooter.equippedGunId = isSmiley ? 35 : 22;
                }

                var hatLauncher = outObject.GetComponentInChildren <ExplosionDebrisLauncher>();

                // basically changes smiley's debris launcher into shades'
                hatLauncher.specifyArcDegrees = false;
                hatLauncher.minShards         = 1;
                hatLauncher.maxShards         = 1;

                hatLauncher.debrisSources = new DebrisObject[] { hatPrefab };

                // move the ring of bullets spawned by jumping
                var shootPoint = outObject.transform.Find("shoot point");
                shootPoint.position += new Vector3(1.5f, 0);

                // move the actual pixel colliders
                var rigidbody = outObject.GetComponent <SpeculativeRigidbody>();

                foreach (var item in rigidbody.PixelColliders)
                {
                    item.ManualOffsetX = 32;
                    item.Regenerate(outObject.transform);
                }

                // TODO balance
                actor.healthHaver.ForceSetCurrentHealth(600);
                actor.healthHaver.SetHealthMaximum(600);

                actor.RegenerateCache();

                ExpandCustomEnemyDatabase.AddEnemyToDatabase(outObject, actor.EnemyGuid, true);
                FakePrefab.MarkAsFakePrefab(outObject);
                UnityEngine.Object.DontDestroyOnLoad(outObject);
            }
            catch (Exception e)
            {
                ETGModConsole.Log($"Error setting up the western bro {whichBro}: " + e.ToString());
            }
        }
Ejemplo n.º 20
0
        // Token: 0x06004CAC RID: 19628 RVA: 0x001999F8 File Offset: 0x00197BF8
        private void DestroyCrystals(RuntimeGameActorEffectData effectData, bool playVfxExplosion = true)
        {
            if (effectData.vfxObjects == null || effectData.vfxObjects.Count == 0)
            {
                return;
            }
            Vector2   vector = Vector2.zero;
            GameActor actor  = effectData.actor;

            if (actor)
            {
                vector = ((!actor.specRigidbody) ? actor.sprite.WorldCenter : actor.specRigidbody.HitboxPixelCollider.UnitCenter);
            }
            else
            {
                int num = 0;
                for (int i = 0; i < effectData.vfxObjects.Count; i++)
                {
                    if (effectData.vfxObjects[i].First)
                    {
                        vector += effectData.vfxObjects[i].First.transform.position.XY();
                        num++;
                    }
                }
                if (num == 0)
                {
                    return;
                }
                vector /= (float)num;
            }
            if (playVfxExplosion && this.vfxExplosion)
            {
                GameObject gameObject = SpawnManager.SpawnVFX(this.vfxExplosion, vector, Quaternion.identity);
                tk2dSprite component  = gameObject.GetComponent <tk2dSprite>();
                if (actor && component)
                {
                    actor.sprite.AttachRenderer(component);
                    component.HeightOffGround = 0.1f;
                    component.UpdateZDepth();
                }
            }
            for (int j = 0; j < effectData.vfxObjects.Count; j++)
            {
                GameObject first = effectData.vfxObjects[j].First;
                if (first)
                {
                    first.transform.parent = SpawnManager.Instance.VFX;
                    DebrisObject orAddComponent = first.GetOrAddComponent <DebrisObject>();
                    if (actor)
                    {
                        actor.sprite.AttachRenderer(orAddComponent.sprite);
                    }
                    orAddComponent.sprite.IsPerpendicular = true;
                    orAddComponent.DontSetLayer           = true;
                    orAddComponent.gameObject.SetLayerRecursively(LayerMask.NameToLayer("FG_Critical"));
                    orAddComponent.angularVelocity         = Mathf.Sign(UnityEngine.Random.value - 0.5f) * 125f;
                    orAddComponent.angularVelocityVariance = 60f;
                    orAddComponent.decayOnBounce           = 0.5f;
                    orAddComponent.bounceCount             = 1;
                    orAddComponent.canRotate = true;
                    float num2 = effectData.vfxObjects[j].Second + UnityEngine.Random.Range(-this.debrisAngleVariance, this.debrisAngleVariance);
                    if (orAddComponent.name.Contains("tilt", true))
                    {
                        num2 += 45f;
                    }
                    Vector2 vector2        = BraveMathCollege.DegreesToVector(num2, 1f) * (float)UnityEngine.Random.Range(this.debrisMinForce, this.debrisMaxForce);
                    Vector3 startingForce  = new Vector3(vector2.x, (vector2.y >= 0f) ? 0f : vector2.y, (vector2.y <= 0f) ? 0f : vector2.y);
                    float   startingHeight = (!actor) ? 0.75f : (first.transform.position.y - actor.specRigidbody.HitboxPixelCollider.UnitBottom);
                    if (orAddComponent.minorBreakable)
                    {
                        orAddComponent.minorBreakable.enabled = true;
                    }
                    orAddComponent.Trigger(startingForce, startingHeight, 1f);
                }
            }
            effectData.vfxObjects.Clear();
        }
Ejemplo n.º 21
0
        private void HandleTossedBallGrounded(DebrisObject obj)
        {
            obj.OnGrounded -= this.HandleTossedBallGrounded;
            MonsterBall component = obj.GetComponent <MonsterBall>();
            // component.spriteAnimator.Play("monster_ball_open");
            float   distance        = -1f;
            float   nearestDistance = float.MaxValue;
            AIActor nearestEnemy    = null;

            try
            {
                List <AIActor> activeEnemies = obj.transform.position.GetAbsoluteRoom().GetActiveEnemies(RoomHandler.ActiveEnemyType.All);
                if (activeEnemies == null)
                {
                    goto SKIP;
                }
                for (int i = 0; i < activeEnemies.Count; i++)
                {
                    AIActor enemy = activeEnemies[i];
                    if (!enemy.IsMimicEnemy && enemy.healthHaver && !enemy.healthHaver.IsBoss && enemy.healthHaver.IsVulnerable)
                    {
                        if (!enemy.healthHaver.IsDead)
                        {
                            if (!BannedMonsterBallEnemies.Contains(enemy.EnemyGuid))
                            {
                                float num = Vector2.Distance(obj.sprite.WorldCenter, enemy.CenterPosition);
                                if (num < nearestDistance)
                                {
                                    nearestDistance = num;
                                    nearestEnemy    = enemy;
                                }
                            }
                        }
                    }
                }
SKIP:
                if (nearestEnemy == null)
                {
                    AIActor[] AllEnemiesOnFloor = FindObjectsOfType <AIActor>();
                    if (AllEnemiesOnFloor == null)
                    {
                        if (component.m_Debug)
                        {
                            ETGModConsole.Log("[Monster_Ball] No Enemies present on the floor?");
                        }
                    }
                    else
                    {
                        for (int i = 0; i < AllEnemiesOnFloor.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(AllEnemiesOnFloor[i].name))
                            {
                                if (AllEnemiesOnFloor[i].name.ToLower().Contains("companionpet"))
                                {
                                    nearestEnemy    = AllEnemiesOnFloor[i];
                                    nearestDistance = component.EnemySearchRadius;
                                }
                            }
                        }
                    }
                }
                if (component.m_Debug && nearestEnemy == null)
                {
                    ETGModConsole.Log("[Monster_Ball] activeEnemies is null.");
                }
                if (nearestEnemy && distance <= component.EnemySearchRadius)
                {
                    if (component.m_Debug)
                    {
                        ETGModConsole.Log("Monster_Ball: Attempting to capture: " + nearestEnemy.GetActorName());
                    }
                    component.m_containsEnemy   = true;
                    component.m_storedEnemyGuid = nearestEnemy.EnemyGuid;
                    component.m_wasBlackPhantom = nearestEnemy.IsBlackPhantom;
                    GameManager.Instance.StartCoroutine(SuckUpEnemy(nearestEnemy, obj, this.LastOwner));
                }
                else
                {
                    component.m_containsEnemy   = false;
                    component.m_storedEnemyGuid = string.Empty;
                    component.m_wasBlackPhantom = false;
                    if (component.m_Debug && nearestEnemy == null)
                    {
                        ETGModConsole.Log("[Monster_Ball] No enemies in room!");
                    }
                    else if (component.m_Debug && nearestEnemy != null && distance > component.EnemySearchRadius)
                    {
                        ETGModConsole.Log("[Monster_Ball] No enemy in range!");
                    }
                    return;
                }
            }
            catch (Exception)
            {
                if (component.m_Debug)
                {
                    ETGModConsole.Log("[Monster Ball] Exception in HandleTossedBallGrounded!");
                }
                component.m_containsEnemy   = false;
                component.m_storedEnemyGuid = string.Empty;
                component.m_wasBlackPhantom = false;
            }
        }
Ejemplo n.º 22
0
        public static void CurseRoomRewardMethod(Action <RoomHandler> orig, RoomHandler self)
        {
            bool harderlotj = JammedSquire.NoHarderLotJ;

            if (harderlotj)
            {
                orig(self);
            }
            else
            {
                orig(self);
                FloorRewardData         currentRewardData = GameManager.Instance.RewardManager.CurrentRewardData;
                LootEngine.AmmoDropType ammoDropType      = LootEngine.AmmoDropType.DEFAULT_AMMO;
                bool   flag  = LootEngine.DoAmmoClipCheck(currentRewardData, out ammoDropType);
                string path  = (ammoDropType != LootEngine.AmmoDropType.SPREAD_AMMO) ? "Ammo_Pickup" : "Ammo_Pickup_Spread";
                float  value = UnityEngine.Random.value;
                float  num   = currentRewardData.ChestSystem_ChestChanceLowerBound;
                //float num2 = GameManager.Instance.PrimaryPlayer.stats.GetStatValue(PlayerStats.StatType.Coolness) / 100f;
                float num3 = (GameManager.Instance.PrimaryPlayer.stats.GetStatValue(PlayerStats.StatType.Curse) / 250f);
                if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER)
                {
                    num3 += GameManager.Instance.SecondaryPlayer.stats.GetStatValue(PlayerStats.StatType.Curse) / 250f;
                }
                if (PassiveItem.IsFlagSetAtAll(typeof(ChamberOfEvilItem)))
                {
                    num3 *= 1.25f;
                }
                num = Mathf.Clamp(num + GameManager.Instance.PrimaryPlayer.AdditionalChestSpawnChance, currentRewardData.ChestSystem_ChestChanceLowerBound, currentRewardData.ChestSystem_ChestChanceUpperBound) + num3;
                bool  flag2 = currentRewardData.SingleItemRewardTable != null;
                bool  flag3 = false;
                float num4  = 0.1f;
                if (!RoomHandler.HasGivenRoomChestRewardThisRun && MetaInjectionData.ForceEarlyChest)
                {
                    flag3 = true;
                }
                if (flag3)
                {
                    if (!RoomHandler.HasGivenRoomChestRewardThisRun && (GameManager.Instance.CurrentFloor == 1 || GameManager.Instance.CurrentFloor == -1))
                    {
                        flag2 = false;
                        num  += num4;
                        if (GameManager.Instance.PrimaryPlayer && GameManager.Instance.PrimaryPlayer.NumRoomsCleared > 4)
                        {
                            num = 1f;
                        }
                    }
                    if (!RoomHandler.HasGivenRoomChestRewardThisRun && self.distanceFromEntrance < RoomHandler.NumberOfRoomsToPreventChestSpawning)
                    {
                        GameManager.Instance.Dungeon.InformRoomCleared(false, false);
                        return;
                    }
                }
                BraveUtility.Log("Current chest spawn chance: " + num, Color.yellow, BraveUtility.LogVerbosity.IMPORTANT);
                if (value > num)
                {
                    if (flag)
                    {
                        IntVector2 bestRewardLocation = self.GetBestRewardLocation(new IntVector2(1, 1), RoomHandler.RewardLocationStyle.CameraCenter, true);
                        LootEngine.SpawnItem((GameObject)BraveResources.Load(path, ".prefab"), bestRewardLocation.ToVector3(), Vector2.up, 1f, true, true, false);
                    }
                    GameManager.Instance.Dungeon.InformRoomCleared(false, false);
                    return;
                }
                if (flag2)
                {
                    float num5 = currentRewardData.PercentOfRoomClearRewardsThatAreChests;
                    if (PassiveItem.IsFlagSetAtAll(typeof(AmazingChestAheadItem)))
                    {
                        num5 *= 2f;
                        num5  = Mathf.Max(0.5f, num5);
                    }
                    flag2 = (UnityEngine.Random.value > num5);
                }
                if (flag2)
                {
                    float      num6 = (GameManager.Instance.CurrentGameType != GameManager.GameType.COOP_2_PLAYER) ? GameManager.Instance.RewardManager.SinglePlayerPickupIncrementModifier : GameManager.Instance.RewardManager.CoopPickupIncrementModifier;
                    GameObject gameObject;
                    if (UnityEngine.Random.value < 1f / num6)
                    {
                        gameObject = currentRewardData.SingleItemRewardTable.SelectByWeight(false);
                    }
                    else
                    {
                        gameObject = ((UnityEngine.Random.value >= 0.9f) ? GameManager.Instance.RewardManager.FullHeartPrefab.gameObject : GameManager.Instance.RewardManager.HalfHeartPrefab.gameObject);
                    }
                    UnityEngine.Debug.Log(gameObject.name + "SPAWNED");
                    DebrisObject debrisObject = LootEngine.SpawnItem(gameObject, self.GetBestRewardLocation(new IntVector2(1, 1), RoomHandler.RewardLocationStyle.CameraCenter, true).ToVector3() + new Vector3(0.25f, 0f, 0f), Vector2.up, 1f, true, true, false);
                    Exploder.DoRadialPush(debrisObject.sprite.WorldCenter.ToVector3ZUp(debrisObject.sprite.WorldCenter.y), 8f, 3f);
                    AkSoundEngine.PostEvent("Play_OBJ_item_spawn_01", debrisObject.gameObject);
                    GameManager.Instance.Dungeon.InformRoomCleared(true, false);
                }
                else
                {
                    IntVector2 bestRewardLocation = self.GetBestRewardLocation(new IntVector2(2, 1), RoomHandler.RewardLocationStyle.CameraCenter, true);
                    bool       isRainbowRun       = GameStatsManager.Instance.IsRainbowRun;
                    if (isRainbowRun)
                    {
                        LootEngine.SpawnBowlerNote(GameManager.Instance.RewardManager.BowlerNoteChest, bestRewardLocation.ToCenterVector2(), self, true);
                        RoomHandler.HasGivenRoomChestRewardThisRun = true;
                    }
                    else
                    {
                        Chest exists = self.SpawnRoomRewardChest(null, bestRewardLocation);
                        if (exists)
                        {
                            RoomHandler.HasGivenRoomChestRewardThisRun = true;
                        }
                    }
                    GameManager.Instance.Dungeon.InformRoomCleared(true, true);
                }
                if (flag)
                {
                    IntVector2 bestRewardLocation = self.GetBestRewardLocation(new IntVector2(1, 1), RoomHandler.RewardLocationStyle.CameraCenter, true);
                    LootEngine.DelayedSpawnItem(1f, (GameObject)BraveResources.Load(path, ".prefab"), bestRewardLocation.ToVector3() + new Vector3(0.25f, 0f, 0f), Vector2.up, 1f, true, true, false);
                }
            }
        }
Ejemplo n.º 23
0
        public void KillDropWeirdActive(PlayerItem item)
        {
            DebrisObject debrisObject = LastOwner.DropActiveItem(item);

            UnityEngine.Object.Destroy(debrisObject.gameObject, 0.01f);
        }
Ejemplo n.º 24
0
        // Token: 0x060004FC RID: 1276 RVA: 0x0002A77C File Offset: 0x0002897C
        public DebrisObject Drop(PlayerController player)
        {
            DebrisObject result = base.Drop(player, 4f);

            return(result);
        }
        /// <summary>
        /// Container Class for all the properties for organization.
        /// </summary>
        /// <param name="c"></param>
        public TorqueScriptTemplate(ref dnTorque c)
            {
            m_ts = c;
            _mConsoleobject = new ConsoleObject(ref c);
            _mMathobject = new tMath(ref c);
            	_mUtil = new UtilObject(ref c);
	_mHTTPObject = new HTTPObjectObject(ref c);
	_mTCPObject = new TCPObjectObject(ref c);
	_mDynamicConsoleMethodComponent = new DynamicConsoleMethodComponentObject(ref c);
	_mSimComponent = new SimComponentObject(ref c);
	_mArrayObject = new ArrayObjectObject(ref c);
	_mConsoleLogger = new ConsoleLoggerObject(ref c);
	_mFieldBrushObject = new FieldBrushObjectObject(ref c);
	_mPersistenceManager = new PersistenceManagerObject(ref c);
	_mSimDataBlock = new SimDataBlockObject(ref c);
	_mSimObject = new SimObjectObject(ref c);
	_mSimPersistSet = new SimPersistSetObject(ref c);
	_mSimSet = new SimSetObject(ref c);
	_mSimXMLDocument = new SimXMLDocumentObject(ref c);
	_mFileObject = new FileObjectObject(ref c);
	_mFileStreamObject = new FileStreamObjectObject(ref c);
	_mStreamObject = new StreamObjectObject(ref c);
	_mZipObject = new ZipObjectObject(ref c);
	_mDecalRoad = new DecalRoadObject(ref c);
	_mMeshRoad = new MeshRoadObject(ref c);
	_mRiver = new RiverObject(ref c);
	_mScatterSky = new ScatterSkyObject(ref c);
	_mSkyBox = new SkyBoxObject(ref c);
	_mSun = new SunObject(ref c);
	_mGuiRoadEditorCtrl = new GuiRoadEditorCtrlObject(ref c);
	_mForest = new ForestObject(ref c);
	_mForestWindEmitter = new ForestWindEmitterObject(ref c);
	_mForestBrush = new ForestBrushObject(ref c);
	_mForestBrushTool = new ForestBrushToolObject(ref c);
	_mForestEditorCtrl = new ForestEditorCtrlObject(ref c);
	_mForestSelectionTool = new ForestSelectionToolObject(ref c);
	_mCubemapData = new CubemapDataObject(ref c);
	_mDebugDrawer = new DebugDrawerObject(ref c);
	_mGuiTSCtrl = new GuiTSCtrlObject(ref c);
	_mGuiBitmapButtonCtrl = new GuiBitmapButtonCtrlObject(ref c);
	_mGuiButtonBaseCtrl = new GuiButtonBaseCtrlObject(ref c);
	_mGuiCheckBoxCtrl = new GuiCheckBoxCtrlObject(ref c);
	_mGuiIconButtonCtrl = new GuiIconButtonCtrlObject(ref c);
	_mGuiSwatchButtonCtrl = new GuiSwatchButtonCtrlObject(ref c);
	_mGuiToolboxButtonCtrl = new GuiToolboxButtonCtrlObject(ref c);
	_mGuiAutoScrollCtrl = new GuiAutoScrollCtrlObject(ref c);
	_mGuiDynamicCtrlArrayControl = new GuiDynamicCtrlArrayControlObject(ref c);
	_mGuiFormCtrl = new GuiFormCtrlObject(ref c);
	_mGuiFrameSetCtrl = new GuiFrameSetCtrlObject(ref c);
	_mGuiPaneControl = new GuiPaneControlObject(ref c);
	_mGuiRolloutCtrl = new GuiRolloutCtrlObject(ref c);
	_mGuiScrollCtrl = new GuiScrollCtrlObject(ref c);
	_mGuiStackControl = new GuiStackControlObject(ref c);
	_mGuiTabBookCtrl = new GuiTabBookCtrlObject(ref c);
	_mGuiBitmapCtrl = new GuiBitmapCtrlObject(ref c);
	_mGuiColorPickerCtrl = new GuiColorPickerCtrlObject(ref c);
	_mGuiDirectoryFileListCtrl = new GuiDirectoryFileListCtrlObject(ref c);
	_mGuiFileTreeCtrl = new GuiFileTreeCtrlObject(ref c);
	_mGuiGameListMenuCtrl = new GuiGameListMenuCtrlObject(ref c);
	_mGuiGameListOptionsCtrl = new GuiGameListOptionsCtrlObject(ref c);
	_mGuiGradientCtrl = new GuiGradientCtrlObject(ref c);
	_mGuiListBoxCtrl = new GuiListBoxCtrlObject(ref c);
	_mGuiMaterialCtrl = new GuiMaterialCtrlObject(ref c);
	_mGuiMLTextCtrl = new GuiMLTextCtrlObject(ref c);
	_mGuiPopUpMenuCtrl = new GuiPopUpMenuCtrlObject(ref c);
	_mGuiPopUpMenuCtrlEx = new GuiPopUpMenuCtrlExObject(ref c);
	_mGuiSliderCtrl = new GuiSliderCtrlObject(ref c);
	_mGuiTabPageCtrl = new GuiTabPageCtrlObject(ref c);
	_mGuiTextCtrl = new GuiTextCtrlObject(ref c);
	_mGuiTextEditCtrl = new GuiTextEditCtrlObject(ref c);
	_mGuiTextListCtrl = new GuiTextListCtrlObject(ref c);
	_mGuiTreeViewCtrl = new GuiTreeViewCtrlObject(ref c);
	_mGuiCanvas = new GuiCanvasObject(ref c);
	_mGuiControl = new GuiControlObject(ref c);
	_mGuiControlProfile = new GuiControlProfileObject(ref c);
	_mDbgFileView = new DbgFileViewObject(ref c);
	_mGuiEditCtrl = new GuiEditCtrlObject(ref c);
	_mGuiFilterCtrl = new GuiFilterCtrlObject(ref c);
	_mGuiGraphCtrl = new GuiGraphCtrlObject(ref c);
	_mGuiImageList = new GuiImageListObject(ref c);
	_mGuiInspector = new GuiInspectorObject(ref c);
	_mGuiInspectorTypeFileName = new GuiInspectorTypeFileNameObject(ref c);
	_mGuiInspectorTypeBitMask32 = new GuiInspectorTypeBitMask32Object(ref c);
	_mGuiMenuBar = new GuiMenuBarObject(ref c);
	_mGuiParticleGraphCtrl = new GuiParticleGraphCtrlObject(ref c);
	_mGuiShapeEdPreview = new GuiShapeEdPreviewObject(ref c);
	_mGuiInspectorDynamicField = new GuiInspectorDynamicFieldObject(ref c);
	_mGuiInspectorDynamicGroup = new GuiInspectorDynamicGroupObject(ref c);
	_mGuiInspectorField = new GuiInspectorFieldObject(ref c);
	_mGuiVariableInspector = new GuiVariableInspectorObject(ref c);
	_mGuiMessageVectorCtrl = new GuiMessageVectorCtrlObject(ref c);
	_mGuiProgressBitmapCtrl = new GuiProgressBitmapCtrlObject(ref c);
	_mGuiTickCtrl = new GuiTickCtrlObject(ref c);
	_mGuiTheoraCtrl = new GuiTheoraCtrlObject(ref c);
	_mMessageVector = new MessageVectorObject(ref c);
	_mEditTSCtrl = new EditTSCtrlObject(ref c);
	_mGuiMissionAreaCtrl = new GuiMissionAreaCtrlObject(ref c);
	_mMECreateUndoAction = new MECreateUndoActionObject(ref c);
	_mMEDeleteUndoAction = new MEDeleteUndoActionObject(ref c);
	_mWorldEditor = new WorldEditorObject(ref c);
	_mLangTable = new LangTableObject(ref c);
	_mPathedInterior = new PathedInteriorObject(ref c);
	_mMaterial = new MaterialObject(ref c);
	_mSimResponseCurve = new SimResponseCurveObject(ref c);
	_mMenuBar = new MenuBarObject(ref c);
	_mPopupMenu = new PopupMenuObject(ref c);
	_mFileDialog = new FileDialogObject(ref c);
	_mPostEffect = new PostEffectObject(ref c);
	_mRenderBinManager = new RenderBinManagerObject(ref c);
	_mRenderPassManager = new RenderPassManagerObject(ref c);
	_mRenderPassStateToken = new RenderPassStateTokenObject(ref c);
	_mSceneObject = new SceneObjectObject(ref c);
	_mSFXController = new SFXControllerObject(ref c);
	_mSFXParameter = new SFXParameterObject(ref c);
	_mSFXProfile = new SFXProfileObject(ref c);
	_mSFXSource = new SFXSourceObject(ref c);
	_mActionMap = new ActionMapObject(ref c);
	_mNetConnection = new NetConnectionObject(ref c);
	_mNetObject = new NetObjectObject(ref c);
	_mAIClient = new AIClientObject(ref c);
	_mAIConnection = new AIConnectionObject(ref c);
	_mAIPlayer = new AIPlayerObject(ref c);
	_mCamera = new CameraObject(ref c);
	_mDebris = new DebrisObject(ref c);
	_mGroundPlane = new GroundPlaneObject(ref c);
	_mGuiMaterialPreview = new GuiMaterialPreviewObject(ref c);
	_mGuiObjectView = new GuiObjectViewObject(ref c);
	_mItem = new ItemObject(ref c);
	_mLightBase = new LightBaseObject(ref c);
	_mLightDescription = new LightDescriptionObject(ref c);
	_mLightFlareData = new LightFlareDataObject(ref c);
	_mMissionArea = new MissionAreaObject(ref c);
	_mSpawnSphere = new SpawnSphereObject(ref c);
	_mPathCamera = new PathCameraObject(ref c);
	_mPhysicalZone = new PhysicalZoneObject(ref c);
	_mPlayer = new PlayerObject(ref c);
	_mPortal = new PortalObject(ref c);
	_mProjectile = new ProjectileObject(ref c);
	_mProximityMine = new ProximityMineObject(ref c);
	_mShapeBaseData = new ShapeBaseDataObject(ref c);
	_mShapeBase = new ShapeBaseObject(ref c);
	_mStaticShape = new StaticShapeObject(ref c);
	_mTrigger = new TriggerObject(ref c);
	_mTSStatic = new TSStaticObject(ref c);
	_mZone = new ZoneObject(ref c);
	_mRenderMeshExample = new RenderMeshExampleObject(ref c);
	_mLightning = new LightningObject(ref c);
	_mParticleData = new ParticleDataObject(ref c);
	_mParticleEmitterData = new ParticleEmitterDataObject(ref c);
	_mParticleEmitterNode = new ParticleEmitterNodeObject(ref c);
	_mPrecipitation = new PrecipitationObject(ref c);
	_mGameBase = new GameBaseObject(ref c);
	_mGameConnection = new GameConnectionObject(ref c);
	_mPhysicsDebrisData = new PhysicsDebrisDataObject(ref c);
	_mPhysicsForce = new PhysicsForceObject(ref c);
	_mPhysicsShape = new PhysicsShapeObject(ref c);
	_mAITurretShape = new AITurretShapeObject(ref c);
	_mTurretShape = new TurretShapeObject(ref c);
	_mFlyingVehicle = new FlyingVehicleObject(ref c);
	_mWheeledVehicle = new WheeledVehicleObject(ref c);
	_mTerrainBlock = new TerrainBlockObject(ref c);
	_mSettings = new SettingsObject(ref c);
	_mCompoundUndoAction = new CompoundUndoActionObject(ref c);
	_mUndoManager = new UndoManagerObject(ref c);
	_mUndoAction = new UndoActionObject(ref c);
	_mEventManager = new EventManagerObject(ref c);
	_mMessage = new MessageObject(ref c);
}
Ejemplo n.º 26
0
 public static void OnPostOpenBullshit(Action <Chest, List <Transform> > orig, Chest self, List <Transform> transrights)
 {
     try
     {
         List <DebrisObject> list = new List <DebrisObject>();
         bool      isRainbowRun   = GameStatsManager.Instance.IsRainbowRun;
         Type      chesttype      = typeof(Chest);
         FieldInfo _forceDropOkayForRainbowRun = chesttype.GetField("m_forceDropOkayForRainbowRun", BindingFlags.NonPublic | BindingFlags.Instance);
         if (isRainbowRun && !self.IsRainbowChest && !(bool)_forceDropOkayForRainbowRun.GetValue(self))
         {
             Vector2 a;
             if (self.spawnTransform != null)
             {
                 a = self.spawnTransform.position;
             }
             else
             {
                 Bounds bounds = self.sprite.GetBounds();
                 a = self.transform.position + bounds.extents;
             }
             FieldInfo _room = chesttype.GetField("m_room", BindingFlags.NonPublic | BindingFlags.Instance);
             LootEngine.SpawnBowlerNote(GameManager.Instance.RewardManager.BowlerNoteChest, a + new Vector2(-0.5f, -2.25f), (RoomHandler)_room.GetValue(self), true);
         }
         else
         {
             for (int i = 0; i < self.contents.Count; i++)
             {
                 List <DebrisObject> list2 = LootEngine.SpewLoot(new List <GameObject>
                 {
                     self.contents[i].gameObject
                 }, transrights[i].position);
                 list.AddRange(list2);
                 for (int j = 0; j < list2.Count; j++)
                 {
                     if (list2[j])
                     {
                         list2[j].PreventFallingInPits = true;
                     }
                     if (!(list2[j].GetComponent <Gun>() != null))
                     {
                         if (!(list2[j].GetComponent <CurrencyPickup>() != null))
                         {
                             if (list2[j].specRigidbody != null)
                             {
                                 list2[j].specRigidbody.CollideWithOthers = false;
                                 DebrisObject debrisObject      = list2[j];
                                 MethodInfo   _BecomeViableItem = chesttype.GetMethod("BecomeViableItem", BindingFlags.NonPublic | BindingFlags.Instance);
                                 debrisObject.OnTouchedGround += (Action <DebrisObject>)_BecomeViableItem.Invoke(self, new object[] { debrisObject });
                             }
                         }
                     }
                 }
             }
         }
         if (self.IsRainbowChest && isRainbowRun && self.transform.position.GetAbsoluteRoom() == GameManager.Instance.Dungeon.data.Entrance)
         {
             MethodInfo _HandleRainbowRunLootProcessing = chesttype.GetMethod("HandleRainbowRunLootProcessing", BindingFlags.NonPublic | BindingFlags.Instance);
             GameManager.Instance.Dungeon.StartCoroutine((IEnumerator)_HandleRainbowRunLootProcessing.Invoke(self, new object[] { list }));
         }
         if (god.ContainsKey(self))
         {
             List <Tuple <int, int> > choices = god[self];
             foreach (Tuple <int, int> choice in choices)
             {
                 DebrisObject firstItem  = GetItemFromListByID(list, choice.First);
                 DebrisObject secondItem = GetItemFromListByID(list, choice.Second);
                 if (firstItem && secondItem)
                 {
                     GameManager.Instance.Dungeon.StartCoroutine(ItemChoiceCoroutine(firstItem, secondItem));
                 }
             }
         }
     }
     catch (Exception error)
     {
         ETGModConsole.Log(error.ToString());
     }
 }
Ejemplo n.º 27
0
 private void OnBounced(DebrisObject obj)
 {
 }
Ejemplo n.º 28
0
        public void KillDropWeirdItem(PassiveItem item)
        {
            DebrisObject debrisObject = LastOwner.DropPassiveItem(item);

            UnityEngine.Object.Destroy(debrisObject.gameObject, 0.01f);
        }
        public void PlaceCorruptTiles(Dungeon dungeon, RoomHandler roomHandler = null, GameObject parentObject = null, bool corruptWallsOnly = false, bool isLeadKeyRoom = false)
        {
            bool m_CorruptedSecretRoomsPresent = false;

            if (roomHandler == null)
            {
                foreach (RoomHandler room in dungeon.data.rooms)
                {
                    if (room.GetRoomName() != null)
                    {
                        if (room.GetRoomName().ToLower().StartsWith("expand apache corrupted secret"))
                        {
                            m_CorruptedSecretRoomsPresent = true;
                            break;
                        }
                    }
                }
            }

            if (roomHandler == null && dungeon.IsGlitchDungeon)
            {
                if (StaticReferenceManager.AllNpcs != null && StaticReferenceManager.AllNpcs.Count > 0)
                {
                    foreach (TalkDoerLite npc in StaticReferenceManager.AllNpcs)
                    {
                        npc.SpeaksGleepGlorpenese = true;
                    }
                }
            }
            else if (roomHandler != null && StaticReferenceManager.AllNpcs != null && StaticReferenceManager.AllNpcs.Count > 0)
            {
                foreach (TalkDoerLite npc in StaticReferenceManager.AllNpcs)
                {
                    if (npc.GetAbsoluteParentRoom() == roomHandler)
                    {
                        npc.SpeaksGleepGlorpenese = true;
                        if (npc.GetAbsoluteParentRoom() != null && !string.IsNullOrEmpty(npc.GetAbsoluteParentRoom().GetRoomName()))
                        {
                            if (npc.GetAbsoluteParentRoom().GetRoomName().ToLower().StartsWith("expand apache corrupted secret"))
                            {
                                ExpandShaders.Instance.ApplyGlitchShader(npc.GetComponent <tk2dBaseSprite>());
                            }
                        }
                    }
                }
            }

            if (!dungeon.IsGlitchDungeon && roomHandler == null && !m_CorruptedSecretRoomsPresent)
            {
                return;
            }

            if (dungeon.IsGlitchDungeon | roomHandler != null)
            {
                m_CorruptedSecretRoomsPresent = false;
            }

            tk2dSpriteCollectionData dungeonCollection = dungeon.tileIndices.dungeonCollection;

            // Used for debug read out information
            int CorruptWallTilesPlaced     = 0;
            int CorruptOpenAreaTilesPlaced = 0;
            int iterations = 0;

            GameObject GlitchedTileObject = new GameObject("GlitchTile_" + UnityEngine.Random.Range(1000000, 9999999))
            {
                layer = 22
            };

            if (parentObject != null)
            {
                GlitchedTileObject.transform.parent = parentObject.transform;
            }
            GlitchedTileObject.AddComponent <tk2dSprite>();
            tk2dSprite glitchSprite = GlitchedTileObject.GetComponent <tk2dSprite>();

            glitchSprite.Collection = dungeonCollection;
            glitchSprite.SetSprite(glitchSprite.Collection, 22);
            glitchSprite.ignoresTiltworldDepth      = false;
            glitchSprite.depthUsesTrimmedBounds     = false;
            glitchSprite.allowDefaultLayer          = false;
            glitchSprite.OverrideMaterialMode       = tk2dBaseSprite.SpriteMaterialOverrideMode.NONE;
            glitchSprite.independentOrientation     = false;
            glitchSprite.hasOffScreenCachedUpdate   = false;
            glitchSprite.CachedPerpState            = tk2dBaseSprite.PerpendicularState.PERPENDICULAR;
            glitchSprite.SortingOrder               = 2;
            glitchSprite.IsBraveOutlineSprite       = false;
            glitchSprite.IsZDepthDirty              = false;
            glitchSprite.ApplyEmissivePropertyBlock = false;
            glitchSprite.GenerateUV2       = false;
            glitchSprite.LockUV2OnFrameOne = false;
            glitchSprite.StaticPositions   = false;

            List <int> CurrentFloorWallIDs  = new List <int>();
            List <int> CurrentFloorFloorIDs = new List <int>();
            List <int> CurrentFloorMiscIDs  = new List <int>();

            // Select Sprite ID lists based on tileset. (IDs corrispond to different sprites depending on tileset dungeonCollection)
            if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CASTLEGEON)
            {
                CurrentFloorWallIDs  = ExpandLists.CastleWallIDs;
                CurrentFloorFloorIDs = ExpandLists.CastleFloorIDs;
                CurrentFloorMiscIDs  = ExpandLists.CastleMiscIDs;
            }
            else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.GUNGEON)
            {
                CurrentFloorWallIDs  = ExpandLists.GungeonWallIDs;
                CurrentFloorFloorIDs = ExpandLists.GungeonFloorIDs;
                CurrentFloorMiscIDs  = ExpandLists.GungeonMiscIDs;
            }
            else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.MINEGEON)
            {
                CurrentFloorWallIDs  = ExpandLists.MinesWallIDs;
                CurrentFloorFloorIDs = ExpandLists.MinesFloorIDs;
                CurrentFloorMiscIDs  = ExpandLists.MinesMiscIDs;
            }
            else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CATACOMBGEON)
            {
                CurrentFloorWallIDs  = ExpandLists.HollowsWallIDs;
                CurrentFloorFloorIDs = ExpandLists.HollowsFloorIDs;
                CurrentFloorMiscIDs  = ExpandLists.HollowsMiscIDs;
            }
            else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.FORGEGEON)
            {
                CurrentFloorWallIDs  = ExpandLists.ForgeWallIDs;
                CurrentFloorFloorIDs = ExpandLists.ForgeFloorIDs;
                CurrentFloorMiscIDs  = ExpandLists.ForgeMiscIDs;
            }
            else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.HELLGEON)
            {
                CurrentFloorWallIDs  = ExpandLists.BulletHell_WallIDs;
                CurrentFloorFloorIDs = ExpandLists.BulletHell_FloorIDs;
                CurrentFloorMiscIDs  = ExpandLists.BulletHell_MiscIDs;
            }
            else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.SEWERGEON)
            {
                CurrentFloorWallIDs  = ExpandLists.SewerWallIDs;
                CurrentFloorFloorIDs = ExpandLists.SewerFloorIDs;
                CurrentFloorMiscIDs  = ExpandLists.SewerMiscIDs;
            }
            else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CATHEDRALGEON)
            {
                CurrentFloorWallIDs  = ExpandLists.AbbeyWallIDs;
                CurrentFloorFloorIDs = ExpandLists.AbbeyFloorIDs;
                CurrentFloorMiscIDs  = ExpandLists.AbbeyMiscIDs;
            }
            else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.RATGEON | dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.JUNGLEGEON)
            {
                CurrentFloorWallIDs  = ExpandLists.RatDenWallIDs;
                CurrentFloorFloorIDs = ExpandLists.RatDenFloorIDs;
                CurrentFloorMiscIDs  = ExpandLists.RatDenMiscIDs;
            }
            else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.OFFICEGEON)
            {
                foreach (int id in ExpandLists.Nakatomi_OfficeWallIDs)
                {
                    CurrentFloorWallIDs.Add(id);
                }
                foreach (int id in ExpandLists.Nakatomi_OfficeFloorIDs)
                {
                    CurrentFloorFloorIDs.Add(id);
                }
                foreach (int id in ExpandLists.Nakatomi_OfficeMiscIDs)
                {
                    CurrentFloorMiscIDs.Add(id);
                }
                // This floor stores both Office and Future tilesets it uses into the same sprite collection atlas.
                // Each section has a specific size and and the ID of the last tileset will be subtracted from entries from the next.
                // Office tileset IDs end at id 703
                // Future tileset IDs start at id 704
                // Future tileset IDs have 704 added to them to get the correct ID in the main sprite collection.
                foreach (int id in ExpandLists.Nakatomi_FutureWallIDs)
                {
                    CurrentFloorWallIDs.Add(id + 704);
                }
                foreach (int id in ExpandLists.Nakatomi_FutureFloorIDs)
                {
                    CurrentFloorFloorIDs.Add(id + 704);
                }
                foreach (int id in ExpandLists.Nakatomi_FutureMiscIDs)
                {
                    CurrentFloorMiscIDs.Add(id + 704);
                }
            }
            else
            {
                // Unkown Tilesets will use Gungeon as placeholder
                Dungeon tempDungeonPrefab = DungeonDatabase.GetOrLoadByName("Base_Gungeon");
                dungeonCollection    = tempDungeonPrefab.tileIndices.dungeonCollection;
                CurrentFloorWallIDs  = ExpandLists.GungeonWallIDs;
                CurrentFloorFloorIDs = ExpandLists.GungeonFloorIDs;
                CurrentFloorMiscIDs  = ExpandLists.GungeonMiscIDs;
                tempDungeonPrefab    = null;
            }

            List <int> roomList = Enumerable.Range(0, dungeon.data.rooms.Count).ToList();

            roomList = roomList.Shuffle();

            if (roomHandler != null)
            {
                roomList = new List <int>()
                {
                    0
                };
            }

            List <IntVector2> cachedWallTiles = new List <IntVector2>();
            List <IntVector2> validWalls      = new List <IntVector2>();
            List <IntVector2> validOpenAreas  = new List <IntVector2>();

            RoomHandler RoomBeingWorkedOn = null;

            while (iterations < roomList.Count)
            {
                try {
                    RoomHandler currentRoom = null;

                    if (roomHandler == null)
                    {
                        currentRoom = dungeon.data.rooms[roomList[iterations]];
                    }
                    else
                    {
                        currentRoom = roomHandler;
                    }

                    if (currentRoom == null)
                    {
                        break;
                    }

                    RoomBeingWorkedOn = currentRoom;

                    if (string.IsNullOrEmpty(currentRoom.GetRoomName()))
                    {
                        currentRoom.area.PrototypeRoomName = ("ProceduralRoom_" + UnityEngine.Random.Range(100000, 999999));
                    }

                    if (!m_CorruptedSecretRoomsPresent || (currentRoom.GetRoomName().ToLower().StartsWith("expand apache corrupted secret") | dungeon.IsGlitchDungeon | roomHandler != null))
                    {
                        bool isCorruptedSecretRoom = false;

                        if (currentRoom.GetRoomName().ToLower().StartsWith("expand apache corrupted secret") && !isLeadKeyRoom)
                        {
                            GameObject m_CorruptionMarkerObject = new GameObject("CorruptionAmbienceMarkerObject")
                            {
                                layer = 0
                            };
                            m_CorruptionMarkerObject.transform.position = currentRoom.area.Center;
                            m_CorruptionMarkerObject.transform.parent   = currentRoom.hierarchyParent;
                            ExpandStaticReferenceManager.AllCorruptionSoundObjects.Add(m_CorruptionMarkerObject);
                            isCorruptedSecretRoom = true;
                        }

                        if (m_CorruptedSecretRoomsPresent | isLeadKeyRoom)
                        {
                            foreach (TalkDoerLite npc in StaticReferenceManager.AllNpcs)
                            {
                                if (npc.GetAbsoluteParentRoom() != null && npc.GetAbsoluteParentRoom() == currentRoom)
                                {
                                    npc.SpeaksGleepGlorpenese = true;
                                    ExpandShaders.Instance.ApplyGlitchShader(npc.GetComponent <tk2dBaseSprite>());
                                }
                            }
                        }

                        validWalls.Clear();
                        validOpenAreas.Clear();

                        for (int Width = -1; Width <= currentRoom.area.dimensions.x + 3; Width++)
                        {
                            for (int Height = -1; Height <= currentRoom.area.dimensions.y + 3; Height++)
                            {
                                int X = currentRoom.area.basePosition.x + Width;
                                int Y = currentRoom.area.basePosition.y + Height;
                                if (!cachedWallTiles.Contains(new IntVector2(X, Y)) && (
                                        dungeon.data.isWall(X, Y) | dungeon.data.isAnyFaceWall(X, Y) | dungeon.data.isWall(X, Y - 1))
                                    )
                                {
                                    validWalls.Add(new IntVector2(X, Y));
                                }
                            }
                        }

                        int WallCorruptionIntensity = (validWalls.Count / UnityEngine.Random.Range(2, 4));
                        if (roomHandler == null && !isCorruptedSecretRoom && UnityEngine.Random.value <= 0.1f)
                        {
                            WallCorruptionIntensity = 0;
                        }

                        if (WallCorruptionIntensity > 0)
                        {
                            for (int C = 0; C < WallCorruptionIntensity; C++)
                            {
                                if (validWalls.Count > 0)
                                {
                                    IntVector2 WallPosition = BraveUtility.RandomElement(validWalls);
                                    cachedWallTiles.Add(WallPosition);

                                    float RandomIntervalFloat       = UnityEngine.Random.Range(0.02f, 0.06f);
                                    float RandomDispFloat           = UnityEngine.Random.Range(0.07f, 0.09f);
                                    float RandomDispIntensityFloat  = UnityEngine.Random.Range(0.085f, 0.2f);
                                    float RandomColorProbFloat      = UnityEngine.Random.Range(0.04f, 0.15f);
                                    float RandomColorIntensityFloat = UnityEngine.Random.Range(0.08f, 0.14f);

                                    GameObject m_GlitchTile = Instantiate(GlitchedTileObject, (WallPosition.ToVector2()), Quaternion.identity);
                                    m_GlitchTile.name += ("_" + UnityEngine.Random.Range(100000, 999999).ToString());
                                    m_GlitchTile.layer = 22;
                                    if (parentObject != null)
                                    {
                                        m_GlitchTile.transform.parent = parentObject.transform;
                                    }
                                    else
                                    {
                                        m_GlitchTile.transform.parent = currentRoom.hierarchyParent;
                                    }

                                    tk2dSprite m_GlitchSprite = m_GlitchTile.GetComponent <tk2dSprite>();

                                    int        TileType  = UnityEngine.Random.Range(1, 3);
                                    List <int> spriteIDs = new List <int>();
                                    if (TileType == 1)
                                    {
                                        spriteIDs = CurrentFloorWallIDs;
                                    }
                                    if (TileType == 2)
                                    {
                                        spriteIDs = CurrentFloorFloorIDs;
                                    }
                                    if (TileType == 3)
                                    {
                                        spriteIDs = CurrentFloorMiscIDs;
                                    }

                                    m_GlitchSprite.SetSprite(BraveUtility.RandomElement(spriteIDs));

                                    if (dungeon.data.isFaceWallLower(WallPosition.x, WallPosition.y) && !dungeon.data.isWall(WallPosition.x, WallPosition.y - 1))
                                    {
                                        DepthLookupManager.ProcessRenderer(m_GlitchSprite.renderer, DepthLookupManager.GungeonSortingLayer.BACKGROUND);
                                        m_GlitchSprite.IsPerpendicular = false;
                                        m_GlitchSprite.HeightOffGround = 0;
                                        m_GlitchSprite.UpdateZDepth();
                                    }
                                    else
                                    {
                                        m_GlitchSprite.HeightOffGround = 3;
                                        m_GlitchSprite.UpdateZDepth();
                                        m_GlitchTile.SetLayerRecursively(LayerMask.NameToLayer("FG_Critical"));
                                    }

                                    if (roomHandler != null && !isCorruptedSecretRoom && !isLeadKeyRoom)
                                    {
                                        m_GlitchTile.AddComponent <DebrisObject>();
                                        DebrisObject m_GlitchDebris = m_GlitchTile.GetComponent <DebrisObject>();
                                        m_GlitchDebris.angularVelocity         = 0;
                                        m_GlitchDebris.angularVelocityVariance = 0;
                                        m_GlitchDebris.animatePitFall          = false;
                                        m_GlitchDebris.bounceCount             = 0;
                                        m_GlitchDebris.breakOnFallChance       = 0;
                                        m_GlitchDebris.breaksOnFall            = false;
                                        m_GlitchDebris.canRotate             = false;
                                        m_GlitchDebris.changesCollisionLayer = false;
                                        m_GlitchDebris.collisionStopsBullets = false;
                                        m_GlitchDebris.followupBehavior      = DebrisObject.DebrisFollowupAction.None;
                                        m_GlitchDebris.IsAccurateDebris      = true;
                                        m_GlitchDebris.IsCorpse                      = false;
                                        m_GlitchDebris.motionMultiplier              = 0;
                                        m_GlitchDebris.pitFallSplash                 = false;
                                        m_GlitchDebris.playAnimationOnTrigger        = false;
                                        m_GlitchDebris.PreventAbsorption             = true;
                                        m_GlitchDebris.PreventFallingInPits          = true;
                                        m_GlitchDebris.Priority                      = EphemeralObject.EphemeralPriority.Ephemeral;
                                        m_GlitchDebris.shouldUseSRBMotion            = false;
                                        m_GlitchDebris.usesDirectionalFallAnimations = false;
                                        m_GlitchDebris.lifespanMax                   = 600;
                                        m_GlitchDebris.lifespanMin                   = 500;
                                        m_GlitchDebris.usesLifespan                  = true;
                                    }
                                    else
                                    {
                                        m_GlitchTile.AddComponent <ExpandCorruptedObjectDummyComponent>();
                                        ExpandCorruptedObjectDummyComponent dummyComponent = m_GlitchTile.GetComponent <ExpandCorruptedObjectDummyComponent>();
                                        dummyComponent.Init();
                                    }

                                    if (UnityEngine.Random.value <= 0.5f)
                                    {
                                        ExpandShaders.Instance.ApplyGlitchShader(m_GlitchSprite, true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat);
                                    }
                                    CorruptWallTilesPlaced++;
                                    validWalls.Remove(WallPosition);
                                }
                            }
                        }

                        for (int Width = -1; Width <= currentRoom.area.dimensions.x; Width++)
                        {
                            for (int Height = -1; Height <= currentRoom.area.dimensions.y; Height++)
                            {
                                int X = currentRoom.area.basePosition.x + Width;
                                int Y = currentRoom.area.basePosition.y + Height;
                                if (!dungeon.data.isWall(X, Y) && !dungeon.data.isAnyFaceWall(X, Y))
                                {
                                    validOpenAreas.Add(new IntVector2(X, Y));
                                }
                            }
                        }

                        int OpenAreaCorruptionIntensity = (validOpenAreas.Count / UnityEngine.Random.Range(5, 10));

                        if (UnityEngine.Random.value <= 0.2f | isCorruptedSecretRoom)
                        {
                            if (isCorruptedSecretRoom)
                            {
                                OpenAreaCorruptionIntensity = (validOpenAreas.Count / UnityEngine.Random.Range(2, 5));
                            }
                            else
                            {
                                OpenAreaCorruptionIntensity = (validOpenAreas.Count / UnityEngine.Random.Range(3, 6));
                            }
                        }

                        if ((roomHandler == null && !isCorruptedSecretRoom && UnityEngine.Random.value <= 0.15f) | corruptWallsOnly)
                        {
                            OpenAreaCorruptionIntensity = 0;
                        }

                        if (OpenAreaCorruptionIntensity > 0 && !currentRoom.IsShop && currentRoom.area.PrototypeRoomCategory != PrototypeDungeonRoom.RoomCategory.BOSS)
                        {
                            for (int S = 0; S <= OpenAreaCorruptionIntensity; S++)
                            {
                                IntVector2 OpenAreaPosition = BraveUtility.RandomElement(validOpenAreas);

                                float RandomIntervalFloat       = UnityEngine.Random.Range(0.02f, 0.06f);
                                float RandomDispFloat           = UnityEngine.Random.Range(0.07f, 0.09f);
                                float RandomDispIntensityFloat  = UnityEngine.Random.Range(0.085f, 0.2f);
                                float RandomColorProbFloat      = UnityEngine.Random.Range(0.04f, 0.15f);
                                float RandomColorIntensityFloat = UnityEngine.Random.Range(0.08f, 0.14f);

                                GameObject m_GlitchTile = Instantiate(GlitchedTileObject, (OpenAreaPosition.ToVector2()), Quaternion.identity);
                                m_GlitchTile.name += ("_" + UnityEngine.Random.Range(100000, 999999).ToString());

                                if (parentObject != null)
                                {
                                    m_GlitchTile.transform.parent = parentObject.transform;
                                }
                                else
                                {
                                    m_GlitchTile.transform.parent = currentRoom.hierarchyParent;
                                }

                                tk2dSprite m_GlitchSprite = m_GlitchTile.GetComponent <tk2dSprite>();
                                int        TileType       = UnityEngine.Random.Range(1, 3);
                                List <int> spriteIDs      = new List <int>();
                                if (TileType == 1)
                                {
                                    spriteIDs = CurrentFloorWallIDs;
                                }
                                if (TileType == 2)
                                {
                                    spriteIDs = CurrentFloorFloorIDs;
                                }
                                if (TileType == 3)
                                {
                                    spriteIDs = CurrentFloorMiscIDs;
                                }

                                m_GlitchSprite.SetSprite(BraveUtility.RandomElement(spriteIDs));

                                if (UnityEngine.Random.value <= 0.3f)
                                {
                                    ExpandShaders.Instance.ApplyGlitchShader(m_GlitchSprite, true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat);
                                }
                                DepthLookupManager.ProcessRenderer(m_GlitchSprite.renderer, DepthLookupManager.GungeonSortingLayer.BACKGROUND);
                                m_GlitchSprite.IsPerpendicular = false;
                                m_GlitchSprite.HeightOffGround = -4f;
                                m_GlitchSprite.SortingOrder    = 2;
                                m_GlitchSprite.UpdateZDepth();

                                if (roomHandler != null && !isCorruptedSecretRoom)
                                {
                                    m_GlitchTile.AddComponent <DebrisObject>();
                                    DebrisObject m_GlitchDebris = m_GlitchTile.GetComponent <DebrisObject>();
                                    m_GlitchDebris.angularVelocity         = 0;
                                    m_GlitchDebris.angularVelocityVariance = 0;
                                    m_GlitchDebris.animatePitFall          = false;
                                    m_GlitchDebris.bounceCount             = 0;
                                    m_GlitchDebris.breakOnFallChance       = 0;
                                    m_GlitchDebris.breaksOnFall            = false;
                                    m_GlitchDebris.canRotate             = false;
                                    m_GlitchDebris.changesCollisionLayer = false;
                                    m_GlitchDebris.collisionStopsBullets = false;
                                    m_GlitchDebris.followupBehavior      = DebrisObject.DebrisFollowupAction.None;
                                    m_GlitchDebris.IsAccurateDebris      = true;
                                    m_GlitchDebris.IsCorpse                      = false;
                                    m_GlitchDebris.motionMultiplier              = 0;
                                    m_GlitchDebris.pitFallSplash                 = false;
                                    m_GlitchDebris.playAnimationOnTrigger        = false;
                                    m_GlitchDebris.PreventAbsorption             = true;
                                    m_GlitchDebris.PreventFallingInPits          = true;
                                    m_GlitchDebris.Priority                      = EphemeralObject.EphemeralPriority.Ephemeral;
                                    m_GlitchDebris.shouldUseSRBMotion            = false;
                                    m_GlitchDebris.usesDirectionalFallAnimations = false;
                                    if (!isCorruptedSecretRoom && roomHandler != null)
                                    {
                                        m_GlitchDebris.lifespanMax  = 600;
                                        m_GlitchDebris.lifespanMin  = 500;
                                        m_GlitchDebris.usesLifespan = true;
                                    }
                                    else
                                    {
                                        m_GlitchDebris.usesLifespan = false;
                                    }
                                }
                                else
                                {
                                    m_GlitchTile.AddComponent <ExpandCorruptedObjectDummyComponent>();
                                    ExpandCorruptedObjectDummyComponent dummyComponent = m_GlitchTile.GetComponent <ExpandCorruptedObjectDummyComponent>();
                                    dummyComponent.Init();
                                }
                                CorruptOpenAreaTilesPlaced++;
                                validOpenAreas.Remove(OpenAreaPosition);
                            }
                        }
                    }
                    iterations++;
                } catch (Exception ex) {
                    if (ExpandStats.debugMode)
                    {
                        if (RoomBeingWorkedOn != null && !string.IsNullOrEmpty(RoomBeingWorkedOn.GetRoomName()))
                        {
                            ETGModConsole.Log("[DEBUG] Exception occured in Dungeon.PlaceWallMimics with room: " + RoomBeingWorkedOn.GetRoomName());
                            Debug.Log("Exception caught in Dungeon.PlaceWallMimics with room: " + RoomBeingWorkedOn.GetRoomName());
                        }
                        else
                        {
                            ETGModConsole.Log("[DEBUG] Exception occured in Dungeon.PlaceWallMimics!");
                            Debug.Log("Exception caught in Dungeon.PlaceWallMimics!");
                        }
                        Debug.LogException(ex);
                    }
                    if (CorruptWallTilesPlaced > 0)
                    {
                        if (ExpandStats.debugMode)
                        {
                            ETGModConsole.Log("[DEBUG] Number of corrupted wall tiles succesfully placed: " + CorruptWallTilesPlaced, false);
                            ETGModConsole.Log("[DEBUG] Number of corrupted ppen area tiles succesfully placed: " + CorruptOpenAreaTilesPlaced, false);
                        }
                    }
                    if (RoomBeingWorkedOn != null)
                    {
                        RoomBeingWorkedOn = null;
                    }
                    iterations++;
                }
            }
            if (CorruptWallTilesPlaced > 0)
            {
                if (ExpandStats.debugMode)
                {
                    ETGModConsole.Log("[DEBUG] Number of Valid Corrupted Wall Tile locations: " + CorruptWallTilesPlaced, false);
                    ETGModConsole.Log("[DEBUG] Number of Valid Corrupted locations: " + CorruptOpenAreaTilesPlaced, false);
                }
            }
            Destroy(GlitchedTileObject);
            return;
        }