diff --git a/Buffs/Placeables/EffigyOfDecayBuff.cs b/Buffs/Placeables/EffigyOfDecayBuff.cs new file mode 100644 index 0000000000..0965076425 --- /dev/null +++ b/Buffs/Placeables/EffigyOfDecayBuff.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Placeables +{ + public class EffigyOfDecayBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Effigy of Decay"); + Description.SetDefault("The sulphuric waters empower you"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().decayEffigy = true; + } + } +} diff --git a/Buffs/Placeables/EffigyOfDecayBuff.png b/Buffs/Placeables/EffigyOfDecayBuff.png new file mode 100644 index 0000000000..232c161252 Binary files /dev/null and b/Buffs/Placeables/EffigyOfDecayBuff.png differ diff --git a/Buffs/Summon/RustyDroneBuff.cs b/Buffs/Summon/RustyDroneBuff.cs new file mode 100644 index 0000000000..d9d8b6c342 --- /dev/null +++ b/Buffs/Summon/RustyDroneBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class RustyDroneBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Rusty Drone"); + Description.SetDefault("A pitifully fragile drone is observing you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.rustyDrone = true; + } + if (!modPlayer.rustyDrone) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/RustyDroneBuff.png b/Buffs/Summon/RustyDroneBuff.png new file mode 100644 index 0000000000..cd1d218f2f Binary files /dev/null and b/Buffs/Summon/RustyDroneBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 69a08c167e..5d7ec9e9e5 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -509,6 +509,7 @@ namespace CalamityMod.CalPlayer public int hallowedRuneCooldown = 0; public bool silvaWings = false; public int icicleCooldown = 0; + public bool rustyMedal = false; #endregion #region Armor Set @@ -663,6 +664,7 @@ namespace CalamityMod.CalPlayer public int chiBuffTimer = 0; public bool corrEffigy = false; public bool crimEffigy = false; + public bool decayEffigy = false; public bool rRage = false; public bool tRegen = false; public bool xRage = false; @@ -825,6 +827,7 @@ namespace CalamityMod.CalPlayer public bool necrosteocytesDudes = false; public bool gammaHead = false; public List GammaCanisters = new List(); + public bool rustyDrone = false; #endregion #region Biome @@ -1475,6 +1478,7 @@ namespace CalamityMod.CalPlayer camper = false; silvaWings = false; corrosiveSpine = false; + rustyMedal = false; daedalusReflect = false; daedalusSplit = false; @@ -1611,6 +1615,7 @@ namespace CalamityMod.CalPlayer trinketOfChiBuff = false; corrEffigy = false; crimEffigy = false; + decayEffigy = false; rRage = false; xRage = false; xWrath = false; @@ -1779,6 +1784,7 @@ namespace CalamityMod.CalPlayer brimseeker = false; necrosteocytesDudes = false; gammaHead = false; + rustyDrone = false; abyssalDivingSuitPrevious = abyssalDivingSuit; abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; @@ -6188,6 +6194,22 @@ namespace CalamityMod.CalPlayer } } + if (rustyMedal) + { + if (item.ranged) + { + if (Main.rand.NextBool(8)) + { + for (int i = 0; i < 3; i++) + { + Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f; + Vector2 directionToMouse = (startingPosition - Main.MouseWorld).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f); + Projectile.NewProjectile(startingPosition, directionToMouse * 12f, ModContent.ProjectileType(), (int)(damage * 0.3f), 0f, player.whoAmI); + } + } + } + } + return true; } #endregion diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2bad61ffc0..80e9e8c0a4 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2241,6 +2241,13 @@ namespace CalamityMod.CalPlayer } } + // Effigy of Decay effects + if (modPlayer.decayEffigy) + { + player.buffImmune[ModContent.BuffType()] = true; + player.gills = true; + } + if (modPlayer.astralInjection) { if (player.statMana < player.statManaMax2) diff --git a/Gores/SulphSeaGen/SulphurousRockGore1.png b/Gores/SulphSeaGen/SulphurousRockGore1.png new file mode 100644 index 0000000000..479431268b Binary files /dev/null and b/Gores/SulphSeaGen/SulphurousRockGore1.png differ diff --git a/Gores/SulphSeaGen/SulphurousRockGore2.png b/Gores/SulphSeaGen/SulphurousRockGore2.png new file mode 100644 index 0000000000..ca6ea7c49a Binary files /dev/null and b/Gores/SulphSeaGen/SulphurousRockGore2.png differ diff --git a/Gores/SulphSeaGen/SulphurousRockGore3.png b/Gores/SulphSeaGen/SulphurousRockGore3.png new file mode 100644 index 0000000000..f21238cc41 Binary files /dev/null and b/Gores/SulphSeaGen/SulphurousRockGore3.png differ diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index 9eea624895..7be1dd64fb 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -1,14 +1,6 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using MonoMod.Cil; +using MonoMod.Cil; using System; -using System.Reflection; using Terraria; -using Terraria.Localization; -using Terraria.ModLoader; -using static Mono.Cecil.Cil.OpCodes; namespace CalamityMod.ILEditing { @@ -21,10 +13,13 @@ namespace CalamityMod.ILEditing { IL.Terraria.WorldGen.MakeDungeon += (il) => { - var cursor = new ILCursor(il) + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(i => i.MatchStsfld("Terraria.WorldGen", "dMaxY"))) { - Index = 45 - }; + CalamityMod.instance.Logger.Warn("Dungeon movement editing code failed."); + return; + } + cursor.Index++; cursor.EmitDelegate(() => { WorldGen.dungeonX += (WorldGen.dungeonX < Main.maxTilesX / 2).ToDirectionInt() * 450; diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs new file mode 100644 index 0000000000..3abfaba7c3 --- /dev/null +++ b/Items/Accessories/RustyMedallion.cs @@ -0,0 +1,30 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class RustyMedallion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rusty Medallion"); + Tooltip.SetDefault("Causes most ranged weapons to sometimes release acid droplets from the sky"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 32; + item.rare = 1; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rustyMedal = true; + } + } +} diff --git a/Items/Accessories/RustyMedallion.png b/Items/Accessories/RustyMedallion.png new file mode 100644 index 0000000000..398cd2132d Binary files /dev/null and b/Items/Accessories/RustyMedallion.png differ diff --git a/Items/BrokenWaterFilter.cs b/Items/BrokenWaterFilter.cs new file mode 100644 index 0000000000..edaca008a4 --- /dev/null +++ b/Items/BrokenWaterFilter.cs @@ -0,0 +1,31 @@ +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items +{ + public class BrokenWaterFilter : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Broken Water Filter"); + Tooltip.SetDefault("Releases a bunch of caustic tears\n" + + "More tears are released in the water"); + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 999; + item.consumable = true; + item.rare = 1; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useAnimation = item.useTime = 25; + item.noUseGraphic = true; + item.shootSpeed = 7f; + item.UseSound = SoundID.Item1; + item.shoot = ModContent.ProjectileType(); + } + } +} diff --git a/Items/BrokenWaterFilter.png b/Items/BrokenWaterFilter.png new file mode 100644 index 0000000000..6b1604e24c Binary files /dev/null and b/Items/BrokenWaterFilter.png differ diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs new file mode 100644 index 0000000000..cd1290e38f --- /dev/null +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -0,0 +1,33 @@ +using CalamityMod.Tiles.Furniture; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class EffigyOfDecay : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Effigy of Decay"); + Tooltip.SetDefault("When placed down nearby players have their damage can breath underwater\n" + + "This effect does not work in the abyss\n" + + "Nearby players are also immune to the sulphuric poisoning"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/EffigyOfDecay.png b/Items/Placeables/Furniture/EffigyOfDecay.png new file mode 100644 index 0000000000..6448e3e42d Binary files /dev/null and b/Items/Placeables/Furniture/EffigyOfDecay.png differ diff --git a/Items/Placeables/Furniture/RustyChest.cs b/Items/Placeables/Furniture/RustyChest.cs new file mode 100644 index 0000000000..0230fb4cbc --- /dev/null +++ b/Items/Placeables/Furniture/RustyChest.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Abyss; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture +{ + public class RustyChest : ModItem + { + public override void SetStaticDefaults() + { + } + + 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 = 1; + item.consumable = true; + item.value = 500; + item.createTile = ModContent.TileType(); + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Chest); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Furniture/RustyChest.png b/Items/Placeables/Furniture/RustyChest.png new file mode 100644 index 0000000000..f35a85e233 Binary files /dev/null and b/Items/Placeables/Furniture/RustyChest.png differ diff --git a/Items/Placeables/HardenedSulphurousSandstone.cs b/Items/Placeables/HardenedSulphurousSandstone.cs new file mode 100644 index 0000000000..dc8de7a63c --- /dev/null +++ b/Items/Placeables/HardenedSulphurousSandstone.cs @@ -0,0 +1,36 @@ +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables +{ + public class HardenedSulphurousSandstone : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hardened Sulphurous Sandstone"); + } + + public override void SetDefaults() + { + item.createTile = ModContent.TileType(); + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 16; + item.height = 16; + item.maxStack = 999; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(18); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this); + recipe.AddRecipe(); + base.AddRecipes(); + } + } +} diff --git a/Items/Placeables/HardenedSulphurousSandstone.png b/Items/Placeables/HardenedSulphurousSandstone.png new file mode 100644 index 0000000000..9f1150114b Binary files /dev/null and b/Items/Placeables/HardenedSulphurousSandstone.png differ diff --git a/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs b/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs new file mode 100644 index 0000000000..7fab425008 --- /dev/null +++ b/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs @@ -0,0 +1,36 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +namespace CalamityMod.Items.Placeables.Walls +{ + public class HardenedSulphurousSandstoneWall : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hardened Sulphurous Sandstone Wall"); + } + + public override void SetDefaults() + { + item.createWall = ModContent.WallType(); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 16; + item.height = 16; + item.maxStack = 999; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(18); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + base.AddRecipes(); + } + } +} diff --git a/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.png b/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.png new file mode 100644 index 0000000000..011ec604f4 Binary files /dev/null and b/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.png differ diff --git a/Items/RustyLockpick.cs b/Items/RustyLockpick.cs new file mode 100644 index 0000000000..3598f8959a --- /dev/null +++ b/Items/RustyLockpick.cs @@ -0,0 +1,30 @@ +using CalamityMod.Items.Materials; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items +{ + public class RustyLockpick : ModItem + { + public override void SetStaticDefaults() + { + Tooltip.SetDefault("Opens locked rusty chests"); + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 28; + item.maxStack = 99; + item.rare = 1; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/RustyLockpick.png b/Items/RustyLockpick.png new file mode 100644 index 0000000000..4281306709 Binary files /dev/null and b/Items/RustyLockpick.png differ diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs new file mode 100644 index 0000000000..6a53511774 --- /dev/null +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -0,0 +1,45 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class RustyBeaconPrototype : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rusty Beacon Prototype"); + Tooltip.SetDefault("Summons a long-abandoned drone to support you\n" + + "Clicking on an enemy gives them a tiny prick, causing them to become aggravated\n" + + "The drone hovers above nearby enemies and gives them various debuffs"); + } + + public override void SetDefaults() + { + item.mana = 10; + item.width = 28; + item.height = 20; + item.useTime = item.useAnimation = 35; + item.useStyle = 4; + item.noMelee = true; + item.knockBack = 0.5f; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = 1; + item.UseSound = SoundID.Item15; // Phaseblade sound effect + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 1f); + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.png b/Items/Weapons/Summon/RustyBeaconPrototype.png new file mode 100644 index 0000000000..13625d6aac Binary files /dev/null and b/Items/Weapons/Summon/RustyBeaconPrototype.png differ diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index f2b7a04d87..291d3d519d 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -65,46 +65,19 @@ namespace CalamityMod.Items.Weapons.Summon maxMinionScale = 10; } damage = (int)(damage * ((player.minionDamage * 5 / 3) + (player.minionDamage * 0.46f * (maxMinionScale - 1)))); - int owner = player.whoAmI; - float num72 = item.shootSpeed; - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld - vector2; - float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) - { - velX = (float)player.direction; - velY = 0f; - dist = num72; - } - else - { - dist = num72 / dist; - } - velX *= dist; - velY *= dist; int head = -1; int tail = -1; - int typeHead = ModContent.ProjectileType(); - int typeTail = ModContent.ProjectileType(); - for (int i = 0; i < Main.maxProjectiles; i++) + for (int num187 = 0; num187 < Main.projectile.Length; num187++) { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) + if (Main.projectile[num187].active && Main.projectile[num187].owner == Main.myPlayer) { - if (head == -1 && Main.projectile[i].type == typeHead) + if (head == -1 && Main.projectile[num187].type == ModContent.ProjectileType()) { - head = i; + head = num187; } - else if (tail == -1 && Main.projectile[i].type == typeTail) + if (tail == -1 && Main.projectile[num187].type == ModContent.ProjectileType()) { - tail = i; + tail = num187; } if (head != -1 && tail != -1) { @@ -114,53 +87,30 @@ namespace CalamityMod.Items.Weapons.Summon } if (head == -1 && tail == -1) { - float num77 = Vector2.Dot(value, vector3); - if (num77 > 0f) - { - player.ChangeDir(1); - } - else - { - player.ChangeDir(-1); - } - velX = 0f; - velY = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner); + speedX = 0f; + speedY = 0f; + position.X = (float)Main.mouseX + Main.screenPosition.X; + position.Y = (float)Main.mouseY + Main.screenPosition.Y; + int curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, curr, 0f); int head2 = curr; - - int prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, (float)prev); - Main.projectile[curr].identity = head2; - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - Main.projectile[curr].identity = head2; - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, curr, 0f); + Main.projectile[head2].localAI[1] = curr; + head2 = curr; + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, curr, 0f); + Main.projectile[head2].localAI[1] = curr; } else if (head != -1 && tail != -1) { - float uuid = (float)Projectile.GetByUUID(Main.myPlayer, Main.projectile[tail].ai[0]); - int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, uuid); - int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, (float)body); - - Main.projectile[body].localAI[1] = (float)back; - Main.projectile[body].ai[1] = 1f; + int body = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, Projectile.GetByUUID(Main.myPlayer, Main.projectile[tail].ai[0]), 0f); + int body2 = body; + body = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, body, 0f); + Main.projectile[body2].localAI[1] = body; + Main.projectile[body2].netUpdate = true; + Main.projectile[body2].ai[1] = 1f; + Main.projectile[body].localAI[1] = tail; Main.projectile[body].netUpdate = true; - Main.projectile[body].identity = head; - - Main.projectile[back].localAI[1] = (float)tail; - Main.projectile[back].netUpdate = true; - Main.projectile[back].ai[1] = 1f; - Main.projectile[body].identity = head; - + Main.projectile[body].ai[1] = 1f; Main.projectile[tail].ai[0] = Main.projectile[body].projUUID; Main.projectile[tail].netUpdate = true; Main.projectile[tail].ai[1] = 1f; diff --git a/NPCs/Abyss/MicrobialCluster.cs b/NPCs/Abyss/MicrobialCluster.cs new file mode 100644 index 0000000000..3441e843dd --- /dev/null +++ b/NPCs/Abyss/MicrobialCluster.cs @@ -0,0 +1,90 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Abyss +{ + public class MicrobialCluster : ModNPC + { + public const int ChargeRate = 120; + public const int SlowdownTime = 45; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Microbial Cluster"); + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 0; + npc.width = 24; + npc.height = 24; + npc.lifeMax = 5; + npc.aiStyle = aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.noTileCollide = false; + npc.noGravity = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.dontTakeDamageFromHostiles = true; + npc.knockBackResist = 0f; + } + public override void AI() + { + if (npc.collideX || npc.collideY) + { + npc.velocity *= -1f; + npc.netUpdate = true; + } + DelegateMethods.v3_1 = Color.GreenYellow.ToVector3() * 2f; + Utils.PlotTileLine(npc.Center, npc.Center + npc.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + npc.ai[0]++; + if (npc.ai[0] % SlowdownTime > SlowdownTime - SlowdownTime) + { + npc.velocity *= 0.98f; + } + if (npc.ai[0] % SlowdownTime == SlowdownTime - 1) + { + npc.velocity = npc.velocity.SafeNormalize(-Vector2.UnitY).RotatedByRandom(MathHelper.PiOver4) * 4f; + } + if (npc.ai[0] % 32f == 31f) + { + Dust dust = Dust.NewDustPerfect(npc.Center, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1f, 2f); + dust.noGravity = true; + dust.scale = 1.6f; + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) => spawnInfo.player.InSulphur() && spawnInfo.water ? 0.4f : 0f; + + public override void NPCLoot() + { + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 6; k++) + { + Dust dust = Dust.NewDustPerfect(npc.Center, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1f, 2f); + dust.scale = 1.2f; + } + } + } + } +} diff --git a/NPCs/Abyss/MicrobialCluster.png b/NPCs/Abyss/MicrobialCluster.png new file mode 100644 index 0000000000..f5bfef9b91 Binary files /dev/null and b/NPCs/Abyss/MicrobialCluster.png differ diff --git a/Projectiles/Ranged/ToxicannonDrop.cs b/Projectiles/Ranged/ToxicannonDrop.cs index 6523d1bcc7..a0cf3f0305 100644 --- a/Projectiles/Ranged/ToxicannonDrop.cs +++ b/Projectiles/Ranged/ToxicannonDrop.cs @@ -3,7 +3,6 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Ranged diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index b0c6d3b1ef..8f4b173ffc 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = 0f; projectile.netUpdate = true; } - int chase = (int)projectile.ai[0]; + int chase = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); float num1064; float scaleFactor17; float scaleFactor18; diff --git a/Projectiles/Summon/MechwormBody2.cs b/Projectiles/Summon/MechwormBody2.cs index e6a56751f1..13d9371b4e 100644 --- a/Projectiles/Summon/MechwormBody2.cs +++ b/Projectiles/Summon/MechwormBody2.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = 0f; projectile.netUpdate = true; } - int chase = (int)projectile.ai[0]; + int chase = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); float num1064; float scaleFactor17; float scaleFactor18; diff --git a/Projectiles/Summon/RustShrapnel.cs b/Projectiles/Summon/RustShrapnel.cs new file mode 100644 index 0000000000..b6ec7cbe6e --- /dev/null +++ b/Projectiles/Summon/RustShrapnel.cs @@ -0,0 +1,80 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class RustShrapnel : ModProjectile + { + public bool HitTile = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shrapnel"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.tileCollide = true; + projectile.minionSlots = 0f; + projectile.minion = true; + } + public override void AI() + { + projectile.ai[0] += 1f; + if (HitTile) + { + projectile.velocity.X = 0f; + projectile.rotation = MathHelper.Pi; + } + else + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + projectile.velocity.Y += 0.4f; + projectile.velocity.X *= 0.96f; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + HitTile = true; + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + projectile.Kill(); + } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + projectile.Kill(); + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 15; i++) + { + Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = Vector2.One.RotatedBy(i / 15f * MathHelper.TwoPi) * 3f * (float)Math.Cos(i / 15f * MathHelper.TwoPi); + dust.scale = 2.5f; + dust.noGravity = true; + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Summon/RustShrapnel.png b/Projectiles/Summon/RustShrapnel.png new file mode 100644 index 0000000000..7e787acdea Binary files /dev/null and b/Projectiles/Summon/RustShrapnel.png differ diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs new file mode 100644 index 0000000000..28a3960b9e --- /dev/null +++ b/Projectiles/Summon/RustyDrone.cs @@ -0,0 +1,150 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.Cooldowns; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class RustyDrone : ModProjectile + { + public const float PlayerHomingInertia = 32f; + public const float PlayerHomingSpeed = 11f; + + public const float NPCHomingInertia = 20f; + public const float NPCHomingSpeed = 14f; + + public const float AttackRate = 110f; + + public const float DistanceToCheck = 750f; + + public const int ExplosionShrapnelBaseDamage = 16; // Uses player.MinionDamage + + public const int ResummonCooldownTime = 60 * 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rusty Drone"); + Main.projFrames[projectile.type] = 12; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.alpha = 255; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) + { + int oldDamage = projectile.damage; + projectile.damage = 1; // For the initial tiny prick effect + projectile.Damage(); + projectile.damage = oldDamage; + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.Center -= Vector2.UnitY * 1400f; + projectile.localAI[0] += 1f; + } + if (projectile.alpha > 0) + { + projectile.alpha = (int)MathHelper.Lerp(projectile.alpha, 0f, 0.02f); + projectile.velocity = Vector2.UnitY * 10f; + } + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = trueDamage; + } + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + { + modPlayer.rustyDrone = false; + } + if (modPlayer.rustyDrone) + { + projectile.timeLeft = 2; + } + } + NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + if (potentialTarget == null) + { + if (projectile.Distance(player.Center) > 120f) + { + projectile.velocity = (projectile.velocity * PlayerHomingInertia + projectile.DirectionTo(player.Top) * PlayerHomingSpeed) / (PlayerHomingInertia + 1); + } + if (projectile.frame >= 8) + { + projectile.frame = 0; + } + } + else + { + // A bit above the target, and always on the opposite side of the target's sprite direction. + Vector2 destination = potentialTarget.Top + Vector2.UnitX * -potentialTarget.spriteDirection * Main.rand.NextFloat(50f, 75f) - Vector2.UnitY * 42f; + projectile.velocity = (projectile.velocity * NPCHomingInertia + projectile.DirectionTo(destination) * NPCHomingSpeed) / (NPCHomingInertia + 1); + if (projectile.frame < 8) + { + projectile.frame = 8; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 8; + } + if (projectile.Distance(destination) < 55f) + { + if (projectile.ai[0]++ % AttackRate == AttackRate - 1) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(potentialTarget.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner, projectile.whoAmI, potentialTarget.whoAmI); + } + } + } + } + projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.X * 0.05f; + projectile.ai[1]++; + if (projectile.ai[1] >= 360f) + { + Utils.PoofOfSmoke(projectile.Center); + for (int i = 0; i < 4; i++) + { + Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), + (int)(ExplosionShrapnelBaseDamage * player.MinionDamage()), 2f, projectile.owner); + } + projectile.Kill(); + } + } + + public override bool CanDamage() => projectile.localAI[0] == 0f; // Only do damage from the initial 1 damage prick, and never again. This is a support summon. + } +} diff --git a/Projectiles/Summon/RustyDrone.png b/Projectiles/Summon/RustyDrone.png new file mode 100644 index 0000000000..9682cc8684 Binary files /dev/null and b/Projectiles/Summon/RustyDrone.png differ diff --git a/Projectiles/Summon/RustyDroneTargetIndicator.cs b/Projectiles/Summon/RustyDroneTargetIndicator.cs new file mode 100644 index 0000000000..0831b15112 --- /dev/null +++ b/Projectiles/Summon/RustyDroneTargetIndicator.cs @@ -0,0 +1,94 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class RustyDroneTargetIndicator : ModProjectile + { + public float Outwardness = 45f; + public Vector2 DeltaPositionRelativetoTarget = Vector2.Zero; + + public const int BuffTime = 180; + public const float TurnRate = 30f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Target Indicator"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.alpha = 50; + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Outwardness); + writer.WriteVector2(DeltaPositionRelativetoTarget); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Outwardness = reader.ReadSingle(); + DeltaPositionRelativetoTarget = reader.ReadVector2(); + } + public override void AI() + { + if (projectile.ai[0] < 0 || projectile.ai[0] >= Main.projectile.Length || projectile.ai[1] < 0 || projectile.ai[1] >= Main.npc.Length) + { + projectile.Kill(); + return; + } + if (Main.projectile[(int)projectile.ai[0]].type != ModContent.ProjectileType() || + !Main.projectile[(int)projectile.ai[0]].active) + { + projectile.Kill(); + } + if (!Main.npc[(int)projectile.ai[1]].active) + { + projectile.Kill(); + } + projectile.Center = Vector2.Lerp(projectile.Center, Main.npc[(int)projectile.ai[1]].Center + DeltaPositionRelativetoTarget * Outwardness, 3f / TurnRate); + if (projectile.localAI[0] == 0f) + { + DeltaPositionRelativetoTarget = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + projectile.localAI[0] = 1f; + } + projectile.localAI[1]++; + if (projectile.localAI[1] % TurnRate == TurnRate - 1f) + { + Outwardness *= 0.6f; + DeltaPositionRelativetoTarget = DeltaPositionRelativetoTarget.RotatedByRandom(MathHelper.PiOver4); + projectile.scale = 1.5f; + projectile.netUpdate = true; + } + if (projectile.scale > 1f && Outwardness > 4f) + { + projectile.scale = MathHelper.Lerp(projectile.scale, 1f, 0.025f); + } + else if (Outwardness <= 4f) + { + Outwardness *= 0.935f; + if (projectile.timeLeft > 40) + { + projectile.timeLeft = 40; + Main.npc[(int)projectile.ai[1]].AddBuff(BuffID.Poisoned, BuffTime); + Main.npc[(int)projectile.ai[1]].AddBuff(ModContent.BuffType(), BuffTime); + } + projectile.alpha = (int)MathHelper.Lerp(projectile.alpha, 255f, 1f / 40f); + projectile.scale += 0.05f; + } + } + } +} diff --git a/Projectiles/Summon/RustyDroneTargetIndicator.png b/Projectiles/Summon/RustyDroneTargetIndicator.png new file mode 100644 index 0000000000..a0b103cdd0 Binary files /dev/null and b/Projectiles/Summon/RustyDroneTargetIndicator.png differ diff --git a/Projectiles/Summon/TacticalPlagueEngineSummon.cs b/Projectiles/Summon/TacticalPlagueEngineSummon.cs index 1727c65ceb..035b9da555 100644 --- a/Projectiles/Summon/TacticalPlagueEngineSummon.cs +++ b/Projectiles/Summon/TacticalPlagueEngineSummon.cs @@ -189,9 +189,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/WulfrumBoltMinion.cs b/Projectiles/Summon/WulfrumBoltMinion.cs new file mode 100644 index 0000000000..3ace303fb9 --- /dev/null +++ b/Projectiles/Summon/WulfrumBoltMinion.cs @@ -0,0 +1,58 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class WulfrumBoltMinion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.minionSlots = 0f; + projectile.minion = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.1f / 255f, 0f); + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 61, 0f, 0f, 100, default, 3f); + Main.dust[num155].noGravity = true; + Main.dust[num155].noLight = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + if (Main.rand.NextBool(8)) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 61, 0f, 0f, 100, default, 2.25f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].noLight = true; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/WulfrumBoltMinion.png b/Projectiles/Summon/WulfrumBoltMinion.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/Summon/WulfrumBoltMinion.png differ diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index c674c1d367..13aabe4831 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -225,12 +225,8 @@ namespace CalamityMod.Projectiles.Summon Vector2 vec = vector2_3 - projectile.Center; vec.Normalize(); Vector2 vec2 = vec * 10f; - int bolt = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vec2.X, vec2.Y, ModContent.ProjectileType(), projectile.damage, 0.0f, Main.myPlayer, 0.0f, 0.0f); - Main.projectile[bolt].Calamity().forceMinion = true; + int bolt = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vec2.X, vec2.Y, ModContent.ProjectileType(), projectile.damage, 0.0f, Main.myPlayer, 0.0f, 0.0f); Main.projectile[bolt].netUpdate = true; - Main.projectile[bolt].penetrate = 1; - Main.projectile[bolt].extraUpdates = 1; - ProjectileID.Sets.MinionShot[Main.projectile[bolt].type] = true; projectile.netUpdate = true; } diff --git a/Projectiles/Typeless/BrokenWaterFilterSpewer.cs b/Projectiles/Typeless/BrokenWaterFilterSpewer.cs new file mode 100644 index 0000000000..6ea1e653dd --- /dev/null +++ b/Projectiles/Typeless/BrokenWaterFilterSpewer.cs @@ -0,0 +1,45 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.SummonItems.Invasion; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BrokenWaterFilterSpewer : ModProjectile + { + public const int TimeLeft = 180; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.timeLeft = TimeLeft; + projectile.penetrate = 1; + projectile.tileCollide = false; + } + + public override void AI() + { + projectile.velocity *= 0.98f; + int totalTearCount = projectile.wet ? 5 : 3; + totalTearCount++; + if (projectile.ai[0]++ >= TimeLeft / totalTearCount) + { + Item.NewItem(projectile.Center, ModContent.ItemType()); + projectile.ai[0] = 0; + } + projectile.rotation = projectile.rotation.AngleTowards(MathHelper.PiOver4, 0.04f); + Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1.5f, 3f); + dust.noGravity = true; + dust.scale = 1.3f; + } + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/BrokenWaterFilterSpewer.png b/Projectiles/Typeless/BrokenWaterFilterSpewer.png new file mode 100644 index 0000000000..6b1604e24c Binary files /dev/null and b/Projectiles/Typeless/BrokenWaterFilterSpewer.png differ diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.cs b/Tiles/Abyss/HardenedSulphurousSandstone.cs new file mode 100644 index 0000000000..d8a786d4c1 --- /dev/null +++ b/Tiles/Abyss/HardenedSulphurousSandstone.cs @@ -0,0 +1,101 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class HardenedSulphurousSandstone : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithAbyss(Type); + + dustType = 32; + drop = ModContent.ItemType(); + AddMapEntry(new Color(76, 58, 59)); + mineResist = 1f; + minPick = 55; + soundType = 0; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + if (CalamityUtils.ParanoidTileRetrieval(i, j + 1).active() && + CalamityUtils.ParanoidTileRetrieval(i, j + 1).type == (ushort)ModContent.TileType()) + { + WorldGen.KillTile(i, j + 1); + } + } + 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); + return false; + } + public override void RandomUpdate(int i, int j) + { + int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); + int nearbyVineCount = 0; + for (int x = i - 15; x <= i + 15; x++) + { + for (int y = j - 15; y <= j + 15; y++) + { + if (WorldGen.InWorld(x, y)) + { + if (CalamityUtils.ParanoidTileRetrieval(x, y).active() && + CalamityUtils.ParanoidTileRetrieval(x, y).type == (ushort)ModContent.TileType()) + { + nearbyVineCount++; + } + } + } + } + if (Main.tile[i, j + 1] != null && nearbyVineCount < 5) + { + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + { + if (Main.tile[i, j + 1].liquid == 255 && + !Main.tile[i, j + 1].lava()) + { + bool flag13 = false; + for (int num52 = num8; num52 > num8 - 10; num52--) + { + if (Main.tile[i, num52].bottomSlope()) + { + flag13 = false; + break; + } + if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) + { + flag13 = true; + break; + } + } + if (flag13) + { + int num53 = i; + int num54 = j + 1; + Main.tile[num53, num54].type = (ushort)ModContent.TileType(); + Main.tile[num53, num54].active(true); + WorldGen.SquareTileFrame(num53, num54, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); + } + } + } + Main.tile[i, j].slope(0); + Main.tile[i, j].halfBrick(false); + } + } + } + } +} diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.png b/Tiles/Abyss/HardenedSulphurousSandstone.png new file mode 100644 index 0000000000..e771428125 Binary files /dev/null and b/Tiles/Abyss/HardenedSulphurousSandstone.png differ diff --git a/Tiles/Abyss/RustyChestLocked.cs b/Tiles/Abyss/RustyChestLocked.cs new file mode 100644 index 0000000000..9391ea2eb8 --- /dev/null +++ b/Tiles/Abyss/RustyChestLocked.cs @@ -0,0 +1,124 @@ +using CalamityMod.Dusts; +using CalamityMod.Items; +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class RustyChestLocked : ModTile + { + public override void SetDefaults() + { + this.SetUpChest(); + ModTranslation name = CreateMapEntryName("chestRusty"); + name.SetDefault("Rusty Chest"); + AddMapEntry(new Color(57, 48, 83), name, MapChestName); + dustType = ModContent.DustType(); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Rusty Chest"; + chestDrop = ModContent.ItemType(); + } + + public override bool HasSmartInteract() => true; + + public override bool IsLockedChest(int i, int j) => Main.tile[i, j].frameX / 36 == 1; + + public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) + { + Player closest = Main.player[Player.FindClosest(new Vector2(i, j) * 16f, 1, 1)]; + if (!closest.InventoryHas(ModContent.ItemType())) + return false; + + for (int k = 0; k < closest.inventory.Length; k++) + { + if (closest.inventory[k].type == ModContent.ItemType()) + { + if (ItemLoader.ConsumeItem(closest.inventory[k], closest)) + { + closest.inventory[k].stack--; + } + if (closest.inventory[k].stack <= 0) + { + closest.inventory[k] = new Item(); + } + break; + } + } + + dustType = this.dustType; + + return true; + } + + public string MapChestName(string name, int i, int j) + { + // Bounds check + if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) + return name; + + // Tile null check + Tile tile = Main.tile[i, j]; + if (tile is null) + return name; + + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; + + int chest = Chest.FindChest(left, top); + return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); + } + + 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(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } + + public override bool NewRightClick(int i, int j) + { + Tile tile = Main.tile[i, j]; + + int left = i; + int top = j; + + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + return CalamityUtils.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); + } + + public override void MouseOver(int i, int j) + { + if (IsLockedChest(i, j)) + CalamityUtils.ChestMouseOver("Rusty Chest", i, j); + else + CalamityUtils.ChestMouseOver("Rusty Chest", i, j); + } + + public override void MouseOverFar(int i, int j) + { + if (IsLockedChest(i, j)) + CalamityUtils.ChestMouseFar("Rusty Chest", i, j); + else + CalamityUtils.ChestMouseFar("Rusty Chest", i, j); + } + } +} diff --git a/Tiles/Abyss/RustyChestLocked.png b/Tiles/Abyss/RustyChestLocked.png new file mode 100644 index 0000000000..e88cc3af08 Binary files /dev/null and b/Tiles/Abyss/RustyChestLocked.png differ diff --git a/Tiles/Abyss/RustyChestLocked_Highlight.png b/Tiles/Abyss/RustyChestLocked_Highlight.png new file mode 100644 index 0000000000..94e49a2c3d Binary files /dev/null and b/Tiles/Abyss/RustyChestLocked_Highlight.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs new file mode 100644 index 0000000000..062ba57029 --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs @@ -0,0 +1,45 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalacmite1 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalacmite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite1.png b/Tiles/Abyss/Stalactite/SulphurousStalacmite1.png new file mode 100644 index 0000000000..a7340e66a7 Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalacmite1.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs new file mode 100644 index 0000000000..658e69ab75 --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs @@ -0,0 +1,45 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalacmite2 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalacmite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite2.png b/Tiles/Abyss/Stalactite/SulphurousStalacmite2.png new file mode 100644 index 0000000000..5d297982b1 Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalacmite2.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs new file mode 100644 index 0000000000..93947597cf --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalacmite3 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalacmite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite3.png b/Tiles/Abyss/Stalactite/SulphurousStalacmite3.png new file mode 100644 index 0000000000..56f5f2a261 Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalacmite3.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs new file mode 100644 index 0000000000..2e528711ca --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalacmite4 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalacmite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite4.png b/Tiles/Abyss/Stalactite/SulphurousStalacmite4.png new file mode 100644 index 0000000000..792626edd6 Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalacmite4.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs new file mode 100644 index 0000000000..a5b9195e2b --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs @@ -0,0 +1,47 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalacmite5 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(0, 3); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalacmite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite5.png b/Tiles/Abyss/Stalactite/SulphurousStalacmite5.png new file mode 100644 index 0000000000..532fd83e59 Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalacmite5.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs new file mode 100644 index 0000000000..44e7679268 --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs @@ -0,0 +1,47 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalacmite6 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(0, 3); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalacmite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite6.png b/Tiles/Abyss/Stalactite/SulphurousStalacmite6.png new file mode 100644 index 0000000000..2155c8ef4e Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalacmite6.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs new file mode 100644 index 0000000000..6196c4010d --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs @@ -0,0 +1,45 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalactite1 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalactite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite1.png b/Tiles/Abyss/Stalactite/SulphurousStalactite1.png new file mode 100644 index 0000000000..bd65323caf Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalactite1.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs new file mode 100644 index 0000000000..17435e8c29 --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs @@ -0,0 +1,45 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalactite2 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalactite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite2.png b/Tiles/Abyss/Stalactite/SulphurousStalactite2.png new file mode 100644 index 0000000000..d85a594c34 Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalactite2.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs new file mode 100644 index 0000000000..b7c9616506 --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalactite3 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalactite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite3.png b/Tiles/Abyss/Stalactite/SulphurousStalactite3.png new file mode 100644 index 0000000000..3503dcbd71 Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalactite3.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs new file mode 100644 index 0000000000..f5a8117c35 --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalactite4 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalactite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite4.png b/Tiles/Abyss/Stalactite/SulphurousStalactite4.png new file mode 100644 index 0000000000..99e80f4efc Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalactite4.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs new file mode 100644 index 0000000000..26b4eb84fb --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs @@ -0,0 +1,47 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalactite5 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalactite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite5.png b/Tiles/Abyss/Stalactite/SulphurousStalactite5.png new file mode 100644 index 0000000000..be82d5b48f Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalactite5.png differ diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs new file mode 100644 index 0000000000..e102c63cdf --- /dev/null +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.Stalactite +{ + public class SulphurousStalactite6 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Stalactite"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite6.png b/Tiles/Abyss/Stalactite/SulphurousStalactite6.png new file mode 100644 index 0000000000..40879b24bd Binary files /dev/null and b/Tiles/Abyss/Stalactite/SulphurousStalactite6.png differ diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs index 315b0de6e4..3275265a58 100644 --- a/Tiles/Abyss/SteamGeyser.cs +++ b/Tiles/Abyss/SteamGeyser.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles.Abyss Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.DrawYOffset = 4; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Geyser"); diff --git a/Tiles/Abyss/SulphuricFossil1.cs b/Tiles/Abyss/SulphuricFossil1.cs new file mode 100644 index 0000000000..cef3f99cc3 --- /dev/null +++ b/Tiles/Abyss/SulphuricFossil1.cs @@ -0,0 +1,31 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphuricFossil1 : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Fossil"); + AddMapEntry(new Color(113, 90, 71), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Abyss/SulphuricFossil1.png b/Tiles/Abyss/SulphuricFossil1.png new file mode 100644 index 0000000000..719f621c0b Binary files /dev/null and b/Tiles/Abyss/SulphuricFossil1.png differ diff --git a/Tiles/Abyss/SulphuricFossil2.cs b/Tiles/Abyss/SulphuricFossil2.cs new file mode 100644 index 0000000000..1dfc116c73 --- /dev/null +++ b/Tiles/Abyss/SulphuricFossil2.cs @@ -0,0 +1,31 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphuricFossil2 : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Fossil"); + AddMapEntry(new Color(113, 90, 71), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Abyss/SulphuricFossil2.png b/Tiles/Abyss/SulphuricFossil2.png new file mode 100644 index 0000000000..9d08d9f024 Binary files /dev/null and b/Tiles/Abyss/SulphuricFossil2.png differ diff --git a/Tiles/Abyss/SulphuricFossil3.cs b/Tiles/Abyss/SulphuricFossil3.cs new file mode 100644 index 0000000000..2a0bf68f7a --- /dev/null +++ b/Tiles/Abyss/SulphuricFossil3.cs @@ -0,0 +1,31 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphuricFossil3 : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Fossil"); + AddMapEntry(new Color(113, 90, 71), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Abyss/SulphuricFossil3.png b/Tiles/Abyss/SulphuricFossil3.png new file mode 100644 index 0000000000..5a5a641757 Binary files /dev/null and b/Tiles/Abyss/SulphuricFossil3.png differ diff --git a/Tiles/Abyss/SulphurousColumn.cs b/Tiles/Abyss/SulphurousColumn.cs new file mode 100644 index 0000000000..6e8482262b --- /dev/null +++ b/Tiles/Abyss/SulphurousColumn.cs @@ -0,0 +1,57 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphurousColumn : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSolid[Type] = false; + Main.tileSolidTop[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + AddMapEntry(new Color(150, 100, 50), name); + name.SetDefault("Column"); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + for (int k = 0; k < WorldGen.genRand.Next(3, 4 + 1); k++) + { + Gore.NewGore(new Vector2(i, j) * 16f, + Vector2.One.RotatedByRandom(MathHelper.TwoPi) * WorldGen.genRand.NextFloat(1.4f, 3.2f), + mod.GetGoreSlot($"Gores/SulphSeaGen/SulphurousRockGore{WorldGen.genRand.Next(3) + 1}")); + } + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/SulphurousColumn.png b/Tiles/Abyss/SulphurousColumn.png new file mode 100644 index 0000000000..7ae5f91a23 Binary files /dev/null and b/Tiles/Abyss/SulphurousColumn.png differ diff --git a/Tiles/Abyss/SulphurousRib1.cs b/Tiles/Abyss/SulphurousRib1.cs new file mode 100644 index 0000000000..9e254f7762 --- /dev/null +++ b/Tiles/Abyss/SulphurousRib1.cs @@ -0,0 +1,47 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphurousRib1 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(0, 3); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ribs"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/SulphurousRib1.png b/Tiles/Abyss/SulphurousRib1.png new file mode 100644 index 0000000000..04d827a0a1 Binary files /dev/null and b/Tiles/Abyss/SulphurousRib1.png differ diff --git a/Tiles/Abyss/SulphurousRib2.cs b/Tiles/Abyss/SulphurousRib2.cs new file mode 100644 index 0000000000..453c193cda --- /dev/null +++ b/Tiles/Abyss/SulphurousRib2.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphurousRib2 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ribs"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/SulphurousRib2.png b/Tiles/Abyss/SulphurousRib2.png new file mode 100644 index 0000000000..039a428250 Binary files /dev/null and b/Tiles/Abyss/SulphurousRib2.png differ diff --git a/Tiles/Abyss/SulphurousRib3.cs b/Tiles/Abyss/SulphurousRib3.cs new file mode 100644 index 0000000000..2f1e4d3514 --- /dev/null +++ b/Tiles/Abyss/SulphurousRib3.cs @@ -0,0 +1,45 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphurousRib3 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ribs"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/SulphurousRib3.png b/Tiles/Abyss/SulphurousRib3.png new file mode 100644 index 0000000000..08d87b3f8c Binary files /dev/null and b/Tiles/Abyss/SulphurousRib3.png differ diff --git a/Tiles/Abyss/SulphurousRib4.cs b/Tiles/Abyss/SulphurousRib4.cs new file mode 100644 index 0000000000..3362214509 --- /dev/null +++ b/Tiles/Abyss/SulphurousRib4.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphurousRib4 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ribs"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/SulphurousRib4.png b/Tiles/Abyss/SulphurousRib4.png new file mode 100644 index 0000000000..0a7697777c Binary files /dev/null and b/Tiles/Abyss/SulphurousRib4.png differ diff --git a/Tiles/Abyss/SulphurousRib5.cs b/Tiles/Abyss/SulphurousRib5.cs new file mode 100644 index 0000000000..147743daf5 --- /dev/null +++ b/Tiles/Abyss/SulphurousRib5.cs @@ -0,0 +1,44 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphurousRib5 : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 1; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ribs"); + AddMapEntry(new Color(57, 48, 83), name); + dustType = (int)CalamityDusts.SulfurousSeaAcid; + + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/SulphurousRib5.png b/Tiles/Abyss/SulphurousRib5.png new file mode 100644 index 0000000000..491e4c63f3 Binary files /dev/null and b/Tiles/Abyss/SulphurousRib5.png differ diff --git a/Tiles/Abyss/SulphurousSand.cs b/Tiles/Abyss/SulphurousSand.cs index b95c2cafa2..5e3b428401 100644 --- a/Tiles/Abyss/SulphurousSand.cs +++ b/Tiles/Abyss/SulphurousSand.cs @@ -114,6 +114,14 @@ namespace CalamityMod.Tiles.Abyss } } + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + if (CalamityUtils.ParanoidTileRetrieval(i, j + 1).active() && + CalamityUtils.ParanoidTileRetrieval(i, j + 1).type == (ushort)ModContent.TileType()) + { + WorldGen.KillTile(i, j + 1); + } + } public override void RandomUpdate(int i, int j) { int tileLocationY = j - 1; @@ -184,6 +192,61 @@ namespace CalamityMod.Tiles.Abyss } } } + + int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); + int nearbyVineCount = 0; + for (int x = i - 15; x <= i + 15; x++) + { + for (int y = j - 15; y <= j + 15; y++) + { + if (WorldGen.InWorld(x, y)) + { + if (CalamityUtils.ParanoidTileRetrieval(x, y).active() && + CalamityUtils.ParanoidTileRetrieval(x, y).type == (ushort)ModContent.TileType()) + { + nearbyVineCount++; + } + } + } + } + if (Main.tile[i, j + 1] != null && nearbyVineCount < 5) + { + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + { + if (Main.tile[i, j + 1].liquid == 255 && + !Main.tile[i, j + 1].lava()) + { + bool flag13 = false; + for (int num52 = num8; num52 > num8 - 10; num52--) + { + if (Main.tile[i, num52].bottomSlope()) + { + flag13 = false; + break; + } + if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) + { + flag13 = true; + break; + } + } + if (flag13) + { + int num53 = i; + int num54 = j + 1; + Main.tile[num53, num54].type = (ushort)ModContent.TileType(); + Main.tile[num53, num54].active(true); + WorldGen.SquareTileFrame(num53, num54, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); + } + } + Main.tile[i, j].slope(0); + Main.tile[i, j].halfBrick(false); + } + } + } } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/Abyss/SulphurousSandstone.cs b/Tiles/Abyss/SulphurousSandstone.cs index 9c5856c996..b56db9b99b 100644 --- a/Tiles/Abyss/SulphurousSandstone.cs +++ b/Tiles/Abyss/SulphurousSandstone.cs @@ -1,6 +1,6 @@ - using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss @@ -27,11 +27,75 @@ namespace CalamityMod.Tiles.Abyss { num = fail ? 1 : 3; } - + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + if (CalamityUtils.ParanoidTileRetrieval(i, j + 1).active() && + CalamityUtils.ParanoidTileRetrieval(i, j + 1).type == (ushort)ModContent.TileType()) + { + WorldGen.KillTile(i, j + 1); + } + } 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); return false; } + public override void RandomUpdate(int i, int j) + { + int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); + int nearbyVineCount = 0; + for (int x = i - 15; x <= i + 15; x++) + { + for (int y = j - 15; y <= j + 15; y++) + { + if (WorldGen.InWorld(x, y)) + { + if (CalamityUtils.ParanoidTileRetrieval(x, y).active() && + CalamityUtils.ParanoidTileRetrieval(x, y).type == (ushort)ModContent.TileType()) + { + nearbyVineCount++; + } + } + } + } + if (Main.tile[i, j + 1] != null && nearbyVineCount < 5) + { + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + { + if (Main.tile[i, j + 1].liquid == 255 && + !Main.tile[i, j + 1].lava()) + { + bool flag13 = false; + for (int num52 = num8; num52 > num8 - 10; num52--) + { + if (Main.tile[i, num52].bottomSlope()) + { + flag13 = false; + break; + } + if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) + { + flag13 = true; + break; + } + } + if (flag13) + { + int num53 = i; + int num54 = j + 1; + Main.tile[num53, num54].type = (ushort)ModContent.TileType(); + Main.tile[num53, num54].active(true); + WorldGen.SquareTileFrame(num53, num54, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); + } + } + Main.tile[i, j].slope(0); + Main.tile[i, j].halfBrick(false); + } + } + } + } } } diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs new file mode 100644 index 0000000000..45143f8b54 --- /dev/null +++ b/Tiles/Abyss/SulphurousVines.cs @@ -0,0 +1,96 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphurousVines : ModTile + { + public override void SetDefaults() + { + Main.tileCut[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileNoFail[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sulphurous Vines"); + AddMapEntry(new Color(0, 50, 0), name); + soundType = 6; + dustType = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + //GIVE VINE ROPE IF SPECIAL VINE BOOK + if (WorldGen.genRand.Next(2) == 0 && Main.player[(int)Player.FindClosest(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16)].cordage) + { + Item.NewItem(new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope); + } + if (Main.tile[i, j + 1] != null) + { + if (Main.tile[i, j + 1].active()) + { + if (Main.tile[i, j + 1].type == ModContent.TileType()) + { + WorldGen.KillTile(i, j + 1, false, false, false); + if (!Main.tile[i, j + 1].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); + } + } + } + } + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j + 1] != null) + { + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + { + if (Main.tile[i, j + 1].liquid >= 128 && !Main.tile[i, j + 1].lava()) + { + bool flag13 = false; + for (int num52 = j; num52 > j - 10; j--) + { + if (Main.tile[i, num52].bottomSlope()) + { + flag13 = false; + break; + } + if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) + { + flag13 = true; + break; + } + } + if (flag13) + { + int num53 = i; + int num54 = j + 1; + Main.tile[num53, num54].type = (ushort)ModContent.TileType(); + Main.tile[num53, num54].frameX = (short)(WorldGen.genRand.Next(8) * 18); + Main.tile[num53, num54].frameY = (short)(4 * 18); + Main.tile[num53, num54 - 1].frameX = (short)(WorldGen.genRand.Next(12) * 18); + Main.tile[num53, num54 - 1].frameY = (short)(WorldGen.genRand.Next(4) * 18); + Main.tile[num53, num54].active(true); + WorldGen.SquareTileFrame(num53, num54, true); + WorldGen.SquareTileFrame(num53, num54 - 1, true); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); + NetMessage.SendTileSquare(-1, num53, num54 - 1, 3, TileChangeType.None); + } + } + } + } + } + } + } +} diff --git a/Tiles/Abyss/SulphurousVines.png b/Tiles/Abyss/SulphurousVines.png new file mode 100644 index 0000000000..e9881e2b19 Binary files /dev/null and b/Tiles/Abyss/SulphurousVines.png differ diff --git a/Tiles/Furniture/EffigyOfDecayPlaceable.cs b/Tiles/Furniture/EffigyOfDecayPlaceable.cs new file mode 100644 index 0000000000..a4a98487c7 --- /dev/null +++ b/Tiles/Furniture/EffigyOfDecayPlaceable.cs @@ -0,0 +1,39 @@ +using CalamityMod.Buffs.Placeables; +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class EffigyOfDecayPlaceable : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Width = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Effigy of Decay"); + AddMapEntry(new Color(113, 90, 71), name); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (player is null) + return; + if (!player.dead && player.active) + player.AddBuff(ModContent.BuffType(), 20); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/EffigyOfDecayPlaceable.png b/Tiles/Furniture/EffigyOfDecayPlaceable.png new file mode 100644 index 0000000000..61db8a5d83 Binary files /dev/null and b/Tiles/Furniture/EffigyOfDecayPlaceable.png differ diff --git a/Walls/HardenedSulphurousSandstoneWall.cs b/Walls/HardenedSulphurousSandstoneWall.cs new file mode 100644 index 0000000000..fef8c39c6d --- /dev/null +++ b/Walls/HardenedSulphurousSandstoneWall.cs @@ -0,0 +1,22 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class HardenedSulphurousSandstoneWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = 32; + drop = ModContent.ItemType(); + AddMapEntry(new Color(62, 50, 39)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/HardenedSulphurousSandstoneWall.png b/Walls/HardenedSulphurousSandstoneWall.png new file mode 100644 index 0000000000..e87f30c45d Binary files /dev/null and b/Walls/HardenedSulphurousSandstoneWall.png differ diff --git a/World/Abyss.cs b/World/Abyss.cs index f388496d1b..96d2f89063 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -1,3 +1,6 @@ +using CalamityMod.Items; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.FurnitureVoid; using CalamityMod.Walls; @@ -19,17 +22,17 @@ namespace CalamityMod.World // Small world if (Main.maxTilesX == 4200) { - return 270; + return 370; } // Medium world else if (Main.maxTilesX == 6400) { - return 365; + return 445; } // Large world else { - return 430; + return 500; } } } @@ -40,39 +43,632 @@ namespace CalamityMod.World // Small world if (Main.maxTilesX == 4200) { - return 160; + return (int)((Main.rockLayer + 20 - YStart) * 0.65); } // Medium world else if (Main.maxTilesX == 6400) { - return 240; + return (int)((Main.rockLayer + 20 - YStart) * 0.8); } // Large world else { - return 310; + return (int)((Main.rockLayer + 20 - YStart) * 0.925); } } } - // How deep the sulph sea goes. - public const int YDescent = 80; - public static int YStart => DetermineYStart(); + public static int YStart = 0; + public static readonly List SulphSeaTiles = new List() + { + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType() + }; public static void PlaceSulphurSea() { CalamityWorld.abyssSide = Main.dungeonX < Main.maxTilesX / 2; - - PlaceCavernBlock(BlockDepth); - PlaceScenery(180); - PlaceWaterCaverns(); - - // A copy of old sulf sea code that replaced all sand with sulph sea/abyss gravel. - // Made by Fabsol. - ReplaceRemainingSand(); - PlaceMiscTiles(90); - SmoothenSea(); - KillRemainingGrass(); + DetermineYStart(); + CreateStartingBlock(); + ChiselOutSea(); + CreateWater(); + GenerateHardenedSandstone(); + PlaceVentsAndFossils(); + SmoothenTheEntireSea(); } - public static int DetermineYStart() + + public static void FinishGeneratingSulphurSea() + { + PlaceStalactites(); + PlaceColumns(); + PlaceRustyChests(); + PlaceTrees(); + } + + #region Perlin Noise + public static float NoiseFunction(int seed) + { + seed = (seed << 13) ^ seed; + return 1.0f - ((seed * (seed * seed * 15731) + 1376312589) & 0x7fffffff) / 1073741824.0f; + } + public static float PerlinNoise2D(float x, float y, int octave, int seed) + { + float frequency = (float)Math.Pow(2, octave); + float xFrequency = x * frequency; + float yFrequency = y * frequency; + int flooredXFrequency = (int)xFrequency; + int flooredYFrequency = (int)yFrequency; + float fractionXFrequency = xFrequency - flooredXFrequency; + float fractionYFrequency = yFrequency - flooredYFrequency; + + float noise1 = NoiseFunction(flooredXFrequency + flooredYFrequency * 54 + seed); + float noise2 = NoiseFunction(flooredXFrequency + 1 + flooredYFrequency * 54 + seed); + float noise3 = NoiseFunction(flooredXFrequency + (1 + flooredYFrequency) * 54 + seed); + float noise4 = NoiseFunction(flooredXFrequency + 1 + (1 + flooredYFrequency) * 54 + seed); + + float lerpStart = MathHelper.Lerp(noise1, noise2, fractionXFrequency); + float lerpEnd = MathHelper.Lerp(noise3, noise4, fractionXFrequency); + return MathHelper.Lerp(lerpStart, lerpEnd, fractionYFrequency); + } + #endregion + + #region Generating Initial Block + public static void CreateStartingBlock() + { + float randomValue1 = WorldGen.genRand.NextFloat(-0.4f, 0.4f); + while (Math.Abs(randomValue1) < 0.22f) + { + randomValue1 = WorldGen.genRand.NextFloat(-0.4f, 0.4f); + } + float randomValue2 = WorldGen.genRand.NextFloat(-0.2f, 0.2f); + while (Math.Abs(randomValue2) < 0.07f) + { + randomValue2 = WorldGen.genRand.NextFloat(-0.2f, 0.2f); + } + for (int x = 1; x < BiomeWidth; x++) + { + float xRatio = x / (float)BiomeWidth; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + float yRatio = (y - YStart) / (float)BlockDepth; + float xAngleWrap = x / (float)BiomeWidth * MathHelper.TwoPi - MathHelper.Pi; + bool generateSand = yRatio < SandstoneYMinimum(xAngleWrap, randomValue1, randomValue2); + if (WorldGen.InWorld(trueX, y)) + { + if (y - YStart < BlockDepth - (int)(BlockDepth * 0.35f) + (int)(Math.Sin(xRatio * MathHelper.Pi) * (int)(BlockDepth * 0.35f))) + { + Main.tile[trueX, y] = new Tile() + { + type = generateSand ? (ushort)ModContent.TileType() : (ushort)ModContent.TileType(), + wall = generateSand ? (ushort)ModContent.WallType() : (ushort)ModContent.WallType() + }; + Main.tile[trueX, y].active(true); + } + } + } + } + } + public static float SandstoneYMinimum(float xAsAngle, float randomValue1, float randomValue2) + { + float sineSquaredRandom1 = randomValue1 * (float)Math.Cos(xAsAngle * randomValue1) * (float)Math.Cos(xAsAngle * randomValue1); + float sineSquaredRandom2 = randomValue1 * (float)Math.Sin(xAsAngle * randomValue1) * (float)Math.Sin(xAsAngle * randomValue1); + float sineSquaredRandom3 = randomValue2 * (float)Math.Sin(xAsAngle * randomValue2); + float sineSquaredRandom4 = (float)Math.Sin(randomValue1 / randomValue2 * xAsAngle) * (float)Math.Cos(randomValue1 * MathHelper.Pi); + return 0.25f * Math.Abs(sineSquaredRandom1 + 0.5f * sineSquaredRandom2 + sineSquaredRandom3 - sineSquaredRandom4) + 0.25f; + } + #endregion + + #region Generating Beach Waters + public static void ChiselOutSea() + { + int seaStartX = CalamityWorld.abyssSide ? 0 : Main.maxTilesX; + int seaEndX = CalamityWorld.abyssSide ? BiomeWidth : Main.maxTilesX - BiomeWidth; + int xCounter = 80; + float depth = 1f; + int yTop = 0; + while (!Main.tile[seaEndX - 1, yTop].active()) + { + yTop++; + } + yTop += WorldGen.genRand.Next(1, 5); + for (int x = seaEndX - 1; x != seaStartX; x += (CalamityWorld.abyssSide ? -1 : 1)) + { + xCounter++; + if (xCounter < BiomeWidth * 0.05) + { + depth += WorldGen.genRand.Next(10, 20) * 0.2f; + } + else if (xCounter < BiomeWidth * 0.08) + { + depth += WorldGen.genRand.Next(10, 20) * 0.15f; + } + else if (xCounter < BiomeWidth * 0.1) + { + depth += WorldGen.genRand.Next(10, 20) * 0.1f; + } + else if (xCounter < BiomeWidth * 0.15) + { + depth += WorldGen.genRand.Next(10, 20) * 0.07f; + } + else if (xCounter < BiomeWidth * 0.2) + { + depth += WorldGen.genRand.Next(10, 20) * 0.05f; + } + else if (xCounter < BiomeWidth * 0.25) + { + depth += WorldGen.genRand.Next(10, 20) * 0.04f; + } + else if (xCounter < BiomeWidth * 0.325) + { + depth += WorldGen.genRand.Next(10, 20) * 0.03f; + } + else if (xCounter < BiomeWidth * 0.375) + { + depth += WorldGen.genRand.Next(10, 20) * 0.02f; + } + else if (xCounter < BiomeWidth * 0.45) + { + depth += WorldGen.genRand.Next(10, 20) * 0.01f; + } + else if (xCounter < BiomeWidth * 0.6) + { + depth += WorldGen.genRand.Next(10, 20) * 0.005f; + } + else if (xCounter < BiomeWidth * 0.75) + { + depth += WorldGen.genRand.Next(10, 20) * 0.001f; + } + int depthAdditive = WorldGen.genRand.Next(15, 20); + int y = 0; + while (y < yTop + depth + depthAdditive) + { + if (y < yTop + depth * 0.75f - 3f) + { + Main.tile[x, y].active(false); + if (y > yTop) + { + Main.tile[x, y].liquid = 255; + } + else if (y == yTop) + { + Main.tile[x, y].liquid = 127; + } + } + else if (y > yTop && + (Main.tile[x, y].type == (ushort)ModContent.TileType() || + Main.tile[x, y].type == (ushort)ModContent.TileType())) + { + Main.tile[x, y].active(true); + } + Main.tile[x, y].wall = 0; + y++; + } + } + } + #endregion + + #region Generating Water + public const int PerlinIterations = 1; + public const int PerlinOctaves = 4; + public const int PerlinXEdgeClamp = 20; + public const float PerlinYDelta = 40; + public const float PerlinNoiseMax = 0.05f; + public const float PerlinThreshold = 0.1f; // Be careful with this number + public static void CreateWater() + { + int[] seeds = new int[PerlinIterations]; + for (int i = 0; i < seeds.Length; i++) + { + seeds[i] = WorldGen.genRand.Next(); + } + for (int x = 1; x < BiomeWidth; x++) + { + float xRatio = x / (float)BiomeWidth; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + float yRatio = (y - YStart) / (float)BlockDepth; + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + if (y - YStart < BlockDepth - (int)(BlockDepth * 0.35f) + (int)(Math.Sin(xRatio * MathHelper.Pi) * (int)(BlockDepth * 0.35f)) - PerlinYDelta) + { + if (x < PerlinXEdgeClamp || x > BiomeWidth - PerlinXEdgeClamp) + continue; + float perlinAverage = 0f; + for (int k = 0; k < seeds.Length; k++) + { + perlinAverage += PerlinNoise2D(xRatio, yRatio, PerlinOctaves, seeds[k]) / PerlinIterations; + } + if (perlinAverage > PerlinThreshold * WorldGen.genRand.NextFloat(1f - PerlinNoiseMax, 1f + PerlinNoiseMax)) + { + ushort oldWall = Main.tile[trueX, y].wall; + Main.tile[trueX, y] = new Tile() + { + wall = oldWall, + liquid = 255 + }; + } + } + } + } + } + #endregion + + #region Generating Edge Sandstone + public const int EdgeCheckMinX = 6; + public const int EdgeCheckMaxX = 8; + public const int EdgeCheckMinY = 4; + public const int EdgeCheckMaxY = 6; + public const int MinimumEdgeScore = 4; + public const int SpotWidth = 4; + public static void GenerateHardenedSandstone() + { + for (int x = 1; x < BiomeWidth; x++) + { + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + int edgeScore = GetEdgeScore(trueX, y); + + if (edgeScore >= MinimumEdgeScore) + { + for (int dx = -SpotWidth / 2; dx <= SpotWidth; dx++) + { + for (int dy = -SpotWidth / 2; dy <= SpotWidth / 2; dy++) + { + if (WorldGen.InWorld(trueX + dx, y + dy)) + { + if (CalamityUtils.ParanoidTileRetrieval(trueX + dx, y + dy).type != (ushort)ModContent.TileType() && + SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(trueX + dx, y + dy).type)) + { + Main.tile[trueX + dx, y + dy].type = (ushort)ModContent.TileType(); + } + } + } + } + } + else if (WorldGen.genRand.NextBool(10)) + { + for (int i = 0; i < 20; i++) + { + TileLoader.RandomUpdate(trueX, y, Main.tile[trueX, y].type); + } + } + } + } + } + public static int GetEdgeScore(int x, int y) + { + int edgeScore = 0; + for (int dx = x - WorldGen.genRand.Next(EdgeCheckMinX, EdgeCheckMaxX + 1); dx <= x + WorldGen.genRand.Next(EdgeCheckMinX, EdgeCheckMaxX + 1); dx++) + { + if (dx == x) + continue; + if (CalamityUtils.ParanoidTileRetrieval(dx, y).liquid == 255) + edgeScore++; + } + for (int dy = y - WorldGen.genRand.Next(EdgeCheckMinY, EdgeCheckMaxY + 1); dy <= y + WorldGen.genRand.Next(EdgeCheckMinY, EdgeCheckMaxY + 1); dy++) + { + if (dy == y) + continue; + if (CalamityUtils.ParanoidTileRetrieval(x, dy).liquid == 255) + edgeScore++; + } + return edgeScore; + } + #endregion + + #region Smoothening Everything + public static void SmoothenTheEntireSea() + { + for (int x = 2; x < BiomeWidth - 2; x++) + { + int trueX = x; + if (!CalamityWorld.abyssSide) + trueX = Main.maxTilesX - x; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + Tile.SmoothSlope(trueX, y); + } + } + } + #endregion + + #region Generating Scenery + public const int ColumnMinDistanceX = 8; + public const int ColumnMinHeight = 10; + public const int ColumnMaxHeight = 27; + public const int StalactitePairMinDistance = 6; + public const int StalactitePairMaxDistance = 44; + public static void PlaceVentsAndFossils() + { + for (int x = 1; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + // Generate vents in the top 45% + if (y - YStart < BlockDepth * 0.45f) + { + if (WorldGen.SolidTile(trueX, y + 1) && WorldGen.genRand.NextBool(20)) + { + PlaceMiscTile(trueX, y, 1, 2, (ushort)ModContent.TileType()); + } + } + // And fossils in the bottom 55% + else + { + if (WorldGen.SolidTile(trueX, y + 1)) + { + // Generate ribs such that they're all nearby + if (WorldGen.genRand.NextBool(25)) + { + ushort type = (ushort)Utils.SelectRandom(WorldGen.genRand, + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType()); + int height; + if (type == ModContent.TileType() || type == ModContent.TileType()) + { + height = 3; + } + else if (type == ModContent.TileType()) + { + height = 2; + } + else if (type == ModContent.TileType()) + { + height = 4; + } + else + { + height = 1; + } + PlaceMiscTile(trueX, y, 1, height, type); + } + else if (WorldGen.genRand.NextBool(16)) + { + PlaceMiscTile(trueX, y, 3, 2, (ushort)Utils.SelectRandom(WorldGen.genRand, ModContent.TileType(), ModContent.TileType(), ModContent.TileType())); + } + } + } + } + } + } + public static void PlaceColumns() + { + int previousX = 0; + int style; + for (int x = 1; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + if (y - YStart > BlockDepth * 0.5f) + { + if (WorldGen.SolidTile(trueX, y + 1) && + WorldGen.SolidTile(trueX + 1, y + 1) && + SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y + 1).type) && + WorldGen.genRand.NextBool(3) && + Math.Abs(trueX - previousX) >= ColumnMinDistanceX) + { + int top = y; + int height = 0; + while (!(WorldGen.SolidTile(trueX - 1, top) && WorldGen.SolidTile(trueX, top) && WorldGen.SolidTile(trueX + 1, top))) + { + top--; + height++; + if (height > ColumnMaxHeight + 1) + break; + } + if (height <= ColumnMaxHeight && height >= ColumnMinHeight) + { + for (int dy = 0; dy < height; dy++) + { + style = WorldGen.genRand.Next(3); + short yFrame = 18; + if (dy == 0) + yFrame = 36; + if (dy == height - 1) + yFrame = 0; + if (Main.tile[trueX, y - dy] == null) + Main.tile[trueX, y - dy] = new Tile(); + ushort oldWall = Main.tile[trueX, y - dy].wall; + Main.tile[trueX, y - dy] = new Tile + { + type = (ushort)ModContent.TileType(), + frameX = (short)(style * 36), + frameY = yFrame, + liquid = 255, + wall = oldWall + }; + Main.tile[trueX, y - dy].active(true); + + if (Main.tile[trueX + 1, y - dy] == null) + Main.tile[trueX + 1, y - dy] = new Tile(); + + oldWall = Main.tile[trueX + 1, y - dy].wall; + Main.tile[trueX + 1, y - dy] = new Tile + { + type = (ushort)ModContent.TileType(), + frameX = (short)(style * 36 + 18), + frameY = yFrame, + liquid = 255, + wall = oldWall + }; + Main.tile[trueX + 1, y - dy].active(true); + } + previousX = trueX; + } + } + } + } + } + } + public static void PlaceStalactites() + { + int heightFromType(int type) + { + if (type <= 2) + return 2; + else if (type <= 4) + return 3; + else + return 4; + }; + for (int x = 1; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + if (y - YStart > BlockDepth * 0.25f) + { + if (WorldGen.SolidTile(trueX, y - 1) && WorldGen.genRand.NextBool(10)) + { + int dy = 1; + while (!CalamityUtils.ParanoidTileRetrieval(trueX, y + dy).active()) + { + dy++; + if (dy > StalactitePairMaxDistance) + break; + } + if (dy <= StalactitePairMaxDistance && dy >= StalactitePairMinDistance) + { + int type = WorldGen.genRand.Next(6); + type++; + int height = heightFromType(type); + PlaceStalactite(trueX, y, height, (ushort)CalamityMod.instance.TileType($"SulphurousStalactite{type}")); + if (WorldGen.SolidTile(trueX, y + dy + 1)) + { + PlaceStalacmite(trueX, y + dy, height, (ushort)CalamityMod.instance.TileType($"SulphurousStalacmite{type}")); + } + + // Reset the slope/half brick variables for the tiles below/above the pairs, so that it doesn't look like there's an + // imaginary gap between the stalactite and tile it's attached to. + Main.tile[trueX, y - 1].slope(0); + Main.tile[trueX, y - 1].halfBrick(false); + + Main.tile[trueX, y + dy + 1].slope(0); + Main.tile[trueX, y + dy + 1].halfBrick(false); + } + } + } + } + } + } + public static void PlaceMiscTile(int x, int y, int width, int height, ushort type, int style = 0) + { + try + { + bool canGenerate = true; + for (int i = x; i < x + width; i++) + { + for (int j = y - (int)Math.Ceiling(height / 2.0); j < y + (int)Math.Ceiling(height / 2.0); j++) + { + if (Main.tile[i, j] == null) + { + Main.tile[i, j] = new Tile(); + } + if (Main.tile[i, j].active()) + { + canGenerate = false; + } + } + if (Main.tile[i, y + 1] == null) + { + Main.tile[i, y + 1] = new Tile(); + } + if (!Main.tile[i, y + 1].nactive() || Main.tile[i, y + 1].halfBrick() || Main.tile[i, y + 1].slope() != 0 || !Main.tileSolid[Main.tile[i, y + 1].type]) + { + canGenerate = false; + } + } + if (canGenerate) + { + WorldGen.PlaceTile(x, y, type, style: style); + } + } + catch + { + return; // This should only ever happen from an index error, and there's really no point in continuing if that happens + } + } + public static void PlaceStalactite(int x, int y, int height, ushort type) + { + for (int dy = 0; dy < height; dy++) + { + ushort oldWall = Main.tile[x, y + dy].wall; + Main.tile[x, y + dy] = new Tile + { + wall = oldWall, + type = type, + frameY = (short)(dy * 18) + }; + Main.tile[x, y + dy].active(true); + } + } + public static void PlaceStalacmite(int x, int y, int height, ushort type) + { + for (int dy = height - 1; dy >= 0; dy--) + { + ushort oldWall = Main.tile[x, y + dy].wall; + Main.tile[x, y - dy] = new Tile + { + type = type, + frameY = (short)(height * 18 - dy * 18), + wall = oldWall + }; + Main.tile[x, y - dy].active(true); + } + } + #endregion + + #region Generating Chests + public const int CheckCutoffDistance = 45; + public static void PlaceRustyChests() + { + // Ambiguity bullshit. + int[] ItemTypes = { ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() }; + + for (int i = 0; i < ItemTypes.Length; ++i) + { + Chest chest = null; + int attempts = 0; + + while (chest == null && attempts < 2500) + { + attempts++; + int x = WorldGen.genRand.Next(CheckCutoffDistance, BiomeWidth - CheckCutoffDistance); + if (!CalamityWorld.abyssSide) + { + x = Main.maxTilesX - x; + } + int y = WorldGen.genRand.Next(YStart + CheckCutoffDistance, YStart + BlockDepth - CheckCutoffDistance); + if (WorldGen.InWorld(x, y)) + { + if (!CalamityUtils.ParanoidTileRetrieval(x, y).active() && + SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(x, y + 1).type)) + { + chest = WorldGenerationMethods.AddChestWithLoot(x, y, (ushort)ModContent.TileType(), tileStyle: 1); + } + } + } + + // If a chest was placed, force its first item to be the unique item. + if (chest != null) + { + chest.item[0].SetDefaults(ItemTypes[i]); + chest.item[0].Prefix(-1); + } + } + } + #endregion + + #region Misc Functions + public static void DetermineYStart() { int maxHeight = int.MaxValue; for (int i = 0; i < 15; i++) @@ -84,428 +680,13 @@ namespace CalamityMod.World while (!Main.tile[xCheck, YStart].active()) { YStart++; - if (YStart > (int)Main.rockLayer - YDescent - 5) + if (YStart > Main.rockLayer - 40) break; } if (maxHeight > YStart) maxHeight = YStart; } - return maxHeight; - } - public static void PlaceCavernBlock(int blockDepth) - { - for (int x = 0; x < BiomeWidth; x++) - { - for (int y = 15; y < blockDepth; y++) - { - int trueX = x; - if (!CalamityWorld.abyssSide) - { - trueX = Main.maxTilesX - x; - } - int trueDepth = blockDepth - 36 + (int)(Math.Sin(MathHelper.Pi * x / BiomeWidth) * 36); - if (WorldGen.InWorld(trueX, y + YStart)) - { - if (CalamityUtils.ParanoidTileRetrieval(trueX, y + YStart).liquid == 0 && - y < trueDepth) - { - ushort type = (ushort)ModContent.TileType(); - if (y > trueDepth * 0.35 && y < trueDepth * 0.4 && Main.rand.NextBool(4)) - { - type = (ushort)ModContent.TileType(); - } - else if (y >= trueDepth * 0.4) - { - type = (ushort)ModContent.TileType(); - } - if ((Main.tile[trueX, y + YStart].active() && Main.tile[trueX, y + YStart].type != TileID.Trees && Main.tile[trueX, y + YStart].type != TileID.PalmTree) || - y > trueDepth * (0.26 + WorldGen.genRand.NextFloat(-0.02f, 0.02f))) - { - Main.tile[trueX, y + YStart].type = type; - Main.tile[trueX, y + YStart].slope(0); - Main.tile[trueX, y + YStart].active(true); - Main.tile[trueX, y + YStart].wall = Main.tile[trueX, y + YStart].type == (ushort)ModContent.TileType() ? - (ushort)ModContent.WallType() : (ushort)ModContent.WallType(); - } - } - } - } - } - } - public static void PlaceWaterCaverns() - { - // This is used in other vanilla worldgen. However, it does not affect any worldgen after this. - // This is basically the point where TileRunner stops spawning water. - WorldGen.waterLine = 1; - int xStart = CalamityWorld.abyssSide ? BiomeWidth / 2 : - Main.maxTilesX - BiomeWidth / 2; - for (int c = 0; c < 8; c++) - { - Vector2 startingPosition = new Vector2(xStart + WorldGen.genRand.Next(-25, 25 + 1), YStart + WorldGen.genRand.Next(20)); - while (!CalamityUtils.ParanoidTileRetrieval((int)startingPosition.X, (int)startingPosition.Y).active()) - { - startingPosition.Y++; - } - float xDirection = WorldGen.genRand.NextFloat() * 0.2f - 0.2f; - float yDirection = 1f - xDirection; - if (c == 0) - { - xDirection = WorldGen.genRand.NextFloat(1f, 2f); - yDirection = 2f; - } - if (WorldGen.genRand.NextBool(2)) - { - xDirection *= -1; - } - if (WorldGen.genRand.NextBool(2)) - { - yDirection *= -1; - } - for (int i = 0; i < 11; i++) - { - startingPosition = WorldGen.digTunnel(startingPosition.X, startingPosition.Y, xDirection, yDirection, WorldGen.genRand.Next(6, 20), WorldGen.genRand.Next(4, 9), false); - xDirection += WorldGen.genRand.NextFloat(-0.5f, 0.5f); - yDirection += WorldGen.genRand.NextFloat(-0.2f, 0.2f); - xDirection = MathHelper.Clamp(xDirection, -4f, 4f); - yDirection = MathHelper.Clamp(yDirection, -1f, 3f); - float xdirection2 = WorldGen.genRand.NextFloat(-0.4f, 0.4f); - float ydirection2 = WorldGen.genRand.NextFloat(-0.2f, 0.2f); - if (WorldGen.genRand.NextBool(2)) - { - xdirection2 *= -1; - } - if (WorldGen.genRand.NextBool(2)) - { - ydirection2 *= -1; - } - Vector2 tunnelVector = WorldGen.digTunnel(startingPosition.X, startingPosition.Y, xdirection2, ydirection2, WorldGen.genRand.Next(30, 50), WorldGen.genRand.Next(5, 10 + 1), false); - - // The -2 parameter causes the tile-runner to generate liquids. Water above the lavaLine and lava below. - WorldGen.TileRunner((int)tunnelVector.X, (int)tunnelVector.Y, WorldGen.genRand.Next(24, 32 + 1), WorldGen.genRand.Next(19, 24 + 1), -2, false, 0f, 0f, false, true); - } - } - } - public static void PlaceScenery(int downwardCheck) - { - // Vents - for (int x = 0; x < BiomeWidth; x++) - { - int trueX = x; - if (!CalamityWorld.abyssSide) - { - trueX = Main.maxTilesX - x; - } - for (int y = YStart - 30; y < YStart + downwardCheck; y++) - { - if (WorldGen.genRand.NextBool(9)) - { - if (CalamityUtils.TileSelectionSolid(trueX, y, 2, -2)) - break; - WorldGen.PlaceTile(trueX, y, ModContent.TileType()); - } - } - } - - // Rock pillars in the water - for (int c = 1; c <= 5; c++) - { - int xStart = 0; - switch (c) - { - case 1: - xStart = 40; - break; - case 2: - xStart = 60; - break; - case 3: - xStart = 90; - break; - case 4: - xStart = 140; - break; - case 5: - xStart = 200; - break; - } - if (!CalamityWorld.abyssSide) - { - xStart = Main.maxTilesX - xStart; - } - // Adjust Y positioning a bit - int dy = -40; - while (!CalamityUtils.ParanoidTileRetrieval(xStart, YStart + dy).active() || - (CalamityUtils.ParanoidTileRetrieval(xStart, YStart + dy).type != (ushort)ModContent.TileType() && - CalamityUtils.ParanoidTileRetrieval(xStart, YStart + dy).type != (ushort)ModContent.TileType())) - { - if (WorldGen.InWorld(xStart, YStart + dy + 1)) - { - if (Main.tile[xStart, YStart + dy + 1] == null) - Main.tile[xStart, YStart + dy + 1] = new Tile(); - } - else - { - dy++; - continue; - } - dy++; - if (YStart + dy > Main.rockLayer - 30) - break; - } - int ascent = WorldGen.genRand.Next(4 * c, 8 * c + 3) + 7; - - int widthTop = WorldGen.genRand.Next(2, 4 + 1); - int widthBottomAdditive = WorldGen.genRand.Next(13, 20 + 1); - float root = WorldGen.genRand.NextFloat(1.6f, 3.2f); - for (int y = YStart - ascent; y <= YStart + 6; y++) - { - // The root is used to give a less linear scale - float yRatio = (float)Math.Pow(1f - (-(y - YStart) / (float)ascent), 1f / root); - int width = widthTop + (int)(widthBottomAdditive * yRatio); - for (int x = xStart - width / 2; x <= xStart + width / 2; x++) - { - Main.tile[x, y + dy].type = (ushort)ModContent.TileType(); - Main.tile[x, y + dy].slope(0); - Main.tile[x, y + dy].active(true); - } - } - } - } - public static void ReplaceRemainingSand() - { - List tilesToReplace = new List() - { - TileID.Dirt, - TileID.Mud, - TileID.Grass, - TileID.CorruptGrass, - TileID.FleshGrass, - TileID.Ebonsand, - TileID.Ebonstone, - TileID.Crimstone, - TileID.Crimsand, - TileID.Sand, - TileID.Stone, - TileID.Copper, - TileID.Tin, - TileID.Iron, - TileID.Lead, - TileID.Tungsten, - TileID.Silver - }; - List wallsToReplace = new List() - { - WallID.Stone, - WallID.Grass, - WallID.GrassUnsafe, - WallID.CorruptGrassUnsafe, - WallID.CrimsonGrassUnsafe, - WallID.CrimstoneUnsafe, - WallID.EbonstoneUnsafe, - WallID.MudUnsafe - }; - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - - if (WorldGen.dungeonX < genLimit) - CalamityWorld.abyssSide = true; - - int abyssChasmX = CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135); //2100 - 1965 = 135 : 2100 + 1965 = 4065 - - if (CalamityWorld.abyssSide) - { - for (int abyssIndexSand = 0; abyssIndexSand < abyssChasmX + BiomeWidth; abyssIndexSand++) - { - for (int abyssIndexSand2 = 0; abyssIndexSand2 < (int)Main.rockLayer - WorldGen.genRand.Next(115, 122 + 1); abyssIndexSand2++) - { - Tile tile = Framing.GetTileSafely(abyssIndexSand, abyssIndexSand2); - if (abyssIndexSand > abyssChasmX + BiomeWidth) - { - if (tile.active() && - tilesToReplace.Contains(tile.type) && - WorldGen.genRand.Next(4) == 0) - { - tile.type = (ushort)ModContent.TileType(); - } - else if (tile.active() && - tile.type == TileID.Trees) - { - tile.active(false); - } - } - else if (abyssIndexSand > abyssChasmX + BiomeWidth - 15) - { - if (tile.active() && - tilesToReplace.Contains(tile.type) && - WorldGen.genRand.Next(2) == 0) - { - tile.type = (ushort)ModContent.TileType(); - } - else if (tile.active() && - tile.type == TileID.Trees) - { - tile.active(false); - } - } - else - { - if (tile.active() && - tilesToReplace.Contains(tile.type)) - { - tile.type = (ushort)ModContent.TileType(); - } - else if (tile.active() && - tile.type == TileID.Trees) - { - tile.active(false); - } - } - if (wallsToReplace.Contains(tile.wall)) - { - Main.tile[abyssIndexSand, abyssIndexSand2].wall = Main.tile[abyssIndexSand, abyssIndexSand2].type == (ushort)ModContent.TileType() ? - (ushort)ModContent.WallType() : (ushort)ModContent.WallType(); - } - } - } - } - else - { - for (int abyssIndexSand = abyssChasmX - BiomeWidth; abyssIndexSand < x; abyssIndexSand++) - { - for (int abyssIndexSand2 = 0; abyssIndexSand2 < (int)Main.rockLayer - WorldGen.genRand.Next(115, 122 + 1); abyssIndexSand2++) - { - Tile tile = Framing.GetTileSafely(abyssIndexSand, abyssIndexSand2); - if (abyssIndexSand < abyssChasmX - BiomeWidth) - { - if (tile.active() && - tilesToReplace.Contains(tile.type) && - WorldGen.genRand.Next(4) == 0) - { - tile.type = (ushort)ModContent.TileType(); - } - else if (tile.active() && - tile.type == TileID.Trees) - { - tile.active(false); - } - } - else if (abyssIndexSand < abyssChasmX - BiomeWidth + 15) - { - if (tile.active() && - tilesToReplace.Contains(tile.type) && - WorldGen.genRand.Next(2) == 0) - { - tile.type = (ushort)ModContent.TileType(); - } - else if (tile.active() && - tile.type == TileID.Trees) - { - tile.active(false); - } - } - else - { - if (tile.active() && - tilesToReplace.Contains(tile.type)) - { - tile.type = (ushort)ModContent.TileType(); - } - else if (tile.active() && - tile.type == TileID.Trees) - { - tile.active(false); - } - } - if (wallsToReplace.Contains(tile.wall)) - { - Main.tile[abyssIndexSand, abyssIndexSand2].wall = Main.tile[abyssIndexSand, abyssIndexSand2].type == (ushort)ModContent.TileType() ? - (ushort)ModContent.WallType() : (ushort)ModContent.WallType(); - } - } - } - } - } - // This should not have been required - public static void KillRemainingGrass() - { - List ToKill = new List() - { - TileID.Dirt, - TileID.Grass, - TileID.Mud, - }; - for (int x = 0; x < BiomeWidth; x++) - { - int trueX = x; - if (!CalamityWorld.abyssSide) - { - trueX = Main.maxTilesX - x; - } - for (int y = YStart - 300; y < YStart + 300; y++) - { - if (!WorldGen.InWorld(trueX, y)) - continue; - if (ToKill.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y).type) && CalamityUtils.ParanoidTileRetrieval(trueX, y).active()) - { - // During the check in ParanoidTileRetrieval, the tile is replaced with an instance if it is null. - // As a result, null checks are not required here. - Main.tile[trueX, y] = new Tile(); - WorldGen.KillTile(trueX, y - 1); - } - } - } - } - public static void PlaceMiscTiles(int maximumDepth) - { - // Kelp - for (int x = 0; x < BiomeWidth; x++) - { - int trueX = x; - if (!CalamityWorld.abyssSide) - { - trueX = Main.maxTilesX - x; - } - for (int y = YStart + 20; y < YStart + 20 + maximumDepth; y++) - { - if (WorldGen.genRand.NextBool(24)) - { - if (CalamityUtils.TileSelectionSolid(trueX, y, 1, 2) && - (CalamityUtils.ParanoidTileRetrieval(trueX, y).type == ModContent.TileType() || - CalamityUtils.ParanoidTileRetrieval(trueX, y).type == ModContent.TileType())) - break; - WorldGen.PlaceTile(trueX, y, TileID.DyePlants, style:5); - } - } - } - } - public static void SmoothenSea() - { - for (int x = 1; x < Main.maxTilesX - 1; x++) - { - int trueX = x; - if (!CalamityWorld.abyssSide) - { - trueX = Main.maxTilesX - x; - } - for (int y = 1; y < Main.maxTilesY * 0.5; y++) - { - if (Framing.GetTileSafely(trueX, y).type == (ushort)ModContent.TileType() || - Framing.GetTileSafely(trueX, y).type == (ushort)ModContent.TileType()) - { - Main.tile[trueX, y].slope(0); - Main.tile[trueX, y].halfBrick(false); - try - { - Tile.SmoothSlope(trueX, y); - } - catch - { - continue; - } - } - } - } + YStart = maxHeight; } public static void PlaceTrees() { @@ -531,7 +712,7 @@ namespace CalamityMod.World { lastTreeX = trueX; } - if (!success && + if (!success && Main.tile[trueX, y - 1].type == ModContent.TileType() && Main.tile[trueX, y - 2].type == ModContent.TileType()) { @@ -545,7 +726,7 @@ namespace CalamityMod.World public static bool GrowSaplingImmediately(int i, int j) { int trueStartingPositionY = j; - while (TileLoader.IsSapling((int)Main.tile[i, trueStartingPositionY].type)) + while (TileLoader.IsSapling(Main.tile[i, trueStartingPositionY].type)) { trueStartingPositionY++; } @@ -604,10 +785,12 @@ namespace CalamityMod.World WorldGen.RangeFrame(i - 2, trueStartingPositionY - treeHeight - 1, i + 2, trueStartingPositionY + 1); if (Main.netMode == NetmodeID.Server) { - NetMessage.SendTileSquare(-1, i, (int)((double)trueStartingPositionY - (double)treeHeight * 0.5), treeHeight + 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, i, (int)(trueStartingPositionY - treeHeight * 0.5), treeHeight + 1, TileChangeType.None); } return true; } + #endregion + public static void PlaceAbyss() { int x = Main.maxTilesX; @@ -948,7 +1131,6 @@ namespace CalamityMod.World } } } - PlaceTrees(); } } } diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index ec98aa3a12..8572d347e5 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -742,7 +742,7 @@ namespace CalamityMod.World calamityTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; sunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; abyssTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - sulphurTiles = tileCounts[ModContent.TileType()]; + sulphurTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; #region Astral Stuff int astralDesertTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; @@ -864,6 +864,16 @@ namespace CalamityMod.World })); #endregion + int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); + if (SulphurIndex != -1) + { + tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur", delegate (GenerationProgress progress) + { + progress.Message = "Sulphur Sea"; + Abyss.PlaceSulphurSea(); + })); + } + tasks.Insert(FinalIndex + 2, new PassLegacy("SpecialShrines", delegate (GenerationProgress progress) { progress.Message = "Special Shrines"; @@ -876,18 +886,13 @@ namespace CalamityMod.World Abyss.PlaceAbyss(); })); - // Moved to prevent the sulf sea caverns from being swallowed by the abyss opening - int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); - if (SulphurIndex != -1) + tasks.Insert(FinalIndex + 4, new PassLegacy("Sulphur2", delegate (GenerationProgress progress) { - tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur", delegate (GenerationProgress progress) - { - progress.Message = "Sulphur Sea"; - Abyss.PlaceSulphurSea(); - })); - } + progress.Message = "Finishing Sulphur Sea"; + Abyss.FinishGeneratingSulphurSea(); + })); - tasks.Insert(FinalIndex + 4, new PassLegacy("IWannaRock", delegate (GenerationProgress progress) + tasks.Insert(FinalIndex + 5, new PassLegacy("IWannaRock", delegate (GenerationProgress progress) { progress.Message = "I Wanna Rock"; WorldGenerationMethods.PlaceRoxShrine(); diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index 90b073535a..6cf3b5a228 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -75,7 +75,7 @@ namespace CalamityMod.World } } - private static Chest AddChestWithLoot(int i, int j, ushort type = TileID.Containers, uint startingSlot = 1, int tileStyle = 0) + internal static Chest AddChestWithLoot(int i, int j, ushort type = TileID.Containers, uint startingSlot = 1, int tileStyle = 0) { int chestIndex = -1; @@ -100,7 +100,7 @@ namespace CalamityMod.World return chest; } - private static void PlaceLootInChest(ref Chest chest, ushort type, uint startingSlot) + internal static void PlaceLootInChest(ref Chest chest, ushort type, uint startingSlot) { uint itemIndex = startingSlot; @@ -139,7 +139,25 @@ namespace CalamityMod.World } PutItemInChest(ref chest, ItemID.GoldCoin, goldCoins); } + else if (type == ModContent.TileType()) + { + // 15-29 torches (in accordence with vanilla) + PutItemInChest(ref chest, ItemID.Torch, 15, 29); + // 50% chance of 1 or 2 of the following potions + int[] potions = new int[] + { + ModContent.ItemType(), ItemID.WaterWalkingPotion, ItemID.ShinePotion, ItemID.GillsPotion, ItemID.FlipperPotion + }; + PutItemInChest(ref chest, WorldGen.genRand.Next(potions), 1, 2, WorldGen.genRand.NextBool()); + PutItemInChest(ref chest, WorldGen.genRand.Next(potions), 1, 2, WorldGen.genRand.NextBool()); + + // 33% chance of flippers + PutItemInChest(ref chest, ItemID.Flipper, condition: WorldGen.genRand.NextBool(3)); + + // Typical coins + PutItemInChest(ref chest, ItemID.GoldCoin, 2, 4); + } // Default loot else {