From f92ebe7eac6767ae7c84d6236e3dd7586bfbb7a4 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <142704082+CongratsIsTrash@users.noreply.github.com> Date: Fri, 31 Jan 2025 13:01:05 -0500 Subject: [PATCH] Final stuff from me: Secret seed things 1 - Celebrationmk10 is now forced to spawn on the Jungle-side Ocean to prevent spawning in the Sulphurous Sea 2 - Moved Calamity final worldgen adjustments to happen before final secret seed adjustments and Dirtiest Block gen (also fixes Forsaken Archive not being painted in secret seeds) 3 - Gravity Normalizer now negates the low gravity of Remix surface 4 - Fixed Aerialite not spawning in Remix 5 - Fixed Cloud Elemental not spawning in Remix 6 - Fixed Armored Digger GFB drops appearing in the bestiary 7 - Fixed Jungle Temple not generating on the surface in Remix 8 - Fixed Mimic and Ice Mimic loot pools in Remix 9 - Fixed Sandstorm's Core broken localization in GFB --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- Items/SummonItems/SandstormsCore.cs | 2 +- NPCs/CalamityGlobalNPCLoot.cs | 66 +++++++++++++++++++++----- NPCs/NormalNPCs/ArmoredDiggerHead.cs | 4 +- NPCs/NormalNPCs/ThiccWaifu.cs | 2 +- Systems/WorldgenManagementSystem.cs | 28 ++++++++++- Utilities/PlayerUtils.cs | 4 +- World/AerialiteOreGen.cs | 6 +-- World/CustomTemple.cs | 26 ++++++++-- 9 files changed, 112 insertions(+), 28 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index a3ed869174..9c339b8add 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2512,7 +2512,7 @@ namespace CalamityMod.CalPlayer if (gravityNormalizer) { Player.buffImmune[BuffID.VortexDebuff] = true; - if (Player.InSpace()) + if (Player.ReducedSpaceGravity()) { Player.gravity = Player.defaultGravity; if (Player.wet) diff --git a/Items/SummonItems/SandstormsCore.cs b/Items/SummonItems/SandstormsCore.cs index 32dba4f830..63d2f7ab20 100644 --- a/Items/SummonItems/SandstormsCore.cs +++ b/Items/SummonItems/SandstormsCore.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.SummonItems return true; } - public override void ModifyTooltips(List list) => list.FindAndReplace("[BIOME]", Main.zenithWorld ? CalamityUtils.GetTextValue("Biomes.AstralDesert") : Language.GetTextValue("Bestiary_Biomes.Desert")); + public override void ModifyTooltips(List list) => list.FindAndReplace("[BIOME]", Main.zenithWorld ? CalamityUtils.GetTextValue("Biomes.AstralDesert.TownNPCDialogueName") : Language.GetTextValue("Bestiary_Biomes.Desert")); public override void AddRecipes() { diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 6b875b8cad..fee18a037d 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -162,19 +162,42 @@ namespace CalamityMod.NPCs return false; }); - int[] mimicItems = new int[] - { + // Yes, Mimics have three separate loot tables which we must reintegrate + int[] normalMimicItems = + [ ItemID.MagicDagger, ItemID.CrossNecklace, ItemID.PhilosophersStone, ItemID.StarCloak, ItemID.TitanGlove, ItemID.DualHook - }; + ]; + int[] remixPreHardMimicItems = + [ + ItemID.BandofRegeneration, + ItemID.MagicMirror, + ItemID.CloudinaBottle, + ItemID.HermesBoots, + ItemID.ShoeSpikes, + ItemID.Mace + ]; + int[] remixHardmodeMimicItems = + [ + ItemID.WandofSparking, + ItemID.CrossNecklace, + ItemID.PhilosophersStone, + ItemID.StarCloak, + ItemID.TitanGlove, + ItemID.DualHook + ]; // Mimics will not drop any items if spawned from statues. - var notStatue = npcLoot.DefineConditionalDropSet(new Conditions.NotFromStatue()); - notStatue.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, mimicItems)); + var notRemix = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !(npc.SpawnedFromStatue || Main.remixWorld))); + var remixPreHM = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !npc.SpawnedFromStatue && Main.remixWorld && !Main.hardMode)); + var remixHardmode = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !npc.SpawnedFromStatue && Main.remixWorld && Main.hardMode)); + notRemix.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, normalMimicItems)); + remixPreHM.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, remixPreHardMimicItems)); + remixHardmode.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, remixHardmodeMimicItems)); } catch (ArgumentNullException) { } break; @@ -225,17 +248,38 @@ namespace CalamityMod.NPCs return false; }); - int[] iceMimicItems = new int[] - { + // Yes, Ice Mimics have three separate loot tables which me must reintegrate + int[] normalIceMimicItems = + [ ItemID.Frostbrand, ItemID.IceBow, ItemID.FlowerofFrost - }; + ]; + int[] remixPreHardIceMimicItems = + [ + ItemID.IceBoomerang, + ItemID.IceBlade, + ItemID.IceBow, + ItemID.IceSkates, + ItemID.BlizzardinaBottle, + ItemID.FlurryBoots + ]; + int[] remixHardmodeIceMimicItems = + [ + ItemID.Frostbrand, + ItemID.SnowballCannon, + ItemID.FlowerofFrost + ]; // Ice Mimics will not drop any items if spawned from statues. - var notStatue = npcLoot.DefineConditionalDropSet(new Conditions.NotFromStatue()); - notStatue.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, iceMimicItems)); - notStatue.Add(ItemID.ToySled, 20, 1, 1); + var notRemix = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !(npc.SpawnedFromStatue || Main.remixWorld))); + var remixPreHM = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !npc.SpawnedFromStatue && Main.remixWorld && !Main.hardMode)); + var remixHardmode = npcLoot.DefineConditionalDropSet(DropHelper.If(() => !npc.SpawnedFromStatue && Main.remixWorld && Main.hardMode)); + notRemix.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, normalIceMimicItems)); + remixPreHM.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, remixPreHardIceMimicItems)); + remixHardmode.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, remixHardmodeIceMimicItems)); + // Independent from all of the Remix madness, Ice Mimics have a 5% chance to drop Toy Sled. + npcLoot.DefineConditionalDropSet(new Conditions.NotFromStatue()).Add(ItemID.ToySled, 20); } catch (ArgumentNullException) { } break; diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 70fc0433aa..2d46af55bd 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -475,8 +475,8 @@ namespace CalamityMod.NPCs.NormalNPCs npcLoot.Add(ModContent.ItemType(), 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 1, 4, 8); npcLoot.Add(ModContent.ItemType(), 1, 4, 8); - npcLoot.AddIf(() => Main.zenithWorld, ModContent.ItemType(), 1, 3, 6); - npcLoot.AddIf(() => Main.zenithWorld, ModContent.ItemType(), 10); + npcLoot.AddIf(() => Main.zenithWorld, ModContent.ItemType(), 1, 3, 6, ui: false); + npcLoot.AddIf(() => Main.zenithWorld, ModContent.ItemType(), 10, ui: false); } public override void ModifyTypeName(ref string typeName) diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index f0c7452571..79fe0ad633 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -451,7 +451,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || !Main.hardMode || !Main.raining || !spawnInfo.Player.ZoneSkyHeight) + if (spawnInfo.PlayerSafe || !Main.hardMode || (!Main.raining && !Main.remixWorld) || !spawnInfo.Player.ZoneSkyHeight) return 0f; // Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly. diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 822a6dac34..df706f93c0 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -94,6 +94,30 @@ namespace CalamityMod.Systems })); } + // Move spawn point in Celebrationmk10 to not be in the Sulphurous Sea + int spawnPointIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Spawn Point")); + if (spawnPointIndex != -1 && WorldGen.tenthAnniversaryWorldGen && !WorldGen.getGoodWorldGen) + { + tasks.Insert(spawnPointIndex + 1, new PassLegacy("Fix Tenth Anniversary Spawn", (progress, config) => + { + if ((Main.spawnTileX < Main.maxTilesX / 2 && GenVars.dungeonSide == -1) || (Main.spawnTileX > Main.maxTilesX / 2 && GenVars.dungeonSide == 1)) + { + // Flip the side of the world you spawn on if it's the Dungeon side + Main.spawnTileX = Main.maxTilesX - Main.spawnTileX; + // Then fix the Y position of the spawn point + for (int i = 0; i < Main.maxTilesY; i++) + { + if (Main.tile[Main.spawnTileX, i].HasTile) + { + Main.spawnTileY = i; + break; + } + } + } + + })); + } + // Mechanic Shed int mechanicIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Sunflowers")); if (mechanicIndex != -1) @@ -131,12 +155,12 @@ 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) { // Reallocate gems so rarity corresponds to depth - int currentFinalIndex = FinalIndex; + int currentFinalIndex = FinalIndex - 1; tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) => { progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.GemAdjustment").Value; diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index faf8ed2d66..cdead115fc 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -327,11 +327,11 @@ namespace CalamityMod #region Location and Biomes public static bool IsUnderwater(this Player player) => Collision.DrownCollision(player.position, player.width, player.height, player.gravDir); - public static bool InSpace(this Player player) + public static bool ReducedSpaceGravity(this Player player) { float x = Main.maxTilesX / 4200f; x *= x; - float spaceGravityMult = (float)((player.position.Y / 16f - (60f + 10f * x)) / (Main.worldSurface / 6.0)); + float spaceGravityMult = (float)((player.position.Y / 16f - (60f + 10f * x)) / (Main.worldSurface / (Main.remixWorld ? 1.0 : 6.0))); return spaceGravityMult < 1f; } diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs index 497e2d6017..0df55e7229 100644 --- a/World/AerialiteOreGen.cs +++ b/World/AerialiteOreGen.cs @@ -30,11 +30,11 @@ namespace CalamityMod.World Tile tile = Main.tile[x, y]; // The following conditions must happen in order for aerialite to generate: - // 1. The original tile ID must be that of a cloud. + // 1. The original tile ID must be that of a Cloud, Lesion Block, or Flesh Block. // 2. The original tile must not be empty air. // 3. A random dice-roll must land correctly, to ensure that patches of ore are occasional. // If any of these conditions are not met, this loop iteration is skipped. - if (tile.TileType != TileID.Cloud || !tile.HasTile || !WorldGen.genRand.NextBool(CloudOreConversionChance)) + if (!(tile.TileType == TileID.Cloud || tile.TileType == TileID.LesionBlock || tile.TileType == TileID.FleshBlock) || !tile.HasTile || !WorldGen.genRand.NextBool(CloudOreConversionChance)) continue; int radius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); @@ -51,7 +51,7 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(x, y), new ModShapes.All(biggerCircle), Actions.Chain(new GenAction[] { new Actions.ClearTile(), - new Actions.PlaceTile((ushort)TileID.Cloud) + new Actions.PlaceTile(tile.TileType) })); // Circle of ore. diff --git a/World/CustomTemple.cs b/World/CustomTemple.cs index 007f9721cc..1ffd63a2b0 100644 --- a/World/CustomTemple.cs +++ b/World/CustomTemple.cs @@ -26,18 +26,34 @@ namespace CalamityMod.World int y = WorldGen.genRand.Next((int)Main.rockLayer, Main.maxTilesY - 500); - if (Main.tile[x, y].HasTile && Main.tile[x, y].TileType == 60) + if (Main.remixWorld) { - Rectangle ugDesert = GenVars.UndergroundDesertLocation; - Rectangle InflatedSunkenSeaLocation = new Rectangle(ugDesert.Left - 160, ugDesert.Center.Y - 160, ugDesert.Width + 320, ugDesert.Height / 2 + 320); - Rectangle TempleLocation = new Rectangle(x - 80, y - 80, 160, 160); + while (Main.tile[x, y].HasTile || Main.tile[x, y].WallType > 0 || y > (int)(Main.worldSurface - 5.0)) + { + y--; + } - if (!TempleLocation.Intersects(InflatedSunkenSeaLocation)) + y++; + if (Main.tile[x, y].HasTile && (Main.tile[x, y].TileType == TileID.JungleGrass || Main.tile[x, y].TileType == TileID.Mud)) { success = true; GenNewTemple(x, y); } } + else + { + if (Main.tile[x, y].HasTile && Main.tile[x, y].TileType == TileID.JungleGrass) + { + Rectangle ugDesert = GenVars.UndergroundDesertLocation; + Rectangle InflatedSunkenSeaLocation = new Rectangle(ugDesert.Left - 160, ugDesert.Center.Y - 160, ugDesert.Width + 320, ugDesert.Height / 2 + 320); + Rectangle TempleLocation = new Rectangle(x - 80, y - 80, 160, 160); + if (!TempleLocation.Intersects(InflatedSunkenSeaLocation)) + { + success = true; + GenNewTemple(x, y); + } + } + } } }