public static void triggerAlchemistReaction(Mod mod, Player player, OrchidModPlayer modPlayer) { string floatingTextStr = "Failed reaction ..."; AlchemistHiddenReactionRecipe hiddenReaction = new RecipeBlank(); foreach (AlchemistHiddenReactionRecipe recipe in OrchidMod.alchemistReactionRecipes) { bool goodIngredients = true; if (modPlayer.alchemistNbElements == recipe.ingredients.Count) { foreach (int ingredientID in recipe.ingredients) { if (!(OrchidModAlchemistHelper.containsAlchemistFlask(ingredientID, player, modPlayer))) { if (!AlchemistHiddenReactionHelper.checkSubstitutes(ingredientID, mod, player, modPlayer)) { goodIngredients = false; break; } } } if (goodIngredients) { hiddenReaction = recipe; floatingTextStr = recipe.name; int val = 0; Item item = new Item(); foreach (int ingredientID in recipe.ingredients) { item.SetDefaults(ingredientID); OrchidModGlobalItem globalItem = item.GetGlobalItem <OrchidModGlobalItem>(); val += globalItem.alchemistPotencyCost; } val = (int)(val / 2); CombatText.NewText(player.Hitbox, new Color(128, 255, 0), val); modPlayer.alchemistPotency += modPlayer.alchemistPotency + val > modPlayer.alchemistPotencyMax ? modPlayer.alchemistPotencyMax : modPlayer.alchemistPotency; break; } } } Color floatingTextColor = hiddenReaction.typeName != "RecipeBlank" ? new Color(128, 255, 0) : new Color(255, 0, 0); CombatText.NewText(player.Hitbox, floatingTextColor, floatingTextStr); if (hiddenReaction.typeName == "RecipeBlank") { player.AddBuff((BuffType <Alchemist.Buffs.Debuffs.ReactionCooldown>()), 60 * 5); for (int i = 0; i < 15; i++) { int dust = Dust.NewDust(player.Center, 10, 10, 37); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 2f; Main.dust[dust].scale *= 1.2f; } for (int i = 0; i < 10; i++) { int dust = Dust.NewDust(player.Center, 10, 10, 6); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 2f; Main.dust[dust].scale *= 1.5f; } Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 16); } else { triggerAlchemistReactionEffects(hiddenReaction, mod, player, modPlayer); if (!(modPlayer.alchemistKnownReactions.Contains(hiddenReaction.typeName))) { if (modPlayer.alchemistKnownHints.Contains(hiddenReaction.typeName)) { modPlayer.alchemistKnownHints.Remove(hiddenReaction.typeName); } modPlayer.alchemistKnownReactions.Add(hiddenReaction.typeName); floatingTextColor = new Color(255, 187, 0); floatingTextStr = "New Entry"; Rectangle rect = player.Hitbox; rect.Y -= 50; CombatText.NewText(rect, floatingTextColor, floatingTextStr); } } int colorRed = modPlayer.alchemistColorR; int colorGreen = modPlayer.alchemistColorG; int colorBlue = modPlayer.alchemistColorB; int rand = 2 + Main.rand.Next(3); for (int i = 0; i < rand; i++) { int proj = ProjectileType <Alchemist.Projectiles.AlchemistSmoke1>(); Vector2 vel = (new Vector2(0f, -((float)(2 + Main.rand.Next(5)))).RotatedByRandom(MathHelper.ToRadians(180))); int smokeProj = Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, proj, 0, 0f, player.whoAmI); Main.projectile[smokeProj].localAI[0] = colorRed; Main.projectile[smokeProj].localAI[1] = colorGreen; Main.projectile[smokeProj].ai[1] = colorBlue; } rand = 1 + Main.rand.Next(3); for (int i = 0; i < rand; i++) { int proj = ProjectileType <Alchemist.Projectiles.AlchemistSmoke2>(); Vector2 vel = (new Vector2(0f, -((float)(2 + Main.rand.Next(5)))).RotatedByRandom(MathHelper.ToRadians(180))); int smokeProj = Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, proj, 0, 0f, player.whoAmI); Main.projectile[smokeProj].localAI[0] = colorRed; Main.projectile[smokeProj].localAI[1] = colorGreen; Main.projectile[smokeProj].ai[1] = colorBlue; } rand = Main.rand.Next(2); for (int i = 0; i < rand; i++) { int proj = ProjectileType <Alchemist.Projectiles.AlchemistSmoke3>(); Vector2 vel = (new Vector2(0f, -((float)(2 + Main.rand.Next(5)))).RotatedByRandom(MathHelper.ToRadians(180))); int smokeProj = Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, proj, 0, 0f, player.whoAmI); Main.projectile[smokeProj].localAI[0] = colorRed; Main.projectile[smokeProj].localAI[1] = colorGreen; Main.projectile[smokeProj].ai[1] = colorBlue; } AlchemistHiddenReactionHelper.bonusReactionEffects(mod, player, modPlayer); modPlayer.alchemistFlaskDamage = 0; modPlayer.alchemistNbElements = 0; OrchidModAlchemistHelper.clearAlchemistElements(player, modPlayer, mod); OrchidModAlchemistHelper.clearAlchemistFlasks(player, modPlayer, mod); OrchidModAlchemistHelper.clearAlchemistColors(player, modPlayer, mod); modPlayer.alchemistSelectUIDisplay = false; }