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

◆ KillTile_DropBait()

static void Terraria.WorldGen.KillTile_DropBait ( int i,
int j,
Tile tileCache )
inlinestaticprivate

Definition at line 60599 of file WorldGen.cs.

60600 {
60601 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
60602 int num = -1;
60603 int num3 = -1;
60604 int num4 = -1;
60605 int num5 = -1;
60606 int num6 = Player.FindClosest(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16);
60607 if (tileCache.type == 3)
60608 {
60609 num = 400;
60610 num3 = 100;
60611 if (Main.player[num6].flowerBoots && tileCache.frameX >= 108)
60612 {
60613 num *= 10000;
60614 num3 *= 10000;
60615 }
60616 }
60617 if (tileCache.type == 73)
60618 {
60619 num = 200;
60620 num3 = 50;
60621 if (Main.player[num6].flowerBoots && tileCache.frameX >= 108)
60622 {
60623 num *= 10000;
60624 num3 *= 10000;
60625 }
60626 }
60627 if (tileCache.type == 637)
60628 {
60629 num5 = 100;
60630 if (Main.player[num6].flowerBoots && tileCache.frameX >= 108)
60631 {
60632 num5 *= 10000;
60633 }
60634 }
60635 if (tileCache.type == 61)
60636 {
60637 num4 = 80;
60638 if (Main.player[num6].flowerBoots && tileCache.frameX >= 108)
60639 {
60640 num4 *= 10000;
60641 }
60642 }
60643 if (tileCache.type == 74)
60644 {
60645 num4 = 40;
60646 if (Main.player[num6].flowerBoots && tileCache.frameX >= 108)
60647 {
60648 num4 *= 10000;
60649 }
60650 }
60651 if (tileCache.type == 62)
60652 {
60653 num4 = 250;
60654 }
60655 if (tileCache.type == 185)
60656 {
60657 if (tileCache.frameY == 0 && tileCache.frameX < 214)
60658 {
60659 num = 6;
60660 }
60661 if (tileCache.frameY == 18 && (tileCache.frameX < 214 || tileCache.frameX >= 1368))
60662 {
60663 num = 6;
60664 }
60665 }
60666 else if (tileCache.type == 186)
60667 {
60668 if (tileCache.frameX >= 378 && tileCache.frameX <= 700)
60669 {
60670 num = 6;
60671 }
60672 }
60673 else if (tileCache.type == 187)
60674 {
60675 if (tileCache.frameX >= 756 && tileCache.frameX <= 916)
60676 {
60677 num = 6;
60678 }
60679 if (tileCache.frameX <= 322)
60680 {
60681 num = 6;
60682 }
60683 }
60684 else if (tileCache.type == 233)
60685 {
60686 num4 = 10;
60687 }
60688 int num7 = 357;
60689 if (Main.player[num6].ZoneGraveyard)
60690 {
60691 num7 = 606;
60692 }
60693 TileLoader.DropCritterChance(i, j, tileCache.type, ref num, ref num3, ref num4);
60694 if (num > 0 && NPC.CountNPCS(num7) < 5 && genRand.Next(num) == 0)
60695 {
60696 int type = num7;
60697 if (num7 == 357 && Player.GetClosestRollLuck(i, j, NPC.goldCritterChance) == 0f)
60698 {
60699 type = 448;
60700 }
60701 int num8 = NPC.NewNPC(GetNPCSource_TileBreak(i, j), i * 16 + 10, j * 16, type);
60702 Main.npc[num8].TargetClosest();
60703 Main.npc[num8].velocity.Y = (float)genRand.Next(-50, -21) * 0.1f;
60704 Main.npc[num8].velocity.X = (float)genRand.Next(0, 26) * 0.1f * (float)(-Main.npc[num8].direction);
60705 Main.npc[num8].direction *= -1;
60706 Main.npc[num8].netUpdate = true;
60707 }
60708 if (num3 > 0 && NPC.CountNPCS(377) < 5 && genRand.Next(num3) == 0)
60709 {
60710 int type2 = 377;
60711 if (Player.GetClosestRollLuck(i, j, NPC.goldCritterChance) == 0f)
60712 {
60713 type2 = 446;
60714 }
60715 int num9 = NPC.NewNPC(GetNPCSource_TileBreak(i, j), i * 16 + 10, j * 16, type2);
60716 Main.npc[num9].TargetClosest();
60717 Main.npc[num9].velocity.Y = (float)genRand.Next(-50, -21) * 0.1f;
60718 Main.npc[num9].velocity.X = (float)genRand.Next(0, 26) * 0.1f * (float)(-Main.npc[num9].direction);
60719 Main.npc[num9].direction *= -1;
60720 Main.npc[num9].netUpdate = true;
60721 }
60722 if (num4 > 0 && NPC.CountNPCS(485) + NPC.CountNPCS(486) + NPC.CountNPCS(487) < 8 && genRand.Next(num4) == 0)
60723 {
60724 int type3 = 485;
60725 if (genRand.Next(4) == 0)
60726 {
60727 type3 = 486;
60728 }
60729 if (genRand.Next(12) == 0)
60730 {
60731 type3 = 487;
60732 }
60733 int num10 = NPC.NewNPC(GetNPCSource_TileBreak(i, j), i * 16 + 10, j * 16, type3);
60734 Main.npc[num10].TargetClosest();
60735 Main.npc[num10].velocity.Y = (float)genRand.Next(-50, -21) * 0.1f;
60736 Main.npc[num10].velocity.X = (float)genRand.Next(0, 26) * 0.1f * (float)(-Main.npc[num10].direction);
60737 Main.npc[num10].direction *= -1;
60738 Main.npc[num10].netUpdate = true;
60739 }
60740 if (num5 > 0 && NPC.CountNPCS(654) + NPC.CountNPCS(653) < 8 && genRand.Next(num5) == 0)
60741 {
60742 int type4 = 653;
60743 if (genRand.Next(2) == 0)
60744 {
60745 type4 = 654;
60746 }
60747 int num2 = NPC.NewNPC(GetNPCSource_TileBreak(i, j), i * 16 + 10, j * 16, type4);
60748 Main.npc[num2].TargetClosest();
60749 Main.npc[num2].velocity.Y = (float)genRand.Next(-50, -21) * 0.1f;
60750 Main.npc[num2].velocity.X = (float)genRand.Next(0, 26) * 0.1f * (float)(-Main.npc[num2].direction);
60751 Main.npc[num2].direction *= -1;
60752 Main.npc[num2].netUpdate = true;
60753 }
60754 }
static void DropCritterChance(int i, int j, int type, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance)
This serves as the central class from which tile-related functions are supported and carried out.
Definition TileLoader.cs:23
static EntitySource_TileBreak GetNPCSource_TileBreak(int x, int y)
Definition WorldGen.cs:1557
static UnifiedRandom genRand
Definition WorldGen.cs:1455

References Terraria.NPC.CountNPCS(), Terraria.ModLoader.TileLoader.DropCritterChance(), Terraria.Player.FindClosest(), Terraria.Tile.frameX, Terraria.Tile.frameY, Terraria.Player.GetClosestRollLuck(), Terraria.NPC.goldCritterChance, Terraria.NPC.NewNPC(), Terraria.Main.npc, Terraria.Main.player, and Terraria.Tile.type.

+ Here is the call graph for this function: