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

◆ AI_006_Worms()

void Terraria.NPC.AI_006_Worms ( )
inlineprivate

Definition at line 44220 of file NPC.cs.

44221 {
44222 if (type == 117 && localAI[1] == 0f)
44223 {
44224 localAI[1] = 1f;
44226 int num = 1;
44227 if (velocity.X < 0f)
44228 {
44229 num = -1;
44230 }
44231 for (int i = 0; i < 20; i++)
44232 {
44233 Dust.NewDust(new Vector2(position.X - 20f, position.Y - 20f), width + 40, height + 40, 5, num * 8, -1f);
44234 }
44235 }
44236 if (type == 454 && localAI[3] == 0f)
44237 {
44239 localAI[3] = 1f;
44240 }
44241 if (type >= 454 && type <= 459)
44242 {
44243 dontTakeDamage = alpha > 0;
44244 if (type == 454 || (type != 454 && Main.npc[(int)ai[1]].alpha < 85))
44245 {
44246 if (dontTakeDamage)
44247 {
44248 for (int j = 0; j < 2; j++)
44249 {
44250 int num2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 100, default(Color), 2f);
44251 Main.dust[num2].noGravity = true;
44252 Main.dust[num2].noLight = true;
44253 }
44254 }
44255 alpha -= 42;
44256 if (alpha < 0)
44257 {
44258 alpha = 0;
44259 }
44260 }
44261 }
44262 if (type >= 621 && type <= 623)
44263 {
44265 dontTakeDamage = alpha > 0;
44266 if (type == 621 || (type != 621 && Main.npc[(int)ai[1]].alpha < 85))
44267 {
44268 if (dontTakeDamage)
44269 {
44270 for (int k = 0; k < 2; k++)
44271 {
44272 Dust.NewDust(position, width, height, 5, 0f, 0f, 100);
44273 }
44274 }
44275 alpha -= 42;
44276 if (alpha < 0)
44277 {
44278 alpha = 0;
44279 }
44280 }
44281 if (alpha == 0 && Main.rand.Next(5) == 0)
44282 {
44283 Dust.NewDust(position, width, height, 5, 0f, 0f, 100);
44284 }
44286 }
44287 else if (type == 402)
44288 {
44289 ai[2] += 1f;
44290 float num3 = 600f;
44291 float num4 = num3 - 30f;
44292 if (velocity.Length() >= 1f && ai[2] <= num4)
44293 {
44294 velocity *= Utils.Remap(ai[2], num4 * 0.5f, num4, 1f, 0.5f);
44295 }
44296 if (ai[2] == num4)
44297 {
44298 for (int l = 0; l < 50; l++)
44299 {
44300 Vector2 vector = Main.rand.NextVector2Circular(8f, 8f);
44301 if (Main.rand.Next(2) == 0)
44302 {
44303 int num5 = Dust.NewDust(position, width, height, 180, 0f, 0f, 100);
44304 Main.dust[num5].scale += (float)Main.rand.Next(50) * 0.04f;
44305 Main.dust[num5].noGravity = true;
44306 Main.dust[num5].velocity = vector;
44307 Main.dust[num5].fadeIn = Main.rand.NextFloat() * 1.5f;
44308 }
44309 if (Main.rand.Next(2) == 0)
44310 {
44311 int num6 = Dust.NewDust(position, width, height, 176, 0f, 0f, 100);
44312 Main.dust[num6].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
44313 Main.dust[num6].noGravity = true;
44314 Main.dust[num6].velocity = vector;
44315 Main.dust[num6].fadeIn = Main.rand.NextFloat() * 1.5f;
44316 }
44317 }
44318 if (Main.netMode != 1)
44319 {
44321 velocity = velocity.SafeNormalize(Vector2.Zero) * 6f;
44322 netUpdate = true;
44323 }
44324 }
44325 if (ai[2] >= num3 && Main.netMode != 1)
44326 {
44327 ai[2] = 0f;
44328 netUpdate = true;
44329 }
44330 }
44331 if (Main.netMode != 1 && Main.expertMode)
44332 {
44333 if (type == 14 && ((double)(position.Y / 16f) < Main.worldSurface || Main.getGoodWorld))
44334 {
44335 int num7 = (int)(base.Center.X / 16f);
44336 int num8 = (int)(base.Center.Y / 16f);
44337 if (WorldGen.InWorld(num7, num8) && Main.tile[num7, num8].wall == 0)
44338 {
44339 int num9 = 900;
44340 if (Main.getGoodWorld)
44341 {
44342 num9 /= 2;
44343 }
44344 if (Main.rand.Next(num9) == 0)
44345 {
44346 TargetClosest();
44347 if (Collision.CanHitLine(base.Center, 1, 1, Main.player[target].Center, 1, 1))
44348 {
44349 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2) + velocity.X), (int)(position.Y + (float)(height / 2) + velocity.Y), 666, 0, 0f, 1f);
44350 }
44351 }
44352 }
44353 }
44354 else if (type == 13)
44355 {
44356 int num10 = 90;
44357 num10 += (int)((float)life / (float)lifeMax * 60f * 5f);
44358 if (Main.rand.Next(num10) == 0)
44359 {
44360 TargetClosest();
44361 if (Collision.CanHitLine(base.Center, 1, 1, Main.player[target].Center, 1, 1))
44362 {
44363 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2) + velocity.X), (int)(position.Y + (float)(height / 2) + velocity.Y), 666, 0, 0f, 1f);
44364 }
44365 }
44366 }
44367 }
44368 bool flag = false;
44369 float num11 = 0.2f;
44370 switch (type)
44371 {
44372 case 513:
44373 flag = !Main.player[target].ZoneUndergroundDesert;
44374 num11 = 0.1f;
44375 break;
44376 case 10:
44377 case 39:
44378 case 95:
44379 case 117:
44380 case 510:
44381 flag = true;
44382 break;
44383 case 621:
44384 flag = false;
44385 break;
44386 }
44387 if (type >= 13 && type <= 15)
44388 {
44389 realLife = -1;
44390 }
44391 else if (ai[3] > 0f)
44392 {
44393 realLife = (int)ai[3];
44394 }
44395 if (target < 0 || target == 255 || Main.player[target].dead || (flag && (double)Main.player[target].position.Y < Main.worldSurface * 16.0))
44396 {
44397 TargetClosest();
44398 }
44399 if (Main.player[target].dead || (flag && (double)Main.player[target].position.Y < Main.worldSurface * 16.0))
44400 {
44401 EncourageDespawn(300);
44402 if (flag)
44403 {
44404 velocity.Y += num11;
44405 }
44406 }
44407 if (type == 621 && Main.dayTime)
44408 {
44409 EncourageDespawn(60);
44410 velocity.Y += 1f;
44411 }
44412 if (Main.netMode != 1)
44413 {
44414 if (type == 87 && ai[0] == 0f)
44415 {
44416 ai[3] = whoAmI;
44417 realLife = whoAmI;
44418 int num12 = 0;
44419 int num13 = whoAmI;
44420 for (int m = 0; m < 14; m++)
44421 {
44422 int num14 = 89;
44423 switch (m)
44424 {
44425 case 1:
44426 case 8:
44427 num14 = 88;
44428 break;
44429 case 11:
44430 num14 = 90;
44431 break;
44432 case 12:
44433 num14 = 91;
44434 break;
44435 case 13:
44436 num14 = 92;
44437 break;
44438 }
44439 num12 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num14, whoAmI);
44440 Main.npc[num12].ai[3] = whoAmI;
44441 Main.npc[num12].realLife = whoAmI;
44442 Main.npc[num12].ai[1] = num13;
44443 Main.npc[num12].CopyInteractions(this);
44444 Main.npc[num13].ai[0] = num12;
44445 NetMessage.SendData(23, -1, -1, null, num12);
44446 num13 = num12;
44447 }
44448 }
44449 if (type == 454 && ai[0] == 0f)
44450 {
44451 ai[3] = whoAmI;
44452 realLife = whoAmI;
44453 int num15 = 0;
44454 int num16 = whoAmI;
44455 for (int n = 0; n < 30; n++)
44456 {
44457 int num17 = 456;
44458 if ((n - 2) % 4 == 0 && n < 26)
44459 {
44460 num17 = 455;
44461 }
44462 else
44463 {
44464 switch (n)
44465 {
44466 case 27:
44467 num17 = 457;
44468 break;
44469 case 28:
44470 num17 = 458;
44471 break;
44472 case 29:
44473 num17 = 459;
44474 break;
44475 }
44476 }
44477 num15 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num17, whoAmI);
44478 Main.npc[num15].ai[3] = whoAmI;
44479 Main.npc[num15].realLife = whoAmI;
44480 Main.npc[num15].ai[1] = num16;
44481 Main.npc[num15].CopyInteractions(this);
44482 Main.npc[num16].ai[0] = num15;
44483 NetMessage.SendData(23, -1, -1, null, num15);
44484 num16 = num15;
44485 }
44486 }
44487 if (type == 513 && ai[0] == 0f)
44488 {
44489 ai[3] = whoAmI;
44490 realLife = whoAmI;
44491 int num18 = 0;
44492 int num19 = whoAmI;
44493 int num20 = Main.rand.Next(6, 10);
44494 for (int num21 = 0; num21 < num20; num21++)
44495 {
44496 int num22 = 514;
44497 if (num21 == num20 - 1)
44498 {
44499 num22 = 515;
44500 }
44501 num18 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num22, whoAmI);
44502 Main.npc[num18].ai[3] = whoAmI;
44503 Main.npc[num18].realLife = whoAmI;
44504 Main.npc[num18].ai[1] = num19;
44505 Main.npc[num18].CopyInteractions(this);
44506 Main.npc[num19].ai[0] = num18;
44507 NetMessage.SendData(23, -1, -1, null, num18);
44508 num19 = num18;
44509 }
44510 }
44511 if (type == 510 && ai[0] == 0f)
44512 {
44513 ai[3] = whoAmI;
44514 realLife = whoAmI;
44515 int num23 = 0;
44516 int num24 = whoAmI;
44517 int num25 = Main.rand.Next(12, 21);
44518 for (int num26 = 0; num26 < num25; num26++)
44519 {
44520 int num27 = 511;
44521 if (num26 == num25 - 1)
44522 {
44523 num27 = 512;
44524 }
44525 num23 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num27, whoAmI);
44526 Main.npc[num23].ai[3] = whoAmI;
44527 Main.npc[num23].realLife = whoAmI;
44528 Main.npc[num23].ai[1] = num24;
44529 Main.npc[num23].CopyInteractions(this);
44530 Main.npc[num24].ai[0] = num23;
44531 NetMessage.SendData(23, -1, -1, null, num23);
44532 num24 = num23;
44533 }
44534 }
44535 if (type == 621 && ai[0] == 0f)
44536 {
44537 ai[3] = whoAmI;
44538 realLife = whoAmI;
44539 int num28 = 0;
44540 int num29 = whoAmI;
44541 int num30 = 16;
44542 for (int num31 = 0; num31 < num30; num31++)
44543 {
44544 int num32 = 622;
44545 if (num31 == num30 - 1)
44546 {
44547 num32 = 623;
44548 }
44549 num28 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num32, whoAmI);
44550 Main.npc[num28].ai[3] = whoAmI;
44551 Main.npc[num28].realLife = whoAmI;
44552 Main.npc[num28].ai[1] = num29;
44553 Main.npc[num28].CopyInteractions(this);
44554 Main.npc[num29].ai[0] = num28;
44555 NetMessage.SendData(23, -1, -1, null, num28);
44556 num29 = num28;
44557 }
44558 }
44559 else if ((type == 7 || type == 8 || type == 10 || type == 11 || type == 13 || type == 14 || type == 39 || type == 40 || type == 95 || type == 96 || type == 98 || type == 99 || type == 117 || type == 118) && ai[0] == 0f)
44560 {
44561 if (type == 7 || type == 10 || type == 13 || type == 39 || type == 95 || type == 98 || type == 117)
44562 {
44563 if (type < 13 || type > 15)
44564 {
44565 ai[3] = whoAmI;
44566 realLife = whoAmI;
44567 }
44568 ai[2] = Main.rand.Next(8, 13);
44569 if (type == 10)
44570 {
44571 ai[2] = Main.rand.Next(4, 7);
44572 }
44573 if (type == 13)
44574 {
44576 }
44577 if (type == 39)
44578 {
44579 ai[2] = Main.rand.Next(14, 23);
44580 if (Main.getGoodWorld)
44581 {
44582 ai[2] += 3f;
44583 if (Main.remixWorld)
44584 {
44585 ai[2] += 4f;
44586 }
44587 }
44588 }
44589 if (type == 95)
44590 {
44591 ai[2] = Main.rand.Next(6, 12);
44592 }
44593 if (type == 98)
44594 {
44595 ai[2] = Main.rand.Next(20, 26);
44596 }
44597 if (type == 117)
44598 {
44599 ai[2] = Main.rand.Next(3, 6);
44600 }
44601 if (type == 7 && Main.remixWorld)
44602 {
44603 ai[2] *= 2f;
44604 }
44605 ai[0] = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), type + 1, whoAmI);
44606 Main.npc[(int)ai[0]].CopyInteractions(this);
44607 }
44608 else if ((type == 8 || type == 11 || type == 14 || type == 40 || type == 96 || type == 99 || type == 118) && ai[2] > 0f)
44609 {
44610 ai[0] = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), type, whoAmI);
44611 Main.npc[(int)ai[0]].CopyInteractions(this);
44612 }
44613 else
44614 {
44615 ai[0] = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), type + 1, whoAmI);
44616 Main.npc[(int)ai[0]].CopyInteractions(this);
44617 }
44618 if (type < 13 || type > 15)
44619 {
44620 Main.npc[(int)ai[0]].ai[3] = ai[3];
44621 Main.npc[(int)ai[0]].realLife = realLife;
44622 }
44623 Main.npc[(int)ai[0]].ai[1] = whoAmI;
44624 Main.npc[(int)ai[0]].ai[2] = ai[2] - 1f;
44625 netUpdate = true;
44626 }
44627 if (type == 412 && ai[0] == 0f)
44628 {
44629 ai[3] = whoAmI;
44630 realLife = whoAmI;
44631 int num33 = 0;
44632 int num34 = whoAmI;
44633 int num35 = 30;
44634 for (int num36 = 0; num36 < num35; num36++)
44635 {
44636 int num37 = 413;
44637 if (num36 == num35 - 1)
44638 {
44639 num37 = 414;
44640 }
44641 num33 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num37, whoAmI);
44642 Main.npc[num33].ai[3] = whoAmI;
44643 Main.npc[num33].realLife = whoAmI;
44644 Main.npc[num33].ai[1] = num34;
44645 Main.npc[num33].CopyInteractions(this);
44646 Main.npc[num34].ai[0] = num33;
44647 NetMessage.SendData(23, -1, -1, null, num33);
44648 num34 = num33;
44649 }
44650 }
44651 switch (type)
44652 {
44653 case 8:
44654 case 9:
44655 case 11:
44656 case 12:
44657 case 40:
44658 case 41:
44659 case 88:
44660 case 89:
44661 case 90:
44662 case 91:
44663 case 92:
44664 case 96:
44665 case 97:
44666 case 99:
44667 case 100:
44668 case 118:
44669 case 119:
44670 case 413:
44671 case 414:
44672 case 455:
44673 case 456:
44674 case 457:
44675 case 458:
44676 case 459:
44677 case 511:
44678 case 512:
44679 case 514:
44680 case 515:
44681 case 622:
44682 case 623:
44683 if (!Main.npc[(int)ai[1]].active || Main.npc[(int)ai[1]].aiStyle != aiStyle)
44684 {
44685 life = 0;
44686 HitEffect();
44687 checkDead();
44688 active = false;
44689 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44690 return;
44691 }
44692 break;
44693 }
44694 switch (type)
44695 {
44696 case 7:
44697 case 8:
44698 case 10:
44699 case 11:
44700 case 39:
44701 case 40:
44702 case 87:
44703 case 88:
44704 case 89:
44705 case 90:
44706 case 91:
44707 case 95:
44708 case 96:
44709 case 98:
44710 case 99:
44711 case 117:
44712 case 118:
44713 case 412:
44714 case 413:
44715 case 454:
44716 case 455:
44717 case 456:
44718 case 457:
44719 case 458:
44720 case 510:
44721 case 511:
44722 case 513:
44723 case 514:
44724 case 621:
44725 case 622:
44726 if (!Main.npc[(int)ai[0]].active || Main.npc[(int)ai[0]].aiStyle != aiStyle)
44727 {
44728 life = 0;
44729 HitEffect();
44730 checkDead();
44731 active = false;
44732 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44733 return;
44734 }
44735 break;
44736 }
44737 if (type == 13 || type == 14 || type == 15)
44738 {
44739 if (!Main.npc[(int)ai[1]].active && !Main.npc[(int)ai[0]].active)
44740 {
44741 life = 0;
44742 HitEffect();
44743 checkDead();
44744 active = false;
44745 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44746 return;
44747 }
44748 if (type == 13 && !Main.npc[(int)ai[0]].active)
44749 {
44750 life = 0;
44751 HitEffect();
44752 checkDead();
44753 active = false;
44754 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44755 return;
44756 }
44757 if (type == 15 && !Main.npc[(int)ai[1]].active)
44758 {
44759 life = 0;
44760 HitEffect();
44761 checkDead();
44762 active = false;
44763 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44764 return;
44765 }
44766 if (type == 14 && (!Main.npc[(int)ai[1]].active || Main.npc[(int)ai[1]].aiStyle != aiStyle))
44767 {
44768 type = 13;
44769 int num38 = whoAmI;
44770 float num39 = (float)life / (float)lifeMax;
44771 float num40 = ai[0];
44773 life = (int)((float)lifeMax * num39);
44774 ai[0] = num40;
44775 TargetClosest();
44776 netUpdate = true;
44777 whoAmI = num38;
44778 alpha = 0;
44779 }
44780 if (type == 14 && (!Main.npc[(int)ai[0]].active || Main.npc[(int)ai[0]].aiStyle != aiStyle))
44781 {
44782 type = 15;
44783 int num41 = whoAmI;
44784 float num42 = (float)life / (float)lifeMax;
44785 float num43 = ai[1];
44787 life = (int)((float)lifeMax * num42);
44788 ai[1] = num43;
44789 TargetClosest();
44790 netUpdate = true;
44791 whoAmI = num41;
44792 alpha = 0;
44793 }
44794 }
44795 if (!active && Main.netMode == 2)
44796 {
44797 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44798 }
44799 }
44800 int num44 = (int)(position.X / 16f) - 1;
44801 int num45 = (int)((position.X + (float)width) / 16f) + 2;
44802 int num46 = (int)(position.Y / 16f) - 1;
44803 int num47 = (int)((position.Y + (float)height) / 16f) + 2;
44804 if (num44 < 0)
44805 {
44806 num44 = 0;
44807 }
44808 if (num45 > Main.maxTilesX)
44809 {
44810 num45 = Main.maxTilesX;
44811 }
44812 if (num46 < 0)
44813 {
44814 num46 = 0;
44815 }
44816 if (num47 > Main.maxTilesY)
44817 {
44818 num47 = Main.maxTilesY;
44819 }
44820 bool flag2 = false;
44821 if (type >= 87 && type <= 92)
44822 {
44823 flag2 = true;
44824 }
44825 if (type >= 454 && type <= 459)
44826 {
44827 flag2 = true;
44828 }
44829 if (type >= 621 && type <= 623)
44830 {
44831 flag2 = true;
44832 }
44833 if (type >= 412 && type <= 414)
44834 {
44835 flag2 = true;
44836 }
44837 if (type == 402)
44838 {
44839 flag2 = true;
44840 }
44841 if (!flag2)
44842 {
44843 Vector2 vector2 = default(Vector2);
44844 for (int num48 = num44; num48 < num45; num48++)
44845 {
44846 for (int num49 = num46; num49 < num47; num49++)
44847 {
44848 if (Main.tile[num48, num49] == null || ((!Main.tile[num48, num49].nactive() || (!Main.tileSolid[Main.tile[num48, num49].type] && (!Main.tileSolidTop[Main.tile[num48, num49].type] || Main.tile[num48, num49].frameY != 0))) && Main.tile[num48, num49].liquid <= 64))
44849 {
44850 continue;
44851 }
44852 vector2.X = num48 * 16;
44853 vector2.Y = num49 * 16;
44854 if (position.X + (float)width > vector2.X && position.X < vector2.X + 16f && position.Y + (float)height > vector2.Y && position.Y < vector2.Y + 16f)
44855 {
44856 flag2 = true;
44857 if (Main.rand.Next(100) == 0 && type != 117 && Main.tile[num48, num49].nactive() && Main.tileSolid[Main.tile[num48, num49].type])
44858 {
44859 WorldGen.KillTile(num48, num49, fail: true, effectOnly: true);
44860 }
44861 }
44862 }
44863 }
44864 }
44865 if (!flag2 && (type == 7 || type == 10 || type == 13 || type == 39 || type == 95 || type == 98 || type == 117 || type == 375 || type == 454 || type == 510 || type == 513 || type == 621))
44866 {
44868 int num50 = 1000;
44869 bool flag3 = true;
44870 for (int num51 = 0; num51 < 255; num51++)
44871 {
44872 if (Main.player[num51].active)
44873 {
44874 Rectangle rectangle2 = new Rectangle((int)Main.player[num51].position.X - num50, (int)Main.player[num51].position.Y - num50, num50 * 2, num50 * 2);
44875 if (rectangle.Intersects(rectangle2))
44876 {
44877 flag3 = false;
44878 break;
44879 }
44880 }
44881 }
44882 if (flag3)
44883 {
44884 flag2 = true;
44885 }
44886 }
44887 if ((type >= 87 && type <= 92) || (type >= 454 && type <= 459) || (type >= 621 && type <= 623))
44888 {
44889 if (velocity.X < 0f)
44890 {
44891 spriteDirection = 1;
44892 }
44893 else if (velocity.X > 0f)
44894 {
44895 spriteDirection = -1;
44896 }
44897 }
44898 if (type == 414)
44899 {
44900 if (justHit)
44901 {
44902 localAI[3] = 3f;
44903 }
44904 if (localAI[2] > 0f)
44905 {
44906 localAI[2] -= 16f;
44907 if (localAI[2] == 0f)
44908 {
44909 localAI[2] = -128f;
44910 }
44911 }
44912 else if (localAI[2] < 0f)
44913 {
44914 localAI[2] += 16f;
44915 }
44916 else if (localAI[3] > 0f)
44917 {
44918 localAI[2] = 128f;
44919 localAI[3] -= 1f;
44920 }
44921 }
44922 if (type == 412)
44923 {
44925 Vector2 vector3 = base.Center + (rotation - (float)Math.PI / 2f).ToRotationVector2() * 8f;
44926 Vector2 vector4 = rotation.ToRotationVector2() * 16f;
44927 Dust obj = Main.dust[Dust.NewDust(vector3 + vector4, 0, 0, 6, velocity.X, velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)];
44928 obj.noGravity = true;
44929 obj.noLight = true;
44930 obj.position -= new Vector2(4f);
44931 obj.fadeIn = 1f;
44932 obj.velocity = Vector2.Zero;
44933 Dust obj2 = Main.dust[Dust.NewDust(vector3 - vector4, 0, 0, 6, velocity.X, velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)];
44934 obj2.noGravity = true;
44935 obj2.noLight = true;
44936 obj2.position -= new Vector2(4f);
44937 obj2.fadeIn = 1f;
44938 obj2.velocity = Vector2.Zero;
44940 }
44941 float num52 = 8f;
44942 float num53 = 0.07f;
44943 if (type == 95)
44944 {
44945 num52 = 5.5f;
44946 num53 = 0.045f;
44947 }
44948 if (type == 10)
44949 {
44950 num52 = 6f;
44951 num53 = 0.05f;
44952 }
44953 if (type == 513)
44954 {
44955 num52 = 7f;
44956 num53 = 0.1f;
44957 }
44958 if (type == 7)
44959 {
44960 num52 = 9f;
44961 num53 = 0.1f;
44962 }
44963 if (type == 13)
44964 {
44965 num52 = 10f;
44966 num53 = 0.07f;
44967 if (Main.expertMode)
44968 {
44969 num52 = 12f;
44970 num53 = 0.15f;
44971 }
44972 if (Main.getGoodWorld)
44973 {
44974 num52 += 4f;
44975 num53 += 0.05f;
44976 }
44977 }
44978 if (type == 510)
44979 {
44980 if (!Main.player[target].dead && Main.player[target].ZoneSandstorm)
44981 {
44982 num52 = 16f;
44983 num53 = 0.35f;
44984 }
44985 else
44986 {
44987 num52 = 10f;
44988 num53 = 0.25f;
44989 }
44990 }
44991 if (type == 87)
44992 {
44993 num52 = 11f;
44994 num53 = 0.25f;
44995 }
44996 if (type == 621)
44997 {
44998 num52 = 15f;
44999 num53 = 0.45f;
45000 }
45001 if (type == 375)
45002 {
45003 num52 = 6f;
45004 num53 = 0.15f;
45005 }
45006 if (type == 454)
45007 {
45008 num52 = 20f;
45009 num53 = 0.55f;
45010 }
45011 if (type == 402)
45012 {
45013 num52 = 9f;
45014 num53 = 0.3f;
45015 }
45016 if (type == 117 && Main.wofNPCIndex >= 0)
45017 {
45018 float num54 = (float)Main.npc[Main.wofNPCIndex].life / (float)Main.npc[Main.wofNPCIndex].lifeMax;
45019 if ((double)num54 < 0.5)
45020 {
45021 num52 += 1f;
45022 num53 += 0.1f;
45023 }
45024 if ((double)num54 < 0.25)
45025 {
45026 num52 += 1f;
45027 num53 += 0.1f;
45028 }
45029 if ((double)num54 < 0.1)
45030 {
45031 num52 += 2f;
45032 num53 += 0.1f;
45033 }
45034 }
45035 if (type == 39)
45036 {
45037 num52 = 9f;
45038 num53 = 0.1f;
45039 if (Main.getGoodWorld)
45040 {
45041 num52 = 10f;
45042 num53 = 0.12f;
45043 }
45044 }
45045 Vector2 vector5 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
45046 float num55 = Main.player[target].position.X + (float)(Main.player[target].width / 2);
45047 float num56 = Main.player[target].position.Y + (float)(Main.player[target].height / 2);
45048 if (type == 412)
45049 {
45050 num52 = 10f;
45051 num53 = 0.3f;
45052 int num57 = -1;
45053 int num58 = (int)(Main.player[target].Center.X / 16f);
45054 int num59 = (int)(Main.player[target].Center.Y / 16f);
45055 for (int num60 = num58 - 2; num60 <= num58 + 2; num60++)
45056 {
45057 for (int num61 = num59; num61 <= num59 + 15; num61++)
45058 {
45059 if (WorldGen.SolidTile2(num60, num61))
45060 {
45061 num57 = num61;
45062 break;
45063 }
45064 }
45065 if (num57 > 0)
45066 {
45067 break;
45068 }
45069 }
45070 if (num57 > 0)
45071 {
45072 num57 *= 16;
45073 float num62 = num57 - 800;
45074 if (Main.player[target].position.Y > num62)
45075 {
45076 num56 = num62;
45077 if (Math.Abs(base.Center.X - Main.player[target].Center.X) < 500f)
45078 {
45079 num55 = ((!(velocity.X > 0f)) ? (Main.player[target].Center.X - 600f) : (Main.player[target].Center.X + 600f));
45080 }
45081 }
45082 }
45083 else
45084 {
45085 num52 = 14f;
45086 num53 = 0.5f;
45087 }
45088 float num63 = num52 * 1.3f;
45089 float num64 = num52 * 0.7f;
45090 float num65 = velocity.Length();
45091 if (num65 > 0f)
45092 {
45093 if (num65 > num63)
45094 {
45096 velocity *= num63;
45097 }
45098 else if (num65 < num64)
45099 {
45101 velocity *= num64;
45102 }
45103 }
45104 if (num57 > 0)
45105 {
45106 for (int num66 = 0; num66 < 200; num66++)
45107 {
45108 if (Main.npc[num66].active && Main.npc[num66].type == type && num66 != whoAmI)
45109 {
45110 Vector2 vector6 = Main.npc[num66].Center - base.Center;
45111 if (vector6.Length() < 400f)
45112 {
45113 vector6.Normalize();
45114 vector6 *= 1000f;
45115 num55 -= vector6.X;
45116 num56 -= vector6.Y;
45117 }
45118 }
45119 }
45120 }
45121 else
45122 {
45123 for (int num67 = 0; num67 < 200; num67++)
45124 {
45125 if (Main.npc[num67].active && Main.npc[num67].type == type && num67 != whoAmI)
45126 {
45127 Vector2 vector7 = Main.npc[num67].Center - base.Center;
45128 if (vector7.Length() < 60f)
45129 {
45130 vector7.Normalize();
45131 vector7 *= 200f;
45132 num55 -= vector7.X;
45133 num56 -= vector7.Y;
45134 }
45135 }
45136 }
45137 }
45138 }
45139 num55 = (int)(num55 / 16f) * 16;
45140 num56 = (int)(num56 / 16f) * 16;
45141 vector5.X = (int)(vector5.X / 16f) * 16;
45142 vector5.Y = (int)(vector5.Y / 16f) * 16;
45143 num55 -= vector5.X;
45144 num56 -= vector5.Y;
45145 if (type == 375)
45146 {
45147 num55 *= -1f;
45148 num56 *= -1f;
45149 }
45150 float num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56);
45151 if (ai[1] > 0f && ai[1] < (float)Main.npc.Length)
45152 {
45153 try
45154 {
45155 vector5 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
45156 num55 = Main.npc[(int)ai[1]].position.X + (float)(Main.npc[(int)ai[1]].width / 2) - vector5.X;
45157 num56 = Main.npc[(int)ai[1]].position.Y + (float)(Main.npc[(int)ai[1]].height / 2) - vector5.Y;
45158 }
45159 catch
45160 {
45161 }
45162 rotation = (float)Math.Atan2(num56, num55) + 1.57f;
45163 num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56);
45164 int num69 = width;
45165 if (type >= 87 && type <= 92)
45166 {
45167 num69 = 42;
45168 }
45169 if (type >= 454 && type <= 459)
45170 {
45171 num69 = 36;
45172 }
45173 if (type >= 13 && type <= 15)
45174 {
45175 num69 = (int)((float)num69 * scale);
45176 }
45177 if (type >= 513 && type <= 515)
45178 {
45179 num69 -= 6;
45180 }
45181 if (type >= 412 && type <= 414)
45182 {
45183 num69 += 6;
45184 }
45185 if (type >= 621 && type <= 623)
45186 {
45187 num69 = 24;
45188 }
45189 if (Main.getGoodWorld && type >= 13 && type <= 15)
45190 {
45191 num69 = 62;
45192 }
45193 num68 = (num68 - (float)num69) / num68;
45194 num55 *= num68;
45195 num56 *= num68;
45197 position.X += num55;
45198 position.Y += num56;
45199 if (type >= 87 && type <= 92)
45200 {
45201 if (num55 < 0f)
45202 {
45203 spriteDirection = 1;
45204 }
45205 else if (num55 > 0f)
45206 {
45207 spriteDirection = -1;
45208 }
45209 }
45210 if (type >= 454 && type <= 459)
45211 {
45212 if (num55 < 0f)
45213 {
45214 spriteDirection = 1;
45215 }
45216 else if (num55 > 0f)
45217 {
45218 spriteDirection = -1;
45219 }
45220 }
45221 if (type >= 621 && type <= 623)
45222 {
45223 if (num55 < 0f)
45224 {
45225 spriteDirection = 1;
45226 }
45227 else if (num55 > 0f)
45228 {
45229 spriteDirection = -1;
45230 }
45231 }
45232 }
45233 else
45234 {
45235 if (!flag2)
45236 {
45237 TargetClosest();
45238 if (type == 39 && velocity.Y < 0f)
45239 {
45240 velocity.Y += 0.08f;
45241 }
45242 else
45243 {
45244 velocity.Y += 0.11f;
45245 }
45246 if (velocity.Y > num52)
45247 {
45248 velocity.Y = num52;
45249 }
45250 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num52 * 0.4)
45251 {
45252 if (velocity.X < 0f)
45253 {
45254 velocity.X -= num53 * 1.1f;
45255 }
45256 else
45257 {
45258 velocity.X += num53 * 1.1f;
45259 }
45260 }
45261 else if (velocity.Y == num52)
45262 {
45263 if (velocity.X < num55)
45264 {
45265 velocity.X += num53;
45266 }
45267 else if (velocity.X > num55)
45268 {
45269 velocity.X -= num53;
45270 }
45271 }
45272 else if (velocity.Y > 4f)
45273 {
45274 if (velocity.X < 0f)
45275 {
45276 velocity.X += num53 * 0.9f;
45277 }
45278 else
45279 {
45280 velocity.X -= num53 * 0.9f;
45281 }
45282 }
45283 }
45284 else
45285 {
45286 if (type != 621 && type != 87 && type != 117 && type != 454 && type != 412 && soundDelay == 0)
45287 {
45288 float num70 = num68 / 40f;
45289 if (num70 < 10f)
45290 {
45291 num70 = 10f;
45292 }
45293 if (num70 > 20f)
45294 {
45295 num70 = 20f;
45296 }
45297 soundDelay = (int)num70;
45298 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y);
45299 }
45300 num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56);
45301 float num71 = Math.Abs(num55);
45302 float num72 = Math.Abs(num56);
45303 float num73 = num52 / num68;
45304 num55 *= num73;
45305 num56 *= num73;
45306 bool flag4 = false;
45307 if ((type == 7 || type == 13) && ((!Main.player[target].ZoneCorrupt && !Main.player[target].ZoneCrimson) || Main.player[target].dead))
45308 {
45309 flag4 = true;
45310 }
45311 if ((type == 513 && (double)Main.player[target].position.Y < Main.worldSurface * 16.0 && !Main.player[target].ZoneSandstorm && !Main.player[target].ZoneUndergroundDesert) || Main.player[target].dead)
45312 {
45313 flag4 = true;
45314 }
45315 if ((type == 510 && (double)Main.player[target].position.Y < Main.worldSurface * 16.0 && !Main.player[target].ZoneSandstorm && !Main.player[target].ZoneUndergroundDesert) || Main.player[target].dead)
45316 {
45317 flag4 = true;
45318 }
45319 if (flag4)
45320 {
45321 bool flag5 = true;
45322 for (int num74 = 0; num74 < 255; num74++)
45323 {
45324 if (Main.player[num74].active && !Main.player[num74].dead && Main.player[num74].ZoneCorrupt)
45325 {
45326 flag5 = false;
45327 }
45328 }
45329 if (flag5)
45330 {
45331 if (Main.netMode != 1 && (double)(position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0)
45332 {
45333 active = false;
45334 int num75 = (int)ai[0];
45335 while (num75 > 0 && num75 < 200 && Main.npc[num75].active && Main.npc[num75].aiStyle == aiStyle)
45336 {
45337 int num76 = (int)Main.npc[num75].ai[0];
45338 Main.npc[num75].active = false;
45339 life = 0;
45340 if (Main.netMode == 2)
45341 {
45342 NetMessage.SendData(23, -1, -1, null, num75);
45343 }
45344 num75 = num76;
45345 }
45346 if (Main.netMode == 2)
45347 {
45348 NetMessage.SendData(23, -1, -1, null, whoAmI);
45349 }
45350 }
45351 num55 = 0f;
45352 num56 = num52;
45353 }
45354 }
45355 bool flag6 = false;
45356 if (type == 87)
45357 {
45358 if (((velocity.X > 0f && num55 < 0f) || (velocity.X < 0f && num55 > 0f) || (velocity.Y > 0f && num56 < 0f) || (velocity.Y < 0f && num56 > 0f)) && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > num53 / 2f && num68 < 300f)
45359 {
45360 flag6 = true;
45361 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < num52)
45362 {
45363 velocity *= 1.1f;
45364 }
45365 }
45366 if (position.Y > Main.player[target].position.Y || (double)(Main.player[target].position.Y / 16f) > Main.worldSurface || Main.player[target].dead)
45367 {
45368 flag6 = true;
45369 if (Math.Abs(velocity.X) < num52 / 2f)
45370 {
45371 if (velocity.X == 0f)
45372 {
45373 velocity.X -= direction;
45374 }
45375 velocity.X *= 1.1f;
45376 }
45377 else if (velocity.Y > 0f - num52)
45378 {
45379 velocity.Y -= num53;
45380 }
45381 }
45382 }
45383 if (type == 454 || type == 621)
45384 {
45385 float num77 = 300f;
45386 if (type == 621)
45387 {
45388 num77 = 120f;
45389 }
45390 if (((velocity.X > 0f && num55 < 0f) || (velocity.X < 0f && num55 > 0f) || (velocity.Y > 0f && num56 < 0f) || (velocity.Y < 0f && num56 > 0f)) && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > num53 / 2f && num68 < num77)
45391 {
45392 flag6 = true;
45393 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < num52)
45394 {
45395 velocity *= 1.1f;
45396 }
45397 }
45398 if (position.Y > Main.player[target].position.Y || Main.player[target].dead)
45399 {
45400 flag6 = true;
45401 if (Math.Abs(velocity.X) < num52 / 2f)
45402 {
45403 if (velocity.X == 0f)
45404 {
45405 velocity.X -= direction;
45406 }
45407 velocity.X *= 1.1f;
45408 }
45409 else if (velocity.Y > 0f - num52)
45410 {
45411 velocity.Y -= num53;
45412 }
45413 }
45414 }
45415 if (!flag6)
45416 {
45417 if ((velocity.X > 0f && num55 > 0f) || (velocity.X < 0f && num55 < 0f) || (velocity.Y > 0f && num56 > 0f) || (velocity.Y < 0f && num56 < 0f))
45418 {
45419 if (velocity.X < num55)
45420 {
45421 velocity.X += num53;
45422 }
45423 else if (velocity.X > num55)
45424 {
45425 velocity.X -= num53;
45426 }
45427 if (velocity.Y < num56)
45428 {
45429 velocity.Y += num53;
45430 }
45431 else if (velocity.Y > num56)
45432 {
45433 velocity.Y -= num53;
45434 }
45435 if ((double)Math.Abs(num56) < (double)num52 * 0.2 && ((velocity.X > 0f && num55 < 0f) || (velocity.X < 0f && num55 > 0f)))
45436 {
45437 if (velocity.Y > 0f)
45438 {
45439 velocity.Y += num53 * 2f;
45440 }
45441 else
45442 {
45443 velocity.Y -= num53 * 2f;
45444 }
45445 }
45446 if ((double)Math.Abs(num55) < (double)num52 * 0.2 && ((velocity.Y > 0f && num56 < 0f) || (velocity.Y < 0f && num56 > 0f)))
45447 {
45448 if (velocity.X > 0f)
45449 {
45450 velocity.X += num53 * 2f;
45451 }
45452 else
45453 {
45454 velocity.X -= num53 * 2f;
45455 }
45456 }
45457 }
45458 else if (num71 > num72)
45459 {
45460 if (velocity.X < num55)
45461 {
45462 velocity.X += num53 * 1.1f;
45463 }
45464 else if (velocity.X > num55)
45465 {
45466 velocity.X -= num53 * 1.1f;
45467 }
45468 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num52 * 0.5)
45469 {
45470 if (velocity.Y > 0f)
45471 {
45472 velocity.Y += num53;
45473 }
45474 else
45475 {
45476 velocity.Y -= num53;
45477 }
45478 }
45479 }
45480 else
45481 {
45482 if (velocity.Y < num56)
45483 {
45484 velocity.Y += num53 * 1.1f;
45485 }
45486 else if (velocity.Y > num56)
45487 {
45488 velocity.Y -= num53 * 1.1f;
45489 }
45490 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num52 * 0.5)
45491 {
45492 if (velocity.X > 0f)
45493 {
45494 velocity.X += num53;
45495 }
45496 else
45497 {
45498 velocity.X -= num53;
45499 }
45500 }
45501 }
45502 }
45503 }
45504 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
45505 if (type == 7 || type == 10 || type == 13 || type == 39 || type == 95 || type == 98 || type == 117 || type == 510 || type == 513 || type == 621)
45506 {
45507 if (flag2)
45508 {
45509 if (localAI[0] != 1f)
45510 {
45511 netUpdate = true;
45512 }
45513 localAI[0] = 1f;
45514 }
45515 else
45516 {
45517 if (localAI[0] != 0f)
45518 {
45519 netUpdate = true;
45520 }
45521 localAI[0] = 0f;
45522 }
45523 if (((velocity.X > 0f && oldVelocity.X < 0f) || (velocity.X < 0f && oldVelocity.X > 0f) || (velocity.Y > 0f && oldVelocity.Y < 0f) || (velocity.Y < 0f && oldVelocity.Y > 0f)) && !justHit)
45524 {
45525 netUpdate = true;
45526 }
45527 }
45528 if (type == 454)
45529 {
45530 float num78 = Vector2.Distance(Main.player[target].Center, base.Center);
45531 int num79 = 0;
45532 if (Vector2.Normalize(Main.player[target].Center - base.Center).ToRotation().AngleTowards(velocity.ToRotation(), (float)Math.PI / 2f) == velocity.ToRotation() && num78 < 350f)
45533 {
45534 num79 = 4;
45535 }
45536 if ((double)num79 > frameCounter)
45537 {
45538 frameCounter += 1.0;
45539 }
45540 if ((double)num79 < frameCounter)
45541 {
45542 frameCounter -= 1.0;
45543 }
45544 if (frameCounter < 0.0)
45545 {
45546 frameCounter = 0.0;
45547 }
45548 if (frameCounter > 4.0)
45549 {
45550 frameCounter = 4.0;
45551 }
45552 }
45553 }
45554 if (type < 13 || type > 15 || (type != 13 && (type == 13 || Main.npc[(int)ai[1]].alpha >= 85)))
45555 {
45556 return;
45557 }
45558 if (alpha > 0 && life > 0)
45559 {
45560 for (int num80 = 0; num80 < 2; num80++)
45561 {
45562 int num81 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14, 0f, 0f, 100, default(Color), 2f);
45563 Main.dust[num81].noGravity = true;
45564 Main.dust[num81].noLight = true;
45565 }
45566 }
45567 if ((position - oldPosition).Length() > 2f)
45568 {
45569 alpha -= 42;
45570 if (alpha < 0)
45571 {
45572 alpha = 0;
45573 }
45574 }
45575 }
static double Atan2(double y, double x)
static double Sqrt(double d)
static double Abs(double value)
const double PI
Definition Math.cs:16
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 oldPosition
Definition Entity.cs:18
Vector2 Center
Definition Entity.cs:43
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
Vector2 oldVelocity
Definition Entity.cs:20
static readonly LegacySoundStyle Item119
Definition SoundID.cs:652
static readonly LegacySoundStyle NPCDeath13
Definition SoundID.cs:306
Vector2 netOffset
Definition NPC.cs:103
void SpawnStardustMark_StardustWorm()
Definition NPC.cs:37033
float[] localAI
Definition NPC.cs:449
int spriteDirection
Definition NPC.cs:517
void EncourageDespawn(int despawnTime)
Definition NPC.cs:1390
int lifeMax
Definition NPC.cs:479
void TargetClosest(bool faceTarget=true)
Definition NPC.cs:69934
int aiStyle
Definition NPC.cs:453
static int GetEaterOfWorldsSegmentsCount()
Definition NPC.cs:44171
float[] ai
Definition NPC.cs:447
bool dontTakeDamage
Definition NPC.cs:527
void SetDefaultsKeepPlayerInteraction(int Type)
Definition NPC.cs:2488
float scale
Definition NPC.cs:493
void CopyInteractions(NPC npc)
Definition NPC.cs:44162
int type
Definition NPC.cs:445
int alpha
Definition NPC.cs:489
float rotation
Definition NPC.cs:501
double frameCounter
Definition NPC.cs:483
IEntitySource GetSpawnSourceForNPCFromNPCAI()
Definition NPC.cs:87546
static int NewNPC(IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255)
Definition NPC.cs:77654
void checkDead()
Definition NPC.cs:70326
void HitEffect(int hitDirection=0, double dmg=10.0)
Definition NPC.cs:78386
bool justHit
Definition NPC.cs:455
int life
Definition NPC.cs:477
int soundDelay
Definition NPC.cs:437
int realLife
Definition NPC.cs:173
bool netUpdate
Definition NPC.cs:507
int target
Definition NPC.cs:459
static Color Transparent
Definition Color.cs:76
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91

