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

◆ AI_121_QueenSlime()

void Terraria.NPC.AI_121_QueenSlime ( )
inlineprivate

Definition at line 45955 of file NPC.cs.

45956 {
45957 //IL_0063: Unknown result type (might be due to invalid IL or missing references)
45958 //IL_0097: Unknown result type (might be due to invalid IL or missing references)
45959 //IL_00ad: Unknown result type (might be due to invalid IL or missing references)
45960 //IL_012b: Unknown result type (might be due to invalid IL or missing references)
45961 //IL_0136: Unknown result type (might be due to invalid IL or missing references)
45962 //IL_00e6: Unknown result type (might be due to invalid IL or missing references)
45963 //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
45964 //IL_0534: Unknown result type (might be due to invalid IL or missing references)
45965 //IL_0547: Unknown result type (might be due to invalid IL or missing references)
45966 //IL_0556: Unknown result type (might be due to invalid IL or missing references)
45967 //IL_056c: Unknown result type (might be due to invalid IL or missing references)
45968 //IL_01e9: Unknown result type (might be due to invalid IL or missing references)
45969 //IL_01ee: Unknown result type (might be due to invalid IL or missing references)
45970 //IL_01f3: Unknown result type (might be due to invalid IL or missing references)
45971 //IL_0201: Unknown result type (might be due to invalid IL or missing references)
45972 //IL_0206: Unknown result type (might be due to invalid IL or missing references)
45973 //IL_020b: Unknown result type (might be due to invalid IL or missing references)
45974 //IL_0219: Unknown result type (might be due to invalid IL or missing references)
45975 //IL_021f: Unknown result type (might be due to invalid IL or missing references)
45976 //IL_0224: Unknown result type (might be due to invalid IL or missing references)
45977 //IL_0229: Unknown result type (might be due to invalid IL or missing references)
45978 //IL_09ff: Unknown result type (might be due to invalid IL or missing references)
45979 //IL_0a04: Unknown result type (might be due to invalid IL or missing references)
45980 //IL_0b1c: Unknown result type (might be due to invalid IL or missing references)
45981 //IL_0b30: Unknown result type (might be due to invalid IL or missing references)
45982 //IL_0b35: Unknown result type (might be due to invalid IL or missing references)
45983 //IL_0b3b: Unknown result type (might be due to invalid IL or missing references)
45984 //IL_1001: Unknown result type (might be due to invalid IL or missing references)
45985 //IL_0a1b: Unknown result type (might be due to invalid IL or missing references)
45986 //IL_0a20: Unknown result type (might be due to invalid IL or missing references)
45987 //IL_0a2a: Unknown result type (might be due to invalid IL or missing references)
45988 //IL_0a2f: Unknown result type (might be due to invalid IL or missing references)
45989 //IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
45990 //IL_0a81: Unknown result type (might be due to invalid IL or missing references)
45991 //IL_0a8b: Unknown result type (might be due to invalid IL or missing references)
45992 //IL_0a90: Unknown result type (might be due to invalid IL or missing references)
45993 //IL_0b78: Unknown result type (might be due to invalid IL or missing references)
45994 //IL_1496: Unknown result type (might be due to invalid IL or missing references)
45995 //IL_149b: Unknown result type (might be due to invalid IL or missing references)
45996 //IL_18f1: Unknown result type (might be due to invalid IL or missing references)
45997 //IL_0bda: Unknown result type (might be due to invalid IL or missing references)
45998 //IL_0bdf: Unknown result type (might be due to invalid IL or missing references)
45999 //IL_1092: Unknown result type (might be due to invalid IL or missing references)
46000 //IL_101a: Unknown result type (might be due to invalid IL or missing references)
46001 //IL_1026: Unknown result type (might be due to invalid IL or missing references)
46002 //IL_04e6: Unknown result type (might be due to invalid IL or missing references)
46003 //IL_04fd: Unknown result type (might be due to invalid IL or missing references)
46004 //IL_0502: Unknown result type (might be due to invalid IL or missing references)
46005 //IL_050b: Unknown result type (might be due to invalid IL or missing references)
46006 //IL_051a: Unknown result type (might be due to invalid IL or missing references)
46007 //IL_028e: Unknown result type (might be due to invalid IL or missing references)
46008 //IL_0298: Unknown result type (might be due to invalid IL or missing references)
46009 //IL_02b0: Unknown result type (might be due to invalid IL or missing references)
46010 //IL_02ba: Unknown result type (might be due to invalid IL or missing references)
46011 //IL_02cc: Unknown result type (might be due to invalid IL or missing references)
46012 //IL_1503: Unknown result type (might be due to invalid IL or missing references)
46013 //IL_1506: Unknown result type (might be due to invalid IL or missing references)
46014 //IL_150b: Unknown result type (might be due to invalid IL or missing references)
46015 //IL_1510: Unknown result type (might be due to invalid IL or missing references)
46016 //IL_1517: Unknown result type (might be due to invalid IL or missing references)
46017 //IL_151c: Unknown result type (might be due to invalid IL or missing references)
46018 //IL_1521: Unknown result type (might be due to invalid IL or missing references)
46019 //IL_1526: Unknown result type (might be due to invalid IL or missing references)
46020 //IL_152d: Unknown result type (might be due to invalid IL or missing references)
46021 //IL_1537: Unknown result type (might be due to invalid IL or missing references)
46022 //IL_153c: Unknown result type (might be due to invalid IL or missing references)
46023 //IL_14b0: Unknown result type (might be due to invalid IL or missing references)
46024 //IL_14bc: Unknown result type (might be due to invalid IL or missing references)
46025 //IL_10b2: Unknown result type (might be due to invalid IL or missing references)
46026 //IL_10b7: Unknown result type (might be due to invalid IL or missing references)
46027 //IL_1043: Unknown result type (might be due to invalid IL or missing references)
46028 //IL_1744: Unknown result type (might be due to invalid IL or missing references)
46029 //IL_1752: Unknown result type (might be due to invalid IL or missing references)
46030 //IL_1757: Unknown result type (might be due to invalid IL or missing references)
46031 //IL_175c: Unknown result type (might be due to invalid IL or missing references)
46032 //IL_0307: Unknown result type (might be due to invalid IL or missing references)
46033 //IL_02da: Unknown result type (might be due to invalid IL or missing references)
46034 //IL_0bf6: Unknown result type (might be due to invalid IL or missing references)
46035 //IL_0bfb: Unknown result type (might be due to invalid IL or missing references)
46036 //IL_0c05: Unknown result type (might be due to invalid IL or missing references)
46037 //IL_0c0a: Unknown result type (might be due to invalid IL or missing references)
46038 //IL_0c37: Unknown result type (might be due to invalid IL or missing references)
46039 //IL_0c5c: Unknown result type (might be due to invalid IL or missing references)
46040 //IL_0c66: Unknown result type (might be due to invalid IL or missing references)
46041 //IL_0c6b: Unknown result type (might be due to invalid IL or missing references)
46042 //IL_14d9: Unknown result type (might be due to invalid IL or missing references)
46043 //IL_14de: Unknown result type (might be due to invalid IL or missing references)
46044 //IL_177a: Unknown result type (might be due to invalid IL or missing references)
46045 //IL_177d: Unknown result type (might be due to invalid IL or missing references)
46046 //IL_1782: Unknown result type (might be due to invalid IL or missing references)
46047 //IL_1787: Unknown result type (might be due to invalid IL or missing references)
46048 //IL_1789: Unknown result type (might be due to invalid IL or missing references)
46049 //IL_178b: Unknown result type (might be due to invalid IL or missing references)
46050 //IL_1790: Unknown result type (might be due to invalid IL or missing references)
46051 //IL_179a: Unknown result type (might be due to invalid IL or missing references)
46052 //IL_179f: Unknown result type (might be due to invalid IL or missing references)
46053 //IL_17a1: Unknown result type (might be due to invalid IL or missing references)
46054 //IL_17a7: Unknown result type (might be due to invalid IL or missing references)
46055 //IL_17ae: Unknown result type (might be due to invalid IL or missing references)
46056 //IL_17b7: Unknown result type (might be due to invalid IL or missing references)
46057 //IL_17d0: Unknown result type (might be due to invalid IL or missing references)
46058 //IL_17d2: Unknown result type (might be due to invalid IL or missing references)
46059 //IL_17ff: Unknown result type (might be due to invalid IL or missing references)
46060 //IL_1801: Unknown result type (might be due to invalid IL or missing references)
46061 //IL_1762: Unknown result type (might be due to invalid IL or missing references)
46062 //IL_176e: Unknown result type (might be due to invalid IL or missing references)
46063 //IL_1773: Unknown result type (might be due to invalid IL or missing references)
46064 //IL_1778: Unknown result type (might be due to invalid IL or missing references)
46065 //IL_0315: Unknown result type (might be due to invalid IL or missing references)
46066 //IL_02e8: Unknown result type (might be due to invalid IL or missing references)
46067 //IL_11b8: Unknown result type (might be due to invalid IL or missing references)
46068 //IL_11d9: Unknown result type (might be due to invalid IL or missing references)
46069 //IL_11de: Unknown result type (might be due to invalid IL or missing references)
46070 //IL_11e3: Unknown result type (might be due to invalid IL or missing references)
46071 //IL_11e5: Unknown result type (might be due to invalid IL or missing references)
46072 //IL_1203: Unknown result type (might be due to invalid IL or missing references)
46073 //IL_121c: Unknown result type (might be due to invalid IL or missing references)
46074 //IL_121e: Unknown result type (might be due to invalid IL or missing references)
46075 //IL_10ea: Unknown result type (might be due to invalid IL or missing references)
46076 //IL_10fd: Unknown result type (might be due to invalid IL or missing references)
46077 //IL_1102: Unknown result type (might be due to invalid IL or missing references)
46078 //IL_1129: Unknown result type (might be due to invalid IL or missing references)
46079 //IL_1607: Unknown result type (might be due to invalid IL or missing references)
46080 //IL_1618: Unknown result type (might be due to invalid IL or missing references)
46081 //IL_161d: Unknown result type (might be due to invalid IL or missing references)
46082 //IL_1622: Unknown result type (might be due to invalid IL or missing references)
46083 //IL_162b: Unknown result type (might be due to invalid IL or missing references)
46084 //IL_1636: Unknown result type (might be due to invalid IL or missing references)
46085 //IL_1640: Unknown result type (might be due to invalid IL or missing references)
46086 //IL_1647: Unknown result type (might be due to invalid IL or missing references)
46087 //IL_0323: Unknown result type (might be due to invalid IL or missing references)
46088 //IL_02f6: Unknown result type (might be due to invalid IL or missing references)
46089 //IL_0331: Unknown result type (might be due to invalid IL or missing references)
46090 //IL_047f: Unknown result type (might be due to invalid IL or missing references)
46091 //IL_0492: Unknown result type (might be due to invalid IL or missing references)
46092 //IL_0897: Unknown result type (might be due to invalid IL or missing references)
46093 //IL_08a2: Unknown result type (might be due to invalid IL or missing references)
46094 //IL_08b0: Unknown result type (might be due to invalid IL or missing references)
46095 //IL_08bb: Unknown result type (might be due to invalid IL or missing references)
46096 int num = 30;
46097 int num11 = 40;
46098 _ = Main.expertMode;
46099 float num22 = 1f;
46100 bool flag = false;
46101 bool flag2 = life <= lifeMax / 2;
46102 if (localAI[0] == 0f)
46103 {
46104 ai[1] = -100f;
46105 localAI[0] = lifeMax;
46106 TargetClosest();
46107 netUpdate = true;
46108 }
46109 Lighting.AddLight(base.Center, 1f, 0.7f, 0.9f);
46110 int num27 = 500;
46111 if (Main.player[target].dead || Math.Abs(base.Center.X - Main.player[target].Center.X) / 16f > (float)num27)
46112 {
46113 TargetClosest();
46114 if (Main.player[target].dead || Math.Abs(base.Center.X - Main.player[target].Center.X) / 16f > (float)num27)
46115 {
46116 EncourageDespawn(10);
46117 if (Main.player[target].Center.X < base.Center.X)
46118 {
46119 direction = 1;
46120 }
46121 else
46122 {
46123 direction = -1;
46124 }
46125 }
46126 }
46127 if (!Main.player[target].dead && timeLeft > 10 && !flag2 && ai[3] >= 300f && ai[0] == 0f && velocity.Y == 0f)
46128 {
46129 ai[0] = 2f;
46130 ai[1] = 0f;
46131 if (Main.netMode != 1)
46132 {
46133 netUpdate = true;
46135 Point point = base.Center.ToTileCoordinates();
46136 Point point2 = Main.player[target].Center.ToTileCoordinates();
46137 Vector2 vector = Main.player[target].Center - base.Center;
46138 int num28 = 10;
46139 int num29 = 0;
46140 int num30 = 7;
46141 int num31 = 0;
46142 bool flag3 = false;
46143 if (ai[3] >= 360f || ((Vector2)(ref vector)).Length() > 2000f)
46144 {
46145 if (ai[3] > 360f)
46146 {
46147 ai[3] = 360f;
46148 }
46149 flag3 = true;
46150 num31 = 100;
46151 }
46152 while (!flag3 && num31 < 100)
46153 {
46154 num31++;
46155 int num32 = Main.rand.Next(point2.X - num28, point2.X + num28 + 1);
46156 int num2 = Main.rand.Next(point2.Y - num28, point2.Y + 1);
46157 if ((num2 >= point2.Y - num30 && num2 <= point2.Y + num30 && num32 >= point2.X - num30 && num32 <= point2.X + num30) || (num2 >= point.Y - num29 && num2 <= point.Y + num29 && num32 >= point.X - num29 && num32 <= point.X + num29) || Main.tile[num32, num2].nactive())
46158 {
46159 continue;
46160 }
46161 int num3 = num2;
46162 int i = 0;
46163 if (Main.tile[num32, num3].nactive() && Main.tileSolid[Main.tile[num32, num3].type] && !Main.tileSolidTop[Main.tile[num32, num3].type])
46164 {
46165 i = 1;
46166 }
46167 else
46168 {
46169 for (; i < 150 && num3 + i < Main.maxTilesY; i++)
46170 {
46171 int num4 = num3 + i;
46172 if (Main.tile[num32, num4].nactive() && Main.tileSolid[Main.tile[num32, num4].type] && !Main.tileSolidTop[Main.tile[num32, num4].type])
46173 {
46174 i--;
46175 break;
46176 }
46177 }
46178 }
46179 num2 += i;
46180 bool flag4 = true;
46181 if (flag4 && Main.tile[num32, num2].lava())
46182 {
46183 flag4 = false;
46184 }
46185 if (flag4 && !Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
46186 {
46187 flag4 = false;
46188 }
46189 if (flag4)
46190 {
46191 localAI[1] = num32 * 16 + 8;
46192 localAI[2] = num2 * 16 + 16;
46193 flag3 = true;
46194 break;
46195 }
46196 }
46197 if (num31 >= 100)
46198 {
46199 Vector2 bottom = Main.player[Player.FindClosest(position, width, height)].Bottom;
46200 localAI[1] = bottom.X;
46201 localAI[2] = bottom.Y;
46202 ai[3] = 0f;
46203 }
46204 }
46205 }
46206 if (!flag2 && (!Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0) || Math.Abs(base.Top.Y - Main.player[target].Bottom.Y) > 320f))
46207 {
46208 ai[3] += 1.5f;
46209 }
46210 else
46211 {
46212 float num5 = ai[3];
46213 ai[3] -= 1f;
46214 if (ai[3] < 0f)
46215 {
46216 if (Main.netMode != 1 && num5 > 0f)
46217 {
46218 netUpdate = true;
46219 }
46220 ai[3] = 0f;
46221 }
46222 }
46223 if (timeLeft <= 10 && ((flag2 && ai[0] != 0f) || (!flag2 && ai[0] != 3f)))
46224 {
46225 if (flag2)
46226 {
46227 ai[0] = 0f;
46228 }
46229 else
46230 {
46231 ai[0] = 3f;
46232 }
46233 ai[1] = 0f;
46234 ai[2] = 0f;
46235 ai[3] = 0f;
46236 netUpdate = true;
46237 }
46238 noTileCollide = false;
46239 noGravity = false;
46240 if (flag2)
46241 {
46242 localAI[3] += 1f;
46243 if (localAI[3] >= 24f)
46244 {
46245 localAI[3] = 0f;
46246 }
46247 if (ai[0] == 4f && ai[2] == 1f)
46248 {
46249 localAI[3] = 6f;
46250 }
46251 if (ai[0] == 5f && ai[2] != 1f)
46252 {
46253 localAI[3] = 7f;
46254 }
46255 }
46256 switch ((int)ai[0])
46257 {
46258 case 0:
46259 {
46260 if (flag2)
46261 {
46263 }
46264 else
46265 {
46266 noTileCollide = false;
46267 noGravity = false;
46268 if (velocity.Y == 0f)
46269 {
46270 velocity.X *= 0.8f;
46271 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
46272 {
46273 velocity.X = 0f;
46274 }
46275 }
46276 }
46277 if (timeLeft <= 10 || (!flag2 && velocity.Y != 0f))
46278 {
46279 break;
46280 }
46281 ai[1] += 1f;
46282 int num10 = 60;
46283 if (flag2)
46284 {
46285 num10 = 120;
46286 }
46287 if (!(ai[1] > (float)num10))
46288 {
46289 break;
46290 }
46291 ai[1] = 0f;
46292 if (flag2)
46293 {
46294 Player player = Main.player[target];
46295 if (Main.rand.Next(2) != 1)
46296 {
46297 ai[0] = 4f;
46298 }
46299 else
46300 {
46301 ai[0] = 5f;
46302 }
46303 if (ai[0] == 4f)
46304 {
46305 ai[2] = 1f;
46306 if (player != null && player.active && !player.dead && (player.Bottom.Y < base.Bottom.Y || Math.Abs(player.Center.X - base.Center.X) > 250f))
46307 {
46308 ai[0] = 5f;
46309 ai[2] = 0f;
46310 }
46311 }
46312 }
46313 else
46314 {
46315 switch (Main.rand.Next(3))
46316 {
46317 default:
46318 ai[0] = 3f;
46319 break;
46320 case 1:
46321 ai[0] = 4f;
46322 break;
46323 case 2:
46324 ai[0] = 5f;
46325 break;
46326 }
46327 }
46328 netUpdate = true;
46329 break;
46330 }
46331 case 1:
46332 {
46333 rotation = 0f;
46334 ai[1] += 1f;
46335 num22 = MathHelper.Clamp(ai[1] / 30f, 0f, 1f);
46336 num22 = 0.5f + num22 * 0.5f;
46337 if (ai[1] >= 30f && Main.netMode != 1)
46338 {
46339 ai[0] = 0f;
46340 ai[1] = 0f;
46341 netUpdate = true;
46342 TargetClosest();
46343 }
46344 if (Main.netMode == 1 && ai[1] >= 60f)
46345 {
46346 ai[0] = 0f;
46347 ai[1] = 0f;
46348 TargetClosest();
46349 }
46351 ((Color)(ref newColor2)).A = 150;
46352 for (int num19 = 0; num19 < 10; num19++)
46353 {
46354 int num20 = Dust.NewDust(position + Vector2.UnitX * -20f, width + 40, height, 4, velocity.X, velocity.Y, 50, newColor2, 1.5f);
46355 Main.dust[num20].noGravity = true;
46356 Dust obj2 = Main.dust[num20];
46357 obj2.velocity *= 2f;
46358 }
46359 break;
46360 }
46361 case 2:
46362 rotation = 0f;
46363 ai[1] += 1f;
46364 num22 = MathHelper.Clamp((60f - ai[1]) / 60f, 0f, 1f);
46365 num22 = 0.5f + num22 * 0.5f;
46366 if (ai[1] >= 60f)
46367 {
46368 flag = true;
46369 }
46370 if (ai[1] == 60f)
46371 {
46372 Gore.NewGore(base.Center + new Vector2(-40f, (float)(-height / 2)), velocity, 1258);
46373 }
46374 if (ai[1] >= 60f && Main.netMode != 1)
46375 {
46376 base.Bottom = new Vector2(localAI[1], localAI[2]);
46377 ai[0] = 1f;
46378 ai[1] = 0f;
46379 netUpdate = true;
46380 }
46381 if (Main.netMode == 1 && ai[1] >= 120f)
46382 {
46383 ai[0] = 1f;
46384 ai[1] = 0f;
46385 }
46386 if (!flag)
46387 {
46389 ((Color)(ref newColor)).A = 150;
46390 for (int n = 0; n < 10; n++)
46391 {
46392 int num18 = Dust.NewDust(position + Vector2.UnitX * -20f, width + 40, height, 4, velocity.X, velocity.Y, 50, newColor, 1.5f);
46393 Main.dust[num18].noGravity = true;
46394 Dust obj = Main.dust[num18];
46395 obj.velocity *= 0.5f;
46396 }
46397 }
46398 break;
46399 case 3:
46400 rotation = 0f;
46401 if (velocity.Y == 0f)
46402 {
46403 velocity.X *= 0.8f;
46404 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
46405 {
46406 velocity.X = 0f;
46407 }
46408 ai[1] += 4f;
46409 if ((double)life < (double)lifeMax * 0.66)
46410 {
46411 ai[1] += 4f;
46412 }
46413 if ((double)life < (double)lifeMax * 0.33)
46414 {
46415 ai[1] += 4f;
46416 }
46417 if (!(ai[1] >= 0f))
46418 {
46419 break;
46420 }
46421 netUpdate = true;
46422 TargetClosest();
46423 if (ai[2] == 3f)
46424 {
46425 velocity.Y = -13f;
46426 velocity.X += 3.5f * (float)direction;
46427 ai[1] = 0f;
46428 ai[2] = 0f;
46429 if (timeLeft > 10)
46430 {
46431 ai[0] = 0f;
46432 }
46433 else
46434 {
46435 ai[1] = -60f;
46436 }
46437 }
46438 else if (ai[2] == 2f)
46439 {
46440 velocity.Y = -6f;
46441 velocity.X += 4.5f * (float)direction;
46442 ai[1] = -40f;
46443 ai[2] += 1f;
46444 }
46445 else
46446 {
46447 velocity.Y = -8f;
46448 velocity.X += 4f * (float)direction;
46449 ai[1] = -40f;
46450 ai[2] += 1f;
46451 }
46452 }
46453 else
46454 {
46455 if (target >= 255)
46456 {
46457 break;
46458 }
46459 float num12 = 3f;
46460 if (Main.getGoodWorld)
46461 {
46462 num12 = 7f;
46463 }
46464 if ((direction == 1 && velocity.X < num12) || (direction == -1 && velocity.X > 0f - num12))
46465 {
46466 if ((direction == -1 && (double)velocity.X < 0.1) || (direction == 1 && (double)velocity.X > -0.1))
46467 {
46468 velocity.X += 0.2f * (float)direction;
46469 }
46470 else
46471 {
46472 velocity.X *= 0.93f;
46473 }
46474 }
46475 }
46476 break;
46477 case 4:
46478 {
46479 rotation *= 0.9f;
46480 noTileCollide = true;
46481 noGravity = true;
46482 if (ai[2] == 1f)
46483 {
46484 noTileCollide = false;
46485 noGravity = false;
46486 int num13 = 30;
46487 if (flag2)
46488 {
46489 num13 = 10;
46490 }
46491 if (Main.getGoodWorld)
46492 {
46493 num13 = 0;
46494 }
46495 Player player2 = Main.player[target];
46496 _ = base.Center;
46497 if (!player2.dead && player2.active && Math.Abs(base.Center.X - player2.Center.X) / 16f <= (float)num27)
46498 {
46499 _ = player2.Center;
46500 }
46501 if (velocity.Y == 0f)
46502 {
46503 ai[0] = 0f;
46504 ai[1] = 0f;
46505 ai[2] = 0f;
46506 netUpdate = true;
46508 if (Main.netMode != 1)
46509 {
46510 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Bottom, Vector2.Zero, 922, num11, 0f, Main.myPlayer);
46511 }
46512 for (int l = 0; l < 20; l++)
46513 {
46514 int num14 = Dust.NewDust(base.Bottom - new Vector2((float)(width / 2), 30f), width, 30, 31, velocity.X, velocity.Y, 40, AI_121_QueenSlime_GetDustColor());
46515 Main.dust[num14].noGravity = true;
46516 Main.dust[num14].velocity.Y = -5f + Main.rand.NextFloat() * -3f;
46517 Main.dust[num14].velocity.X *= 7f;
46518 }
46519 }
46520 else if (ai[1] >= (float)num13)
46521 {
46522 for (int m = 0; m < 4; m++)
46523 {
46524 Vector2 vector3 = base.Bottom - new Vector2(Main.rand.NextFloatDirection() * 16f, (float)Main.rand.Next(8));
46525 int num15 = Dust.NewDust(vector3, 2, 2, 31, velocity.X, velocity.Y, 40, AI_121_QueenSlime_GetDustColor(), 1.4f);
46526 Main.dust[num15].position = vector3;
46527 Main.dust[num15].noGravity = true;
46528 Main.dust[num15].velocity.Y = velocity.Y * 0.9f;
46529 Main.dust[num15].velocity.X = ((Main.rand.Next(2) == 0) ? (-10f) : 10f) + Main.rand.NextFloatDirection() * 3f;
46530 }
46531 }
46532 velocity.X *= 0.8f;
46533 float num16 = ai[1];
46534 ai[1] += 1f;
46535 if (ai[1] >= (float)num13)
46536 {
46537 if (num16 < (float)num13)
46538 {
46539 netUpdate = true;
46540 }
46541 if (flag2 && ai[1] > (float)(num13 + 120))
46542 {
46543 ai[0] = 0f;
46544 ai[1] = 0f;
46545 ai[2] = 0f;
46546 velocity.Y *= 0.8f;
46547 netUpdate = true;
46548 break;
46549 }
46550 velocity.Y += 1f;
46551 float num17 = 14f;
46552 if (Main.getGoodWorld)
46553 {
46554 velocity.Y += 1f;
46555 num17 = 15.99f;
46556 }
46557 if (velocity.Y == 0f)
46558 {
46559 velocity.Y = 0.01f;
46560 }
46561 if (velocity.Y >= num17)
46562 {
46563 velocity.Y = num17;
46564 }
46565 }
46566 else
46567 {
46568 velocity.Y *= 0.8f;
46569 }
46570 break;
46571 }
46572 if (Main.netMode != 1 && ai[1] == 0f)
46573 {
46574 TargetClosest();
46575 netUpdate = true;
46576 }
46577 ai[1] += 1f;
46578 if (!(ai[1] >= 30f))
46579 {
46580 break;
46581 }
46582 if (ai[1] >= 60f)
46583 {
46584 ai[1] = 60f;
46585 if (Main.netMode != 1)
46586 {
46587 ai[1] = 0f;
46588 ai[2] = 1f;
46589 velocity.Y = -3f;
46590 netUpdate = true;
46591 }
46592 }
46593 Player player3 = Main.player[target];
46594 Vector2 center = base.Center;
46595 if (!player3.dead && player3.active && Math.Abs(base.Center.X - player3.Center.X) / 16f <= (float)num27)
46596 {
46597 center = player3.Center;
46598 }
46599 center.Y -= 384f;
46600 if (velocity.Y == 0f)
46601 {
46602 velocity = center - base.Center;
46603 velocity = velocity.SafeNormalize(Vector2.Zero);
46604 velocity *= 20f;
46605 }
46606 else
46607 {
46608 velocity.Y *= 0.95f;
46609 }
46610 break;
46611 }
46612 case 5:
46613 {
46614 rotation *= 0.9f;
46615 noTileCollide = true;
46616 noGravity = true;
46617 if (flag2)
46618 {
46619 ai[3] = 0f;
46620 }
46621 if (ai[2] == 1f)
46622 {
46623 ai[1] += 1f;
46624 if (!(ai[1] >= 10f))
46625 {
46626 break;
46627 }
46628 if (Main.netMode != 1)
46629 {
46630 int num6 = 10;
46631 if (Main.getGoodWorld)
46632 {
46633 num6 = 15;
46634 }
46635 int num7 = num6;
46636 if (!flag2)
46637 {
46638 num7 = 6;
46639 }
46640 Vector2 spinningpoint = default(Vector2);
46641 for (int j = 0; j < num7; j++)
46642 {
46643 ((Vector2)(ref spinningpoint))._002Ector(9f, 0f);
46644 spinningpoint = spinningpoint.RotatedBy((float)(-j) * ((float)Math.PI * 2f) / (float)num6, Vector2.Zero);
46645 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, spinningpoint.X, spinningpoint.Y, 926, num, 0f, Main.myPlayer);
46646 }
46647 }
46648 ai[0] = 0f;
46649 ai[1] = 0f;
46650 ai[2] = 0f;
46651 netUpdate = true;
46652 break;
46653 }
46654 if (Main.netMode != 1 && ai[1] == 0f)
46655 {
46656 TargetClosest();
46657 netUpdate = true;
46658 }
46659 ai[1] += 1f;
46660 if (ai[1] >= 50f)
46661 {
46662 ai[1] = 50f;
46663 if (Main.netMode != 1)
46664 {
46665 ai[1] = 0f;
46666 ai[2] = 1f;
46667 netUpdate = true;
46668 }
46669 }
46670 float num8 = 100f;
46671 for (int k = 0; k < 4; k++)
46672 {
46673 Vector2 vector2 = base.Center + Main.rand.NextVector2CircularEdge(num8, num8);
46674 if (!flag2)
46675 {
46676 vector2 += new Vector2(0f, 20f);
46677 }
46678 Vector2 v = vector2 - base.Center;
46679 v = v.SafeNormalize(Vector2.Zero) * -8f;
46680 int num9 = Dust.NewDust(vector2, 2, 2, 31, v.X, v.Y, 40, AI_121_QueenSlime_GetDustColor(), 1.8f);
46681 Main.dust[num9].position = vector2;
46682 Main.dust[num9].noGravity = true;
46683 Main.dust[num9].alpha = 250;
46684 Main.dust[num9].velocity = v;
46685 Main.dust[num9].customData = this;
46686 }
46687 if (flag2)
46688 {
46690 }
46691 break;
46692 }
46693 }
46694 dontTakeDamage = (hide = flag);
46695 if (num22 != scale)
46696 {
46697 position.X += width / 2;
46698 position.Y += height;
46699 scale = num22;
46700 width = (int)(114f * scale);
46701 height = (int)(100f * scale);
46702 position.X -= width / 2;
46703 position.Y -= height;
46704 }
46705 if (life <= 0)
46706 {
46707 return;
46708 }
46709 if (Main.rand.Next(360) == 0)
46710 {
46712 }
46713 if (Main.netMode == 1)
46714 {
46715 return;
46716 }
46717 if (localAI[0] >= (float)(lifeMax / 2) && life < lifeMax / 2)
46718 {
46719 localAI[0] = life;
46720 ai[0] = 0f;
46721 ai[1] = 0f;
46722 ai[2] = 0f;
46723 netUpdate = true;
46724 }
46725 int num21 = (int)((float)lifeMax * 0.02f);
46726 if (flag2)
46727 {
46728 num21 = (int)((float)lifeMax * 0.015f);
46729 }
46730 if (!((float)(life + num21) < localAI[0]))
46731 {
46732 return;
46733 }
46734 localAI[0] = life;
46735 int num23 = Main.rand.Next(1, 3);
46736 for (int num24 = 0; num24 < num23; num24++)
46737 {
46738 int x = (int)(position.X + (float)Main.rand.Next(width - 32));
46739 int y = (int)(position.Y + (float)Main.rand.Next(height - 32));
46740 int num25 = 658;
46741 switch (Main.rand.Next(3))
46742 {
46743 case 0:
46744 num25 = 658;
46745 break;
46746 case 1:
46747 num25 = 659;
46748 break;
46749 case 2:
46750 num25 = 660;
46751 break;
46752 }
46754 Main.npc[num26].SetDefaults(num25);
46755 Main.npc[num26].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f;
46756 Main.npc[num26].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f;
46757 Main.npc[num26].ai[0] = -500 * Main.rand.Next(3);
46758 Main.npc[num26].ai[1] = 0f;
46759 if (Main.netMode == 2 && num26 < 200)
46760 {
46761 NetMessage.SendData(23, -1, -1, null, num26);
46762 }
46763 }
46764 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
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
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
static readonly SoundStyle Item167
Definition SoundID.cs:1011
int timeLeft
Definition NPC.cs:1017
float[] localAI
Acts like F:Terraria.NPC.ai, but does not sync to the server. Many vanilla T:Terraria....
Definition NPC.cs:1003
void EncourageDespawn(int despawnTime)
Definition NPC.cs:2199
int lifeMax
The maximum life of this NPC.
Definition NPC.cs:1077
void TargetClosest(bool faceTarget=true)
Definition NPC.cs:83247
static Color AI_121_QueenSlime_GetDustColor()
Definition NPC.cs:45818
bool hide
Indicates that this NPC is drawn at a specific layer in the render order. Must use in conjunction wit...
Definition NPC.cs:1098
void AI_121_QueenSlime_FlyMovement()
Definition NPC.cs:45834
bool noGravity
If true, the npc will not be affected by gravity. Demon Eyes and other floating npc use this....
Definition NPC.cs:1122
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 dontTakeDamage
Definition NPC.cs:1160
float scale
Makes the NPC bigger or smaller. Bigger than 1f is bigger. Defaults to 1f.
Definition NPC.cs:1104
float rotation
Definition NPC.cs:1116
IEntitySource GetSpawnSourceForNPCFromNPCAI()
Definition NPC.cs:107568
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)
Spawns an NPC into the game world with the given type. This method should not be called on multipla...
Definition NPC.cs:91239
bool noTileCollide
If true, the npc does not collide with tiles, making the npc pass through tiles freely....
Definition NPC.cs:1128
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
bool netUpdate
Definition NPC.cs:1130
int target
Definition NPC.cs:1019

