public override void Rasterize(BitmapRasterizer<DungeonTile> rasterizer, Random rand) { var buf = rasterizer.Bitmap; var bounds = Bounds; rasterizer.Copy(AbyssTemplate.MapTemplate, new Rect(10, 10, 52, 52), Pos, tile => tile.TileType.Name == "Space"); int numCorrupt = new Range(2, 10).Random(rand); while (numCorrupt > 0) { int x = rand.Next(bounds.X, bounds.MaxX); int y = rand.Next(bounds.Y, bounds.MaxY); if (buf[x, y].Object == null) continue; if (buf[x, y].Object.ObjectType != AbyssTemplate.PartialRedFloor) continue; buf[x, y].Object = null; numCorrupt--; } int numImp = new Range(1, 2).Random(rand); int numDemon = new Range(1, 3).Random(rand); int numBrute = new Range(1, 3).Random(rand); while (numImp > 0 || numDemon > 0 || numBrute > 0) { int x = rand.Next(bounds.X, bounds.MaxX); int y = rand.Next(bounds.Y, bounds.MaxY); if (buf[x, y].Object != null || buf[x, y].TileType == AbyssTemplate.Space) continue; switch (rand.Next(3)) { case 0: if (numImp > 0) { buf[x, y].Object = new DungeonObject { ObjectType = AbyssTemplate.AbyssImp }; numImp--; } break; case 1: if (numDemon > 0) { buf[x, y].Object = new DungeonObject { ObjectType = AbyssTemplate.AbyssDemon[rand.Next(AbyssTemplate.AbyssDemon.Length)] }; numDemon--; } break; case 2: if (numBrute > 0) { buf[x, y].Object = new DungeonObject { ObjectType = AbyssTemplate.AbyssBrute[rand.Next(AbyssTemplate.AbyssBrute.Length)] }; numBrute--; } break; } } }
public override void Rasterize(BitmapRasterizer<DungeonTile> rasterizer, Random rand) { rasterizer.Copy(AbyssTemplate.MapTemplate, new Rect(70, 10, 85, 31), Pos, tile => tile.TileType.Name == "Space"); var bounds = Bounds; var buf = rasterizer.Bitmap; for (int x = bounds.X; x < bounds.MaxX; x++) for (int y = bounds.Y; y < bounds.MaxY; y++) { if (buf[x, y].TileType != AbyssTemplate.Space) buf[x, y].Region = "Treasure"; } }
public override void Rasterize(BitmapRasterizer <DungeonTile> rasterizer, Random rand) { rasterizer.Copy(AbyssTemplate.MapTemplate, new Rect(70, 10, 85, 31), Pos, tile => tile.TileType.Name == "Space"); var bounds = Bounds; var buf = rasterizer.Bitmap; for (int x = bounds.X; x < bounds.MaxX; x++) { for (int y = bounds.Y; y < bounds.MaxY; y++) { if (buf[x, y].TileType != AbyssTemplate.Space) { buf[x, y].Region = "Treasure"; } } } }
public override void Rasterize(BitmapRasterizer <DungeonTile> rasterizer, Random rand) { var buf = rasterizer.Bitmap; var bounds = Bounds; rasterizer.Copy(AbyssTemplate.MapTemplate, new Rect(10, 10, 52, 52), Pos, tile => tile.TileType.Name == "Space"); int numCorrupt = new Range(2, 10).Random(rand); while (numCorrupt > 0) { int x = rand.Next(bounds.X, bounds.MaxX); int y = rand.Next(bounds.Y, bounds.MaxY); if (buf[x, y].Object == null) { continue; } if (buf[x, y].Object.ObjectType != AbyssTemplate.PartialRedFloor) { continue; } buf[x, y].Object = null; numCorrupt--; } int numImp = new Range(1, 2).Random(rand); int numDemon = new Range(1, 3).Random(rand); int numBrute = new Range(1, 3).Random(rand); while (numImp > 0 || numDemon > 0 || numBrute > 0) { int x = rand.Next(bounds.X, bounds.MaxX); int y = rand.Next(bounds.Y, bounds.MaxY); if (buf[x, y].Object != null || buf[x, y].TileType == AbyssTemplate.Space) { continue; } switch (rand.Next(3)) { case 0: if (numImp > 0) { buf[x, y].Object = new DungeonObject { ObjectType = AbyssTemplate.AbyssImp }; numImp--; } break; case 1: if (numDemon > 0) { buf[x, y].Object = new DungeonObject { ObjectType = AbyssTemplate.AbyssDemon[rand.Next(AbyssTemplate.AbyssDemon.Length)] }; numDemon--; } break; case 2: if (numBrute > 0) { buf[x, y].Object = new DungeonObject { ObjectType = AbyssTemplate.AbyssBrute[rand.Next(AbyssTemplate.AbyssBrute.Length)] }; numBrute--; } break; } } }
public override void Rasterize(BitmapRasterizer <DungeonTile> rasterizer, Random rand) { rasterizer.Copy(LabTemplate.MapTemplate, template, Pos); LabTemplate.DrawSpiderWeb(rasterizer, Bounds, rand); }
public override void Rasterize(BitmapRasterizer<DungeonTile> rasterizer, Random rand) { rasterizer.Copy(LabTemplate.MapTemplate, current.Bounds, Pos); if ((current.Flags & RoomFlags.Evil) == 0) LabTemplate.CreateEnemies(rasterizer, Bounds, rand); var flags = current.Flags & RoomFlags.ConnectionMask; DungeonTile? tile = null; switch (flags) { case RoomFlags.Conn_Floor: tile = new DungeonTile { TileType = LabTemplate.LabFloor }; break; case RoomFlags.Conn_Destructible: tile = new DungeonTile { TileType = LabTemplate.LabFloor, Object = destWall }; break; default: return; } foreach (var edge in Edges) { var direction = edge.Linkage.Direction; if (edge.RoomA != this) direction = direction.Reverse(); Point a, b; switch (direction) { case Direction.South: a = new Point(edge.Linkage.Offset, Pos.Y + Height - 1); b = new Point(a.X + 3, a.Y); break; case Direction.North: a = new Point(edge.Linkage.Offset, Pos.Y); b = new Point(a.X + 3, a.Y); break; case Direction.East: a = new Point(Pos.X + Width - 1, edge.Linkage.Offset); b = new Point(a.X, a.Y + 3); break; case Direction.West: a = new Point(Pos.X, edge.Linkage.Offset); b = new Point(a.X, a.Y + 3); break; default: throw new ArgumentException(); } rasterizer.DrawLine(a, b, tile.Value); } LabTemplate.DrawSpiderWeb(rasterizer, Bounds, rand); }
public override void Rasterize(BitmapRasterizer <DungeonTile> rasterizer, Random rand) { rasterizer.Copy(LabTemplate.MapTemplate, current.Bounds, Pos); if ((current.Flags & RoomFlags.Evil) == 0) { LabTemplate.CreateEnemies(rasterizer, Bounds, rand); } var flags = current.Flags & RoomFlags.ConnectionMask; DungeonTile?tile = null; switch (flags) { case RoomFlags.Conn_Floor: tile = new DungeonTile { TileType = LabTemplate.LabFloor }; break; case RoomFlags.Conn_Destructible: tile = new DungeonTile { TileType = LabTemplate.LabFloor, Object = destWall }; break; default: return; } foreach (var edge in Edges) { var direction = edge.Linkage.Direction; if (edge.RoomA != this) { direction = direction.Reverse(); } Point a, b; switch (direction) { case Direction.South: a = new Point(edge.Linkage.Offset, Pos.Y + Height - 1); b = new Point(a.X + 3, a.Y); break; case Direction.North: a = new Point(edge.Linkage.Offset, Pos.Y); b = new Point(a.X + 3, a.Y); break; case Direction.East: a = new Point(Pos.X + Width - 1, edge.Linkage.Offset); b = new Point(a.X, a.Y + 3); break; case Direction.West: a = new Point(Pos.X, edge.Linkage.Offset); b = new Point(a.X, a.Y + 3); break; default: throw new ArgumentException(); } rasterizer.DrawLine(a, b, tile.Value); } LabTemplate.DrawSpiderWeb(rasterizer, Bounds, rand); }
public override void Rasterize(BitmapRasterizer<DungeonTile> rasterizer, Random rand) { rasterizer.Copy(LabTemplate.MapTemplate, template, Pos); LabTemplate.DrawSpiderWeb(rasterizer, Bounds, rand); }