Inheritance: GenModShape
 public override bool Place(Point origin, StructureMap structures)
 {
     Point y;
     Point point;
     Dictionary<ushort, int> nums = new Dictionary<ushort, int>();
     Point point1 = new Point(origin.X - 25, origin.Y - 25);
     Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50);
     ushort[] numArray = new ushort[] { 0, 1 };
     WorldUtils.Gen(point1, rectangle, (new Actions.TileScanner(numArray)).Output(nums));
     if (nums[0] + nums[1] < 1250)
     {
         return false;
     }
     Searches.Up up = new Searches.Up(1000);
     GenCondition[] genConditionArray = new GenCondition[] { (new Conditions.IsSolid()).AreaOr(1, 50).Not() };
     bool flag = WorldUtils.Find(origin, Searches.Chain(up, genConditionArray), out y);
     Point point2 = origin;
     Searches.Up up1 = new Searches.Up(origin.Y - y.Y);
     GenCondition[] isTile = new GenCondition[1];
     ushort[] numArray1 = new ushort[] { 53 };
     isTile[0] = new Conditions.IsTile(numArray1);
     if (WorldUtils.Find(point2, Searches.Chain(up1, isTile), out point))
     {
         return false;
     }
     if (!flag)
     {
         return false;
     }
     y.Y = y.Y + 50;
     ShapeData shapeDatum = new ShapeData();
     ShapeData shapeDatum1 = new ShapeData();
     Point point3 = new Point(origin.X, origin.Y + 20);
     Point point4 = new Point(origin.X, origin.Y + 30);
     float single = 0.8f + GenBase._random.NextFloat() * 0.5f;
     if (!structures.CanPlace(new Rectangle(point3.X - (int)(20f * single), point3.Y - 20, (int)(40f * single), 40), 0))
     {
         return false;
     }
     if (!structures.CanPlace(new Rectangle(origin.X, y.Y + 10, 1, origin.Y - y.Y - 9), 2))
     {
         return false;
     }
     Shapes.Slime slime = new Shapes.Slime(20, single, 1f);
     GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(2, 0.4), (new Actions.ClearTile(true)).Output(shapeDatum) };
     WorldUtils.Gen(point3, slime, Actions.Chain(blotch));
     Shapes.Mound mound = new Shapes.Mound(14, 14);
     GenAction[] genActionArray = new GenAction[] { new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0, false, true), (new Actions.SetFrames(true)).Output(shapeDatum1) };
     WorldUtils.Gen(point4, mound, Actions.Chain(genActionArray));
     shapeDatum.Subtract(shapeDatum1, point3, point4);
     ModShapes.InnerOutline innerOutline = new ModShapes.InnerOutline(shapeDatum, true);
     GenAction[] setTile = new GenAction[] { new Actions.SetTile(2, false, true), new Actions.SetFrames(true) };
     WorldUtils.Gen(point3, innerOutline, Actions.Chain(setTile));
     ModShapes.All all = new ModShapes.All(shapeDatum);
     GenAction[] rectangleMask = new GenAction[] { new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid(0, 255) };
     WorldUtils.Gen(point3, all, Actions.Chain(rectangleMask));
     ModShapes.All all1 = new ModShapes.All(shapeDatum);
     GenAction[] placeWall = new GenAction[] { new Actions.PlaceWall(68, true), null, null, null };
     ushort[] numArray2 = new ushort[] { 2 };
     placeWall[1] = new Modifiers.OnlyTiles(numArray2);
     placeWall[2] = new Modifiers.Offset(0, 1);
     placeWall[3] = new ActionVines(3, 5, 52);
     WorldUtils.Gen(point3, all1, Actions.Chain(placeWall));
     ShapeData shapeDatum2 = new ShapeData();
     Point point5 = new Point(origin.X, y.Y + 10);
     Shapes.Rectangle rectangle1 = new Shapes.Rectangle(1, origin.Y - y.Y - 9);
     GenAction[] onlyTile = new GenAction[] { new Modifiers.Blotches(2, 0.2), (new Actions.ClearTile(false)).Output(shapeDatum2), new Modifiers.Expand(1), null, null };
     ushort[] numArray3 = new ushort[] { 53 };
     onlyTile[3] = new Modifiers.OnlyTiles(numArray3);
     onlyTile[4] = (new Actions.SetTile(397, false, true)).Output(shapeDatum2);
     WorldUtils.Gen(point5, rectangle1, Actions.Chain(onlyTile));
     WorldUtils.Gen(new Point(origin.X, y.Y + 10), new ModShapes.All(shapeDatum2), new Actions.SetFrames(true));
     if (GenBase._random.Next(3) != 0)
     {
         WorldGen.PlaceTile(point4.X, point4.Y - 15, 186, true, false, -1, 15);
     }
     else
     {
         WorldGen.PlaceTile(point4.X, point4.Y - 15, 187, true, false, -1, 17);
     }
     ModShapes.All all2 = new ModShapes.All(shapeDatum1);
     GenAction[] offset = new GenAction[] { new Modifiers.Offset(0, -1), null, null, null };
     ushort[] numArray4 = new ushort[] { 2 };
     offset[1] = new Modifiers.OnlyTiles(numArray4);
     offset[2] = new Modifiers.Offset(0, -1);
     offset[3] = new ActionGrass();
     WorldUtils.Gen(point4, all2, Actions.Chain(offset));
     structures.AddStructure(new Rectangle(point3.X - (int)(20f * single), point3.Y - 20, (int)(40f * single), 40), 4);
     return true;
 }
