diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 36a6baef26..d7c58193c9 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -148,11 +148,11 @@ namespace CalamityMod.Systems })); } - // All further tasks occur after vanilla worldgen is completed + // All further tasks occur right before vanilla worldgen is completed (which includes The Dirtiest Block and final secret seed adjustments) int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); if (FinalIndex != -1) { - int currentFinalIndex = FinalIndex; + int currentFinalIndex = FinalIndex - 1; // Reallocate gems so rarity corresponds to depth tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) => diff --git a/World/DungeonArchive.cs b/World/DungeonArchive.cs index 6905aa4203..51487e5f4c 100644 --- a/World/DungeonArchive.cs +++ b/World/DungeonArchive.cs @@ -95,61 +95,6 @@ namespace CalamityMod.World PlaceSchematic(PinkArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, ref firstItem, new Action(FillArchiveChests)); } - - // Paint the archives in secret seeds - byte PaintType = 0; - if (Main.remixWorld) - { - PaintType = PaintID.DeepPurplePaint; - if (Main.drunkWorld && (GenVars.crimsonLeft && i < Main.maxTilesX / 2) || (!GenVars.crimsonLeft && i > Main.maxTilesX / 2)) - PaintType = PaintID.DeepRedPaint; - else if (!Main.drunkWorld && WorldGen.crimson) - PaintType = PaintID.DeepRedPaint; - } - else if (Main.tenthAnniversaryWorld) - PaintType = PaintID.DeepPinkPaint; - else if (Main.notTheBeesWorld) - PaintType = PaintID.DeepOrangePaint; - else if (Main.drunkWorld || Main.getGoodWorld) - { - switch (dungeonArchiveColor) - { - case 0: - PaintType = (byte)WorldGen.genRand.Next(19, 23); - break; - case 1: - PaintType = (byte)WorldGen.genRand.Next(15, 19); - break; - default: - PaintType = WorldGen.genRand.NextBool(2) ? (byte)WorldGen.genRand.Next(23, 25) : (byte)WorldGen.genRand.Next(13, 15); - break; - } - } - - if (PaintType == 0) - return; - - bool BlackDungeonWall = Main.drunkWorld || Main.remixWorld || Main.getGoodWorld; - // All the variants are the same size so just pick one of them - // Note that it is anchored top center so the for loop check has to be changed accordingly - Vector2 schematicSize = new Vector2(TileMaps[BlueArchiveKey].GetLength(0), TileMaps[BlueArchiveKey].GetLength(1)) + Vector2.One; - for (int x = i - (int)schematicSize.X; x < i + schematicSize.X; x++) - { - for (int y = j; y < j + schematicSize.Y; y++) - { - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (Main.tileDungeon[tile.TileType] || TileID.Sets.CrackedBricks[tile.TileType]) - tile.TileColor = PaintType; - if (tile.TileType == TileID.Platforms) // Dungeon platforms - { - int variant = tile.TileFrameY / 18; - if (variant >= 6 && variant <= 12) - tile.TileColor = PaintType; - } - if (Main.wallDungeon[tile.WallType]) - tile.WallColor = BlackDungeonWall ? PaintID.BlackPaint : PaintType; - } - } break; } } diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index c675a5bfa8..adda47c705 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -348,8 +348,10 @@ namespace CalamityMod.World do { - int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); - int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.85f)); + int placementPositionX = Main.rand.NextBool() ? WorldGen.genRand.Next((int)(Main.maxTilesX * 0.55f), Main.maxTilesX - WorldGen.beachDistance) : WorldGen.genRand.Next(WorldGen.beachDistance, (int)(Main.maxTilesX * 0.45f)); + int placementPositionY = WorldGen.genRand.Next((int)GenVars.rockLayer + 20, Main.maxTilesY - 220); + if (Main.remixWorld) + placementPositionY = WorldGen.genRand.Next((int)GenVars.worldSurface + 100, (int)GenVars.rockLayer); Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); @@ -366,9 +368,10 @@ namespace CalamityMod.World canGenerateInLocation = false; //The granite geode is supposed to fully float in free air. No tile replacements - if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile && !Main.remixWorld) + if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile && !Main.drunkWorld) graniteWallsInArea++; - else if ((tile.WallType == WallID.MarbleUnsafe || tile.TileType == TileID.Marble) && Main.remixWorld) //Get fixed boi makes it generate in marble biomes + // Drunk world variant + else if ((tile.WallType == WallID.MarbleUnsafe || tile.TileType == TileID.Marble) && Main.drunkWorld) graniteWallsInArea++; } } @@ -379,8 +382,45 @@ namespace CalamityMod.World else { bool _ = true; - PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillGraniteShrineChest)); + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, Main.drunkWorld ? new Action(FillMarbleShrineChest) : new Action(FillGraniteShrineChest)); CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + + // Drunk world: turns into a Marble Geode + if (Main.drunkWorld) + { + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + switch (tile.TileType) + { + case TileID.Granite: // Granite Block --> Marble Block + tile.TileType = TileID.Marble; + break; + case TileID.GraniteBlock: // Smooth Granite Block --> Smooth Marble Block + tile.TileType = TileID.MarbleBlock; + break; + case TileID.Containers: // Granite Chest --> Marble Chest + tile.TileFrameX += 36; + break; + case TileID.ExposedGems: // Sapphire --> Diamond + tile.TileFrameX += 54; + break; + } + switch (tile.WallType) + { + case WallID.Granite: // Granite Wall --> Marble Wall + tile.WallType = WallID.Marble; + break; + case WallID.SapphireGemspark: // Sapphire Gemspark Wall --> Diamond Gemspark Wall + tile.WallType = WallID.DiamondGemspark; + tile.WallColor = PaintID.None; + break; + } + } + } + } break; } @@ -501,8 +541,10 @@ namespace CalamityMod.World do { - int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); - int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.85f)); + int placementPositionX = Main.rand.NextBool() ? WorldGen.genRand.Next((int)(Main.maxTilesX * 0.55f), Main.maxTilesX - WorldGen.beachDistance) : WorldGen.genRand.Next(WorldGen.beachDistance, (int)(Main.maxTilesX * 0.45f)); + int placementPositionY = WorldGen.genRand.Next((int)GenVars.rockLayer + 20, Main.maxTilesY - 220); + if (Main.remixWorld) + placementPositionY = WorldGen.genRand.Next((int)GenVars.worldSurface + 100, (int)GenVars.rockLayer); Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); @@ -521,9 +563,10 @@ namespace CalamityMod.World //Marble biomes either have blocks or walls, occasionally both //This should be near maximum to prevent the structure from overextending - if ((tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) && !Main.zenithWorld) + if ((tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) && !Main.drunkWorld) marbleStuffInArea++; - else if ((tile.WallType == WallID.GraniteUnsafe || tile.TileType == TileID.Granite) && Main.zenithWorld) //Generates in granite in gfb + // Drunk world variant + else if ((tile.TileType == TileID.Granite || tile.WallType == WallID.GraniteUnsafe) && Main.drunkWorld) marbleStuffInArea++; //There should be some space between the pillars so it doesn't make pillars in the middle of nowhere zone @@ -541,8 +584,48 @@ namespace CalamityMod.World else { bool _ = true; - PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillMarbleShrineChest)); + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, Main.drunkWorld ? new Action(FillGraniteShrineChest) : new Action(FillMarbleShrineChest)); CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + + // Drunk world: turns into a Granite Column + if (Main.drunkWorld) + { + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + switch (tile.TileType) + { + case TileID.Marble: // Marble Block --> Granite Block + tile.TileType = TileID.Granite; + break; + case TileID.MarbleBlock: // Smooth Marble Block --> Smooth Granite Block + tile.TileType = TileID.GraniteBlock; + break; + case TileID.MarbleColumn: // Marble Column --> Granite Column + tile.TileType = TileID.GraniteColumn; + break; + case TileID.Containers: // Marble Chest --> Granite Chest + tile.TileFrameX -= 36; + break; + case TileID.Platforms: // Marble Platform --> Granite Platform + tile.TileFrameY -= 18; + break; + } + switch (tile.WallType) + { + case WallID.Marble: // Marble Wall --> Granite Wall + tile.WallType = WallID.Granite; + break; + case WallID.MarbleBlock: // Smooth Marble Wall --> Smooth Granite Wall + tile.WallType = WallID.GraniteBlock; + tile.WallColor = PaintID.None; + break; + } + } + } + } break; }