public override bool Place(Point origin, StructureMap structures)
 {
     Point y;
     if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y))
     {
         return false;
     }
     Searches.Down down = new Searches.Down(80);
     GenCondition[] isSolid = new GenCondition[] { new Conditions.IsSolid() };
     if (!WorldUtils.Find(origin, Searches.Chain(down, isSolid), out y))
     {
         return false;
     }
     y.Y = y.Y + 2;
     Ref<int> @ref = new Ref<int>(0);
     Shapes.Circle circle = new Shapes.Circle(8);
     GenAction[] genActionArray = new GenAction[] { new Modifiers.IsSolid(), new Actions.Scanner(@ref) };
     WorldUtils.Gen(y, circle, Actions.Chain(genActionArray));
     if (@ref.Value < 20)
     {
         return false;
     }
     if (!structures.CanPlace(new Rectangle(y.X - 8, y.Y - 8, 16, 16), 0))
     {
         return false;
     }
     Shapes.Circle circle1 = new Shapes.Circle(8);
     GenAction[] radialDither = new GenAction[] { new Modifiers.RadialDither(0f, 10f), new Modifiers.IsSolid(), new Actions.SetTile(229, true, true) };
     WorldUtils.Gen(y, circle1, Actions.Chain(radialDither));
     ShapeData shapeDatum = new ShapeData();
     Shapes.Circle circle2 = new Shapes.Circle(4, 3);
     GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(2, 0.3), new Modifiers.IsSolid(), new Actions.ClearTile(true), (new Modifiers.RectangleMask(-6, 6, 0, 3)).Output(shapeDatum), new Actions.SetLiquid(2, 255) };
     WorldUtils.Gen(y, circle2, Actions.Chain(blotch));
     Point point = new Point(y.X, y.Y + 1);
     ModShapes.InnerOutline innerOutline = new ModShapes.InnerOutline(shapeDatum, true);
     GenAction[] isEmpty = new GenAction[] { new Modifiers.IsEmpty(), new Modifiers.RectangleMask(-6, 6, 1, 3), new Actions.SetTile(59, true, true) };
     WorldUtils.Gen(point, innerOutline, Actions.Chain(isEmpty));
     structures.AddStructure(new Rectangle(y.X - 8, y.Y - 8, 16, 16), 0);
     return true;
 }
 public override bool Place(Point origin, StructureMap structures)
 {
     Point point;
     Ref<int> @ref = new Ref<int>(0);
     Ref<int> ref1 = new Ref<int>(0);
     Shapes.Circle circle = new Shapes.Circle(10);
     GenAction[] scanner = new GenAction[] { new Actions.Scanner(ref1), new Modifiers.IsSolid(), new Actions.Scanner(@ref) };
     WorldUtils.Gen(origin, circle, Actions.Chain(scanner));
     if (@ref.Value < ref1.Value - 5)
     {
         return false;
     }
     int num = GenBase._random.Next(6, 10);
     int num1 = GenBase._random.Next(5);
     if (!structures.CanPlace(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 0))
     {
         return false;
     }
     ShapeData shapeDatum = new ShapeData();
     Shapes.Slime slime = new Shapes.Slime(num);
     GenAction[] onlyTile = new GenAction[] { (new Modifiers.Blotches(num1, num1, num1, 1, 0.3)).Output(shapeDatum), new Modifiers.Offset(0, -2), null, null, null, null };
     ushort[] numArray = new ushort[] { 53 };
     onlyTile[2] = new Modifiers.OnlyTiles(numArray);
     onlyTile[3] = new Actions.SetTile(397, true, true);
     onlyTile[4] = new Modifiers.OnlyWalls(new byte[1]);
     onlyTile[5] = new Actions.PlaceWall(16, true);
     WorldUtils.Gen(origin, slime, Actions.Chain(onlyTile));
     ModShapes.All all = new ModShapes.All(shapeDatum);
     GenAction[] clearTile = new GenAction[] { new Actions.ClearTile(false), new Actions.SetLiquid(0, 0), new Actions.SetFrames(true), new Modifiers.OnlyWalls(new byte[1]), new Actions.PlaceWall(16, true) };
     WorldUtils.Gen(origin, all, Actions.Chain(clearTile));
     Searches.Down down = new Searches.Down(10);
     GenCondition[] isSolid = new GenCondition[] { new Conditions.IsSolid() };
     if (!WorldUtils.Find(origin, Searches.Chain(down, isSolid), out point))
     {
         return false;
     }
     int y = point.Y - 1;
     bool flag = GenBase._random.Next() % 2 == 0;
     if (GenBase._random.Next() % 10 != 0)
     {
         int num2 = GenBase._random.Next(1, 4);
         int num3 = (flag ? 4 : -(num >> 1));
         for (int i = 0; i < num2; i++)
         {
             int num4 = GenBase._random.Next(1, 3);
             for (int j = 0; j < num4; j++)
             {
                 WorldGen.PlaceTile(origin.X + num3 - i, y - j, 331, false, false, -1, 0);
             }
         }
     }
     int num5 = (num - 3) * (flag ? -1 : 1);
     if (GenBase._random.Next() % 10 != 0)
     {
         WorldGen.PlaceTile(origin.X + num5, y, 186, false, false, -1, 0);
     }
     if (GenBase._random.Next() % 10 != 0)
     {
         WorldGen.PlaceTile(origin.X, y, 215, true, false, -1, 0);
         if (GenBase._tiles[origin.X, y].active() && GenBase._tiles[origin.X, y].type == 215)
         {
             Tile tile = GenBase._tiles[origin.X, y];
             tile.frameY = (short)(tile.frameY + 36);
             Tile tile1 = GenBase._tiles[origin.X - 1, y];
             tile1.frameY = (short)(tile1.frameY + 36);
             Tile tile2 = GenBase._tiles[origin.X + 1, y];
             tile2.frameY = (short)(tile2.frameY + 36);
             Tile tile3 = GenBase._tiles[origin.X, y - 1];
             tile3.frameY = (short)(tile3.frameY + 36);
             Tile tile4 = GenBase._tiles[origin.X - 1, y - 1];
             tile4.frameY = (short)(tile4.frameY + 36);
             Tile tile5 = GenBase._tiles[origin.X + 1, y - 1];
             tile5.frameY = (short)(tile5.frameY + 36);
         }
     }
     structures.AddStructure(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 4);
     return true;
 }
 public override bool Place(Point origin, StructureMap structures)
 {
     Point point;
     if (WorldGen.SolidTile(origin.X, origin.Y) && GenBase._tiles[origin.X, origin.Y].wall == 3)
     {
         return false;
     }
     Searches.Down down = new Searches.Down(100);
     GenCondition[] isSolid = new GenCondition[] { new Conditions.IsSolid() };
     if (!WorldUtils.Find(origin, Searches.Chain(down, isSolid), out origin))
     {
         return false;
     }
     Point point1 = new Point(origin.X - 4, origin.Y);
     Searches.Down down1 = new Searches.Down(5);
     GenCondition[] genConditionArray = new GenCondition[1];
     ushort[] numArray = new ushort[] { 25 };
     genConditionArray[0] = (new Conditions.IsTile(numArray)).AreaAnd(8, 1);
     if (!WorldUtils.Find(point1, Searches.Chain(down1, genConditionArray), out point))
     {
         return false;
     }
     ShapeData shapeDatum = new ShapeData();
     ShapeData shapeDatum1 = new ShapeData();
     ShapeData shapeDatum2 = new ShapeData();
     for (int i = 0; i < 6; i++)
     {
         Shapes.Circle circle = new Shapes.Circle(GenBase._random.Next(10, 12) + i);
         GenAction[] offset = new GenAction[] { new Modifiers.Offset(0, 5 * i + 5), (new Modifiers.Blotches(3, 0.3)).Output(shapeDatum) };
         WorldUtils.Gen(origin, circle, Actions.Chain(offset));
     }
     for (int j = 0; j < 6; j++)
     {
         Shapes.Circle circle1 = new Shapes.Circle(GenBase._random.Next(5, 7) + j);
         GenAction[] genActionArray = new GenAction[] { new Modifiers.Offset(0, 2 * j + 18), (new Modifiers.Blotches(3, 0.3)).Output(shapeDatum1) };
         WorldUtils.Gen(origin, circle1, Actions.Chain(genActionArray));
     }
     for (int k = 0; k < 6; k++)
     {
         Shapes.Circle circle2 = new Shapes.Circle(GenBase._random.Next(4, 6) + k / 2);
         GenAction[] offset1 = new GenAction[] { new Modifiers.Offset(0, (int)(7.5f * (float)k) - 10), (new Modifiers.Blotches(3, 0.3)).Output(shapeDatum2) };
         WorldUtils.Gen(origin, circle2, Actions.Chain(offset1));
     }
     ShapeData shapeDatum3 = new ShapeData(shapeDatum1);
     shapeDatum1.Subtract(shapeDatum2, origin, origin);
     shapeDatum3.Subtract(shapeDatum1, origin, origin);
     ShapeData[] shapeDataArray = new ShapeData[] { shapeDatum, shapeDatum2 };
     Rectangle bounds = ShapeData.GetBounds(origin, shapeDataArray);
     if (!structures.CanPlace(bounds, CorruptionPitBiome.ValidTiles, 2))
     {
         return false;
     }
     ModShapes.All all = new ModShapes.All(shapeDatum);
     GenAction[] setTile = new GenAction[] { new Actions.SetTile(25, true, true), new Actions.PlaceWall(3, true) };
     WorldUtils.Gen(origin, all, Actions.Chain(setTile));
     WorldUtils.Gen(origin, new ModShapes.All(shapeDatum1), new Actions.SetTile(0, true, true));
     WorldUtils.Gen(origin, new ModShapes.All(shapeDatum2), new Actions.ClearTile(true));
     ModShapes.All all1 = new ModShapes.All(shapeDatum1);
     GenAction[] isTouchingAir = new GenAction[] { new Modifiers.IsTouchingAir(true), null, null };
     ushort[] numArray1 = new ushort[] { 25 };
     isTouchingAir[1] = new Modifiers.NotTouching(false, numArray1);
     isTouchingAir[2] = new Actions.SetTile(23, true, true);
     WorldUtils.Gen(origin, all1, Actions.Chain(isTouchingAir));
     WorldUtils.Gen(origin, new ModShapes.All(shapeDatum3), new Actions.PlaceWall(69, true));
     structures.AddStructure(bounds, 2);
     return true;
 }
 public override bool Place(Point origin, StructureMap structures)
 {
     Point point;
     Point point1;
     Point point2 = new Point(origin.X - 3, origin.Y);
     Searches.Down down = new Searches.Down(200);
     GenCondition[] genConditionArray = new GenCondition[] { (new Conditions.IsSolid()).AreaAnd(6, 1) };
     if (!WorldUtils.Find(point2, Searches.Chain(down, genConditionArray), out point))
     {
         return false;
     }
     Point point3 = new Point(point.X, point.Y - 5);
     Searches.Up up = new Searches.Up(120);
     GenCondition[] genConditionArray1 = new GenCondition[] { (new Conditions.IsSolid()).AreaOr(6, 1) };
     if (!WorldUtils.Find(point3, Searches.Chain(up, genConditionArray1), out point1) || point.Y - 5 - point1.Y > 60)
     {
         return false;
     }
     if (point.Y - point1.Y < 30)
     {
         return false;
     }
     if (!structures.CanPlace(new Rectangle(point.X - 30, point.Y - 60, 60, 90), 0))
     {
         return false;
     }
     Dictionary<ushort, int> nums = new Dictionary<ushort, int>();
     Point point4 = new Point(point.X - 25, point.Y - 25);
     Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50);
     ushort[] numArray = new ushort[] { 0, 59, 147, 1 };
     WorldUtils.Gen(point4, rectangle, (new Actions.TileScanner(numArray)).Output(nums));
     int item = nums[0] + nums[1];
     int num = nums[59];
     if (nums[147] > num || item > num || num < 50)
     {
         return false;
     }
     int y = (point.Y - point1.Y - 9) / 5;
     int num1 = y * 5;
     int num2 = 0;
     double num3 = GenBase._random.NextDouble() + 1;
     double num4 = GenBase._random.NextDouble() + 2;
     if (GenBase._random.Next(2) == 0)
     {
         num4 = -num4;
     }
     for (int i = 0; i < y; i++)
     {
         double num5 = (double)(i + 1) / 12;
         int num6 = (int)(Math.Sin(num5 * num3 * 3.14159274101257) * num4);
         int num7 = (num6 < num2 ? num6 - num2 : 0);
         Point point5 = new Point(point.X + num2 + num7, point.Y - (i + 1) * 5);
         Shapes.Rectangle rectangle1 = new Shapes.Rectangle(6 + Math.Abs(num6 - num2), 7);
         GenAction[] removeWall = new GenAction[] { new Actions.RemoveWall(), new Actions.SetTile(383, false, true), new Actions.SetFrames(false) };
         WorldUtils.Gen(point5, rectangle1, Actions.Chain(removeWall));
         Point point6 = new Point(point.X + num2 + num7 + 2, point.Y - (i + 1) * 5);
         Shapes.Rectangle rectangle2 = new Shapes.Rectangle(2 + Math.Abs(num6 - num2), 5);
         GenAction[] clearTile = new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) };
         WorldUtils.Gen(point6, rectangle2, Actions.Chain(clearTile));
         Point point7 = new Point(point.X + num2 + 2, point.Y - i * 5);
         Shapes.Rectangle rectangle3 = new Shapes.Rectangle(2, 2);
         GenAction[] genActionArray = new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) };
         WorldUtils.Gen(point7, rectangle3, Actions.Chain(genActionArray));
         num2 = num6;
     }
     int num8 = 6;
     if (num4 < 0)
     {
         num8 = 0;
     }
     List<Point> points = new List<Point>();
     for (int j = 0; j < 2; j++)
     {
         double num9 = ((double)j + 1) / 3;
         int num10 = num8 + (int)(Math.Sin((double)y * num9 / 12 * num3 * 3.14159274101257) * num4);
         double num11 = GenBase._random.NextDouble() * 0.785398185253143 - 0.785398185253143 - 0.200000002980232;
         if (num8 == 0)
         {
             num11 = num11 - 1.57079637050629;
         }
         Point point8 = new Point(point.X + num10, point.Y - (int)((double)(y * 5) * num9));
         ShapeBranch shapeBranch = (new ShapeBranch(num11, (double)GenBase._random.Next(12, 16))).OutputEndpoints(points);
         GenAction[] setTile = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) };
         WorldUtils.Gen(point8, shapeBranch, Actions.Chain(setTile));
         num8 = 6 - num8;
     }
     int num12 = (int)(Math.Sin((double)y / 12 * num3 * 3.14159274101257) * num4);
     Point point9 = new Point(point.X + 6 + num12, point.Y - num1);
     ShapeBranch shapeBranch1 = (new ShapeBranch(-0.685398185253143, (double)GenBase._random.Next(16, 22))).OutputEndpoints(points);
     GenAction[] setTile1 = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) };
     WorldUtils.Gen(point9, shapeBranch1, Actions.Chain(setTile1));
     Point point10 = new Point(point.X + num12, point.Y - num1);
     ShapeBranch shapeBranch2 = (new ShapeBranch(-2.45619455575943, (double)GenBase._random.Next(16, 22))).OutputEndpoints(points);
     GenAction[] genActionArray1 = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) };
     WorldUtils.Gen(point10, shapeBranch2, Actions.Chain(genActionArray1));
     foreach (Point point11 in points)
     {
         Shapes.Circle circle = new Shapes.Circle(4);
         GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(4, 2, 0.3), null, null, null, null };
         ushort[] numArray1 = new ushort[] { 383 };
         blotch[1] = new Modifiers.SkipTiles(numArray1);
         byte[] numArray2 = new byte[] { 78 };
         blotch[2] = new Modifiers.SkipWalls(numArray2);
         blotch[3] = new Actions.SetTile(384, false, true);
         blotch[4] = new Actions.SetFrames(true);
         WorldUtils.Gen(point11, circle, Actions.Chain(blotch));
     }
     for (int k = 0; k < 4; k++)
     {
         float single = (float)k / 3f * 2f + 0.57075f;
         WorldUtils.Gen(point, new ShapeRoot(single, (float)GenBase._random.Next(40, 60), 4f, 1f), new Actions.SetTile(383, true, true));
     }
     WorldGen.AddBuriedChest(point.X + 3, point.Y - 1, (GenBase._random.Next(4) == 0 ? 0 : WorldGen.GetNextJungleChestItem()), false, 10);
     structures.AddStructure(new Rectangle(point.X - 30, point.Y - 30, 60, 60), 0);
     return true;
 }