private void BreakEgg(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { float value = UnityEngine.Random.Range(0.0f, 1.0f); bool flag = value < 0.15; if (flag && !Owner.HasPickupID(817)) { PlayerController player = this.Owner; float curHealth = player.healthHaver.GetCurrentHealth(); AkSoundEngine.PostEvent("Play_WPN_egg_impact_01", base.gameObject); player.PlayEffectOnActor(ResourceCache.Acquire("Global VFX/VFX_Healing_Sparkles_001") as GameObject, Vector3.zero, true, false, false); player.healthHaver.ForceSetCurrentHealth(curHealth + 0.5f); UnityEngine.Object.Destroy(base.gameObject, 1f); player.DropPassiveItem(this); PickupObject.ItemQuality itemQuality = PickupObject.ItemQuality.D; PickupObject itemOfTypeAndQuality = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality, (UnityEngine.Random.value >= 0.5f) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable, false); if (itemOfTypeAndQuality) { LootEngine.SpawnItem(itemOfTypeAndQuality.gameObject, base.transform.position, Vector2.up, 0.1f, true, false, false); } } else { return; } }
protected override void Update() { PlayerController lastOwner = this.Owner; base.Update(); PickupObject.ItemQuality q = lastOwner.inventory.CurrentGun.quality; switch (lastOwner.inventory.CurrentGun.quality) { case PickupObject.ItemQuality.D: lastOwner.CurrentGun.CustomBossDamageModifier = 1.5f; break; case PickupObject.ItemQuality.C: lastOwner.CurrentGun.CustomBossDamageModifier = 1.3f; break; case PickupObject.ItemQuality.B: lastOwner.CurrentGun.CustomBossDamageModifier = 1.1f; break; //case PickupObject.ItemQuality.A: //lastOwner.CurrentGun.CustomBossDamageModifier = 1.5f; //break; case PickupObject.ItemQuality.S: lastOwner.CurrentGun.CustomBossDamageModifier = -1.1f; break; default: lastOwner.CurrentGun.CustomBossDamageModifier = 0f; break; } }
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; } }
protected override void DoEffect(PlayerController user) { if (user.CharacterUsesRandomGuns) { itemToGiveQuality = PickupObject.ItemQuality.D; spawnRecycledItem(); itemToGiveQuality = PickupObject.ItemQuality.C; spawnRecycledItem(); itemToGiveQuality = PickupObject.ItemQuality.B; spawnRecycledItem(); itemToGiveQuality = PickupObject.ItemQuality.A; spawnRecycledItem(); itemToGiveQuality = PickupObject.ItemQuality.S; spawnRecycledItem(); user.RemoveActiveItem(this.PickupObjectId); } else { if (user.CurrentGun.CanActuallyBeDropped(user)) { Gun currentGun = user.CurrentGun; PickupObject.ItemQuality itemQuality = currentGun.quality; user.inventory.DestroyCurrentGun(); if (currentGun.quality == PickupObject.ItemQuality.D) { itemToGiveQuality = PickupObject.ItemQuality.D; spawnRecycledItem(); } else if (currentGun.quality == PickupObject.ItemQuality.C) { itemToGiveQuality = PickupObject.ItemQuality.C; spawnRecycledItem(); } else if (currentGun.quality == PickupObject.ItemQuality.B) { itemToGiveQuality = PickupObject.ItemQuality.B; spawnRecycledItem(); } else if (currentGun.quality == PickupObject.ItemQuality.A) { itemToGiveQuality = PickupObject.ItemQuality.A; spawnRecycledItem(); } else if (currentGun.quality == PickupObject.ItemQuality.S) { itemToGiveQuality = PickupObject.ItemQuality.S; spawnRecycledItem(); } else { LootEngine.SpawnItem(PickupObjectDatabase.GetById(127).gameObject, LastOwner.specRigidbody.UnitCenter, Vector2.zero, 1f, false, true, false); } } else { return; } } }
private void DetermineAndSpawnMunchedGun(PlayerController player, ItemQuality recentQuality) { int randomQual = UnityEngine.Random.Range((int)recentQuality, (int)lastEatenGunQuality + 1); GameObject item = GameManager.Instance.RewardManager.GetItemForPlayer(player, GameManager.Instance.RewardManager.GunsLootTable, (ItemQuality)randomQual, null, false, null, false, null, false, RewardManager.RewardSource.UNSPECIFIED); LootEngine.SpawnItem(item, base.sprite.WorldCenter, Vector2.zero, 0); lastEatenGunQuality = ItemQuality.COMMON; base.aiActor.MovementSpeed = base.aiActor.BaseMovementSpeed; isDoingSomething = false; }
protected void CreateRewardItem() { PickupObject.ItemQuality itemQuality = PickupObject.ItemQuality.B; PickupObject itemOfTypeAndQuality = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality, (UnityEngine.Random.value >= 0.5f) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable, false); if (itemOfTypeAndQuality) { LootEngine.SpawnItem(itemOfTypeAndQuality.gameObject, base.transform.position, Vector2.up, 0.1f, true, false, false); } }
protected override void DoEffect(PlayerController user) { PickupObject.ItemQuality itemQuality = ItemQuality.D; PickupObject itemOfTypeAndQuality = LootEngine.GetItemOfTypeAndQuality <Gun>(itemQuality, GameManager.Instance.RewardManager.GunsLootTable, false); LootEngine.SpawnItem(itemOfTypeAndQuality.gameObject, LastOwner.specRigidbody.UnitCenter, Vector2.up, 1f, false, true, false); PickupObject stuffdone = LootEngine.GetItemOfTypeAndQuality <PassiveItem>(itemQuality, GameManager.Instance.RewardManager.ItemsLootTable, false); LootEngine.SpawnItem(stuffdone.gameObject, LastOwner.specRigidbody.UnitCenter, Vector2.up, 1f, false, true, false); PickupObject dothingitdo = LootEngine.GetItemOfTypeAndQuality <PlayerItem>(itemQuality, GameManager.Instance.RewardManager.ItemsLootTable, false); LootEngine.SpawnItem(dothingitdo.gameObject, LastOwner.specRigidbody.UnitCenter, Vector2.up, 1f, false, true, false); }
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_CHR_muncher_eat_01", base.gameObject); bool flag = user.CurrentGun.CanActuallyBeDropped(user); if (flag) { Gun currentGun = user.CurrentGun; PickupObject.ItemQuality quality = currentGun.quality; switch (quality) { case PickupObject.ItemQuality.D: user.inventory.DestroyCurrentGun(); this.MuncherSpawn(); break; case PickupObject.ItemQuality.C: user.inventory.DestroyCurrentGun(); this.MuncherSpawn(); break; case PickupObject.ItemQuality.B: user.inventory.DestroyCurrentGun(); this.MuncherSpawn(); break; case PickupObject.ItemQuality.A: user.inventory.DestroyCurrentGun(); LootEngine.SpawnItem(ETGMod.Databases.Items["Junk Heart"].gameObject, this.LastOwner.specRigidbody.UnitCenter, Vector2.zero, 1f, false, true, false); break; case PickupObject.ItemQuality.S: user.inventory.DestroyCurrentGun(); LootEngine.SpawnItem(ETGMod.Databases.Items["Junk Heart"].gameObject, this.LastOwner.specRigidbody.UnitCenter, Vector2.zero, 1f, false, true, false); break; default: LootEngine.SpawnItem(PickupObjectDatabase.GetById(127).gameObject, this.LastOwner.specRigidbody.UnitCenter, Vector2.zero, 1f, false, true, false); break; } } }
private PickupObject OpenS(PlayerController user) { PickupObject.ItemQuality itemQuality = PickupObject.ItemQuality.S; PickupObject itemOfTypeAndQuality = (UnityEngine.Random.value >= 0.5f) ? LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality, GameManager.Instance.RewardManager.GunsLootTable, false) : LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality, GameManager.Instance.RewardManager.ItemsLootTable, false); DebrisObject debrisObject = LootEngine.SpawnItem(itemOfTypeAndQuality.gameObject, user.CenterPosition, Vector2.up, 1f, true, true, false); if (debrisObject) { Vector2 v = (!debrisObject.sprite) ? (debrisObject.transform.position.XY() + new Vector2(0.5f, 0.5f)) : debrisObject.sprite.WorldCenter; GameObject gameObject = SpawnManager.SpawnVFX((GameObject)BraveResources.Load("Global VFX/VFX_BlackPhantomDeath", ".prefab"), v, Quaternion.identity, false); if (gameObject && gameObject.GetComponent <tk2dSprite>()) { tk2dSprite component = gameObject.GetComponent <tk2dSprite>(); component.HeightOffGround = 5f; component.UpdateZDepth(); } return(debrisObject.GetComponentInChildren <PickupObject>()); } return(null); }
public static string getUISpriteString(this PickupObject.ItemQuality q) { string icon; switch (q) { case PickupObject.ItemQuality.SPECIAL: icon = "resourceful_rat_icon_001"; break; case PickupObject.ItemQuality.COMMON: icon = "poopsack_001"; break; case PickupObject.ItemQuality.D: icon = "master_token_icon_001"; break; case PickupObject.ItemQuality.C: icon = "master_token_icon_002"; break; case PickupObject.ItemQuality.B: icon = "master_token_icon_003"; break; case PickupObject.ItemQuality.A: icon = "master_token_icon_004"; break; case PickupObject.ItemQuality.S: icon = "master_token_icon_005"; break; default: icon = "ps4_cross"; break; } return("[sprite \"" + icon + "\"]"); }
private IEnumerator Misdirect() { yield return(new WaitForSeconds(1f)); PlayerController player = this.LastOwner; PickupObject.ItemQuality itemQuality = PickupObject.ItemQuality.S; PickupObject.ItemQuality itemQuality2 = PickupObject.ItemQuality.A; PickupObject itemOfTypeAndQuality = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality, GameManager.Instance.RewardManager.ItemsLootTable, false); PickupObject itemOfTypeAndQuality2 = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality2, GameManager.Instance.RewardManager.ItemsLootTable, false); LootEngine.SpawnItem(itemOfTypeAndQuality.gameObject, player.specRigidbody.UnitCenter, Vector2.left, 1f, false, true, false); LootEngine.SpawnItem(itemOfTypeAndQuality2.gameObject, player.specRigidbody.UnitCenter, Vector2.right, 1f, false, true, false); yield return(new WaitForSeconds(15f)); string text; string header; header = "I told you not to press it"; text = "Prepare to feel the pain"; this.Notify(header, text); yield return(new WaitForSeconds(2f)); Material glitchPass = new Material(Shader.Find("Brave/Internal/GlitchUnlit")); Pixelator.Instance.RegisterAdditionalRenderPass(glitchPass); yield return(new WaitForSeconds(2f)); GameManager.Instance.InjectedFlowPath = "Core Game Flows/Secret_DoubleBeholster_Flow"; Pixelator.Instance.FadeToBlack(0.5f, false, 0f); GameManager.Instance.DelayedLoadNextLevel(0.5f); yield return(new WaitForSeconds(1f)); PlayerController user = this.LastOwner; user.healthHaver.NextShotKills = true; yield break; }
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 SpawnBonusItem(HealthHaver enemy, PickupObject.ItemQuality itemQuality) { GameManager.Instance.RewardManager.SpawnTotallyRandomItem(enemy.specRigidbody.UnitCenter, itemQuality, itemQuality); }
private void OnEnemyDamaged(float damage, bool fatal, HealthHaver enemy) { bool flag = fatal && enemy.aiActor; if (flag) { { int numure = UnityEngine.Random.Range(0, 4); bool fuckye = numure == 0 | numure == 1 | numure == 2; if (fuckye) { bool flag3 = this.mimicGuids.Contains(enemy.aiActor.EnemyGuid); if (flag3) { int id = BraveUtility.RandomElement <int>(BunnysFoot.Lootdrops); LootEngine.SpawnItem(PickupObjectDatabase.GetById(id).gameObject, enemy.specRigidbody.UnitCenter, Vector2.down, .7f, false, true, false); } } bool fuckye1 = numure == 3; if (fuckye1) { PickupObject.ItemQuality itemQuality = PickupObject.ItemQuality.D; bool flag3 = enemy.aiActor.EnemyGuid == "2ebf8ef6728648089babb507dec4edb7"; if (flag3) { itemQuality = PickupObject.ItemQuality.D; this.SpawnBonusItem(enemy, itemQuality); } else { bool flag4 = enemy.aiActor.EnemyGuid == "d8d651e3484f471ba8a2daa4bf535ce6"; if (flag4) { itemQuality = PickupObject.ItemQuality.C; this.SpawnBonusItem(enemy, itemQuality); } else { bool flag5 = enemy.aiActor.EnemyGuid == "abfb454340294a0992f4173d6e5898a8"; if (flag5) { itemQuality = PickupObject.ItemQuality.B; this.SpawnBonusItem(enemy, itemQuality); } else { bool flag6 = enemy.aiActor.EnemyGuid == "d8fd592b184b4ac9a3be217bc70912a2"; if (flag6) { itemQuality = PickupObject.ItemQuality.A; this.SpawnBonusItem(enemy, itemQuality); } else { bool flag7 = enemy.aiActor.EnemyGuid == "6450d20137994881aff0ddd13e3d40c8"; if (flag7) { itemQuality = PickupObject.ItemQuality.S; this.SpawnBonusItem(enemy, itemQuality); } } } } } } } } }
protected override void Update() { //PlayerController player = base.Owner as PlayerController; //{ // Material mat = new Material(EnemyDatabase.GetOrLoadByName("GunNut").sprite.renderer.material); // mat.mainTexture = player.sprite.renderer.material.mainTexture; //mat.SetColor("_EmissiveColor", new Color32(67, 225, 240, 255)); //mat.SetFloat("_EmissiveColorPower", 1.55f); //mat.SetFloat("_EmissivePower", 100); //player.sprite.renderer.material = mat; //} Gun currentGun = base.Owner.CurrentGun; PickupObject.ItemQuality quality = currentGun.quality; this.CurrentGuns = 1; this.LastGuns = 2; base.Owner.inventory.AllGuns.Count(); { bool characterUsesRandomGuns = base.Owner.CharacterUsesRandomGuns; if (characterUsesRandomGuns) { bool autoscrap = Commands.ModularDoesntAutoScrapGunsInBlessed; if (autoscrap) { } else { bool flag2 = CurrentGuns != this.LastGuns; bool flag3 = flag2; if (flag3) { if (this.m_owner.CurrentGun.PickupObjectId != ModuleGunID) { bool flagh = currentGun.quality == PickupObject.ItemQuality.D; if (flagh) { base.Owner.healthHaver.Armor = base.Owner.healthHaver.Armor + 1f; this.StripGun(); this.AddModule(); } else { bool flage = currentGun.quality == PickupObject.ItemQuality.C; if (flage) { base.Owner.healthHaver.Armor = base.Owner.healthHaver.Armor + 1f; this.StripGun(); this.AddT2Module(); } else { bool flagt = currentGun.quality == PickupObject.ItemQuality.B; if (flagt) { this.StripGun(); this.AddModule(); this.AddT2Module(); } else { bool flagi = currentGun.quality == PickupObject.ItemQuality.A; if (flagi) { this.StripGun(); this.T3Module(); this.AddT2Module(); } else { bool flag6 = currentGun.quality == PickupObject.ItemQuality.S; if (flag6) { this.StripGun(); this.AddModule(); this.T3Module(); this.AddT2Module(); } else { this.StripGun(); this.AddModule(); } } } } } bool flagsandwich = base.Owner.HasPickupID(Game.Items["lichs_eye_bullets"].PickupObjectId); if (flagsandwich) { AkSoundEngine.PostEvent("Play_OBJ_metronome_jingle_01", base.gameObject); this.AddModule(); } } } } } else { bool flag2 = CurrentGuns != this.LastGuns; bool flag3 = flag2; if (flag3) { if (this.m_owner.CurrentGun.PickupObjectId != ModuleGunID) { bool flagh = currentGun.quality == PickupObject.ItemQuality.D; if (flagh) { base.Owner.healthHaver.Armor = base.Owner.healthHaver.Armor + 2f; this.StripGun(); this.AddModule(); } else { bool flage = currentGun.quality == PickupObject.ItemQuality.C; if (flage) { base.Owner.healthHaver.Armor = base.Owner.healthHaver.Armor + 1f; this.StripGun(); this.AddT2Module(); } else { bool flagt = currentGun.quality == PickupObject.ItemQuality.B; if (flagt) { this.StripGun(); this.AddModule(); this.AddT2Module(); } else { bool flagi = currentGun.quality == PickupObject.ItemQuality.A; if (flagi) { this.StripGun(); this.T3Module(); this.AddT2Module(); } else { bool flag6 = currentGun.quality == PickupObject.ItemQuality.S; if (flag6) { this.StripGun(); this.AddModule(); this.T3Module(); this.AddT2Module(); } else { this.StripGun(); this.AddModule(); } } } } } bool flagsandwich = base.Owner.HasPickupID(Game.Items["lichs_eye_bullets"].PickupObjectId); if (flagsandwich) { AkSoundEngine.PostEvent("Play_OBJ_metronome_jingle_01", base.gameObject); this.AddModule(); } } } } } }
//Doubles the damage, makes the next shot kill the player, and stores the amount we buffed the player for later private void StartEffect(PlayerController user) { int gunRng = UnityEngine.Random.Range(1, 100); PlayerController player = this.LastOwner; switch (gunRng) { case 1: PickupObject.ItemQuality itemQualityS = PickupObject.ItemQuality.S; PickupObject itemOfTypeAndQualityS = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQualityS, GameManager.Instance.RewardManager.GunsLootTable, false); LootEngine.SpawnItem(itemOfTypeAndQualityS.gameObject, player.specRigidbody.UnitCenter, Vector2.left, 1f, false, true, false); break; case 2: case 3: PickupObject.ItemQuality itemQualityA = PickupObject.ItemQuality.A; PickupObject itemOfTypeAndQualityA = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQualityA, GameManager.Instance.RewardManager.GunsLootTable, false); LootEngine.SpawnItem(itemOfTypeAndQualityA.gameObject, player.specRigidbody.UnitCenter, Vector2.left, 1f, false, true, false); break; case 4: case 5: case 6: case 7: PickupObject.ItemQuality itemQualityB = PickupObject.ItemQuality.B; PickupObject itemOfTypeAndQualityB = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQualityB, GameManager.Instance.RewardManager.GunsLootTable, false); LootEngine.SpawnItem(itemOfTypeAndQualityB.gameObject, player.specRigidbody.UnitCenter, Vector2.left, 1f, false, true, false); break; case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: PickupObject.ItemQuality itemQualityC = PickupObject.ItemQuality.C; PickupObject itemOfTypeAndQualityC = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQualityC, GameManager.Instance.RewardManager.GunsLootTable, false); LootEngine.SpawnItem(itemOfTypeAndQualityC.gameObject, player.specRigidbody.UnitCenter, Vector2.left, 1f, false, true, false); break; case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: PickupObject.ItemQuality itemQualityD = PickupObject.ItemQuality.D; PickupObject itemOfTypeAndQualityD = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQualityD, GameManager.Instance.RewardManager.GunsLootTable, false); LootEngine.SpawnItem(itemOfTypeAndQualityD.gameObject, player.specRigidbody.UnitCenter, Vector2.left, 1f, false, true, false); break; default: LootEngine.SpawnItem(PickupObjectDatabase.GetById(31).gameObject, player.specRigidbody.UnitCenter, Vector2.left, 1f, false, true, false); break; } }
private static IEnumerator ToilEnemyDupe(AIActor AIActor) { yield return(null); string guid = AIActor.EnemyGuid; var enemyPrefab = EnemyDatabase.GetOrLoadByGuid(guid); AIActor aiactor = AIActor.Spawn(enemyPrefab, AIActor.gameActor.CenterPosition.ToIntVector2(VectorConversions.Floor), AIActor.GetAbsoluteParentRoom(), true, AIActor.AwakenAnimationType.Default, true); HasBeenAffectedByCurrentChallenge challengitude = aiactor.gameObject.AddComponent <HasBeenAffectedByCurrentChallenge>(); challengitude.linkedOther = AIActor; HasBeenAffectedByCurrentChallenge challengitude2 = AIActor.gameObject.AddComponent <HasBeenAffectedByCurrentChallenge>(); challengitude2.linkedOther = aiactor; aiactor.procedurallyOutlined = true; AIActor.procedurallyOutlined = true; aiactor.IsWorthShootingAt = AIActor.IsWorthShootingAt; aiactor.IgnoreForRoomClear = AIActor.IgnoreForRoomClear; aiactor.AssignedCurrencyToDrop = AIActor.AssignedCurrencyToDrop; aiactor.AdditionalSafeItemDrops = AIActor.AdditionalSafeItemDrops; aiactor.AdditionalSimpleItemDrops = AIActor.AdditionalSimpleItemDrops; aiactor.CanTargetEnemies = AIActor.CanTargetEnemies; aiactor.CanTargetPlayers = AIActor.CanTargetPlayers; if (AIActor.IsInReinforcementLayer) { aiactor.HandleReinforcementFallIntoRoom(0f); } if (AIActor.GetComponent <KillOnRoomClear>() != null) { KillOnRoomClear kill = aiactor.gameObject.GetOrAddComponent <KillOnRoomClear>(); kill.overrideDeathAnim = AIActor.GetComponent <KillOnRoomClear>().overrideDeathAnim; kill.preventExplodeOnDeath = AIActor.GetComponent <KillOnRoomClear>().preventExplodeOnDeath; } if (aiactor.EnemyGuid == "22fc2c2c45fb47cf9fb5f7b043a70122") { aiactor.CollisionDamage = 0f; aiactor.specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.PlayerHitBox)); aiactor.specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.Projectile)); } else if (aiactor.EnemyGuid == "249db525a9464e5282d02162c88e0357") { if (aiactor.gameObject.GetComponent <SpawnEnemyOnDeath>()) { UnityEngine.Object.Destroy(aiactor.gameObject.GetComponent <SpawnEnemyOnDeath>()); } } else if (EasyEnemyTypeLists.VanillaMimics.Contains(aiactor.EnemyGuid)) { if (AIActor.AdditionalSafeItemDrops != null && aiactor.AdditionalSafeItemDrops != null) { List <PickupObject> newDrops = new List <PickupObject>(); PickupObject.ItemQuality qual = PickupObject.ItemQuality.D; int itemsToReAdd = 0; for (int i = (aiactor.AdditionalSafeItemDrops.Count - 1); i >= 0; i--) { if (!BabyGoodChanceKin.lootIDlist.Contains(aiactor.AdditionalSafeItemDrops[i].PickupObjectId)) { qual = aiactor.AdditionalSafeItemDrops[i].quality; itemsToReAdd++; } else { newDrops.Add(PickupObjectDatabase.GetById(aiactor.AdditionalSafeItemDrops[i].PickupObjectId)); } } if (itemsToReAdd > 0) { for (int i = 0; i < itemsToReAdd; i++) { PickupObject item = LootEngine.GetItemOfTypeAndQuality <PassiveItem>(qual, null, false); if (UnityEngine.Random.value <= 0.5f) { item = LootEngine.GetItemOfTypeAndQuality <Gun>(qual, null, false); } newDrops.Add(item); } aiactor.AdditionalSafeItemDrops = newDrops; } } } GameManager.Instance.StartCoroutine(Shrimk(aiactor)); GameManager.Instance.StartCoroutine(Shrimk(AIActor)); aiactor.specRigidbody.Reinitialize(); yield break; }
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; }
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 GetItem() { PlayerController user = this.LastOwner; float value = UnityEngine.Random.Range(0.0f, 1f); bool flag = value < 0.7; if (flag) { PickupObject.ItemQuality itemQuality = PickupObject.ItemQuality.D; PickupObject itemOfTypeAndQuality = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality, (UnityEngine.Random.value >= 0.5f) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable, false); if (itemOfTypeAndQuality) { LootEngine.SpawnItem(itemOfTypeAndQuality.gameObject, user.CenterPosition, Vector2.up, 1f, true, true, false); } } else { bool flag2 = value < 0.85; if (flag2) { PickupObject.ItemQuality itemQuality5 = PickupObject.ItemQuality.C; PickupObject itemOfTypeAndQuality5 = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality5, (UnityEngine.Random.value >= 0.5f) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable, false); if (itemOfTypeAndQuality5) { LootEngine.SpawnItem(itemOfTypeAndQuality5.gameObject, user.CenterPosition, Vector2.up, 1f, true, true, false); } } else { bool flag3 = value < 0.95; if (flag3) { PickupObject.ItemQuality itemQuality4 = PickupObject.ItemQuality.B; PickupObject itemOfTypeAndQuality4 = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality4, (UnityEngine.Random.value >= 0.5f) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable, false); if (itemOfTypeAndQuality4) { LootEngine.SpawnItem(itemOfTypeAndQuality4.gameObject, user.CenterPosition, Vector2.up, 1f, true, true, false); } } else { bool flag4 = value < 0.98; if (flag4) { PickupObject.ItemQuality itemQuality3 = PickupObject.ItemQuality.A; PickupObject itemOfTypeAndQuality3 = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality3, (UnityEngine.Random.value >= 0.5f) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable, false); if (itemOfTypeAndQuality3) { LootEngine.SpawnItem(itemOfTypeAndQuality3.gameObject, user.CenterPosition, Vector2.up, 1f, true, true, false); } } else { PickupObject.ItemQuality itemQuality2 = PickupObject.ItemQuality.S; PickupObject itemOfTypeAndQuality2 = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality2, (UnityEngine.Random.value >= 0.5f) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable, false); if (itemOfTypeAndQuality2) { LootEngine.SpawnItem(itemOfTypeAndQuality2.gameObject, user.CenterPosition, Vector2.up, 1f, true, true, false); } } } } } }
public static IEnumerator SpewGun(PlayerController user) { yield return(new WaitForSeconds(0.5f)); PlayerController lastOwner = user; float num = UnityEngine.Random.Range(0f, 1f); bool flag = (double)num < 0.7; bool flag2 = flag; if (flag2) { PickupObject.ItemQuality itemQuality = PickupObject.ItemQuality.D; PickupObject itemOfTypeAndQuality = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality, GameManager.Instance.RewardManager.GunsLootTable, false); bool flag3 = itemOfTypeAndQuality; if (flag3) { LootEngine.SpawnItem(itemOfTypeAndQuality.gameObject, lastOwner.CenterPosition, Vector2.up, 1f, true, true, false); } } else { bool flag4 = (double)num < 0.85; bool flag5 = flag4; if (flag5) { PickupObject.ItemQuality itemQuality2 = PickupObject.ItemQuality.C; PickupObject itemOfTypeAndQuality2 = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality2, GameManager.Instance.RewardManager.GunsLootTable, false); bool flag6 = itemOfTypeAndQuality2; if (flag6) { LootEngine.SpawnItem(itemOfTypeAndQuality2.gameObject, lastOwner.CenterPosition, Vector2.up, 1f, true, true, false); } } else { bool flag7 = (double)num < 0.95; bool flag8 = flag7; if (flag8) { PickupObject.ItemQuality itemQuality3 = PickupObject.ItemQuality.B; PickupObject itemOfTypeAndQuality3 = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality3, GameManager.Instance.RewardManager.GunsLootTable, false); bool flag9 = itemOfTypeAndQuality3; if (flag9) { LootEngine.SpawnItem(itemOfTypeAndQuality3.gameObject, lastOwner.CenterPosition, Vector2.up, 1f, true, true, false); } } else { bool flag10 = (double)num < 0.98; bool flag11 = flag10; if (flag11) { PickupObject.ItemQuality itemQuality4 = PickupObject.ItemQuality.A; PickupObject itemOfTypeAndQuality4 = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality4, GameManager.Instance.RewardManager.GunsLootTable, false); bool flag12 = itemOfTypeAndQuality4; if (flag12) { LootEngine.SpawnItem(itemOfTypeAndQuality4.gameObject, lastOwner.CenterPosition, Vector2.up, 1f, true, true, false); } } else { PickupObject.ItemQuality itemQuality5 = PickupObject.ItemQuality.S; PickupObject itemOfTypeAndQuality5 = LootEngine.GetItemOfTypeAndQuality <PickupObject>(itemQuality5, GameManager.Instance.RewardManager.GunsLootTable, false); bool flag13 = itemOfTypeAndQuality5; if (flag13) { LootEngine.SpawnItem(itemOfTypeAndQuality5.gameObject, lastOwner.CenterPosition, Vector2.up, 1f, true, true, false); } } } } } yield break; }
public static void OnOpen(Action <Chest, PlayerController> orig, Chest self, PlayerController player) { if (self.breakAnimName.Contains("black")) { AdvancedGameStatsManager.Instance.SetFlag(CustomDungeonFlags.CUSTOMFLAG_OPENED_BLACK_CHEST, true); } if (ETGMod.Databases.Items["Suspiscious Strongbox"] != null) { bool hasSynergy = player.PlayerHasActiveSynergy("#BOWLERS_APPROVAL"); if (hasSynergy && GameStatsManager.Instance.IsRainbowRun && !self.IsRainbowChest) { List <PickupObject> d = self.PredictContents(player); List <int> b = new List <int>(); foreach (PickupObject po in d) { b.Add(po.PickupObjectId); } self.BecomeRainbowChest(); self.forceContentIds = b; } } bool hasCloversFlowersSynergy = player.PlayerHasActiveSynergy("#CLOVERS_FLOWERS"); if (hasCloversFlowersSynergy) { self.PredictContents(player); self.contents.Add(UnityEngine.Random.value < 0.5f ? PickupObjectDatabase.GetById(78) : PickupObjectDatabase.GetById(600)); } foreach (PassiveItem passive in player.passiveItems) { if (passive is KeyOfChaosItem) { if (!self.IsLocked && !self.IsLockBroken && !self.IsSealed) { if (player.PlayerHasActiveSynergy("#KEY_OF_BATTLE")) { player.ownerlessStatModifiers.Add(Toolbox.SetupStatModifier(PlayerStats.StatType.Damage, 1.75f, StatModifier.ModifyMethod.MULTIPLICATIVE, true)); } List <PickupObject> d = self.PredictContents(player); if (d != null) { List <int> contentIds = new List <int>(); foreach (PickupObject po in d) { PickupObject.ItemQuality quality = po.quality; float value = UnityEngine.Random.value; bool doubleChaos = player.PlayerHasActiveSynergy("#THERE_IS_ONLY_CHAOS") && UnityEngine.Random.value < 0.5f; bool dropJunk = false; bool isChaosJunk = false; if (value < 0.25f) { if (po.quality != ItemQuality.SPECIAL && po.quality != ItemQuality.EXCLUDED && po.quality != ItemQuality.COMMON) { if ((po.quality == ItemQuality.D && !doubleChaos) || (po.quality == ItemQuality.C && doubleChaos)) { dropJunk = true; } else if (po.quality == ItemQuality.D && doubleChaos) { dropJunk = true; isChaosJunk = true; } else { quality -= doubleChaos ? 2 : 1; } } } else if (value < 0.5f) { if (po.quality != ItemQuality.SPECIAL && po.quality != ItemQuality.EXCLUDED && po.quality != ItemQuality.COMMON) { if ((po.quality == ItemQuality.S && !doubleChaos) || (po.quality == ItemQuality.A && doubleChaos)) { contentIds.Add(LootEngine.GetItemOfTypeAndQuality <PickupObject>(ItemQuality.D, UnityEngine.Random.value < 0.5f ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable).PickupObjectId); } if (po.quality == ItemQuality.S && doubleChaos) { contentIds.Add(LootEngine.GetItemOfTypeAndQuality <PickupObject>(ItemQuality.C, UnityEngine.Random.value < 0.5f ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable).PickupObjectId); } else { quality += doubleChaos ? 2 : 1; } } } if (!dropJunk) { PickupObject item; if (quality != ItemQuality.COMMON && quality != ItemQuality.EXCLUDED && quality != ItemQuality.SPECIAL) { item = LootEngine.GetItemOfTypeAndQuality <PickupObject>(quality, UnityEngine.Random.value < 0.5f ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable); } else { item = po; } contentIds.Add(item.PickupObjectId); } else { contentIds.Add(isChaosJunk ? SpecialItemIds.PointlessJunk : GlobalItemIds.Junk); } } self.contents = null; self.forceContentIds = contentIds; self.ChestType = (Chest.GeneralChestType)UnityEngine.Random.Range(1, 2); } } } } orig(self, player); }