References Terraria.Entity.active, Terraria.Lighting.AddLight(), Terraria.NPC.ai, Terraria.NPC.AI_121_QueenSlime_FlyMovement(), Terraria.NPC.AI_121_QueenSlime_GetDustColor(), Terraria.Entity.Bottom, Terraria.Collision.CanHitLine(), Terraria.Entity.Center, Terraria.Player.dead, Terraria.Entity.direction, Terraria.NPC.dontTakeDamage, Terraria.Main.dust, Terraria.NPC.EncourageDespawn(), Terraria.Main.expertMode, Terraria.Player.FindClosest(), Terraria.Main.getGoodWorld, Terraria.NPC.GetSpawnSource_ForProjectile(), Terraria.NPC.GetSpawnSourceForNPCFromNPCAI(), Terraria.Entity.height, Terraria.NPC.hide, Terraria.ID.SoundID.Item167, Terraria.NPC.life, Terraria.NPC.lifeMax, Terraria.NPC.localAI, Terraria.Main.maxTilesY, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.NPC.netUpdate, Terraria.Dust.NewDust(), Terraria.Gore.NewGore(), Terraria.NPC.NewNPC(), Terraria.Projectile.NewProjectile(), Terraria.NPC.noGravity, Terraria.NPC.noTileCollide, Terraria.Main.npc, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Main.rand, Terraria.NPC.rotation, Terraria.NPC.scale, Terraria.NetMessage.SendData(), Terraria.NPC.target, Terraria.NPC.TargetClosest(), Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, Terraria.NPC.timeLeft, Terraria.Entity.velocity, and Terraria.Entity.width.

Referenced by Terraria.NPC.VanillaAI_Inner().

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