Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AI_147_Explosion()

void Terraria.Projectile.AI_147_Explosion ( )
inlineprivate

Definition at line 43296 of file Projectile.cs.

43297 {
43298 switch ((int)ai[0])
43299 {
43300 case 0:
43301 {
43302 for (int k = 0; k < 4; k++)
43303 {
43304 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
43305 }
43306 for (int l = 0; l < 20; l++)
43307 {
43308 int num5 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 130, 0f, 0f, 200, default(Color), 1.2f);
43309 Main.dust[num5].noGravity = true;
43310 Main.dust[num5].velocity *= 3f;
43311 num5 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 130, 0f, 0f, 200, default(Color), 0.5f);
43312 Main.dust[num5].velocity *= 1.2f;
43313 Main.dust[num5].noGravity = true;
43314 }
43315 for (int m = 0; m < 1; m++)
43316 {
43317 int num6 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
43318 Main.gore[num6].velocity *= 0.3f;
43319 Main.gore[num6].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43320 Main.gore[num6].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43321 }
43322 break;
43323 }
43324 case 1:
43325 {
43327 Vector2 center2 = base.Center;
43328 Main.rand.NextFloat();
43329 for (float num7 = 0f; num7 < 1f; num7 += 0.0125f)
43330 {
43331 Dust dust4 = Dust.NewDustPerfect(center2, 278, null, 200, Color.Lerp(celeb2Color2, Color.White, Main.rand.NextFloat() * 0.6f));
43332 dust4.scale = 1.1f;
43333 dust4.fadeIn = 1.3f;
43334 dust4.velocity *= Main.rand.NextFloat() * 2f + 2f;
43335 if (dust4.velocity.Y > 0f)
43336 {
43337 dust4.velocity *= 0.3f;
43338 }
43339 dust4.velocity *= 2f;
43340 }
43341 for (int n = 0; n < 3; n++)
43342 {
43343 int num8 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
43344 Main.gore[num8].velocity *= 0.3f;
43345 Main.gore[num8].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43346 Main.gore[num8].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43347 }
43348 int fluff = 20;
43349 int distFluff = 100;
43350 int layerStart = 2;
43351 int layerEnd = 10;
43352 int layerJump = 2;
43354 break;
43355 }
43356 case 2:
43357 {
43358 Vector2 center3 = base.Center;
43360 float num9 = 0.05f;
43361 float num10 = 0.13f;
43362 bool flag = Main.rand.Next(4) == 0;
43363 if (flag)
43364 {
43365 num9 = 0.1f;
43366 num10 = 0.1f;
43367 }
43368 float num11 = Main.rand.NextFloatDirection();
43369 for (float num12 = 0f; num12 < 5f; num12 += 1f)
43370 {
43371 Vector2 spinningpoint = new Vector2(0f, -100f);
43372 Vector2 vector4 = center3 + spinningpoint.RotatedBy(num11 + num12 * ((float)Math.PI * 2f / 5f));
43373 Vector2 vector5 = center3 + spinningpoint.RotatedBy(num11 + (num12 + 1f) * ((float)Math.PI * 2f / 5f));
43374 Vector2 vector6 = center3 + spinningpoint.RotatedBy(num11 + (num12 + 0.5f) * ((float)Math.PI * 2f / 5f)) * 0.4f;
43375 for (int num13 = 0; num13 < 2; num13++)
43376 {
43379 if (num13 == 1)
43380 {
43381 value = vector6;
43382 value2 = vector5;
43383 }
43384 for (float num14 = 0f; num14 < 1f; num14 += num10)
43385 {
43388 Vector2 vector9 = (vector7 - vector8).SafeNormalize(Vector2.Zero);
43389 Dust dust5 = Dust.NewDustPerfect(vector8, 267, Vector2.Zero, 0, celeb2Color3, 0.5f);
43390 dust5.fadeIn = 1.2f;
43391 dust5.noGravity = true;
43392 dust5.velocity = vector9 * Vector2.Distance(vector7, vector8) * num9;
43393 }
43394 }
43395 }
43396 if (flag)
43397 {
43398 for (int num15 = 0; num15 < 4; num15++)
43399 {
43400 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
43401 }
43402 for (int num16 = 0; num16 < 60; num16++)
43403 {
43404 int num17 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 200, default(Color), 2.5f);
43405 Main.dust[num17].noGravity = true;
43406 Main.dust[num17].velocity *= 8f;
43407 num17 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 200, default(Color), 1.5f);
43408 Main.dust[num17].velocity *= 4.2f;
43409 Main.dust[num17].noGravity = true;
43410 }
43411 for (int num18 = 0; num18 < 1; num18++)
43412 {
43413 int num19 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
43414 Main.gore[num19].velocity *= 0.3f;
43415 Main.gore[num19].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43416 Main.gore[num19].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43417 }
43418 }
43419 else
43420 {
43421 for (int num20 = 0; num20 < 4; num20++)
43422 {
43423 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
43424 }
43425 for (int num21 = 0; num21 < 40; num21++)
43426 {
43427 int num22 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 200, default(Color), 2.5f);
43428 Main.dust[num22].noGravity = true;
43429 Main.dust[num22].velocity *= 4f;
43430 num22 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 200, default(Color), 1.5f);
43431 Main.dust[num22].velocity *= 2.2f;
43432 Main.dust[num22].noGravity = true;
43433 }
43434 for (int num23 = 0; num23 < 1; num23++)
43435 {
43436 int num24 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
43437 Main.gore[num24].velocity *= 0.3f;
43438 Main.gore[num24].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43439 Main.gore[num24].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43440 }
43441 }
43442 break;
43443 }
43444 case 3:
43445 {
43447 Vector2 center4 = base.Center;
43448 for (int num27 = 0; num27 < 4; num27++)
43449 {
43450 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
43451 }
43452 float num28 = Main.rand.NextFloat() * ((float)Math.PI * 2f);
43453 for (int num29 = 0; num29 < 40; num29++)
43454 {
43455 Dust dust6 = Dust.NewDustPerfect(center4, 278, null, 100, Color.Lerp(celeb2Color5, Color.White, Main.rand.NextFloat() * 0.3f));
43456 dust6.scale = 1.3f * (dust6.velocity.Length() / 2f);
43457 dust6.fadeIn = 1.5f * (dust6.velocity.Length() / 2f);
43458 dust6.noGravity = true;
43459 dust6.velocity *= 6f;
43460 if (Math.Abs(dust6.velocity.X) > Math.Abs(dust6.velocity.Y))
43461 {
43462 dust6.velocity.Y *= 0.1f;
43463 }
43464 else
43465 {
43466 dust6.velocity.X *= 0.1f;
43467 }
43468 dust6.velocity = dust6.velocity.RotatedBy(num28);
43469 }
43470 for (int num30 = 0; num30 < 1; num30++)
43471 {
43472 int num31 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
43473 Main.gore[num31].velocity *= 0.3f;
43474 Main.gore[num31].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43475 Main.gore[num31].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43476 }
43477 break;
43478 }
43479 case 4:
43480 {
43482 Vector2 center5 = base.Center;
43483 Main.rand.NextFloat();
43484 for (float num32 = 0f; num32 < 1f; num32 += 0.025f)
43485 {
43486 Dust dust7 = Dust.NewDustPerfect(center5, 132, null, 200);
43487 dust7.scale = 1.1f;
43488 dust7.fadeIn = 1.5f;
43489 dust7.velocity *= Main.rand.NextFloat() * 2f + 2f;
43490 if (dust7.velocity.Y > 0f)
43491 {
43492 dust7.velocity *= 0.3f;
43493 }
43494 dust7.velocity *= 2f;
43495 }
43496 for (int num33 = 0; num33 < 3; num33++)
43497 {
43498 int num34 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
43499 Main.gore[num34].velocity *= 0.3f;
43500 Main.gore[num34].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43501 Main.gore[num34].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43502 }
43503 break;
43504 }
43505 case 5:
43506 {
43508 _ = base.Center;
43509 for (int num25 = 0; num25 < 20; num25++)
43510 {
43511 int num26 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 278, 0f, 0f, 200, Color.Lerp(celeb2Color4, Color.White, Main.rand.NextFloat() * 0.4f), 2.5f);
43512 Main.dust[num26].fadeIn = 1.3f;
43513 Main.dust[num26].scale = 1.1f;
43514 Main.dust[num26].velocity *= 2f;
43515 num26 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0f, 0f, 200, celeb2Color4, 2.5f);
43516 Main.dust[num26].velocity *= 1.2f;
43517 Main.dust[num26].noGravity = true;
43518 }
43519 break;
43520 }
43521 case 6:
43522 {
43524 Vector2 center = base.Center;
43525 for (int i = 0; i < 4; i++)
43526 {
43527 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
43528 }
43529 for (float num = 0f; num < 1f; num += 0.015f)
43530 {
43531 Vector2 vector = Vector2.UnitY.RotatedBy(num * ((float)Math.PI * 2f)) * (1f + Main.rand.NextFloatDirection() * 0.1f);
43532 Dust dust = Dust.NewDustPerfect(center + vector, 134, Vector2.Zero, 0, celeb2Color);
43533 dust.scale = 1.4f;
43534 dust.velocity = vector * 5f;
43535 dust.velocity.Y += -3f;
43536 dust.velocity *= 2f;
43537 }
43538 for (float num2 = 0f; num2 < 1f; num2 += 0.025f)
43539 {
43540 Vector2 vector2 = Vector2.UnitY.RotatedBy(num2 * ((float)Math.PI * 2f)) * (1f + Main.rand.NextFloatDirection() * 0.2f);
43541 Dust dust2 = Dust.NewDustPerfect(center + vector2, 267, Vector2.Zero, 0, celeb2Color);
43542 dust2.noGravity = true;
43543 dust2.scale = 0.4f;
43544 dust2.fadeIn = 1.2f;
43545 dust2.velocity = vector2 * 4f;
43546 dust2.velocity.Y += -3f;
43547 dust2.velocity *= 2f;
43548 }
43549 for (float num3 = 0f; num3 < 1f; num3 += 0.07f)
43550 {
43551 Vector2 vector3 = Vector2.UnitY.RotatedBy(num3 * ((float)Math.PI * 2f)) * (1f + Main.rand.NextFloatDirection() * 0.3f);
43552 Dust dust3 = Dust.NewDustPerfect(center + vector3, 267, Vector2.Zero, 0, celeb2Color);
43553 dust3.noGravity = true;
43554 dust3.scale = 0.4f;
43555 dust3.fadeIn = 1.3f;
43556 dust3.velocity = vector3 * 7f;
43557 dust3.velocity.Y += -3f;
43558 dust3.velocity *= 2f;
43559 }
43560 for (int j = 0; j < 1; j++)
43561 {
43562 int num4 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
43563 Main.gore[num4].velocity *= 0.3f;
43564 Main.gore[num4].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43565 Main.gore[num4].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43566 }
43567 break;
43568 }
43569 }
43570 }
static double Abs(double value)
const double PI
Definition Math.cs:16
Vector2 position
Definition Entity.cs:14
void CreateGroundExplosion(float MAX_SPREAD, int fluff, int distFluff, int layerStart, int layerEnd, int layerJump)
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227

References System.Math.Abs(), Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Main.dust, Terraria.Main.gore, Microsoft.Xna.Framework.Color.Lerp(), Microsoft.Xna.Framework.Vector2.Lerp(), Terraria.Dust.NewDust(), Terraria.Dust.NewDustPerfect(), Terraria.Gore.NewGore(), Microsoft.Xna.Framework.Vector2.One, System.Math.PI, Terraria.Main.rand, Microsoft.Xna.Framework.Vector2.UnitY, System.value, Microsoft.Xna.Framework.Color.White, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.