public override bool Place(Point origin, StructureMap structures)
        {
            if (GenBase._tiles[(int)origin.X, (int)origin.Y].active() && WorldGen.SolidTile((int)origin.X, (int)origin.Y))
            {
                return(false);
            }
            Point result;

            if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(80), (GenCondition) new Conditions.IsSolid()), out result))
            {
                return(false);
            }
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            Point& local = @result;
            // ISSUE: explicit reference operation
            int num = (^ local).Y + 2;

            // ISSUE: explicit reference operation
            (^ local).Y = (__Null)num;
            Ref <int> count = new Ref <int>(0);

            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count)));
            if (count.Value < 20 || !structures.CanPlace(new Rectangle(result.X - 8, result.Y - 8, 16, 16), 0))
            {
                return(false);
            }
            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.RadialDither(0.0f, 10f), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.SetTile((ushort)229, true, true)));
            ShapeData data = new ShapeData();

            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(4, 3), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.3), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.ClearTile(true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), (GenAction) new Actions.SetLiquid(2, byte.MaxValue)));
            WorldUtils.Gen(new Point((int)result.X, result.Y + 1), (GenShape) new ModShapes.InnerOutline(data, true), Actions.Chain((GenAction) new Modifiers.IsEmpty(), (GenAction) new Modifiers.RectangleMask(-6, 6, 1, 3), (GenAction) new Actions.SetTile((ushort)59, true, true)));
            structures.AddStructure(new Rectangle(result.X - 8, result.Y - 8, 16, 16), 0);
            return(true);
        }
Beispiel #2
0
        private static List <Rectangle> CreateRooms(Point origin)
        {
            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(200), new Conditions.IsSolid()), out Point result) || result == origin)
            {
                return(new List <Rectangle>());
            }
            Rectangle item       = FindRoom(result);
            Rectangle rectangle  = FindRoom(new Point(item.Center.X, item.Y + 1));
            Rectangle rectangle2 = FindRoom(new Point(item.Center.X, item.Y + item.Height + 10));

            rectangle2.Y = item.Y + item.Height - 1;
            float roomSolidPrecentage  = GetRoomSolidPrecentage(rectangle);
            float roomSolidPrecentage2 = GetRoomSolidPrecentage(rectangle2);

            item.Y       += 3;
            rectangle.Y  += 3;
            rectangle2.Y += 3;
            List <Rectangle> list = new List <Rectangle>();

            if (WorldGen.genRand.NextFloat() > roomSolidPrecentage + 0.2f)
            {
                list.Add(rectangle);
            }
            list.Add(item);
            if (WorldGen.genRand.NextFloat() > roomSolidPrecentage2 + 0.2f)
            {
                list.Add(rectangle2);
            }
            return(list);
        }
Beispiel #3
0
        private static List <Microsoft.Xna.Framework.Rectangle> CreateRooms(Point origin)
        {
            Point result;

            if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(200), (GenCondition) new Conditions.IsSolid()), out result) || result == origin)
            {
                return(new List <Microsoft.Xna.Framework.Rectangle>());
            }
            Microsoft.Xna.Framework.Rectangle room1 = HouseUtils.FindRoom(result);
            Microsoft.Xna.Framework.Rectangle room2 = HouseUtils.FindRoom(new Point(room1.Center.X, room1.Y + 1));
            Microsoft.Xna.Framework.Rectangle room3 = HouseUtils.FindRoom(new Point(room1.Center.X, room1.Y + room1.Height + 10));
            room3.Y = room1.Y + room1.Height - 1;
            float roomSolidPrecentage1 = HouseUtils.GetRoomSolidPrecentage(room2);
            float roomSolidPrecentage2 = HouseUtils.GetRoomSolidPrecentage(room3);

            room1.Y += 3;
            room2.Y += 3;
            room3.Y += 3;
            List <Microsoft.Xna.Framework.Rectangle> rectangleList = new List <Microsoft.Xna.Framework.Rectangle>();

            if ((double)WorldGen.genRand.NextFloat() > (double)roomSolidPrecentage1 + 0.200000002980232)
            {
                rectangleList.Add(room2);
            }
            rectangleList.Add(room1);
            if ((double)WorldGen.genRand.NextFloat() > (double)roomSolidPrecentage2 + 0.200000002980232)
            {
                rectangleList.Add(room3);
            }
            return(rectangleList);
        }
        public override bool Place(Point origin, StructureMap structures)
        {
            Dictionary <ushort, int> resultsOutput = new Dictionary <ushort, int>();

            WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), (GenShape) new Shapes.Rectangle(50, 50), (GenAction) new Actions.TileScanner(new ushort[2]
            {
                (ushort)0,
                (ushort)1
            }).Output(resultsOutput));
            if (resultsOutput[(ushort)0] + resultsOutput[(ushort)1] < 1250)
            {
                return(false);
            }
            Point result1;
            bool  flag = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result1);
            Point result2;

            if (WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Up((int)(origin.Y - result1.Y)), (GenCondition) new Conditions.IsTile(new ushort[1]
            {
                (ushort)53
            })), out result2) || !flag)
            {
                return(false);
            }
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            __Null& local = @result1.Y;
            // ISSUE: cast to a reference type
            // ISSUE: explicit reference operation
            int num = ^ (int&)local + 50;
