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

◆ FinishDrunkGen()

static void Terraria.WorldGen.FinishDrunkGen ( )
inlinestaticprivate

Definition at line 18064 of file WorldGen.cs.

18065 {
18066 byte color = (byte)genRand.Next(13, 25);
18067 byte b = 16;
18068 for (int i = 0; i < Main.maxTilesX; i++)
18069 {
18070 bool flag = false;
18071 for (int j = 0; j < Main.maxTilesY; j++)
18072 {
18073 if (!Main.tile[i, j].active() || !Main.tileDungeon[Main.tile[i, j].type])
18074 {
18075 continue;
18076 }
18077 if (Main.tile[i, j].type == 44)
18078 {
18079 color = (byte)genRand.Next(13, 15);
18080 if (genRand.Next(2) == 0)
18081 {
18082 color = (byte)genRand.Next(23, 25);
18083 }
18084 }
18085 if (Main.tile[i, j].type == 43)
18086 {
18087 color = (byte)genRand.Next(15, 19);
18088 }
18089 if (Main.tile[i, j].type == 41)
18090 {
18091 color = (byte)genRand.Next(19, 23);
18092 }
18093 }
18094 if (flag)
18095 {
18096 break;
18097 }
18098 }
18099 for (int k = 10; k < Main.maxTilesX - 10; k++)
18100 {
18101 for (int l = 10; l < Main.maxTilesY - 10; l++)
18102 {
18103 if (Main.tile[k, l].active() && (Main.tileDungeon[Main.tile[k, l].type] || TileID.Sets.CrackedBricks[Main.tile[k, l].type]))
18104 {
18105 Main.tile[k, l].color(color);
18106 }
18107 if (Main.wallDungeon[Main.tile[k, l].wall])
18108 {
18109 Main.tile[k, l].wallColor(25);
18110 }
18111 if (Main.tile[k, l].active())
18112 {
18113 if (Main.tile[k, l].type == 60)
18114 {
18115 int num = 1;
18116 for (int m = k - num; m <= k + num; m++)
18117 {
18118 for (int n = l - num; n <= l + num; n++)
18119 {
18120 if (Main.tile[m, n].type == 147 || Main.tile[m, n].type == 161)
18121 {
18122 Main.tile[m, n].type = 59;
18123 }
18124 }
18125 }
18126 }
18127 bool flag2 = false;
18128 if (Main.tile[k, l].type == 226)
18129 {
18130 flag2 = true;
18131 }
18132 if (Main.tile[k, l].type == 137)
18133 {
18134 int num2 = Main.tile[k, l].frameY / 18;
18135 if (num2 >= 1 && num2 <= 4)
18136 {
18137 flag2 = true;
18138 }
18139 }
18140 if (flag2)
18141 {
18142 Main.tile[k, l].color(b);
18143 }
18144 }
18145 if (Main.tile[k, l].wall == 87)
18146 {
18147 Main.tile[k, l].wallColor(b);
18148 }
18149 }
18150 }
18151 for (int num3 = 0; num3 < 8000 && Main.chest[num3] != null; num3++)
18152 {
18153 if (genRand.Next(15) == 0 && Main.chest[num3].item[1].stack != 0)
18154 {
18155 for (int num4 = 1; num4 < 40; num4++)
18156 {
18157 if (Main.chest[num3].item[num4].stack == 0)
18158 {
18159 Main.chest[num3].item[num4].SetDefaults(5001);
18160 break;
18161 }
18162 }
18163 }
18164 if (genRand.Next(30) != 0 || Main.chest[num3].item[1].stack == 0)
18165 {
18166 continue;
18167 }
18168 for (int num5 = 1; num5 < 40; num5++)
18169 {
18170 if (Main.chest[num3].item[num5].stack == 0)
18171 {
18172 Main.chest[num3].item[num5].SetDefaults(678);
18173 break;
18174 }
18175 }
18176 }
18177 }
static bool[] CrackedBricks
Definition TileID.cs:113
static UnifiedRandom genRand
Definition WorldGen.cs:1215

References Terraria.Main.chest, Terraria.ID.TileID.Sets.CrackedBricks, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.tile, Terraria.Main.tileDungeon, and Terraria.Main.wallDungeon.