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

◆ AI_107_ImprovedWalkers()

void Terraria.NPC.AI_107_ImprovedWalkers ( )
inlineprivate

Definition at line 55138 of file NPC.cs.

55139 {
55140 //IL_16d7: Unknown result type (might be due to invalid IL or missing references)
55141 //IL_0890: Unknown result type (might be due to invalid IL or missing references)
55142 //IL_0895: Unknown result type (might be due to invalid IL or missing references)
55143 //IL_08a6: Unknown result type (might be due to invalid IL or missing references)
55144 //IL_08ab: Unknown result type (might be due to invalid IL or missing references)
55145 //IL_139a: Unknown result type (might be due to invalid IL or missing references)
55146 //IL_139f: Unknown result type (might be due to invalid IL or missing references)
55147 //IL_08d6: Unknown result type (might be due to invalid IL or missing references)
55148 //IL_08f5: Unknown result type (might be due to invalid IL or missing references)
55149 //IL_23c4: Unknown result type (might be due to invalid IL or missing references)
55150 //IL_145b: Unknown result type (might be due to invalid IL or missing references)
55151 //IL_1e7c: Unknown result type (might be due to invalid IL or missing references)
55152 //IL_196e: Unknown result type (might be due to invalid IL or missing references)
55153 //IL_147d: Unknown result type (might be due to invalid IL or missing references)
55154 //IL_1482: Unknown result type (might be due to invalid IL or missing references)
55155 //IL_0f7b: Unknown result type (might be due to invalid IL or missing references)
55156 //IL_0f80: Unknown result type (might be due to invalid IL or missing references)
55157 //IL_0509: Unknown result type (might be due to invalid IL or missing references)
55158 //IL_05f1: Unknown result type (might be due to invalid IL or missing references)
55159 //IL_0589: Unknown result type (might be due to invalid IL or missing references)
55160 //IL_1e9e: Unknown result type (might be due to invalid IL or missing references)
55161 //IL_0813: Unknown result type (might be due to invalid IL or missing references)
55162 //IL_0f9d: Unknown result type (might be due to invalid IL or missing references)
55163 //IL_0fa2: Unknown result type (might be due to invalid IL or missing references)
55164 //IL_0835: Unknown result type (might be due to invalid IL or missing references)
55165 //IL_10a1: Unknown result type (might be due to invalid IL or missing references)
55166 //IL_0fe2: Unknown result type (might be due to invalid IL or missing references)
55167 //IL_0fe7: Unknown result type (might be due to invalid IL or missing references)
55168 //IL_1003: Unknown result type (might be due to invalid IL or missing references)
55169 //IL_1008: Unknown result type (might be due to invalid IL or missing references)
55170 //IL_10c3: Unknown result type (might be due to invalid IL or missing references)
55171 //IL_10c8: Unknown result type (might be due to invalid IL or missing references)
55172 //IL_10e9: Unknown result type (might be due to invalid IL or missing references)
55173 //IL_110b: Unknown result type (might be due to invalid IL or missing references)
55174 //IL_1110: Unknown result type (might be due to invalid IL or missing references)
55175 //IL_2c37: Unknown result type (might be due to invalid IL or missing references)
55176 //IL_0f1e: Unknown result type (might be due to invalid IL or missing references)
55177 bool flag = velocity.X == 0f && velocity.Y == 0f && !justHit;
55178 bool flag2 = false;
55179 bool flag3 = false;
55180 bool flag4 = false;
55181 int num = 32;
55182 int num2 = 15;
55183 float num3 = 9f;
55184 bool flag5 = false;
55185 float num4 = 40f;
55186 int num5 = 30;
55187 int num6 = 0;
55188 bool flag6 = false;
55189 bool flag7 = true;
55190 float num7 = 0.9f;
55191 bool flag8 = false;
55192 bool flag9 = false;
55193 bool flag10 = false;
55194 bool flag11 = false;
55195 bool flag12 = false;
55196 bool flag13 = false;
55197 bool flag14 = false;
55198 bool flag15 = true;
55199 int num8 = 70;
55200 int num9 = num8 / 2;
55201 float num10 = 11f;
55203 int num11 = 1;
55204 int num12 = 81;
55205 float num13 = 700f;
55206 float num14 = 0f;
55207 float num15 = 0.1f;
55208 Vector2? vector2 = null;
55209 float num16 = 0.5f;
55210 int num17 = 1;
55211 float num18 = 1f;
55212 bool flag16 = false;
55213 float num19 = 30f;
55214 float num20 = 0f;
55215 bool flag17 = false;
55216 bool flag18 = true;
55217 bool flag19 = false;
55218 int num21 = 30;
55219 bool flag20 = false;
55220 bool flag21 = false;
55221 bool flag22 = false;
55222 bool flag23 = false;
55223 LegacySoundStyle style = null;
55224 int num22 = 0;
55225 bool flag24 = false;
55226 float num23 = 1f;
55227 float num24 = 0.07f;
55228 float num25 = 0.8f;
55229 float num26 = width / 2 + 6;
55230 bool flag25 = directionY < 0;
55231 bool flag26 = false;
55232 int num27 = 1;
55233 bool flag27 = false;
55234 float num28 = 5f;
55235 float num29 = 3f;
55236 float num30 = 8f;
55237 float amount = 0.05f;
55238 float amount2 = 0.04f;
55239 float amount3 = 0.1f;
55240 bool flag28 = false;
55241 float num31 = 0.025f;
55243 NPCUtils.NPCTargetingMethod nPCTargetingMethod = NPCUtils.TargetClosestCommon;
55245 {
55247 }
55248 if (targetData.Type == NPCTargetType.NPC && Main.npc[TranslatedTargetIndex].type == 548 && Main.npc[TranslatedTargetIndex].dontTakeDamageFromHostiles)
55249 {
55252 }
55254 {
55255 if (!targetData.Invalid)
55256 {
55257 flag2 = !Collision.CanHit(base.Center, 0, 0, targetData.Center, 0, 0) && (direction == Math.Sign(targetData.Center.X - base.Center.X) || (noGravity && Distance(targetData.Center) > 50f && base.Center.Y > targetData.Center.Y));
55258 }
55259 flag2 &= ai[0] <= 0f;
55260 }
55261 if (flag2)
55262 {
55263 if (velocity.Y == 0f || Math.Abs(targetData.Center.Y - base.Center.Y) > 800f)
55264 {
55265 noGravity = true;
55266 noTileCollide = true;
55267 }
55268 }
55269 else
55270 {
55271 noGravity = false;
55272 noTileCollide = false;
55273 }
55275 bool flag30 = true;
55276 SlotId val;
55277 switch (type)
55278 {
55279 case 576:
55280 case 577:
55281 num22 = 700;
55282 style = SoundID.DD2_OgreRoar;
55283 num26 -= 32f;
55284 flag5 = true;
55285 num6 = 60;
55286 num4 = 130f;
55287 num5 = 44;
55289 num7 = 0.7f;
55290 if (localAI[0] > 0f)
55291 {
55292 localAI[0] -= 1f;
55293 }
55294 if (ai[0] <= 0f)
55295 {
55296 float num34 = ai[1];
55297 float num35 = Distance(targetData.Center);
55298 if (localAI[3] >= 60f)
55299 {
55300 if (num35 <= num4 + 300f && localAI[0] <= 0f)
55301 {
55302 ai[1] = 2f;
55303 }
55304 else if (num35 > num4 + 30f)
55305 {
55306 ai[1] = 1f;
55307 }
55308 else if (!(num35 > num4))
55309 {
55310 ai[1] = 0f;
55311 if (num34 == 1f)
55312 {
55313 ai[0] = 0f;
55314 }
55315 }
55316 }
55317 if (num34 != ai[1])
55318 {
55319 netUpdate = true;
55320 }
55321 }
55322 else if (ai[1] == 2f)
55323 {
55324 localAI[0] = 300f;
55325 }
55326 switch ((int)ai[1])
55327 {
55328 case 0:
55329 num5 = 44;
55330 if (ai[0] == 40f)
55331 {
55333 }
55334 break;
55335 case 2:
55336 num5 = 90;
55337 num4 = 250f;
55338 flag4 = true;
55340 num9 = 36;
55341 num = 56;
55342 num2 = 41;
55343 num3 = 13f;
55344 flag3 = true;
55345 num12 = 683;
55346 flag15 = false;
55347 vector = new Vector2(-direction * 20, height / 2 - 1);
55348 if (ai[0] == 40f)
55349 {
55351 }
55352 break;
55353 case 1:
55354 flag3 = true;
55355 num5 = 90;
55356 num4 = 1000f;
55357 num6 = 240;
55359 flag15 = false;
55360 vector = new Vector2(direction * 30, -70f);
55361 num12 = 676;
55362 if (ai[0] == 80f)
55363 {
55365 }
55366 break;
55367 }
55368 if (ai[0] < (float)(-num6))
55369 {
55370 ai[0] = -num6;
55371 }
55372 break;
55373 case 552:
55374 case 553:
55375 case 554:
55376 style = SoundID.DD2_GoblinScream;
55377 num22 = 1000;
55378 flag5 = true;
55380 if (type == 553)
55381 {
55382 num24 += 0.01f;
55383 num23 += 0.2f;
55384 }
55385 if (type == 554)
55386 {
55387 num24 += 0.02f;
55388 num23 += 0.4f;
55389 }
55390 if (!(localAI[3] >= 60f))
55391 {
55392 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55393 }
55394 break;
55395 case 570:
55396 case 571:
55398 flag24 = true;
55399 flag12 = true;
55400 flag15 = ai[1] > 40f;
55401 num8 = 60;
55402 num9 = 40;
55403 if (type == 571 && ai[1] > 10f && ai[1] <= 40f && (int)ai[1] % 6 == 0)
55404 {
55405 num9 = (int)ai[1] - 1;
55406 }
55407 if (type == 570 && ai[1] > 10f && ai[1] <= 40f && (int)ai[1] % 9 == 0)
55408 {
55409 num9 = (int)ai[1] - 1;
55410 }
55411 num12 = 671;
55412 vector.X += 22 * direction;
55413 num15 = 0.15f;
55414 num16 = 1.5f;
55415 num13 = 600f;
55416 num10 = 13f;
55417 num17 = 1;
55418 num18 = 0f;
55419 if (type == 570)
55420 {
55421 num16 = 2.5f;
55422 }
55424 if (type == 571)
55425 {
55427 }
55428 num23 = 0.77f;
55429 if (ai[0] > 0f)
55430 {
55431 if (ai[1] == 40f)
55432 {
55434 }
55435 else if (ai[1] == 60f)
55436 {
55438 }
55439 }
55440 if (!(localAI[3] >= 60f))
55441 {
55442 num13 = 1f;
55443 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55444 }
55445 break;
55446 case 572:
55447 case 573:
55448 if (localAI[3] == 0f)
55449 {
55450 float[] array = localAI;
55451 val = SlotId.Invalid;
55452 array[0] = ((SlotId)(ref val)).ToFloat();
55453 float[] array2 = localAI;
55454 val = SlotId.Invalid;
55455 array2[1] = ((SlotId)(ref val)).ToFloat();
55456 }
55458 if (ai[1] == 2f)
55459 {
55462 position = base.Center;
55463 width = (height = 192);
55464 base.Center = position;
55467 alpha = 255;
55468 for (int k = 0; k < 4; k++)
55469 {
55470 int num37 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
55471 Main.dust[num37].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
55472 }
55473 for (int l = 0; l < 20; l++)
55474 {
55475 int num38 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 200, default(Color), 3.7f);
55476 Main.dust[num38].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
55477 Main.dust[num38].noGravity = true;
55478 Main.dust[num38].velocity *= 3f;
55479 num38 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
55480 Main.dust[num38].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 4f;
55481 Main.dust[num38].velocity *= 2f;
55482 Main.dust[num38].noGravity = true;
55483 Main.dust[num38].fadeIn = 2.5f;
55484 }
55485 for (int m = 0; m < 6; m++)
55486 {
55487 int num39 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 0, default(Color), 2.7f);
55488 Main.dust[num39].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
55489 Main.dust[num39].noGravity = true;
55490 Main.dust[num39].velocity *= 3f;
55491 }
55492 for (int n = 0; n < 12; n++)
55493 {
55494 int num40 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
55495 Main.dust[num40].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
55496 Main.dust[num40].noGravity = true;
55497 Main.dust[num40].velocity *= 3f;
55498 }
55499 for (int num41 = 0; num41 < 5; num41++)
55500 {
55501 int num42 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
55502 Main.gore[num42].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
55503 Main.gore[num42].velocity *= 0.3f;
55504 Main.gore[num42].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
55505 Main.gore[num42].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
55506 }
55507 ai[0] += 1f;
55508 if (ai[0] >= 3f)
55509 {
55511 life = 0;
55512 HitEffect();
55513 active = false;
55514 }
55515 return;
55516 }
55517 if (ai[0] > 0f && ai[1] == 0f && life > 0)
55518 {
55520 if (!((SlotId)(ref val2)).IsValid)
55521 {
55522 float[] array3 = localAI;
55524 array3[0] = ((SlotId)(ref val)).ToFloat();
55525 }
55526 localAI[2] += 1f;
55527 if (localAI[2] == 30f)
55528 {
55529 float[] array4 = localAI;
55531 array4[0] = ((SlotId)(ref val)).ToFloat();
55532 float[] array5 = localAI;
55534 array5[1] = ((SlotId)(ref val)).ToFloat();
55535 }
55536 }
55537 if (ai[0] > 0f && ai[1] == 1f)
55538 {
55539 ai[0] = 0f;
55540 ai[1] = 2f;
55541 netUpdate = true;
55542 return;
55543 }
55544 num23 = 0.88f;
55545 if (ai[0] == 1f)
55546 {
55547 ai[1] = 1f;
55548 }
55549 if (ai[0] == 0f && ai[1] == 1f)
55550 {
55552 if (activeSound == null)
55553 {
55554 float[] array6 = localAI;
55556 array6[0] = ((SlotId)(ref val)).ToFloat();
55557 }
55558 else
55559 {
55560 activeSound.Position = base.Center;
55561 }
55563 if (activeSound2 == null)
55564 {
55565 float[] array7 = localAI;
55567 array7[1] = ((SlotId)(ref val)).ToFloat();
55568 }
55569 else
55570 {
55571 activeSound2.Position = base.Center;
55572 }
55573 }
55574 if (ai[1] > 0f && ai[0] == 0f)
55575 {
55576 flag5 = true;
55577 num5 = 40;
55578 num4 = 64f;
55579 num24 = 0.3f;
55580 num23 = 4f;
55581 Vector2 vector3 = base.Center + new Vector2(spriteDirection * 12, 0f);
55582 if (Main.rand.Next(6) == 0)
55583 {
55584 Dust dust3 = Dust.NewDustDirect(vector3, 1, 1, 213, Main.rand.Next(-2, 3), Main.rand.Next(-2, 3), 100, new Color(255, 255, 255, 0));
55585 dust3.noGravity = true;
55586 dust3.fadeIn = dust3.scale + 1f + 0.01f * (float)Main.rand.Next(0, 51);
55587 dust3.velocity *= 0.3f;
55588 dust3.velocity.X += (float)(-spriteDirection) * 1.2f;
55589 dust3.velocity.Y += -3.5f;
55590 dust3.velocity.X += velocity.X;
55591 }
55592 if (Main.rand.Next(12) == 0)
55593 {
55594 Dust dust4 = Dust.NewDustPerfect(vector3, 6, velocity, 100);
55595 dust4.noGravity = true;
55596 dust4.velocity.Y -= 1f + Main.rand.NextFloat();
55597 dust4.scale = 1.1f;
55598 dust4.fadeIn = 0.5f;
55599 dust4.customData = this;
55600 }
55601 }
55602 else
55603 {
55604 flag5 = true;
55605 num5 = 40;
55606 num4 = 700f;
55607 }
55608 if (!(localAI[3] >= 60f))
55609 {
55610 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55611 }
55612 break;
55613 case 568:
55614 case 569:
55615 {
55616 num5 = 110;
55617 num24 = 0.16f;
55618 num25 = 0.7f;
55619 num23 = 1.4f;
55620 flag5 = true;
55621 num4 = 600f;
55623 if (!(localAI[3] >= 60f))
55624 {
55625 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55626 }
55627 if (ai[0] == 0f)
55628 {
55629 float[] array8 = localAI;
55630 val = SlotId.Invalid;
55631 array8[1] = ((SlotId)(ref val)).ToFloat();
55632 }
55633 if (ai[0] != 1f)
55634 {
55635 break;
55636 }
55638 ai[0] += 1f;
55639 if (Main.rand.Next(10) == 0)
55640 {
55641 Dust dust7 = Dust.NewDustDirect(base.TopLeft, width, height, 271, 0f, -3f, 0, Color.Transparent, 0.6f);
55642 dust7.velocity.X /= 2f;
55643 dust7.noGravity = true;
55644 dust7.fadeIn = 1.5f;
55645 dust7.position.Y += 4f;
55646 }
55648 if (activeSound3 == null)
55649 {
55650 float[] array9 = localAI;
55652 array9[1] = ((SlotId)(ref val)).ToFloat();
55653 }
55654 else
55655 {
55656 activeSound3.Position = base.Center;
55657 }
55658 localAI[0] += 1f;
55659 if (localAI[0] > 60f && Main.rand.Next(10) == 0)
55660 {
55661 Vector2 vec = base.Center + (Main.rand.NextFloat() * ((float)Math.PI * 2f)).ToRotationVector2() * 400f * (0.3f + 0.7f * Main.rand.NextFloat());
55662 Point point = vec.ToTileCoordinates();
55663 if (!WorldGen.SolidTile(point.X, point.Y))
55664 {
55665 Dust dust8 = Dust.NewDustPerfect(vec, 27, new Vector2(0f, -3f), 0, new Color(255, 255, 255, 127), 1.5f);
55666 dust8.velocity = DirectionTo(dust8.position) * dust8.velocity.Length();
55667 dust8.fadeIn = 1.5f;
55668 }
55669 }
55670 if (Main.netMode != 2)
55671 {
55672 Player player = Main.player[Main.myPlayer];
55673 if (!player.dead && player.active && (player.Center - base.Center).Length() < 400f && !player.creativeGodMode)
55674 {
55675 player.AddBuff(195, 3, quiet: false);
55676 }
55677 }
55678 if (ai[1] > 0f)
55679 {
55680 ai[1] -= 1f;
55681 }
55682 if (!(ai[1] <= 0f))
55683 {
55684 break;
55685 }
55686 ai[1] = 60f;
55687 if (Main.netMode != 1)
55688 {
55689 int num51 = lifeMax / 20;
55690 if (num51 > lifeMax - life)
55691 {
55692 num51 = lifeMax - life;
55693 }
55694 if (num51 > 0)
55695 {
55696 life += num51;
55698 netUpdate = true;
55699 }
55700 }
55701 break;
55702 }
55703 case 561:
55704 case 562:
55705 case 563:
55706 {
55707 bool num36 = localAI[3] >= 60f;
55708 if (ai[1] == 82f)
55709 {
55711 num22 = 7;
55713 }
55715 flag24 = true;
55716 flag12 = true;
55717 flag15 = ai[1] > 82f;
55718 num8 = 90;
55719 num9 = 82;
55720 num12 = 662;
55721 if (type == 563)
55722 {
55723 num12 = 685;
55724 }
55725 vector.Y -= 14f;
55726 num15 = 0f;
55727 num16 = 0.5f;
55728 num13 = 600f;
55729 num10 = 13f;
55730 if (!num36)
55731 {
55732 num13 = 1f;
55733 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55734 }
55735 if (type == 561)
55736 {
55737 num23 = 0.88f;
55738 num16 = 0.6f;
55740 num10 = 11.5f;
55741 num13 -= 100f;
55742 }
55743 if (type == 562)
55744 {
55745 num23 = 0.94f;
55746 num16 = 0.5f;
55748 num10 = 12.2f;
55749 num13 -= 50f;
55750 }
55751 if (type == 563)
55752 {
55753 num23 = 1f;
55754 num16 = 0.4f;
55756 }
55757 break;
55758 }
55759 case 555:
55760 case 556:
55761 case 557:
55762 {
55763 num22 = 800;
55765 bool num33 = localAI[3] >= 60f;
55767 flag24 = true;
55768 flag12 = true;
55769 flag15 = ai[1] > 18f;
55770 num8 = 42;
55771 num9 = 18;
55772 num12 = 681;
55773 num11 = 10;
55774 vector.Y -= 14f;
55775 num15 = 0.4f;
55776 num16 = 0.5f;
55777 num13 = 280f;
55778 num10 = 6f;
55779 if (!num33)
55780 {
55781 num13 = 1f;
55782 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55783 }
55784 if (type == 555)
55785 {
55786 num23 = 0.88f;
55787 num16 = 0.6f;
55789 }
55790 if (type == 556)
55791 {
55792 num23 = 0.88f;
55793 num16 = 0.6f;
55795 }
55796 if (type == 557)
55797 {
55798 num23 = 1.12f;
55799 num16 = 0.4f;
55801 }
55802 if (ai[1] == (float)num9)
55803 {
55805 }
55806 break;
55807 }
55808 case 566:
55809 case 567:
55810 {
55811 DelegateMethods.v3_1 = new Vector3(0.3f, 0.05f, 0.45f) * 1.5f;
55812 Utils.PlotTileLine(base.Top, base.Bottom, width, DelegateMethods.CastLightOpen);
55814 bool num43 = localAI[3] >= 120f;
55815 if (!num43)
55816 {
55817 num24 = 0f;
55818 }
55819 if (num43)
55820 {
55821 dontTakeDamage = false;
55822 break;
55823 }
55824 dontTakeDamage = true;
55825 velocity.X = 0f;
55826 flag24 = true;
55827 flag20 = true;
55828 ai[3] = 0f;
55829 if (localAI[3] == 0f)
55830 {
55831 alpha = 255;
55832 }
55833 localAI[3] += 1f;
55834 float num44 = localAI[3];
55835 if (num44 >= 110f)
55836 {
55837 alpha -= 26;
55838 if (alpha < 0)
55839 {
55840 alpha = 0;
55841 }
55842 }
55843 if (num44 >= 100f)
55844 {
55845 int num45 = (int)localAI[3] / 20;
55846 float num46 = base.Size.Length() / 2f;
55847 num46 /= 20f;
55848 int maxValue = 5;
55849 for (int num47 = 0; num47 < num45 * 2; num47++)
55850 {
55851 if (Main.rand.Next(maxValue) == 0)
55852 {
55853 Dust dust5 = Dust.NewDustDirect(position, width, height, 236, velocity.X * 1f);
55854 dust5.scale = 1f;
55855 dust5.fadeIn = 0.3f;
55856 dust5.velocity = new Vector2(Main.rand.NextFloatDirection() * 1f, 0f - dust5.velocity.Length()) * 1.25f * num46;
55857 }
55858 }
55859 }
55860 else
55861 {
55862 int num48 = (int)localAI[3] / 10;
55863 float num49 = base.Size.Length() / 2f;
55864 num49 /= 20f;
55865 int maxValue2 = 5;
55866 for (int num50 = 0; (float)num50 < (float)num48 * 1.3f; num50++)
55867 {
55868 if (Main.rand.Next(maxValue2) == 0)
55869 {
55870 Dust dust6 = Dust.NewDustDirect(position + new Vector2(-width / 2, 8f), width + width, height, 27, velocity.X * 1f, 0f, 100);
55871 dust6.scale = 1.1f;
55872 dust6.fadeIn = 0.1f;
55873 dust6.velocity = new Vector2(Main.rand.NextFloatDirection() * 0.1f, 0f - dust6.velocity.Length()) * 1.05f * num49 * Main.rand.NextFloat();
55874 dust6.velocity.Y *= Utils.GetLerpValue((float)width * 0.75f, 0f, Math.Abs(dust6.position.X - base.Center.X), clamped: true);
55875 }
55876 }
55877 }
55878 if (num44 > 100f && (int)num44 % 4 == 0)
55879 {
55880 Gore.NewGoreDirect(base.Left, new Vector2(0f, -3f), Utils.SelectRandom<int>(Main.rand, 971, 972), 0.85f).velocity.X *= 0.8f;
55881 }
55882 break;
55883 }
55884 case 620:
55885 {
55886 flag27 = wet;
55887 flag30 = false;
55888 flag16 = true;
55889 num20 = 150f;
55890 num19 = 20f;
55891 bool dayTime = Main.dayTime;
55892 flag21 = !dayTime;
55893 flag24 = true;
55894 flag12 = true;
55895 flag15 = ai[1] > 40f;
55896 num8 = 60;
55897 num9 = 40;
55898 if (ai[1] > 10f && ai[1] <= 40f && (int)ai[1] % 5 == 0)
55899 {
55900 num9 = (int)ai[1] - 1;
55901 }
55902 num12 = 811;
55903 vector.X -= 4 * direction;
55904 vector.Y -= 20f;
55905 num15 = 0.15f;
55906 num16 = 2.5f;
55907 num13 = 600f;
55908 num10 = 13f;
55909 num17 = 1;
55910 num18 = 0f;
55912 num23 = 8f;
55913 num24 *= 3f;
55914 num25 = 0.9f;
55915 if (ai[0] > 0f)
55916 {
55917 if (ai[1] == 40f)
55918 {
55920 }
55921 else if (ai[1] == 60f)
55922 {
55924 }
55925 }
55927 if (alpha == 255)
55928 {
55930 velocity.Y = -6f;
55931 netUpdate = true;
55932 for (int i = 0; i < 35; i++)
55933 {
55934 Dust dust = Dust.NewDustDirect(position, width, height, 5);
55935 dust.velocity *= 1f;
55936 dust.scale = 1f + Main.rand.NextFloat() * 0.5f;
55937 dust.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
55938 dust.velocity += velocity * 0.5f;
55939 }
55940 }
55941 alpha -= 15;
55942 if (alpha < 0)
55943 {
55944 alpha = 0;
55945 }
55946 if (alpha != 0)
55947 {
55948 for (int j = 0; j < 2; j++)
55949 {
55950 Dust dust2 = Dust.NewDustDirect(position, width, height, 5);
55951 dust2.velocity *= 1f;
55952 dust2.scale = 1f + Main.rand.NextFloat() * 0.5f;
55953 dust2.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
55954 dust2.velocity += velocity * 0.3f;
55955 }
55956 }
55957 if (Main.rand.Next(3) == 0)
55958 {
55959 Dust.NewDustDirect(position, width, height, 5, 0f, 0f, 50, default(Color), 1.3f).velocity = Vector2.Zero;
55960 }
55962 if (dayTime)
55963 {
55964 flag12 = false;
55965 flag24 = false;
55966 flag23 = true;
55967 }
55968 else
55969 {
55970 if (velocity.Y != 0f || !((float)targetData.Hitbox.Bottom < base.Top.Y) || !(Math.Abs(base.Center.X - (float)targetData.Hitbox.Center.X) < (float)(width * 3)) || !Collision.CanHit(base.Hitbox.TopLeft(), base.Hitbox.Width, base.Hitbox.Height, targetData.Hitbox.TopLeft(), targetData.Hitbox.Width, targetData.Hitbox.Height))
55971 {
55972 break;
55973 }
55974 int num32 = (int)((base.Bottom.Y - 16f - (float)targetData.Hitbox.Bottom) / 16f);
55975 if (num32 < 27)
55976 {
55977 if (num32 < 11)
55978 {
55979 velocity.Y = -11f;
55980 }
55981 else if (num32 < 15)
55982 {
55983 velocity.Y = -13f;
55984 }
55985 else if (num32 < 19)
55986 {
55987 velocity.Y = -14f;
55988 }
55989 else
55990 {
55991 velocity.Y = -15.9f;
55992 }
55993 }
55994 }
55995 break;
55996 }
55997 }
55998 if (flag28)
55999 {
56000 bool flag31 = velocity.Y == 0f;
56001 for (int num52 = 0; num52 < 200; num52++)
56002 {
56003 if (num52 != whoAmI && Main.npc[num52].active && Main.npc[num52].type == type && Math.Abs(position.X - Main.npc[num52].position.X) + Math.Abs(position.Y - Main.npc[num52].position.Y) < (float)width)
56004 {
56005 if (position.X < Main.npc[num52].position.X)
56006 {
56007 velocity.X -= num31;
56008 }
56009 else
56010 {
56011 velocity.X += num31;
56012 }
56013 if (position.Y < Main.npc[num52].position.Y)
56014 {
56015 velocity.Y -= num31;
56016 }
56017 else
56018 {
56019 velocity.Y += num31;
56020 }
56021 }
56022 }
56023 if (flag31)
56024 {
56025 velocity.Y = 0f;
56026 }
56027 }
56028 if (flag29)
56029 {
56030 if (localAI[3] == 0f)
56031 {
56032 alpha = 255;
56033 }
56034 if (localAI[3] == 30f)
56035 {
56037 }
56038 if (localAI[3] < 60f)
56039 {
56040 localAI[3] += 1f;
56041 alpha -= 5;
56042 if (alpha < 0)
56043 {
56044 alpha = 0;
56045 }
56046 int num53 = (int)localAI[3] / 10;
56047 float num54 = base.Size.Length() / 2f;
56048 num54 /= 20f;
56049 int maxValue3 = 5;
56050 if (type == 576 || type == 577)
56051 {
56052 maxValue3 = 1;
56053 }
56054 for (int num55 = 0; num55 < num53; num55++)
56055 {
56056 if (Main.rand.Next(maxValue3) == 0)
56057 {
56058 Dust dust9 = Dust.NewDustDirect(position, width, height, 27, velocity.X * 1f, 0f, 100);
56059 dust9.scale = 0.55f;
56060 dust9.fadeIn = 0.7f;
56061 dust9.velocity *= 0.1f * num54;
56062 dust9.velocity += velocity;
56063 }
56064 }
56065 }
56066 }
56067 if (flag27)
56068 {
56069 noGravity = true;
56071 if (collideX)
56072 {
56073 velocity.X = 0f - oldVelocity.X;
56074 }
56075 if (velocity.X != 0f)
56076 {
56078 }
56079 if (Collision.CanHit(position, width, height, targetData.Position, targetData.Width, targetData.Height))
56080 {
56081 Vector2 value = targetData.Center - base.Center;
56082 value.Normalize();
56083 value *= num28;
56085 return;
56086 }
56087 float num56 = num28;
56088 if (velocity.Y > 0f)
56089 {
56090 num56 = num29;
56091 }
56092 if (velocity.Y < 0f)
56093 {
56094 num56 = num30;
56095 }
56096 Vector2 value2 = new Vector2(direction, -1f);
56097 value2.Normalize();
56098 value2 *= num56;
56099 if (num56 < num28)
56100 {
56102 }
56103 else
56104 {
56106 }
56107 return;
56108 }
56109 bool flag32 = false;
56110 if ((flag12 || flag5) && ai[0] > 0f)
56111 {
56112 flag18 = false;
56113 }
56114 if (flag12 && ai[1] > 0f)
56115 {
56116 flag22 = true;
56117 }
56118 if (flag5 && ai[0] > 0f)
56119 {
56120 flag22 = true;
56121 }
56122 if (flag5)
56123 {
56124 if (ai[0] < 0f)
56125 {
56126 ai[0] += 1f;
56127 flag = false;
56128 }
56129 if (ai[0] == 0f && (velocity.Y == 0f || flag6) && targetData.Type != 0 && (Collision.CanHit(position, width, height, targetData.Position, targetData.Width, targetData.Height) || Collision.CanHitLine(position, width, height, targetData.Position, targetData.Width, targetData.Height)) && (targetData.Center - base.Center).Length() < num4)
56130 {
56131 ai[0] = num5;
56132 netUpdate = true;
56133 }
56134 if (ai[0] > 0f)
56135 {
56137 if (flag7)
56138 {
56139 velocity.X *= num7;
56140 flag24 = true;
56141 flag20 = true;
56142 ai[3] = 0f;
56143 netUpdate = true;
56144 }
56145 ai[0] -= 1f;
56146 if (ai[0] == 0f)
56147 {
56148 ai[0] = -num6;
56149 netUpdate = true;
56150 }
56151 }
56152 }
56153 if (flag3 && ai[0] > 0f)
56154 {
56155 if (flag15)
56156 {
56159 }
56160 if (ai[0] == (float)num9)
56161 {
56162 Vector2 vector4 = base.Center + vector;
56163 Vector2 v = targetData.Center - vector4;
56164 v.Y -= Math.Abs(v.X) * num15;
56165 Vector2 vector5 = v.SafeNormalize(-Vector2.UnitY) * num10;
56166 for (int num57 = 0; num57 < num17; num57++)
56167 {
56170 if (vector2.HasValue)
56171 {
56172 vector6 += vector2.Value;
56173 }
56174 else
56175 {
56176 vector6 += Utils.RandomVector2(Main.rand, 0f - num16, num16);
56177 }
56178 vector7 += vector5 * num18;
56179 if (Main.netMode != 1)
56180 {
56181 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector7, vector6, num12, num11, 0f, Main.myPlayer);
56182 }
56183 }
56184 }
56185 }
56186 if (flag4 && ai[0] > 0f)
56187 {
56188 if (velocity.Y != 0f && ai[0] < (float)num2)
56189 {
56190 ai[0] = num2;
56191 }
56192 if (ai[0] == (float)num)
56193 {
56194 velocity.Y = 0f - num3;
56195 }
56196 }
56197 if (!flag17 && flag18)
56198 {
56199 if (velocity.Y == 0f && velocity.X * (float)direction < 0f)
56200 {
56201 flag19 = true;
56202 }
56203 if (position.X == oldPosition.X || ai[3] >= (float)num21 || flag19)
56204 {
56205 ai[3] += 1f;
56206 }
56207 else if (Math.Abs(velocity.X) > 0.9f && ai[3] > 0f)
56208 {
56209 ai[3] -= 1f;
56210 }
56211 if (ai[3] > (float)(num21 * 10))
56212 {
56213 ai[3] = 0f;
56214 }
56215 if (justHit && !flag30)
56216 {
56217 ai[3] = 0f;
56218 }
56219 if (targetData.Hitbox.Intersects(base.Hitbox))
56220 {
56221 ai[3] = 0f;
56222 }
56223 if (ai[3] == (float)num21)
56224 {
56225 netUpdate = true;
56226 if (flag30)
56227 {
56228 noGravity = true;
56229 noTileCollide = true;
56230 position.X += direction * width * 2;
56231 int num58 = 20;
56232 float num59 = base.Size.Length() / 2f;
56233 num59 /= 20f;
56234 int maxValue4 = 5;
56235 if (type == 576 || type == 577)
56236 {
56237 maxValue4 = 1;
56238 }
56239 for (int num60 = 0; num60 < num58; num60++)
56240 {
56241 if (Main.rand.Next(maxValue4) == 0)
56242 {
56243 Dust dust10 = Dust.NewDustDirect(position, width, height, 27, velocity.X * 1f, 0f, 100);
56244 dust10.scale = 0.55f;
56245 dust10.fadeIn = 0.7f;
56246 dust10.velocity *= 3f * num59;
56247 dust10.noGravity = true;
56248 dust10.fadeIn = 1.5f;
56249 dust10.velocity *= 3f;
56250 }
56251 }
56252 return;
56253 }
56254 }
56255 }
56256 if (!flag20)
56257 {
56258 if (ai[3] < (float)num21 && flag21)
56259 {
56260 if (num22 > 0 && Main.rand.Next(num22) == 0)
56261 {
56262 SoundEngine.PlayTrackedSound(style, base.Center);
56263 }
56268 {
56269 netUpdate = true;
56270 }
56271 }
56272 else if (!flag22)
56273 {
56274 if (flag23)
56275 {
56276 EncourageDespawn(10);
56277 }
56278 if (velocity.X == 0f)
56279 {
56280 if (velocity.Y == 0f)
56281 {
56282 ai[2] += 1f;
56283 if (ai[2] >= 2f)
56284 {
56285 direction *= -1;
56287 ai[2] = 0f;
56288 netUpdate = true;
56289 }
56290 }
56291 }
56292 else if (ai[2] != 0f)
56293 {
56294 ai[2] = 0f;
56295 netUpdate = true;
56296 }
56297 if (direction == 0)
56298 {
56299 direction = 1;
56300 }
56301 }
56302 }
56303 if (!flag24)
56304 {
56305 if (velocity.X < 0f - num23 || velocity.X > num23)
56306 {
56307 if (velocity.Y == 0f)
56308 {
56309 velocity *= num25;
56310 }
56311 }
56312 else if ((velocity.X < num23 && direction == 1) || (velocity.X > 0f - num23 && direction == -1))
56313 {
56314 velocity.X = MathHelper.Clamp(velocity.X + num24 * (float)direction, 0f - num23, num23);
56315 }
56316 }
56317 if (flag12)
56318 {
56319 if (confused)
56320 {
56321 ai[0] = 0f;
56322 }
56323 else
56324 {
56325 if (ai[1] > 0f)
56326 {
56327 ai[1] -= 1f;
56328 }
56329 if (justHit)
56330 {
56331 ai[1] = num19;
56332 ai[0] = 0f;
56333 }
56334 if (ai[0] > 0f)
56335 {
56336 if (flag15)
56337 {
56340 }
56341 if (ai[1] == (float)num9)
56342 {
56343 Vector2 vector8 = base.Center + vector;
56344 Vector2 v2 = targetData.Center - vector8;
56345 v2.Y -= Math.Abs(v2.X) * num15;
56346 Vector2 vector9 = v2.SafeNormalize(-Vector2.UnitY) * num10;
56347 for (int num61 = 0; num61 < num17; num61++)
56348 {
56351 if (vector2.HasValue)
56352 {
56353 vector11 += vector2.Value;
56354 }
56355 else
56356 {
56357 vector11 += Utils.RandomVector2(Main.rand, 0f - num16, num16);
56358 }
56359 vector10 += vector11 * num18;
56360 if (Main.netMode != 1)
56361 {
56362 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector10, vector11, num12, num11, 0f, Main.myPlayer);
56363 }
56364 }
56365 if (Math.Abs(vector9.Y) > Math.Abs(vector9.X) * 2f)
56366 {
56367 ai[0] = ((vector9.Y > 0f) ? 1 : 5);
56368 }
56369 else if (Math.Abs(vector9.X) > Math.Abs(vector9.Y) * 2f)
56370 {
56371 ai[0] = 3f;
56372 }
56373 else
56374 {
56375 ai[0] = ((vector9.Y > 0f) ? 2 : 4);
56376 }
56377 if (flag16)
56378 {
56379 direction = ((vector9.X > 0f) ? 1 : (-1));
56380 }
56381 }
56382 bool flag33 = true;
56383 if ((velocity.Y != 0f && !flag14) || ai[1] <= 0f)
56384 {
56385 bool flag34 = false;
56386 if (num20 != 0f && ai[1] <= 0f)
56387 {
56388 flag34 = true;
56389 }
56390 ai[0] = 0f;
56391 ai[1] = (flag34 ? num20 : 0f);
56392 }
56393 else if (!flag13 || (!flag33 && (!flag14 || velocity.Y == 0f)))
56394 {
56395 velocity.X *= 0.9f;
56397 }
56398 }
56399 if ((ai[0] <= 0f || flag13) && (velocity.Y == 0f || flag14) && ai[1] <= 0f && targetData.Type != 0 && Collision.CanHit(position, width, height, targetData.Position, targetData.Width, targetData.Height))
56400 {
56401 Vector2 vector12 = targetData.Center - base.Center;
56402 if (vector12.Length() < num13)
56403 {
56404 netUpdate = true;
56405 velocity.X *= 0.5f;
56406 ai[0] = 3f;
56407 ai[1] = num8;
56408 if (Math.Abs(vector12.Y) > Math.Abs(vector12.X) * 2f)
56409 {
56410 ai[0] = ((vector12.Y > 0f) ? 1 : 5);
56411 }
56412 else if (Math.Abs(vector12.X) > Math.Abs(vector12.Y) * 2f)
56413 {
56414 ai[0] = 3f;
56415 }
56416 else
56417 {
56418 ai[0] = ((vector12.Y > 0f) ? 2 : 4);
56419 }
56420 if (flag16)
56421 {
56422 direction = ((vector12.X > 0f) ? 1 : (-1));
56423 }
56424 }
56425 }
56426 if (ai[0] <= 0f || flag13)
56427 {
56428 bool flag35 = Distance(targetData.Center) < num14;
56429 if (flag35 && Collision.CanHitLine(position, width, height, targetData.Position, targetData.Width, targetData.Height))
56430 {
56431 ai[3] = 0f;
56432 }
56433 if (velocity.X < 0f - num23 || velocity.X > num23 || flag35)
56434 {
56435 if (velocity.Y == 0f)
56436 {
56437 velocity.X *= num25;
56438 }
56439 }
56440 else if ((velocity.X < num23 && direction == 1) || (velocity.X > 0f - num23 && direction == -1))
56441 {
56442 velocity.X = MathHelper.Clamp(velocity.X + num24 * (float)direction, 0f - num23, num23);
56443 }
56444 }
56445 }
56446 }
56447 if (velocity.Y == 0f)
56448 {
56449 int num62 = (int)(base.Bottom.Y + 7f) / 16;
56450 int num63 = (int)base.Left.X / 16;
56451 int num64 = (int)base.Right.X / 16;
56452 int num65;
56453 for (num65 = num63; num65 <= num64; num65++)
56454 {
56455 num65 = Utils.Clamp(num65, 0, Main.maxTilesX);
56456 num62 = Utils.Clamp(num62, 0, Main.maxTilesY);
56457 Tile tile = Main.tile[num65, num62];
56458 if (tile == null)
56459 {
56460 return;
56461 }
56462 if (tile.nactive() && Main.tileSolid[tile.type])
56463 {
56464 flag32 = true;
56465 break;
56466 }
56467 }
56468 }
56469 Point point2 = base.Center.ToTileCoordinates();
56470 if (WorldGen.InWorld(point2.X, point2.Y, 5) && !noGravity)
56471 {
56474 Collision.StepUp(ref cPosition, ref velocity, cWidth, cHeight, ref stepSpeed, ref gfxOffY);
56476 }
56477 if (flag32)
56478 {
56479 int num66 = (int)(base.Center.X + num26 * (float)direction) / 16;
56480 int num67 = ((int)base.Bottom.Y - 15) / 16;
56481 bool flag36 = position.Y + (float)height - (float)(num67 * 16) > 20f;
56482 Tile tileSafely = Framing.GetTileSafely(num66 + direction, num67 + 1);
56483 Tile tileSafely2 = Framing.GetTileSafely(num66, num67 + 1);
56484 Tile tileSafely3 = Framing.GetTileSafely(num66, num67);
56485 Tile tileSafely4 = Framing.GetTileSafely(num66, num67 - 1);
56486 Tile tileSafely5 = Framing.GetTileSafely(num66, num67 - 2);
56487 Tile tileSafely6 = Framing.GetTileSafely(num66, num67 - 3);
56488 if (flag8 && tileSafely4.nactive() && (tileSafely4.type == 10 || tileSafely4.type == 388))
56489 {
56490 ai[0] += 1f;
56491 ai[3] = 0f;
56492 if (ai[0] >= 60f)
56493 {
56494 if (flag9)
56495 {
56496 ai[1] = 0f;
56497 }
56498 int num68 = 5;
56499 if (Main.tile[num66, num67 - 1].type == 388)
56500 {
56501 num68 = 2;
56502 }
56503 velocity.X = 0.5f * (float)(-direction);
56504 ai[1] += num68;
56505 bool flag37 = false;
56506 if (ai[1] >= 10f)
56507 {
56508 flag37 = true;
56509 ai[1] = 10f;
56510 }
56511 if (flag10)
56512 {
56513 flag37 = true;
56514 }
56515 WorldGen.KillTile(num66, num67 - 1, fail: true);
56516 if (Main.netMode != 1 && flag37)
56517 {
56518 if (flag11)
56519 {
56520 WorldGen.KillTile(num66, num67 - 1);
56521 if (Main.netMode == 2)
56522 {
56523 NetMessage.SendData(17, -1, -1, null, 0, num66, num67 - 1);
56524 }
56525 }
56526 else
56527 {
56528 if (tileSafely4.type == 10)
56529 {
56530 bool flag38 = WorldGen.OpenDoor(num66, num67 - 1, direction);
56531 if (!flag38)
56532 {
56533 ai[3] = num21;
56534 netUpdate = true;
56535 }
56536 if (Main.netMode == 2 && flag38)
56537 {
56538 NetMessage.SendData(19, -1, -1, null, 0, num66, num67 - 1, direction);
56539 }
56540 }
56541 if (tileSafely4.type == 388)
56542 {
56543 bool flag39 = WorldGen.ShiftTallGate(num66, num67 - 1, closing: false);
56544 if (!flag39)
56545 {
56546 ai[3] = num21;
56547 netUpdate = true;
56548 }
56549 if (Main.netMode == 2 && flag39)
56550 {
56551 NetMessage.SendData(19, -1, -1, null, 4, num66, num67 - 1, direction);
56552 }
56553 }
56554 }
56555 }
56556 }
56557 }
56558 else
56559 {
56560 int num69 = spriteDirection * num27;
56561 if (velocity.X * (float)num69 > 0f)
56562 {
56563 if (height >= 32 && tileSafely5.nactive() && Main.tileSolid[tileSafely5.type])
56564 {
56565 netUpdate = true;
56566 velocity.Y = -7f;
56567 if (tileSafely6.nactive() && Main.tileSolid[tileSafely6.type])
56568 {
56569 velocity.Y = -8f;
56570 }
56571 }
56572 else if (tileSafely4.nactive() && Main.tileSolid[tileSafely4.type])
56573 {
56574 velocity.Y = -6f;
56575 netUpdate = true;
56576 }
56577 else if (flag36 && tileSafely3.nactive() && !tileSafely3.topSlope() && Main.tileSolid[tileSafely3.type])
56578 {
56579 velocity.Y = -5f;
56580 netUpdate = true;
56581 }
56582 else if (flag25 && (!tileSafely2.nactive() || !Main.tileSolid[tileSafely2.type]) && (!tileSafely.nactive() || !Main.tileSolid[tileSafely.type]))
56583 {
56584 velocity.X *= 1.5f;
56585 velocity.Y = -8f;
56586 netUpdate = true;
56587 }
56588 else if (flag8)
56589 {
56590 ai[0] = 0f;
56591 ai[1] = 0f;
56592 }
56593 if (velocity.Y == 0f && flag && ai[3] == 1f)
56594 {
56595 velocity.Y = -5f;
56596 netUpdate = true;
56597 }
56598 }
56599 if (flag26 && velocity.Y == 0f && Math.Abs(targetData.Center.X - base.Center.X) < 100f && Math.Abs(targetData.Center.Y - base.Center.Y) < 50f && Math.Abs(velocity.X) >= 1f && velocity.X * (float)direction > 0f)
56600 {
56601 velocity.X = MathHelper.Clamp(velocity.X * 2f, -3f, 3f);
56602 velocity.Y = -4f;
56603 netAlways = true;
56604 }
56605 }
56606 }
56607 else if (flag8)
56608 {
56609 ai[0] = 0f;
56610 ai[1] = 0f;
56611 }
56612 if (!flag2 || !noTileCollide)
56613 {
56614 return;
56615 }
56616 wet = false;
56617 if (flag29)
56618 {
56619 if (alpha < 60)
56620 {
56621 alpha += 20;
56622 }
56623 localAI[3] = 40f;
56624 }
56625 bool num70 = velocity.Y == 0f;
56626 if (Math.Abs(base.Center.X - targetData.Center.X) > 200f)
56627 {
56628 spriteDirection = (direction = ((targetData.Center.X > base.Center.X) ? 1 : (-1)));
56629 velocity.X = MathHelper.Lerp(velocity.X, direction, 0.05f);
56630 }
56631 int num71 = 80;
56632 int num72 = height;
56633 Vector2 vector14 = new Vector2(base.Center.X - (float)(num71 / 2), position.Y + (float)height - (float)num72);
56634 bool flag40 = false;
56635 if (position.Y + (float)height < targetData.Position.Y + (float)targetData.Height - 16f)
56636 {
56637 flag40 = true;
56638 }
56639 if (flag40)
56640 {
56641 velocity.Y += 0.5f;
56642 }
56643 else if (Collision.SolidCollision(vector14, num71, num72) || targetData.Center.Y - base.Center.Y < -100f || (targetData.Center.Y - base.Center.Y < 10f && Math.Abs(targetData.Center.X - base.Center.X) < 60f))
56644 {
56645 if (velocity.Y > 0f)
56646 {
56647 velocity.Y = 0f;
56648 }
56649 if ((double)velocity.Y > -0.2)
56650 {
56651 velocity.Y -= 0.025f;
56652 }
56653 else
56654 {
56655 velocity.Y -= 0.2f;
56656 }
56657 if (velocity.Y < -4f)
56658 {
56659 velocity.Y = -4f;
56660 }
56661 }
56662 else
56663 {
56664 if (velocity.Y < 0f)
56665 {
56666 velocity.Y = 0f;
56667 }
56668 if ((double)velocity.Y < 0.1)
56669 {
56670 velocity.Y += 0.025f;
56671 }
56672 else
56673 {
56674 velocity.Y += 0.5f;
56675 }
56676 }
56677 if (velocity.Y > 10f)
56678 {
56679 velocity.Y = 10f;
56680 }
56681 if (num70)
56682 {
56683 velocity.Y = 0f;
56684 }
56685 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
static double Abs(double value)
const double PI
Definition Math.cs:16
static int Sign(decimal value)
Definition Math.cs:1202
static SlotId PlayTrackedSound(SoundStyle style, Vector2 position)
static ActiveSound GetActiveSound(SlotId id)
Vector2 oldPosition
Definition Entity.cs:18
Vector2 velocity
Definition Entity.cs:16
float Distance(Vector2 Other)
Definition Entity.cs:187
Vector2 position
Definition Entity.cs:14
Vector2 oldVelocity
Definition Entity.cs:20
Vector2 DirectionTo(Vector2 Destination)
Definition Entity.cs:197
static bool[] BelongsToInvasionOldOnesArmy
Definition NPCID.cs:4166
static bool[] FighterUsesDD2PortalAppearEffect
Definition NPCID.cs:4178
static readonly LegacySoundStyle DD2_WitherBeastAuraPulse
Definition SoundID.cs:900
static readonly LegacySoundStyle DD2_OgreGroundPound
Definition SoundID.cs:886
static readonly LegacySoundStyle DD2_OgreRoar
Definition SoundID.cs:890
static readonly LegacySoundStyle DD2_KoboldIgnite
Definition SoundID.cs:864
static readonly LegacySoundStyle DD2_WitherBeastCrystalImpact
Definition SoundID.cs:902
static readonly LegacySoundStyle DD2_KoboldScreamChargeLoop
Definition SoundID.cs:868
static readonly LegacySoundStyle DD2_GoblinScream
Definition SoundID.cs:840
static readonly LegacySoundStyle DD2_KoboldIgniteLoop
Definition SoundID.cs:866
static readonly LegacySoundStyle DD2_OgreAttack
Definition SoundID.cs:882
static readonly LegacySoundStyle DD2_GoblinBomberScream
Definition SoundID.cs:846
static readonly LegacySoundStyle DD2_OgreSpit
Definition SoundID.cs:892
static readonly LegacySoundStyle DD2_DrakinShot
Definition SoundID.cs:834
static readonly LegacySoundStyle DD2_KoboldExplosion
Definition SoundID.cs:860
static readonly LegacySoundStyle DD2_JavelinThrowersTaunt
Definition SoundID.cs:856
static readonly LegacySoundStyle DD2_DrakinBreathIn
Definition SoundID.cs:828
static readonly LegacySoundStyle DD2_JavelinThrowersAttack
Definition SoundID.cs:850
static readonly LegacySoundStyle DD2_EtherianPortalSpawnEnemy
Definition SoundID.cs:922
static readonly LegacySoundStyle DD2_GoblinBomberThrow
Definition SoundID.cs:848
Vector2 netOffset
Definition NPC.cs:103
void GetTileCollisionParameters(out Vector2 cPosition, out int cWidth, out int cHeight)
Definition NPC.cs:89517
bool netAlways
Definition NPC.cs:171
void HealEffect(int healAmount, bool broadcast=true)
Definition NPC.cs:69617
int damage
Definition NPC.cs:461
float[] localAI
Definition NPC.cs:449
int spriteDirection
Definition NPC.cs:517
bool confused
Definition NPC.cs:253
void EncourageDespawn(int despawnTime)
Definition NPC.cs:1390
int lifeMax
Definition NPC.cs:479
float gfxOffY
Definition NPC.cs:125
void TargetClosest(bool faceTarget=true)
Definition NPC.cs:69934
NPCAimedTarget GetTargetData(bool ignorePlayerTankPets=true)
Definition NPC.cs:864
bool noGravity
Definition NPC.cs:503
float[] ai
Definition NPC.cs:447
bool dontTakeDamage
Definition NPC.cs:527
float stepSpeed
Definition NPC.cs:127
float value
Definition NPC.cs:523
bool collideX
Definition NPC.cs:511
int type
Definition NPC.cs:445
bool HasValidTarget
Definition NPC.cs:665
int alpha
Definition NPC.cs:489
bool noTileCollide
Definition NPC.cs:505
int GetAttackDamage_ScaledByStrength(float normalDamage)
Definition NPC.cs:1057
int GetAttackDamage_ForProjectiles(float normalDamage, float expertDamage)
Definition NPC.cs:1082
void HitEffect(int hitDirection=0, double dmg=10.0)
Definition NPC.cs:78386
bool justHit
Definition NPC.cs:455
int TranslatedTargetIndex
Definition NPC.cs:707
int life
Definition NPC.cs:477
IEntitySource GetSpawnSource_ForProjectile()
Definition NPC.cs:87526
int directionY
Definition NPC.cs:443
bool netUpdate
Definition NPC.cs:507
LegacySoundStyle HitSound
Definition NPC.cs:473
static void TargetClosestCommon(NPC searcher, bool faceTarget=true, Vector2? checkPosition=null)
Definition NPCUtils.cs:303
static void TargetClosestOldOnesInvasion(NPC searcher, bool faceTarget=true, Vector2? checkPosition=null)
Definition NPCUtils.cs:261
static Color Transparent
Definition Color.cs:76
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227
static readonly SlotId Invalid
Definition SlotId.cs:5
static SlotId FromFloat(float value)
Definition SlotId.cs:80