Beispiel #5
0
        public override bool Place(Point origin, StructureMap structures)
        {
            Dictionary <ushort, int> dictionary = new Dictionary <ushort, int>();

            WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(0, 1).Output(dictionary));
            int num = dictionary[0] + dictionary[1];

            if (num < 1250)
            {
                return(false);
            }
            Point result;
            bool  flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result);
            Point result2;

            if (WorldUtils.Find(origin, Searches.Chain(new Searches.Up(origin.Y - result.Y), new Conditions.IsTile(53)), out result2))
            {
                return(false);
            }
            if (!flag)
            {
                return(false);
            }
            result.Y += 50;
            ShapeData shapeData  = new ShapeData();
            ShapeData shapeData2 = new ShapeData();
            Point     point      = new Point(origin.X, origin.Y + 20);
            Point     point2     = new Point(origin.X, origin.Y + 30);
            float     num2       = 0.8f + GenBase._random.NextFloat() * 0.5f;

            if (!structures.CanPlace(new Rectangle(point.X - (int)(20f * num2), point.Y - 20, (int)(40f * num2), 40)))
            {
                return(false);
            }
            if (!structures.CanPlace(new Rectangle(origin.X, result.Y + 10, 1, origin.Y - result.Y - 9), 2))
            {
                return(false);
            }
            WorldUtils.Gen(point, new Shapes.Slime(20, num2, 1f), Actions.Chain(new Modifiers.Blotches(2, 0.4), new Actions.ClearTile(true).Output(shapeData)));
            WorldUtils.Gen(point2, new Shapes.Mound(14, 14), Actions.Chain(new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0), new Actions.SetFrames(true).Output(shapeData2)));
            shapeData.Subtract(shapeData2, point, point2);
            WorldUtils.Gen(point, new ModShapes.InnerOutline(shapeData), Actions.Chain(new Actions.SetTile(2), new Actions.SetFrames(true)));
            WorldUtils.Gen(point, new ModShapes.All(shapeData), Actions.Chain(new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid()));
            WorldUtils.Gen(point, new ModShapes.All(shapeData), Actions.Chain(new Actions.PlaceWall(68), new Modifiers.OnlyTiles(2), new Modifiers.Offset(0, 1), new ActionVines(3, 5)));
            ShapeData data = new ShapeData();

            WorldUtils.Gen(new Point(origin.X, result.Y + 10), new Shapes.Rectangle(1, origin.Y - result.Y - 9), Actions.Chain(new Modifiers.Blotches(2, 0.2), new Actions.ClearTile().Output(data), new Modifiers.Expand(1), new Modifiers.OnlyTiles(53), new Actions.SetTile(397).Output(data)));
            WorldUtils.Gen(new Point(origin.X, result.Y + 10), new ModShapes.All(data), new Actions.SetFrames(true));
            if (GenBase._random.Next(3) == 0)
            {
                WorldGen.PlaceTile(point2.X, point2.Y - 15, 187, true, false, -1, 17);
            }
            else
            {
                WorldGen.PlaceTile(point2.X, point2.Y - 15, 186, true, false, -1, 15);
            }
            WorldUtils.Gen(point2, new ModShapes.All(shapeData2), Actions.Chain(new Modifiers.Offset(0, -1), new Modifiers.OnlyTiles(2), new Modifiers.Offset(0, -1), new ActionGrass()));
            structures.AddStructure(new Rectangle(point.X - (int)(20f * num2), point.Y - 20, (int)(40f * num2), 40), 4);
            return(true);
        }
Beispiel #6
0
        public override bool Place(Point origin, StructureMap structures)
        {
            if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y))
            {
                return(false);
            }
            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), new Conditions.IsSolid()), out var result))
            {
                return(false);
            }
            result.Y += 2;
            Ref <int> @ref = new Ref <int>(0);

            WorldUtils.Gen(result, new Shapes.Circle(8), Actions.Chain(new Modifiers.IsSolid(), new Actions.Scanner(@ref)));
            if (@ref.Value < 20)
            {
                return(false);
            }
            if (!structures.CanPlace(new Rectangle(result.X - 8, result.Y - 8, 16, 16)))
            {
                return(false);
            }
            WorldUtils.Gen(result, new Shapes.Circle(8), Actions.Chain(new Modifiers.RadialDither(0f, 10f), new Modifiers.IsSolid(), new Actions.SetTile(229, setSelfFrames: true)));
            ShapeData data = new ShapeData();

            WorldUtils.Gen(result, new Shapes.Circle(4, 3), Actions.Chain(new Modifiers.Blotches(), new Modifiers.IsSolid(), new Actions.ClearTile(frameNeighbors: true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), new Actions.SetLiquid(2)));
            WorldUtils.Gen(new Point(result.X, result.Y + 1), new ModShapes.InnerOutline(data), Actions.Chain(new Modifiers.IsEmpty(), new Modifiers.RectangleMask(-6, 6, 1, 3), new Actions.SetTile(59, setSelfFrames: true)));
            structures.AddProtectedStructure(new Rectangle(result.X - 8, result.Y - 8, 16, 16));
            return(true);
        }
Beispiel #7
0
        public override bool Place(Point origin, StructureMap structures)
        {
            if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y, false))
            {
                return(false);
            }
            Point result;

            if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(80), (GenCondition) new Conditions.IsSolid()), out result))
            {
                return(false);
            }
            result.Y += 2;
            Ref <int> count = new Ref <int>(0);

            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count)));
            if (count.Value < 20 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16), 0))
            {
                return(false);
            }
            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.RadialDither(0.0f, 10f), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.SetTile((ushort)229, true, true)));
            ShapeData data = new ShapeData();

            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(4, 3), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.3), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.ClearTile(true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), (GenAction) new Actions.SetLiquid(2, byte.MaxValue)));
            WorldUtils.Gen(new Point(result.X, result.Y + 1), (GenShape) new ModShapes.InnerOutline(data, true), Actions.Chain((GenAction) new Modifiers.IsEmpty(), (GenAction) new Modifiers.RectangleMask(-6, 6, 1, 3), (GenAction) new Actions.SetTile((ushort)59, true, true)));
            structures.AddProtectedStructure(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16), 0);
            return(true);
        }