References System.Math.Abs(), Terraria.Entity.active, Terraria.NPC.ai, Terraria.NPC.aiStyle, Terraria.NPC.alpha, System.Math.Atan2(), Terraria.Collision.CanHitLine(), Terraria.NPC.checkDead(), Terraria.NPC.CopyInteractions(), Terraria.Main.dayTime, Terraria.Entity.direction, Microsoft.Xna.Framework.Vector2.Distance(), Terraria.NPC.dontTakeDamage, Terraria.Main.dust, Terraria.NPC.EncourageDespawn(), Terraria.Main.expertMode, Terraria.NPC.frameCounter, Terraria.NPC.GetEaterOfWorldsSegmentsCount(), Terraria.Main.getGoodWorld, Terraria.NPC.GetSpawnSourceForNPCFromNPCAI(), Terraria.Entity.height, Terraria.NPC.HitEffect(), Terraria.WorldGen.InWorld(), Terraria.ID.SoundID.Item119, Terraria.NPC.justHit, Terraria.WorldGen.KillTile(), Microsoft.Xna.Framework.Vector2.Length(), Terraria.NPC.life, Terraria.NPC.lifeMax, Terraria.NPC.localAI, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.netMode, Terraria.NPC.netOffset, Terraria.NPC.netUpdate, Terraria.Dust.NewDust(), Terraria.NPC.NewNPC(), Microsoft.Xna.Framework.Vector2.Normalize(), Terraria.Main.npc, Terraria.ID.SoundID.NPCDeath13, System.obj, Terraria.Entity.oldPosition, Terraria.Entity.oldVelocity, System.Math.PI, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Main.rand, Terraria.NPC.realLife, Terraria.Utils.Remap(), Terraria.Main.remixWorld, Terraria.Main.rockLayer, Terraria.NPC.rotation, Terraria.NPC.scale, Terraria.NetMessage.SendData(), Terraria.NPC.SetDefaultsKeepPlayerInteraction(), Terraria.WorldGen.SolidTile2(), Terraria.NPC.soundDelay, Terraria.NPC.SpawnStardustMark_StardustWorm(), Terraria.NPC.spriteDirection, System.Math.Sqrt(), Terraria.NPC.target, Terraria.NPC.TargetClosest(), Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, Microsoft.Xna.Framework.Color.Transparent, Terraria.NPC.type, Microsoft.Xna.Framework.Graphics.Vector2, Terraria.Entity.velocity, Terraria.Entity.whoAmI, Terraria.Entity.width, Terraria.Main.wofNPCIndex, Terraria.Main.worldSurface, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.NPC.AI().