diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 8eca3faac5..9fdd9ce31b 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -266,10 +266,6 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.Text = "Throws a mixture of slime and sparkling crystals" + "\nSlimed enemies take more damage from fire-based debuffs"); - // Add a tooltip about location of Shadow Chests - if (item.type == ItemID.ShadowKey) - EditTooltipByNum(0, (line) => line.Text += "\nShadow Chests can be found in the Abyss, Brimstone Crag and Underworld"); - // Flesh Knuckles giving extra max life. if (item.type == ItemID.FleshKnuckles || item.type == ItemID.HeroShield || item.type == ItemID.BerserkerGlove) EditTooltipByNum(0, (line) => line.Text += "\nMax life increased by 45"); diff --git a/Items/Placeables/Furniture/AbyssTreasureChest.cs b/Items/Placeables/Furniture/AbyssTreasureChest.cs new file mode 100644 index 0000000000..a8ad758c07 --- /dev/null +++ b/Items/Placeables/Furniture/AbyssTreasureChest.cs @@ -0,0 +1,30 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Abyss; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class AbyssTreasureChest : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 500; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/AbyssTreasureChest.png b/Items/Placeables/Furniture/AbyssTreasureChest.png new file mode 100644 index 0000000000..00da063301 Binary files /dev/null and b/Items/Placeables/Furniture/AbyssTreasureChest.png differ diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 9ec6cbeb7a..a767c1fd04 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -191,7 +191,7 @@ namespace CalamityMod.NPCs.Abyss } if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) { - return SpawnCondition.OceanMonster.Chance * 2.5f; + return SpawnCondition.CaveJellyfish.Chance * 2.5f; } return SpawnCondition.OceanMonster.Chance * 0.1f; } diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index f59ead27ec..a7913f771d 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -106,7 +106,7 @@ namespace CalamityMod.NPCs.Abyss } if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) { - return SpawnCondition.OceanMonster.Chance * 2.2f; + return SpawnCondition.CaveJellyfish.Chance * 2.2f; } return SpawnCondition.OceanMonster.Chance * 0.1f; } diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 640101ef60..0da8231ab7 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -171,7 +171,7 @@ namespace CalamityMod.NPCs.Abyss } if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) { - return SpawnCondition.CaveJellyfish.Chance * 1.0f; + return SpawnCondition.CaveJellyfish.Chance * 2.0f; } return 0f; } diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index d62a3c8a13..3b5098dd17 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -60,6 +60,9 @@ namespace CalamityMod.Schematics internal const string SurfaceShrineKey = "Surface Shrine"; internal const string SurfaceShrineFilename = "Schematics/Shrine_Surface.csch"; + + internal const string VernalKey = "Vernal Pass"; + internal const string VernalFilename = "Schematics/VernalPass.csch"; internal const string AstralBeaconKey = "Astral Beacon"; @@ -116,6 +119,8 @@ namespace CalamityMod.Schematics [MushroomShrineKey] = CalamitySchematicIO.LoadSchematic(MushroomShrineFilename), [SurfaceShrineKey] = CalamitySchematicIO.LoadSchematic(SurfaceShrineFilename), + [VernalKey] = CalamitySchematicIO.LoadSchematic(VernalFilename), + // Astral world gen structures [AstralBeaconKey] = CalamitySchematicIO.LoadSchematic(AstralBeaconFilename), diff --git a/Schematics/VernalPass.csch b/Schematics/VernalPass.csch new file mode 100644 index 0000000000..155bbbd423 Binary files /dev/null and b/Schematics/VernalPass.csch differ diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 515bfd4b91..3d99cd5bc4 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Systems #region ModifyWorldGenTasks public override void ModifyWorldGenTasks(List tasks, ref float totalWeight) { - // Evil Floating Island + //Evil Floating Island int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses")); if (islandIndex != -1) { @@ -40,14 +40,14 @@ namespace CalamityMod.Systems })); } - // Calamity's biome chests in the dungeon + //Calamity's biome chests in the dungeon int DungeonChestIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); if (DungeonChestIndex != -1) { tasks.Insert(DungeonChestIndex + 1, new PassLegacy("CalamityDungeonBiomeChests", MiscWorldgenRoutines.GenerateBiomeChests)); } - // Larger Jungle Temple + //Larger Jungle Temple int JungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); tasks[JungleTempleIndex] = new PassLegacy("Jungle Temple", (progress, config) => { @@ -55,7 +55,7 @@ namespace CalamityMod.Systems CustomTemple.NewJungleTemple(); }); - // Improved Golem arena + //Improved Golem arena int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => { @@ -66,7 +66,7 @@ namespace CalamityMod.Systems Main.tileSolid[232] = false; }); - // Better Lihzahrd altar (consistency?) + //Better Lihzahrd altar (consistency?) int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) => { @@ -74,7 +74,7 @@ namespace CalamityMod.Systems CustomTemple.NewJungleTempleLihzahrdAltar(); }); - // Giant beehive + //Giant beehive int giantHiveIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Hives")); if (giantHiveIndex != -1) { @@ -92,7 +92,18 @@ namespace CalamityMod.Systems })); } - // Sunken sea + //Vernal pass + int vernalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World")); + if (vernalIndex != -1) + { + tasks.Insert(vernalIndex + 1, new PassLegacy("Vernal Pass", (progress, config) => + { + progress.Message = "Generating vernal pass"; //placeholder until something more fancy is made + VernalPass.PlaceVernalPass(WorldGen.structures); + })); + } + + //Sunken sea int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Settle Liquids Again")); if (SunkenSeaIndex != -1) { @@ -107,11 +118,11 @@ namespace CalamityMod.Systems })); } - // All further tasks occur after vanilla worldgen is completed + //All further tasks occur after vanilla worldgen is completed int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); if (FinalIndex != -1) { - // Reallocate gems so rarity corresponds to depth + //Reallocate gems so rarity corresponds to depth int currentFinalIndex = FinalIndex; tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) => { @@ -119,17 +130,17 @@ namespace CalamityMod.Systems MiscWorldgenRoutines.SmartGemGen(); })); - // Forsaken Archive structure in the Dungeon + //Forsaken Archive structure in the Dungeon tasks.Insert(++currentFinalIndex, new PassLegacy("Forsaken Archive", (progress, config) => { progress.Message = "Entombing occult literature"; DungeonArchive.PlaceArchive(); })); - // Planetoids + //Planetoids tasks.Insert(++currentFinalIndex, new PassLegacy("Planetoids", Planetoid.GenerateAllBasePlanetoids)); - // Sulphurous Sea (Step 1) + //Sulphurous Sea (Step 1) int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); if (SulphurIndex != -1) { @@ -140,14 +151,14 @@ namespace CalamityMod.Systems })); } - // Brimstone Crags + //Brimstone Crags tasks.Insert(++currentFinalIndex, new PassLegacy("Brimstone Crag", (progress, config) => { progress.Message = "Incinerating Azafure"; BrimstoneCrag.GenAllCragsStuff(); })); - // Biome shrines + //Biome shrines tasks.Insert(++currentFinalIndex, new PassLegacy("Special Shrines", (progress, config) => { progress.Message = "Hiding forbidden shrines"; @@ -192,7 +203,7 @@ namespace CalamityMod.Systems AerialiteOreGen.Generate(false); })); - // Draedon Labs + //Draedon Labs tasks.Insert(++currentFinalIndex, new PassLegacy("Draedon Structures", (progress, config) => { progress.Message = "Rust and Dust"; @@ -240,21 +251,21 @@ namespace CalamityMod.Systems } })); - // Abyss + //Abyss tasks.Insert(++currentFinalIndex, new PassLegacy("Abyss", (progress, config) => { progress.Message = "Disposing of Silva's remains"; Abyss.PlaceAbyss(); })); - // Sulphurous Sea (Part 2, after Abyss) + //Sulphurous Sea (Part 2, after Abyss) tasks.Insert(++currentFinalIndex, new PassLegacy("Sulphur Sea 2", (progress, config) => { progress.Message = "Irradiating one of the oceans"; SulphurousSea.SulphurSeaGenerationAfterAbyss(); })); - // Roxcalibur + //Roxcalibur tasks.Insert(++currentFinalIndex, new PassLegacy("Roxcalibur", (progress, config) => { progress.Message = "I wanna rock"; @@ -263,7 +274,7 @@ namespace CalamityMod.Systems } } - // An Astral Meteor always falls at the beginning of Hardmode. + //An Astral Meteor always falls at the beginning of Hardmode. public override void ModifyHardmodeTasks(List tasks) { int announceIndex = tasks.FindIndex(match => match.Name == "Hardmode Announcement"); diff --git a/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs b/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs index f677e5ae63..570059f638 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { - offsetY = -12; + offsetY = -16; height = 32; } diff --git a/Tiles/Abyss/AbyssGravel.cs b/Tiles/Abyss/AbyssGravel.cs index a0ae5efff5..b50dcfd665 100644 --- a/Tiles/Abyss/AbyssGravel.cs +++ b/Tiles/Abyss/AbyssGravel.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.Abyss up.HasTile = true; up.TileFrameY = 0; - //7 different frames, choose a random one + //16 different frames, choose a random one up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); WorldGen.SquareTileFrame(i, j - 1, true); diff --git a/Tiles/Abyss/AbyssTreasureChest.cs b/Tiles/Abyss/AbyssTreasureChest.cs new file mode 100644 index 0000000000..1dcb77524a --- /dev/null +++ b/Tiles/Abyss/AbyssTreasureChest.cs @@ -0,0 +1,211 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.Audio; +using Terraria.GameContent.ObjectInteractions; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Tiles.Abyss +{ + public class AbyssTreasureChest : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileOreFinderPriority[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileID.Sets.BasicChest[Type] = true; + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Containers }; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 18 }; + TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(Chest.FindEmptyChest, -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(Chest.AfterPlacement_Hook, -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { TileID.MagicalIceBlock }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ContainerName.SetDefault("Abyssal Chest"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyssal Chest"); + AddMapEntry(new Color(142, 101, 71), name); + DustType = 33; + HitSound = SoundID.Dig; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return true; + } + + public override bool IsLockedChest(int i, int j) => Main.tile[i, j].TileFrameX / 36 == 1; + + public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) + { + return true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = 1; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ModContent.ItemType()); + Chest.DestroyChest(i, j); + } + + public override bool RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.TileFrameX % 36 != 0) + { + left--; + } + + if (tile.TileFrameY != 0) + { + top--; + } + + if (player.sign >= 0) + { + SoundEngine.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + + if (Main.editChest) + { + SoundEngine.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f); + player.editedChestName = false; + } + + bool isLocked = IsLockedChest(left, top); + if (Main.netMode == NetmodeID.MultiplayerClient && !isLocked) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + SoundEngine.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, top); + Main.stackSplit = 600; + } + } + else + { + if (isLocked) + { + if (NPC.downedBoss3 && Chest.Unlock(left, top)) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.Unlock, -1, -1, null, player.whoAmI, 1f, left, top); + } + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + SoundEngine.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + SoundEngine.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + + Recipe.FindRecipes(); + } + } + } + + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.TileFrameX % 36 != 0) + { + left--; + } + + if (tile.TileFrameY != 0) + { + top--; + } + + int chest = Chest.FindChest(left, top); + if (chest < 0) + { + player.cursorItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.cursorItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Abyssal Chest"; + if (player.cursorItemIconText == "Abyssal Chest") + { + player.cursorItemIconID = ModContent.ItemType(); + + player.cursorItemIconText = ""; + } + } + + player.noThrow = 2; + player.cursorItemIconEnabled = true; + } + + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.cursorItemIconText == "") + { + player.cursorItemIconEnabled = false; + player.cursorItemIconID = 0; + } + } + } +} \ No newline at end of file diff --git a/Tiles/Abyss/AbyssTreasureChest.png b/Tiles/Abyss/AbyssTreasureChest.png new file mode 100644 index 0000000000..b2d4077ba3 Binary files /dev/null and b/Tiles/Abyss/AbyssTreasureChest.png differ diff --git a/Tiles/Abyss/AbyssTreasureChest_Highlight.png b/Tiles/Abyss/AbyssTreasureChest_Highlight.png new file mode 100644 index 0000000000..2d38a5cbe2 Binary files /dev/null and b/Tiles/Abyss/AbyssTreasureChest_Highlight.png differ diff --git a/Tiles/Abyss/PyreMantle.cs b/Tiles/Abyss/PyreMantle.cs index 0881be913b..30472fe800 100644 --- a/Tiles/Abyss/PyreMantle.cs +++ b/Tiles/Abyss/PyreMantle.cs @@ -44,29 +44,6 @@ namespace CalamityMod.Tiles.Abyss return false; } - public override void RandomUpdate(int i, int j) - { - Tile tile = Main.tile[i, j]; - Tile up = Main.tile[i, j - 1]; - Tile up2 = Main.tile[i, j - 2]; - - //place kelp - if (WorldGen.genRand.Next(25) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) - { - up.TileType = (ushort)ModContent.TileType(); - up.HasTile = true; - up.TileFrameY = 0; - - //7 different frames, choose a random one - up.TileFrameX = (short)(WorldGen.genRand.Next(7) * 18); - WorldGen.SquareTileFrame(i, j - 1, true); - - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); - } - } - } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index 3936080b2c..7e36ce3d0b 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -47,30 +47,6 @@ namespace CalamityMod.Tiles.Abyss return false; } - public override void RandomUpdate(int i, int j) - { - Tile tile = Main.tile[i, j]; - Tile up = Main.tile[i, j - 1]; - Tile up2 = Main.tile[i, j - 2]; - - //place kelp - if (WorldGen.genRand.Next(25) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) - { - up.TileType = (ushort)ModContent.TileType(); - up.HasTile = true; - up.TileFrameY = 0; - - //7 different frames, choose a random one - up.TileFrameX = (short)(WorldGen.genRand.Next(7) * 18); - WorldGen.SquareTileFrame(i, j - 1, true); - - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); - } - } - } - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { int uniqueAnimationFrameX = 0; diff --git a/Tiles/Ores/ScoriaOre.cs b/Tiles/Ores/ScoriaOre.cs index 921bf0de1c..2dc48d0d8a 100644 --- a/Tiles/Ores/ScoriaOre.cs +++ b/Tiles/Ores/ScoriaOre.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Tiles.Ores { return; } - if (closer && Main.rand.NextBool(300)) + if (closer && Main.rand.NextBool(400)) { int tileLocationY = j + 1; if (Main.tile[i, tileLocationY] != null) diff --git a/World/Abyss.cs b/World/Abyss.cs index ecbc7c7786..a0caa39bbc 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -57,8 +57,8 @@ namespace CalamityMod.World if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) { - tile.LiquidType = LiquidID.Water; - tile.LiquidAmount = 255; + tile.Get().LiquidType = LiquidID.Water; + tile.LiquidAmount = byte.MaxValue; } bool canConvert = tile.HasTile && tile.TileType < TileID.Count && tile.TileType != ModContent.TileType(); @@ -471,16 +471,16 @@ namespace CalamityMod.World { case 0: //1 island, to the left - AbyssIsland(abyssChasmX - WorldGen.genRand.Next(65, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, true, false); + AbyssIsland(abyssChasmX - WorldGen.genRand.Next(65, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, false, false); break; case 1: //1 island, to the right - AbyssIsland(abyssChasmX + WorldGen.genRand.Next(65, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, true, false); + AbyssIsland(abyssChasmX + WorldGen.genRand.Next(65, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, false, false); break; case 2: //2 islands, left and right - AbyssIsland(abyssChasmX - WorldGen.genRand.Next(65, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, true, false); - AbyssIsland(abyssChasmX + WorldGen.genRand.Next(65, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, true, false); + AbyssIsland(abyssChasmX - WorldGen.genRand.Next(65, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, false, false); + AbyssIsland(abyssChasmX + WorldGen.genRand.Next(65, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, false, false); break; } @@ -529,8 +529,8 @@ namespace CalamityMod.World if (!tile.HasTile && tile.WallType > 0) { //fill up any air pockets with water - tile.LiquidType = LiquidID.Water; - tile.LiquidAmount = 255; + tile.Get().LiquidType = LiquidID.Water; + tile.LiquidAmount = byte.MaxValue; } //kill obsidian @@ -555,9 +555,8 @@ namespace CalamityMod.World //above the 4th layer if (abyssIndex2 < (int)(rockLayer + y * 0.262) && WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1)) { - //giant kelp, more often in upper layers - if (WorldGen.genRand.NextBool(16) && tile.TileType == ModContent.TileType() || - WorldGen.genRand.NextBool(25) && tile.TileType == ModContent.TileType()) + //giant kelp on abyss gravel + if (WorldGen.genRand.NextBool(15) && tile.TileType == ModContent.TileType()) { ushort[] Kelps = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; @@ -565,9 +564,8 @@ namespace CalamityMod.World WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Kelps)); } - //thermal vents - if (WorldGen.genRand.NextBool(72) && tile.TileType == ModContent.TileType() || - WorldGen.genRand.NextBool(15) && tile.TileType == ModContent.TileType()) + //thermal vents on pyre mantle + if (WorldGen.genRand.NextBool(15) && tile.TileType == ModContent.TileType()) { ushort[] Vents = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; @@ -822,7 +820,7 @@ namespace CalamityMod.World //essentially places molten blocks if scoria is enabled //if scoria is not enabled, then it places planty mush with a 1 in 5 chance, and otherwise place actual scoria //very backwards logic of having scoria not place when enabled but it makes it place more often so whatever - num16 = hasScoria ? ModContent.TileType() : WorldGen.genRand.Next(5) == 0 ? ModContent.TileType() : ModContent.TileType(); + num16 = hasScoria ? ModContent.TileType() : WorldGen.genRand.Next(3) == 0 ? ModContent.TileType() : ModContent.TileType(); } } @@ -839,7 +837,6 @@ namespace CalamityMod.World Main.tile[n, num17].Get().HasTile = true; Main.tile[n, num17].TileType = (ushort)num16; - CalamityUtils.SafeSquareTileFrame(n, num17, true); } } @@ -917,6 +914,7 @@ namespace CalamityMod.World } } } + num23 += WorldGen.genRand.Next(num25, (int)(num25 * 1.5)); } } @@ -1001,7 +999,12 @@ namespace CalamityMod.World } //place the chest itself - WorldGen.AddBuriedChest(i, j - 1, itemChoice, false, 4); + //TODO: will create a proper loot pool to go in abyss chests along with the main item + int ChestIndex = WorldGen.PlaceChest(i, j - 2, (ushort)ModContent.TileType(), false, 1); + if (ChestIndex != -1) + { + Main.chest[ChestIndex].item[0].SetDefaults(itemChoice); + } } } } diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index bf6868149d..a6a8887b83 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -249,21 +249,25 @@ namespace CalamityMod.World //place crag ruins bool place = true; + int house1Offset = WorldGen.genRand.Next(0, 55); SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey3, - new Point(biomeStart + 150, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); - PlaceSquareForCragHouses(biomeStart + 150, Main.maxTilesY - 125); + new Point(biomeStart + 150 + house1Offset, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); + PlaceSquareForCragHouses(biomeStart + 150 + house1Offset, Main.maxTilesY - 125); + int house2Offset = WorldGen.genRand.Next(-55, 0); SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey1, - new Point(biomeMiddle - 235, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); - PlaceSquareForCragHouses(biomeMiddle - 235, Main.maxTilesY - 125); + new Point(biomeMiddle - 235 + house2Offset, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); + PlaceSquareForCragHouses(biomeMiddle - 235 + house2Offset, Main.maxTilesY - 125); + int house3Offset = WorldGen.genRand.Next(0, 55); SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey4, - new Point(biomeMiddle + 235, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); - PlaceSquareForCragHouses(biomeMiddle + 235, Main.maxTilesY - 125); + new Point(biomeMiddle + 235 + house3Offset, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); + PlaceSquareForCragHouses(biomeMiddle + 235 + house3Offset, Main.maxTilesY - 125); + int house4Offset = WorldGen.genRand.Next(-55, 0); SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey2, - new Point(biomeEdge - 150, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); - PlaceSquareForCragHouses(biomeEdge - 150, Main.maxTilesY - 125); + new Point(biomeEdge - 150 + house4Offset, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); + PlaceSquareForCragHouses(biomeEdge - 150 + house4Offset, Main.maxTilesY - 125); //lava clean up again for (int x = biomeStart; x <= biomeEdge; x++) diff --git a/World/VernalPass.cs b/World/VernalPass.cs new file mode 100644 index 0000000000..4bcf2f53fd --- /dev/null +++ b/World/VernalPass.cs @@ -0,0 +1,87 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Mounts; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.SummonItems; +using CalamityMod.Tiles.DraedonStructures; +using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Walls; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.WorldBuilding; + +using static CalamityMod.Schematics.SchematicManager; + +namespace CalamityMod.World +{ + public class VernalPass + { + public static bool ShouldAvoidLocation(Point placementPoint) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(placementPoint.X, placementPoint.Y); + + //avoid hive and jungle temple blocks + if (tile.TileType == TileID.LihzahrdBrick || tile.WallType == WallID.LihzahrdBrickUnsafe || + tile.TileType == TileID.Hive || tile.WallType == WallID.HiveUnsafe) + { + return true; + } + + return false; + } + + public static void PlaceVernalPass(StructureMap structures) + { + int tries = 0; + string mapKey = VernalKey; + + do + { + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY / 2), (int)((Main.maxTilesY - 300))); + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int jungleGrassInArea = 0; + bool canGenerateInLocation = true; + + float totalTiles = schematicSize.X * schematicSize.Y; + 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); + + if (ShouldAvoidLocation(new Point(x, y))) + { + canGenerateInLocation = false; + } + + if (tile.TileType == TileID.JungleGrass || tile.TileType == TileID.JunglePlants || tile.TileType == TileID.JungleVines) + { + jungleGrassInArea++; + } + } + } + if (!canGenerateInLocation || jungleGrassInArea < totalTiles * 0.1f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + { + tries++; + } + else + { + bool place = true; + + //TODO: this needs to have items placed in chests, will do that later + SchematicManager.PlaceSchematic>(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.Center, ref place); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + break; + } + + } while (tries <= 20000); + } + } +}