Beispiel #8
0
 private static bool AreRoomsValid(
     IEnumerable <Microsoft.Xna.Framework.Rectangle> rooms,
     StructureMap structures,
     HouseType style)
 {
     foreach (Microsoft.Xna.Framework.Rectangle room in rooms)
     {
         if (style != HouseType.Granite)
         {
             if (WorldUtils.Find(new Point(room.X - 2, room.Y - 2), Searches.Chain(new Searches.Rectangle(room.Width + 4, room.Height + 4).RequireAll(false), (GenCondition) new Conditions.HasLava()), out Point _))
             {
                 return(false);
             }
         }
         if (WorldGen.notTheBees)
         {
             if (!structures.CanPlace(room, HouseUtils.BeelistedTiles, 5))
             {
                 return(false);
             }
         }
         else if (!structures.CanPlace(room, HouseUtils.BlacklistedTiles, 5))
         {
             return(false);
         }
     }
     return(true);
 }
        public override bool Place(Point origin, StructureMap structures)
        {
            if (WorldGen.SolidTile(origin.X, origin.Y) && GenBase._tiles[origin.X, origin.Y].wall == 3)
            {
                return(false);
            }

            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(100), new Conditions.IsSolid()), out origin))
            {
                return(false);
            }

            Point result;

            if (!WorldUtils.Find(new Point(origin.X - 4, origin.Y), Searches.Chain(new Searches.Down(5), new Conditions.IsTile(new ushort[1] {
                25
            }).AreaAnd(8, 1)), out result))
            {
                return(false);
            }

            ShapeData data1      = new ShapeData();
            ShapeData shapeData1 = new ShapeData();
            ShapeData shapeData2 = new ShapeData();

            for (int index = 0; index < 6; ++index)
            {
                WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(10, 12) + index), Actions.Chain(new Modifiers.Offset(0, 5 * index + 5), new Modifiers.Blotches(3, 0.3).Output(data1)));
            }
            for (int index = 0; index < 6; ++index)
            {
                WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(5, 7) + index), Actions.Chain(new Modifiers.Offset(0, 2 * index + 18), new Modifiers.Blotches(3, 0.3).Output(shapeData1)));
            }
            for (int index = 0; index < 6; ++index)
            {
                WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(4, 6) + index / 2), Actions.Chain(new Modifiers.Offset(0, (int)(7.5 * (double)index) - 10), new Modifiers.Blotches(3, 0.3).Output(shapeData2)));
            }

            ShapeData data2 = new ShapeData(shapeData1);

            shapeData1.Subtract(shapeData2, origin, origin);
            data2.Subtract(shapeData1, origin, origin);
            Microsoft.Xna.Framework.Rectangle bounds = ShapeData.GetBounds(origin, data1, shapeData2);
            if (!structures.CanPlace(bounds, CorruptionPitBiome.ValidTiles, 2))
            {
                return(false);
            }

            WorldUtils.Gen(origin, new ModShapes.All(data1), Actions.Chain(new Actions.SetTile((ushort)25, true, true), new Actions.PlaceWall(3, true)));
            WorldUtils.Gen(origin, new ModShapes.All(shapeData1), new Actions.SetTile(0, true, true));
            WorldUtils.Gen(origin, new ModShapes.All(shapeData2), new Actions.ClearTile(true));
            WorldUtils.Gen(origin, new ModShapes.All(shapeData1), Actions.Chain(new Modifiers.IsTouchingAir(true), new Modifiers.NotTouching(0 != 0, new ushort[1] {
                25
            }), new Actions.SetTile(23, true, true)));
            WorldUtils.Gen(origin, new ModShapes.All(data2), new Actions.PlaceWall(69, true));

            structures.AddStructure(bounds, 2);
            return(true);
        }
