public static void HandleLoadout(PlayerController player) { var starterGuns = AllStarterGuns[Random.Range(0, AllStarterGuns.Length)]; player.inventory.AddGunToInventory(Gungeon.Game.Items[starterGuns.First] as Gun, false); if (!string.IsNullOrEmpty(starterGuns.Second)) { player.inventory.AddGunToInventory(Gungeon.Game.Items[starterGuns.Second] as Gun, false); } if (BraveUtility.RandomBool()) { var gun = GetWeightedRandomItem <Gun>(); player.startingGunIds.Add(gun.PickupObjectId); LootEngine.TryGivePrefabToPlayer(gun.gameObject, player, true); } else { var active = GetWeightedRandomItem <PlayerItem>(); player.startingActiveItemIds.Add(active.PickupObjectId); LootEngine.TryGivePrefabToPlayer(active.gameObject, player, true); } var passive = GetWeightedRandomItem <PassiveItem>(); passive.CanBeDropped = false; player.startingGunIds.Add(passive.PickupObjectId); LootEngine.TryGivePrefabToPlayer(passive.gameObject, player, true); }
private void HandleRatBossSetup() { GameObject SpecialRatBoss = DungeonPlaceableUtility.InstantiateDungeonPlaceable(EnemyDatabase.GetOrLoadByGuid("6868795625bd46f3ae3e4377adce288b").gameObject, m_ParentRoom, new IntVector2(17, 28), true, AIActor.AwakenAnimationType.Awaken, true); AIActor RatBossAIActor = SpecialRatBoss.GetComponent <AIActor>(); if (RatBossAIActor != null) { PickupObject.ItemQuality targetQuality = (UnityEngine.Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.C : PickupObject.ItemQuality.D) : PickupObject.ItemQuality.B; GenericLootTable lootTable = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable; PickupObject item = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetQuality, lootTable, false); PickupObject item2 = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetQuality, lootTable, false); Destroy(RatBossAIActor.gameObject.GetComponent <ResourcefulRatDeathController>()); Destroy(RatBossAIActor.gameObject.GetComponent <ResourcefulRatRewardRoomController>()); RatBossAIActor.State = AIActor.ActorState.Awakening; RatBossAIActor.StealthDeath = true; RatBossAIActor.healthHaver.gameObject.AddComponent <ExpandSpawnGlitchObjectOnDeath>(); ExpandSpawnGlitchObjectOnDeath ObjectSpawnerComponent = RatBossAIActor.healthHaver.gameObject.GetComponent <ExpandSpawnGlitchObjectOnDeath>(); ObjectSpawnerComponent.spawnRatCorpse = true; ObjectSpawnerComponent.ratCorpseSpawnsKey = true; ObjectSpawnerComponent.parentEnemyWasRat = true; if (item && item2) { RatBossAIActor.AdditionalSafeItemDrops = new List <PickupObject> { item, item2 }; } RatBossAIActor.healthHaver.enabled = true; RatBossAIActor.healthHaver.forcePreventVictoryMusic = true; RatBossAIActor.ConfigureOnPlacement(m_ParentRoom); RatBossAIActor.specRigidbody.CollideWithOthers = true; } }
private void DoItemSpawn() { if (ItemList == null) { ItemList = new List <PickupObject>(); if (numberOfDefaultItemsToSpawn == 1) { PickupObject.ItemQuality targetQuality = (Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.C : PickupObject.ItemQuality.D) : PickupObject.ItemQuality.B; GenericLootTable lootTable = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable; PickupObject item = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetQuality, lootTable, false); if (item) { LootEngine.SpawnItem(item.gameObject, specRigidbody.GetUnitCenter(ColliderType.HitBox), Vector2.zero, 0f, true, true, false); } return; } else { for (int i = 0; i < numberOfDefaultItemsToSpawn; i++) { PickupObject.ItemQuality targetQuality = (Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.C : PickupObject.ItemQuality.D) : PickupObject.ItemQuality.B; GenericLootTable lootTable = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable; PickupObject item = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetQuality, lootTable, false); if (item) { ItemList.Add(item); } } } } if (ItemList.Count <= 0) { return; } if (ItemList.Count == 1) { LootEngine.SpawnItem(ItemList[0].gameObject, specRigidbody.GetUnitCenter(ColliderType.HitBox), Vector2.zero, 0f, true, true, false); return; } else if (ItemList.Count > 1) { foreach (PickupObject pickupObject in ItemList) { LootEngine.SpawnItem(pickupObject.gameObject, specRigidbody.GetUnitCenter(ColliderType.HitBox), Vector2.zero, 0f, true, true, false); } } return; }
protected override void DoEffect(PlayerController user) { // AkSoundEngine.PostEvent("Play_BOSS_bulletbros_anger_01", gameObject); if (BraveUtility.RandomBool()) { AkSoundEngine.PostEvent("Play_ENM_smiley_whistle_01", gameObject); } else { AkSoundEngine.PostEvent("Play_ENM_smiley_whistle_02", gameObject); } if (StaticReferenceManager.AllEnemies.Count > 0) { List <AIActor> m_BabyGoodHammers = new List <AIActor>(); foreach (AIActor enemy in StaticReferenceManager.AllEnemies) { if (enemy.EnemyGuid == CompanionGuid) { m_BabyGoodHammers.Add(enemy); } } if (m_BabyGoodHammers.Count <= 0) { StartCoroutine(HandleSpawnAnimation(user)); StartCoroutine(SpawnHammer(user)); } else { m_HammersHidden = true; foreach (AIActor enemy in m_BabyGoodHammers) { enemy.gameObject.GetComponent <CompanionController>().enabled = false; enemy.ToggleRenderers(false); enemy.IsGone = true; enemy.behaviorSpeculator.InterruptAndDisable(); enemy.specRigidbody.CollideWithOthers = false; StartCoroutine(HandleSpawnAnimation(user, enemy.sprite.WorldBottomLeft)); StartCoroutine(SpawnHammer(user)); } } } else { StartCoroutine(HandleSpawnAnimation(user)); StartCoroutine(SpawnHammer(user)); } }
private void HandleHideKeyOnTable() { ExpandObjectDatabase objectDatabase = new ExpandObjectDatabase(); IntVector2 GlitchedTable1Position = new IntVector2(9, 10); IntVector2 GlitchedTable2Position = new IntVector2(9, 8); GameObject GlitchedVerticalTable1 = ExpandUtility.GenerateDungeonPlacable(objectDatabase.TableVertical, false, true).InstantiateObject(m_ParentRoom, GlitchedTable1Position); GameObject GlitchedVerticalTable2 = ExpandUtility.GenerateDungeonPlacable(objectDatabase.TableVertical, false, true).InstantiateObject(m_ParentRoom, GlitchedTable2Position); GlitchedVerticalTable1.transform.SetParent(m_ParentRoom.hierarchyParent, true); GlitchedVerticalTable2.transform.SetParent(m_ParentRoom.hierarchyParent, true); GlitchedVerticalTable1.AddComponent <ExpandKickableObject>(); GlitchedVerticalTable2.AddComponent <ExpandKickableObject>(); float RandomIntervalFloat = UnityEngine.Random.Range(0.02f, 0.06f); float RandomDispFloat = UnityEngine.Random.Range(0.1f, 0.16f); float RandomDispIntensityFloat = UnityEngine.Random.Range(0.1f, 0.2f); float RandomColorProbFloat = UnityEngine.Random.Range(0.05f, 0.2f); float RandomColorIntensityFloat = UnityEngine.Random.Range(0.1f, 0.22f); if (BraveUtility.RandomBool()) { ExpandKickableObject GlitchedTable1Component = GlitchedVerticalTable1.GetComponent <ExpandKickableObject>(); GlitchedTable1Component.SpawnedObject = PickupObjectDatabase.GetById(727).gameObject; GlitchedTable1Component.willDefinitelyExplode = true; GlitchedTable1Component.spawnObjectOnSelfDestruct = true; ExpandShaders.Instance.ApplyGlitchShader(GlitchedTable1Component.GetComponentInChildren <tk2dBaseSprite>(), true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat); } else { ExpandKickableObject GlitchedTable1Component = GlitchedVerticalTable2.GetComponent <ExpandKickableObject>(); GlitchedTable1Component.SpawnedObject = PickupObjectDatabase.GetById(727).gameObject; GlitchedTable1Component.willDefinitelyExplode = true; GlitchedTable1Component.spawnObjectOnSelfDestruct = true; ExpandShaders.Instance.ApplyGlitchShader(GlitchedTable1Component.GetComponentInChildren <tk2dBaseSprite>(), true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat); } m_ParentRoom.RegisterInteractable(GlitchedVerticalTable1.GetComponentInChildren <FlippableCover>()); m_ParentRoom.RegisterInteractable(GlitchedVerticalTable2.GetComponentInChildren <FlippableCover>()); m_ParentRoom.RegisterInteractable(GlitchedVerticalTable1.GetComponent <ExpandKickableObject>()); m_ParentRoom.RegisterInteractable(GlitchedVerticalTable2.GetComponent <ExpandKickableObject>()); }
private IEnumerator DoSurprise() { yield return(new WaitForSeconds(0.7f)); AkSoundEngine.PostEvent("play_obj_chest_open_01", gameObject); DoConfetti(sprite.WorldBottomCenter); PickupObject.ItemQuality targetQuality = PickupObject.ItemQuality.D; float m_RandomFloat = UnityEngine.Random.value; Vector2 SpawnPosition = specRigidbody.GetPixelCollider(ColliderType.HitBox).UnitCenter; if (UnityEngine.Random.value < 0.3) { targetQuality = (m_RandomFloat >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.B : PickupObject.ItemQuality.C) : PickupObject.ItemQuality.B; } else { targetQuality = (m_RandomFloat >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.C : PickupObject.ItemQuality.D) : PickupObject.ItemQuality.C; } SurpriseChestEnemySpawnPool = SurpriseChestEnemySpawnPool.Shuffle(); AIActor Enemy = AIActor.Spawn(EnemyDatabase.GetOrLoadByGuid(BraveUtility.RandomElement(SurpriseChestEnemySpawnPool)), SpawnPosition, m_room, true, AIActor.AwakenAnimationType.Spawn, true); if (Enemy) { Enemy.IgnoreForRoomClear = false; GenericLootTable lootTable = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable; PickupObject item = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetQuality, lootTable, false); if (item) { Enemy.AdditionalSafeItemDrops.Add(item); } ExpandParadropController paraDropController = Enemy.gameObject.AddComponent <ExpandParadropController>(); paraDropController.Configured = true; } yield return(null); if (Enemy && !Enemy.IgnoreForRoomClear) { m_room.SealRoom(); } yield break; }
private void AnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame) { if (clip.GetFrame(frame).eventInfo == "slam") { GameManager.Instance.MainCameraController.DoScreenShake(SlamScreenShakeSettings, (transform.position + new Vector3(0, 2f)), false); if (ImpactVFXObjects != null && ImpactVFXObjects.Length > 0) { float SpawnPositionX = UnityEngine.Random.Range((transform.position.x + 2), (transform.position.x + 3)); float SpawnPositionY = UnityEngine.Random.Range((transform.position.y + 2), (transform.position.y + 9)); float SpawnPositionX2 = UnityEngine.Random.Range((transform.position.x + 2), (transform.position.x + 3)); float SpawnPositionY2 = UnityEngine.Random.Range((transform.position.y + 2), (transform.position.y + 9)); Vector3 SpawnPosition = new Vector3(SpawnPositionX, SpawnPositionY); Vector3 SpawnPosition2 = new Vector3(SpawnPositionX2, SpawnPositionY2); Instantiate(BraveUtility.RandomElement(ImpactVFXObjects), SpawnPosition, Quaternion.identity); if (BraveUtility.RandomBool()) { Instantiate(BraveUtility.RandomElement(ImpactVFXObjects), SpawnPosition2, Quaternion.identity); } List <string> SoundFXList = new List <string>() { "Play_OBJ_rock_break_01", "Play_OBJ_boulder_crash_01", "Play_OBJ_stone_crumble_01" }; SoundFXList = SoundFXList.Shuffle(); AkSoundEngine.PostEvent(BraveUtility.RandomElement(SoundFXList), gameObject); if (BraveUtility.RandomBool()) { AkSoundEngine.PostEvent("Play_PET_junk_splat_01", gameObject); } } } }
private void TransitionToDepart(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip) { GameManager.Instance.MainCameraController.DoDelayedScreenShake(departureShake, 0.25f, null); if (!m_depatureIsPlayerless) { for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++) { GameManager.Instance.AllPlayers[i].PrepareForSceneTransition(); } float delay = 0.5f; Pixelator.Instance.FadeToBlack(delay, false, 0f); GameUIRoot.Instance.HideCoreUI(string.Empty); GameUIRoot.Instance.ToggleLowerPanels(false, false, string.Empty); if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.SUPERBOSSRUSH) { GameManager.Instance.DelayedLoadBossrushFloor(delay); } else if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.BOSSRUSH) { GameManager.Instance.DelayedLoadBossrushFloor(delay); } else { if (!GameManager.Instance.IsFoyer && GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.NONE) { GlobalDungeonData.ValidTilesets nextTileset = GameManager.Instance.GetNextTileset(GameManager.Instance.Dungeon.tileIndices.tilesetId); GameManager.DoMidgameSave(nextTileset); } if (UsesOverrideTargetFloor) { GlobalDungeonData.ValidTilesets overrideTargetFloor = OverrideTargetFloor; if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.CATACOMBGEON) { GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_catacombs"); } else if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.FORGEGEON) { GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_forge"); } else if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.OFFICEGEON) { ExpandStats.elevatorHasBeenUsed = true; if (BraveUtility.RandomBool()) { GameManager.Instance.InjectedFlowPath = BraveUtility.RandomElement(ExpandDungeonFlow.GlitchChestFlows); GameManager.Instance.DelayedLoadNextLevel(delay); } else { GameManager.Instance.StartCoroutine(ExpandUtility.DelayedGlitchLevelLoad(delay, BraveUtility.RandomElement(ExpandDungeonFlow.GlitchChestFlows), useNakatomiTileset: BraveUtility.RandomBool())); } } else if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.WESTGEON) { GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_west"); // GameManager.Instance.StartCoroutine(ExpandUtility.DelayedGlitchLevelLoad(delay, "SecretGlitchFloor_Flow", true)); } else { GameManager.Instance.DelayedLoadNextLevel(delay); } } else { GameManager.Instance.DelayedLoadNextLevel(delay); } AkSoundEngine.PostEvent("Stop_MUS_All", gameObject); } } elevatorFloor.SetActive(false); animator.AnimationCompleted = (Action <tk2dSpriteAnimator, tk2dSpriteAnimationClip>)Delegate.Remove(animator.AnimationCompleted, new Action <tk2dSpriteAnimator, tk2dSpriteAnimationClip>(TransitionToDepart)); animator.PlayAndDisableObject(elevatorDepartAnimName, null); }
private IEnumerator BecomeMimic() { if (m_hands == null) { StartCoroutine(DoIntro()); } if (!ChaosConsole.WallMimicsUseRewardManager) { m_ChaosModeActive = true; } if (m_GlitchModeActive) { m_ItemDropOdds += 0.2f; m_FriendlyMimicOdds += 0.2f; } m_isHidden = false; SpeculativeRigidbody specRigidbody = this.specRigidbody; specRigidbody.OnRigidbodyCollision = (SpeculativeRigidbody.OnRigidbodyCollisionDelegate)Delegate.Remove(specRigidbody.OnRigidbodyCollision, new SpeculativeRigidbody.OnRigidbodyCollisionDelegate(HandleRigidbodyCollision)); SpeculativeRigidbody specRigidbody2 = this.specRigidbody; specRigidbody2.OnBeamCollision = (SpeculativeRigidbody.OnBeamCollisionDelegate)Delegate.Remove(specRigidbody2.OnBeamCollision, new SpeculativeRigidbody.OnBeamCollisionDelegate(HandleBeamCollision)); AIAnimator tongueAnimator = aiAnimator.ChildAnimator; tongueAnimator.renderer.enabled = true; tongueAnimator.spriteAnimator.enabled = true; AIAnimator spitAnimator = tongueAnimator.ChildAnimator; spitAnimator.renderer.enabled = true; spitAnimator.spriteAnimator.enabled = true; tongueAnimator.PlayUntilFinished("spawn", false, null, -1f, false); float delay = tongueAnimator.CurrentClipLength; float timer = 0f; bool hasPlayedVFX = false; while (timer < delay) { yield return(null); timer += BraveTime.DeltaTime; if (!hasPlayedVFX && delay - timer < 0.1f) { hasPlayedVFX = true; if (WallDisappearVFX) { Vector2 zero = Vector2.zero; Vector2 zero2 = Vector2.zero; DungeonData.Direction facingDirection = m_facingDirection; if (facingDirection != DungeonData.Direction.SOUTH) { if (facingDirection != DungeonData.Direction.EAST) { if (facingDirection == DungeonData.Direction.WEST) { zero = new Vector2(0f, -1f); zero2 = new Vector2(0f, 1f); } } else { zero = new Vector2(0f, -1f); zero2 = new Vector2(0f, 1f); } } else { zero = new Vector2(0f, -1f); zero2 = new Vector2(0f, 1f); } Vector2 min = Vector2.Min(pos1.ToVector2(), pos2.ToVector2()) + zero; Vector2 max = Vector2.Max(pos1.ToVector2(), pos2.ToVector2()) + new Vector2(1f, 1f) + zero2; for (int i = 0; i < 5; i++) { Vector2 v = BraveUtility.RandomVector2(min, max, new Vector2(0.25f, 0.25f)) + new Vector2(0f, 1f); GameObject gameObject = SpawnManager.SpawnVFX(WallDisappearVFX, v, Quaternion.identity); tk2dBaseSprite tk2dBaseSprite = (!gameObject) ? null : gameObject.GetComponent <tk2dBaseSprite>(); if (tk2dBaseSprite) { tk2dBaseSprite.HeightOffGround = 8f; tk2dBaseSprite.UpdateZDepth(); } } } } } if (!m_failedWallConfigure && m_GlitchModeActive) { if (aiActor.ParentRoom != null && GlitchEnemyList != null && GlitchEnemyList.Count > 0 && UnityEngine.Random.value <= m_spawnGitchEnemyOdds) { float RandomIntervalFloat = UnityEngine.Random.Range(0.02f, 0.06f); float RandomDispFloat = UnityEngine.Random.Range(0.1f, 0.16f); float RandomDispIntensityFloat = UnityEngine.Random.Range(0.1f, 0.4f); float RandomColorProbFloat = UnityEngine.Random.Range(0.05f, 0.2f); float RandomColorIntensityFloat = UnityEngine.Random.Range(0.1f, 0.25f); int count2 = this.specRigidbody.PixelColliders.Count; this.specRigidbody.PixelColliders.RemoveAt(count2 - 1); this.specRigidbody.PixelColliders.RemoveAt(count2 - 2); StaticReferenceManager.AllShadowSystemDepthHavers.Remove(m_fakeWall.transform); Destroy(m_fakeWall); Destroy(m_fakeCeiling); Vector3 targetPosForSpawn = m_startingPos + DungeonData.GetIntVector2FromDirection(m_facingDirection).ToVector3(); while (timer < delay) { aiAnimator.LockFacingDirection = true; aiAnimator.FacingDirection = DungeonData.GetAngleFromDirection(m_facingDirection); yield return(null); timer += BraveTime.DeltaTime; transform.position = Vector3.Lerp(m_startingPos, targetPosForSpawn, Mathf.InverseLerp(0.42f, 0.58f, timer)); this.specRigidbody.Reinitialize(); } yield return(null); Vector3 FinalSpawnLocation = transform.position; Vector3 VFXExplosionLocation = transform.position; Vector2 VFXExplosionSource = Vector2.zero; DungeonData.Direction CurrentDirection = m_facingDirection; if (CurrentDirection == DungeonData.Direction.WEST) { FinalSpawnLocation += new Vector3(2.5f, 3.5f); VFXExplosionLocation += new Vector3(3.5f, 3.5f); VFXExplosionSource = new Vector2(1, 0); } else if (CurrentDirection == DungeonData.Direction.EAST) { FinalSpawnLocation += new Vector3(4f, 3.5f); VFXExplosionLocation += new Vector3(3f, 3.5f); } else if (CurrentDirection == DungeonData.Direction.NORTH) { FinalSpawnLocation += new Vector3(3.5f, 4f); VFXExplosionLocation += new Vector3(3.5f, 3f); VFXExplosionSource = new Vector2(0, 1); } else if (CurrentDirection == DungeonData.Direction.SOUTH) { FinalSpawnLocation += new Vector3(3.5f, 1.5f); VFXExplosionLocation += new Vector3(3.5f, 2.5f); } yield return(null); string SelectedEnemy = BraveUtility.RandomElement(GlitchEnemyList); ExplosionData wallMimicExplosionData = new ExplosionData(); wallMimicExplosionData.CopyFrom(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData); wallMimicExplosionData.damage = 0f; wallMimicExplosionData.force /= 1.6f; if (SelectedEnemy != "RATCORPSE") { Exploder.Explode(VFXExplosionLocation, wallMimicExplosionData, VFXExplosionSource, ignoreQueues: true, damageTypes: CoreDamageTypes.None); GameObject SpawnVFXObject = Instantiate((GameObject)ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof")); tk2dBaseSprite SpawnVFXObjectComponent = SpawnVFXObject.GetComponent <tk2dBaseSprite>(); SpawnVFXObjectComponent.PlaceAtPositionByAnchor(FinalSpawnLocation + new Vector3(0f, 0.5f, 0f), tk2dBaseSprite.Anchor.MiddleCenter); SpawnVFXObjectComponent.HeightOffGround = 1f; SpawnVFXObjectComponent.UpdateZDepth(); AIActor glitchActor = AIActor.Spawn(EnemyDatabase.GetOrLoadByGuid(SelectedEnemy), FinalSpawnLocation, aiActor.ParentRoom, true, AIActor.AwakenAnimationType.Awaken, true); /*if (aiActor.ParentRoom != null && !aiActor.ParentRoom.IsSealed && !glitchActor.IgnoreForRoomClear) { * if (GameManager.Instance.PrimaryPlayer.CurrentRoom == aiActor.ParentRoom && aiActor.ParentRoom.EverHadEnemies) { * aiActor.ParentRoom.SealRoom(); * } * }*/ PickupObject.ItemQuality targetGlitchEnemyItemQuality = (UnityEngine.Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.C : PickupObject.ItemQuality.D) : PickupObject.ItemQuality.B; GenericLootTable glitchEnemyLootTable = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable; PickupObject glitchEnemyItem = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetGlitchEnemyItemQuality, glitchEnemyLootTable, false); /*if (BraveUtility.RandomBool()) { * ChaosUtility.MakeCompanion(glitchActor); * } else { * ChaosShaders.Instance.ApplyGlitchShader(glitchActor, glitchActor.sprite, true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat); * }*/ ChaosShaders.Instance.ApplyGlitchShader(glitchActor, glitchActor.sprite, true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat); if (glitchEnemyItem) { glitchActor.AdditionalSafeItemDrops.Add(glitchEnemyItem); } } else { Exploder.Explode(VFXExplosionLocation, wallMimicExplosionData, VFXExplosionSource, ignoreQueues: true, damageTypes: CoreDamageTypes.None); GameObject SpawnVFXObject = Instantiate((GameObject)ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof")); tk2dBaseSprite SpawnVFXObjectComponent = SpawnVFXObject.GetComponent <tk2dBaseSprite>(); SpawnVFXObjectComponent.PlaceAtPositionByAnchor(FinalSpawnLocation + new Vector3(0f, 0.5f, 0f), tk2dBaseSprite.Anchor.MiddleCenter); SpawnVFXObjectComponent.HeightOffGround = 1f; SpawnVFXObjectComponent.UpdateZDepth(); GameObject spawnedRatCorpseObject = Instantiate(ChaosPrefabs.RatCorpseNPC, FinalSpawnLocation, Quaternion.identity); TalkDoerLite talkdoerComponent = spawnedRatCorpseObject.GetComponent <TalkDoerLite>(); talkdoerComponent.transform.position.XY().GetAbsoluteRoom().RegisterInteractable(talkdoerComponent); talkdoerComponent.transform.position.XY().GetAbsoluteRoom().TransferInteractableOwnershipToDungeon(talkdoerComponent); talkdoerComponent.playmakerFsm.SetState("Set Mode"); ChaosUtility.AddHealthHaver(talkdoerComponent.gameObject, 60, flashesOnDamage: false, exploderSpawnsItem: true); } yield return(null); Destroy(aiActor.gameObject); yield break; } } PickupObject.ItemQuality targetQuality = (UnityEngine.Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.C : PickupObject.ItemQuality.D) : PickupObject.ItemQuality.B; GenericLootTable lootTable = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable; PickupObject item = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetQuality, lootTable, false); if (item) { if (m_ChaosModeActive) { if (UnityEngine.Random.value <= m_ItemDropOdds) { aiActor.AdditionalSafeItemDrops.Add(item); } else { aiActor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(70)); if (BraveUtility.RandomBool()) { aiActor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(70)); } if (m_GlitchModeActive) { aiActor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(70)); } } if (UnityEngine.Random.value <= m_FriendlyMimicOdds) { m_isFriendlyMimic = true; } } else { aiActor.AdditionalSafeItemDrops.Add(item); } } else { if (m_ChaosModeActive && UnityEngine.Random.value <= m_FriendlyMimicOdds) { m_isFriendlyMimic = true; } } aiActor.enabled = true; behaviorSpeculator.enabled = true; if (aiActor.ParentRoom != null && aiActor.ParentRoom.IsSealed && !m_isFriendlyMimic) { aiActor.IgnoreForRoomClear = false; } // if (m_isFriendlyMimic) { ChaosUtility.MakeCompanion(aiActor); } if (m_isFriendlyMimic) { aiActor.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null); } if (!m_failedWallConfigure) { int count = this.specRigidbody.PixelColliders.Count; for (int j = 0; j < count - 2; j++) { this.specRigidbody.PixelColliders[j].Enabled = true; } this.specRigidbody.PixelColliders.RemoveAt(count - 1); this.specRigidbody.PixelColliders.RemoveAt(count - 2); StaticReferenceManager.AllShadowSystemDepthHavers.Remove(m_fakeWall.transform); Destroy(m_fakeWall); Destroy(m_fakeCeiling); } else { int count = this.specRigidbody.PixelColliders.Count; for (int j = 0; j < count; j++) { this.specRigidbody.PixelColliders[j].Enabled = true; } } for (int k = 0; k < m_hands.Length; k++) { m_hands[k].gameObject.SetActive(true); } aiActor.ToggleRenderers(true); if (aiShooter) { aiShooter.ToggleGunAndHandRenderers(true, "ChaosWallMimicController"); } aiActor.IsGone = false; healthHaver.IsVulnerable = true; aiActor.State = AIActor.ActorState.Normal; for (int l = 0; l < m_hands.Length; l++) { m_hands[l].gameObject.SetActive(false); } m_isFinished = true; delay = 0.58f; timer = 0f; Vector3 targetPos = m_startingPos + DungeonData.GetIntVector2FromDirection(m_facingDirection).ToVector3(); while (timer < delay) { aiAnimator.LockFacingDirection = true; aiAnimator.FacingDirection = DungeonData.GetAngleFromDirection(m_facingDirection); yield return(null); timer += BraveTime.DeltaTime; transform.position = Vector3.Lerp(m_startingPos, targetPos, Mathf.InverseLerp(0.42f, 0.58f, timer)); this.specRigidbody.Reinitialize(); } aiAnimator.LockFacingDirection = false; knockbackDoer.SetImmobile(false, "ChaosWallMimicController"); aiActor.CollisionDamage = 0.5f; aiActor.CollisionKnockbackStrength = m_collisionKnockbackStrength; yield break; }
public void TeleportToGlitchRoom() { try { PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; Dungeon dungeon = GameManager.Instance.Dungeon; ChaosRoomRandomizer roomRandomizer = new ChaosRoomRandomizer(); int SelectedRoomIndex = UnityEngine.Random.Range(0, roomRandomizer.MasterRoomArray.Length); int SelectedCombatRoomIndex = UnityEngine.Random.Range(0, ChaosPrefabs.CustomRoomTable.includedRooms.elements.Count); if (BraveUtility.RandomBool()) { SelectedPrototypeDungeonRoom = Instantiate(roomRandomizer.MasterRoomArray[SelectedRoomIndex]); } else { SelectedPrototypeDungeonRoom = Instantiate(ChaosPrefabs.CustomRoomTable.includedRooms.elements[SelectedCombatRoomIndex].room); } Destroy(roomRandomizer); // roomRandomizer = null; if (SelectedPrototypeDungeonRoom == null) { Invoke("TentacleRelease", 1f); Invoke("TentacleShowPlayer", 1.45f); Invoke("Unfreeze", 2f); return; } if (SelectedPrototypeDungeonRoom.category == PrototypeDungeonRoom.RoomCategory.SECRET) { SelectedPrototypeDungeonRoom.category = PrototypeDungeonRoom.RoomCategory.NORMAL; } SelectedPrototypeDungeonRoom.name = ("Glitched " + SelectedPrototypeDungeonRoom.name); GlitchRoom = ChaosUtility.Instance.AddCustomRuntimeRoom(SelectedPrototypeDungeonRoom); // Spawn Rainbow chest. This room doesn't spawn NPC it seems.(unless player hasn't unlocked it yet? Not likely. Most would have unlocked this one by now) if (GlitchRoom.GetRoomName().ToLower().EndsWith("earlymetashopcell")) { IntVector2 SpecialChestLocation = new IntVector2(10, 14); WeightedGameObject wChestObject = new WeightedGameObject(); Chest RainbowChest = GameManager.Instance.RewardManager.Rainbow_Chest; wChestObject.rawGameObject = RainbowChest.gameObject; WeightedGameObjectCollection wChestObjectCollection = new WeightedGameObjectCollection(); wChestObjectCollection.Add(wChestObject); Chest PlacableChest = GlitchRoom.SpawnRoomRewardChest(wChestObjectCollection, (SpecialChestLocation + GlitchRoom.area.basePosition)); } primaryPlayer.EscapeRoom(PlayerController.EscapeSealedRoomStyle.TELEPORTER, true, GlitchRoom); primaryPlayer.WarpFollowersToPlayer(); Invoke("TentacleRelease", 1f); Invoke("TentacleShowPlayer", 1.45f); Invoke("Unfreeze", 2f); if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER) { GameManager.Instance.GetOtherPlayer(secondaryPlayer).ReuniteWithOtherPlayer(primaryPlayer, false); } } catch (Exception ex) { if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] Error! Exception occured while attempting to generate glitch room!", false); ETGModConsole.Log(ex.Message, false); ETGModConsole.Log(ex.Source, false); ETGModConsole.Log(ex.StackTrace, false); ETGModConsole.Log(ex.TargetSite.ToString(), false); Debug.LogException(ex); } Invoke("TentacleRelease", 1f); Invoke("TentacleShowPlayer", 1.45f); Invoke("Unfreeze", 2f); return; } return; }
protected override IEnumerator Top() { for (int i = 0; i < 10; i++) { this.FireBurst((i % 2 != 0) ? "right gun" : "left gun"); if (i % 3 == 2) { yield return(this.Wait(6)); this.QuadShot(this.AimDirection + UnityEngine.Random.Range(-60f, 60f), (!BraveUtility.RandomBool()) ? "right gun" : "left gun", UnityEngine.Random.Range(9f, 11f)); yield return(this.Wait(6)); } yield return(this.Wait(12)); } yield break; }
private void HandleChestRoomSetup() { AssetBundle sharedAssets1 = ResourceManager.LoadAssetBundle("shared_auto_001"); AssetBundle sharedAssets2 = ResourceManager.LoadAssetBundle("shared_auto_002"); ExpandObjectDatabase objectDatabase = new ExpandObjectDatabase(); try { DungeonPlaceable ChestPlatform = sharedAssets2.LoadAsset <DungeonPlaceable>("Treasure_Dais_Stone_Carpet"); GameObject Chest_Black = sharedAssets1.LoadAsset <GameObject>("Chest_Black"); GameObject Chest_Rainbow = sharedAssets1.LoadAsset <GameObject>("Chest_Rainbow"); GameObject Chest_Rat = sharedAssets1.LoadAsset <GameObject>("Chest_Rat"); IntVector2 TreasureChestCarpetPosition1 = new IntVector2(8, 29); IntVector2 TreasureChestCarpetPosition2 = new IntVector2(8, 54); IntVector2 SecretChestPosition1 = new IntVector2(8, 31); IntVector2 SecretChestPosition2 = new IntVector2(8, 56); GameObject TreasureChestStoneCarpet1 = ChestPlatform.InstantiateObject(m_ParentRoom, TreasureChestCarpetPosition1); GameObject TreasureChestStoneCarpet2 = ChestPlatform.InstantiateObject(m_ParentRoom, TreasureChestCarpetPosition2); TreasureChestStoneCarpet1.transform.position -= new Vector3(0.55f, 0); TreasureChestStoneCarpet2.transform.position -= new Vector3(0.55f, 0); TreasureChestStoneCarpet1.transform.SetParent(m_ParentRoom.hierarchyParent, true); TreasureChestStoneCarpet2.transform.SetParent(m_ParentRoom.hierarchyParent, true); GameObject PlacedBlackChestObject = ExpandUtility.GenerateDungeonPlacable(Chest_Black, false, true).InstantiateObject(m_ParentRoom, SecretChestPosition1); GameObject PlacedRainbowChestObject = ExpandUtility.GenerateDungeonPlacable(Chest_Rainbow, false, true).InstantiateObject(m_ParentRoom, SecretChestPosition2); PlacedBlackChestObject.transform.position += new Vector3(0.5f, 0); PlacedRainbowChestObject.transform.position += new Vector3(0.5f, 0); TreasureChestStoneCarpet1.transform.position += new Vector3(0.5f, 0); TreasureChestStoneCarpet2.transform.position += new Vector3(0.5f, 0); PlacedBlackChestObject.transform.SetParent(m_ParentRoom.hierarchyParent, true); PlacedRainbowChestObject.transform.SetParent(m_ParentRoom.hierarchyParent, true); tk2dBaseSprite PlacedBlackChestSprite = PlacedBlackChestObject.GetComponentInChildren <tk2dBaseSprite>(); GenericLootTable BlackChestLootTable = GameManager.Instance.RewardManager.ItemsLootTable; Chest PlacedBlackChestComponent = PlacedBlackChestObject.GetComponent <Chest>(); Chest PlacedRainbowChestComponent = PlacedRainbowChestObject.GetComponent <Chest>(); PlacedBlackChestComponent.ChestType = Chest.GeneralChestType.ITEM; PlacedBlackChestComponent.lootTable.lootTable = BlackChestLootTable; bool LootTableCheck = PlacedBlackChestComponent.lootTable.canDropMultipleItems && PlacedBlackChestComponent.lootTable.overrideItemLootTables != null && PlacedBlackChestComponent.lootTable.overrideItemLootTables.Count > 0; if (LootTableCheck) { PlacedBlackChestComponent.lootTable.overrideItemLootTables[0] = BlackChestLootTable; } PlacedBlackChestComponent.overrideMimicChance = 0f; PlacedBlackChestComponent.ForceUnlock(); PlacedBlackChestComponent.PreventFuse = true; PlacedRainbowChestComponent.ForceUnlock(); PlacedRainbowChestComponent.PreventFuse = true; m_ParentRoom.RegisterInteractable(PlacedBlackChestComponent); m_ParentRoom.RegisterInteractable(PlacedRainbowChestComponent); Vector3 SpecialLockedDoorPosition = (new Vector3(9, 52.25f) + m_ParentRoom.area.basePosition.ToVector3()); GameObject SpecialLockedDoor = Instantiate(objectDatabase.LockedJailDoor, SpecialLockedDoorPosition, Quaternion.identity); SpecialLockedDoor.transform.SetParent(m_ParentRoom.hierarchyParent, true); InteractableLock SpecialLockedDoorComponent = SpecialLockedDoor.GetComponentInChildren <InteractableLock>(); SpecialLockedDoorComponent.lockMode = InteractableLock.InteractableLockMode.RESOURCEFUL_RAT; SpecialLockedDoorComponent.JailCellKeyId = 0; tk2dBaseSprite RainbowLockSprite = SpecialLockedDoorComponent.GetComponentInChildren <tk2dBaseSprite>(); if (RainbowLockSprite != null) { ExpandShaders.Instance.ApplyRainbowShader(RainbowLockSprite); } IntVector2 PuzzleChestPosition1 = new IntVector2(4, 19); IntVector2 PuzzleChestPosition2 = new IntVector2(12, 19); IntVector2 PuzzleChestPosition3 = new IntVector2(4, 40); IntVector2 PuzzleChestPosition4 = new IntVector2(12, 40); IntVector2 PuzzleChestPosition5 = new IntVector2(4, 50); IntVector2 PuzzleChestPosition6 = new IntVector2(12, 50); IntVector2 PuzzleChestCarpetPosition1 = (PuzzleChestPosition1 - new IntVector2(0, 1)); IntVector2 PuzzleChestCarpetPosition2 = (PuzzleChestPosition2 - new IntVector2(0, 1)); IntVector2 PuzzleChestCarpetPosition3 = (PuzzleChestPosition3 - new IntVector2(0, 1)); IntVector2 PuzzleChestCarpetPosition4 = (PuzzleChestPosition4 - new IntVector2(0, 1)); IntVector2 PuzzleChestCarpetPosition5 = (PuzzleChestPosition5 - new IntVector2(0, 1)); IntVector2 PuzzleChestCarpetPosition6 = (PuzzleChestPosition6 - new IntVector2(0, 1)); GameObject PlacedPuzzleRatChest1 = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition1, false, true); GameObject PlacedPuzzleRatChest2 = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition2, false, true); GameObject PlacedPuzzleRatChest3 = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition3, false, true); GameObject PlacedPuzzleRatChest4 = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition4, false, true); GameObject PlacedPuzzleRatChest5 = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition5, false, true); GameObject PlacedPuzzleRatChest6 = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition6, false, true); GameObject PuzzleChestStoneCarpet1 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition1); GameObject PuzzleChestStoneCarpet2 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition2); GameObject PuzzleChestStoneCarpet3 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition3); GameObject PuzzleChestStoneCarpet4 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition4); GameObject PuzzleChestStoneCarpet5 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition5); GameObject PuzzleChestStoneCarpet6 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition6); PlacedPuzzleRatChest1.transform.SetParent(m_ParentRoom.hierarchyParent, true); PlacedPuzzleRatChest2.transform.SetParent(m_ParentRoom.hierarchyParent, true); PlacedPuzzleRatChest3.transform.SetParent(m_ParentRoom.hierarchyParent, true); PlacedPuzzleRatChest4.transform.SetParent(m_ParentRoom.hierarchyParent, true); PlacedPuzzleRatChest5.transform.SetParent(m_ParentRoom.hierarchyParent, true); PlacedPuzzleRatChest6.transform.SetParent(m_ParentRoom.hierarchyParent, true); PuzzleChestStoneCarpet1.transform.SetParent(m_ParentRoom.hierarchyParent, true); PuzzleChestStoneCarpet2.transform.SetParent(m_ParentRoom.hierarchyParent, true); PuzzleChestStoneCarpet3.transform.SetParent(m_ParentRoom.hierarchyParent, true); PuzzleChestStoneCarpet4.transform.SetParent(m_ParentRoom.hierarchyParent, true); PuzzleChestStoneCarpet5.transform.SetParent(m_ParentRoom.hierarchyParent, true); PuzzleChestStoneCarpet6.transform.SetParent(m_ParentRoom.hierarchyParent, true); Chest PuzzleRatChest1Component = PlacedPuzzleRatChest1.GetComponent <Chest>(); Chest PuzzleRatChest2Component = PlacedPuzzleRatChest2.GetComponent <Chest>(); Chest PuzzleRatChest3Component = PlacedPuzzleRatChest3.GetComponent <Chest>(); Chest PuzzleRatChest4Component = PlacedPuzzleRatChest4.GetComponent <Chest>(); Chest PuzzleRatChest5Component = PlacedPuzzleRatChest5.GetComponent <Chest>(); Chest PuzzleRatChest6Component = PlacedPuzzleRatChest6.GetComponent <Chest>(); PuzzleRatChest1Component.PreventFuse = true; PuzzleRatChest2Component.PreventFuse = true; PuzzleRatChest3Component.PreventFuse = true; PuzzleRatChest4Component.PreventFuse = true; PuzzleRatChest5Component.PreventFuse = true; PuzzleRatChest6Component.PreventFuse = true; PuzzleRatChest1Component.overrideMimicChance = 0f; PuzzleRatChest2Component.overrideMimicChance = 0f; PuzzleRatChest3Component.overrideMimicChance = 0f; PuzzleRatChest4Component.overrideMimicChance = 0f; PuzzleRatChest5Component.overrideMimicChance = 0f; PuzzleRatChest6Component.overrideMimicChance = 0f; float Seed = UnityEngine.Random.value; if (Seed <= 0.5f) { PuzzleRatChest1Component.forceContentIds = new List <int> { 68 }; PuzzleRatChest2Component.forceContentIds = new List <int> { 727, 727 }; } else { PuzzleRatChest1Component.forceContentIds = new List <int> { 727, 727 }; PuzzleRatChest2Component.forceContentIds = new List <int> { 68 }; } if (BraveUtility.RandomBool()) { PuzzleRatChest3Component.forceContentIds = new List <int> { 70, 70, 70, 70 }; PuzzleRatChest4Component.forceContentIds = new List <int> { 727, 727 }; } else { PuzzleRatChest3Component.forceContentIds = new List <int> { 727, 727 }; PuzzleRatChest4Component.forceContentIds = new List <int> { 70, 70, 70, 70 }; } if (BraveUtility.RandomBool()) { PuzzleRatChest5Component.forceContentIds = new List <int> { 74 }; PuzzleRatChest6Component.forceContentIds = new List <int> { 316 }; } else { PuzzleRatChest5Component.forceContentIds = new List <int> { 316 }; PuzzleRatChest6Component.forceContentIds = new List <int> { 74 }; } PuzzleRatChest1Component.ConfigureOnPlacement(m_ParentRoom); PuzzleRatChest2Component.ConfigureOnPlacement(m_ParentRoom); PuzzleRatChest3Component.ConfigureOnPlacement(m_ParentRoom); PuzzleRatChest4Component.ConfigureOnPlacement(m_ParentRoom); PuzzleRatChest5Component.ConfigureOnPlacement(m_ParentRoom); PuzzleRatChest6Component.ConfigureOnPlacement(m_ParentRoom); m_ParentRoom.RegisterInteractable(PuzzleRatChest1Component); m_ParentRoom.RegisterInteractable(PuzzleRatChest2Component); m_ParentRoom.RegisterInteractable(PuzzleRatChest3Component); m_ParentRoom.RegisterInteractable(PuzzleRatChest4Component); m_ParentRoom.RegisterInteractable(PuzzleRatChest5Component); m_ParentRoom.RegisterInteractable(PuzzleRatChest6Component); Vector3 InfoSignPosition = (new Vector3(6, 4) + m_ParentRoom.area.basePosition.ToVector3()); GameObject ChestPuzzleInfoSign = Instantiate(ExpandPrefabs.Jungle_BlobLostSign, InfoSignPosition, Quaternion.identity); ChestPuzzleInfoSign.name = "Lunk's Minigame Sign"; ChestPuzzleInfoSign.GetComponent <ExpandNoteDoer>().stringKey = "A minigame Lunk created based on a game he used to play in a land far away.\nGuess the right chest to continue forward.\n If you can guess the correct chest 3 times, the ultimate prize shall be gained!"; m_ParentRoom.RegisterInteractable(ChestPuzzleInfoSign.GetComponent <ExpandNoteDoer>()); } catch (Exception ex) { if (ExpandStats.debugMode) { string Message = "[ExpandTheGungeon] Warning: Exception caught in ExpandWestPuzzleRoomController.HandleChestRoomSetup!"; ETGModConsole.Log(Message); Debug.Log(Message); Debug.LogException(ex); } } sharedAssets1 = null; sharedAssets2 = null; objectDatabase = null; }
private static void PlaceRandomCorpses(Dungeon dungeon, RoomHandler currentRoom) { PrototypeDungeonRoom.RoomCategory roomCategory = currentRoom.area.PrototypeRoomCategory; int MaxObjectsPerRoom = 12; if (currentRoom != null && !string.IsNullOrEmpty(currentRoom.GetRoomName()) && !currentRoom.IsMaintenanceRoom() && !currentRoom.GetRoomName().StartsWith("Boss Foyer") && !currentRoom.PrecludeTilemapDrawing) { if (Random.value <= 0.6f && roomCategory != PrototypeDungeonRoom.RoomCategory.ENTRANCE && roomCategory != PrototypeDungeonRoom.RoomCategory.REWARD) { List <IntVector2> m_CachedPositions = new List <IntVector2>(); int MaxCorpseCount = MaxObjectsPerRoom; if (Random.value <= 0.3f) { MaxCorpseCount = 20; } else if (roomCategory == PrototypeDungeonRoom.RoomCategory.BOSS) { MaxCorpseCount = 17; } int CorpseCount = Random.Range(6, MaxObjectsPerRoom); for (int i = 0; i < CorpseCount; i++) { IntVector2?RandomVector = GetRandomAvailableCell(dungeon, currentRoom, m_CachedPositions); if (RandomVector.HasValue) { if (Random.value <= 0.08f) { GameObject SkeletonCorpse = Object.Instantiate(ExpandPrefabs.Sarco_Skeleton, RandomVector.Value.ToVector3(), Quaternion.identity); SkeletonCorpse.GetComponent <tk2dSprite>().HeightOffGround = -1; SkeletonCorpse.GetComponent <tk2dSprite>().UpdateZDepth(); if (BraveUtility.RandomBool()) { SkeletonCorpse.GetComponent <tk2dSprite>().FlipX = true; } SkeletonCorpse.transform.parent = currentRoom.hierarchyParent; RandomObjectsPlaced++; } else { GameObject WrithingBulletManCorpse = ExpandObjectDatabase.WrithingBulletman.InstantiateObject(currentRoom, (RandomVector.Value - currentRoom.area.basePosition)); WrithingBulletManCorpse.transform.parent = currentRoom.hierarchyParent; RandomObjectsPlaced++; } if (m_CachedPositions.Count <= 0) { break; } } else { RandomObjectsSkipped++; } } } } }
public void PlaceRandomJunkEnemies(Dungeon dungeon, RoomHandler roomHandler) { if (dungeon.IsGlitchDungeon) { return; } if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.RATGEON) { return; } if (Random.value <= 0.85f) { return; } int RandomEnemiesPlaced = 0; int RandomEnemiesSkipped = 0; int MaxEnemies = 1; int iterations = 0; if (Random.value <= 0.1f) { MaxEnemies = 2; } if (dungeon.data.rooms == null | dungeon.data.rooms.Count <= 0) { return; } List <int> roomList = Enumerable.Range(0, dungeon.data.rooms.Count).ToList(); roomList = roomList.Shuffle(); if (roomHandler != null) { roomList = new List <int>(new int[] { dungeon.data.rooms.IndexOf(roomHandler) }); } while (iterations < roomList.Count && RandomEnemiesPlaced < MaxEnemies) { RoomHandler currentRoom = dungeon.data.rooms[roomList[iterations]]; PrototypeDungeonRoom.RoomCategory roomCategory = currentRoom.area.PrototypeRoomCategory; try { if (currentRoom != null && !string.IsNullOrEmpty(currentRoom.GetRoomName()) && currentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear) && !currentRoom.IsMaintenanceRoom() && !currentRoom.IsSecretRoom && !currentRoom.IsWinchesterArcadeRoom && !currentRoom.IsGunslingKingChallengeRoom && !currentRoom.GetRoomName().StartsWith("Boss Foyer") && !currentRoom.GetRoomName().StartsWith(ExpandRoomPrefabs.Expand_Keep_TreeRoom.name) && !currentRoom.GetRoomName().StartsWith(ExpandRoomPrefabs.Expand_Keep_TreeRoom2.name)) { if (roomCategory != PrototypeDungeonRoom.RoomCategory.BOSS && roomCategory != PrototypeDungeonRoom.RoomCategory.ENTRANCE && roomCategory != PrototypeDungeonRoom.RoomCategory.REWARD && roomCategory != PrototypeDungeonRoom.RoomCategory.EXIT) { if (RandomEnemiesPlaced >= MaxEnemies) { break; } List <IntVector2> m_CachedPositions = new List <IntVector2>(); IntVector2? RandomGlitchEnemyVector = GetRandomAvailableCellForEnemy(dungeon, currentRoom, m_CachedPositions); if (RandomGlitchEnemyVector.HasValue) { if (Random.value <= 0.5f) { m_GlitchEnemyDatabase.SpawnGlitchedRaccoon(currentRoom, RandomGlitchEnemyVector.Value, false, AIActor.AwakenAnimationType.Spawn, true); } else { m_GlitchEnemyDatabase.SpawnGlitchedTurkey(currentRoom, RandomGlitchEnemyVector.Value, false, AIActor.AwakenAnimationType.Spawn, true); } } else { RandomEnemiesSkipped++; } RandomEnemiesPlaced++; } } iterations++; } catch (System.Exception ex) { if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] Exception while setting up or placing enemy for current room" /*+ currentRoom.GetRoomName()*/, false); } if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] Skipping current room...", false); } if (ExpandStats.debugMode) { ETGModConsole.Log(ex.Message + ex.StackTrace + ex.Source, false); } if (RandomEnemiesPlaced >= MaxEnemies) { break; } iterations++; } } if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] Max Number of Junk Enemies assigned to floor: " + MaxEnemies, false); ETGModConsole.Log("[DEBUG] Number of Junk Enemies placed: " + RandomEnemiesPlaced, false); ETGModConsole.Log("[DEBUG] Number of Junk Enemies skipped: " + RandomEnemiesSkipped, false); if (RandomEnemiesPlaced <= 0) { ETGModConsole.Log("[DEBUG] Error: No Junk Enemies have been placed!", false); } } if (RandomEnemiesPlaced > 0) { AIActor[] actors = FindObjectsOfType <AIActor>(); if (actors != null & actors.Length > 0) { foreach (AIActor actor in actors) { if (!string.IsNullOrEmpty(actor.ActorName)) { if (actor.ActorName == "Junk Raccoon") { actor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(127)); if (Random.value <= 0.2f) { actor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(127)); } else { if (Random.value <= 0.1f) { actor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(74)); } else { actor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(85)); } } if (Random.value <= 0.01f) { if (GameManager.Instance.PrimaryPlayer.HasPickupID(641)) { actor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(74)); } else { actor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(641)); } } else if (Random.value <= 0.01f) { if (GameManager.Instance.PrimaryPlayer.HasPickupID(580)) { actor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(74)); } else { actor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(580)); } } } else if (actor.ActorName == "Junk Turkey") { if (BraveUtility.RandomBool()) { actor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(600)); } else { actor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(78)); } } } } } } Destroy(m_GlitchEnemyDatabase); return; }
public static void InitFlow() { for (int i = 0; i < LoopRoomCount + 1; i++) { m_cachedNodes_01.Add(ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Custom_GlitchChestAlt_Flow, PrototypeDungeonRoom.RoomCategory.NORMAL)); m_cachedNodes_04.Add(ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Custom_GlitchChestAlt_Flow, PrototypeDungeonRoom.RoomCategory.NORMAL)); } for (int i = 0; i < SingleChainRoomCount + 1; i++) { m_cachedNodes_02.Add(ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Custom_GlitchChestAlt_Flow, PrototypeDungeonRoom.RoomCategory.NORMAL)); m_cachedNodes_03.Add(ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Custom_GlitchChestAlt_Flow, PrototypeDungeonRoom.RoomCategory.NORMAL)); } m_cachedNodes_01[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_01[LoopRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_02[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_02[SingleChainRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_03[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_03[SingleChainRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_04[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_04[LoopRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; bool bossShuffle = BraveUtility.RandomBool(); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.name = "Custom_GlitchChestAlt_Flow"; ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.fallbackRoomTable = ChaosPrefabs.CustomRoomTableNoCastle; ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.subtypeRestrictions = new List <DungeonFlowSubtypeRestriction>() { ChaosDungeonFlows.BaseSubTypeRestrictions }; ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.flowInjectionData = new List <ProceduralFlowModifierData>(0); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.sharedInjectionData = new List <SharedInjectionData>() { ChaosDungeonFlows.BaseSharedInjectionData }; ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.Initialize(); // Hub area ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_HubNode, null); // Big Entrance with first loop. ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_EntranceNode, m_HubNode); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_cachedNodes_01[0], m_HubNode); for (int i = 1; i < LoopRoomCount + 1; i++) { ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_cachedNodes_01[i], m_cachedNodes_01[i - 1]); } ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_ShopNode_01, m_cachedNodes_01[LoopRoomCount]); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_ChestRoom_01, m_ShopNode_01); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.LoopConnectNodes(m_HubNode, m_ChestRoom_01); // Maybe boss path. :P ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_cachedNodes_02[0], m_HubNode); for (int i = 1; i < SingleChainRoomCount + 1; i++) { ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_cachedNodes_02[i], m_cachedNodes_02[i - 1]); } ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_ChestRoom_02, m_cachedNodes_02[SingleChainRoomCount]); if (bossShuffle) { ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_BossFoyerNode, m_ChestRoom_02); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_BossNode, m_BossFoyerNode); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_ExitNode, m_BossNode); } else { ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_FakeBossFoyerNode, m_ChestRoom_02); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_FakeBossNode, m_FakeBossFoyerNode); } // Maybe boss path. :P ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_cachedNodes_03[0], m_EntranceNode); for (int i = 1; i < SingleChainRoomCount + 1; i++) { ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_cachedNodes_03[i], m_cachedNodes_03[i - 1]); } ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_ChestRoom_03, m_cachedNodes_03[SingleChainRoomCount]); if (bossShuffle) { ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_FakeBossFoyerNode, m_ChestRoom_03); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_FakeBossNode, m_FakeBossFoyerNode); } else { ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_BossFoyerNode, m_ChestRoom_03); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_BossNode, m_BossFoyerNode); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_ExitNode, m_BossNode); } // Second Loop ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_cachedNodes_04[0], m_EntranceNode); for (int i = 1; i < LoopRoomCount + 1; i++) { ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_cachedNodes_04[i], m_cachedNodes_04[i - 1]); } ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.AddNodeToFlow(m_ChestRoom_04, m_cachedNodes_04[LoopRoomCount]); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.LoopConnectNodes(m_ChestRoom_04, m_EntranceNode); ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.FirstNode = m_HubNode; }
private void PlaceWallMimics(Action <Dungeon, RoomHandler> orig, Dungeon dungeon, RoomHandler roomHandler) { // Used for debug read out information int NorthWallCount = 0; int SouthWallCount = 0; int EastWallCount = 0; int WestWallCount = 0; int WallMimicsPlaced = 0; int iterations = 0; if (ExpandTheGungeon.LogoEnabled && GameManager.Instance.CurrentLevelOverrideState != GameManager.LevelOverrideState.FOYER) { ExpandTheGungeon.LogoEnabled = false; } if (ExpandTheGungeon.GameManagerHook == null) { if (ExpandStats.debugMode) { Debug.Log("[ExpandTheGungeon] Installing GameManager.Awake Hook...."); } ExpandTheGungeon.GameManagerHook = new Hook( typeof(GameManager).GetMethod("Awake", BindingFlags.NonPublic | BindingFlags.Instance), typeof(ExpandTheGungeon).GetMethod("GameManager_Awake", BindingFlags.NonPublic | BindingFlags.Instance), typeof(GameManager) ); } ExpandStaticReferenceManager.ClearStaticPerLevelData(); ExpandStaticReferenceManager.PopulateLists(); try { int currentFloor = GameManager.Instance.CurrentFloor; int numWallMimicsForFloor = MetaInjectionData.GetNumWallMimicsForFloor(dungeon.tileIndices.tilesetId); GameManager.LevelOverrideState levelOverrideState = GameManager.Instance.CurrentLevelOverrideState; if (levelOverrideState != GameManager.LevelOverrideState.NONE | levelOverrideState == GameManager.LevelOverrideState.TUTORIAL) { if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] This floor has been excluded from having Wall Mimics", false); } return; } if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] Current Floor: " + currentFloor, false); ETGModConsole.Log("[DEBUG] Wall Mimics assigned by RewardManager: " + numWallMimicsForFloor, false); } SetupSecretDoorDestinations(dungeon); if (currentFloor < 4) { PlaceGlitchElevator(dungeon); } ExpandJunkEnemySpawneer m_ExpandJunkEnemySpawneer = new ExpandJunkEnemySpawneer(); m_ExpandJunkEnemySpawneer.PlaceRandomJunkEnemies(dungeon, roomHandler); m_ExpandJunkEnemySpawneer = null; if (dungeon.IsGlitchDungeon) { ETGMod.AIActor.OnPreStart = (Action <AIActor>)Delegate.Combine(ETGMod.AIActor.OnPreStart, new Action <AIActor>(EnemyModRandomizer)); } else { ETGMod.AIActor.OnPreStart = (Action <AIActor>)Delegate.Remove(ETGMod.AIActor.OnPreStart, new Action <AIActor>(EnemyModRandomizer)); } ExpandPlaceCorruptTiles m_CorruptTilePlayer = new ExpandPlaceCorruptTiles(); m_CorruptTilePlayer.PlaceCorruptTiles(dungeon); m_CorruptTilePlayer = null; ExpandFloorDecorator FloorDecorator = new ExpandFloorDecorator(); FloorDecorator.PlaceFloorDecoration(dungeon); FloorDecorator = null; if (numWallMimicsForFloor <= 0) { if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] There will be no Wall Mimics assigned to this floor.", false); } return; } if (levelOverrideState == GameManager.LevelOverrideState.RESOURCEFUL_RAT) { if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] The Resourceful Rat Maze has been excluded from having wall mimics.", false); } return; } if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] Wall Mimics Assigned to Floor: " + numWallMimicsForFloor, false); } List <int> roomList = Enumerable.Range(0, dungeon.data.rooms.Count).ToList(); roomList = roomList.Shuffle(); if (roomHandler != null) { roomList = new List <int>(new int[] { dungeon.data.rooms.IndexOf(roomHandler) }); } List <Tuple <IntVector2, DungeonData.Direction> > validWalls = new List <Tuple <IntVector2, DungeonData.Direction> >(); List <AIActor> enemiesList = new List <AIActor>(); while (iterations < roomList.Count && WallMimicsPlaced < numWallMimicsForFloor) { RoomHandler currentRoom = dungeon.data.rooms[roomList[iterations]]; if (!currentRoom.IsShop) { if (!currentRoom.area.IsProceduralRoom || currentRoom.area.proceduralCells == null) { if (currentRoom.area.PrototypeRoomCategory != PrototypeDungeonRoom.RoomCategory.BOSS || !BraveUtility.RandomBool()) { if (!currentRoom.GetRoomName().StartsWith("DraGunRoom") && !currentRoom.IsMaintenanceRoom() && !BannedWallMimicRoomList.Contains(currentRoom.GetRoomName().ToLower())) { if (currentRoom.connectedRooms != null) { for (int i = 0; i < currentRoom.connectedRooms.Count; i++) { if (currentRoom.connectedRooms[i] == null || currentRoom.connectedRooms[i].area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.BOSS) { } } } if (roomHandler == null) { bool MaxMimicCountReached = false; currentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All, ref enemiesList); for (int j = 0; j < enemiesList.Count; j++) { AIActor aiactor = enemiesList[j]; if (aiactor && aiactor.EnemyGuid == GameManager.Instance.RewardManager.WallMimicChances.EnemyGuid) { MaxMimicCountReached = true; break; } } if (MaxMimicCountReached) { goto IL_EXIT; } } validWalls.Clear(); 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) && X % 4 == 0 && Y % 4 == 0) { int WallCount = 0; if (!dungeon.data.isWall(X - 1, Y + 2) && !dungeon.data.isWall(X, Y + 2) && !dungeon.data.isWall(X + 1, Y + 2) && !dungeon.data.isWall(X + 2, Y + 2) && !dungeon.data.isWall(X - 1, Y + 1) && !dungeon.data.isWall(X, Y + 1) && !dungeon.data.isWall(X + 1, Y + 1) && !dungeon.data.isWall(X + 2, Y + 1) && dungeon.data.isWall(X - 1, Y) && dungeon.data.isWall(X, Y) && dungeon.data.isWall(X + 1, Y) && dungeon.data.isWall(X + 2, Y) && dungeon.data.isWall(X - 1, Y - 1) && dungeon.data.isWall(X, Y - 1) && dungeon.data.isWall(X + 1, Y - 1) && dungeon.data.isWall(X + 2, Y - 1) && !dungeon.data.isPlainEmptyCell(X - 1, Y - 3) && !dungeon.data.isPlainEmptyCell(X, Y - 3) && !dungeon.data.isPlainEmptyCell(X + 1, Y - 3) && !dungeon.data.isPlainEmptyCell(X + 2, Y - 3)) { validWalls.Add(Tuple.Create(new IntVector2(X, Y), DungeonData.Direction.NORTH)); WallCount++; SouthWallCount++; } else if (dungeon.data.isWall(X - 1, Y + 2) && dungeon.data.isWall(X, Y + 2) && dungeon.data.isWall(X + 1, Y + 2) && dungeon.data.isWall(X + 2, Y + 2) && dungeon.data.isWall(X - 1, Y + 1) && dungeon.data.isWall(X, Y + 1) && dungeon.data.isWall(X + 1, Y + 1) && dungeon.data.isWall(X + 2, Y + 1) && dungeon.data.isWall(X - 1, Y) && dungeon.data.isWall(X, Y) && dungeon.data.isWall(X + 1, Y) && dungeon.data.isWall(X + 2, Y) && dungeon.data.isPlainEmptyCell(X, Y - 1) && dungeon.data.isPlainEmptyCell(X + 1, Y - 1) && !dungeon.data.isPlainEmptyCell(X, Y + 4) && !dungeon.data.isPlainEmptyCell(X + 1, Y + 4)) { validWalls.Add(Tuple.Create(new IntVector2(X, Y), DungeonData.Direction.SOUTH)); WallCount++; NorthWallCount++; } else if (dungeon.data.isWall(X, Y + 2) && dungeon.data.isWall(X, Y + 1) && dungeon.data.isWall(X - 1, Y) && dungeon.data.isWall(X, Y - 1) && dungeon.data.isWall(X, Y - 2) && !dungeon.data.isPlainEmptyCell(X - 2, Y + 2) && !dungeon.data.isPlainEmptyCell(X - 2, Y + 1) && !dungeon.data.isPlainEmptyCell(X - 2, Y) && dungeon.data.isPlainEmptyCell(X + 1, Y) && dungeon.data.isPlainEmptyCell(X + 1, Y - 1) && !dungeon.data.isPlainEmptyCell(X - 2, Y - 1) && !dungeon.data.isPlainEmptyCell(X - 2, Y - 2)) { validWalls.Add(Tuple.Create(new IntVector2(X, Y), DungeonData.Direction.EAST)); WallCount++; WestWallCount++; } else if (dungeon.data.isWall(X, Y + 2) && dungeon.data.isWall(X, Y + 1) && dungeon.data.isWall(X + 1, Y) && dungeon.data.isWall(X, Y - 1) && dungeon.data.isWall(X, Y - 2) && !dungeon.data.isPlainEmptyCell(X + 2, Y + 2) && !dungeon.data.isPlainEmptyCell(X + 2, Y + 1) && !dungeon.data.isPlainEmptyCell(X + 2, Y) && dungeon.data.isPlainEmptyCell(X - 1, Y) && dungeon.data.isPlainEmptyCell(X - 1, Y - 1) && !dungeon.data.isPlainEmptyCell(X + 2, Y - 1) && !dungeon.data.isPlainEmptyCell(X + 2, Y - 2)) { validWalls.Add(Tuple.Create(new IntVector2(X - 1, Y), DungeonData.Direction.WEST)); WallCount++; EastWallCount++; } if (WallCount > 0) { bool flag2 = true; int XPadding = -5; while (XPadding <= 5 && flag2) { int YPadding = -5; while (YPadding <= 5 && flag2) { int x = X + XPadding; int y = Y + YPadding; if (dungeon.data.CheckInBoundsAndValid(x, y)) { CellData cellData = dungeon.data[x, y]; if (cellData != null) { if (cellData.type == CellType.PIT || cellData.diagonalWallType != DiagonalWallType.NONE) { flag2 = false; } } } YPadding++; } XPadding++; } if (!flag2) { while (WallCount > 0) { validWalls.RemoveAt(validWalls.Count - 1); WallCount--; } } } } } } if (roomHandler == null) { if (validWalls.Count > 0) { Tuple <IntVector2, DungeonData.Direction> WallCell = BraveUtility.RandomElement(validWalls); IntVector2 Position = WallCell.First; DungeonData.Direction Direction = WallCell.Second; if (Direction != DungeonData.Direction.WEST) { currentRoom.RuntimeStampCellComplex(Position.x, Position.y, CellType.FLOOR, DiagonalWallType.NONE); } if (Direction != DungeonData.Direction.EAST) { currentRoom.RuntimeStampCellComplex(Position.x + 1, Position.y, CellType.FLOOR, DiagonalWallType.NONE); } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(GameManager.Instance.RewardManager.WallMimicChances.EnemyGuid); AIActor.Spawn(orLoadByGuid, Position, currentRoom, true, AIActor.AwakenAnimationType.Default, true); validWalls.Remove(WallCell); WallMimicsPlaced++; } } } } } } IL_EXIT: iterations++; } if (WallMimicsPlaced > 0) { PhysicsEngine.Instance.ClearAllCachedTiles(); if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] Number of Valid North Wall Mimics locations: " + NorthWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid South Wall Mimics locations: " + SouthWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid East Wall Mimics locations: " + EastWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid West Wall Mimics locations: " + WestWallCount, false); ETGModConsole.Log("[DEBUG] Number of Wall Mimics succesfully placed: " + WallMimicsPlaced, false); } } } catch (Exception ex) { if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] Exception occured in Dungeon.PlaceWallMimics!"); } Debug.Log("Exception caught in Dungeon.PlaceWallMimics!"); Debug.LogException(ex); if (WallMimicsPlaced > 0) { PhysicsEngine.Instance.ClearAllCachedTiles(); if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] Number of Valid North Wall Mimics locations: " + NorthWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid South Wall Mimics locations: " + SouthWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid East Wall Mimics locations: " + EastWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid West Wall Mimics locations: " + WestWallCount, false); ETGModConsole.Log("[DEBUG] Number of Wall Mimics succesfully placed: " + WallMimicsPlaced, false); } } } }
private void SelfDestructOnKick() { int currentCurse = PlayerStats.GetTotalCurse(); int currentCoolness = PlayerStats.GetTotalCoolness(); float ExplodeOnKickChances = 0.25f; float ExplodeOnKickDamageToEnemies = 150f; bool ExplodeOnKickDamagesPlayer = BraveUtility.RandomBool(); if (willDefinitelyExplode) { ExplodeOnKickChances = 1f; ExplodeOnKickDamagesPlayer = false; ExplodeOnKickDamageToEnemies = 200f; } else { if (currentCoolness >= 3) { ExplodeOnKickDamagesPlayer = false; ExplodeOnKickDamageToEnemies = 175f; } if (currentCurse >= 3) { ExplodeOnKickChances = 0.35f; ExplodeOnKickDamageToEnemies = 200f; } } if (spawnObjectOnSelfDestruct && SpawnedObject != null && !m_objectSpawned) { m_objectSpawned = true; GameObject PlacedGlitchObject = ChaosUtility.GenerateDungeonPlacable(SpawnedObject, false, true).InstantiateObject(transform.position.GetAbsoluteRoom(), (specRigidbody.GetUnitCenter(ColliderType.HitBox) - transform.position.GetAbsoluteRoom().area.basePosition.ToVector2()).ToIntVector2(VectorConversions.Floor)); PlacedGlitchObject.transform.parent = transform.position.GetAbsoluteRoom().hierarchyParent; if (PlacedGlitchObject.GetComponent <PickupObject>() != null) { PickupObject PlacedGltichObjectComponent = PlacedGlitchObject.GetComponent <PickupObject>(); PlacedGltichObjectComponent.RespawnsIfPitfall = true; } } if (UnityEngine.Random.value <= ExplodeOnKickChances) { if (useDefaultExplosion) { Exploder.DoDefaultExplosion(specRigidbody.GetUnitCenter(ColliderType.HitBox), Vector2.zero, null, true, CoreDamageTypes.None); Exploder.DoRadialDamage(ExplodeOnKickDamageToEnemies, sprite.WorldCenter, 4f, ExplodeOnKickDamagesPlayer, true, true); } else { Exploder.Explode(specRigidbody.GetUnitCenter(ColliderType.HitBox), TableExplosionData, Vector2.zero, null, false, CoreDamageTypes.None, false); } /*if (gameObject.GetComponent<FlippableCover>() != null) { * FlippableCover flippableCover = gameObject.GetComponent<FlippableCover>(); * flippableCover.DestroyCover(); * } else if (gameObject.GetComponent<MajorBreakable>() != null) { * MajorBreakable majorBreakableComponent = gameObject.GetComponent<MajorBreakable>(); * if (m_lastDirectionKicked.HasValue) { * majorBreakableComponent.Break(m_lastDirectionKicked.Value.ToVector2()); * } else { * majorBreakableComponent.Break(new Vector2(0, 0)); * } * } else if (gameObject.GetComponent<MinorBreakable>() != null) { * MinorBreakable minorBreakableComponent = gameObject.GetComponent<MinorBreakable>(); * minorBreakableComponent.Break(); * } else { * Destroy(gameObject); * }*/ Destroy(gameObject); return; } return; }
public void PlaceWallMimics(Action <Dungeon, RoomHandler> orig, Dungeon dungeon, RoomHandler roomHandler) { int WallMimicsPlaced = 0; int WallMimicsPerRoom = 1; int numWallMimicsForFloor = MetaInjectionData.GetNumWallMimicsForFloor(dungeon.tileIndices.tilesetId); int currentFloor = GameManager.Instance.CurrentFloor; if (roomHandler != null) { goto IL_SKIP; } if (ExpandTheGungeon.LogoEnabled && GameManager.Instance.CurrentLevelOverrideState != GameManager.LevelOverrideState.FOYER) { ExpandTheGungeon.LogoEnabled = false; } if (GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.FOYER) { ExpandSettings.phobosElevatorHasBeenUsed = false; ExpandSettings.elevatorHasBeenUsed = false; } ExpandStaticReferenceManager.PopulateLists(); GameManager.LevelOverrideState levelOverrideState = GameManager.Instance.CurrentLevelOverrideState; if (ExpandSettings.debugMode) { ETGModConsole.Log("[DEBUG] Current Floor: " + currentFloor, false); } try { if (ExpandTheGungeon.GameManagerHook == null) { if (ExpandSettings.debugMode) { Debug.Log("[ExpandTheGungeon] Installing GameManager.Awake Hook...."); } ExpandTheGungeon.GameManagerHook = new Hook( typeof(GameManager).GetMethod("Awake", BindingFlags.NonPublic | BindingFlags.Instance), typeof(ExpandTheGungeon).GetMethod("GameManager_Awake", BindingFlags.NonPublic | BindingFlags.Instance), typeof(GameManager) ); } if (ExpandSettings.debugMode) { ETGModConsole.Log("[DEBUG] Number of Wall Mimics RewardManager wants to spawn: " + numWallMimicsForFloor, false); } if (levelOverrideState != GameManager.LevelOverrideState.NONE | levelOverrideState == GameManager.LevelOverrideState.TUTORIAL | levelOverrideState == GameManager.LevelOverrideState.FOYER | dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.RATGEON) { if (ExpandSettings.debugMode) { ETGModConsole.Log("[DEBUG] This floor has been excluded from having Wall Mimics", false); } if (ExpandSettings.debugMode && dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.RATGEON) { ETGModConsole.Log("[DEBUG] The Resourceful Rat Maze/tileset has been excluded from having wall mimics and other floor mods!", false); } return; } if (dungeon.data == null | dungeon.data.rooms.Count <= 0) { if (ExpandSettings.debugMode) { ETGModConsole.Log("Dungeon has no rooms or Dungeon.data is null! This is super abnormal!", false); } return; } PlaceGlitchElevator(dungeon, currentFloor); ExpandJunkEnemySpawneer.PlaceRandomJunkEnemies(dungeon, roomHandler); if (ExpandSettings.EnableExpandedGlitchFloors) { if (dungeon.IsGlitchDungeon) { ETGMod.AIActor.OnPreStart = (Action <AIActor>)Delegate.Combine(ETGMod.AIActor.OnPreStart, new Action <AIActor>(EnemyModRandomizer)); } else { ETGMod.AIActor.OnPreStart = (Action <AIActor>)Delegate.Remove(ETGMod.AIActor.OnPreStart, new Action <AIActor>(EnemyModRandomizer)); } ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon); } ExpandFloorDecorator.PlaceFloorDecoration(dungeon); if (PlayerHasCorruptedJunk) { CorruptRandomRooms(dungeon, currentFloor); } } catch (Exception ex) { if (ExpandSettings.debugMode) { ETGModConsole.Log("[DEBUG] Exception caught in early setup code for ExpandMain.ExpandPlaceWallMimics!"); } Debug.Log("Exception caught in early setup code for ExpandMain.ExpandPlaceWallMimics!"); Debug.LogException(ex); } if (numWallMimicsForFloor <= 0 && !PlayerHasWallMimicItem) { if (ExpandSettings.debugMode) { ETGModConsole.Log("[DEBUG] There will be no Wall Mimics for this floor.", false); } PhysicsEngine.Instance.ClearAllCachedTiles(); return; } IL_SKIP: if (roomHandler != null) { if (ExpandSettings.debugMode) { ETGModConsole.Log("[DEBUG] Wall Mimics Assigned to specific room: " + numWallMimicsForFloor, false); } if (SpawnWallMimic(dungeon, roomHandler) == 0) { if (ExpandSettings.debugMode) { ETGModConsole.Log("[DEBUG] Failed to find valid locations for a Wall Mimic in room: " + numWallMimicsForFloor + "!", false); } } } else { List <RoomHandler> RoomList = new List <RoomHandler>(); foreach (RoomHandler room in dungeon.data.rooms) { if (room.area != null && !room.IsShop && !room.PrecludeTilemapDrawing && !string.IsNullOrEmpty(room.GetRoomName()) && room.area.PrototypeRoomCategory != PrototypeDungeonRoom.RoomCategory.SECRET) { if (!room.area.IsProceduralRoom || room.area.proceduralCells == null) { if (room.area.PrototypeRoomCategory != PrototypeDungeonRoom.RoomCategory.BOSS || !BraveUtility.RandomBool()) { if (!room.GetRoomName().StartsWith("DraGunRoom") && !room.IsMaintenanceRoom() && !BannedWallMimicRoomList.Contains(room.GetRoomName().ToLower())) { RoomList.Add(room); } } } } } int ValidRooms = RoomList.Count; int RoomsChecked = 0; if (PlayerHasWallMimicItem) { switch (dungeon.tileIndices.tilesetId) { case GlobalDungeonData.ValidTilesets.CATHEDRALGEON: WallMimicsPerRoom = 2; break; case GlobalDungeonData.ValidTilesets.BELLYGEON: WallMimicsPerRoom = 2; break; case GlobalDungeonData.ValidTilesets.CATACOMBGEON: WallMimicsPerRoom = 2; break; case GlobalDungeonData.ValidTilesets.OFFICEGEON: WallMimicsPerRoom = 2; break; case GlobalDungeonData.ValidTilesets.WESTGEON: WallMimicsPerRoom = 2; break; case GlobalDungeonData.ValidTilesets.FORGEGEON: WallMimicsPerRoom = 2; break; case GlobalDungeonData.ValidTilesets.HELLGEON: WallMimicsPerRoom = 3; break; default: WallMimicsPerRoom = 1; break; } numWallMimicsForFloor = (ValidRooms * WallMimicsPerRoom); if (ExpandSettings.debugMode) { ETGModConsole.Log("[DEBUG] Wall Mimics assigned by Cursed Bricks: " + (ValidRooms * WallMimicsPerRoom), false); } } IL_CHECKNEXTROOM: if (WallMimicsPlaced >= numWallMimicsForFloor | RoomList.Count <= 0 | RoomsChecked >= ValidRooms) { if (ExpandSettings.debugMode) { ETGModConsole.Log("[DEBUG] All valid rooms for Wall Mimics have been checked. Placement complete."); ETGModConsole.Log("[DEBUG] Wall Mimics Succewsfully Placed: " + WallMimicsPlaced); } PhysicsEngine.Instance.ClearAllCachedTiles(); return; } if (RoomList.Count > 1) { RoomList = RoomList.Shuffle(); } RoomHandler CurrentRoom = BraveUtility.RandomElement(RoomList); RoomList.Remove(CurrentRoom); RoomsChecked++; WallMimicsPlaced += SpawnWallMimic(dungeon, CurrentRoom, WallMimicsPerRoom); if (RoomsChecked < ValidRooms && WallMimicsPlaced < numWallMimicsForFloor) { goto IL_CHECKNEXTROOM; } } if (ExpandSettings.debugMode) { ETGModConsole.Log("[DEBUG] All valid rooms for Wall Mimics have been checked. Placement complete."); ETGModConsole.Log("[DEBUG] Wall Mimics Succewsfully Placed: " + WallMimicsPlaced); } PhysicsEngine.Instance.ClearAllCachedTiles(); }
private void TransitionToDepart(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip) { GameManager.Instance.MainCameraController.DoDelayedScreenShake(departureShake, 0.25f, null); if (!m_depatureIsPlayerless) { for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++) { GameManager.Instance.AllPlayers[i].PrepareForSceneTransition(); } float delay = 0.5f; Pixelator.Instance.FadeToBlack(delay, false, 0f); GameUIRoot.Instance.HideCoreUI(string.Empty); GameUIRoot.Instance.ToggleLowerPanels(false, false, string.Empty); if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.SUPERBOSSRUSH) { GameManager.Instance.DelayedLoadBossrushFloor(delay); } else if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.BOSSRUSH) { GameManager.Instance.DelayedLoadBossrushFloor(delay); } else { if (!GameManager.Instance.IsFoyer && GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.NONE) { GlobalDungeonData.ValidTilesets nextTileset = GameManager.Instance.GetNextTileset(GameManager.Instance.Dungeon.tileIndices.tilesetId); GameManager.DoMidgameSave(nextTileset); } if (IsGlitchElevator) { ExpandSettings.elevatorHasBeenUsed = true; GameManager.Instance.StartCoroutine(ExpandUtility.DelayedGlitchLevelLoad(delay, BraveUtility.RandomElement(ExpandDungeonFlow.GlitchChestFlows), BraveUtility.RandomBool())); } else if (UsesOverrideTargetFloor) { GlobalDungeonData.ValidTilesets overrideTargetFloor = OverrideTargetFloor; if (!string.IsNullOrEmpty(OverrideTargetFlorDungeonFlow)) { GameManager.Instance.InjectedFlowPath = OverrideTargetFlorDungeonFlow; } switch (overrideTargetFloor) { case GlobalDungeonData.ValidTilesets.CASTLEGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_castle"); break; case GlobalDungeonData.ValidTilesets.SEWERGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_sewer"); break; case GlobalDungeonData.ValidTilesets.JUNGLEGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_jungle"); break; case GlobalDungeonData.ValidTilesets.GUNGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt5"); break; case GlobalDungeonData.ValidTilesets.CATHEDRALGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_cathedral"); break; case GlobalDungeonData.ValidTilesets.BELLYGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_belly"); break; case GlobalDungeonData.ValidTilesets.MINEGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_mines"); break; case GlobalDungeonData.ValidTilesets.RATGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "ss_resourcefulrat"); break; case GlobalDungeonData.ValidTilesets.CATACOMBGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_catacombs"); break; case GlobalDungeonData.ValidTilesets.OFFICEGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_nakatomi"); break; case GlobalDungeonData.ValidTilesets.WESTGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_west"); break; case GlobalDungeonData.ValidTilesets.FORGEGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_forge"); break; case GlobalDungeonData.ValidTilesets.HELLGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_bullethell"); break; case GlobalDungeonData.ValidTilesets.SPACEGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_space"); break; case GlobalDungeonData.ValidTilesets.PHOBOSGEON: GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_phobos"); break; case GlobalDungeonData.ValidTilesets.FINALGEON: // Use FINALGEON to specify a name that does not have a matching tilesetID GameManager.Instance.DelayedLoadCustomLevel(delay, OverrideExactLevelName); break; } } else { GameManager.Instance.DelayedLoadNextLevel(delay); } AkSoundEngine.PostEvent("Stop_MUS_All", gameObject); } } elevatorFloor.SetActive(false); animator.AnimationCompleted = (Action <tk2dSpriteAnimator, tk2dSpriteAnimationClip>)Delegate.Remove(animator.AnimationCompleted, new Action <tk2dSpriteAnimator, tk2dSpriteAnimationClip>(TransitionToDepart)); animator.PlayAndDisableObject(elevatorDepartAnimName, null); }
public void InitSpecialMods() { if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CASTLEGEON) { List <AGDEnemyReplacementTier> m_cachedReplacementTiers = GameManager.Instance.EnemyReplacementTiers; // Removes special enemies added after the secret floor for (int i = 0; i < m_cachedReplacementTiers.Count; i++) { if (m_cachedReplacementTiers[i].Name.ToLower().EndsWith("_Forge") | m_cachedReplacementTiers[i].Name.ToLower().EndsWith("_Hell")) { m_cachedReplacementTiers.Remove(m_cachedReplacementTiers[i]); } } } if (ChaosDungeonFlows.Custom_GlitchChest_Flow.sharedInjectionData.Count > 0) { ChaosDungeonFlows.Custom_GlitchChest_Flow.sharedInjectionData.Clear(); } if (ChaosDungeonFlows.Custom_Glitch_Flow.sharedInjectionData.Count > 0) { ChaosDungeonFlows.Custom_Glitch_Flow.sharedInjectionData.Clear(); } if (ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.sharedInjectionData.Count > 0) { ChaosDungeonFlows.Custom_GlitchChestAlt_Flow.sharedInjectionData.Clear(); } if (ChaosGlitchMod.isGlitchFloor && GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.PHOBOSGEON) { StartCoroutine(secretglitchfloor_flow.InitCustomObjects(UnityEngine.Random.value, BraveUtility.RandomBool(), BraveUtility.RandomBool())); } InitObjectMods(GameManager.Instance.Dungeon); ChaosDungeonFlows.isGlitchFlow = false; ChaosGlitchMod.isGlitchFloor = false; }
private IEnumerator DoRickRoll() { yield return(new WaitForSeconds(0.1f)); GameObject m_RickRollInstance = Instantiate(RickRollAnimationObject, (transform.position + new Vector3(0.1f, 0.5f, 0)), Quaternion.identity); Vector3 RickScale = new Vector2(0.2f, 0.2f).ToVector3ZUp(1f); m_RickRollInstance.layer = LayerMask.NameToLayer("Unpixelated"); m_RickRollInstance.transform.localScale = RickScale; if (majorBreakable) { majorBreakable.TemporarilyInvulnerable = true; } if (sprite) { sprite.HeightOffGround = -2f; sprite.UpdateZDepth(); } tk2dSpriteAnimator m_RickRollAnimator = m_RickRollInstance.GetComponent <tk2dSpriteAnimator>(); m_RickRollAnimator.Play("RickRollAnimation_Rise"); while (m_RickRollAnimator.IsPlaying("RickRollAnimation_Rise")) { yield return(null); } m_RickRollAnimator.Play("RickRollAnimation"); if (!ExpandSettings.youtubeSafeMode) { AkSoundEngine.PostEvent("Play_EX_RickRollMusic_01", gameObject); } else { GameManager.Instance.StartCoroutine(DoYouTubeSafeAnnouncement(new Vector3(1.5f, 3.5f))); } yield return(new WaitForSeconds(10)); Destroy(m_RickRollInstance); if (majorBreakable) { majorBreakable.TemporarilyInvulnerable = false; } yield return(null); spriteAnimator.Play(breakAnimName); specRigidbody.enabled = false; IsBroken = true; Transform shadowTransform = transform.Find("Expand_RickRollChestShadow"); if (shadowTransform != null) { Destroy(shadowTransform.gameObject); } if (m_room.npcSealState != RoomHandler.NPCSealState.SealNone) { m_room.npcSealState = RoomHandler.NPCSealState.SealNone; } Exploder.DoDefaultExplosion(sprite.WorldCenter, Vector2.zero, null, true, CoreDamageTypes.None, false); yield return(null); PickupObject.ItemQuality targetQuality = (UnityEngine.Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.B : PickupObject.ItemQuality.C) : PickupObject.ItemQuality.B; GenericLootTable lootTable = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable; PickupObject item = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetQuality, lootTable, false); if (item) { LootEngine.SpawnItem(item.gameObject, sprite.WorldCenter, Vector2.zero, 0f, true, true, false); } yield break; }
private void EnemyModRandomizer(AIActor targetActor) { // Finding too many issues being caused with Bosses to allow shader modifications on them. if (targetActor.healthHaver != null && targetActor.healthHaver.IsBoss) { return; } bool hasAltSkin = false; bool hasShader = false; if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.PHOBOSGEON) { if (targetActor.EnemyGuid == "ba928393c8ed47819c2c5f593100a5bc") { ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: ChaosPrefabs.StoneCubeCollection_West); } } if (ChaosConsole.isHardMode | ChaosConsole.isUltraMode) { if (ChaosLists.PreventBeingJammedOverrideList.Contains(targetActor.EnemyGuid)) { targetActor.PreventBlackPhantom = true; } if (ChaosLists.PreventDeathOnBossKillList.Contains(targetActor.EnemyGuid)) { targetActor.PreventAutoKillOnBossDeath = true; } if (targetActor.EnemyGuid == "eeb33c3a5a8e4eaaaaf39a743e8767bc") { targetActor.AlwaysShowOffscreenArrow = true; } if ((targetActor.EnemyGuid == "128db2f0781141bcb505d8f00f9e4d47" | targetActor.EnemyGuid == "b54d89f9e802455cbb2b8a96a31e8259") && UnityEngine.Random.value < 0.3f) { if (RedShotGunMan.BootlegRedShotGunManCollection == null) { RedShotGunMan.Init(); } targetActor.optionalPalette = null; targetActor.procedurallyOutlined = false; targetActor.sprite.OverrideMaterialMode = tk2dBaseSprite.SpriteMaterialOverrideMode.NONE; targetActor.sprite.renderer.material.SetTexture("_PaletteTex", null); FieldInfo field = typeof(AIActor).GetField("m_isPaletteSwapped", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(targetActor, false); if (targetActor.EnemyGuid == "128db2f0781141bcb505d8f00f9e4d47") { ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: RedShotGunMan.BootlegRedShotGunManCollection); } else { ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: BlueShotGunMan.BootlegBlueShotGunManCollection); } targetActor.OverrideDisplayName = ("Bootleg " + targetActor.GetActorName()); targetActor.ActorName += "ALT"; hasAltSkin = true; return; } if ((targetActor.EnemyGuid == "01972dee89fc4404a5c408d50007dad5" | targetActor.EnemyGuid == "db35531e66ce41cbb81d507a34366dfe") && UnityEngine.Random.value < 0.3f) { float Selector = UnityEngine.Random.Range(0, 3); if (Selector < 1) { if (BulletMan.BootlegBulletManCollection == null) { BulletMan.Init(targetActor); } ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: ChaosPrefabs.BulletManMonochromeCollection, overrideShader: ShaderCache.Acquire("tk2d/BlendVertexColorUnlitTilted")); targetActor.OverrideDisplayName = ("1-Bit " + targetActor.GetActorName()); targetActor.ActorName += "ALT"; hasAltSkin = true; return; } else if (Selector >= 1) { ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: ChaosPrefabs.BulletManUpsideDownCollection); targetActor.OverrideDisplayName = ("Bizarro " + targetActor.GetActorName()); targetActor.ActorName += "ALT"; hasAltSkin = true; return; } else if (Selector >= 2) { ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: BulletMan.BootlegBulletManCollection, overrideShader: ShaderCache.Acquire("tk2d/BlendVertexColorUnlitTilted")); targetActor.OverrideDisplayName = ("Bootleg " + targetActor.GetActorName()); targetActor.ActorName += "ALT"; hasAltSkin = true; return; } return; } if (targetActor.EnemyGuid == "88b6b6a93d4b4234a67844ef4728382c" && UnityEngine.Random.value < 0.32f) { if (BulletManBandana.BootlegBulletManBandanaCollection == null) { BulletManBandana.Init(targetActor); } ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: BulletManBandana.BootlegBulletManBandanaCollection, overrideShader: ShaderCache.Acquire("tk2d/BlendVertexColorUnlitTilted")); targetActor.OverrideDisplayName = ("Bootleg " + targetActor.GetActorName()); targetActor.ActorName += "ALT"; hasAltSkin = true; return; } if (targetActor.EnemyGuid == "14ea47ff46b54bb4a98f91ffcffb656d" && BraveUtility.RandomBool()) { if (RatGrenade.RatGrenadeCollection == null) { RatGrenade.Init(targetActor); } ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: RatGrenade.RatGrenadeCollection); targetActor.healthHaver.gameObject.AddComponent <ChaosExplodeOnDeath>(); ExplodeOnDeath RatExplodeComponent = targetActor.healthHaver.gameObject.GetComponent <ExplodeOnDeath>(); RatExplodeComponent.explosionData = EnemyDatabase.GetOrLoadByGuid("b4666cb6ef4f4b038ba8924fd8adf38f").gameObject.GetComponent <ExplodeOnDeath>().explosionData; RatExplodeComponent.deathType = OnDeathBehavior.DeathType.Death; RatExplodeComponent.triggerName = string.Empty; RatExplodeComponent.immuneToIBombApp = false; RatExplodeComponent.LinearChainExplosion = false; RatExplodeComponent.LinearChainExplosionData = EnemyDatabase.GetOrLoadByGuid("b4666cb6ef4f4b038ba8924fd8adf38f").gameObject.GetComponent <ExplodeOnDeath>().LinearChainExplosionData; targetActor.CorpseObject = null; hasAltSkin = true; return; } if (targetActor.EnemyGuid == "2feb50a6a40f4f50982e89fd276f6f15" && BraveUtility.RandomBool()) { if (Bullat.BootlegBullatCollection == null) { Bullat.Init(targetActor); } ChaosUtility.ApplyCustomTexture(targetActor, prebuiltCollection: Bullat.BootlegBullatCollection); AIActor TinyBlobulord = EnemyDatabase.GetOrLoadByGuid("d1c9781fdac54d9e8498ed89210a0238"); targetActor.behaviorSpeculator.OtherBehaviors = TinyBlobulord.behaviorSpeculator.OtherBehaviors; targetActor.behaviorSpeculator.TargetBehaviors = TinyBlobulord.behaviorSpeculator.TargetBehaviors; targetActor.behaviorSpeculator.OverrideBehaviors = TinyBlobulord.behaviorSpeculator.OverrideBehaviors; targetActor.behaviorSpeculator.AttackBehaviors = TinyBlobulord.behaviorSpeculator.AttackBehaviors; targetActor.behaviorSpeculator.MovementBehaviors = TinyBlobulord.behaviorSpeculator.MovementBehaviors; targetActor.DiesOnCollison = true; targetActor.procedurallyOutlined = false; targetActor.OverrideDisplayName = ("Bootleg " + targetActor.GetActorName()); hasAltSkin = true; return; } if (!hasAltSkin && targetActor.EnemyGuid != "5e0af7f7d9de4755a68d2fd3bbc15df4") { if (UnityEngine.Random.value <= 0.2f && !targetActor.IsBlackPhantom) { ChaosShaders.Instance.BecomeHologram(targetActor, BraveUtility.RandomBool()); hasShader = true; return; } else if (UnityEngine.Random.value <= 0.16f && !targetActor.IsBlackPhantom) { ChaosShaders.Instance.ApplySpaceShader(targetActor.sprite); hasShader = true; return; } else if (UnityEngine.Random.value <= 0.15f && !targetActor.IsBlackPhantom) { ChaosShaders.Instance.BecomeRainbow(targetActor); hasShader = true; return; } else if (UnityEngine.Random.value <= 0.1f && !targetActor.IsBlackPhantom) { ChaosShaders.Instance.BecomeCosmicHorror(targetActor.sprite); hasShader = true; return; } else if (UnityEngine.Random.value <= 0.065f && !targetActor.IsBlackPhantom) { ChaosShaders.Instance.BecomeGalaxy(targetActor.sprite); hasShader = true; return; } } } if (!hasAltSkin && !hasShader && ChaosConsole.GlitchEnemies && targetActor.EnemyGuid != "5e0af7f7d9de4755a68d2fd3bbc15df4" && !targetActor.IsBlackPhantom && UnityEngine.Random.value <= ChaosConsole.GlitchRandomActors) { float RandomIntervalFloat = UnityEngine.Random.Range(0.02f, 0.06f); float RandomDispFloat = UnityEngine.Random.Range(0.1f, 0.16f); float RandomDispIntensityFloat = UnityEngine.Random.Range(0.1f, 0.4f); float RandomColorProbFloat = UnityEngine.Random.Range(0.05f, 0.2f); float RnadomColorIntensityFloat = UnityEngine.Random.Range(0.1f, 0.25f); if (!targetActor.sprite.usesOverrideMaterial && !ChaosLists.DontGlitchMeList.Contains(targetActor.EnemyGuid)) { ChaosShaders.Instance.BecomeGlitched(targetActor, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RnadomColorIntensityFloat); if (!targetActor.healthHaver.IsBoss && !ChaosLists.blobsAndCritters.Contains(targetActor.EnemyGuid) && targetActor.GetComponent <ChaosSpawnGlitchObjectOnDeath>() == null) { if (UnityEngine.Random.value <= 0.25) { targetActor.gameObject.AddComponent <ChaosSpawnGlitchObjectOnDeath>(); } } ChaosGlitchedEnemies.GlitchExistingEnemy(targetActor); if (!ChaosConsole.randomEnemySizeEnabled) { if (targetActor.healthHaver != null) { if (!targetActor.healthHaver.IsBoss) { targetActor.healthHaver.SetHealthMaximum(targetActor.healthHaver.GetMaxHealth() / 1.5f, null, false); } else { targetActor.healthHaver.SetHealthMaximum(targetActor.healthHaver.GetMaxHealth() / 1.25f, null, false); } } } if (UnityEngine.Random.value <= 0.1f && targetActor.EnemyGuid != "4d37ce3d666b4ddda8039929225b7ede" && targetActor.EnemyGuid != "19b420dec96d4e9ea4aebc3398c0ba7a" && targetActor.GetComponent <ExplodeOnDeath>() == null && targetActor.GetComponent <ChaosSpawnGlitchObjectOnDeath>() == null && targetActor.GetComponent <ChaosSpawnGlitchEnemyOnDeath>() == null) { try { targetActor.gameObject.AddComponent <ChaosExplodeOnDeath>(); } catch (Exception) { } } } return; } }
public static DungeonFlow Apache_Fucking_Around_Flow() { DungeonFlowSubtypeRestriction m_SubTypeRestrictions = new DungeonFlowSubtypeRestriction() { baseCategoryRestriction = PrototypeDungeonRoom.RoomCategory.NORMAL, normalSubcategoryRestriction = PrototypeDungeonRoom.RoomNormalSubCategory.TRAP, bossSubcategoryRestriction = PrototypeDungeonRoom.RoomBossSubCategory.FLOOR_BOSS, specialSubcategoryRestriction = PrototypeDungeonRoom.RoomSpecialSubCategory.UNSPECIFIED_SPECIAL, secretSubcategoryRestriction = PrototypeDungeonRoom.RoomSecretSubCategory.UNSPECIFIED_SECRET, maximumRoomsOfSubtype = 1 }; DungeonFlow m_CachedFlow = ScriptableObject.CreateInstance <DungeonFlow>(); bool SecretRoomSelector = BraveUtility.RandomBool(); m_CachedFlow.name = "Apache_Fucking_Around_Flow"; m_CachedFlow.fallbackRoomTable = ExpandPrefabs.CustomRoomTable2; m_CachedFlow.subtypeRestrictions = new List <DungeonFlowSubtypeRestriction>() { m_SubTypeRestrictions }; m_CachedFlow.flowInjectionData = new List <ProceduralFlowModifierData>(0); m_CachedFlow.sharedInjectionData = new List <SharedInjectionData>(0); m_CachedFlow.Initialize(); DungeonFlowNode m_EntranceNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.ENTRANCE, ExpandPrefabs.elevator_entrance); DungeonFlowNode m_ExitNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.EXIT, ExpandPrefabs.tiny_exit); DungeonFlowNode m_BossNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.BOSS, ExpandPrefabs.doublebeholsterroom01); DungeonFlowNode m_BossFoyerNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ExpandPrefabs.boss_foyer); // First chain of nodes starting off Entrance DungeonFlowNode m_ConnectorNode_01 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR); DungeonFlowNode m_ConnectorNode_02 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR); DungeonFlowNode m_ConnectorNode_03 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR); DungeonFlowNode m_ConnectorNode_04 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR); DungeonFlowNode m_ShopNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.SPECIAL, overrideTable: ExpandPrefabs.shop_room_table); DungeonFlowNode m_HubNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.HUB); DungeonFlowNode m_RewardNode_01 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ExpandPrefabs.reward_room); DungeonFlowNode m_RewardNode_02 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ExpandPrefabs.reward_room); DungeonFlowNode m_RewardNode_03 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ExpandPrefabs.gungeon_rewardroom_1); DungeonFlowNode m_NormalNode_01 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_NormalNode_02 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_NormalNode_03 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_NormalNode_04 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_NormalNode_05 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_NormalNode_06 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_NormalNode_07 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_NormalNode_08 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_NormalNode_09 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_NormalNode_10 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_SecretNode_01 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.SECRET); DungeonFlowNode m_SecretNode_02 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.SECRET); DungeonFlowNode m_LoopTargetNormalNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL, oneWayLoopTarget: true); // Warp Wing chain DungeonFlowNode m_WarpWingConnectorNode_01 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ExpandRoomPrefabs.Expand_SecretElevatorDestinationRoom, isWarpWingNode: true); DungeonFlowNode m_WarpWingConnectorNode_02 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR); DungeonFlowNode m_WarpWingConnectorNode_03 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR); DungeonFlowNode m_WarpWingConnectorNode_04 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR); DungeonFlowNode m_WarpWingNormalNode_01 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_WarpWingNormalNode_02 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_WarpWingNormalNode_03 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL); DungeonFlowNode m_WarpWingRewardNode_01 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ExpandPrefabs.reward_room); // Assign special elevator entrance room to one of the two guranteed secret rooms on this flow. if (SecretRoomSelector) { m_SecretNode_01.overrideExactRoom = ExpandRoomPrefabs.Expand_SecretElevatorEntranceRoom; } else { m_SecretNode_02.overrideExactRoom = ExpandRoomPrefabs.Expand_SecretElevatorEntranceRoom; } m_CachedFlow.AddNodeToFlow(m_EntranceNode, null); m_CachedFlow.AddNodeToFlow(m_ConnectorNode_01, m_EntranceNode); m_CachedFlow.AddNodeToFlow(m_ConnectorNode_02, m_ConnectorNode_01); m_CachedFlow.AddNodeToFlow(m_ConnectorNode_03, m_ConnectorNode_02); // Shop node branching off first connector node m_CachedFlow.AddNodeToFlow(m_ShopNode, m_ConnectorNode_01); // Huh node. A chest node then normal node leading to boss room/exit with a normal node and loop nodes connected to exit. m_CachedFlow.AddNodeToFlow(m_HubNode, m_ConnectorNode_01); m_CachedFlow.AddNodeToFlow(m_RewardNode_01, m_HubNode); m_CachedFlow.AddNodeToFlow(m_NormalNode_01, m_HubNode); m_CachedFlow.AddNodeToFlow(m_BossFoyerNode, m_NormalNode_01); m_CachedFlow.AddNodeToFlow(m_BossNode, m_BossFoyerNode); m_CachedFlow.AddNodeToFlow(m_ExitNode, m_BossNode); m_CachedFlow.AddNodeToFlow(m_NormalNode_02, m_ExitNode); m_CachedFlow.AddNodeToFlow(m_LoopTargetNormalNode, m_ExitNode); m_CachedFlow.AddNodeToFlow(m_NormalNode_03, m_LoopTargetNormalNode); m_CachedFlow.AddNodeToFlow(m_RewardNode_02, m_NormalNode_03); // Connect end of this chain back to first node in loop chain. m_CachedFlow.LoopConnectNodes(m_RewardNode_02, m_LoopTargetNormalNode); // Branch of nodes that leads off hub to mainly normal rooms, a chest and a couple secret rooms. m_CachedFlow.AddNodeToFlow(m_NormalNode_04, m_HubNode); m_CachedFlow.AddNodeToFlow(m_NormalNode_05, m_NormalNode_04); m_CachedFlow.AddNodeToFlow(m_NormalNode_06, m_NormalNode_05); m_CachedFlow.AddNodeToFlow(m_NormalNode_07, m_NormalNode_06); m_CachedFlow.AddNodeToFlow(m_SecretNode_01, m_NormalNode_06); m_CachedFlow.AddNodeToFlow(m_NormalNode_08, m_NormalNode_05); m_CachedFlow.AddNodeToFlow(m_NormalNode_09, m_NormalNode_08); m_CachedFlow.AddNodeToFlow(m_NormalNode_10, m_NormalNode_09); m_CachedFlow.AddNodeToFlow(m_SecretNode_02, m_NormalNode_10); m_CachedFlow.AddNodeToFlow(m_RewardNode_03, m_NormalNode_10); // Warpwing CHain of nodes with 1 reward room m_CachedFlow.AddNodeToFlow(m_WarpWingConnectorNode_01, m_HubNode); m_CachedFlow.AddNodeToFlow(m_WarpWingNormalNode_01, m_WarpWingConnectorNode_01); m_CachedFlow.AddNodeToFlow(m_WarpWingRewardNode_01, m_WarpWingNormalNode_01); m_CachedFlow.AddNodeToFlow(m_WarpWingConnectorNode_02, m_WarpWingConnectorNode_01); m_CachedFlow.AddNodeToFlow(m_WarpWingNormalNode_02, m_WarpWingConnectorNode_02); m_CachedFlow.AddNodeToFlow(m_WarpWingConnectorNode_03, m_WarpWingNormalNode_02); m_CachedFlow.AddNodeToFlow(m_WarpWingConnectorNode_04, m_WarpWingConnectorNode_03); m_CachedFlow.AddNodeToFlow(m_WarpWingNormalNode_03, m_WarpWingConnectorNode_04); m_CachedFlow.FirstNode = m_EntranceNode; return(m_CachedFlow); }
public static DungeonFlow Custom_GlitchChestAlt_Flow() { DungeonFlow m_CachedFlow = ScriptableObject.CreateInstance <DungeonFlow>(); List <DungeonFlowNode> m_cachedNodes_01 = new List <DungeonFlowNode>(); List <DungeonFlowNode> m_cachedNodes_02 = new List <DungeonFlowNode>(); List <DungeonFlowNode> m_cachedNodes_03 = new List <DungeonFlowNode>(); List <DungeonFlowNode> m_cachedNodes_04 = new List <DungeonFlowNode>(); DungeonFlowNode m_EntranceNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.ENTRANCE, ExpandPrefabs.big_entrance); DungeonFlowNode m_HubNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.HUB); DungeonFlowNode m_ShopNode_01 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.SPECIAL, overrideTable: ExpandPrefabs.shop_room_table); DungeonFlowNode m_ChestRoom_01 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ExpandPrefabs.reward_room, oneWayLoopTarget: true); DungeonFlowNode m_ChestRoom_02 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.REWARD, ExpandPrefabs.gungeon_rewardroom_1); DungeonFlowNode m_ChestRoom_03 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.REWARD, ExpandPrefabs.gungeon_rewardroom_1); DungeonFlowNode m_ChestRoom_04 = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ExpandPrefabs.reward_room, oneWayLoopTarget: true); DungeonFlowNode m_ExitNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.EXIT, ExpandPrefabs.tiny_exit); DungeonFlowNode m_BossFoyerNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ExpandPrefabs.boss_foyer); DungeonFlowNode m_BossNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.BOSS, ExpandPrefabs.doublebeholsterroom01); DungeonFlowNode m_FakeBossNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.BOSS, ExpandPrefabs.tutorial_minibossroom); DungeonFlowNode m_FakeBossFoyerNode = ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ExpandPrefabs.boss_foyer); for (int i = 0; i < LoopRoomCount + 1; i++) { m_cachedNodes_01.Add(ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL)); m_cachedNodes_04.Add(ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL)); } for (int i = 0; i < SingleChainRoomCount + 1; i++) { m_cachedNodes_02.Add(ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL)); m_cachedNodes_03.Add(ExpandDungeonFlow.GenerateDefaultNode(m_CachedFlow, PrototypeDungeonRoom.RoomCategory.NORMAL)); } m_cachedNodes_01[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_01[LoopRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_02[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_02[SingleChainRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_03[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_03[SingleChainRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_04[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_04[LoopRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; bool bossShuffle = BraveUtility.RandomBool(); m_CachedFlow.name = "Custom_GlitchChestAlt_Flow"; m_CachedFlow.fallbackRoomTable = ExpandPrefabs.CustomRoomTable2; m_CachedFlow.subtypeRestrictions = new List <DungeonFlowSubtypeRestriction>() { ExpandDungeonFlow.BaseSubTypeRestrictions }; m_CachedFlow.flowInjectionData = new List <ProceduralFlowModifierData>(0); m_CachedFlow.sharedInjectionData = new List <SharedInjectionData>() { ExpandDungeonFlow.BaseSharedInjectionData }; m_CachedFlow.Initialize(); // Hub area m_CachedFlow.AddNodeToFlow(m_HubNode, null); // Big Entrance with first loop. m_CachedFlow.AddNodeToFlow(m_EntranceNode, m_HubNode); m_CachedFlow.AddNodeToFlow(m_cachedNodes_01[0], m_HubNode); for (int i = 1; i < LoopRoomCount + 1; i++) { m_CachedFlow.AddNodeToFlow(m_cachedNodes_01[i], m_cachedNodes_01[i - 1]); } m_CachedFlow.AddNodeToFlow(m_ShopNode_01, m_cachedNodes_01[LoopRoomCount]); m_CachedFlow.AddNodeToFlow(m_ChestRoom_01, m_ShopNode_01); m_CachedFlow.LoopConnectNodes(m_HubNode, m_ChestRoom_01); // Maybe boss path. :P m_CachedFlow.AddNodeToFlow(m_cachedNodes_02[0], m_HubNode); for (int i = 1; i < SingleChainRoomCount + 1; i++) { m_CachedFlow.AddNodeToFlow(m_cachedNodes_02[i], m_cachedNodes_02[i - 1]); } m_CachedFlow.AddNodeToFlow(m_ChestRoom_02, m_cachedNodes_02[SingleChainRoomCount]); if (bossShuffle) { m_CachedFlow.AddNodeToFlow(m_BossFoyerNode, m_ChestRoom_02); m_CachedFlow.AddNodeToFlow(m_BossNode, m_BossFoyerNode); m_CachedFlow.AddNodeToFlow(m_ExitNode, m_BossNode); } else { m_CachedFlow.AddNodeToFlow(m_FakeBossFoyerNode, m_ChestRoom_02); m_CachedFlow.AddNodeToFlow(m_FakeBossNode, m_FakeBossFoyerNode); } // Maybe boss path. :P m_CachedFlow.AddNodeToFlow(m_cachedNodes_03[0], m_EntranceNode); for (int i = 1; i < SingleChainRoomCount + 1; i++) { m_CachedFlow.AddNodeToFlow(m_cachedNodes_03[i], m_cachedNodes_03[i - 1]); } m_CachedFlow.AddNodeToFlow(m_ChestRoom_03, m_cachedNodes_03[SingleChainRoomCount]); if (bossShuffle) { m_CachedFlow.AddNodeToFlow(m_FakeBossFoyerNode, m_ChestRoom_03); m_CachedFlow.AddNodeToFlow(m_FakeBossNode, m_FakeBossFoyerNode); } else { m_CachedFlow.AddNodeToFlow(m_BossFoyerNode, m_ChestRoom_03); m_CachedFlow.AddNodeToFlow(m_BossNode, m_BossFoyerNode); m_CachedFlow.AddNodeToFlow(m_ExitNode, m_BossNode); } // Second Loop m_CachedFlow.AddNodeToFlow(m_cachedNodes_04[0], m_EntranceNode); for (int i = 1; i < LoopRoomCount + 1; i++) { m_CachedFlow.AddNodeToFlow(m_cachedNodes_04[i], m_cachedNodes_04[i - 1]); } m_CachedFlow.AddNodeToFlow(m_ChestRoom_04, m_cachedNodes_04[LoopRoomCount]); m_CachedFlow.LoopConnectNodes(m_ChestRoom_04, m_EntranceNode); m_CachedFlow.FirstNode = m_HubNode; return(m_CachedFlow); }
private void PlaceGlitchElevator(Dungeon dungeon) { GameManager.LevelOverrideState levelOverrideState = GameManager.Instance.CurrentLevelOverrideState; if (dungeon.IsGlitchDungeon | ExpandStats.elevatorHasBeenUsed) { return; } if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.BOSSRUSH | GameManager.Instance.CurrentGameMode == GameManager.GameMode.SUPERBOSSRUSH) { return; } if (levelOverrideState == GameManager.LevelOverrideState.FOYER | levelOverrideState == GameManager.LevelOverrideState.TUTORIAL) { ExpandStats.elevatorHasBeenUsed = false; return; } if (levelOverrideState == GameManager.LevelOverrideState.CHARACTER_PAST) { ExpandStats.elevatorHasBeenUsed = false; return; } if (levelOverrideState == GameManager.LevelOverrideState.END_TIMES) { return; } if (GameManager.Instance.CurrentFloor >= 5) { return; } if (UnityEngine.Random.value > 0.003f) { return; } int MaxNumberOfElevators = 1; int ElevatorsPlaced = 0; int ElevatorLocations = 0; int SelectedRoom = 0; List <int> roomList = Enumerable.Range(0, dungeon.data.rooms.Count).ToList(); roomList = roomList.Shuffle(); List <IntVector2> validWalls = new List <IntVector2>(); while (SelectedRoom < roomList.Count && ElevatorsPlaced < MaxNumberOfElevators) { RoomHandler currentRoom = dungeon.data.rooms[roomList[SelectedRoom]]; if (!currentRoom.IsShop && !currentRoom.IsMaintenanceRoom() && !currentRoom.GetRoomName().ToLower().StartsWith("exit") && !currentRoom.GetRoomName().ToLower().StartsWith("tiny_exit") && !currentRoom.GetRoomName().ToLower().StartsWith("elevator") && !currentRoom.GetRoomName().ToLower().StartsWith("tiny_entrance") && !currentRoom.GetRoomName().ToLower().StartsWith("gungeon entrance") && !currentRoom.GetRoomName().ToLower().StartsWith("gungeon_rewardroom") && !currentRoom.GetRoomName().ToLower().StartsWith("reward room") && !currentRoom.GetRoomName().ToLower().StartsWith(ExpandRoomPrefabs.Expand_BootlegRoom.name)) { if (!currentRoom.area.IsProceduralRoom || currentRoom.area.proceduralCells == null) { if (currentRoom.area.PrototypeRoomCategory != PrototypeDungeonRoom.RoomCategory.BOSS || (PlayerStats.GetTotalCurse() >= 5 && !BraveUtility.RandomBool())) { if (!currentRoom.GetRoomName().StartsWith("DraGunRoom")) { if (currentRoom.connectedRooms != null) { for (int i = 0; i < currentRoom.connectedRooms.Count; i++) { if (currentRoom.connectedRooms[i] == null || currentRoom.connectedRooms[i].area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.BOSS) { } } } validWalls.Clear(); 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)) { int WallCellCount = 0; if (!dungeon.data.isPlainEmptyCell(X - 3, Y + 6) && !dungeon.data.isPlainEmptyCell(X - 2, Y + 6) && !dungeon.data.isPlainEmptyCell(X - 1, Y + 6) && !dungeon.data.isPlainEmptyCell(X, Y + 6) && !dungeon.data.isPlainEmptyCell(X + 1, Y + 6) && !dungeon.data.isPlainEmptyCell(X + 2, Y + 6) && !dungeon.data.isPlainEmptyCell(X + 3, Y + 6) && !dungeon.data.isPlainEmptyCell(X + 4, Y + 6) && !dungeon.data.isPlainEmptyCell(X + 5, Y + 6) && !dungeon.data.isPlainEmptyCell(X - 3, Y + 5) && !dungeon.data.isPlainEmptyCell(X - 2, Y + 5) && !dungeon.data.isPlainEmptyCell(X - 1, Y + 5) && !dungeon.data.isPlainEmptyCell(X, Y + 5) && !dungeon.data.isPlainEmptyCell(X + 1, Y + 5) && !dungeon.data.isPlainEmptyCell(X + 2, Y + 5) && !dungeon.data.isPlainEmptyCell(X + 3, Y + 5) && !dungeon.data.isPlainEmptyCell(X + 4, Y + 5) && !dungeon.data.isPlainEmptyCell(X + 5, Y + 5) && !dungeon.data.isPlainEmptyCell(X - 3, Y + 4) && !dungeon.data.isPlainEmptyCell(X - 2, Y + 4) && !dungeon.data.isPlainEmptyCell(X - 1, Y + 4) && !dungeon.data.isPlainEmptyCell(X, Y + 4) && !dungeon.data.isPlainEmptyCell(X + 1, Y + 4) && !dungeon.data.isPlainEmptyCell(X + 2, Y + 4) && !dungeon.data.isPlainEmptyCell(X + 3, Y + 4) && !dungeon.data.isPlainEmptyCell(X + 4, Y + 4) && !dungeon.data.isPlainEmptyCell(X + 5, Y + 4) && !dungeon.data.isPlainEmptyCell(X - 3, Y + 3) && !dungeon.data.isPlainEmptyCell(X - 2, Y + 3) && !dungeon.data.isPlainEmptyCell(X - 1, Y + 3) && !dungeon.data.isPlainEmptyCell(X, Y + 3) && !dungeon.data.isPlainEmptyCell(X + 1, Y + 3) && !dungeon.data.isPlainEmptyCell(X + 2, Y + 3) && !dungeon.data.isPlainEmptyCell(X + 3, Y + 3) && !dungeon.data.isPlainEmptyCell(X + 4, Y + 3) && !dungeon.data.isPlainEmptyCell(X + 5, Y + 3) && !dungeon.data.isPlainEmptyCell(X - 3, Y + 2) && !dungeon.data.isPlainEmptyCell(X - 2, Y + 2) && !dungeon.data.isPlainEmptyCell(X - 1, Y + 2) && !dungeon.data.isPlainEmptyCell(X, Y + 2) && !dungeon.data.isPlainEmptyCell(X + 1, Y + 2) && !dungeon.data.isPlainEmptyCell(X + 2, Y + 2) && !dungeon.data.isPlainEmptyCell(X + 3, Y + 2) && !dungeon.data.isPlainEmptyCell(X + 4, Y + 2) && !dungeon.data.isPlainEmptyCell(X + 5, Y + 2) && !dungeon.data.isPlainEmptyCell(X - 4, Y + 1) && dungeon.data.isWall(X - 3, Y + 1) && dungeon.data.isWall(X - 2, Y + 1) && dungeon.data.isWall(X - 1, Y + 1) && dungeon.data.isWall(X, Y + 1) && dungeon.data.isWall(X + 1, Y + 1) && dungeon.data.isWall(X + 2, Y + 1) && dungeon.data.isWall(X + 3, Y + 1) && dungeon.data.isWall(X + 4, Y + 1) && dungeon.data.isWall(X + 5, Y + 1) && dungeon.data.isWall(X + 6, Y + 1) && dungeon.data.isWall(X + 7, Y + 1) && !dungeon.data.isPlainEmptyCell(X + 8, Y + 1) && !dungeon.data.isPlainEmptyCell(X + 9, Y + 1) && !dungeon.data.isPlainEmptyCell(X - 4, Y) && dungeon.data.isWall(X - 3, Y) && dungeon.data.isWall(X - 2, Y) && dungeon.data.isWall(X - 1, Y) && dungeon.data.isWall(X, Y) && dungeon.data.isWall(X + 1, Y) && dungeon.data.isWall(X + 2, Y) && dungeon.data.isWall(X + 3, Y) && dungeon.data.isWall(X + 4, Y) && dungeon.data.isWall(X + 5, Y) && dungeon.data.isWall(X + 6, Y) && dungeon.data.isWall(X + 7, Y) && !dungeon.data.isPlainEmptyCell(X + 8, Y) && !dungeon.data.isPlainEmptyCell(X + 9, Y) && dungeon.data.isPlainEmptyCell(X - 3, Y - 1) && dungeon.data.isPlainEmptyCell(X - 2, Y - 1) && dungeon.data.isPlainEmptyCell(X - 1, Y - 1) && dungeon.data.isPlainEmptyCell(X, Y - 1) && dungeon.data.isPlainEmptyCell(X + 1, Y - 1) && dungeon.data.isPlainEmptyCell(X + 2, Y - 1) && dungeon.data.isPlainEmptyCell(X + 3, Y - 1) && dungeon.data.isPlainEmptyCell(X + 4, Y - 1) && dungeon.data.isPlainEmptyCell(X + 5, Y - 1) && dungeon.data.isPlainEmptyCell(X + 6, Y - 1) && dungeon.data.isPlainEmptyCell(X + 7, Y - 1) && dungeon.data.isPlainEmptyCell(X - 3, Y - 2) && dungeon.data.isPlainEmptyCell(X - 2, Y - 2) && dungeon.data.isPlainEmptyCell(X - 1, Y - 2) && dungeon.data.isPlainEmptyCell(X, Y - 2) && dungeon.data.isPlainEmptyCell(X + 1, Y - 2) && dungeon.data.isPlainEmptyCell(X + 2, Y - 2) && dungeon.data.isPlainEmptyCell(X + 3, Y - 2) && dungeon.data.isPlainEmptyCell(X + 4, Y - 2) && dungeon.data.isPlainEmptyCell(X + 5, Y - 2) && dungeon.data.isPlainEmptyCell(X + 6, Y - 2) && dungeon.data.isPlainEmptyCell(X + 7, Y - 2)) { validWalls.Add(new IntVector2(X, Y)); WallCellCount++; ElevatorLocations++; } if (WallCellCount > 0) { bool flag2 = true; int XPadding = -5; while (XPadding <= 5 && flag2) { int YPadding = -5; while (YPadding <= 5 && flag2) { int x = X + XPadding; int y = Y + YPadding; if (dungeon.data.CheckInBoundsAndValid(x, y)) { CellData cellData = dungeon.data[x, y]; if (cellData != null) { if (cellData.type == CellType.PIT || cellData.diagonalWallType != DiagonalWallType.NONE) { flag2 = false; } } } YPadding++; } XPadding++; } if (!flag2) { while (WallCellCount > 0) { validWalls.RemoveAt(validWalls.Count - 1); WallCellCount--; } } } } } } if (validWalls.Count > 0) { IntVector2 WallCell = (BraveUtility.RandomElement(validWalls) - currentRoom.area.basePosition); GameObject ElevatorObject = ExpandPrefabs.ElevatorDeparture.InstantiateObject(currentRoom, WallCell, false); ElevatorObject.AddComponent <ExpandElevatorDepartureManager>(); ExpandElevatorDepartureManager elevatorComponent = ElevatorObject.GetComponent <ExpandElevatorDepartureManager>(); elevatorComponent.OverrideTargetFloor = GlobalDungeonData.ValidTilesets.OFFICEGEON; elevatorComponent.UsesOverrideTargetFloor = true; if (elevatorComponent.gameObject.GetComponentsInChildren <tk2dBaseSprite>(true) != null) { foreach (tk2dBaseSprite baseSprite in elevatorComponent.gameObject.GetComponentsInChildren <tk2dBaseSprite>(true)) { ExpandShaders.Instance.ApplyGlitchShader(baseSprite); } } validWalls.Remove(WallCell); ElevatorsPlaced++; } } } } } SelectedRoom++; } if (ExpandStats.debugMode) { ETGModConsole.Log("[DEBUG] Number of Valid Glitch Elevator locations found: " + ElevatorLocations, false); ETGModConsole.Log("[DEBUG] Number of Glitch Elevators placed: " + ElevatorsPlaced, false); } }
private void SetStats(Dungeon dungeon, int currentFloor, int currentCurse, int currentCoolness) { ChaosConsole.hasBeenTentacled = false; ChaosConsole.hasBeenTentacledToAnotherRoom = false; if (ChaosGlitchMod.isGlitchFloor && dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.PHOBOSGEON) { /*Color colorBoost = new Color(0.237f, 0.237f, 0.237f); * dungeon.decoSettings.ambientLightColor += colorBoost; * dungeon.decoSettings.ambientLightColorTwo += colorBoost; * dungeon.decoSettings.lowQualityAmbientLightColor += colorBoost; * dungeon.decoSettings.lowQualityAmbientLightColorTwo += colorBoost; * ChaosUtility.RatDungeon.decoSettings.ambientLightColor += colorBoost; * ChaosUtility.RatDungeon.decoSettings.ambientLightColorTwo += colorBoost; * ChaosUtility.RatDungeon.decoSettings.lowQualityAmbientLightColor += colorBoost; * ChaosUtility.RatDungeon.decoSettings.lowQualityAmbientLightColorTwo += colorBoost;*/ dungeon.DungeonFloorName = "A Corrupted Place..."; dungeon.DungeonShortName = "A Corrupted Place..."; dungeon.DungeonFloorLevelTextOverride = "Beneath the Melting Permafrost."; } if (currentFloor == -1) { ChaosConsole.RandomPits = UnityEngine.Random.Range(40, 60); ChaosConsole.RandomPitsPerRoom = UnityEngine.Random.Range(3, 5); } else { if (currentFloor == 2 | currentFloor == 3) { ChaosConsole.RandomPits = UnityEngine.Random.Range(60, 85); ChaosConsole.RandomPitsPerRoom = UnityEngine.Random.Range(5, 8); } else { if (currentFloor == 4) { ChaosConsole.RandomPits = UnityEngine.Random.Range(70, 90); ChaosConsole.RandomPitsPerRoom = UnityEngine.Random.Range(8, 10); } else { if (currentFloor > 5) { ChaosConsole.RandomPits = UnityEngine.Random.Range(100, 190); ChaosConsole.RandomPitsPerRoom = UnityEngine.Random.Range(10, 18); } } } } if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] Current Curse: " + PlayerStats.GetTotalCurse(), false); ETGModConsole.Log("[DEBUG] Current Coolness: " + PlayerStats.GetTotalCoolness(), false); } if (currentCoolness >= 5) { ChaosConsole.TentacleTimeChances = 0.04f; ChaosConsole.TentacleTimeRandomRoomChances = 0.05f; } else { if (currentCurse == 0) { ChaosConsole.TentacleTimeChances = 0.05f; ChaosConsole.TentacleTimeRandomRoomChances = 0.08f; } else { if (currentCurse >= 1 && currentCurse <= 3) { ChaosConsole.TentacleTimeChances = 0.1f; ChaosConsole.TentacleTimeRandomRoomChances = 0.15f; } else { if (currentCurse >= 4 && currentCurse <= 6) { ChaosConsole.TentacleTimeChances = 0.15f; ChaosConsole.TentacleTimeRandomRoomChances = 0.2f; } else { if (currentCurse > 9) { ChaosConsole.TentacleTimeChances = 0.35f; ChaosConsole.TentacleTimeRandomRoomChances = 0.4f; } } } } } // Secret Floors and Tutorial if (currentFloor == -1) { if (BraveUtility.RandomBool()) { ChaosConsole.MaxWallMimicsPerRoom = 1; } else { ChaosConsole.MaxWallMimicsPerRoom = 2; } ChaosConsole.MaxWallMimicsForFloor = 15; if (currentCurse >= 5) { ChaosConsole.MaxWallMimicsForFloor = 25; } } // Normal Floors with 1 = Keep, 2 = Gungeon Proper, and so on // Floor 1 guranteed to have 1 mimic per room. if (currentFloor == 1) { ChaosConsole.elevatorHasBeenUsed = false; ChaosConsole.MaxWallMimicsPerRoom = 1; ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(5, 15); if (currentCurse >= 6) { ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(15, 25); } } // Floor 2 and onwards can have more then one mimic per room. // However not a gurantee that every room will have that count. if (currentFloor == 2) { if (BraveUtility.RandomBool()) { ChaosConsole.MaxWallMimicsPerRoom = 1; } else { ChaosConsole.MaxWallMimicsPerRoom = 2; } ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(10, 15); if (currentCurse >= 6) { ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(20, 25); } } if (currentFloor == 3) { if (BraveUtility.RandomBool()) { ChaosConsole.MaxWallMimicsPerRoom = 1; } else { ChaosConsole.MaxWallMimicsPerRoom = 2; } ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(15, 20); if (currentCurse >= 6) { ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(20, 25); } } if (currentFloor == 4) { if (BraveUtility.RandomBool()) { ChaosConsole.MaxWallMimicsPerRoom = 1; } else { ChaosConsole.MaxWallMimicsPerRoom = 2; } ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(20, 25); if (currentCurse >= 6) { ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(25, 35); } } if (currentFloor == 5) { if (BraveUtility.RandomBool()) { ChaosConsole.MaxWallMimicsPerRoom = 1; } else { ChaosConsole.MaxWallMimicsPerRoom = 3; } ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(20, 30); if (currentCurse >= 6) { ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(30, 40); } } if (currentFloor >= 6) { if (BraveUtility.RandomBool()) { ChaosConsole.MaxWallMimicsPerRoom = 1; } else { ChaosConsole.MaxWallMimicsPerRoom = 3; } ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(30, 40); if (currentCurse >= 5) { ChaosConsole.MaxWallMimicsForFloor = UnityEngine.Random.Range(35, 50); } } return; }
public static void InitFlow() { List <DungeonFlowNode> m_cachedNodes_01 = new List <DungeonFlowNode>(); List <DungeonFlowNode> m_cachedNodes_02 = new List <DungeonFlowNode>(); List <DungeonFlowNode> m_cachedNodes_03 = new List <DungeonFlowNode>(); List <DungeonFlowNode> m_cachedNodes_04 = new List <DungeonFlowNode>(); DungeonFlowNode m_EntranceNode = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.ENTRANCE, ChaosRoomPrefabs.Giant_Elevator_Room); DungeonFlowNode m_HubNode = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.HUB); DungeonFlowNode m_ShopNode_01 = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.SPECIAL, overrideTable: ChaosPrefabs.shop_room_table); DungeonFlowNode m_ShopNode_02 = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.SPECIAL, overrideTable: ChaosPrefabs.shop_room_table); DungeonFlowNode m_ChestRoom_01 = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ChaosPrefabs.reward_room, oneWayLoopTarget: true); DungeonFlowNode m_ChestRoom_02 = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.REWARD, ChaosPrefabs.gungeon_rewardroom_1); DungeonFlowNode m_ChestRoom_03 = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.REWARD, ChaosPrefabs.gungeon_rewardroom_1); DungeonFlowNode m_ChestRoom_04 = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ChaosPrefabs.reward_room, oneWayLoopTarget: true); DungeonFlowNode m_ExitNode = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.EXIT, ChaosPrefabs.tiny_exit); DungeonFlowNode m_BossFoyerNode = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ChaosPrefabs.boss_foyer); DungeonFlowNode m_BossNode = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.BOSS, overrideTable: ChaosPrefabs.MegaBossRoomTable); DungeonFlowNode m_FakeBossNode = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.BOSS, ChaosPrefabs.tutorial_minibossroom); DungeonFlowNode m_FakeBossFoyerNode = ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.CONNECTOR, ChaosPrefabs.boss_foyer); for (int i = 0; i < LoopRoomCount + 1; i++) { m_cachedNodes_01.Add(ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.NORMAL)); m_cachedNodes_04.Add(ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.NORMAL)); } for (int i = 0; i < SingleChainRoomCount + 1; i++) { m_cachedNodes_02.Add(ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.NORMAL)); m_cachedNodes_03.Add(ChaosDungeonFlows.GenerateDefaultNode(ChaosDungeonFlows.Fruit_Loops, PrototypeDungeonRoom.RoomCategory.NORMAL)); } m_cachedNodes_01[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_01[LoopRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_02[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_02[SingleChainRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_03[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_03[SingleChainRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_04[0].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; m_cachedNodes_04[LoopRoomCount].roomCategory = PrototypeDungeonRoom.RoomCategory.CONNECTOR; bool bossShuffle = BraveUtility.RandomBool(); ChaosDungeonFlows.Fruit_Loops.name = "Fruit_Loops"; ChaosDungeonFlows.Fruit_Loops.fallbackRoomTable = ChaosPrefabs.CustomRoomTableNoCastle; ChaosDungeonFlows.Fruit_Loops.subtypeRestrictions = new List <DungeonFlowSubtypeRestriction>() { ChaosDungeonFlows.BaseSubTypeRestrictions }; ChaosDungeonFlows.Fruit_Loops.flowInjectionData = new List <ProceduralFlowModifierData>(0); ChaosDungeonFlows.Fruit_Loops.sharedInjectionData = new List <SharedInjectionData>() { ChaosDungeonFlows.BaseSharedInjectionData }; ChaosDungeonFlows.Fruit_Loops.Initialize(); // Hub area ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_HubNode, null); // Big Entrance with first loop. ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_EntranceNode, m_HubNode); ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_cachedNodes_01[0], m_HubNode); for (int i = 1; i < LoopRoomCount + 1; i++) { ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_cachedNodes_01[i], m_cachedNodes_01[i - 1]); } ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_ShopNode_01, m_cachedNodes_01[LoopRoomCount]); ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_ChestRoom_01, m_ShopNode_01); ChaosDungeonFlows.Fruit_Loops.LoopConnectNodes(m_HubNode, m_ChestRoom_01); // Maybe boss path. :P ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_cachedNodes_02[0], m_HubNode); for (int i = 1; i < SingleChainRoomCount + 1; i++) { ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_cachedNodes_02[i], m_cachedNodes_02[i - 1]); } ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_ChestRoom_02, m_cachedNodes_02[SingleChainRoomCount]); if (bossShuffle) { ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_BossFoyerNode, m_ChestRoom_02); ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_BossNode, m_BossFoyerNode); ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_ExitNode, m_BossNode); } else { ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_FakeBossFoyerNode, m_ChestRoom_02); ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_FakeBossNode, m_FakeBossFoyerNode); } // Maybe boss path. :P ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_cachedNodes_03[0], m_EntranceNode); for (int i = 1; i < SingleChainRoomCount + 1; i++) { ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_cachedNodes_03[i], m_cachedNodes_03[i - 1]); } ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_ChestRoom_03, m_cachedNodes_03[SingleChainRoomCount]); if (bossShuffle) { ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_FakeBossFoyerNode, m_ChestRoom_03); ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_FakeBossNode, m_FakeBossFoyerNode); } else { ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_BossFoyerNode, m_ChestRoom_03); ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_BossNode, m_BossFoyerNode); ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_ExitNode, m_BossNode); } // Second Loop ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_cachedNodes_04[0], m_EntranceNode); for (int i = 1; i < LoopRoomCount + 1; i++) { ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_cachedNodes_04[i], m_cachedNodes_04[i - 1]); } ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_ShopNode_02, m_cachedNodes_04[LoopRoomCount]); ChaosDungeonFlows.Fruit_Loops.AddNodeToFlow(m_ChestRoom_04, m_ShopNode_02); ChaosDungeonFlows.Fruit_Loops.LoopConnectNodes(m_ChestRoom_04, m_EntranceNode); ChaosDungeonFlows.Fruit_Loops.FirstNode = m_HubNode; }
private void ChaosPlaceWallMimics(Action <Dungeon, RoomHandler> orig, Dungeon dungeon, RoomHandler roomHandler) { // Used for debug read out information int NorthWallCount = 0; int SouthWallCount = 0; int EastWallCount = 0; int WestWallCount = 0; int WallMimicsPlaced = 0; int iterations = 0; try { int currentFloor = GameManager.Instance.CurrentFloor; int numWallMimicsForFloor = MetaInjectionData.GetNumWallMimicsForFloor(dungeon.tileIndices.tilesetId); GameManager.LevelOverrideState levelOverrideState = GameManager.Instance.CurrentLevelOverrideState; // Set Max Wall Mimic values based on each floor. Secret floors and Tutorial are always -1 and will keep default values. SetStats(dungeon, currentFloor, PlayerStats.GetTotalCurse(), PlayerStats.GetTotalCoolness()); if (!ChaosConsole.WallMimicsUseRewardManager) { numWallMimicsForFloor = ChaosConsole.MaxWallMimicsForFloor; } if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] Current Floor: " + currentFloor, false); ETGModConsole.Log("[DEBUG] Wall Mimics assigned by RewardManager: " + numWallMimicsForFloor, false); } if (ChaosConsole.WallMimicsUseRewardManager) { ChaosConsole.MaxWallMimicsPerRoom = 1; ChaosConsole.MaxWallMimicsForFloor = numWallMimicsForFloor; } if (ChaosConsole.isHardMode | ChaosConsole.isUltraMode) { if (currentFloor == 1) { PlaceTeleporter(dungeon); } PlaceGlitchElevator(dungeon); } if (ChaosConsole.isUltraMode) { if (levelOverrideState == GameManager.LevelOverrideState.RESOURCEFUL_RAT | levelOverrideState == GameManager.LevelOverrideState.TUTORIAL | levelOverrideState != GameManager.LevelOverrideState.NONE) { if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] This floor has been excluded from having additional pits.", false); } } else { ChaosPitRandomizer.Instance.PlaceRandomPits(dungeon, roomHandler, currentFloor); } } if (currentFloor == 4 && ChaosConsole.allowGlitchFloor) { PlaceSecretRatGrate(dungeon); } // Wall Mimics will not be placed glitch floors. if (ChaosGlitchMod.isGlitchFloor | dungeon.IsGlitchDungeon) { return; } if (ChaosConsole.MaxWallMimicsForFloor <= 0) { if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] There will be no Wall Mimics assigned to this floor.", false); } return; } if (levelOverrideState != GameManager.LevelOverrideState.NONE | levelOverrideState == GameManager.LevelOverrideState.TUTORIAL) { if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] This floor has been excluded from having Wall Mimics", false); } return; } if (!ChaosConsole.WallMimicsUseRewardManager && levelOverrideState == GameManager.LevelOverrideState.RESOURCEFUL_RAT) { if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] The Resourceful Rat Maze has been excluded from having wall mimics.", false); } return; } if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] Wall Mimics Per Room: " + ChaosConsole.MaxWallMimicsPerRoom, false); ETGModConsole.Log("[DEBUG] Max Wall Mimic assigned to floor if RewardManager overridden: " + ChaosConsole.MaxWallMimicsForFloor, false); } List <int> roomList = Enumerable.Range(0, dungeon.data.rooms.Count).ToList(); roomList = roomList.Shuffle(); if (roomHandler != null) { roomList = new List <int>(new int[] { dungeon.data.rooms.IndexOf(roomHandler) }); } List <Tuple <IntVector2, DungeonData.Direction> > validWalls = new List <Tuple <IntVector2, DungeonData.Direction> >(); List <AIActor> enemiesList = new List <AIActor>(); while (iterations < roomList.Count && WallMimicsPlaced < numWallMimicsForFloor) { RoomHandler currentRoom = dungeon.data.rooms[roomList[iterations]]; if (!currentRoom.IsShop || !ChaosConsole.WallMimicsUseRewardManager) { if (!currentRoom.area.IsProceduralRoom || currentRoom.area.proceduralCells == null) { if (currentRoom.area.PrototypeRoomCategory != PrototypeDungeonRoom.RoomCategory.BOSS || (PlayerStats.GetTotalCurse() >= 5 && !BraveUtility.RandomBool())) { if (!currentRoom.GetRoomName().StartsWith("DraGunRoom") && !currentRoom.IsMaintenanceRoom()) { if (currentRoom.connectedRooms != null) { for (int i = 0; i < currentRoom.connectedRooms.Count; i++) { if (currentRoom.connectedRooms[i] == null || currentRoom.connectedRooms[i].area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.BOSS) { } } } if (roomHandler == null && ChaosConsole.WallMimicsUseRewardManager) { bool MaxMimicCountReached = false; currentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All, ref enemiesList); for (int j = 0; j < enemiesList.Count; j++) { AIActor aiactor = enemiesList[j]; if (aiactor && aiactor.EnemyGuid == GameManager.Instance.RewardManager.WallMimicChances.EnemyGuid) { MaxMimicCountReached = true; break; } } if (MaxMimicCountReached) { goto IL_EXIT; } } validWalls.Clear(); 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) && X % 4 == 0 && Y % 4 == 0) { int WallCount = 0; if (!dungeon.data.isWall(X - 1, Y + 2) && !dungeon.data.isWall(X, Y + 2) && !dungeon.data.isWall(X + 1, Y + 2) && !dungeon.data.isWall(X + 2, Y + 2) && !dungeon.data.isWall(X - 1, Y + 1) && !dungeon.data.isWall(X, Y + 1) && !dungeon.data.isWall(X + 1, Y + 1) && !dungeon.data.isWall(X + 2, Y + 1) && dungeon.data.isWall(X - 1, Y) && dungeon.data.isWall(X, Y) && dungeon.data.isWall(X + 1, Y) && dungeon.data.isWall(X + 2, Y) && dungeon.data.isWall(X - 1, Y - 1) && dungeon.data.isWall(X, Y - 1) && dungeon.data.isWall(X + 1, Y - 1) && dungeon.data.isWall(X + 2, Y - 1) && !dungeon.data.isPlainEmptyCell(X - 1, Y - 3) && !dungeon.data.isPlainEmptyCell(X, Y - 3) && !dungeon.data.isPlainEmptyCell(X + 1, Y - 3) && !dungeon.data.isPlainEmptyCell(X + 2, Y - 3)) { validWalls.Add(Tuple.Create(new IntVector2(X, Y), DungeonData.Direction.NORTH)); WallCount++; SouthWallCount++; } else if (dungeon.data.isWall(X - 1, Y + 2) && dungeon.data.isWall(X, Y + 2) && dungeon.data.isWall(X + 1, Y + 2) && dungeon.data.isWall(X + 2, Y + 2) && dungeon.data.isWall(X - 1, Y + 1) && dungeon.data.isWall(X, Y + 1) && dungeon.data.isWall(X + 1, Y + 1) && dungeon.data.isWall(X + 2, Y + 1) && dungeon.data.isWall(X - 1, Y) && dungeon.data.isWall(X, Y) && dungeon.data.isWall(X + 1, Y) && dungeon.data.isWall(X + 2, Y) && dungeon.data.isPlainEmptyCell(X, Y - 1) && dungeon.data.isPlainEmptyCell(X + 1, Y - 1) && !dungeon.data.isPlainEmptyCell(X, Y + 4) && !dungeon.data.isPlainEmptyCell(X + 1, Y + 4)) { validWalls.Add(Tuple.Create(new IntVector2(X, Y), DungeonData.Direction.SOUTH)); WallCount++; NorthWallCount++; } else if (dungeon.data.isWall(X, Y + 2) && dungeon.data.isWall(X, Y + 1) && dungeon.data.isWall(X - 1, Y) && dungeon.data.isWall(X, Y - 1) && dungeon.data.isWall(X, Y - 2) && !dungeon.data.isPlainEmptyCell(X - 2, Y + 2) && !dungeon.data.isPlainEmptyCell(X - 2, Y + 1) && !dungeon.data.isPlainEmptyCell(X - 2, Y) && dungeon.data.isPlainEmptyCell(X + 1, Y) && dungeon.data.isPlainEmptyCell(X + 1, Y - 1) && !dungeon.data.isPlainEmptyCell(X - 2, Y - 1) && !dungeon.data.isPlainEmptyCell(X - 2, Y - 2)) { validWalls.Add(Tuple.Create(new IntVector2(X, Y), DungeonData.Direction.EAST)); WallCount++; WestWallCount++; } else if (dungeon.data.isWall(X, Y + 2) && dungeon.data.isWall(X, Y + 1) && dungeon.data.isWall(X + 1, Y) && dungeon.data.isWall(X, Y - 1) && dungeon.data.isWall(X, Y - 2) && !dungeon.data.isPlainEmptyCell(X + 2, Y + 2) && !dungeon.data.isPlainEmptyCell(X + 2, Y + 1) && !dungeon.data.isPlainEmptyCell(X + 2, Y) && dungeon.data.isPlainEmptyCell(X - 1, Y) && dungeon.data.isPlainEmptyCell(X - 1, Y - 1) && !dungeon.data.isPlainEmptyCell(X + 2, Y - 1) && !dungeon.data.isPlainEmptyCell(X + 2, Y - 2)) { validWalls.Add(Tuple.Create(new IntVector2(X - 1, Y), DungeonData.Direction.WEST)); WallCount++; EastWallCount++; } if (WallCount > 0) { bool flag2 = true; int XPadding = -5; while (XPadding <= 5 && flag2) { int YPadding = -5; while (YPadding <= 5 && flag2) { int x = X + XPadding; int y = Y + YPadding; if (dungeon.data.CheckInBoundsAndValid(x, y)) { CellData cellData = dungeon.data[x, y]; if (cellData != null) { if (cellData.type == CellType.PIT || cellData.diagonalWallType != DiagonalWallType.NONE) { flag2 = false; } } } YPadding++; } XPadding++; } if (!flag2) { while (WallCount > 0) { validWalls.RemoveAt(validWalls.Count - 1); WallCount--; } } } } } } if (roomHandler == null) { int loopCount = 0; while (loopCount < ChaosConsole.MaxWallMimicsPerRoom) { // if (!ChaosConsole.WallMimicsUseRewardManager) { if (WallMimicsPlaced >= ChaosConsole.MaxWallMimicsForFloor) { break; } } if (validWalls.Count > 0) { Tuple <IntVector2, DungeonData.Direction> WallCell = BraveUtility.RandomElement(validWalls); IntVector2 Position = WallCell.First; DungeonData.Direction Direction = WallCell.Second; if (Direction != DungeonData.Direction.WEST) { currentRoom.RuntimeStampCellComplex(Position.x, Position.y, CellType.FLOOR, DiagonalWallType.NONE); } if (Direction != DungeonData.Direction.EAST) { currentRoom.RuntimeStampCellComplex(Position.x + 1, Position.y, CellType.FLOOR, DiagonalWallType.NONE); } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(GameManager.Instance.RewardManager.WallMimicChances.EnemyGuid); AIActor.Spawn(orLoadByGuid, Position, currentRoom, true, AIActor.AwakenAnimationType.Default, true); validWalls.Remove(WallCell); WallMimicsPlaced++; } ++loopCount; } } } } } } IL_EXIT: iterations++; } if (WallMimicsPlaced > 0) { PhysicsEngine.Instance.ClearAllCachedTiles(); if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] Number of Valid North Wall Mimics locations: " + NorthWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid South Wall Mimics locations: " + SouthWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid East Wall Mimics locations: " + EastWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid West Wall Mimics locations: " + WestWallCount, false); ETGModConsole.Log("[DEBUG] Number of Wall Mimics succesfully placed: " + WallMimicsPlaced, false); } } } catch (Exception ex) { if (ChaosConsole.DebugExceptions) { ETGModConsole.Log("[DEBUG] Exception occured in Dungeon.PlaceWallMimics!"); } Debug.Log("Exception caught in Dungeon.PlaceWallMimics!"); Debug.LogException(ex); if (WallMimicsPlaced > 0) { PhysicsEngine.Instance.ClearAllCachedTiles(); if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] Number of Valid North Wall Mimics locations: " + NorthWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid South Wall Mimics locations: " + SouthWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid East Wall Mimics locations: " + EastWallCount, false); ETGModConsole.Log("[DEBUG] Number of Valid West Wall Mimics locations: " + WestWallCount, false); ETGModConsole.Log("[DEBUG] Number of Wall Mimics succesfully placed: " + WallMimicsPlaced, false); } } } }
private void SelfDestructOnKick() { int currentCurse = PlayerStats.GetTotalCurse(); int currentCoolness = PlayerStats.GetTotalCoolness(); float ExplodeOnKickChances = 0.25f; float ExplodeOnKickDamageToEnemies = 150f; Vector2 ExplosionCenterPosition = sprite.WorldCenter; bool ExplodeOnKickDamagesPlayer = BraveUtility.RandomBool(); if (willDefinitelyExplode) { ExplodeOnKickDamagesPlayer = false; ExplodeOnKickDamageToEnemies = 200f; } else { if (currentCoolness >= 3) { ExplodeOnKickDamagesPlayer = false; ExplodeOnKickDamageToEnemies = 175f; } if (currentCurse >= 3) { ExplodeOnKickChances = 0.35f; ExplodeOnKickDamageToEnemies = 200f; } } if (!ExplodeOnKickDamagesPlayer) { TableExplosionData.damageToPlayer = 0; } if (spawnObjectOnSelfDestruct && SpawnedObject != null && !m_objectSpawned) { m_objectSpawned = true; GameObject PlacedGlitchObject = ExpandUtility.GenerateDungeonPlacable(SpawnedObject, false, true).InstantiateObject(transform.position.GetAbsoluteRoom(), (specRigidbody.GetUnitCenter(ColliderType.HitBox) - transform.position.GetAbsoluteRoom().area.basePosition.ToVector2()).ToIntVector2(VectorConversions.Floor)); PlacedGlitchObject.transform.parent = transform.position.GetAbsoluteRoom().hierarchyParent; if (PlacedGlitchObject.GetComponent <PickupObject>() != null) { PickupObject PlacedGltichObjectComponent = PlacedGlitchObject.GetComponent <PickupObject>(); PlacedGltichObjectComponent.RespawnsIfPitfall = true; } } if (UnityEngine.Random.value <= ExplodeOnKickChances | willDefinitelyExplode) { if (useDefaultExplosion) { Exploder.DoDefaultExplosion(ExplosionCenterPosition, Vector2.zero, null, true, CoreDamageTypes.None); Exploder.DoRadialDamage(ExplodeOnKickDamageToEnemies, ExplosionCenterPosition, 4f, ExplodeOnKickDamagesPlayer, true, true); } else { Exploder.Explode(ExplosionCenterPosition, TableExplosionData, Vector2.zero, null, false, CoreDamageTypes.None, false); } Destroy(gameObject); return; } return; }
private void TransitionToDepart(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip) { if (!m_depatureIsPlayerless) { if (OverrideTargetFloor == GlobalDungeonData.ValidTilesets.PHOBOSGEON) { Pixelator.Instance.RegisterAdditionalRenderPass(ChaosShaders.GlitchScreenShader); } } GameManager.Instance.MainCameraController.DoDelayedScreenShake(departureShake, 0.25f, null); if (!m_depatureIsPlayerless) { for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++) { GameManager.Instance.AllPlayers[i].PrepareForSceneTransition(); } // float delay = 0.5f; float delay = 0.7f; Pixelator.Instance.FadeToBlack(delay, false, 0f); GameUIRoot.Instance.HideCoreUI(string.Empty); GameUIRoot.Instance.ToggleLowerPanels(false, false, string.Empty); if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.SUPERBOSSRUSH) { GameManager.Instance.DelayedLoadBossrushFloor(delay); } else if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.BOSSRUSH) { GameManager.Instance.DelayedLoadBossrushFloor(delay); } else { if (!GameManager.Instance.IsFoyer && GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.NONE) { GlobalDungeonData.ValidTilesets nextTileset = GameManager.Instance.GetNextTileset(GameManager.Instance.Dungeon.tileIndices.tilesetId); GameManager.DoMidgameSave(nextTileset); } if (UsesOverrideTargetFloor) { GlobalDungeonData.ValidTilesets overrideTargetFloor = OverrideTargetFloor; if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.CATACOMBGEON) { GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_catacombs"); } else if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.FORGEGEON) { GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_forge"); } else if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.OFFICEGEON) { ChaosConsole.elevatorHasBeenUsed = true; if (BraveUtility.RandomBool()) { string[] flowPath = new string[] { "custom_glitchchest_flow", "custom_glitchchestalt_flow", "custom_glitch_flow" }; ChaosUtility.PrepareGlitchFlow(BraveUtility.RandomElement(flowPath)); GameManager.Instance.DelayedLoadNextLevel(delay); } else { string[] flows = new string[] { "custom_glitchchest_flow", "custom_glitchchestalt_flow" }; GameManager.Instance.StartCoroutine(ChaosUtility.DelayedGlitchLevelLoad(delay, BraveUtility.RandomElement(flows), useNakatomiTileset: BraveUtility.RandomBool())); } } else if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.PHOBOSGEON) { ChaosUtility.RatDungeon = DungeonDatabase.GetOrLoadByName("Base_ResourcefulRat"); ChaosUtility.RatDungeon.LevelOverrideType = GameManager.LevelOverrideState.NONE; // ChaosUtility.RatDungeon.tileIndices.tilesetId = GlobalDungeonData.ValidTilesets.PHOBOSGEON; // ChaosUtility.RatDungeon.tileIndices.tilesetId = GlobalDungeonData.ValidTilesets.JUNGLEGEON; ChaosPrefabs.InitCanyonTileSet(ChaosUtility.RatDungeon, GlobalDungeonData.ValidTilesets.PHOBOSGEON); GameManager.Instance.StartCoroutine(ChaosUtility.DelayedGlitchLevelLoad(delay, "SecretGlitchFloor_Flow", true)); } else { GameManager.Instance.DelayedLoadNextLevel(delay); } } else { GameManager.Instance.DelayedLoadNextLevel(delay); } AkSoundEngine.PostEvent("Stop_MUS_All", gameObject); } } elevatorFloor.SetActive(false); animator.AnimationCompleted = (Action <tk2dSpriteAnimator, tk2dSpriteAnimationClip>)Delegate.Remove(animator.AnimationCompleted, new Action <tk2dSpriteAnimator, tk2dSpriteAnimationClip>(TransitionToDepart)); animator.PlayAndDisableObject(elevatorDepartAnimName, null); }