Esempio n. 2
0
 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)
		{
			Ref<int> @ref = new Ref<int>(0);
			Ref<int> ref2 = new Ref<int>(0);
			WorldUtils.Gen(origin, new Shapes.Circle(10), Actions.Chain(new GenAction[]
			{
				new Actions.Scanner(ref2),
				new Modifiers.IsSolid(),
				new Actions.Scanner(@ref)
			}));
			if (@ref.Value < ref2.Value - 5)
			{
				return false;
			}
			int num = GenBase._random.Next(6, 10);
			int num2 = GenBase._random.Next(5);
			if (!structures.CanPlace(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 0))
			{
				return false;
			}
			ShapeData data = new ShapeData();
			Point arg_12A_0 = origin;
			GenShape arg_12A_1 = new Shapes.Slime(num);
			GenAction[] array = new GenAction[6];
			array[0] = new Modifiers.Blotches(num2, num2, num2, 1, 0.3).Output(data);
			array[1] = new Modifiers.Offset(0, -2);
			array[2] = new Modifiers.OnlyTiles(new ushort[]
			{
				53
			});
			array[3] = new Actions.SetTile(397, true, true);
			GenAction[] arg_116_0 = array;
			int arg_116_1 = 4;
			byte[] types = new byte[1];
			arg_116_0[arg_116_1] = new Modifiers.OnlyWalls(types);
			array[5] = new Actions.PlaceWall(16, true);
			WorldUtils.Gen(arg_12A_0, arg_12A_1, Actions.Chain(array));
			Point arg_185_0 = origin;
			GenShape arg_185_1 = new ModShapes.All(data);
			GenAction[] array2 = new GenAction[5];
			array2[0] = new Actions.ClearTile(false);
			array2[1] = new Actions.SetLiquid(0, 0);
			array2[2] = new Actions.SetFrames(true);
			GenAction[] arg_171_0 = array2;
			int arg_171_1 = 3;
			byte[] types2 = new byte[1];
			arg_171_0[arg_171_1] = new Modifiers.OnlyWalls(types2);
			array2[4] = new Actions.PlaceWall(16, true);
			WorldUtils.Gen(arg_185_0, arg_185_1, Actions.Chain(array2));
			Point point;
			if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(10), new GenCondition[]
			{
				new Conditions.IsSolid()
			}), out point))
			{
				return false;
			}
			int num3 = point.Y - 1;
			bool flag = GenBase._random.Next() % 2 == 0;
			if (GenBase._random.Next() % 10 != 0)
			{
				int num4 = GenBase._random.Next(1, 4);
				int num5 = flag ? 4 : (-(num >> 1));
				for (int i = 0; i < num4; i++)
				{
					int num6 = GenBase._random.Next(1, 3);
					for (int j = 0; j < num6; j++)
					{
						WorldGen.PlaceTile(origin.X + num5 - i, num3 - j, 331, false, false, -1, 0);
					}
				}
			}
			int num7 = (num - 3) * (flag ? -1 : 1);
			if (GenBase._random.Next() % 10 != 0)
			{
				WorldGen.PlaceTile(origin.X + num7, num3, 186, false, false, -1, 0);
			}
			if (GenBase._random.Next() % 10 != 0)
			{
				WorldGen.PlaceTile(origin.X, num3, 215, true, false, -1, 0);
				if (GenBase._tiles[origin.X, num3].active() && GenBase._tiles[origin.X, num3].type == 215)
				{
					Tile expr_305 = GenBase._tiles[origin.X, num3];
					expr_305.frameY += 36;
					Tile expr_329 = GenBase._tiles[origin.X - 1, num3];
					expr_329.frameY += 36;
					Tile expr_34D = GenBase._tiles[origin.X + 1, num3];
					expr_34D.frameY += 36;
					Tile expr_371 = GenBase._tiles[origin.X, num3 - 1];
					expr_371.frameY += 36;
					Tile expr_397 = GenBase._tiles[origin.X - 1, num3 - 1];
					expr_397.frameY += 36;
					Tile expr_3BD = GenBase._tiles[origin.X + 1, num3 - 1];
					expr_3BD.frameY += 36;
				}
			}
			structures.AddStructure(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 4);
			return true;
		}