Beispiel #10
0
        public override bool Place(Point origin, StructureMap structures)
        {
            if (WorldGen.SolidTile((int)origin.X, (int)origin.Y))
            {
                return(false);
            }
            ushort type = Utils.SelectRandom <ushort>(GenBase._random, new ushort[4]
            {
                (ushort)(WorldGen.goldBar == 19 ? 8 : 169),
                (ushort)(WorldGen.silverBar == 21 ? 9 : 168),
                (ushort)(WorldGen.ironBar == 22 ? 6 : 167),
                (ushort)(WorldGen.copperBar == 20 ? 7 : 166)
            });
            double num1 = GenBase._random.NextDouble() * 2.0 - 1.0;

            if (!WorldUtils.Find(origin, Searches.Chain(num1 > 0.0 ? (GenSearch) new Searches.Right(40) : (GenSearch) new Searches.Left(40), (GenCondition) new Conditions.IsSolid()), out origin))
            {
                return(false);
            }
            if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(80), (GenCondition) new Conditions.IsSolid()), out origin))
            {
                return(false);
            }
            ShapeData shapeData = new ShapeData();
            Ref <int> count1    = new Ref <int>(0);
            Ref <int> count2    = new Ref <int>(0);

            WorldUtils.Gen(origin, new ShapeRunner(10f, 20, new Vector2((float)num1, 1f)).Output(shapeData), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.3), (GenAction) new Actions.Scanner(count1), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count2)));
            if (count2.Value < count1.Value / 2)
            {
                return(false);
            }
            Rectangle area;

            // ISSUE: explicit reference operation
            ((Rectangle)@area).\u002Ector(origin.X - 15, origin.Y - 10, 30, 20);
            if (!structures.CanPlace(area, 0))
            {
                return(false);
            }
            WorldUtils.Gen(origin, (GenShape) new ModShapes.All(shapeData), (GenAction) new Actions.SetTile(type, true, true));
            WorldUtils.Gen(new Point(origin.X - (int)(num1 * -5.0), origin.Y - 5), (GenShape) new Shapes.Circle(5), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.3), (GenAction) new Actions.ClearTile(true)));
            Point result1;
            int   num2 = 1 & (WorldUtils.Find(new Point(origin.X - (num1 > 0.0 ? 3 : -3), origin.Y - 3), Searches.Chain((GenSearch) new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result1) ? 1 : 0);
            int   num3 = GenBase._random.Next(4) == 0 ? 3 : 7;
            Point result2;
            int   num4 = WorldUtils.Find(new Point(origin.X - (num1 > 0.0 ? -num3 : num3), origin.Y - 3), Searches.Chain((GenSearch) new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result2) ? 1 : 0;

            if ((num2 & num4) == 0)
            {
                return(false);
            }
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            __Null& local1 = @result1.Y;
            // ISSUE: cast to a reference type
            // ISSUE: explicit reference operation
            int num5 = ^ (int&)local1 - 1;
        public override bool Place(Point origin, StructureMap structures)
        {
            Point result;
            bool  flag = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 100).Not()), out result);

            result.Y += 100;
            ShapeData data1     = new ShapeData();
            ShapeData shapeData = new ShapeData();
            Point     point1    = new Point(origin.X, origin.Y + 20);
            Point     point2    = new Point(origin.X, origin.Y + 30);

            bool[] validTiles = new bool[TileID.Sets.GeneralPlacementTiles.Length];
            for (int index = 0; index < validTiles.Length; ++index)
            {
                validTiles[index] = TileID.Sets.GeneralPlacementTiles[index];
            }
            validTiles[21]  = false;
            validTiles[467] = false;
            float xScale = (float)(0.800000011920929 + (double)GenBase._random.NextFloat() * 0.5);

            WorldUtils.Gen(point1, (GenShape) new Shapes.Slime(20, xScale, 1f), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.4), new Actions.ClearTile(true).Output(data1)));
            WorldUtils.Gen(point2, (GenShape) new Shapes.Mound(14, 14), Actions.Chain((GenAction) new Modifiers.Blotches(2, 1, 0.8), (GenAction) new Actions.SetTile((ushort)0, false, true), new Actions.SetFrames(true).Output(shapeData)));
            data1.Subtract(shapeData, point1, point2);
            WorldUtils.Gen(point1, (GenShape) new ModShapes.InnerOutline(data1, true), Actions.Chain((GenAction) new Actions.SetTile((ushort)2, false, true), (GenAction) new Actions.SetFrames(true)));
            WorldUtils.Gen(point1, (GenShape) new ModShapes.All(data1), Actions.Chain((GenAction) new Modifiers.RectangleMask(-40, 40, 0, 40), (GenAction) new Modifiers.IsEmpty(), (GenAction) new Actions.SetLiquid(0, byte.MaxValue)));
            WorldUtils.Gen(point1, (GenShape) new ModShapes.All(data1), Actions.Chain((GenAction) new Actions.PlaceWall((ushort)68, true), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
            {
                (ushort)2
            }), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionVines(3, 5, 382)));
            if ((double)GenBase._random.NextFloat() <= (double)this._chanceOfEntrance)
            {
                ShapeData data2 = new ShapeData();
                WorldUtils.Gen(new Point(origin.X, result.Y + 10), (GenShape) new Shapes.Rectangle(1, origin.Y - result.Y - 9), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.2), (GenAction) new Modifiers.SkipTiles(new ushort[2]
                {
                    (ushort)191,
                    (ushort)192
                }), new Actions.ClearTile(false).Output(data2), (GenAction) new Modifiers.Expand(1), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
                {
                    (ushort)53
                }), new Actions.SetTile((ushort)397, false, true).Output(data2)));
                WorldUtils.Gen(new Point(origin.X, result.Y + 10), (GenShape) new ModShapes.All(data2), (GenAction) new Actions.SetFrames(true));
            }
            if ((double)GenBase._random.NextFloat() <= (double)this._chanceOfRealSword)
            {
                WorldGen.PlaceTile(point2.X, point2.Y - 15, 187, true, false, -1, 17);
            }
            else
            {
                WorldGen.PlaceTile(point2.X, point2.Y - 15, 186, true, false, -1, 15);
            }
            WorldUtils.Gen(point2, (GenShape) new ModShapes.All(shapeData), Actions.Chain((GenAction) new Modifiers.Offset(0, -1), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
            {
                (ushort)2
            }), (GenAction) new Modifiers.Offset(0, -1), (GenAction) new ActionGrass()));
            structures.AddProtectedStructure(new Microsoft.Xna.Framework.Rectangle(point1.X - (int)(20.0 * (double)xScale), point1.Y - 20, (int)(40.0 * (double)xScale), 40), 10);
            return(true);
        }
Beispiel #12
0
        public override bool Place(Point origin, StructureMap structures)
        {
            if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y))
            {
                return(false);
            }
            Point origin2;

            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out origin2))
            {
                return(false);
            }
            origin2.Y += 2;
            Ref <int> @ref = new Ref <int>(0);

            WorldUtils.Gen(origin2, new Shapes.Circle(8), Actions.Chain(new GenAction[]
            {
                new Modifiers.IsSolid(),
                new Actions.Scanner(@ref)
            }));
            if (@ref.Value < 20)
            {
                return(false);
            }
            if (!structures.CanPlace(new Rectangle(origin2.X - 8, origin2.Y - 8, 16, 16), 0))
            {
                return(false);
            }
            WorldUtils.Gen(origin2, new Shapes.Circle(8), Actions.Chain(new GenAction[]
            {
                new Modifiers.RadialDither(0f, 10f),
                new Modifiers.IsSolid(),
                new Actions.SetTile(229, true, true)
            }));
            ShapeData data = new ShapeData();

            WorldUtils.Gen(origin2, new Shapes.Circle(4, 3), Actions.Chain(new GenAction[]
            {
                new Modifiers.Blotches(2, 0.3),
                new Modifiers.IsSolid(),
                new Actions.ClearTile(true),
                new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data),
                new Actions.SetLiquid(2, 255)
            }));
            WorldUtils.Gen(new Point(origin2.X, origin2.Y + 1), new ModShapes.InnerOutline(data, true), Actions.Chain(new GenAction[]
            {
                new Modifiers.IsEmpty(),
                new Modifiers.RectangleMask(-6, 6, 1, 3),
                new Actions.SetTile(59, true, true)
            }));
            structures.AddStructure(new Rectangle(origin2.X - 8, origin2.Y - 8, 16, 16), 0);
            return(true);
        }
        private Rectangle GetRoom(Point origin)
        {
            Point origin2;
            bool  flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Left(25), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out origin2);
            Point origin3;
            bool  flag2 = WorldUtils.Find(origin, Searches.Chain(new Searches.Right(25), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out origin3);

            if (!flag)
            {
                origin2 = new Point(origin.X - 25, origin.Y);
            }
            if (!flag2)
            {
                origin3 = new Point(origin.X + 25, origin.Y);
            }
            Rectangle result = new Rectangle(origin.X, origin.Y, 0, 0);

            if (origin.X - origin2.X > origin3.X - origin.X)
            {
                result.X     = origin2.X;
                result.Width = Utils.Clamp <int>(origin3.X - origin2.X, 15, 30);
            }
            else
            {
                result.Width = Utils.Clamp <int>(origin3.X - origin2.X, 15, 30);
                result.X     = origin3.X - result.Width;
            }
            Point point;
            bool  flag3 = WorldUtils.Find(origin2, Searches.Chain(new Searches.Up(10), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out point);
            Point point2;
            bool  flag4 = WorldUtils.Find(origin3, Searches.Chain(new Searches.Up(10), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out point2);

            if (!flag3)
            {
                point = new Point(origin.X, origin.Y - 10);
            }
            if (!flag4)
            {
                point2 = new Point(origin.X, origin.Y - 10);
            }
            result.Height = Utils.Clamp <int>(Math.Max(origin.Y - point.Y, origin.Y - point2.Y), 8, 12);
            result.Y     -= result.Height;
            return(result);
        }
Beispiel #14
0
        // Token: 0x06000FB5 RID: 4021 RVA: 0x003F729C File Offset: 0x003F549C
        private Rectangle GetRoom(Point origin)
        {
            Point point;
            bool  flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Left(25), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out point);
            Point point2;
            bool  arg_5E_0 = WorldUtils.Find(origin, Searches.Chain(new Searches.Right(25), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out point2);

            if (!flag)
            {
                point = new Point(origin.X - 25, origin.Y);
            }
            if (!arg_5E_0)
            {
                point2 = new Point(origin.X + 25, origin.Y);
            }
            Rectangle rectangle = new Rectangle(origin.X, origin.Y, 0, 0);

            if (origin.X - point.X > point2.X - origin.X)
            {
                rectangle.X     = point.X;
                rectangle.Width = Utils.Clamp <int>(point2.X - point.X, 15, 30);
            }
            else
            {
                rectangle.Width = Utils.Clamp <int>(point2.X - point.X, 15, 30);
                rectangle.X     = point2.X - rectangle.Width;
            }
            Point point3;
            bool  flag2 = WorldUtils.Find(point, Searches.Chain(new Searches.Up(10), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out point3);
            Point point4;
            bool  arg_164_0 = WorldUtils.Find(point2, Searches.Chain(new Searches.Up(10), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out point4);

            if (!flag2)
            {
                point3 = new Point(origin.X, origin.Y - 10);
            }
            if (!arg_164_0)
            {
                point4 = new Point(origin.X, origin.Y - 10);
            }
            rectangle.Height = Utils.Clamp <int>(Math.Max(origin.Y - point3.Y, origin.Y - point4.Y), 8, 12);
            rectangle.Y     -= rectangle.Height;
            return(rectangle);
        }
Beispiel #15
0
        private bool FindVerticalExit(Rectangle wall, bool isUp, out int exitX)
        {
            Point result;
            var   flag = WorldUtils.Find(new Point(wall.X + wall.Width - 3, wall.Y + (isUp ? -5 : 0)),
                                         Searches.Chain(new Searches.Left(wall.Width - 3),
                                                        new Conditions.IsSolid().Not().AreaOr(3, 5)), out result);

            exitX = result.X;
            return(flag);
        }
Beispiel #16
0
        private bool FindSideExit(Rectangle wall, bool isLeft, out int exitY)
        {
            Point result;
            var   flag = WorldUtils.Find(new Point(wall.X + (isLeft ? -4 : 0), wall.Y + wall.Height - 3),
                                         Searches.Chain(new Searches.Up(wall.Height - 3),
                                                        new Conditions.IsSolid().Not().AreaOr(4, 3)), out result);

            exitY = result.Y;
            return(flag);
        }
Beispiel #17
0
        public override void AI()
        {
            Player player = Main.player[npc.target];

            npc.TargetClosest(true);

            if (frameType == attackFrameType)

            {
                attackTime++;
                npc.velocity.X = (0);
                npc.velocity.Y = (0);

                if (attackTime > ReloadTime)
                {
                    if (secondShot)
                    {
                        if (Main.netMode != 1)
                        {
                            Projectile.NewProjectile(npc.Center.X - (17f * npc.direction), npc.Center.Y - 40f, 0f, -10f, mod.ProjectileType("AntiAirRocket"), damage, 3f, Main.myPlayer);
                        }
                        //Projectile.NewProjectile(npc.Center.X-(17f*npc.direction), npc.Center.Y-40f, 0f, 0f, 102, damage, 3f, Main.myPlayer);
                        secondShot = false;
                        attackTime = 0;
                    }
                    else
                    {
                        if (Main.netMode != 1)
                        {
                            Projectile.NewProjectile(npc.Center.X + (23f * npc.direction), npc.Center.Y - 40f, 0f, -10f, mod.ProjectileType("AntiAirRocket"), damage, 3f, Main.myPlayer);
                        }
                        //Projectile.NewProjectile(npc.Center.X+(23f*npc.direction), npc.Center.Y-40f, 0f, 0f, 102, damage, 3f, Main.myPlayer);
                        secondShot = true;
                        attackTime = 0;
                    }
                }
            }

            float playerPositionSummery = player.Center.Y - npc.Center.Y;
            Point origin = player.Center.ToTileCoordinates();
            Point point;

            if (playerPositionSummery < -200f && !WorldUtils.Find(origin, Searches.Chain(new Searches.Down(12), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out point))
            {
                frameType = attackFrameType;
            }
            else
            {
                frameType = moveFrameType;
            }
        }
        private Rectangle GetRoom(Point origin)
        {
            Point result1;
            bool  flag1 = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Left(25), (GenCondition) new Conditions.IsSolid()), out result1);
            Point result2;
            bool  flag2 = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Right(25), (GenCondition) new Conditions.IsSolid()), out result2);

            if (!flag1)
            {
                result1 = new Point(origin.X - 25, (int)origin.Y);
            }
            if (!flag2)
            {
                result2 = new Point(origin.X + 25, (int)origin.Y);
            }
            Rectangle rectangle;

            // ISSUE: explicit reference operation
            ((Rectangle)@rectangle).\u002Ector((int)origin.X, (int)origin.Y, 0, 0);
            if (origin.X - result1.X > result2.X - origin.X)
            {
                rectangle.X     = result1.X;
                rectangle.Width = (__Null)Utils.Clamp <int>((int)(result2.X - result1.X), 15, 30);
            }
            else
            {
                rectangle.Width = (__Null)Utils.Clamp <int>((int)(result2.X - result1.X), 15, 30);
                rectangle.X     = result2.X - rectangle.Width;
            }
            Point result3;
            bool  flag3 = WorldUtils.Find(result1, Searches.Chain((GenSearch) new Searches.Up(10), (GenCondition) new Conditions.IsSolid()), out result3);
            Point result4;
            bool  flag4 = WorldUtils.Find(result2, Searches.Chain((GenSearch) new Searches.Up(10), (GenCondition) new Conditions.IsSolid()), out result4);

            if (!flag3)
            {
                result3 = new Point((int)origin.X, origin.Y - 10);
            }
            if (!flag4)
            {
                result4 = new Point((int)origin.X, origin.Y - 10);
            }
            rectangle.Height = (__Null)Utils.Clamp <int>(Math.Max((int)(origin.Y - result3.Y), (int)(origin.Y - result4.Y)), 8, 12);
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            Rectangle& local1 = @rectangle;
            // ISSUE: explicit reference operation
            // ISSUE: variable of the null type
            __Null local2 = (^ local1).Y - rectangle.Height;

            // ISSUE: explicit reference operation
            (^ local1).Y = local2;
            return(rectangle);
        }
Beispiel #19
0
        private Rectangle GetRoom(Point origin)
        {
            Point result1;
            var   flag1 = WorldUtils.Find(origin,
                                          Searches.Chain(new Searches.Left(25), (GenCondition) new Conditions.IsSolid()),
                                          out result1);
            Point result2;
            var   flag2 = WorldUtils.Find(origin,
                                          Searches.Chain(new Searches.Right(25), (GenCondition) new Conditions.IsSolid()),
                                          out result2);

            if (!flag1)
            {
                result1 = new Point(origin.X - 25, origin.Y);
            }
            if (!flag2)
            {
                result2 = new Point(origin.X + 25, origin.Y);
            }
            var rectangle =
                new Rectangle(origin.X, origin.Y, 0, 0);

            if (origin.X - result1.X > result2.X - origin.X)
            {
                rectangle.X     = result1.X;
                rectangle.Width = Utils.Clamp(result2.X - result1.X, 15, 30);
            }
            else
            {
                rectangle.Width = Utils.Clamp(result2.X - result1.X, 15, 30);
                rectangle.X     = result2.X - rectangle.Width;
            }

            Point result3;
            var   flag3 = WorldUtils.Find(result1,
                                          Searches.Chain(new Searches.Up(10), (GenCondition) new Conditions.IsSolid()), out result3);
            Point result4;
            var   flag4 = WorldUtils.Find(result2,
                                          Searches.Chain(new Searches.Up(10), (GenCondition) new Conditions.IsSolid()), out result4);

            if (!flag3)
            {
                result3 = new Point(origin.X, origin.Y - 10);
            }
            if (!flag4)
            {
                result4 = new Point(origin.X, origin.Y - 10);
            }
            rectangle.Height = Utils.Clamp(Math.Max(origin.Y - result3.Y, origin.Y - result4.Y), 8, 12);
            rectangle.Y     -= rectangle.Height;
            return(rectangle);
        }
            public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
            {
                Point origin = player.Bottom.ToTileCoordinates();
                Point point;

                if (effect && !WorldUtils.Find(origin, Searches.Chain(new Searches.Down(3), new GenCondition[]
                {
                    new Conditions.IsSolid()
                }), out point) && player.grappling[0] == -1)
                {
                    damage *= 2;
                }
            }
        public override bool OnTileCollide(Vector2 oldVelocity)
        {
            Point origin = new Vector2(projectile.Center.X + (projectile.width / 2 - 6) * projectile.spriteDirection, projectile.Bottom.Y).ToTileCoordinates();
            Point point;

            if ((oldVelocity.X != projectile.velocity.X) && WorldUtils.Find(origin, Searches.Chain(new Searches.Down(1), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out point))
            {
                projectile.velocity.Y = -6;
            }
            return(false);
        }
        public override bool Place(Point origin, StructureMap structures)
        {
            if (WorldGen.SolidTile(origin.X, origin.Y) && GenBase._tiles[origin.X, origin.Y].wall == 3)
            {
                return(false);
            }
            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(100), new Conditions.IsSolid()), out origin))
            {
                return(false);
            }
            Point result;

            if (!WorldUtils.Find(new Point(origin.X - 4, origin.Y), Searches.Chain(new Searches.Down(5), new Conditions.IsTile(25).AreaAnd(8, 1)), out result))
            {
                return(false);
            }
            ShapeData shapeData  = new ShapeData();
            ShapeData shapeData2 = new ShapeData();
            ShapeData shapeData3 = new ShapeData();

            for (int i = 0; i < 6; i++)
            {
                WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(10, 12) + i), Actions.Chain(new Modifiers.Offset(0, 5 * i + 5), new Modifiers.Blotches(3).Output(shapeData)));
            }
            for (int j = 0; j < 6; j++)
            {
                WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(5, 7) + j), Actions.Chain(new Modifiers.Offset(0, 2 * j + 18), new Modifiers.Blotches(3).Output(shapeData2)));
            }
            for (int k = 0; k < 6; k++)
            {
                WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(4, 6) + k / 2), Actions.Chain(new Modifiers.Offset(0, (int)(7.5f * (float)k) - 10), new Modifiers.Blotches(3).Output(shapeData3)));
            }
            ShapeData shapeData4 = new ShapeData(shapeData2);

            shapeData2.Subtract(shapeData3, origin, origin);
            shapeData4.Subtract(shapeData2, origin, origin);
            Rectangle bounds = ShapeData.GetBounds(origin, shapeData, shapeData3);

            if (!structures.CanPlace(bounds, ValidTiles, 2))
            {
                return(false);
            }
            WorldUtils.Gen(origin, new ModShapes.All(shapeData), Actions.Chain(new Actions.SetTile(25, true), new Actions.PlaceWall(3)));
            WorldUtils.Gen(origin, new ModShapes.All(shapeData2), new Actions.SetTile(0, true));
            WorldUtils.Gen(origin, new ModShapes.All(shapeData3), new Actions.ClearTile(true));
            WorldUtils.Gen(origin, new ModShapes.All(shapeData2), Actions.Chain(new Modifiers.IsTouchingAir(true), new Modifiers.NotTouching(false, 25), new Actions.SetTile(23, true)));
            WorldUtils.Gen(origin, new ModShapes.All(shapeData4), new Actions.PlaceWall(69));
            structures.AddStructure(bounds, 2);
            return(true);
        }
        public override void UpdateEquip(Player player)
        {
            player.statLifeMax2 += 100;
            player.thrownDamage += .15f;
            player.GetModPlayer <QwertyPlayer>().throwReduction *= .60f;
            Point origin = player.Bottom.ToTileCoordinates();
            Point point;

            if (WorldUtils.Find(origin, Searches.Chain(new Searches.Down(3), new GenCondition[] { new Conditions.IsSolid() }), out point))
            {
                player.thrownVelocity += .4f;
                player.lifeRegen      += 4;
            }
        }
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            position = Main.MouseWorld;
            Point point;
            Point origin = position.ToTileCoordinates();

            while (!WorldUtils.Find(position.ToTileCoordinates(), Searches.Chain(new Searches.Down(1), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out point))
            {
                position.Y++;
                origin = position.ToTileCoordinates();
            }
            return(true);
        }
Beispiel #25
0
        private List <Rectangle> CreateSupportBeamList()
        {
            List <Rectangle> list = new List <Rectangle>();
            int num  = Rooms.Min((Rectangle room) => room.Left);
            int num2 = Rooms.Max((Rectangle room) => room.Right) - 1;
            int num3 = 6;

            while (num3 > 4 && (num2 - num) % num3 != 0)
            {
                num3--;
            }
            for (int i = num; i <= num2; i += num3)
            {
                for (int j = 0; j < Rooms.Count; j++)
                {
                    Rectangle rectangle = Rooms[j];
                    if (i < rectangle.X || i >= rectangle.X + rectangle.Width)
                    {
                        continue;
                    }
                    int num4 = rectangle.Y + rectangle.Height;
                    int num5 = 50;
                    for (int k = j + 1; k < Rooms.Count; k++)
                    {
                        if (i >= Rooms[k].X && i < Rooms[k].X + Rooms[k].Width)
                        {
                            num5 = Math.Min(num5, Rooms[k].Y - num4);
                        }
                    }
                    if (num5 > 0)
                    {
                        Point result;
                        bool  flag = WorldUtils.Find(new Point(i, num4), Searches.Chain(new Searches.Down(num5), new Conditions.IsSolid()), out result);
                        if (num5 < 50)
                        {
                            flag   = true;
                            result = new Point(i, num4 + num5);
                        }
                        if (flag)
                        {
                            list.Add(new Rectangle(i, num4, 1, result.Y - num4));
                        }
                    }
                }
            }
            return(list);
        }
Beispiel #26
0
        private List <Microsoft.Xna.Framework.Rectangle> CreateSupportBeamList()
        {
            List <Microsoft.Xna.Framework.Rectangle> rectangleList = new List <Microsoft.Xna.Framework.Rectangle>();
            int num1 = this.Rooms.Min <Microsoft.Xna.Framework.Rectangle>((Func <Microsoft.Xna.Framework.Rectangle, int>)(room => room.Left));
            int num2 = this.Rooms.Max <Microsoft.Xna.Framework.Rectangle>((Func <Microsoft.Xna.Framework.Rectangle, int>)(room => room.Right)) - 1;
            int num3 = 6;

            while (num3 > 4 && (num2 - num1) % num3 != 0)
            {
                --num3;
            }
            for (int x = num1; x <= num2; x += num3)
            {
                for (int index1 = 0; index1 < this.Rooms.Count; ++index1)
                {
                    Microsoft.Xna.Framework.Rectangle room = this.Rooms[index1];
                    if (x >= room.X && x < room.X + room.Width)
                    {
                        int y    = room.Y + room.Height;
                        int num4 = 50;
                        for (int index2 = index1 + 1; index2 < this.Rooms.Count; ++index2)
                        {
                            if (x >= this.Rooms[index2].X && x < this.Rooms[index2].X + this.Rooms[index2].Width)
                            {
                                num4 = Math.Min(num4, this.Rooms[index2].Y - y);
                            }
                        }
                        if (num4 > 0)
                        {
                            Point result;
                            bool  flag = WorldUtils.Find(new Point(x, y), Searches.Chain((GenSearch) new Searches.Down(num4), (GenCondition) new Conditions.IsSolid()), out result);
                            if (num4 < 50)
                            {
                                flag   = true;
                                result = new Point(x, y + num4);
                            }
                            if (flag)
                            {
                                rectangleList.Add(new Microsoft.Xna.Framework.Rectangle(x, y, 1, result.Y - y));
                            }
                        }
                    }
                }
            }
            return(rectangleList);
        }
Beispiel #27
0
        public override bool Place(Point origin, StructureMap structures)
        {
            if (GenBase._tiles[(int)origin.X, (int)origin.Y].active() && WorldGen.SolidTile((int)origin.X, (int)origin.Y))
            {
                return(false);
            }
            Point result;

            if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(80), (GenCondition) new Conditions.IsSolid()), out result))
            {
                return(false);
            }
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            __Null& local = @result.Y;
            // ISSUE: cast to a reference type
            // ISSUE: explicit reference operation
            int num = ^ (int&)local + 2;
        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);
        }
Beispiel #29
0
        private static Rectangle FindRoom(Point origin)
        {
            Point result;
            bool  flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Left(25), new Conditions.IsSolid()), out result);
            Point result2;
            bool  num = WorldUtils.Find(origin, Searches.Chain(new Searches.Right(25), new Conditions.IsSolid()), out result2);

            if (!flag)
            {
                result = new Point(origin.X - 25, origin.Y);
            }
            if (!num)
            {
                result2 = new Point(origin.X + 25, origin.Y);
            }
            Rectangle result3 = new Rectangle(origin.X, origin.Y, 0, 0);

            if (origin.X - result.X > result2.X - origin.X)
            {
                result3.X     = result.X;
                result3.Width = Utils.Clamp(result2.X - result.X, 15, 30);
            }
            else
            {
                result3.Width = Utils.Clamp(result2.X - result.X, 15, 30);
                result3.X     = result2.X - result3.Width;
            }
            Point result4;
            bool  flag2 = WorldUtils.Find(result, Searches.Chain(new Searches.Up(10), new Conditions.IsSolid()), out result4);
            Point result5;
            bool  num2 = WorldUtils.Find(result2, Searches.Chain(new Searches.Up(10), new Conditions.IsSolid()), out result5);

            if (!flag2)
            {
                result4 = new Point(origin.X, origin.Y - 10);
            }
            if (!num2)
            {
                result5 = new Point(origin.X, origin.Y - 10);
            }
            result3.Height = Utils.Clamp(Math.Max(origin.Y - result4.Y, origin.Y - result5.Y), 8, 12);
            result3.Y     -= result3.Height;
            return(result3);
        }
Beispiel #30
0
        private Microsoft.Xna.Framework.Rectangle GetRoom(Point origin)
        {
            Point result1;
            bool  flag1 = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Left(25), (GenCondition) new Conditions.IsSolid()), out result1);
            Point result2;
            int   num1 = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Right(25), (GenCondition) new Conditions.IsSolid()), out result2) ? 1 : 0;

            if (!flag1)
            {
                result1 = new Point(origin.X - 25, origin.Y);
            }
            if (num1 == 0)
            {
                result2 = new Point(origin.X + 25, origin.Y);
            }
            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(origin.X, origin.Y, 0, 0);
            if (origin.X - result1.X > result2.X - origin.X)
            {
                rectangle.X     = result1.X;
                rectangle.Width = Utils.Clamp <int>(result2.X - result1.X, 15, 30);
            }
            else
            {
                rectangle.Width = Utils.Clamp <int>(result2.X - result1.X, 15, 30);
                rectangle.X     = result2.X - rectangle.Width;
            }
            Point result3;
            bool  flag2 = WorldUtils.Find(result1, Searches.Chain((GenSearch) new Searches.Up(10), (GenCondition) new Conditions.IsSolid()), out result3);
            Point result4;
            int   num2 = WorldUtils.Find(result2, Searches.Chain((GenSearch) new Searches.Up(10), (GenCondition) new Conditions.IsSolid()), out result4) ? 1 : 0;

            if (!flag2)
            {
                result3 = new Point(origin.X, origin.Y - 10);
            }
            if (num2 == 0)
            {
                result4 = new Point(origin.X, origin.Y - 10);
            }
            rectangle.Height = Utils.Clamp <int>(Math.Max(origin.Y - result3.Y, origin.Y - result4.Y), 8, 12);
            rectangle.Y     -= rectangle.Height;
            return(rectangle);
        }