48157 {
48158 bool flag = (double)
j < Main.rockLayer;
48159 bool flag2 =
j < Main.UnderworldLayer;
48160 if (Main.remixWorld)
48161 {
48162 flag = (double)
j > Main.rockLayer &&
j < Main.UnderworldLayer;
48163 flag2 = (double)
j > Main.worldSurface && (
double)
j < Main.rockLayer;
48164 }
48165 float num = 1f;
48166 bool flag3 = style >= 34 && style <= 36;
48167 switch (style)
48168 {
48169 case 4:
48170 case 5:
48171 case 6:
48172 num = 1.25f;
48173 break;
48174 default:
48175 if (style >= 7 && style <= 9)
48176 {
48177 num = 1.75f;
48178 }
48179 else if (style >= 10 && style <= 12)
48180 {
48181 num = 1.9f;
48182 }
48183 else if (style >= 13 && style <= 15)
48184 {
48185 num = 2.1f;
48186 }
48187 else if (style >= 16 && style <= 18)
48188 {
48189 num = 1.6f;
48190 }
48191 else if (style >= 19 && style <= 21)
48192 {
48193 num = 3.5f;
48194 }
48195 else if (style >= 22 && style <= 24)
48196 {
48197 num = 1.6f;
48198 }
48199 else if (style >= 25 && style <= 27)
48200 {
48201 num = 10f;
48202 }
48203 else if (style >= 28 && style <= 30)
48204 {
48205 if (Main.hardMode)
48206 {
48207 num = 4f;
48208 }
48209 }
48210 else if (style >= 31 && style <= 33)
48211 {
48212 num = 2f;
48213 }
48214 else if (style >= 34 && style <= 36)
48215 {
48216 num = 1.25f;
48217 }
48218 break;
48219 case 0:
48220 case 1:
48221 case 2:
48222 case 3:
48223 break;
48224 }
48225 num = (num * 2f + 1f) / 3f;
48226 int range = (int)(500f / ((num + 1f) / 2f));
48228 {
48229 return;
48230 }
48232 {
48233 if (Main.netMode != 1)
48234 {
48236 }
48237 return;
48238 }
48239 if (
genRand.Next(35) == 0 && Main.wallDungeon[Main.tile[
i,
j].wall] && (double)
j > Main.worldSurface)
48240 {
48242 return;
48243 }
48244 if (Main.getGoodWorld &&
genRand.Next(6) == 0)
48245 {
48246 Projectile.NewProjectile(
GetProjectileSource_TileBreak(i,
j),
i * 16 + 16,
j * 16 + 8, (float)Main.rand.Next(-100, 101) * 0.002f, 0f, 28, 0, 0f, Main.myPlayer, 16f, 16f);
48247 return;
48248 }
48249 if (Main.remixWorld && Main.netMode != 1 &&
genRand.Next(5) == 0)
48250 {
48252 if (Main.rand.Next(2) == 0)
48253 {
48255 }
48256 else if (player.ZoneJungle)
48257 {
48259 num2 =
NPC.NewNPC(
NPC.GetSpawnSourceForNaturalSpawn(),
x2 * 16 + 16,
y2 * 16 + 32, -10);
48261 {
48262 Main.npc[
num2].ai[1] = 75f;
48263 Main.npc[
num2].netUpdate =
true;
48264 }
48265 }
48266 else if ((
double)
j > Main.rockLayer &&
j < Main.maxTilesY - 350)
48267 {
48269 num3 = ((Main.rand.Next(9) == 0) ?
NPC.NewNPC(
NPC.GetSpawnSourceForNaturalSpawn(),
x2 * 16 + 16,
y2 * 16 + 32, -7) : ((Main.rand.
Next(7) == 0) ?
NPC.NewNPC(
NPC.GetSpawnSourceForNaturalSpawn(),
x2 * 16 + 16,
y2 * 16 + 32, -8) : ((Main.rand.
Next(6) == 0) ?
NPC.NewNPC(
NPC.GetSpawnSourceForNaturalSpawn(),
x2 * 16 + 16,
y2 * 16 + 32, -9) : ((Main.rand.
Next(3) != 0) ?
NPC.NewNPC(
NPC.GetSpawnSourceForNaturalSpawn(),
x2 * 16 + 16,
y2 * 16 + 32, 1) :
NPC.NewNPC(
NPC.GetSpawnSourceForNaturalSpawn(),
x2 * 16 + 16,
y2 * 16 + 32, -3)))));
48271 {
48272 Main.npc[
num3].ai[1] = 75f;
48273 Main.npc[
num3].netUpdate =
true;
48274 }
48275 }
48276 else if ((
double)
j > Main.worldSurface && (
double)
j <= Main.rockLayer)
48277 {
48279 num4 =
NPC.NewNPC(
NPC.GetSpawnSourceForNaturalSpawn(),
x2 * 16 + 16,
y2 * 16 + 32, -6);
48281 {
48282 Main.npc[
num4].ai[1] = 75f;
48283 Main.npc[
num4].netUpdate =
true;
48284 }
48285 }
48286 else
48287 {
48289 }
48290 return;
48291 }
48292 if (Main.remixWorld && (
double)i > (
double)Main.maxTilesX * 0.37 && (
double)i < (
double)Main.maxTilesX * 0.63 &&
j > Main.maxTilesY - 220)
48293 {
48294 int stack = Main.rand.Next(20, 41);
48296 return;
48297 }
48298 if (
genRand.Next(45) == 0 || (Main.rand.Next(45) == 0 && Main.expertMode))
48299 {
48300 if ((
double)
j < Main.worldSurface)
48301 {
48304 {
48306 }
48308 {
48310 }
48312 {
48314 }
48316 {
48318 }
48320 {
48322 }
48324 {
48326 }
48328 {
48330 }
48332 {
48334 }
48335 }
48336 else if (flag)
48337 {
48340 {
48342 }
48344 {
48346 }
48348 {
48350 }
48352 {
48354 }
48356 {
48358 }
48360 {
48362 }
48364 {
48366 }
48368 {
48370 }
48372 {
48374 }
48376 {
48378 }
48379 }
48381 {
48384 {
48386 }
48388 {
48390 }
48392 {
48394 }
48396 {
48398 }
48400 {
48402 }
48404 {
48406 }
48408 {
48410 }
48412 {
48414 }
48416 {
48418 }
48420 {
48422 }
48424 {
48426 }
48428 {
48430 }
48432 {
48434 }
48436 {
48438 }
48440 {
48442 }
48443 }
48444 else
48445 {
48448 {
48450 }
48452 {
48454 }
48456 {
48458 }
48460 {
48462 }
48464 {
48466 }
48468 {
48470 }
48472 {
48474 }
48476 {
48478 }
48480 {
48482 }
48484 {
48486 }
48488 {
48490 }
48492 {
48494 }
48496 {
48498 }
48500 {
48502 }
48504 {
48506 }
48507 }
48508 return;
48509 }
48510 if (Main.netMode == 2 && Main.rand.Next(30) == 0)
48511 {
48513 return;
48514 }
48515 int num9 = Main.rand.Next(7);
48516 if (Main.expertMode)
48517 {
48519 }
48523 for (
int k = 0;
k < 50;
k++)
48524 {
48526 if (!
item.IsAir &&
item.createTile == 4)
48527 {
48530 {
48531 break;
48532 }
48533 }
48534 }
48537 {
48539 if (Main.rand.Next(2) == 0)
48540 {
48542 }
48543 if (Main.expertMode)
48544 {
48545 if (Main.rand.Next(2) == 0)
48546 {
48548 }
48549 if (Main.rand.Next(2) == 0)
48550 {
48552 }
48553 }
48554 return;
48555 }
48557 {
48558 int num12 = Main.rand.Next(2, 7);
48559 if (Main.expertMode)
48560 {
48561 num12 += Main.rand.Next(1, 7);
48562 }
48566 {
48567 num12 += Main.rand.Next(2, 7);
48569 }
48570 else if ((style >= 22 && style <= 24) ||
player2.ZoneCrimson)
48571 {
48572 num12 += Main.rand.Next(2, 7);
48574 }
48575 else if ((style >= 16 && style <= 18) ||
player2.ZoneCorrupt)
48576 {
48577 num12 += Main.rand.Next(2, 7);
48579 }
48580 else if (style >= 7 && style <= 9)
48581 {
48582 num12 += Main.rand.Next(2, 7);
48585 }
48586 else if (style >= 4 && style <= 6)
48587 {
48590 }
48591 else if (style >= 34 && style <= 36)
48592 {
48593 num12 += Main.rand.Next(2, 7);
48595 }
48596 else if (
player2.ZoneGlowshroom)
48597 {
48598 num12 += Main.rand.Next(2, 7);
48600 }
48601 if (Main.tile[i,
j].liquid > 0)
48602 {
48604 }
48605 else
48606 {
48608 }
48609 return;
48610 }
48612 {
48613 case 2:
48614 {
48615 int stack2 = Main.rand.Next(10, 21);
48617 if (flag &&
genRand.Next(2) == 0)
48618 {
48619 type4 = ((!Main.hardMode) ? 42 : 168);
48620 }
48621 if (
j > Main.UnderworldLayer)
48622 {
48624 }
48625 else if (Main.hardMode)
48626 {
48627 type4 = ((Main.rand.Next(2) != 0) ? 47 : ((SavedOreTiers.
Silver != 168) ? 278 : 4915));
48628 }
48630 return;
48631 }
48632 case 3:
48633 {
48635 if (
j > Main.UnderworldLayer || Main.hardMode)
48636 {
48638 }
48640 if (Main.expertMode && Main.rand.Next(3) != 0)
48641 {
48643 }
48645 return;
48646 }
48647 case 4:
48649 {
48652 {
48654 }
48655 int num13 = Main.rand.Next(4) + 1;
48656 if (Main.expertMode)
48657 {
48658 num13 += Main.rand.Next(4);
48659 }
48661 return;
48662 }
48663 break;
48664 }
48665 if ((
num9 == 4 ||
num9 == 5) &&
j < Main.UnderworldLayer && !Main.hardMode)
48666 {
48667 int stack3 = Main.rand.Next(20, 41);
48669 return;
48670 }
48672 if ((
double)
j < Main.worldSurface)
48673 {
48675 }
48676 else if (flag)
48677 {
48679 }
48680 else if (
j > Main.maxTilesY - 250)
48681 {
48683 }
48684 num15 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
48685 if (Main.rand.Next(4) == 0)
48686 {
48687 num15 *= 1f + (float)Main.rand.Next(5, 11) * 0.01f;
48688 }
48689 if (Main.rand.Next(8) == 0)
48690 {
48691 num15 *= 1f + (float)Main.rand.Next(10, 21) * 0.01f;
48692 }
48693 if (Main.rand.Next(12) == 0)
48694 {
48695 num15 *= 1f + (float)Main.rand.Next(20, 41) * 0.01f;
48696 }
48697 if (Main.rand.Next(16) == 0)
48698 {
48699 num15 *= 1f + (float)Main.rand.Next(40, 81) * 0.01f;
48700 }
48701 if (Main.rand.Next(20) == 0)
48702 {
48703 num15 *= 1f + (float)Main.rand.Next(50, 101) * 0.01f;
48704 }
48705 if (Main.expertMode)
48706 {
48708 }
48709 if (Main.expertMode && Main.rand.Next(2) == 0)
48710 {
48712 }
48713 if (Main.expertMode && Main.rand.Next(3) == 0)
48714 {
48716 }
48717 if (Main.expertMode && Main.rand.Next(4) == 0)
48718 {
48720 }
48722 if (
NPC.downedBoss1)
48723 {
48725 }
48726 if (
NPC.downedBoss2)
48727 {
48729 }
48730 if (
NPC.downedBoss3)
48731 {
48733 }
48734 if (
NPC.downedMechBoss1)
48735 {
48737 }
48738 if (
NPC.downedMechBoss2)
48739 {
48741 }
48742 if (
NPC.downedMechBoss3)
48743 {
48745 }
48746 if (
NPC.downedPlantBoss)
48747 {
48749 }
48750 if (
NPC.downedQueenBee)
48751 {
48753 }
48754 if (
NPC.downedGolemBoss)
48755 {
48757 }
48758 if (
NPC.downedPirates)
48759 {
48761 }
48762 if (
NPC.downedGoblins)
48763 {
48765 }
48766 if (
NPC.downedFrost)
48767 {
48769 }
48770 while ((
int)
num15 > 0)
48771 {
48772 if (
num15 > 1000000f)
48773 {
48775 if (
num16 > 50 && Main.rand.Next(2) == 0)
48776 {
48777 num16 /= Main.rand.Next(3) + 1;
48778 }
48779 if (Main.rand.Next(2) == 0)
48780 {
48781 num16 /= Main.rand.Next(3) + 1;
48782 }
48785 continue;
48786 }
48787 if (
num15 > 10000f)
48788 {
48790 if (
num17 > 50 && Main.rand.Next(2) == 0)
48791 {
48792 num17 /= Main.rand.Next(3) + 1;
48793 }
48794 if (Main.rand.Next(2) == 0)
48795 {
48796 num17 /= Main.rand.Next(3) + 1;
48797 }
48800 continue;
48801 }
48803 {
48805 if (
num18 > 50 && Main.rand.Next(2) == 0)
48806 {
48807 num18 /= Main.rand.Next(3) + 1;
48808 }
48809 if (Main.rand.Next(2) == 0)
48810 {
48811 num18 /= Main.rand.Next(3) + 1;
48812 }
48815 continue;
48816 }
48818 if (
num19 > 50 && Main.rand.Next(2) == 0)
48819 {
48820 num19 /= Main.rand.Next(3) + 1;
48821 }
48822 if (Main.rand.Next(2) == 0)
48823 {
48824 num19 /= Main.rand.Next(4) + 1;
48825 }
48827 {
48829 }
48832 }
48833 }
static UnifiedRandom genRand
static EntitySource_TileBreak GetProjectileSource_TileBreak(int x, int y)
static IEntitySource GetItemSource_FromTileBreak(int x, int y)