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

◆ AI_001_Slimes()

void Terraria.NPC.AI_001_Slimes ( )
inlineprivate

Definition at line 64728 of file NPC.cs.

64729 {
64730 //IL_0068: Unknown result type (might be due to invalid IL or missing references)
64731 //IL_007a: Unknown result type (might be due to invalid IL or missing references)
64732 //IL_00b7: Unknown result type (might be due to invalid IL or missing references)
64733 //IL_00ce: Unknown result type (might be due to invalid IL or missing references)
64734 //IL_00d3: Unknown result type (might be due to invalid IL or missing references)
64735 //IL_00f1: Unknown result type (might be due to invalid IL or missing references)
64736 //IL_010c: Unknown result type (might be due to invalid IL or missing references)
64737 //IL_0111: Unknown result type (might be due to invalid IL or missing references)
64738 //IL_013c: Unknown result type (might be due to invalid IL or missing references)
64739 //IL_014a: Unknown result type (might be due to invalid IL or missing references)
64740 //IL_0150: Unknown result type (might be due to invalid IL or missing references)
64741 //IL_038e: Unknown result type (might be due to invalid IL or missing references)
64742 //IL_0394: Unknown result type (might be due to invalid IL or missing references)
64743 //IL_0399: Unknown result type (might be due to invalid IL or missing references)
64744 //IL_039e: Unknown result type (might be due to invalid IL or missing references)
64745 //IL_03a4: Unknown result type (might be due to invalid IL or missing references)
64746 //IL_03c8: Unknown result type (might be due to invalid IL or missing references)
64747 //IL_03e2: Unknown result type (might be due to invalid IL or missing references)
64748 //IL_03ec: Unknown result type (might be due to invalid IL or missing references)
64749 //IL_03f1: Unknown result type (might be due to invalid IL or missing references)
64750 //IL_03f8: Unknown result type (might be due to invalid IL or missing references)
64751 //IL_03fe: Unknown result type (might be due to invalid IL or missing references)
64752 //IL_0403: Unknown result type (might be due to invalid IL or missing references)
64753 //IL_0408: Unknown result type (might be due to invalid IL or missing references)
64754 //IL_0448: Unknown result type (might be due to invalid IL or missing references)
64755 //IL_0459: Unknown result type (might be due to invalid IL or missing references)
64756 //IL_059c: Unknown result type (might be due to invalid IL or missing references)
64757 //IL_05ae: Unknown result type (might be due to invalid IL or missing references)
64758 //IL_04e8: Unknown result type (might be due to invalid IL or missing references)
64759 //IL_04ee: Unknown result type (might be due to invalid IL or missing references)
64760 //IL_04f3: Unknown result type (might be due to invalid IL or missing references)
64761 //IL_04f8: Unknown result type (might be due to invalid IL or missing references)
64762 //IL_04fe: Unknown result type (might be due to invalid IL or missing references)
64763 //IL_051e: Unknown result type (might be due to invalid IL or missing references)
64764 //IL_0524: Unknown result type (might be due to invalid IL or missing references)
64765 //IL_0548: Unknown result type (might be due to invalid IL or missing references)
64766 //IL_0552: Unknown result type (might be due to invalid IL or missing references)
64767 //IL_0557: Unknown result type (might be due to invalid IL or missing references)
64768 //IL_055e: Unknown result type (might be due to invalid IL or missing references)
64769 //IL_0564: Unknown result type (might be due to invalid IL or missing references)
64770 //IL_0569: Unknown result type (might be due to invalid IL or missing references)
64771 //IL_056e: Unknown result type (might be due to invalid IL or missing references)
64772 //IL_070a: Unknown result type (might be due to invalid IL or missing references)
64773 //IL_0626: Unknown result type (might be due to invalid IL or missing references)
64774 //IL_0633: Unknown result type (might be due to invalid IL or missing references)
64775 //IL_0638: Unknown result type (might be due to invalid IL or missing references)
64776 //IL_0659: Unknown result type (might be due to invalid IL or missing references)
64777 //IL_065f: Unknown result type (might be due to invalid IL or missing references)
64778 //IL_0664: Unknown result type (might be due to invalid IL or missing references)
64779 //IL_0669: Unknown result type (might be due to invalid IL or missing references)
64780 //IL_0684: Unknown result type (might be due to invalid IL or missing references)
64781 //IL_068a: Unknown result type (might be due to invalid IL or missing references)
64782 //IL_06bc: Unknown result type (might be due to invalid IL or missing references)
64783 //IL_06c6: Unknown result type (might be due to invalid IL or missing references)
64784 //IL_06cb: Unknown result type (might be due to invalid IL or missing references)
64785 //IL_06e4: Unknown result type (might be due to invalid IL or missing references)
64786 //IL_06ea: Unknown result type (might be due to invalid IL or missing references)
64787 //IL_06ef: Unknown result type (might be due to invalid IL or missing references)
64788 //IL_06f4: Unknown result type (might be due to invalid IL or missing references)
64789 //IL_08ae: Unknown result type (might be due to invalid IL or missing references)
64790 //IL_08b4: Unknown result type (might be due to invalid IL or missing references)
64791 //IL_08b9: Unknown result type (might be due to invalid IL or missing references)
64792 //IL_08be: Unknown result type (might be due to invalid IL or missing references)
64793 //IL_08c4: Unknown result type (might be due to invalid IL or missing references)
64794 //IL_08ca: Unknown result type (might be due to invalid IL or missing references)
64795 //IL_08cf: Unknown result type (might be due to invalid IL or missing references)
64796 //IL_08ef: Unknown result type (might be due to invalid IL or missing references)
64797 //IL_08f5: Unknown result type (might be due to invalid IL or missing references)
64798 //IL_0919: Unknown result type (might be due to invalid IL or missing references)
64799 //IL_0923: Unknown result type (might be due to invalid IL or missing references)
64800 //IL_0928: Unknown result type (might be due to invalid IL or missing references)
64801 //IL_092f: Unknown result type (might be due to invalid IL or missing references)
64802 //IL_0935: Unknown result type (might be due to invalid IL or missing references)
64803 //IL_093a: Unknown result type (might be due to invalid IL or missing references)
64804 //IL_093f: Unknown result type (might be due to invalid IL or missing references)
64805 //IL_074b: Unknown result type (might be due to invalid IL or missing references)
64806 //IL_0750: Unknown result type (might be due to invalid IL or missing references)
64807 //IL_0767: Unknown result type (might be due to invalid IL or missing references)
64808 //IL_076d: Unknown result type (might be due to invalid IL or missing references)
64809 //IL_07c7: Unknown result type (might be due to invalid IL or missing references)
64810 //IL_07cc: Unknown result type (might be due to invalid IL or missing references)
64811 //IL_07e2: Unknown result type (might be due to invalid IL or missing references)
64812 //IL_07e8: Unknown result type (might be due to invalid IL or missing references)
64813 //IL_07ed: Unknown result type (might be due to invalid IL or missing references)
64814 //IL_07f2: Unknown result type (might be due to invalid IL or missing references)
64815 //IL_07fa: Unknown result type (might be due to invalid IL or missing references)
64816 //IL_0804: Unknown result type (might be due to invalid IL or missing references)
64817 //IL_0809: Unknown result type (might be due to invalid IL or missing references)
64818 //IL_0877: Unknown result type (might be due to invalid IL or missing references)
64819 //IL_087d: Unknown result type (might be due to invalid IL or missing references)
64820 //IL_0882: Unknown result type (might be due to invalid IL or missing references)
64821 //IL_0887: Unknown result type (might be due to invalid IL or missing references)
64822 //IL_0e3b: Unknown result type (might be due to invalid IL or missing references)
64823 //IL_0e5b: Unknown result type (might be due to invalid IL or missing references)
64824 //IL_09fa: Unknown result type (might be due to invalid IL or missing references)
64825 //IL_0a1a: Unknown result type (might be due to invalid IL or missing references)
64826 //IL_105a: Unknown result type (might be due to invalid IL or missing references)
64827 //IL_1077: Unknown result type (might be due to invalid IL or missing references)
64828 //IL_0e90: Unknown result type (might be due to invalid IL or missing references)
64829 //IL_0ead: Unknown result type (might be due to invalid IL or missing references)
64830 //IL_0c19: Unknown result type (might be due to invalid IL or missing references)
64831 //IL_0c36: Unknown result type (might be due to invalid IL or missing references)
64832 //IL_0a4f: Unknown result type (might be due to invalid IL or missing references)
64833 //IL_0a6c: Unknown result type (might be due to invalid IL or missing references)
64834 //IL_1e5c: Unknown result type (might be due to invalid IL or missing references)
64835 //IL_1e62: Unknown result type (might be due to invalid IL or missing references)
64836 //IL_1e67: Unknown result type (might be due to invalid IL or missing references)
64837 //IL_1e6c: Unknown result type (might be due to invalid IL or missing references)
64838 //IL_1ed3: Unknown result type (might be due to invalid IL or missing references)
64839 //IL_1f0b: Unknown result type (might be due to invalid IL or missing references)
64840 //IL_1f11: Unknown result type (might be due to invalid IL or missing references)
64841 //IL_1f2e: Unknown result type (might be due to invalid IL or missing references)
64842 //IL_1f34: Unknown result type (might be due to invalid IL or missing references)
64843 //IL_1f39: Unknown result type (might be due to invalid IL or missing references)
64844 //IL_1f3e: Unknown result type (might be due to invalid IL or missing references)
64845 //IL_1a19: Unknown result type (might be due to invalid IL or missing references)
64846 //IL_1a39: Unknown result type (might be due to invalid IL or missing references)
64847 //IL_124d: Unknown result type (might be due to invalid IL or missing references)
64848 //IL_1252: Unknown result type (might be due to invalid IL or missing references)
64849 //IL_1255: Unknown result type (might be due to invalid IL or missing references)
64850 //IL_125f: Unknown result type (might be due to invalid IL or missing references)
64851 //IL_1269: Unknown result type (might be due to invalid IL or missing references)
64852 //IL_1273: Unknown result type (might be due to invalid IL or missing references)
64853 //IL_172f: Unknown result type (might be due to invalid IL or missing references)
64854 //IL_1734: Unknown result type (might be due to invalid IL or missing references)
64855 //IL_1737: Unknown result type (might be due to invalid IL or missing references)
64856 //IL_1741: Unknown result type (might be due to invalid IL or missing references)
64857 //IL_174b: Unknown result type (might be due to invalid IL or missing references)
64858 //IL_1755: Unknown result type (might be due to invalid IL or missing references)
64859 //IL_1c6c: Unknown result type (might be due to invalid IL or missing references)
64860 //IL_1c8c: Unknown result type (might be due to invalid IL or missing references)
64861 //IL_1a89: Unknown result type (might be due to invalid IL or missing references)
64862 //IL_1aa9: Unknown result type (might be due to invalid IL or missing references)
64863 //IL_179a: Unknown result type (might be due to invalid IL or missing references)
64864 //IL_17b7: Unknown result type (might be due to invalid IL or missing references)
64865 //IL_14ef: Unknown result type (might be due to invalid IL or missing references)
64866 //IL_150c: Unknown result type (might be due to invalid IL or missing references)
64867 //IL_12d2: Unknown result type (might be due to invalid IL or missing references)
64868 //IL_12ef: Unknown result type (might be due to invalid IL or missing references)
64869 //IL_1123: Unknown result type (might be due to invalid IL or missing references)
64870 //IL_117e: Unknown result type (might be due to invalid IL or missing references)
64871 //IL_1185: Unknown result type (might be due to invalid IL or missing references)
64872 //IL_0ce2: Unknown result type (might be due to invalid IL or missing references)
64873 //IL_0d3d: Unknown result type (might be due to invalid IL or missing references)
64874 //IL_0d44: Unknown result type (might be due to invalid IL or missing references)
64875 //IL_215f: Unknown result type (might be due to invalid IL or missing references)
64876 //IL_0faf: Unknown result type (might be due to invalid IL or missing references)
64877 //IL_0fcc: Unknown result type (might be due to invalid IL or missing references)
64878 //IL_0fd1: Unknown result type (might be due to invalid IL or missing references)
64879 //IL_0feb: Unknown result type (might be due to invalid IL or missing references)
64880 //IL_0ff2: Unknown result type (might be due to invalid IL or missing references)
64881 //IL_0ff9: Unknown result type (might be due to invalid IL or missing references)
64882 //IL_1000: Unknown result type (might be due to invalid IL or missing references)
64883 //IL_0b6e: Unknown result type (might be due to invalid IL or missing references)
64884 //IL_0b8b: Unknown result type (might be due to invalid IL or missing references)
64885 //IL_0b90: Unknown result type (might be due to invalid IL or missing references)
64886 //IL_0baa: Unknown result type (might be due to invalid IL or missing references)
64887 //IL_0bb1: Unknown result type (might be due to invalid IL or missing references)
64888 //IL_0bb8: Unknown result type (might be due to invalid IL or missing references)
64889 //IL_0bbf: Unknown result type (might be due to invalid IL or missing references)
64890 //IL_1d38: Unknown result type (might be due to invalid IL or missing references)
64891 //IL_1d75: Unknown result type (might be due to invalid IL or missing references)
64892 //IL_1dce: Unknown result type (might be due to invalid IL or missing references)
64893 //IL_1dd5: Unknown result type (might be due to invalid IL or missing references)
64894 //IL_1863: Unknown result type (might be due to invalid IL or missing references)
64895 //IL_15bc: Unknown result type (might be due to invalid IL or missing references)
64896 //IL_1bab: Unknown result type (might be due to invalid IL or missing references)
64897 //IL_1bc8: Unknown result type (might be due to invalid IL or missing references)
64898 //IL_1bcd: Unknown result type (might be due to invalid IL or missing references)
64899 //IL_1be7: Unknown result type (might be due to invalid IL or missing references)
64900 //IL_1bee: Unknown result type (might be due to invalid IL or missing references)
64901 //IL_1bf5: Unknown result type (might be due to invalid IL or missing references)
64902 //IL_1bfc: Unknown result type (might be due to invalid IL or missing references)
64903 //IL_2822: Unknown result type (might be due to invalid IL or missing references)
64904 //IL_1660: Unknown result type (might be due to invalid IL or missing references)
64905 //IL_1667: Unknown result type (might be due to invalid IL or missing references)
64906 //IL_191b: Unknown result type (might be due to invalid IL or missing references)
64907 //IL_1922: Unknown result type (might be due to invalid IL or missing references)
64908 //IL_13f1: Unknown result type (might be due to invalid IL or missing references)
64909 //IL_140e: Unknown result type (might be due to invalid IL or missing references)
64910 //IL_1413: Unknown result type (might be due to invalid IL or missing references)
64911 //IL_141e: Unknown result type (might be due to invalid IL or missing references)
64912 //IL_1425: Unknown result type (might be due to invalid IL or missing references)
64913 //IL_142a: Unknown result type (might be due to invalid IL or missing references)
64914 //IL_1462: Unknown result type (might be due to invalid IL or missing references)
64915 //IL_1469: Unknown result type (might be due to invalid IL or missing references)
64916 //IL_1470: Unknown result type (might be due to invalid IL or missing references)
64917 //IL_1477: Unknown result type (might be due to invalid IL or missing references)
64918 //IL_1437: Unknown result type (might be due to invalid IL or missing references)
64919 //IL_143e: Unknown result type (might be due to invalid IL or missing references)
64920 //IL_1443: Unknown result type (might be due to invalid IL or missing references)
64921 //IL_26f8: Unknown result type (might be due to invalid IL or missing references)
64922 //IL_270a: Unknown result type (might be due to invalid IL or missing references)
64923 if (type == 1 && (ai[1] == 1f || ai[1] == 2f || ai[1] == 3f))
64924 {
64925 ai[1] = -1f;
64926 }
64927 if (type == 1 && ai[1] == 75f)
64928 {
64929 float num = 0.3f;
64930 Lighting.AddLight((int)(base.Center.X / 16f), (int)(base.Center.Y / 16f), 0.8f * num, 0.7f * num, 0.1f * num);
64931 if (Main.rand.Next(12) == 0)
64932 {
64933 Dust dust3 = Dust.NewDustPerfect(base.Center + new Vector2(0f, (float)height * 0.2f) + Main.rand.NextVector2CircularEdge(width, (float)height * 0.6f) * (0.3f + Main.rand.NextFloat() * 0.5f), 228, (Vector2?)new Vector2(0f, (0f - Main.rand.NextFloat()) * 0.3f - 1.5f), 127, default(Color), 1f);
64934 dust3.scale = 0.5f;
64935 dust3.fadeIn = 1.1f;
64936 dust3.noGravity = true;
64937 dust3.noLight = true;
64938 }
64939 }
64940 if (type == 1 && ai[1] == 0f && Main.netMode != 1 && value > 0f)
64941 {
64942 ai[1] = -1f;
64943 if (Main.remixWorld && ai[0] != -999f && Main.rand.Next(3) == 0)
64944 {
64945 ai[1] = 75f;
64946 netUpdate = true;
64947 }
64948 else if (Main.rand.Next(20) == 0)
64949 {
64951 ai[1] = num12;
64952 netUpdate = true;
64953 }
64954 }
64955 if (type == 1 && ai[0] == -999f)
64956 {
64957 frame.Y = 0;
64958 frameCounter = 0.0;
64959 rotation = 0f;
64960 return;
64961 }
64962 if (type == 244)
64963 {
64964 float num23 = (float)Main.DiscoR / 255f;
64965 float num29 = (float)Main.DiscoG / 255f;
64966 float num30 = (float)Main.DiscoB / 255f;
64967 num23 *= 1f;
64968 num29 *= 1f;
64969 num30 *= 1f;
64970 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), num23, num29, num30);
64972 }
64973 bool flag = false;
64974 if (!Main.dayTime || life != lifeMax || (double)position.Y > Main.worldSurface * 16.0 || Main.slimeRain)
64975 {
64976 flag = true;
64977 }
64978 if (Main.remixWorld && type == 59 && life == lifeMax)
64979 {
64980 flag = false;
64981 }
64982 if (type == 81)
64983 {
64984 flag = true;
64985 if (Main.rand.Next(30) == 0)
64986 {
64988 int num31 = Dust.NewDust(position, width, height, 14, 0f, 0f, alpha, this.color);
64989 Dust obj = Main.dust[num31];
64990 obj.velocity *= 0.3f;
64992 }
64993 }
64994 if ((type == 377 || type == 446) && target != 255 && !Main.player[target].dead && Vector2.Distance(base.Center, Main.player[target].Center) <= 200f && !wet)
64995 {
64996 flag = true;
64997 }
64998 if (type == 183)
64999 {
65000 flag = true;
65001 }
65002 if (type == 304)
65003 {
65004 flag = true;
65005 }
65006 if (type == 667)
65007 {
65008 flag = true;
65009 }
65010 if (type == 244)
65011 {
65012 flag = true;
65013 ai[0] += 2f;
65014 }
65015 if (type == 147 && Main.rand.Next(10) == 0)
65016 {
65018 int num32 = Dust.NewDust(position, width, height, 76);
65019 Main.dust[num32].noGravity = true;
65020 Dust obj2 = Main.dust[num32];
65021 obj2.velocity *= 0.1f;
65023 }
65024 if (type == 667)
65025 {
65026 Color color = default(Color);
65027 ((Color)(ref color))._002Ector(204, 181, 72, 255);
65028 Lighting.AddLight((int)(base.Center.X / 16f), (int)(base.Center.Y / 16f), (float)(int)((Color)(ref color)).R / 255f * 1.1f, (float)(int)((Color)(ref color)).G / 255f * 1.1f, (float)(int)((Color)(ref color)).B / 255f * 1.1f);
65029 if (((Vector2)(ref velocity)).Length() > 1f || Main.rand.Next(4) != 0)
65030 {
65031 int num33 = 8;
65032 Vector2 val = position + new Vector2((float)(-num33), (float)(-num33));
65033 int num34 = width + num33 * 2;
65034 int num2 = height + num33 * 2;
65036 int num3 = Dust.NewDust(val, num34, num2, 246);
65037 Main.dust[num3].noGravity = true;
65038 Main.dust[num3].noLightEmittence = true;
65039 Dust obj3 = Main.dust[num3];
65040 obj3.velocity *= 0.2f;
65041 Main.dust[num3].scale = 1.5f;
65043 }
65044 }
65045 if (type == 676)
65046 {
65047 Lighting.AddLight(base.Center, 23);
65048 if ((((Vector2)(ref velocity)).Length() > 1f && Main.rand.Next(3) == 0) || Main.rand.Next(5) == 0)
65049 {
65050 Dust dust2 = Dust.NewDustPerfect(Main.rand.NextVector2FromRectangle(base.Hitbox), 306);
65051 dust2.noGravity = true;
65052 dust2.noLightEmittence = true;
65053 dust2.alpha = 127;
65054 dust2.color = Main.hslToRgb(((float)Main.timeForVisualEffects / 300f + Main.rand.NextFloat() * 0.1f) % 1f, 1f, 0.65f);
65055 ((Color)(ref dust2.color)).A = 0;
65056 dust2.velocity = dust2.position - base.Center;
65057 dust2.velocity *= 0.1f;
65058 dust2.velocity.X *= 0.25f;
65059 if (dust2.velocity.Y > 0f)
65060 {
65061 dust2.velocity.Y *= -1f;
65062 }
65063 dust2.scale = Main.rand.NextFloat() * 0.3f + 0.5f;
65064 dust2.fadeIn = 0.9f;
65065 dust2.position += netOffset;
65066 }
65067 }
65068 if (type == 184)
65069 {
65070 if (Main.rand.Next(8) == 0)
65071 {
65073 int num4 = Dust.NewDust(position - velocity, width, height, 76);
65074 Main.dust[num4].noGravity = true;
65075 Dust obj4 = Main.dust[num4];
65076 obj4.velocity *= 0.15f;
65078 }
65079 flag = true;
65080 if (localAI[0] > 0f)
65081 {
65082 localAI[0] -= 1f;
65083 }
65084 if (!wet && !Main.player[target].npcTypeNoAggro[type])
65085 {
65086 Vector2 vector2 = default(Vector2);
65087 ((Vector2)(ref vector2))._002Ector(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
65088 float num5 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector2.X;
65089 float num6 = Main.player[target].position.Y - vector2.Y;
65090 float num7 = (float)Math.Sqrt(num5 * num5 + num6 * num6);
65091 if (Main.expertMode && num7 < 120f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
65092 {
65093 ai[0] = -40f;
65094 if (velocity.Y == 0f)
65095 {
65096 velocity.X *= 0.9f;
65097 }
65098 if (Main.netMode != 1 && localAI[0] == 0f)
65099 {
65100 Vector2 vector3 = default(Vector2);
65101 for (int i = 0; i < 5; i++)
65102 {
65103 ((Vector2)(ref vector3))._002Ector((float)(i - 2), -4f);
65104 vector3.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
65105 vector3.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
65106 ((Vector2)(ref vector3)).Normalize();
65107 vector3 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f;
65109 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector2.X, vector2.Y, vector3.X, vector3.Y, 174, attackDamage_ForProjectiles, 0f, Main.myPlayer);
65110 localAI[0] = 30f;
65111 }
65112 }
65113 }
65114 else if (num7 < 200f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
65115 {
65116 ai[0] = -40f;
65117 if (velocity.Y == 0f)
65118 {
65119 velocity.X *= 0.9f;
65120 }
65121 if (Main.netMode != 1 && localAI[0] == 0f)
65122 {
65123 num6 = Main.player[target].position.Y - vector2.Y - (float)Main.rand.Next(0, 200);
65124 num7 = (float)Math.Sqrt(num5 * num5 + num6 * num6);
65125 num7 = 4.5f / num7;
65126 num5 *= num7;
65127 num6 *= num7;
65128 localAI[0] = 50f;
65129 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector2.X, vector2.Y, num5, num6, 174, 9, 0f, Main.myPlayer);
65130 }
65131 }
65132 }
65133 }
65134 if (type == 535)
65135 {
65136 flag = true;
65137 if (localAI[0] > 0f)
65138 {
65139 localAI[0] -= 1f;
65140 }
65141 if (!wet && !Main.player[target].npcTypeNoAggro[type])
65142 {
65143 Vector2 vector4 = default(Vector2);
65144 ((Vector2)(ref vector4))._002Ector(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
65145 float num8 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector4.X;
65146 float num9 = Main.player[target].position.Y - vector4.Y;
65147 float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9);
65148 if (Main.expertMode && num10 < 120f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
65149 {
65150 ai[0] = -40f;
65151 if (velocity.Y == 0f)
65152 {
65153 velocity.X *= 0.9f;
65154 }
65155 if (Main.netMode != 1 && localAI[0] == 0f)
65156 {
65157 Vector2 vector5 = default(Vector2);
65158 for (int j = 0; j < 5; j++)
65159 {
65160 ((Vector2)(ref vector5))._002Ector((float)(j - 2), -4f);
65161 vector5.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
65162 vector5.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
65163 ((Vector2)(ref vector5)).Normalize();
65164 vector5 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f;
65166 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector4.X, vector4.Y, vector5.X, vector5.Y, 605, attackDamage_ForProjectiles2, 0f, Main.myPlayer);
65167 localAI[0] = 30f;
65168 }
65169 }
65170 }
65171 else if (num10 < 200f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
65172 {
65173 ai[0] = -40f;
65174 if (velocity.Y == 0f)
65175 {
65176 velocity.X *= 0.9f;
65177 }
65178 if (Main.netMode != 1 && localAI[0] == 0f)
65179 {
65180 num9 = Main.player[target].position.Y - vector4.Y - (float)Main.rand.Next(0, 200);
65181 num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9);
65182 num10 = 4.5f / num10;
65183 num8 *= num10;
65184 num9 *= num10;
65185 localAI[0] = 50f;
65186 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector4.X, vector4.Y, num8, num9, 605, 9, 0f, Main.myPlayer);
65187 }
65188 }
65189 }
65190 }
65191 if (type == 658)
65192 {
65193 flag = true;
65194 if (localAI[0] > 0f)
65195 {
65196 localAI[0] -= 1f;
65197 }
65198 if (!wet && Main.player[target].active && !Main.player[target].dead && !Main.player[target].npcTypeNoAggro[type])
65199 {
65200 Player obj5 = Main.player[target];
65201 Vector2 center = base.Center;
65202 float num11 = obj5.Center.X - center.X;
65203 float num13 = obj5.Center.Y - center.Y;
65204 float num14 = (float)Math.Sqrt(num11 * num11 + num13 * num13);
65205 int num15 = CountNPCS(658);
65206 if (Main.expertMode && num15 < 5 && Math.Abs(num11) < 500f && Math.Abs(num13) < 550f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
65207 {
65208 ai[0] = -40f;
65209 if (velocity.Y == 0f)
65210 {
65211 velocity.X *= 0.9f;
65212 }
65213 if (Main.netMode != 1 && localAI[0] == 0f)
65214 {
65215 Vector2 vector6 = default(Vector2);
65216 for (int k = 0; k < 3; k++)
65217 {
65218 ((Vector2)(ref vector6))._002Ector((float)(k - 1), -4f);
65219 vector6.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
65220 vector6.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
65221 ((Vector2)(ref vector6)).Normalize();
65222 vector6 *= 6f + (float)Main.rand.Next(-50, 51) * 0.01f;
65223 if (num14 > 350f)
65224 {
65225 vector6 *= 2f;
65226 }
65227 else if (num14 > 250f)
65228 {
65229 vector6 *= 1.5f;
65230 }
65232 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), center.X, center.Y, vector6.X, vector6.Y, 920, attackDamage_ForProjectiles_MultiLerp, 0f, Main.myPlayer);
65233 localAI[0] = 25f;
65234 if (num15 > 4)
65235 {
65236 break;
65237 }
65238 }
65239 }
65240 }
65241 else if (Math.Abs(num11) < 500f && Math.Abs(num13) < 550f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
65242 {
65243 float num16 = num14;
65244 ai[0] = -40f;
65245 if (velocity.Y == 0f)
65246 {
65247 velocity.X *= 0.9f;
65248 }
65249 if (Main.netMode != 1 && localAI[0] == 0f)
65250 {
65251 num13 = Main.player[target].position.Y - center.Y - (float)Main.rand.Next(0, 200);
65252 num14 = (float)Math.Sqrt(num11 * num11 + num13 * num13);
65253 num14 = 4.5f / num14;
65254 num14 *= 2f;
65255 if (num16 > 350f)
65256 {
65257 num14 *= 2f;
65258 }
65259 else if (num16 > 250f)
65260 {
65261 num14 *= 1.5f;
65262 }
65263 num11 *= num14;
65264 num13 *= num14;
65265 localAI[0] = 50f;
65267 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), center.X, center.Y, num11, num13, 920, attackDamage_ForProjectiles_MultiLerp2, 0f, Main.myPlayer);
65268 }
65269 }
65270 }
65271 }
65272 if (type == 659)
65273 {
65274 flag = true;
65275 if (localAI[0] > 0f)
65276 {
65277 localAI[0] -= 1f;
65278 }
65279 if (!wet && Main.player[target].active && !Main.player[target].dead && !Main.player[target].npcTypeNoAggro[type])
65280 {
65281 Player obj6 = Main.player[target];
65282 Vector2 center2 = base.Center;
65283 float num17 = obj6.Center.X - center2.X;
65284 float num18 = obj6.Center.Y - center2.Y;
65285 float num19 = (float)Math.Sqrt(num17 * num17 + num18 * num18);
65286 float num20 = num19;
65287 if (Math.Abs(num17) < 500f && Math.Abs(num18) < 550f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
65288 {
65289 ai[0] = -40f;
65290 if (velocity.Y == 0f)
65291 {
65292 velocity.X *= 0.9f;
65293 }
65294 if (Main.netMode != 1 && localAI[0] == 0f)
65295 {
65296 num18 = Main.player[target].position.Y - center2.Y - (float)Main.rand.Next(0, 200);
65297 num19 = (float)Math.Sqrt(num17 * num17 + num18 * num18);
65298 num19 = 4.5f / num19;
65299 num19 *= 2f;
65300 if (num20 > 350f)
65301 {
65302 num19 *= 1.75f;
65303 }
65304 else if (num20 > 250f)
65305 {
65306 num19 *= 1.25f;
65307 }
65308 num17 *= num19;
65309 num18 *= num19;
65310 localAI[0] = 40f;
65311 if (Main.expertMode)
65312 {
65313 localAI[0] = 30f;
65314 }
65316 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), center2.X, center2.Y, num17, num18, 921, attackDamage_ForProjectiles_MultiLerp3, 0f, Main.myPlayer);
65317 }
65318 }
65319 }
65320 }
65321 if (type == 204)
65322 {
65323 flag = true;
65324 if (localAI[0] > 0f)
65325 {
65326 localAI[0] -= 1f;
65327 }
65328 if (!wet && !Main.player[target].npcTypeNoAggro[type])
65329 {
65330 Vector2 vector7 = default(Vector2);
65331 ((Vector2)(ref vector7))._002Ector(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
65332 float num21 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector7.X;
65333 float num22 = Main.player[target].position.Y - vector7.Y;
65334 float num24 = (float)Math.Sqrt(num21 * num21 + num22 * num22);
65335 if (Main.expertMode && num24 < 200f && Collision.CanHit(new Vector2(position.X, position.Y - 20f), width, height + 20, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
65336 {
65337 ai[0] = -40f;
65338 if (velocity.Y == 0f)
65339 {
65340 velocity.X *= 0.9f;
65341 }
65342 if (Main.netMode != 1 && localAI[0] == 0f)
65343 {
65344 Vector2 vector8 = default(Vector2);
65345 for (int l = 0; l < 5; l++)
65346 {
65347 ((Vector2)(ref vector8))._002Ector((float)(l - 2), -2f);
65348 vector8.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.02f;
65349 vector8.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.02f;
65350 ((Vector2)(ref vector8)).Normalize();
65351 vector8 *= 3f + (float)Main.rand.Next(-50, 51) * 0.01f;
65353 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector7.X, vector7.Y, vector8.X, vector8.Y, 176, attackDamage_ForProjectiles3, 0f, Main.myPlayer);
65354 localAI[0] = 80f;
65355 }
65356 }
65357 }
65358 if (num24 < 400f && Collision.CanHit(new Vector2(position.X, position.Y - 20f), width, height + 20, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
65359 {
65360 ai[0] = -80f;
65361 if (velocity.Y == 0f)
65362 {
65363 velocity.X *= 0.9f;
65364 }
65365 if (Main.netMode != 1 && localAI[0] == 0f)
65366 {
65367 num22 = Main.player[target].position.Y - vector7.Y - (float)Main.rand.Next(-30, 20);
65368 num22 -= num24 * 0.05f;
65369 num21 = Main.player[target].position.X - vector7.X - (float)Main.rand.Next(-20, 20);
65370 num24 = (float)Math.Sqrt(num21 * num21 + num22 * num22);
65371 num24 = 7f / num24;
65372 num21 *= num24;
65373 num22 *= num24;
65374 localAI[0] = 65f;
65375 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector7.X, vector7.Y, num21, num22, 176, 13, 0f, Main.myPlayer);
65376 }
65377 }
65378 }
65379 }
65380 if (type == 377 || type == 446)
65381 {
65382 if (localAI[2] < 90f)
65383 {
65384 localAI[2] += 1f;
65385 }
65386 else
65387 {
65388 friendly = false;
65389 }
65390 }
65391 if (type == 59)
65392 {
65394 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1f, 0.3f, 0.1f);
65395 int num25 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 1.7f);
65396 Main.dust[num25].noGravity = true;
65398 }
65399 if (ai[2] > 1f)
65400 {
65401 ai[2] -= 1f;
65402 }
65403 if (wet)
65404 {
65405 if (collideY)
65406 {
65407 velocity.Y = -2f;
65408 }
65409 if (velocity.Y < 0f && ai[3] == position.X)
65410 {
65411 direction *= -1;
65412 ai[2] = 200f;
65413 }
65414 if (velocity.Y > 0f)
65415 {
65416 ai[3] = position.X;
65417 }
65418 if (type == 59 && !Main.remixWorld)
65419 {
65420 if (velocity.Y > 2f)
65421 {
65422 velocity.Y *= 0.9f;
65423 }
65424 else if (directionY < 0)
65425 {
65426 velocity.Y -= 0.8f;
65427 }
65428 velocity.Y -= 0.5f;
65429 if (velocity.Y < -10f)
65430 {
65431 velocity.Y = -10f;
65432 }
65433 }
65434 else
65435 {
65436 if (velocity.Y > 2f)
65437 {
65438 velocity.Y *= 0.9f;
65439 }
65440 velocity.Y -= 0.5f;
65441 if (velocity.Y < -4f)
65442 {
65443 velocity.Y = -4f;
65444 }
65445 }
65446 if (ai[2] == 1f && flag)
65447 {
65448 TargetClosest();
65449 }
65450 }
65451 aiAction = 0;
65452 if (ai[2] == 0f)
65453 {
65454 ai[0] = -100f;
65455 ai[2] = 1f;
65456 TargetClosest();
65457 }
65458 if (velocity.Y == 0f)
65459 {
65460 if (collideY && oldVelocity.Y != 0f && Collision.SolidCollision(position, width, height))
65461 {
65462 position.X -= velocity.X + (float)direction;
65463 }
65464 if (ai[3] == position.X)
65465 {
65466 direction *= -1;
65467 ai[2] = 200f;
65468 }
65469 ai[3] = 0f;
65470 velocity.X *= 0.8f;
65471 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
65472 {
65473 velocity.X = 0f;
65474 }
65475 if (flag)
65476 {
65477 ai[0] += 1f;
65478 }
65479 ai[0] += 1f;
65480 if (type == 59 && !Main.remixWorld)
65481 {
65482 ai[0] += 2f;
65483 }
65484 if (type == 71)
65485 {
65486 ai[0] += 3f;
65487 }
65488 if (type == 667)
65489 {
65490 ai[0] += 3f;
65491 }
65492 if (type == 138)
65493 {
65494 ai[0] += 2f;
65495 }
65496 if (type == 183)
65497 {
65498 ai[0] += 1f;
65499 }
65500 if (type == 658)
65501 {
65502 ai[0] += 5f;
65503 }
65504 if (type == 659)
65505 {
65506 ai[0] += 3f;
65507 }
65508 if (type == 304)
65509 {
65510 float num26 = (1 - life / lifeMax) * 10;
65511 ai[0] += num26;
65512 }
65513 if (type == 377 || type == 446)
65514 {
65515 ai[0] += 3f;
65516 }
65517 if (type == 81)
65518 {
65519 if (scale >= 0f)
65520 {
65521 ai[0] += 4f;
65522 }
65523 else
65524 {
65525 ai[0] += 1f;
65526 }
65527 }
65528 float num27 = -1000f;
65529 if (type == 659)
65530 {
65531 num27 = -500f;
65532 }
65533 if (type == 667)
65534 {
65535 num27 = -400f;
65536 }
65537 int num28 = 0;
65538 if (ai[0] >= 0f)
65539 {
65540 num28 = 1;
65541 }
65542 if (ai[0] >= num27 && ai[0] <= num27 * 0.5f)
65543 {
65544 num28 = 2;
65545 }
65546 if (ai[0] >= num27 * 2f && ai[0] <= num27 * 1.5f)
65547 {
65548 num28 = 3;
65549 }
65550 if (num28 > 0)
65551 {
65552 netUpdate = true;
65553 if (flag && ai[2] == 1f)
65554 {
65555 TargetClosest();
65556 }
65557 if (num28 == 3)
65558 {
65559 velocity.Y = -8f;
65560 if (type == 59 && !Main.remixWorld)
65561 {
65562 velocity.Y -= 2f;
65563 }
65564 velocity.X += 3 * direction;
65565 if (type == 59 && !Main.remixWorld)
65566 {
65567 velocity.X += 0.5f * (float)direction;
65568 }
65569 ai[0] = -200f;
65570 ai[3] = position.X;
65571 }
65572 else
65573 {
65574 velocity.Y = -6f;
65575 velocity.X += 2 * direction;
65576 if (type == 59 && !Main.remixWorld)
65577 {
65578 velocity.X += 2 * direction;
65579 }
65580 ai[0] = -120f;
65581 if (num28 == 1)
65582 {
65583 ai[0] += num27;
65584 }
65585 else
65586 {
65587 ai[0] += num27 * 2f;
65588 }
65589 }
65590 if (type == 659)
65591 {
65592 velocity.Y *= 1.6f;
65593 velocity.X *= 1.2f;
65594 }
65595 if (type == 685)
65596 {
65597 velocity.Y *= 0.5f;
65598 velocity.X *= 0.2f;
65599 if (Main.rand.Next(2) == 0)
65600 {
65601 direction *= -1;
65602 }
65603 }
65604 if (type == 141)
65605 {
65606 velocity.Y *= 1.3f;
65607 velocity.X *= 1.2f;
65608 }
65609 if (type == 377 || type == 446)
65610 {
65611 velocity.Y *= 0.9f;
65612 velocity.X *= 0.6f;
65613 if (flag)
65614 {
65616 velocity.X *= -1f;
65617 }
65618 int i2 = (int)(base.Center.X / 16f);
65619 int j2 = (int)(base.Center.Y / 16f) - 1;
65620 if (WorldGen.SolidTile(i2, j2) && 0f - velocity.Y + (float)height > 16f)
65621 {
65622 velocity.Y = -(16 - height);
65623 }
65624 }
65625 }
65626 else if (ai[0] >= -30f)
65627 {
65628 aiAction = 1;
65629 }
65630 }
65631 else if (target < 255 && ((direction == 1 && velocity.X < 3f) || (direction == -1 && velocity.X > -3f)))
65632 {
65633 if (collideX && Math.Abs(velocity.X) == 0.2f)
65634 {
65635 position.X -= 1.4f * (float)direction;
65636 }
65637 if (collideY && oldVelocity.Y != 0f && Collision.SolidCollision(position, width, height))
65638 {
65639 position.X -= velocity.X + (float)direction;
65640 }
65641 if ((direction == -1 && (double)velocity.X < 0.01) || (direction == 1 && (double)velocity.X > -0.01))
65642 {
65643 velocity.X += 0.2f * (float)direction;
65644 }
65645 else
65646 {
65647 velocity.X *= 0.93f;
65648 }
65649 }
65650 }
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Definition Entity.cs:57
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
Vector2 oldVelocity
Definition Entity.cs:37
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
Vector2 netOffset
Definition NPC.cs:502
int GetAttackDamage_ForProjectiles_MultiLerp(float normalDamage, float expertDamage, float masterDamage)
Definition NPC.cs:1901
static int CountNPCS(int Type)
Returns the number of active NPC in the world of the given NPC type (F:Terraria.NPC....
Definition NPC.cs:106585
float[] localAI
Acts like F:Terraria.NPC.ai, but does not sync to the server. Many vanilla T:Terraria....
Definition NPC.cs:1003
void AI_001_SetRainbowSlimeColor()
Definition NPC.cs:65652
int aiAction
Definition NPC.cs:1005
int lifeMax
The maximum life of this NPC.
Definition NPC.cs:1077
void TargetClosest(bool faceTarget=true)
Definition NPC.cs:83247
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
Definition NPC.cs:997
bool friendly
Indicates that an NPC is friendly to players. If true, a player won't damage the NPC and the NPC won'...
Definition NPC.cs:1197
float value
How many copper coins the NPC will drop when killed (100 copper coins = 1 silver coin etc....
Definition NPC.cs:1156
float scale
Makes the NPC bigger or smaller. Bigger than 1f is bigger. Defaults to 1f.
Definition NPC.cs:1104
bool collideX
Definition NPC.cs:1134
bool collideY
Definition NPC.cs:1136
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
int alpha
0 is opaque, and 255 is transparent. Note that this is the opposite of how alpha is typically express...
Definition NPC.cs:1092
Color color
Definition NPC.cs:1085
float rotation
Definition NPC.cs:1116
static int AI_001_Slimes_GenerateItemInsideBody(bool isBallooned)
Definition NPC.cs:65661
double frameCounter
Definition NPC.cs:1081
int GetAttackDamage_ForProjectiles(float normalDamage, float expertDamage)
Definition NPC.cs:1891
int life
The current life of the NPC. Automatically set to the value of F:Terraria.NPC.lifeMax at the end of S...
Definition NPC.cs:1072
IEntitySource GetSpawnSource_ForProjectile()
Definition NPC.cs:107558
int directionY
Definition NPC.cs:983
bool netUpdate
Definition NPC.cs:1130
int target
Definition NPC.cs:1019

References Terraria.Lighting.AddLight(), Terraria.NPC.ai, Terraria.NPC.AI_001_SetRainbowSlimeColor(), Terraria.NPC.AI_001_Slimes_GenerateItemInsideBody(), Terraria.NPC.aiAction, Terraria.NPC.alpha, Terraria.Collision.CanHit(), Terraria.NPC.collideX, Terraria.NPC.collideY, Terraria.NPC.color, Terraria.NPC.CountNPCS(), Terraria.Main.dayTime, Terraria.Entity.direction, Terraria.NPC.directionY, Terraria.Main.DiscoB, Terraria.Main.DiscoG, Terraria.Main.DiscoR, Terraria.Main.dust, Terraria.Main.expertMode, Terraria.NPC.frameCounter, Terraria.NPC.friendly, Terraria.NPC.GetAttackDamage_ForProjectiles(), Terraria.NPC.GetAttackDamage_ForProjectiles_MultiLerp(), Terraria.NPC.GetSpawnSource_ForProjectile(), Terraria.Entity.height, Terraria.Main.hslToRgb(), Terraria.NPC.life, Terraria.NPC.lifeMax, Terraria.NPC.localAI, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.NPC.netOffset, Terraria.NPC.netUpdate, Terraria.Dust.NewDust(), Terraria.Dust.NewDustPerfect(), Terraria.Projectile.NewProjectile(), Terraria.Entity.oldVelocity, Terraria.Main.player, Terraria.Entity.position, Terraria.Main.rand, Terraria.Main.remixWorld, Terraria.NPC.rotation, Terraria.NPC.scale, Terraria.Main.slimeRain, Terraria.Collision.SolidCollision(), Terraria.WorldGen.SolidTile(), Terraria.NPC.target, Terraria.NPC.TargetClosest(), Terraria.Main.timeForVisualEffects, Terraria.NPC.type, Terraria.NPC.value, Terraria.Entity.velocity, Terraria.Entity.wet, Terraria.Entity.width, and Terraria.Main.worldSurface.

Referenced by Terraria.NPC.VanillaAI_Inner().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: