Terraria v1.4.4.9
Terraria 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 56965 of file WorldGen.cs.

56966 {
56967 int num = -1;
56968 int num2 = -1;
56969 int num3 = -1;
56970 int num4 = -1;
56971 int num5 = Player.FindClosest(new Vector2(i * 16, j * 16), 16, 16);
56972 if (tileCache.type == 3)
56973 {
56974 num = 400;
56975 num2 = 100;
56976 if (Main.player[num5].flowerBoots && tileCache.frameX >= 108)
56977 {
56978 num *= 10000;
56979 num2 *= 10000;
56980 }
56981 }
56982 if (tileCache.type == 73)
56983 {
56984 num = 200;
56985 num2 = 50;
56986 if (Main.player[num5].flowerBoots && tileCache.frameX >= 108)
56987 {
56988 num *= 10000;
56989 num2 *= 10000;
56990 }
56991 }
56992 if (tileCache.type == 637)
56993 {
56994 num4 = 100;
56995 if (Main.player[num5].flowerBoots && tileCache.frameX >= 108)
56996 {
56997 num4 *= 10000;
56998 }
56999 }
57000 if (tileCache.type == 61)
57001 {
57002 num3 = 80;
57003 if (Main.player[num5].flowerBoots && tileCache.frameX >= 108)
57004 {
57005 num3 *= 10000;
57006 }
57007 }
57008 if (tileCache.type == 74)
57009 {
57010 num3 = 40;
57011 if (Main.player[num5].flowerBoots && tileCache.frameX >= 108)
57012 {
57013 num3 *= 10000;
57014 }
57015 }
57016 if (tileCache.type == 62)
57017 {
57018 num3 = 250;
57019 }
57020 if (tileCache.type == 185)
57021 {
57022 if (tileCache.frameY == 0 && tileCache.frameX < 214)
57023 {
57024 num = 6;
57025 }
57026 if (tileCache.frameY == 18 && (tileCache.frameX < 214 || tileCache.frameX >= 1368))
57027 {
57028 num = 6;
57029 }
57030 }
57031 else if (tileCache.type == 186)
57032 {
57033 if (tileCache.frameX >= 378 && tileCache.frameX <= 700)
57034 {
57035 num = 6;
57036 }
57037 }
57038 else if (tileCache.type == 187)
57039 {
57040 if (tileCache.frameX >= 756 && tileCache.frameX <= 916)
57041 {
57042 num = 6;
57043 }
57044 if (tileCache.frameX <= 322)
57045 {
57046 num = 6;
57047 }
57048 }
57049 else if (tileCache.type == 233)
57050 {
57051 num3 = 10;
57052 }
57053 int num6 = 357;
57054 if (Main.player[num5].ZoneGraveyard)
57055 {
57056 num6 = 606;
57057 }
57058 if (num > 0 && NPC.CountNPCS(num6) < 5 && genRand.Next(num) == 0)
57059 {
57060 int type = num6;
57061 if (num6 == 357 && Player.GetClosestRollLuck(i, j, NPC.goldCritterChance) == 0f)
57062 {
57063 type = 448;
57064 }
57065 int num7 = NPC.NewNPC(GetNPCSource_TileBreak(i, j), i * 16 + 10, j * 16, type);
57066 Main.npc[num7].TargetClosest();
57067 Main.npc[num7].velocity.Y = (float)genRand.Next(-50, -21) * 0.1f;
57068 Main.npc[num7].velocity.X = (float)genRand.Next(0, 26) * 0.1f * (float)(-Main.npc[num7].direction);
57069 Main.npc[num7].direction *= -1;
57070 Main.npc[num7].netUpdate = true;
57071 }
57072 if (num2 > 0 && NPC.CountNPCS(377) < 5 && genRand.Next(num2) == 0)
57073 {
57074 int type2 = 377;
57075 if (Player.GetClosestRollLuck(i, j, NPC.goldCritterChance) == 0f)
57076 {
57077 type2 = 446;
57078 }
57079 int num8 = NPC.NewNPC(GetNPCSource_TileBreak(i, j), i * 16 + 10, j * 16, type2);
57080 Main.npc[num8].TargetClosest();
57081 Main.npc[num8].velocity.Y = (float)genRand.Next(-50, -21) * 0.1f;
57082 Main.npc[num8].velocity.X = (float)genRand.Next(0, 26) * 0.1f * (float)(-Main.npc[num8].direction);
57083 Main.npc[num8].direction *= -1;
57084 Main.npc[num8].netUpdate = true;
57085 }
57086 if (num3 > 0 && NPC.CountNPCS(485) + NPC.CountNPCS(486) + NPC.CountNPCS(487) < 8 && genRand.Next(num3) == 0)
57087 {
57088 int type3 = 485;
57089 if (genRand.Next(4) == 0)
57090 {
57091 type3 = 486;
57092 }
57093 if (genRand.Next(12) == 0)
57094 {
57095 type3 = 487;
57096 }
57097 int num9 = NPC.NewNPC(GetNPCSource_TileBreak(i, j), i * 16 + 10, j * 16, type3);
57098 Main.npc[num9].TargetClosest();
57099 Main.npc[num9].velocity.Y = (float)genRand.Next(-50, -21) * 0.1f;
57100 Main.npc[num9].velocity.X = (float)genRand.Next(0, 26) * 0.1f * (float)(-Main.npc[num9].direction);
57101 Main.npc[num9].direction *= -1;
57102 Main.npc[num9].netUpdate = true;
57103 }
57104 if (num4 > 0 && NPC.CountNPCS(654) + NPC.CountNPCS(653) < 8 && genRand.Next(num4) == 0)
57105 {
57106 int type4 = 653;
57107 if (genRand.Next(2) == 0)
57108 {
57109 type4 = 654;
57110 }
57111 int num10 = NPC.NewNPC(GetNPCSource_TileBreak(i, j), i * 16 + 10, j * 16, type4);
57112 Main.npc[num10].TargetClosest();
57113 Main.npc[num10].velocity.Y = (float)genRand.Next(-50, -21) * 0.1f;
57114 Main.npc[num10].velocity.X = (float)genRand.Next(0, 26) * 0.1f * (float)(-Main.npc[num10].direction);
57115 Main.npc[num10].direction *= -1;
57116 Main.npc[num10].netUpdate = true;
57117 }
57118 }
static EntitySource_TileBreak GetNPCSource_TileBreak(int x, int y)
Definition WorldGen.cs:1313
static UnifiedRandom genRand
Definition WorldGen.cs:1215

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