References System.Math.Abs(), Terraria.Entity.active, Terraria.Player.AddBuff(), Terraria.NPC.ai, Terraria.NPC.alpha, System.array, Terraria.ID.NPCID.Sets.BelongsToInvasionOldOnesArmy, Terraria.Collision.CanHit(), Terraria.Collision.CanHitLine(), Terraria.DelegateMethods.CastLightOpen(), Terraria.Entity.Center, Microsoft.Xna.Framework.MathHelper.Clamp(), Terraria.NPC.collideX, Microsoft.Xna.Framework.Graphics.Color, Terraria.NPC.confused, Terraria.Player.creativeGodMode, Terraria.NPC.damage, Terraria.Main.dayTime, Terraria.ID.SoundID.DD2_DrakinBreathIn, Terraria.ID.SoundID.DD2_DrakinShot, Terraria.ID.SoundID.DD2_EtherianPortalSpawnEnemy, Terraria.ID.SoundID.DD2_GoblinBomberScream, Terraria.ID.SoundID.DD2_GoblinBomberThrow, Terraria.ID.SoundID.DD2_GoblinScream, Terraria.ID.SoundID.DD2_JavelinThrowersAttack, Terraria.ID.SoundID.DD2_JavelinThrowersTaunt, Terraria.ID.SoundID.DD2_KoboldExplosion, Terraria.ID.SoundID.DD2_KoboldIgnite, Terraria.ID.SoundID.DD2_KoboldIgniteLoop, Terraria.ID.SoundID.DD2_KoboldScreamChargeLoop, Terraria.ID.SoundID.DD2_OgreAttack, Terraria.ID.SoundID.DD2_OgreGroundPound, Terraria.ID.SoundID.DD2_OgreRoar, Terraria.ID.SoundID.DD2_OgreSpit, Terraria.ID.SoundID.DD2_WitherBeastAuraPulse, Terraria.ID.SoundID.DD2_WitherBeastCrystalImpact, Terraria.Player.dead, Terraria.Entity.direction, Terraria.Entity.DirectionTo(), Terraria.NPC.directionY, Terraria.Entity.Distance(), Terraria.NPC.dontTakeDamage, Terraria.Main.dust, Terraria.NPC.EncourageDespawn(), Terraria.GameContent.Events.DD2Event.EnemiesShouldChasePlayers, Terraria.ID.NPCID.Sets.FighterUsesDD2PortalAppearEffect, ReLogic.Utilities.SlotId.FromFloat(), Terraria.Audio.SoundEngine.GetActiveSound(), Terraria.NPC.GetAttackDamage_ForProjectiles(), Terraria.NPC.GetAttackDamage_ScaledByStrength(), Terraria.Utils.GetLerpValue(), Terraria.NPC.GetSpawnSource_ForProjectile(), Terraria.NPC.GetTargetData(), Terraria.NPC.GetTileCollisionParameters(), Terraria.Framing.GetTileSafely(), Terraria.NPC.gfxOffY, Terraria.Main.gore, Terraria.NPC.HasValidTarget, Terraria.NPC.HealEffect(), Terraria.Entity.height, Terraria.NPC.HitEffect(), Terraria.NPC.HitSound, ReLogic.Utilities.SlotId.Invalid, Terraria.WorldGen.InWorld(), Terraria.NPC.justHit, Terraria.WorldGen.KillTile(), Microsoft.Xna.Framework.MathHelper.Lerp(), Microsoft.Xna.Framework.Vector2.Lerp(), Terraria.NPC.life, Terraria.NPC.lifeMax, Terraria.NPC.localAI, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.myPlayer, Terraria.Tile.nactive(), Terraria.NPC.netAlways, Terraria.Main.netMode, Terraria.NPC.netOffset, Terraria.NPC.netUpdate, Terraria.Dust.NewDust(), Terraria.Dust.NewDustDirect(), Terraria.Dust.NewDustPerfect(), Terraria.Gore.NewGore(), Terraria.Gore.NewGoreDirect(), Terraria.Projectile.NewProjectile(), Terraria.NPC.noGravity, Terraria.NPC.noTileCollide, Terraria.Main.npc, Terraria.Entity.oldPosition, Terraria.Entity.oldVelocity, Terraria.WorldGen.OpenDoor(), System.Math.PI, Terraria.Main.player, Terraria.Audio.SoundEngine.PlayTrackedSound(), Terraria.Utils.PlotTileLine(), Terraria.Entity.position, Terraria.Main.rand, Terraria.Utils.RandomVector2(), Terraria.NetMessage.SendData(), Terraria.WorldGen.ShiftTallGate(), System.Math.Sign(), Terraria.Collision.SolidCollision(), Terraria.WorldGen.SolidTile(), Terraria.NPC.spriteDirection, Terraria.NPC.stepSpeed, Terraria.Collision.StepUp(), Terraria.NPC.TargetClosest(), Terraria.Utilities.NPCUtils.TargetClosestCommon(), Terraria.Utilities.NPCUtils.TargetClosestOldOnesInvasion(), Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.NPC.TranslatedTargetIndex, Microsoft.Xna.Framework.Color.Transparent, Terraria.NPC.type, Terraria.Tile.type, Microsoft.Xna.Framework.Vector2.UnitX, Microsoft.Xna.Framework.Vector2.UnitY, Terraria.NPC.value, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Graphics.Vector3, Terraria.Entity.velocity, Terraria.Entity.wet, Terraria.Entity.whoAmI, Terraria.Entity.width, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.NPC.AI().