diff --git a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs index e919f45390..4f67a37f6f 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs @@ -6,103 +6,108 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class MadAlchemistsCocktailAlt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mad Alchemist's Cocktail"); - } + public class MadAlchemistsCocktailAlt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mad Alchemist's Cocktail"); + } - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - } + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + } - public override void AI() - { - MadAlchemistsCocktailBlue.FlaskAI(); - } + public override void AI() + { + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Poisoned, 300); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.CursedInferno, 180); - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.ShadowFlame, 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(BuffID.Poisoned, 300); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.CursedInferno, 180); + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.ShadowFlame, 300); + } - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Poisoned, 300); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.CursedInferno, 180); - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.ShadowFlame, 300); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item107, projectile.position); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - int height = 120; - float dustScaleA = 2.5f; - float dustScaleB = 1.8f; - Vector2 dustDirection = (-MathHelper.PiOver2).ToRotationVector2(); - Vector2 dustVel = dustDirection * projectile.velocity.Length() * projectile.MaxUpdates; - Main.PlaySound(SoundID.Item20, projectile.Center); - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage *= 2; - projectile.Damage(); - for (int i = 0; i < 40; i++) - { - int prettyEffects = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 200, default, dustScaleA); - Dust dust = Main.dust[prettyEffects]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; - dust.noGravity = true; - dust.velocity *= 4f; - dust.velocity += dustVel * Main.rand.NextFloat(); - prettyEffects = Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 100, default, dustScaleB); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; - dust.velocity *= 3f; - dust.noGravity = true; - prettyEffects = Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, 0f, 0f, 100, default, dustScaleB); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; - dust.velocity *= 2f; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Green * 0.5f; - dust.velocity += dustVel * Main.rand.NextFloat(); - } - for (int j = 0; j < 20; j++) - { - int dusty = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 0, default, num52); - Dust dust = Main.dust[dusty]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - dust.noGravity = true; - dust.velocity *= 0.5f; - dust.velocity += dustVel * (0.6f + 0.6f * Main.rand.NextFloat()); - } - } - } + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item107, projectile.position); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + int height = 120; + float num51 = 1.8f; + float num52 = 2.5f; + Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Main.PlaySound(SoundID.Item20, projectile.Center); + projectile.position = projectile.Center; + projectile.width = projectile.height = height; + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.damage *= 2; + projectile.Damage(); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 200, default, num52); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 4f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 3f; + Main.dust[num54].noGravity = true; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Green * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 0, default, num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs index fae5e77400..801fa20a18 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs @@ -25,37 +25,33 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - FlaskAI(); - } - - public static void FlaskAI() - { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * projectile.direction; - if (projectile.ai[0]++ >= 90f) + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) { - projectile.velocity.Y += 0.4f; - projectile.velocity.X *= 0.97f; + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; } if (projectile.velocity.Y > 16f) { projectile.velocity.Y = 16f; } - } + } public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item107, projectile.position); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - int projAmt = Main.rand.Next(20, 31); + int num220 = Main.rand.Next(20, 31); if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < projAmt; i++) + for (int num221 = 0; num221 < num220; num221++) { - Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - velocity.Normalize(); - velocity *= Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 4, 0f, projectile.owner, 0f, Main.rand.Next(-45, 1)); + Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value17.Normalize(); + value17 *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), projectile.damage / 4, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs index 7e75163b43..d4d16ef5e5 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs @@ -39,40 +39,37 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation += projectile.velocity.X * 0.1f; projectile.rotation += (float)projectile.direction * 0.003f; projectile.velocity *= 0.96f; - - Rectangle cloudHitbox = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - for (int i = 0; i < Main.maxProjectiles; i++) + Rectangle rectangle5 = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + int num3; + for (int num894 = 0; num894 < 1000; num894 = num3 + 1) { - Projectile otherProj = Main.projectile[i]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || otherProj.owner != projectile.owner || !otherProj.minion || i == projectile.whoAmI) - continue; - - if (otherProj.type == projectile.type) + if (num894 != projectile.whoAmI && Main.projectile[num894].active) { - Rectangle otherProjHitbox = new Rectangle((int)otherProj.position.X, (int)otherProj.position.Y, otherProj.width, otherProj.height); - if (cloudHitbox.Intersects(otherProjHitbox)) + Rectangle value43 = new Rectangle((int)Main.projectile[num894].position.X, (int)Main.projectile[num894].position.Y, Main.projectile[num894].width, Main.projectile[num894].height); + if (rectangle5.Intersects(value43)) { - Vector2 projDistance = otherProj.Center - projectile.Center; - if (projDistance.X == 0f && projDistance.Y == 0f) + Vector2 vector105 = Main.projectile[num894].Center - projectile.Center; + if (vector105.X == 0f && vector105.Y == 0f) { - if (i < projectile.whoAmI) + if (num894 < projectile.whoAmI) { - projDistance.X = -1f; - projDistance.Y = 1f; + vector105.X = -1f; + vector105.Y = 1f; } else { - projDistance.X = 1f; - projDistance.Y = -1f; + vector105.X = 1f; + vector105.Y = -1f; } } - projDistance.Normalize(); - projDistance *= 0.005f; - projectile.velocity -= projDistance; - otherProj.velocity += projDistance; + vector105.Normalize(); + vector105 *= 0.005f; + projectile.velocity -= vector105; + Projectile projectile2 = Main.projectile[num894]; + projectile2.velocity += vector105; } } + num3 = num894; } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs index abbb577c5d..dc1add9ccf 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs @@ -25,7 +25,17 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - MadAlchemistsCocktailBlue.FlaskAI(); + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override void Kill(int timeLeft) @@ -34,22 +44,23 @@ namespace CalamityMod.Projectiles.Magic Main.PlaySound(SoundID.Item88, projectile.position); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - for (int i = 0; i < 3; i++) + for (int num118 = 0; num118 < 3; num118++) { - float x = projectile.Center.X + Main.rand.Next(-100, 100); - float y = projectile.Center.Y - Main.rand.Next(500, 600); - Vector2 source = new Vector2(x, y); - Vector2 velocity = projectile.Center - source; - velocity.X += Main.rand.Next(-100, 101); - float speed = 25f; - float targetDist = velocity.Length(); - targetDist = speed / targetDist; - velocity.X *= targetDist; - velocity.Y *= targetDist; + float x = projectile.position.X + (float)Main.rand.Next(-100, 100); + float y = projectile.position.Y - (float)Main.rand.Next(500, 600); + Vector2 vector = new Vector2(x, y); + float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X; + float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 25; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; - float ai2 = velocity.Y + projectile.position.Y; + float ai2 = num16 + projectile.position.Y; if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, projectile.damage / 2, projectile.knockBack * 2f, projectile.owner, 0f, ai2); + Projectile.NewProjectile(x, y, num15, num16, ProjectileID.LunarFlare, projectile.damage / 2, 5f, projectile.owner, 0f, ai2); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs index 7ad2daf8c2..7188ea80f2 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs @@ -25,7 +25,17 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - MadAlchemistsCocktailBlue.FlaskAI(); + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override void Kill(int timeLeft) @@ -35,12 +45,12 @@ namespace CalamityMod.Projectiles.Magic Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < 4; i++) + for (int num221 = 0; num221 < 4; num221++) { - Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - velocity.Normalize(); - velocity *= Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner, 0f, Main.rand.Next(-45, 1)); + Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value17.Normalize(); + value17 *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailRed.cs b/Projectiles/Magic/MadAlchemistsCocktailRed.cs index 1e8c561156..b7946e54e1 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailRed.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailRed.cs @@ -25,17 +25,27 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - MadAlchemistsCocktailBlue.FlaskAI(); + projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } } public override void Kill(int timeLeft) { int height = 480; - float dustScaleA = 3f; - float dustScaleB = 2.4f; - float dustScaleC = 3.8f; - Vector2 dustDirection = (-MathHelper.PiOver2).ToRotationVector2(); - Vector2 dustVel = dustDirection * projectile.velocity.Length() * projectile.MaxUpdates; + float num50 = 3f; + float num51 = 2.4f; + float num52 = 3.8f; + Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 20, 2f, 0f); Main.PlaySound(SoundID.Item107, projectile.position); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); @@ -49,44 +59,55 @@ namespace CalamityMod.Projectiles.Magic projectile.localNPCHitCooldown = 10; projectile.damage *= 3; projectile.Damage(); - for (int i = 0; i < 60; i++) + int num3; + for (int num53 = 0; num53 < 60; num53 = num3 + 1) { - int red = Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 200, default, dustScaleA); - Dust dust = Main.dust[red]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; - dust.noGravity = true; + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 200, default, num50); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; dust.velocity *= 8f; + dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - red = Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 100, default, dustScaleB); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; dust.velocity *= 6f; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - red = Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 100, default, dustScaleB); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; dust.velocity *= 4f; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - red = Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 100, default, dustScaleB); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; dust.velocity *= 2f; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; } - for (int j = 0; j < 30; j++) + for (int num55 = 0; num55 < 30; num55 = num3 + 1) { - int crimson = Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 0, default, dustScaleC); - Dust dust = Main.dust[crimson]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)projectile.velocity.ToRotation(), default) * projectile.width / 3f; - dust.noGravity = true; + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 0, default, num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; + dust = Main.dust[num56]; dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs index 523bac558b..0cd115e19d 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs @@ -24,18 +24,27 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Vector2 adjustVec = new Vector2(6f, 12f); - for (int i = 0; i < 2; i++) - { - Vector2 offset = Vector2.UnitX * -15f; - offset = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + i * MathHelper.Pi), default) * adjustVec * 0.75f; - int shrapnel = Dust.NewDust(projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 0.75f); - Main.dust[shrapnel].noGravity = true; - Main.dust[shrapnel].position = projectile.Center + offset; - Main.dust[shrapnel].velocity = projectile.velocity; - } - int violet = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); - Main.dust[violet].noGravity = true; + Vector2 value7 = new Vector2(6f, 12f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -15f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 0.75f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 0.75f); + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Main.dust[num458].noGravity = true; CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 12f, 20f); }