public IEnumerator CorruptionRoomTime(PlayerController user)
        {
            RoomHandler currentRoom = user.CurrentRoom;
            Dungeon     dungeon     = GameManager.Instance.Dungeon;

            m_CachedScreenCapture = PortalTextureRender();
            yield return(null);

            while (m_ScreenCapInProgress)
            {
                yield return(null);
            }

            if (currentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear))
            {
                StunEnemiesForTeleport(currentRoom, 1f);
            }

            TogglePlayerInput(user, true);

            m_cachedRoomPosition = user.transform.position;

            AkSoundEngine.PostEvent("Play_EX_CorruptionRoomTransition_01", gameObject);
            ExpandShaders.Instance.GlitchScreenForDuration(1, 1.4f, 0.1f);

            GameObject TempFXObject = new GameObject("EXScreenFXTemp")
            {
            };

            TempFXObject.transform.SetParent(dungeon.gameObject.transform);
            TempFXObject.SetActive(false);
            yield return(null);

            ExpandGlitchScreenFXController fxController = TempFXObject.AddComponent <ExpandGlitchScreenFXController>();

            fxController.shaderType   = ExpandGlitchScreenFXController.ShaderType.Glitch;
            fxController.GlitchAmount = 0;
            yield return(null);

            TempFXObject.SetActive(true);
            while (fxController.GlitchAmount < 1)
            {
                fxController.GlitchAmount += (BraveTime.DeltaTime / 0.5f);
                yield return(null);
            }

            bool m_CopyCurrentRoom = false;

            if (!string.IsNullOrEmpty(currentRoom.GetRoomName()))
            {
                m_CopyCurrentRoom = (UnityEngine.Random.value < 0.05f);
            }

            PrototypeDungeonRoom SelectedPrototypeDungeonRoom = null;

            bool IsExitElevatorRoom = false;

            if (m_CopyCurrentRoom)
            {
                try {
                    SelectedPrototypeDungeonRoom = RoomBuilder.GenerateRoomPrefabFromTexture2D(RoomDebug.DumpRoomAreaToTexture2D(currentRoom));
                } catch (Exception ex) {
                    if (ExpandSettings.debugMode)
                    {
                        ETGModConsole.Log("[ExpandTheGungeon.TheLeadKey] ERROR: Exception occured while building room!", true);
                        Debug.LogException(ex);
                    }
                    AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject);
                    TogglePlayerInput(user, false);
                    ClearCooldowns();
                    yield break;
                }
            }
            else
            {
                float RoomSelectionSeed = UnityEngine.Random.value;
                bool  GoingToSecretBoss = false;

                if (RoomSelectionSeed <= 0.01f)
                {
                    GoingToSecretBoss = true;
                }

                if (!GoingToSecretBoss | ExpandSettings.HasSpawnedSecretBoss)
                {
                    if (RoomSelectionSeed <= 0.05f && GameManager.Instance.CurrentFloor != 6 && GameManager.Instance.CurrentFloor != 5 && !ExpandSettings.phobosElevatorHasBeenUsed)
                    {
                        SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(ExitElevatorRoomList);
                        IsExitElevatorRoom           = true;
                    }
                    else if (RoomSelectionSeed <= 0.25f)
                    {
                        SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(RewardRoomList);
                    }
                    else if (RoomSelectionSeed <= 0.5f)
                    {
                        List <PrototypeDungeonRoom> m_SpecialRooms = new List <PrototypeDungeonRoom>();

                        m_SpecialRooms.Add(BraveUtility.RandomElement(NPCRoomList));
                        m_SpecialRooms.Add(BraveUtility.RandomElement(SecretRoomList));
                        m_SpecialRooms.Add(BraveUtility.RandomElement(ShrineRoomList));

                        SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(m_SpecialRooms);
                    }
                    else
                    {
                        SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(MainRoomlist);
                    }
                }
                else
                {
                    ExpandSettings.HasSpawnedSecretBoss = true;

                    RoomHandler[] SecretBossRoomCluster = null;

                    try {
                        SecretBossRoomCluster = GenerateCorruptedBossRoomCluster();
                    } catch (Exception ex) {
                        ETGModConsole.Log("[ExpandTheGungeon.TheLeadKey] ERROR: Exception occured while building room!", true);
                        if (ExpandSettings.debugMode)
                        {
                            Debug.LogException(ex);
                        }
                        AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject);
                        TogglePlayerInput(user, false);
                        ClearCooldowns();
                        yield break;
                    }
                    yield return(null);

                    if (SecretBossRoomCluster == null)
                    {
                        AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject);
                        TogglePlayerInput(user, false);
                        ClearCooldowns();
                        yield break;
                    }

                    ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, SecretBossRoomCluster[0], null, true, true);
                    ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, SecretBossRoomCluster[1], null, true, true);

                    TeleportToRoom(user, SecretBossRoomCluster[0]);

                    while (m_IsTeleporting)
                    {
                        yield return(null);
                    }


                    GameObject m_PortalWarpObjectBossCluster = Instantiate(ExpandPrefabs.EX_GlitchPortal, (user.gameObject.transform.position + new Vector3(0.75f, 0)), Quaternion.identity);
                    ExpandGlitchPortalController m_PortalControllerBossCluster = m_PortalWarpObjectBossCluster.GetComponent <ExpandGlitchPortalController>();
                    if (m_CachedScreenCapture)
                    {
                        m_PortalControllerBossCluster.renderer.material.SetTexture("_PortalTex", m_CachedScreenCapture);
                    }
                    m_PortalControllerBossCluster.CachedPosition = m_cachedRoomPosition;
                    m_PortalControllerBossCluster.ParentRoom     = SecretBossRoomCluster[0];
                    SecretBossRoomCluster[0].RegisterInteractable(m_PortalControllerBossCluster);

                    while (fxController.GlitchAmount > 0)
                    {
                        fxController.GlitchAmount -= (BraveTime.DeltaTime / 0.5f);
                        yield return(null);
                    }

                    TogglePlayerInput(user, false);

                    m_PortalControllerBossCluster.Configured = true;

                    Destroy(TempFXObject);
                    m_InUse = false;
                    yield break;
                }
            }

            if (SelectedPrototypeDungeonRoom == null)
            {
                AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject);
                TogglePlayerInput(user, false);
                ClearCooldowns();
                yield break;
            }

            if (m_CopyCurrentRoom)
            {
                SelectedPrototypeDungeonRoom.overrideRoomVisualType = currentRoom.RoomVisualSubtype;
            }

            RoomHandler GlitchRoom = ExpandUtility.AddCustomRuntimeRoom(SelectedPrototypeDungeonRoom, IsExitElevatorRoom, false, allowProceduralLightFixtures: (true || m_CopyCurrentRoom));

            if (GlitchRoom == null)
            {
                AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject);
                TogglePlayerInput(user, false);
                ClearCooldowns();
                yield break;
            }

            if (!string.IsNullOrEmpty(GlitchRoom.GetRoomName()))
            {
                GlitchRoom.area.PrototypeRoomName = ("Corrupted " + GlitchRoom.GetRoomName());
            }
            else
            {
                GlitchRoom.area.PrototypeRoomName = ("Corrupted Room");
            }

            if (m_CopyCurrentRoom)
            {
                if (ExpandSettings.EnableGlitchFloorScreenShader && !dungeon.IsGlitchDungeon)
                {
                    GameObject GlitchShaderObject = Instantiate(ExpandPrefabs.EXGlitchFloorScreenFX, GlitchRoom.area.UnitCenter, Quaternion.identity);
                    ExpandGlitchScreenFXController FXController = GlitchShaderObject.GetComponent <ExpandGlitchScreenFXController>();
                    FXController.isRoomSpecific        = true;
                    FXController.ParentRoom            = GlitchRoom;
                    FXController.UseCorruptionAmbience = m_CopyCurrentRoom;
                    GlitchShaderObject.transform.SetParent(dungeon.gameObject.transform);
                }

                GameObject[] Objects = FindObjectsOfType <GameObject>();

                try {
                    foreach (GameObject Object in Objects)
                    {
                        if (Object && Object.transform.parent == currentRoom.hierarchyParent && IsValidObject(Object))
                        {
                            Vector3    OrigPosition = (Object.transform.position - currentRoom.area.basePosition.ToVector3());
                            Vector3    NewPosition  = (OrigPosition + GlitchRoom.area.basePosition.ToVector3());
                            GameObject newObject    = Instantiate(Object, NewPosition, Quaternion.identity);
                            newObject.transform.SetParent(GlitchRoom.hierarchyParent);

                            if (newObject.GetComponent <BaseShopController>())
                            {
                                Destroy(newObject.GetComponent <BaseShopController>());
                            }
                            if (newObject.GetComponent <PathingTrapController>())
                            {
                                Destroy(newObject.GetComponent <PathingTrapController>());
                            }

                            if (newObject.GetComponent <IPlaceConfigurable>() != null)
                            {
                                newObject.GetComponent <IPlaceConfigurable>().ConfigureOnPlacement(GlitchRoom);
                            }

                            if (newObject.GetComponent <TalkDoerLite>())
                            {
                                newObject.GetComponent <TalkDoerLite>().SpeaksGleepGlorpenese = true;
                            }

                            if (newObject.GetComponent <IPlayerInteractable>() != null)
                            {
                                GlitchRoom.RegisterInteractable(newObject.GetComponent <IPlayerInteractable>());
                            }

                            if (newObject.GetComponent <FlippableCover>())
                            {
                                ExpandKickableObject kickableObject = newObject.AddComponent <ExpandKickableObject>();
                                newObject.GetComponent <ExpandKickableObject>().ConfigureOnPlacement(GlitchRoom);
                                GlitchRoom.RegisterInteractable(kickableObject);
                            }

                            if (newObject && UnityEngine.Random.value <= 0.4f && !newObject.GetComponent <AIActor>() && !newObject.GetComponent <Chest>())
                            {
                                if (!string.IsNullOrEmpty(newObject.name) && !newObject.name.ToLower().StartsWith("glitchtile") && !newObject.name.ToLower().StartsWith("ex secret door") && !newObject.name.ToLower().StartsWith("lock") && !newObject.name.ToLower().StartsWith("chest"))
                                {
                                    float RandomIntervalFloat       = UnityEngine.Random.Range(0.02f, 0.04f);
                                    float RandomDispFloat           = UnityEngine.Random.Range(0.06f, 0.08f);
                                    float RandomDispIntensityFloat  = UnityEngine.Random.Range(0.07f, 0.1f);
                                    float RandomColorProbFloat      = UnityEngine.Random.Range(0.035f, 0.1f);
                                    float RandomColorIntensityFloat = UnityEngine.Random.Range(0.05f, 0.1f);
                                    ExpandShaders.Instance.BecomeGlitched(newObject, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat);
                                }
                            }
                        }
                    }
                } catch (Exception ex) {
                    if (ExpandSettings.debugMode)
                    {
                        ETGModConsole.Log("[ExpandTheGungeon.TheLeadKey] ERROR: Exception occured while duplicating objects for new room!", true);
                        Debug.LogException(ex);
                    }
                }

                IntVector2 ChestPosition = ExpandObjectDatabase.GetRandomAvailableCellForChest(dungeon, GlitchRoom, new List <IntVector2>());

                if (ChestPosition != IntVector2.Zero)
                {
                    GameObject      newChest  = Instantiate(ExpandPrefabs.SurpriseChestObject, ChestPosition.ToVector3(), Quaternion.identity);
                    ExpandFakeChest fakeChest = newChest.GetComponent <ExpandFakeChest>();
                    fakeChest.ConfigureOnPlacement(GlitchRoom);
                    GlitchRoom.RegisterInteractable(fakeChest);
                }
            }

            if (GlitchRoom.area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.SECRET && GlitchRoom.IsSecretRoom)
            {
                GlitchRoom.secretRoomManager.OpenDoor();
            }

            if (m_CopyCurrentRoom)
            {
                ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, GlitchRoom, null, false, true, true);
            }
            else
            {
                ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, GlitchRoom, null, true, true, true);
            }

            if (IsExitElevatorRoom)
            {
                ElevatorDepartureController DepartureElevator = null;

                if (FindObjectsOfType <ElevatorDepartureController>() != null)
                {
                    foreach (ElevatorDepartureController elevator in FindObjectsOfType <ElevatorDepartureController>())
                    {
                        if (elevator.gameObject.transform.parent == GlitchRoom.hierarchyParent)
                        {
                            DepartureElevator = elevator;
                            break;
                        }
                    }
                }

                if (DepartureElevator)
                {
                    ExpandElevatorDepartureManager exElevator = DepartureElevator.gameObject.AddComponent <ExpandElevatorDepartureManager>();
                    exElevator.OverrideTargetFloor = GlobalDungeonData.ValidTilesets.PHOBOSGEON;
                }
                TeleportToRoom(user, GlitchRoom, false, m_CopyCurrentRoom, new Vector2(4, 2));
            }
            else
            {
                TeleportToRoom(user, GlitchRoom, false, m_CopyCurrentRoom);
            }
            yield return(null);

            while (m_IsTeleporting)
            {
                yield return(null);
            }

            if (user.transform.position.GetAbsoluteRoom() != null)
            {
                if (user.CurrentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear))
                {
                    user.CurrentRoom.CompletelyPreventLeaving = true;
                }
            }
            if (GameManager.Instance.CurrentFloor == 1)
            {
                if (dungeon.data.Entrance != null)
                {
                    dungeon.data.Entrance.AddProceduralTeleporterToRoom();
                }
            }

            GameObject m_PortalWarpObject = Instantiate(ExpandPrefabs.EX_GlitchPortal, (user.gameObject.transform.position + new Vector3(0.75f, 0)), Quaternion.identity);
            ExpandGlitchPortalController m_PortalController = m_PortalWarpObject.GetComponent <ExpandGlitchPortalController>();

            if (m_CachedScreenCapture)
            {
                m_PortalController.renderer.material.SetTexture("_PortalTex", m_CachedScreenCapture);
            }
            m_PortalController.CachedPosition = m_cachedRoomPosition;
            m_PortalController.ParentRoom     = GlitchRoom;
            GlitchRoom.RegisterInteractable(m_PortalController);

            while (fxController.GlitchAmount > 0)
            {
                fxController.GlitchAmount -= (BraveTime.DeltaTime / 0.5f);
                yield return(null);
            }

            TogglePlayerInput(user, false);

            m_PortalController.Configured = true;

            Destroy(TempFXObject);

            m_InUse = false;
            yield break;
        }