From 18cbd1c3e4e8eb83e0eefcf809c5854843c3f05c Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 9 Jun 2020 22:17:50 -0400 Subject: [PATCH] moved flasks to a switch case --- CalPlayer/CalamityPlayer.cs | 222 +++++++++++-------------- CalPlayer/CalamityPlayerMiscEffects.cs | 8 +- Projectiles/Magic/BeamingBolt.cs | 1 + 3 files changed, 102 insertions(+), 129 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a3e7def164..86f194fea7 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4361,37 +4361,30 @@ namespace CalamityMod.CalPlayer } if (item.Calamity().rogue) { - if (player.meleeEnchant > 0) - { - if (player.meleeEnchant == 1) - { - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 2) - { - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 3) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 5) - { - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - } - if (player.meleeEnchant == 6) - { - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - } - if (player.meleeEnchant == 8) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - } - /*if (player.meleeEnchant == 4) - { - target.AddBuff(BuffID.Midas, 120, false); - }*/ - } + switch (player.meleeEnchant) + { + case 1: + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + break; + case 2: + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + break; + case 3: + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + break; + case 5: + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + break; + case 6: + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + break; + case 8: + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + break; + /*case 4: + target.AddBuff(BuffID.Midas, 120, false); + break;*/ + } } if (holyWrath) { @@ -4560,37 +4553,30 @@ namespace CalamityMod.CalPlayer } if (proj.Calamity().rogue) { - if (player.meleeEnchant > 0) - { - if (player.meleeEnchant == 1) - { - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 2) - { - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 3) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 5) - { - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - } - if (player.meleeEnchant == 6) - { - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - } - if (player.meleeEnchant == 8) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 4) - { - target.AddBuff(BuffID.Midas, 120, false); - } - } + switch (player.meleeEnchant) + { + case 1: + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + break; + case 2: + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + break; + case 3: + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + break; + case 5: + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + break; + case 6: + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + break; + case 8: + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + break; + /*case 4: + target.AddBuff(BuffID.Midas, 120, false); + break;*/ + } if (etherealExtorter) { if (ZoneSunkenSea) @@ -4715,37 +4701,30 @@ namespace CalamityMod.CalPlayer } if (item.Calamity().rogue) { - if (player.meleeEnchant > 0) - { - if (player.meleeEnchant == 1) - { - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 2) - { - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 3) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 5) - { - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - } - if (player.meleeEnchant == 6) - { - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - } - if (player.meleeEnchant == 8) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - } - /*if (player.meleeEnchant == 4) - { - target.AddBuff(BuffID.Midas, 120, false); - }*/ - } + switch (player.meleeEnchant) + { + case 1: + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + break; + case 2: + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + break; + case 3: + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + break; + case 5: + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + break; + case 6: + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + break; + case 8: + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + break; + /*case 4: + target.AddBuff(BuffID.Midas, 120, false); + break;*/ + } } if (holyWrath) { @@ -4909,37 +4888,30 @@ namespace CalamityMod.CalPlayer } if (proj.Calamity().rogue) { - if (player.meleeEnchant > 0) - { - if (player.meleeEnchant == 1) - { - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 2) - { - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 3) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 5) - { - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - } - if (player.meleeEnchant == 6) - { - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - } - if (player.meleeEnchant == 8) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - } - /*if (player.meleeEnchant == 4) - { + switch (player.meleeEnchant) + { + case 1: + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + break; + case 2: + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + break; + case 3: + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + break; + case 5: + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + break; + case 6: + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + break; + case 8: + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + break; + /*case 4: target.AddBuff(BuffID.Midas, 120, false); - }*/ - } + break;*/ + } if (etherealExtorter) { if (ZoneSunkenSea) @@ -4951,10 +4923,10 @@ namespace CalamityMod.CalPlayer target.AddBuff(ModContent.BuffType(), 120, false); target.AddBuff(ModContent.BuffType(), 300, false); } - if (Main.moonPhase == 6) //first quarter + /*if (Main.moonPhase == 6) //first quarter { target.AddBuff(BuffID.Midas, 120, false); - } + }*/ if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type)) { target.AddBuff(ModContent.BuffType(), 240, false); diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 411b315321..d9736342f6 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3087,13 +3087,13 @@ namespace CalamityMod.CalPlayer float num3 = player.position.Y - Main.player[myPlayer].position.Y; if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) - Main.player[myPlayer].AddBuff(43, 20, true); + Main.player[myPlayer].AddBuff(BuffID.PaladinsShield, 20, true); } } } if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - player.AddBuff(62, 5, true); + player.AddBuff(BuffID.IceBarrier, 5, true); if (player.statLife <= (int)(player.statLifeMax2 * 0.15)) player.endurance += 0.05f; } @@ -3112,13 +3112,13 @@ namespace CalamityMod.CalPlayer float num3 = player.position.Y - Main.player[myPlayer].position.Y; if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) - Main.player[myPlayer].AddBuff(43, 20, true); + Main.player[myPlayer].AddBuff(BuffID.PaladinsShield, 20, true); } } } if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - player.AddBuff(62, 5, true); + player.AddBuff(BuffID.IceBarrier, 5, true); if (player.statLife <= (int)(player.statLifeMax2 * 0.15)) player.endurance += 0.05f; } diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index f33b377bc5..38ad3ba37f 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic {