private void DoRandomRoomSpawns(RoomHandler room) { for (int i = 0; i < 2; i++) { Vector3 positionToSpawn3 = room.GetRandomVisibleClearSpot(2, 2).ToVector3(); SpawnObjectManager.SpawnObject(BraveUtility.RandomElement(PossibleObjects), positionToSpawn3, EasyVFXDatabase.BloodiedScarfPoofVFX); } }
protected override void DoEffect(PlayerController user) { try { IntVector2 bestRewardLocation2 = user.CurrentRoom.GetBestRewardLocation(IntVector2.One * 2, RoomHandler.RewardLocationStyle.PlayerCenter, true); Vector3 convertedVector = bestRewardLocation2.ToVector3(); FireplaceController Fireplace = null; if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CASTLEGEON) { Fireplace = FindObjectOfType <FireplaceController>(); } GameObject thingToSpawn = BraveUtility.RandomElement(PossibleObjects); if (Fireplace != null && Fireplace.transform.position.GetAbsoluteRoom() == user.CurrentRoom) { thingToSpawn = EasyPlaceableObjects.WaterBarrel; } if (UnityEngine.Random.value <= 0.01f) { IntVector2 bestRewardLocation = user.CurrentRoom.GetBestRewardLocation(IntVector2.One * 2, RoomHandler.RewardLocationStyle.PlayerCenter, true); Chest brown_Chest = GameManager.Instance.RewardManager.D_Chest; brown_Chest.IsLocked = false; brown_Chest.ChestType = Chest.GeneralChestType.UNSPECIFIED; Chest spawnedChest = Chest.Spawn(brown_Chest, bestRewardLocation); spawnedChest.lootTable.lootTable = (UnityEngine.Random.value <= 0.5f ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable); spawnedChest.RegisterChestOnMinimap(spawnedChest.GetAbsoluteParentRoom()); } else { SpawnObjectManager.SpawnObject(thingToSpawn, convertedVector, EasyVFXDatabase.BloodiedScarfPoofVFX); } if (user.PlayerHasActiveSynergy("His Grace")) { KillRandomEnemy(user.CurrentRoom); } if (user.PlayerHasActiveSynergy("Sharpest Tool In The Shed")) { DoRandomRoomSpawns(user.CurrentRoom); } } catch (Exception e) { ETGModConsole.Log(e.Message); ETGModConsole.Log(e.StackTrace); } }