44221 {
44223 {
44226 int num = 1;
44228 {
44229 num = -1;
44230 }
44231 for (
int i = 0;
i < 20;
i++)
44232 {
44234 }
44235 }
44237 {
44240 }
44242 {
44244 if (
type == 454 || (
type != 454 && Main.npc[(
int)
ai[1]].alpha < 85))
44245 {
44247 {
44248 for (
int j = 0;
j < 2;
j++)
44249 {
44251 Main.dust[
num2].noGravity =
true;
44252 Main.dust[
num2].noLight =
true;
44253 }
44254 }
44257 {
44259 }
44260 }
44261 }
44263 {
44266 if (
type == 621 || (
type != 621 && Main.npc[(
int)
ai[1]].alpha < 85))
44267 {
44269 {
44270 for (
int k = 0;
k < 2;
k++)
44271 {
44273 }
44274 }
44277 {
44279 }
44280 }
44281 if (
alpha == 0 && Main.rand.Next(5) == 0)
44282 {
44284 }
44286 }
44287 else if (
type == 402)
44288 {
44293 {
44295 }
44297 {
44298 for (
int l = 0;
l < 50;
l++)
44299 {
44301 if (Main.rand.Next(2) == 0)
44302 {
44304 Main.dust[
num5].scale += (float)Main.rand.Next(50) * 0.04f;
44305 Main.dust[
num5].noGravity =
true;
44307 Main.dust[
num5].fadeIn = Main.rand.NextFloat() * 1.5f;
44308 }
44309 if (Main.rand.Next(2) == 0)
44310 {
44312 Main.dust[
num6].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
44313 Main.dust[
num6].noGravity =
true;
44315 Main.dust[
num6].fadeIn = Main.rand.NextFloat() * 1.5f;
44316 }
44317 }
44318 if (Main.netMode != 1)
44319 {
44323 }
44324 }
44325 if (
ai[2] >=
num3 && Main.netMode != 1)
44326 {
44329 }
44330 }
44331 if (Main.netMode != 1 && Main.expertMode)
44332 {
44333 if (
type == 14 && ((
double)(
position.
Y / 16f) < Main.worldSurface || Main.getGoodWorld))
44334 {
44335 int num7 = (int)(
base.Center.X / 16f);
44336 int num8 = (int)(
base.Center.Y / 16f);
44338 {
44340 if (Main.getGoodWorld)
44341 {
44343 }
44344 if (Main.rand.Next(
num9) == 0)
44345 {
44347 if (Collision.CanHitLine(
base.Center, 1, 1, Main.player[
target].Center, 1, 1))
44348 {
44350 }
44351 }
44352 }
44353 }
44354 else if (
type == 13)
44355 {
44358 if (Main.rand.Next(
num10) == 0)
44359 {
44361 if (Collision.CanHitLine(
base.Center, 1, 1, Main.player[
target].Center, 1, 1))
44362 {
44364 }
44365 }
44366 }
44367 }
44368 bool flag = false;
44369 float num11 = 0.2f;
44371 {
44372 case 513:
44373 flag = !Main.player[
target].ZoneUndergroundDesert;
44375 break;
44376 case 10:
44377 case 39:
44378 case 95:
44379 case 117:
44380 case 510:
44381 flag = true;
44382 break;
44383 case 621:
44384 flag = false;
44385 break;
44386 }
44388 {
44390 }
44391 else if (
ai[3] > 0f)
44392 {
44394 }
44395 if (
target < 0 ||
target == 255 || Main.player[
target].dead || (flag && (
double)Main.player[
target].position.Y < Main.worldSurface * 16.0))
44396 {
44398 }
44399 if (Main.player[
target].dead || (flag && (
double)Main.player[
target].position.Y < Main.worldSurface * 16.0))
44400 {
44402 if (flag)
44403 {
44404 velocity.Y +=
num11;
44405 }
44406 }
44407 if (
type == 621 && Main.dayTime)
44408 {
44410 velocity.Y += 1f;
44411 }
44412 if (Main.netMode != 1)
44413 {
44414 if (
type == 87 &&
ai[0] == 0f)
44415 {
44420 for (
int m = 0;
m < 14;
m++)
44421 {
44424 {
44425 case 1:
44426 case 8:
44428 break;
44429 case 11:
44431 break;
44432 case 12:
44434 break;
44435 case 13:
44437 break;
44438 }
44443 Main.npc[
num12].CopyInteractions(
this);
44445 NetMessage.SendData(23, -1, -1,
null,
num12);
44447 }
44448 }
44449 if (
type == 454 &&
ai[0] == 0f)
44450 {
44455 for (
int n = 0;
n < 30;
n++)
44456 {
44458 if ((
n - 2) % 4 == 0 &&
n < 26)
44459 {
44461 }
44462 else
44463 {
44465 {
44466 case 27:
44468 break;
44469 case 28:
44471 break;
44472 case 29:
44474 break;
44475 }
44476 }
44481 Main.npc[
num15].CopyInteractions(
this);
44483 NetMessage.SendData(23, -1, -1,
null,
num15);
44485 }
44486 }
44487 if (
type == 513 &&
ai[0] == 0f)
44488 {
44493 int num20 = Main.rand.Next(6, 10);
44495 {
44498 {
44500 }
44505 Main.npc[
num18].CopyInteractions(
this);
44507 NetMessage.SendData(23, -1, -1,
null,
num18);
44509 }
44510 }
44511 if (
type == 510 &&
ai[0] == 0f)
44512 {
44517 int num25 = Main.rand.Next(12, 21);
44519 {
44522 {
44524 }
44529 Main.npc[
num23].CopyInteractions(
this);
44531 NetMessage.SendData(23, -1, -1,
null,
num23);
44533 }
44534 }
44535 if (
type == 621 &&
ai[0] == 0f)
44536 {
44543 {
44546 {
44548 }
44553 Main.npc[
num28].CopyInteractions(
this);
44555 NetMessage.SendData(23, -1, -1,
null,
num28);
44557 }
44558 }
44560 {
44562 {
44564 {
44567 }
44568 ai[2] = Main.rand.Next(8, 13);
44570 {
44571 ai[2] = Main.rand.Next(4, 7);
44572 }
44574 {
44576 }
44578 {
44579 ai[2] = Main.rand.Next(14, 23);
44580 if (Main.getGoodWorld)
44581 {
44583 if (Main.remixWorld)
44584 {
44586 }
44587 }
44588 }
44590 {
44591 ai[2] = Main.rand.Next(6, 12);
44592 }
44594 {
44595 ai[2] = Main.rand.Next(20, 26);
44596 }
44598 {
44599 ai[2] = Main.rand.Next(3, 6);
44600 }
44601 if (
type == 7 && Main.remixWorld)
44602 {
44604 }
44607 }
44609 {
44612 }
44613 else
44614 {
44617 }
44619 {
44620 Main.npc[(int)
ai[0]].
ai[3] =
ai[3];
44622 }
44624 Main.npc[(int)
ai[0]].
ai[2] =
ai[2] - 1f;
44626 }
44627 if (
type == 412 &&
ai[0] == 0f)
44628 {
44635 {
44638 {
44640 }
44645 Main.npc[
num33].CopyInteractions(
this);
44647 NetMessage.SendData(23, -1, -1,
null,
num33);
44649 }
44650 }
44652 {
44653 case 8:
44654 case 9:
44655 case 11:
44656 case 12:
44657 case 40:
44658 case 41:
44659 case 88:
44660 case 89:
44661 case 90:
44662 case 91:
44663 case 92:
44664 case 96:
44665 case 97:
44666 case 99:
44667 case 100:
44668 case 118:
44669 case 119:
44670 case 413:
44671 case 414:
44672 case 455:
44673 case 456:
44674 case 457:
44675 case 458:
44676 case 459:
44677 case 511:
44678 case 512:
44679 case 514:
44680 case 515:
44681 case 622:
44682 case 623:
44683 if (!Main.npc[(
int)
ai[1]].active || Main.npc[(
int)
ai[1]].aiStyle !=
aiStyle)
44684 {
44689 NetMessage.SendData(28, -1, -1,
null,
whoAmI, -1f);
44690 return;
44691 }
44692 break;
44693 }
44695 {
44696 case 7:
44697 case 8:
44698 case 10:
44699 case 11:
44700 case 39:
44701 case 40:
44702 case 87:
44703 case 88:
44704 case 89:
44705 case 90:
44706 case 91:
44707 case 95:
44708 case 96:
44709 case 98:
44710 case 99:
44711 case 117:
44712 case 118:
44713 case 412:
44714 case 413:
44715 case 454:
44716 case 455:
44717 case 456:
44718 case 457:
44719 case 458:
44720 case 510:
44721 case 511:
44722 case 513:
44723 case 514:
44724 case 621:
44725 case 622:
44726 if (!Main.npc[(
int)
ai[0]].active || Main.npc[(
int)
ai[0]].aiStyle !=
aiStyle)
44727 {
44732 NetMessage.SendData(28, -1, -1,
null,
whoAmI, -1f);
44733 return;
44734 }
44735 break;
44736 }
44738 {
44739 if (!Main.npc[(
int)
ai[1]].active && !Main.npc[(
int)
ai[0]].active)
44740 {
44745 NetMessage.SendData(28, -1, -1,
null,
whoAmI, -1f);
44746 return;
44747 }
44748 if (
type == 13 && !Main.npc[(
int)
ai[0]].active)
44749 {
44754 NetMessage.SendData(28, -1, -1,
null,
whoAmI, -1f);
44755 return;
44756 }
44757 if (
type == 15 && !Main.npc[(
int)
ai[1]].active)
44758 {
44763 NetMessage.SendData(28, -1, -1,
null,
whoAmI, -1f);
44764 return;
44765 }
44766 if (
type == 14 && (!Main.npc[(
int)
ai[1]].active || Main.npc[(
int)
ai[1]].aiStyle !=
aiStyle))
44767 {
44779 }
44780 if (
type == 14 && (!Main.npc[(
int)
ai[0]].active || Main.npc[(
int)
ai[0]].aiStyle !=
aiStyle))
44781 {
44793 }
44794 }
44795 if (!
active && Main.netMode == 2)
44796 {
44797 NetMessage.SendData(28, -1, -1,
null,
whoAmI, -1f);
44798 }
44799 }
44805 {
44807 }
44808 if (
num45 > Main.maxTilesX)
44809 {
44810 num45 = Main.maxTilesX;
44811 }
44813 {
44815 }
44816 if (
num47 > Main.maxTilesY)
44817 {
44818 num47 = Main.maxTilesY;
44819 }
44820 bool flag2 =
false;
44822 {
44824 }
44826 {
44828 }
44830 {
44832 }
44834 {
44836 }
44838 {
44840 }
44842 {
44845 {
44847 {
44849 {
44850 continue;
44851 }
44852 vector2.X =
num48 * 16;
44853 vector2.Y =
num49 * 16;
44855 {
44857 if (Main.rand.Next(100) == 0 &&
type != 117 && Main.tile[
num48,
num49].nactive() && Main.tileSolid[Main.tile[
num48,
num49].type])
44858 {
44860 }
44861 }
44862 }
44863 }
44864 }
44866 {
44871 {
44872 if (Main.player[
num51].active)
44873 {
44876 {
44878 break;
44879 }
44880 }
44881 }
44883 {
44885 }
44886 }
44888 {
44890 {
44892 }
44894 {
44896 }
44897 }
44899 {
44901 {
44903 }
44905 {
44908 {
44910 }
44911 }
44913 {
44915 }
44917 {
44920 }
44921 }
44923 {
44928 obj.noGravity = true;
44929 obj.noLight = true;
44930 obj.position -=
new Vector2(4f);
44931 obj.fadeIn = 1f;
44934 obj2.noGravity = true;
44935 obj2.noLight = true;
44936 obj2.position -=
new Vector2(4f);
44937 obj2.fadeIn = 1f;
44940 }
44942 float num53 = 0.07f;
44944 {
44947 }
44949 {
44952 }
44954 {
44957 }
44959 {
44962 }
44964 {
44967 if (Main.expertMode)
44968 {
44971 }
44972 if (Main.getGoodWorld)
44973 {
44976 }
44977 }
44979 {
44980 if (!Main.player[
target].dead && Main.player[
target].ZoneSandstorm)
44981 {
44984 }
44985 else
44986 {
44989 }
44990 }
44992 {
44995 }
44997 {
45000 }
45002 {
45005 }
45007 {
45010 }
45012 {
45015 }
45016 if (
type == 117 && Main.wofNPCIndex >= 0)
45017 {
45018 float num54 = (float)Main.npc[Main.wofNPCIndex].life / (
float)Main.npc[Main.wofNPCIndex].lifeMax;
45019 if ((
double)
num54 < 0.5)
45020 {
45023 }
45024 if ((
double)
num54 < 0.25)
45025 {
45028 }
45029 if ((
double)
num54 < 0.1)
45030 {
45033 }
45034 }
45036 {
45039 if (Main.getGoodWorld)
45040 {
45043 }
45044 }
45046 float num55 = Main.player[
target].position.X + (float)(Main.player[
target].width / 2);
45047 float num56 = Main.player[
target].position.Y + (float)(Main.player[
target].height / 2);
45049 {
45053 int num58 = (int)(Main.player[
target].Center.X / 16f);
45054 int num59 = (int)(Main.player[
target].Center.Y / 16f);
45056 {
45058 {
45060 {
45062 break;
45063 }
45064 }
45066 {
45067 break;
45068 }
45069 }
45071 {
45075 {
45078 {
45080 }
45081 }
45082 }
45083 else
45084 {
45087 }
45092 {
45094 {
45097 }
45099 {
45102 }
45103 }
45105 {
45107 {
45109 {
45112 {
45117 }
45118 }
45119 }
45120 }
45121 else
45122 {
45124 {
45126 {
45129 {
45134 }
45135 }
45136 }
45137 }
45138 }
45141 vector5.X = (int)(
vector5.X / 16f) * 16;
45142 vector5.Y = (int)(
vector5.Y / 16f) * 16;
45146 {
45149 }
45151 if (
ai[1] > 0f &&
ai[1] < (
float)Main.npc.Length)
45152 {
45153 try
45154 {
45158 }
45159 catch
45160 {
45161 }
45166 {
45168 }
45170 {
45172 }
45174 {
45176 }
45178 {
45180 }
45182 {
45184 }
45186 {
45188 }
45189 if (Main.getGoodWorld &&
type >= 13 &&
type <= 15)
45190 {
45192 }
45197 position.X +=
num55;
45198 position.Y +=
num56;
45200 {
45202 {
45204 }
45205 else if (
num55 > 0f)
45206 {
45208 }
45209 }
45211 {
45213 {
45215 }
45216 else if (
num55 > 0f)
45217 {
45219 }
45220 }
45222 {
45224 {
45226 }
45227 else if (
num55 > 0f)
45228 {
45230 }
45231 }
45232 }
45233 else
45234 {
45236 {
45239 {
45240 velocity.Y += 0.08f;
45241 }
45242 else
45243 {
45244 velocity.Y += 0.11f;
45245 }
45247 {
45248 velocity.Y =
num52;
45249 }
45251 {
45253 {
45254 velocity.X -=
num53 * 1.1f;
45255 }
45256 else
45257 {
45258 velocity.X +=
num53 * 1.1f;
45259 }
45260 }
45262 {
45264 {
45265 velocity.X +=
num53;
45266 }
45268 {
45269 velocity.X -=
num53;
45270 }
45271 }
45273 {
45275 {
45276 velocity.X +=
num53 * 0.9f;
45277 }
45278 else
45279 {
45280 velocity.X -=
num53 * 0.9f;
45281 }
45282 }
45283 }
45284 else
45285 {
45287 {
45290 {
45292 }
45294 {
45296 }
45299 }
45306 bool flag4 =
false;
45307 if ((
type == 7 ||
type == 13) && ((!Main.player[
target].ZoneCorrupt && !Main.player[
target].ZoneCrimson) || Main.player[
target].dead))
45308 {
45310 }
45311 if ((
type == 513 && (
double)Main.player[
target].position.Y < Main.worldSurface * 16.0 && !Main.player[
target].ZoneSandstorm && !Main.player[
target].ZoneUndergroundDesert) || Main.player[
target].dead)
45312 {
45314 }
45315 if ((
type == 510 && (
double)Main.player[
target].position.Y < Main.worldSurface * 16.0 && !Main.player[
target].ZoneSandstorm && !Main.player[
target].ZoneUndergroundDesert) || Main.player[
target].dead)
45316 {
45318 }
45320 {
45323 {
45324 if (Main.player[
num74].active && !Main.player[
num74].dead && Main.player[
num74].ZoneCorrupt)
45325 {
45327 }
45328 }
45330 {
45331 if (Main.netMode != 1 && (double)(position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0)
45332 {
45336 {
45338 Main.npc[
num75].active =
false;
45340 if (Main.netMode == 2)
45341 {
45342 NetMessage.SendData(23, -1, -1,
null,
num75);
45343 }
45345 }
45346 if (Main.netMode == 2)
45347 {
45348 NetMessage.SendData(23, -1, -1,
null,
whoAmI);
45349 }
45350 }
45353 }
45354 }
45355 bool flag6 =
false;
45357 {
45359 {
45362 {
45364 }
45365 }
45366 if (
position.
Y > Main.player[
target].position.Y || (
double)(Main.player[
target].position.Y / 16f) > Main.worldSurface || Main.player[
target].dead)
45367 {
45370 {
45372 {
45374 }
45375 velocity.X *= 1.1f;
45376 }
45378 {
45379 velocity.Y -=
num53;
45380 }
45381 }
45382 }
45384 {
45385 float num77 = 300f;
45387 {
45389 }
45391 {
45394 {
45396 }
45397 }
45399 {
45402 {
45404 {
45406 }
45407 velocity.X *= 1.1f;
45408 }
45410 {
45411 velocity.Y -=
num53;
45412 }
45413 }
45414 }
45416 {
45418 {
45420 {
45421 velocity.X +=
num53;
45422 }
45424 {
45425 velocity.X -=
num53;
45426 }
45428 {
45429 velocity.Y +=
num53;
45430 }
45432 {
45433 velocity.Y -=
num53;
45434 }
45436 {
45438 {
45439 velocity.Y +=
num53 * 2f;
45440 }
45441 else
45442 {
45443 velocity.Y -=
num53 * 2f;
45444 }
45445 }
45447 {
45449 {
45450 velocity.X +=
num53 * 2f;
45451 }
45452 else
45453 {
45454 velocity.X -=
num53 * 2f;
45455 }
45456 }
45457 }
45459 {
45461 {
45462 velocity.X +=
num53 * 1.1f;
45463 }
45465 {
45466 velocity.X -=
num53 * 1.1f;
45467 }
45469 {
45471 {
45472 velocity.Y +=
num53;
45473 }
45474 else
45475 {
45476 velocity.Y -=
num53;
45477 }
45478 }
45479 }
45480 else
45481 {
45483 {
45484 velocity.Y +=
num53 * 1.1f;
45485 }
45487 {
45488 velocity.Y -=
num53 * 1.1f;
45489 }
45491 {
45493 {
45494 velocity.X +=
num53;
45495 }
45496 else
45497 {
45498 velocity.X -=
num53;
45499 }
45500 }
45501 }
45502 }
45503 }
45506 {
45508 {
45510 {
45512 }
45514 }
45515 else
45516 {
45518 {
45520 }
45522 }
45524 {
45526 }
45527 }
45529 {
45533 {
45535 }
45537 {
45539 }
45541 {
45543 }
45545 {
45547 }
45549 {
45551 }
45552 }
45553 }
45555 {
45556 return;
45557 }
45559 {
45561 {
45563 Main.dust[
num81].noGravity =
true;
45564 Main.dust[
num81].noLight =
true;
45565 }
45566 }
45568 {
45571 {
45573 }
45574 }
45575 }
static double Atan2(double y, double x)
static double Sqrt(double d)
static double Abs(double value)
static void PlaySound(int type, Vector2 position, int style=1)
static readonly LegacySoundStyle Item119
static readonly LegacySoundStyle NPCDeath13
void SpawnStardustMark_StardustWorm()
void EncourageDespawn(int despawnTime)
void TargetClosest(bool faceTarget=true)
static int GetEaterOfWorldsSegmentsCount()
void SetDefaultsKeepPlayerInteraction(int Type)
void CopyInteractions(NPC npc)
IEntitySource GetSpawnSourceForNPCFromNPCAI()
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)
void HitEffect(int hitDirection=0, double dmg=10.0)
static float Distance(Vector2 value1, Vector2 value2)