private static void Spawn_RainbowRodHit(ParticleOrchestraSettings settings) { float num = Main.rand.NextFloat() * ((float)Math.PI * 2f); float num2 = 6f; float num3 = Main.rand.NextFloat(); for (float num4 = 0f; num4 < 1f; num4 += 1f / num2) { Vector2 vector = settings.MovementVector * Main.rand.NextFloatDirection() * 0.15f; Vector2 vector2 = new Vector2(Main.rand.NextFloat() * 0.4f + 0.4f); float f = num + Main.rand.NextFloat() * ((float)Math.PI * 2f); float rotation = (float)Math.PI / 2f; Vector2 vector3 = 1.5f * vector2; float divider = 60f; Vector2 value = Main.rand.NextVector2Circular(8f, 8f) * vector2; PrettySparkleParticle prettySparkleParticle = _poolPrettySparkle.RequestParticle(); prettySparkleParticle.Velocity = f.ToRotationVector2() * vector3 + vector; prettySparkleParticle.AccelerationPerFrame = f.ToRotationVector2() * -(vector3 / divider) - vector * 1f / 60f; prettySparkleParticle.ColorTint = Main.hslToRgb((num3 + Main.rand.NextFloat() * 0.33f) % 1f, 1f, 0.4f + Main.rand.NextFloat() * 0.25f); prettySparkleParticle.ColorTint.A = 0; prettySparkleParticle.LocalPosition = settings.PositionInWorld + value; prettySparkleParticle.Rotation = rotation; prettySparkleParticle.Scale = vector2; Main.ParticleSystem_World_OverPlayers.Add(prettySparkleParticle); prettySparkleParticle = _poolPrettySparkle.RequestParticle(); prettySparkleParticle.Velocity = f.ToRotationVector2() * vector3 + vector; prettySparkleParticle.AccelerationPerFrame = f.ToRotationVector2() * -(vector3 / divider) - vector * 1f / 60f; prettySparkleParticle.ColorTint = new Color(255, 255, 255, 0); prettySparkleParticle.LocalPosition = settings.PositionInWorld + value; prettySparkleParticle.Rotation = rotation; prettySparkleParticle.Scale = vector2 * 0.6f; Main.ParticleSystem_World_OverPlayers.Add(prettySparkleParticle); } for (int i = 0; i < 12; i++) { Color newColor = Main.hslToRgb((num3 + Main.rand.NextFloat() * 0.12f) % 1f, 1f, 0.4f + Main.rand.NextFloat() * 0.25f); int num5 = Dust.NewDust(settings.PositionInWorld, 0, 0, 267, 0f, 0f, 0, newColor); Main.dust[num5].velocity = Main.rand.NextVector2Circular(1f, 1f); Main.dust[num5].velocity += settings.MovementVector * Main.rand.NextFloatDirection() * 0.5f; Main.dust[num5].noGravity = true; Main.dust[num5].scale = 0.6f + Main.rand.NextFloat() * 0.9f; Main.dust[num5].fadeIn = 0.7f + Main.rand.NextFloat() * 0.8f; if (num5 != 6000) { Dust dust = Dust.CloneDust(num5); dust.scale /= 2f; dust.fadeIn *= 0.75f; dust.color = new Color(255, 255, 255, 255); } } }
private static void Spawn_RainbowRodHit(ParticleOrchestraSettings settings) { float num1 = Main.rand.NextFloat() * 6.283185f; float num2 = 6f; float num3 = Main.rand.NextFloat(); for (float num4 = 0.0f; (double)num4 < 1.0; num4 += 1f / num2) { Vector2 vector2_1 = settings.MovementVector * Main.rand.NextFloatDirection() * 0.15f; Vector2 vector2_2 = new Vector2((float)((double)Main.rand.NextFloat() * 0.400000005960464 + 0.400000005960464)); float f = num1 + Main.rand.NextFloat() * 6.283185f; float num5 = 1.570796f; Vector2 vector2_3 = 1.5f * vector2_2; float num6 = 60f; Vector2 vector2_4 = Main.rand.NextVector2Circular(8f, 8f) * vector2_2; PrettySparkleParticle prettySparkleParticle1 = ParticleOrchestrator._poolPrettySparkle.RequestParticle(); prettySparkleParticle1.Velocity = f.ToRotationVector2() * vector2_3 + vector2_1; prettySparkleParticle1.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_3 / num6) - vector2_1 * 1f / 60f; prettySparkleParticle1.ColorTint = Main.hslToRgb((float)(((double)num3 + (double)Main.rand.NextFloat() * 0.330000013113022) % 1.0), 1f, (float)(0.400000005960464 + (double)Main.rand.NextFloat() * 0.25)); prettySparkleParticle1.ColorTint.A = (byte)0; prettySparkleParticle1.LocalPosition = settings.PositionInWorld + vector2_4; prettySparkleParticle1.Rotation = num5; prettySparkleParticle1.Scale = vector2_2; Main.ParticleSystem_World_OverPlayers.Add((IParticle)prettySparkleParticle1); PrettySparkleParticle prettySparkleParticle2 = ParticleOrchestrator._poolPrettySparkle.RequestParticle(); prettySparkleParticle2.Velocity = f.ToRotationVector2() * vector2_3 + vector2_1; prettySparkleParticle2.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_3 / num6) - vector2_1 * 1f / 60f; prettySparkleParticle2.ColorTint = new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0); prettySparkleParticle2.LocalPosition = settings.PositionInWorld + vector2_4; prettySparkleParticle2.Rotation = num5; prettySparkleParticle2.Scale = vector2_2 * 0.6f; Main.ParticleSystem_World_OverPlayers.Add((IParticle)prettySparkleParticle2); } for (int index = 0; index < 12; ++index) { Color rgb = Main.hslToRgb((float)(((double)num3 + (double)Main.rand.NextFloat() * 0.119999997317791) % 1.0), 1f, (float)(0.400000005960464 + (double)Main.rand.NextFloat() * 0.25)); int dustIndex = Dust.NewDust(settings.PositionInWorld, 0, 0, 267, 0.0f, 0.0f, 0, rgb, 1f); Main.dust[dustIndex].velocity = Main.rand.NextVector2Circular(1f, 1f); Main.dust[dustIndex].velocity += settings.MovementVector * Main.rand.NextFloatDirection() * 0.5f; Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].scale = (float)(0.600000023841858 + (double)Main.rand.NextFloat() * 0.899999976158142); Main.dust[dustIndex].fadeIn = (float)(0.699999988079071 + (double)Main.rand.NextFloat() * 0.800000011920929); if (dustIndex != 6000) { Dust dust = Dust.CloneDust(dustIndex); dust.scale /= 2f; dust.fadeIn *= 0.75f; dust.color = new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue); } } }
private static void Spawn_StardustPunch(ParticleOrchestraSettings settings) { float num1 = Main.rand.NextFloat() * 6.283185f; float num2 = 1f; for (float num3 = 0.0f; (double)num3 < 1.0; num3 += 1f / num2) { Vector2 vector2_1 = settings.MovementVector * (float)(0.300000011920929 + (double)Main.rand.NextFloat() * 0.349999994039536); Vector2 vector2_2 = new Vector2((float)((double)Main.rand.NextFloat() * 0.400000005960464 + 0.400000005960464)); float f = num1 + Main.rand.NextFloat() * 6.283185f; float num4 = 1.570796f; Vector2 vector2_3 = 0.1f * vector2_2; float num5 = 60f; Vector2 vector2_4 = Main.rand.NextVector2Circular(8f, 8f) * vector2_2; PrettySparkleParticle prettySparkleParticle1 = ParticleOrchestrator._poolPrettySparkle.RequestParticle(); prettySparkleParticle1.Velocity = f.ToRotationVector2() * vector2_3 + vector2_1; prettySparkleParticle1.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_3 / num5) - vector2_1 * 1f / 60f; prettySparkleParticle1.ColorTint = Main.hslToRgb((float)((0.600000023841858 + (double)Main.rand.NextFloat() * 0.0500000007450581) % 1.0), 1f, (float)(0.400000005960464 + (double)Main.rand.NextFloat() * 0.25)); prettySparkleParticle1.ColorTint.A = (byte)0; prettySparkleParticle1.LocalPosition = settings.PositionInWorld + vector2_4; prettySparkleParticle1.Rotation = num4; prettySparkleParticle1.Scale = vector2_2; Main.ParticleSystem_World_OverPlayers.Add((IParticle)prettySparkleParticle1); PrettySparkleParticle prettySparkleParticle2 = ParticleOrchestrator._poolPrettySparkle.RequestParticle(); prettySparkleParticle2.Velocity = f.ToRotationVector2() * vector2_3 + vector2_1; prettySparkleParticle2.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_3 / num5) - vector2_1 * 1f / 30f; prettySparkleParticle2.ColorTint = new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0); prettySparkleParticle2.LocalPosition = settings.PositionInWorld + vector2_4; prettySparkleParticle2.Rotation = num4; prettySparkleParticle2.Scale = vector2_2 * 0.6f; Main.ParticleSystem_World_OverPlayers.Add((IParticle)prettySparkleParticle2); } for (int index = 0; index < 2; ++index) { Color rgb = Main.hslToRgb((float)((0.589999973773956 + (double)Main.rand.NextFloat() * 0.0500000007450581) % 1.0), 1f, (float)(0.400000005960464 + (double)Main.rand.NextFloat() * 0.25)); int dustIndex = Dust.NewDust(settings.PositionInWorld, 0, 0, 267, 0.0f, 0.0f, 0, rgb, 1f); Main.dust[dustIndex].velocity = Main.rand.NextVector2Circular(2f, 2f); Main.dust[dustIndex].velocity += settings.MovementVector * (float)(0.5 + 0.5 * (double)Main.rand.NextFloat()) * 1.4f; Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].scale = (float)(0.600000023841858 + (double)Main.rand.NextFloat() * 2.0); Main.dust[dustIndex].position += Main.rand.NextVector2Circular(16f, 16f); if (dustIndex != 6000) { Dust dust = Dust.CloneDust(dustIndex); dust.scale /= 2f; dust.fadeIn *= 0.75f; dust.color = new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue); } } }
public override void Kill(int timeLeft) { for (int i = 0; i < 4; i++) { int index4 = Gore.NewGore(new Vector2(projectile.position.X, projectile.position.Y), new Vector2(), Main.rand.Next(61, 64), 1f); Main.gore[index4].velocity *= 0.4f; Main.gore[index4].velocity.X += (float)Main.rand.Next(-10, 11) * 0.1f; Main.gore[index4].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.1f; } Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 3, 1f, 0f); Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.14159274101257); float num1 = (float)14 * projectile.scale; float num5 = (float)10 * projectile.scale; Vector2 vector2 = new Vector2(1.1f, 1f); for (float num2 = 0.0f; (double)num2 < (double)num1; ++num2) { int dustIndex = Dust.NewDust(projectile.Center, 0, 0, 173, 0.0f, 0.0f, 0, new Color(), 1f); Main.dust[dustIndex].position = projectile.Center; Main.dust[dustIndex].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double)num2 / (double)num1, new Vector2()) * vector2 * (float)(0.800000011920929 + (double)Main.rand.NextFloat() * 0.400000005960464) * 2f; Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].scale = 2f; Main.dust[dustIndex].fadeIn = Main.rand.NextFloat() * 2f; Dust dust = Dust.CloneDust(dustIndex); dust.scale /= 2f; dust.fadeIn /= 2f; } for (float ag = 0.0f; (double)ag < (double)num5; ++ag) { int dustIndex = Dust.NewDust(projectile.Center, 0, 0, 157, 0.0f, 0.0f, 0, new Color(), 1f); Main.dust[dustIndex].position = projectile.Center; Main.dust[dustIndex].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double)ag / (double)num5, new Vector2()) * vector2 * (float)(0.800000011920929 + (double)Main.rand.NextFloat() * 0.400000005960464); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].scale = 2f; Main.dust[dustIndex].fadeIn = Main.rand.NextFloat() * 2f; Dust dust = Dust.CloneDust(dustIndex); dust.scale /= 2f; dust.fadeIn /= 2f; } }
public override void Kill(int timeLeft) { Vector2 spinPoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi); float maxRepeats = 18 * projectile.scale; var vector2 = new Vector2(1.1f, 1f); for (float i = 0; i < maxRepeats; ++i) { int dustIndex = Dust.NewDust(projectile.Center, 0, 0, DustType, 0.0f, 0.0f, 0, new Color(), 1f); Main.dust[dustIndex].position = projectile.Center; Main.dust[dustIndex].velocity = spinPoint.RotatedBy(MathHelper.TwoPi * i / maxRepeats, new Vector2()) * vector2 * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].scale = 2f; Main.dust[dustIndex].fadeIn = Main.rand.NextFloat() * 2f; var dust = Dust.CloneDust(dustIndex); dust.scale /= 2f; dust.fadeIn /= 2f; } Main.PlaySound(SoundID.Trackable, (int)projectile.position.X, (int)projectile.position.Y, 165, 0.5f, 0.0f); }
public override void Kill(int timeLeft) { Vector2 spinningpoint = new Vector2(0.0f, -3f).RotatedByRandom(3.14159274101257); float num1 = (float)28 * projectile.scale; Vector2 vector2 = new Vector2(1.1f, 1f); for (float num2 = 0.0f; (double)num2 < (double)num1; ++num2) { int dustIndex = Dust.NewDust(projectile.Center, 0, 0, 267, 0.0f, 0.0f, 0, new Color(r, g, b), .6f); Main.dust[dustIndex].position = projectile.Center; Main.dust[dustIndex].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double)num2 / (double)num1, new Vector2()) * vector2 * (float)(0.800000011920929 + (double)Main.rand.NextFloat() * 0.400000005960464); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].scale = 2f; Main.dust[dustIndex].fadeIn = Main.rand.NextFloat() * 2f; Dust dust = Dust.CloneDust(dustIndex); dust.scale /= 2f; dust.fadeIn /= 2f; dust.color = new Color((int)r, (int)g, (int)b, (int)byte.MaxValue); } Main.PlaySound(42, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); }
public override void AI() { Vector2?vector71 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } if (projectile.type != mod.ProjectileType("EtheralLaserEX") || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("EtheralEX")) { projectile.Kill(); return; } float num810 = (int)projectile.ai[0] - 2.5f; Vector2 value36 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; float num811 = num810 * 0.5235988f; Vector2 value37 = Vector2.Zero; float num812; float y; float num813; float scaleFactor6; if (projectile2.ai[0] < 180f) { num812 = 1f - projectile2.ai[0] / 180f; y = 20f - projectile2.ai[0] / 180f * 14f; if (projectile2.ai[0] < 120f) { num813 = 20f - 4f * (projectile2.ai[0] / 120f); projectile.Opacity = projectile2.ai[0] / 120f * 0.4f; } else { num813 = 16f - 10f * ((projectile2.ai[0] - 120f) / 60f); projectile.Opacity = 0.4f + (projectile2.ai[0] - 120f) / 60f * 0.6f; } scaleFactor6 = -22f + projectile2.ai[0] / 180f * 20f; } else { num812 = 0f; num813 = 1.75f; y = 6f; projectile.Opacity = 1f; scaleFactor6 = -2f; } float num814 = (projectile2.ai[0] + num810 * num813) / (num813 * 6f) * 6.28318548f; num811 = Vector2.UnitY.RotatedBy(num814, default).Y * 0.5235988f * num812; value37 = (Vector2.UnitY.RotatedBy(num814, default) * new Vector2(4f, y)).RotatedBy(projectile2.velocity.ToRotation(), default); projectile.position = projectile2.Center + value36 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; projectile.position += value37; projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(num811, default); projectile.scale = 1.8f * (1f - num812); projectile.damage = projectile2.damage; if (projectile2.ai[0] >= 180f) { projectile.damage *= 3; vector71 = new Vector2?(projectile2.Center); } if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) { vector71 = new Vector2?(Main.player[projectile.owner].Center); } projectile.friendly = projectile2.ai[0] > 30f; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } float num818 = projectile.velocity.ToRotation(); projectile.rotation = num818 - 1.57079637f; projectile.velocity = num818.ToRotationVector2(); float num819 = 2f; float num820 = 0f; Vector2 samplingPoint = projectile.Center; if (vector71.HasValue) { samplingPoint = vector71.Value; } float[] array3 = new float[(int)num819]; Collision.LaserScan(samplingPoint, projectile.velocity, num820 * projectile.scale, 2400f, array3); float num821 = 0f; for (int num822 = 0; num822 < array3.Length; num822++) { num821 += array3[num822]; } num821 /= num819; float amount = 0.75f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) { Color color = Main.hslToRgb(0.54f, 1f, 0.902f); color.A = 0; Vector2 vector80 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); float x = Main.rgbToHsl(new Color(255, 250, 205)).X; for (int num843 = 0; num843 < 2; num843++) { float num844 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 vector81 = new Vector2((float)Math.Cos(num844) * num845, (float)Math.Sin(num844) * num845); int num846 = Dust.NewDust(vector80, 0, 0, 261, vector81.X, vector81.Y, 0, new Color(255, 250, 205), 1f); Main.dust[num846].color = color; Main.dust[num846].scale = 1.1f; if (projectile.scale > 1f) { Main.dust[num846].velocity *= projectile.scale; Main.dust[num846].scale *= projectile.scale; } Main.dust[num846].noGravity = true; if (projectile.scale != 1.4f) { Dust dust9 = Dust.CloneDust(num846); dust9.color = Color.Orange; dust9.scale /= 2f; } float hue = (x + Main.rand.NextFloat() * 0.4f) % 1f; Main.dust[num846].color = Color.Lerp(color, Main.hslToRgb(0.54f, 1f, 0.902f), projectile.scale / 1.4f); } if (Main.rand.Next(5) == 0) { Vector2 value42 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 261, 0f, 0f, 100, new Color(255, 250, 205), 1f); Main.dust[num847].velocity *= 0.5f; Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); } DelegateMethods.v3_1 = color.ToVector3() * 0.3f; float value43 = 0.1f * (float)Math.Sin(Main.GlobalTime * 20f); Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], projectile.width * projectile.scale); float num848 = projectile.velocity.ToRotation(); if (Main.netMode != 2) { ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy(num848, default), new Color(0.5f, 0.1f * Math.Sign(value43) + 0.5f, 0f, 1f) * Math.Abs(value43), size, RippleShape.Square, num848); } Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); return; } }
public override void AI() { projectile.timeLeft++; //from vanilla Vector2?nullable = new Vector2?(); if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } if (projectile.type != ModContent.ProjectileType <PocketBlackholeBeam>() || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != ModContent.ProjectileType <PocketBlackhole>()) { projectile.Kill(); } else { float num1 = (int)projectile.ai[0] - 2.5f; Vector2 vector2_1 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); Projectile projectile1 = Main.projectile[(int)projectile.ai[1]]; float num2 = num1 * 0.5235988f; Vector2 zero = Vector2.Zero; float num3; float y; float num4; float num5; if (projectile1.ai[0] < 180.0) { num3 = (float)(1.0 - projectile1.ai[0] / 180.0); y = (float)(20.0 - projectile1.ai[0] / 180.0 * 14.0); if (projectile1.ai[0] < 120.0) { num4 = (float)(20.0 - 4.0 * (projectile1.ai[0] / 120.0)); projectile.Opacity = (float)(projectile1.ai[0] / 120.0 * 0.400000005960464); } else { num4 = (float)(16.0 - 10.0 * ((projectile1.ai[0] - 120.0) / 60.0)); projectile.Opacity = (float)(0.400000005960464 + (projectile1.ai[0] - 120.0) / 60.0 * 0.600000023841858); } num5 = (float)(projectile1.ai[0] / 180.0 * 20.0 - 22.0); } else { num3 = 0.0f; num4 = 1.75f; y = 6f; projectile.Opacity = 1f; num5 = -2f; } float num6 = (float)((projectile1.ai[0] + num1 * (double)num4) / (num4 * 6.0) * 6.28318548202515); float num7 = Vector2.UnitY.RotatedBy(num6, new Vector2()).Y * 0.5235988f * num3; Vector2 vector2_2 = (Vector2.UnitY.RotatedBy(num6, new Vector2()) * new Vector2(4f, y)).RotatedBy(projectile1.velocity.ToRotation(), new Vector2()); projectile.position = projectile1.Center + vector2_1 * 16f - projectile.Size / 2f + new Vector2(0.0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); Projectile projectile2 = projectile; Vector2 vector2_3 = projectile2.position + projectile1.velocity.ToRotation().ToRotationVector2() * num5; projectile2.position = vector2_3; Projectile projectile3 = projectile; Vector2 vector2_4 = projectile3.position + vector2_2; projectile3.position = vector2_4; projectile.velocity = Vector2.Normalize(projectile1.velocity).RotatedBy(num7, new Vector2()); projectile.scale = (float)(1.79999995231628 * (1.0 - num3)); projectile.damage = projectile1.damage; if (projectile1.ai[0] >= 180.0) { projectile.damage *= 3; nullable = new Vector2?(projectile1.Center); } if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile1.Center, 0, 0)) { nullable = new Vector2?(Main.player[projectile.owner].Center); } projectile.friendly = projectile1.ai[0] > 30.0; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } float rotation1 = projectile.velocity.ToRotation(); projectile.rotation = rotation1 - 1.570796f; projectile.velocity = rotation1.ToRotationVector2(); float num8 = 2f; float num9 = 0.0f; Vector2 center = projectile.Center; if (nullable.HasValue) { center = nullable.Value; } float[] samples = new float[(int)num8]; Collision.LaserScan(center, projectile.velocity, num9 * projectile.scale, 2400f, samples); float num10 = 0.0f; for (int index = 0; index < samples.Length; ++index) { num10 += samples[index]; } float num11 = num10 / num8; float amount = 0.75f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num11, amount); if (Math.Abs(projectile.localAI[1] - num11) >= 100.0 || projectile.scale <= 0.150000005960464) { return; } Color rgb = new Color(253, 108, 227); rgb.A = 0; Vector2 Position = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); float x = Main.rgbToHsl(new Color(253, 108, 227)).X; DelegateMethods.v3_1 = rgb.ToVector3() * 0.3f; float num14 = 0.1f * (float)Math.Sin((double)Main.GlobalTime * 20.0); Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], projectile.width * projectile.scale); float rotation2 = projectile.velocity.ToRotation(); if (Main.netMode != NetmodeID.Server) { ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0.0f).RotatedBy(rotation2, new Vector2()), new Color(0.5f, (float)(0.100000001490116 * Math.Sign(num14) + 0.5), 0.0f, 1f) * Math.Abs(num14), size, RippleShape.Square, rotation2); } Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); for (int index = 0; index < 2; ++index) { float num12 = projectile.velocity.ToRotation() + (float)((Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629); float num13 = (float)(Main.rand.NextDouble() * 0.800000011920929 + 1.0); Vector2 vector2_5 = new Vector2((float)Math.Cos(num12) * num13, (float)Math.Sin(num12) * num13); int dustIndex = Dust.NewDust(Position, 0, 0, 70, vector2_5.X, vector2_5.Y, 0, new Color(253, 108, 227), 3.3f); Main.dust[dustIndex].color = rgb; Main.dust[dustIndex].scale = 1.2f; if (projectile.scale > 1.0) { Main.dust[dustIndex].velocity *= projectile.scale; Main.dust[dustIndex].scale *= projectile.scale; } Main.dust[dustIndex].noGravity = true; if (projectile.scale != 1.39999997615814) { Dust dust = Dust.CloneDust(dustIndex); //dust.color = Color.Purple; dust.scale /= 2f; } float Saturation = (float)((x + Main.rand.NextFloat() * 0.400000005960464) % 1.0); Main.dust[dustIndex].color = Color.Lerp(rgb, Main.hslToRgb(2.55f, Saturation, 0.53f), projectile.scale / 1.4f); } } }
public override bool PreAI() { Vector2?vector68 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } if (!Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("UnscratchedWispHandle_Friendly")) { projectile.Kill(); return(false); } float num802 = (float)((int)projectile.ai[0]) - 2.5f; Vector2 value35 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); Projectile proj = Main.projectile[(int)projectile.ai[1]]; float num803 = num802 * 0.5235988f; Vector2 value36 = Vector2.Zero; float num804; float y; float num805; float scaleFactor6 = 2; if (proj.ai[0] < 180f) { num804 = 1f - proj.ai[0] / 180f; y = 20f - proj.ai[0] / 180f * 14f; if (proj.ai[0] < 120f) { num805 = 20f - 4f * (proj.ai[0] / 120f); projectile.Opacity = proj.ai[0] / 120f * 0.4f; } else { num805 = 16f - 10f * ((proj.ai[0] - 120f) / 60f); projectile.Opacity = 0.4f + (proj.ai[0] - 120f) / 60f * 0.6f; } } else { num804 = 0f; num805 = 1.75f; y = 6f; projectile.Opacity = 1f; } float num806 = (proj.ai[0] + num802 * num805) / (num805 * 6f) * 6.28318548f; num803 = Vector2.UnitY.RotatedBy((double)num806, default(Vector2)).Y * 0.5235988f * num804; value36 = (Vector2.UnitY.RotatedBy((double)num806, default(Vector2)) * new Vector2(4f, y)).RotatedBy((double)proj.velocity.ToRotation(), default(Vector2)); projectile.position = proj.Center + value35 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); //projectile.position += proj.velocity.ToRotation().ToRotationVector2() * scaleFactor6; //projectile.position += value36; projectile.velocity = Vector2.Normalize(proj.velocity).RotatedBy((double)num803, default(Vector2)); projectile.scale = 1.4f * (1f - num804); projectile.damage = proj.damage; if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, proj.Center, 0, 0)) { vector68 = new Vector2?(Main.player[projectile.owner].Center); } projectile.friendly = (proj.ai[0] > 30f); if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } float num810 = projectile.velocity.ToRotation(); projectile.rotation = num810 - 1.57079637f; projectile.velocity = num810.ToRotationVector2(); float num811 = 2f; float scaleFactor7 = 0f; Vector2 value37 = projectile.Center; if (vector68.HasValue) { value37 = vector68.Value; } float[] array3 = new float[(int)num811]; int num812 = 0; while ((float)num812 < num811) { float num813 = (float)num812 / (num811 - 1f); Vector2 value38 = value37 + projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * (num813 - 0.5f) * scaleFactor7 * projectile.scale; int num814 = (int)value38.X / 16; int num815 = (int)value38.Y / 16; Vector2 vector69 = value38 + projectile.velocity * 16f * 150f; int num816 = (int)vector69.X / 16; int num817 = (int)vector69.Y / 16; Tuple <int, int> tuple; float num818; if (!Collision.TupleHitLine(num814, num815, num816, num817, 0, 0, new List <Tuple <int, int> >(), out tuple)) { num818 = new Vector2((float)Math.Abs(num814 - tuple.Item1), (float)Math.Abs(num815 - tuple.Item2)).Length() * 16f; } else if (tuple.Item1 == num816 && tuple.Item2 == num817) { num818 = 2400f; } else { num818 = new Vector2((float)Math.Abs(num814 - tuple.Item1), (float)Math.Abs(num815 - tuple.Item2)).Length() * 16f; } array3[num812] = num818; num812++; } float num819 = 0f; for (int num820 = 0; num820 < array3.Length; num820++) { num819 += array3[num820]; } num819 /= num811; float amount = 0.75f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num819, amount); float prismHue = projectile.GetPrismHue(projectile.ai[0]); Color color = Main.hslToRgb(prismHue, 1f, 0.5f); color.A = 0; Vector2 vector78 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); float x = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X; for (int num841 = 0; num841 < 2; num841++) { float num842 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num843 = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 vector79 = new Vector2((float)Math.Cos((double)num842) * num843, (float)Math.Sin((double)num842) * num843); int num844 = Dust.NewDust(vector78, 0, 0, 267, vector79.X, vector79.Y, 0, default(Color), 1f); Main.dust[num844].color = color; Main.dust[num844].scale = 1.2f; if (projectile.scale > 1f) { Main.dust[num844].velocity *= projectile.scale; Main.dust[num844].scale *= projectile.scale; } Main.dust[num844].noGravity = true; if (projectile.scale != 1.4f) { Dust dust102 = Dust.CloneDust(Main.dust[num844]); dust102.color = Color.White; dust102.scale /= 2f; } float hue = (x + Main.rand.NextFloat() * 0.4f) % 1f; Main.dust[num844].color = Color.Lerp(color, Main.hslToRgb(hue, 1f, 0.75f), projectile.scale / 1.4f); } if (Main.rand.Next(5) == 0) { Vector2 value43 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; int num845 = Dust.NewDust(vector78 + value43 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num845].velocity *= 0.5f; Main.dust[num845].velocity.Y = -Math.Abs(Main.dust[num845].velocity.Y); } DelegateMethods.v3_1 = color.ToVector3() * 0.3f; Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); return(false); }
public override void SetDefaults() { Dust.CloneDust(75); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Player player = Main.player[Player.FindClosest(new Vector2(i * 16, j * 16), 100, 100)]; Tile tile = Main.tile[i, j]; Main.PlaySound(SoundID.Trackable, i * 16, j * 16, 186); for (int index1 = 0; index1 < 3; ++index1) { for (int index2 = 0; index2 < 2; ++index2) { int index3 = Gore.NewGore(new Vector2(i * 16, j * 16), new Vector2(0.0f, 0.0f), 99, 1.1f); Main.gore[index3].velocity *= 0.6f; } } for (int index = 0; index < 9; ++index) { float SpeedX = (float)(-1 * Main.rand.Next(40, 70) * 0.00999999977648258 + Main.rand.Next(-20, 21) * 0.400000005960464); float SpeedY = (float)(-1 * Main.rand.Next(40, 70) * 0.00999999977648258 + Main.rand.Next(-20, 21) * 0.400000005960464); int p = Projectile.NewProjectile((float)(i * 16) + 8 + SpeedX, (float)(j * 16) + 12 + SpeedY, SpeedX, SpeedY, mod.ProjectileType("Visual_Projectile"), 0, 0f, player.whoAmI, 0.0f, 0.0f); Main.projectile[p].scale = Main.rand.Next(30, 150) * 0.01f; } //int randomEffectCounter = 5; int randomEffectCounter = Main.rand.Next(11); bool CheckTileRange(int[] tiletypes, int size) { for (int k = i - size; k <= i + size; k++) { for (int l = j - size; l <= j + size; l++) { if (WorldGen.InWorld(k, l, 1) && Math.Abs(k - i) + Math.Abs(l - j) < Math.Sqrt(size * size + size * size)) { int type = Main.tile[k, l].type; if (tiletypes.Contains(type)) { return(true); } } } } return(false); } while (randomEffectCounter == 7) { if (CheckTileRange(new int[] { TileID.Dirt, TileID.Stone, TileID.IceBlock }, 22)) { break; } randomEffectCounter = Main.rand.Next(11); } while (randomEffectCounter == 6 || randomEffectCounter == 10) { if (CheckTileRange(new int[] { TileID.Stone }, 19)) { break; } randomEffectCounter = Main.rand.Next(11); } switch (randomEffectCounter) { case 0: //SPAWN ZOMBIES { BadLuck(i, j); int a = NPC.NewNPC((i * 16) + -8 - 16 - 16, (j * 16) + 6, 21); int b = NPC.NewNPC((i * 16) + -8 - 16, (j * 16) + 6, 21); int c = NPC.NewNPC((i * 16) + 8, (j * 16) + 6, 21); int d = NPC.NewNPC((i * 16) + 24 + 16, (j * 16) + 6, 21); int e = NPC.NewNPC((i * 16) + 24 + 32, (j * 16) + 6, 21); Main.npc[a].netUpdate = true; Main.npc[b].netUpdate = true; Main.npc[c].netUpdate = true; Main.npc[d].netUpdate = true; Main.npc[e].netUpdate = true; break; } case 1: //DROP COINS { BadLuck(i, j); Main.PlaySound(SoundID.Coins, i * 16, j * 16, 0); int num1 = 0; for (int index = 0; index < 59; ++index) { if (player.inventory[index].type >= ItemID.CopperCoin && player.inventory[index].type <= ItemID.PlatinumCoin) { int number = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, player.inventory[index].type, 1); if (Main.netMode != NetmodeID.SinglePlayer && number >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number, 1f); } int num2 = player.inventory[index].stack / 5; if (Main.expertMode) { num2 = (int)(player.inventory[index].stack * 0.25f); } int num3 = player.inventory[index].stack - num2; player.inventory[index].stack -= num3; if (player.inventory[index].type == ItemID.CopperCoin) { num1 += num3; } if (player.inventory[index].type == ItemID.SilverCoin) { num1 += num3 * 100; } if (player.inventory[index].type == ItemID.GoldCoin) { num1 += num3 * 10000; } if (player.inventory[index].type == ItemID.PlatinumCoin) { num1 += num3 * 1000000; } if (player.inventory[index].stack <= 0) { player.inventory[index] = new Item(); } Main.item[number].stack = num3; Main.item[number].velocity.Y = Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = Main.rand.Next(-20, 21) * 0.2f; Main.item[number].noGrabDelay = 600; if (index == 58) { Main.mouseItem = player.inventory[index].Clone(); } } } player.lostCoins = num1; player.lostCoinString = Main.ValueToCoins(player.lostCoins); break; } case 2: //SPAWN POTIONS { GoodLuck(i, j); int randomPotion = Utils.SelectRandom(Main.rand, new int[38] { 2344, 303, 300, 2325, 2324, 2356, 2329, 2346, 295, 2354, 2327, 291, 305, 2323, 304, 2348, 297, 292, 2345, 2352, 294, 293, 2322, 299, 288, 2347, 289, 298, 2355, 296, 2353, 2328, 290, 301, 2326, 2359, 302, 2349 }); int randomPotion2 = Utils.SelectRandom(Main.rand, new int[38] { 2344, 303, 300, 2325, 2324, 2356, 2329, 2346, 295, 2354, 2327, 291, 305, 2323, 304, 2348, 297, 292, 2345, 2352, 294, 293, 2322, 299, 288, 2347, 289, 298, 2355, 296, 2353, 2328, 290, 301, 2326, 2359, 302, 2349 }); int randomPotion3 = Utils.SelectRandom(Main.rand, new int[38] { 2344, 303, 300, 2325, 2324, 2356, 2329, 2346, 295, 2354, 2327, 291, 305, 2323, 304, 2348, 297, 292, 2345, 2352, 294, 293, 2322, 299, 288, 2347, 289, 298, 2355, 296, 2353, 2328, 290, 301, 2326, 2359, 302, 2349 }); int randomPotion4 = Utils.SelectRandom(Main.rand, new int[38] { 2344, 303, 300, 2325, 2324, 2356, 2329, 2346, 295, 2354, 2327, 291, 305, 2323, 304, 2348, 297, 292, 2345, 2352, 294, 293, 2322, 299, 288, 2347, 289, 298, 2355, 296, 2353, 2328, 290, 301, 2326, 2359, 302, 2349 }); if (Main.netMode != NetmodeID.SinglePlayer) { randomPotion = 2344; randomPotion2 = 303; randomPotion3 = 300; randomPotion4 = 2356; } int number = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, randomPotion, 1); Main.item[number].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; if (Main.netMode != NetmodeID.SinglePlayer && number >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number, 1f); } int number2 = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, randomPotion2, 1); Main.item[number2].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[number2].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; if (Main.netMode != NetmodeID.SinglePlayer && number2 >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number2, 1f); } int number3 = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, randomPotion3, 1); Main.item[number3].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[number3].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; if (Main.netMode != NetmodeID.SinglePlayer && number3 >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number3, 1f); } int number4 = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, randomPotion4, 1); Main.item[number4].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[number4].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; if (Main.netMode != NetmodeID.SinglePlayer && number4 >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number4, 1f); } break; } case 3: //SPAWN AN ITEM { GoodLuck(i, j); int item = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, 393, 1); if (Main.netMode != NetmodeID.SinglePlayer && item >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, item, 1f); } int item1 = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, 18, 1); if (Main.netMode != NetmodeID.SinglePlayer && item1 >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, item1, 1f); } break; } case 4: //SPAWN BUTTERFLIES { GoodLuck(i, j); float npcposX = 0f; float npcposY = 0f; for (int g = 0; g < 8 + Main.rand.Next(6); g++) { npcposX = (i * 16) + Main.rand.Next(-60, 60); npcposY = (j * 16) + Main.rand.Next(-60, 60); int dustType; int npcType; if (Main.rand.NextBool(6)) { npcType = NPC.NewNPC((int)npcposX, (int)npcposY, NPCID.GoldButterfly); dustType = DustID.GoldCoin; } else { npcType = NPC.NewNPC((int)npcposX, (int)npcposY, 356); dustType = DustID.MagicMirror; } Main.npc[npcType].netUpdate = true; Vector2 spinningpoint = new Vector2(0.0f, -3f).RotatedByRandom(MathHelper.Pi); float num1 = (float)28; Vector2 vector2 = new Vector2(1.1f, 1f); for (float num2 = 0.0f; (double)num2 < (double)num1; ++num2) { int dustIndex = Dust.NewDust(new Vector2(npcposX, npcposY), 0, 0, dustType, 0.0f, 0.0f, 0, new Color(), 1f); Main.dust[dustIndex].position = new Vector2(npcposX, npcposY); Main.dust[dustIndex].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double)num2 / (double)num1, new Vector2()) * vector2 * (float)(0.800000011920929 + (double)Main.rand.NextFloat() * 0.400000005960464); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].scale = 2f; Main.dust[dustIndex].fadeIn = Main.rand.NextFloat() * 2f; Dust dust = Dust.CloneDust(dustIndex); dust.scale /= 2f; dust.fadeIn /= 2f; } Main.PlaySound(SoundID.Item, (int)npcposX, (int)npcposY, 6, 1f, 0f); } break; } case 5: //Convert regional stone into gems { GoodLuck(i, j); int gemType = Main.rand.Next(new int[] { 63, 64, 65, 66, 67, 68 }); if (Main.netMode != NetmodeID.SinglePlayer) { gemType = 64; } ConvertStone(i, j, 22, gemType, 0.1f); for (int val = 0; val < 22; val++) { int num = Dust.NewDust(new Vector2(i * 16, j * 16), 80, 80, DustID.Electric, 0f, -2f, 0, default, 2f); Main.dust[num].noGravity = true; Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(77, player); Main.dust[num].position.X += Main.rand.Next(-50, 51) * .05f - 1.5f; Main.dust[num].position.Y += Main.rand.Next(-50, 51) * .05f - 1.5f; Main.dust[num].scale *= .25f; } break; }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Player player = Main.player[Player.FindClosest(new Vector2(i * 16, j * 16), 100, 100)]; Tile tile = Main.tile[i, j]; Main.PlaySound(new Terraria.Audio.LegacySoundStyle(42, 186)); for (int index1 = 0; index1 < 3; ++index1) { for (int index2 = 0; index2 < 2; ++index2) { int index3 = Gore.NewGore(new Vector2(i * 16, j * 16), new Vector2(0.0f, 0.0f), 99, 1.1f); Main.gore[index3].velocity *= 0.6f; } } for (int index = 0; index < 9; ++index) { float SpeedX = (float)(-(double)1 * (double)Main.rand.Next(40, 70) * 0.00999999977648258 + (double)Main.rand.Next(-20, 21) * 0.400000005960464); float SpeedY = (float)(-(double)1 * (double)Main.rand.Next(40, 70) * 0.00999999977648258 + (double)Main.rand.Next(-20, 21) * 0.400000005960464); int p = Projectile.NewProjectile((float)(i * 16) + 8 + SpeedX, (float)(j * 16) + 12 + SpeedY, SpeedX, SpeedY, mod.ProjectileType("Visual_Projectile"), 0, 0f, player.whoAmI, 0.0f, 0.0f); Main.projectile[p].scale = Main.rand.Next(30, 150) * 0.01f; } //int randomEffectCounter = 5; int randomEffectCounter = Main.rand.Next(12); switch (randomEffectCounter) { case 0: //SPAWN ZOMBIES { BadLuck(); int a = NPC.NewNPC((int)(i * 16) + -8 - 16 - 16, (j * 16) + 6, 21); int b = NPC.NewNPC((int)(i * 16) + -8 - 16, (j * 16) + 6, 21); int c = NPC.NewNPC((int)(i * 16) + 8, (j * 16) + 6, 21); int d = NPC.NewNPC((int)(i * 16) + 24 + 16, (j * 16) + 6, 21); int e = NPC.NewNPC((int)(i * 16) + 24 + 32, (j * 16) + 6, 21); Main.npc[a].netUpdate = true; Main.npc[b].netUpdate = true; Main.npc[c].netUpdate = true; Main.npc[d].netUpdate = true; Main.npc[e].netUpdate = true; break; } case 1: //DROP COINS { BadLuck(); Main.PlaySound(new Terraria.Audio.LegacySoundStyle(18, 0)); int num1 = 0; for (int index = 0; index < 59; ++index) { if (player.inventory[index].type >= 71 && player.inventory[index].type <= 74) { int number = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, player.inventory[index].type, 1); if (Main.netMode == 1 && number >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number, 1f); } int num2 = player.inventory[index].stack / 5; if (Main.expertMode) { num2 = (int)((double)player.inventory[index].stack * 0.25); } int num3 = player.inventory[index].stack - num2; player.inventory[index].stack -= num3; if (player.inventory[index].type == 71) { num1 += num3; } if (player.inventory[index].type == 72) { num1 += num3 * 100; } if (player.inventory[index].type == 73) { num1 += num3 * 10000; } if (player.inventory[index].type == 74) { num1 += num3 * 1000000; } if (player.inventory[index].stack <= 0) { player.inventory[index] = new Item(); } Main.item[number].stack = num3; Main.item[number].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; Main.item[number].noGrabDelay = 600; if (index == 58) { Main.mouseItem = player.inventory[index].Clone(); } } } player.lostCoins = num1; player.lostCoinString = Main.ValueToCoins(player.lostCoins); break; } case 2: //SPAWN POTIONS { GoodLuck(); int randomPotion = Utils.SelectRandom <int>(Main.rand, new int[38] { 2344, 303, 300, 2325, 2324, 2356, 2329, 2346, 295, 2354, 2327, 291, 305, 2323, 304, 2348, 297, 292, 2345, 2352, 294, 293, 2322, 299, 288, 2347, 289, 298, 2355, 296, 2353, 2328, 290, 301, 2326, 2359, 302, 2349 }); int randomPotion2 = Utils.SelectRandom <int>(Main.rand, new int[38] { 2344, 303, 300, 2325, 2324, 2356, 2329, 2346, 295, 2354, 2327, 291, 305, 2323, 304, 2348, 297, 292, 2345, 2352, 294, 293, 2322, 299, 288, 2347, 289, 298, 2355, 296, 2353, 2328, 290, 301, 2326, 2359, 302, 2349 }); int randomPotion3 = Utils.SelectRandom <int>(Main.rand, new int[38] { 2344, 303, 300, 2325, 2324, 2356, 2329, 2346, 295, 2354, 2327, 291, 305, 2323, 304, 2348, 297, 292, 2345, 2352, 294, 293, 2322, 299, 288, 2347, 289, 298, 2355, 296, 2353, 2328, 290, 301, 2326, 2359, 302, 2349 }); int randomPotion4 = Utils.SelectRandom <int>(Main.rand, new int[38] { 2344, 303, 300, 2325, 2324, 2356, 2329, 2346, 295, 2354, 2327, 291, 305, 2323, 304, 2348, 297, 292, 2345, 2352, 294, 293, 2322, 299, 288, 2347, 289, 298, 2355, 296, 2353, 2328, 290, 301, 2326, 2359, 302, 2349 }); if (Main.netMode == 1) { randomPotion = 2344; randomPotion2 = 303; randomPotion3 = 300; randomPotion4 = 2356; } int number = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, randomPotion, 1); Main.item[number].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; if (Main.netMode == 1 && number >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number, 1f); } int number2 = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, randomPotion2, 1); Main.item[number2].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[number2].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; if (Main.netMode == 1 && number2 >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number2, 1f); } int number3 = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, randomPotion3, 1); Main.item[number3].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[number3].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; if (Main.netMode == 1 && number3 >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number3, 1f); } int number4 = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, randomPotion4, 1); Main.item[number4].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[number4].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; if (Main.netMode == 1 && number4 >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number4, 1f); } break; } case 3: //SPAWN AN ITEM { GoodLuck(); int item = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, 393, 1); if (Main.netMode == 1 && item >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, item, 1f); } int item1 = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, 18, 1); if (Main.netMode == 1 && item1 >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, item1, 1f); } break; } case 4: //SPAWN BUNNIES { NeutralLuck(); float npcposX = 0f; float npcposY = 0f; for (int g = 0; g < 8 + Main.rand.Next(6); g++) { npcposX = (i * 16) + Main.rand.Next(-60, 60); npcposY = (j * 16) + Main.rand.Next(-60, 60); int a = NPC.NewNPC((int)npcposX, (int)npcposY, 356); Main.npc[a].value = 0; Main.npc[a].friendly = false; Main.npc[a].netUpdate = true; Vector2 spinningpoint = new Vector2(0.0f, -3f).RotatedByRandom(3.14159274101257); float num1 = (float)28; Vector2 vector2 = new Vector2(1.1f, 1f); for (float num2 = 0.0f; (double)num2 < (double)num1; ++num2) { int dustIndex = Dust.NewDust(new Vector2(npcposX, npcposY), 0, 0, 15, 0.0f, 0.0f, 0, new Color(), 1f); Main.dust[dustIndex].position = new Vector2(npcposX, npcposY); Main.dust[dustIndex].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double)num2 / (double)num1, new Vector2()) * vector2 * (float)(0.800000011920929 + (double)Main.rand.NextFloat() * 0.400000005960464); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].scale = 2f; Main.dust[dustIndex].fadeIn = Main.rand.NextFloat() * 2f; Dust dust = Dust.CloneDust(dustIndex); dust.scale /= 2f; dust.fadeIn /= 2f; } Main.PlaySound(2, (int)npcposX, (int)npcposY, 6, 1f, 0f); } break; } case 5: //Potion N LAVA { NeutralLuck(); Main.tile[i, j].lava(true); Main.tile[i, j].liquid = byte.MaxValue; Main.tile[i - 4, j + 2].lava(true); Main.tile[i - 4, j + 2].liquid = byte.MaxValue; Main.tile[i + 4, j + 2].lava(true); Main.tile[i + 4, j + 2].liquid = byte.MaxValue; int item = Item.NewItem((int)(i * 16), (int)(j * 16) - 12, 16, 18, ItemID.ObsidianSkinPotion, 1); if (Main.netMode == 1 && item >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, item, 1f); } break; } case 6: //Convert regional stone into gems { GoodLuck(); int gemType = Main.rand.Next(new int[] { 63, 64, 65, 66, 67, 68 }); if (Main.netMode == 1) { gemType = 64; } ConvertStone(i, j, 8, gemType); for (int val = 0; val < 22; val++) { int num = Dust.NewDust(new Vector2(i * 16, j * 16), 80, 80, 226, 0f, -2f, 0, default(Color), 2f); Main.dust[num].noGravity = true; Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(77, player); Main.dust[num].position.X += Main.rand.Next(-50, 51) * .05f - 1.5f; Main.dust[num].position.Y += Main.rand.Next(-50, 51) * .05f - 1.5f; Main.dust[num].scale *= .25f; } break; } case 7: //Places opposite world evil { BadLuck(); for (int value = 0; value < 32; value++) { int num = Dust.NewDust(new Vector2(i * 16, j * 16), 50, 50, 54, 0f, -2f, 0, default(Color), 2f); Main.dust[num].noGravity = true; Main.dust[num].position.X += Main.rand.Next(-50, 51) * .05f - 1.5f; Main.dust[num].position.Y += Main.rand.Next(-50, 51) * .05f - 1.5f; Main.dust[num].scale *= .35f; Main.dust[num].fadeIn += .1f; } if (WorldGen.crimson) { ConvertStone(i, j, 9, 25); ConvertDirt(i, j, 9, 23); } else { ConvertStone(i, j, 9, 203); ConvertDirt(i, j, 9, 199); } break; } case 8: //Midas effect { GoodLuck(); player.AddBuff(ModContent.BuffType <Buffs.MidasTouch>(), 3600 * 5); for (int numi = 0; numi < 5; numi++) { float SpeedX = (float)(-(double)1 * (double)Main.rand.Next(40, 70) * 0.00999999977648258 + (double)Main.rand.Next(-20, 21) * 0.400000005960464); float SpeedY = (float)(-(double)1 * (double)Main.rand.Next(40, 70) * 0.00999999977648258 + (double)Main.rand.Next(-20, 21) * 0.400000005960464); int p = Projectile.NewProjectile((float)(i * 16) + 8 + SpeedX, (float)(j * 16) + 12 + SpeedY, SpeedX, SpeedY, mod.ProjectileType("MidasProjectile"), 0, 0f, player.whoAmI, 0.0f, 0.0f); Main.projectile[p].scale = Main.rand.Next(60, 150) * 0.01f; } break; } case 9: //Clear all buffs and debuffs { NeutralLuck(); for (int index1 = 0; index1 < 22; ++index1) { player.DelBuff(index1); } break; } case 10: //Darkness and Weak { BadLuck(); player.AddBuff(BuffID.Darkness, 3600); player.AddBuff(BuffID.Weak, 3600); break; } case 11: //Opposite gold/platinum ore { GoodLuck(); int oreType = 13; if (WorldGen.GoldTierOre == TileID.Platinum) { oreType = 13; } else { oreType = 702; } ConvertStone(i, j, 8, oreType); break; } case 12: { GoodLuck(); int item = Item.NewItem((int)(i * 16) + 8, (int)(j * 16) + 12, 16, 18, ModContent.ItemType <Glyph>(), 1); if (Main.netMode == 1 && item >= 0) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, item, 1f); } break; } } }