diff --git a/Backgrounds/BasaltGullyBG.png b/Backgrounds/BasaltGullyBG.png new file mode 100644 index 0000000000..592d4b0dd6 Binary files /dev/null and b/Backgrounds/BasaltGullyBG.png differ diff --git a/Backgrounds/SunkenSeaBGStyle.cs b/Backgrounds/SunkenSeaBGStyle.cs index b3399fee89..75987a1497 100644 --- a/Backgrounds/SunkenSeaBGStyle.cs +++ b/Backgrounds/SunkenSeaBGStyle.cs @@ -10,6 +10,11 @@ namespace CalamityMod.Backgrounds private int SSBG2; private int SSBG3; + private int BGBG0; + private int BGBG1; + private int BGBG2; + private int BGBG3; + public override void SetStaticDefaults() { if (Main.dedServ) @@ -19,14 +24,35 @@ namespace CalamityMod.Backgrounds SSBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); SSBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); SSBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + + BGBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + BGBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BasaltGullyBG"); + BGBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + BGBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BasaltGullyBG"); } public override void FillTextureArray(int[] textureSlots) { - textureSlots[0] = SSBG0; - textureSlots[1] = SSBG1; - textureSlots[2] = SSBG2; - textureSlots[3] = SSBG3; + if (Main.LocalPlayer.InModBiome(ModContent.GetInstance()) || + Main.LocalPlayer.InModBiome(ModContent.GetInstance()) || + Main.LocalPlayer.InModBiome(ModContent.GetInstance()) || + Main.LocalPlayer.InModBiome()) + { + textureSlots[0] = SSBG0; + textureSlots[1] = SSBG1; + textureSlots[2] = SSBG2; + textureSlots[3] = SSBG3; + } + if (!Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && + !Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && + !Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && + !Main.LocalPlayer.InModBiome()) + { + textureSlots[0] = BGBG0; + textureSlots[1] = BGBG1; + textureSlots[2] = BGBG2; + textureSlots[3] = BGBG3; + } } } } diff --git a/Backgrounds/SunkenSeaBurrowsBG.cs b/Backgrounds/SunkenSeaBurrowsBG.cs index b4793bcd0c..c93f47a0ea 100644 --- a/Backgrounds/SunkenSeaBurrowsBG.cs +++ b/Backgrounds/SunkenSeaBurrowsBG.cs @@ -106,6 +106,25 @@ namespace CalamityMod.Backgrounds } } } + if (!Main.dedServ && (Main.LocalPlayer.InModBiome(ModContent.GetInstance()))) + { + int drawLimitX = Main.screenWidth / 16; + int drawLimitY = Main.screenHeight / 16; + Point drawPoint = (Main.screenPosition / 16).ToPoint(); + for (int i = 0; i < drawLimitX; i++) + { + for (int j = 0; j < drawLimitY; j++) + { + Point pos = drawPoint + new Point(i, j); + if (pos.Y >= Main.maxTilesY - 450) + { + if (!Main.tile[pos.X, pos.Y].HasTile && + Main.tile[pos.X, pos.Y].WallType == 0) + Lighting.AddLight(pos.X, pos.Y, TorchID.Red, 0.6f); + } + } + } + } } private void DrawToTarget(On_Main.orig_CheckMonoliths orig) diff --git a/BiomeManagers/BasaltGullyBiome.cs b/BiomeManagers/BasaltGullyBiome.cs index 1fe9fa066a..f5642e3647 100644 --- a/BiomeManagers/BasaltGullyBiome.cs +++ b/BiomeManagers/BasaltGullyBiome.cs @@ -25,8 +25,9 @@ namespace CalamityMod.BiomeManagers bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; + bool MoreThanUnderground = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.UndergroundTiles; - return BiomeTileCounterSystem.SunkenSeaBasaltTiles > 1000 && MoreThanShores && MoreThanReefs && MoreThanPolyp && MoreThanBurrows; + return BiomeTileCounterSystem.SunkenSeaBasaltTiles > 2500 && (MoreThanShores || MoreThanReefs || MoreThanPolyp || MoreThanBurrows); } } } diff --git a/BiomeManagers/GleamingBurrowsBiome.cs b/BiomeManagers/GleamingBurrowsBiome.cs index 94bd09ac08..bfcc61c206 100644 --- a/BiomeManagers/GleamingBurrowsBiome.cs +++ b/BiomeManagers/GleamingBurrowsBiome.cs @@ -24,7 +24,7 @@ namespace CalamityMod.BiomeManagers bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; - return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 1000 && MoreThanReefs && MoreThanPolyp; + return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 3000 && MoreThanReefs && MoreThanPolyp; } } } diff --git a/BiomeManagers/PolypForestBiome.cs b/BiomeManagers/PolypForestBiome.cs index b440b5d7a9..564264d40e 100644 --- a/BiomeManagers/PolypForestBiome.cs +++ b/BiomeManagers/PolypForestBiome.cs @@ -24,7 +24,7 @@ namespace CalamityMod.BiomeManagers bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaPolypTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaPolypTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; - return BiomeTileCounterSystem.SunkenSeaPolypTiles > 1000 && MoreThanReefs && MoreThanBurrows; + return BiomeTileCounterSystem.SunkenSeaPolypTiles > 200 && MoreThanReefs && MoreThanBurrows; } } } diff --git a/BiomeManagers/RadiantReefsBiome.cs b/BiomeManagers/RadiantReefsBiome.cs index 600ce769d2..c613bfbf67 100644 --- a/BiomeManagers/RadiantReefsBiome.cs +++ b/BiomeManagers/RadiantReefsBiome.cs @@ -24,8 +24,9 @@ namespace CalamityMod.BiomeManagers bool MoreThanShores = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaShoresTiles; bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; + bool MoreThanBasalt = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaBasaltTiles; - return ((BiomeTileCounterSystem.SunkenSeaReefsTiles > 500) || (BiomeTileCounterSystem.SunkenSeaBasaltTiles + BiomeTileCounterSystem.SunkenSeaReefsTiles > 500)) && MoreThanBurrows && MoreThanPolyp && MoreThanShores; + return ((BiomeTileCounterSystem.SunkenSeaReefsTiles > 2000) && MoreThanBasalt && MoreThanBurrows && MoreThanPolyp && MoreThanShores); } } } diff --git a/BiomeManagers/TimelessShoresBiome.cs b/BiomeManagers/TimelessShoresBiome.cs index 56a3399ffb..66e93668fd 100644 --- a/BiomeManagers/TimelessShoresBiome.cs +++ b/BiomeManagers/TimelessShoresBiome.cs @@ -23,8 +23,9 @@ namespace CalamityMod.BiomeManagers { bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; bool MoreThanBasalt = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.SunkenSeaBasaltTiles; + bool MoreThanUnderground = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.UndergroundTiles; - return BiomeTileCounterSystem.SunkenSeaShoresTiles > 1000 && MoreThanReefs && MoreThanBasalt; + return (BiomeTileCounterSystem.SunkenSeaShoresTiles > 1200) && MoreThanReefs && MoreThanBasalt && MoreThanUnderground; } } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index f0e1f11e59..420c711fa9 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1553,6 +1553,7 @@ namespace CalamityMod.CalPlayer public float ViridVanguardRotation = 0; public float ViridVanguardActiveCooldown = 0; public float ViridVanguardRotationToAdd = 0; + public bool InvertExaltationLineRotationDirections = false; public bool sageSpirit = false; public bool fleshBall = false; public bool eyeOfNight = false; diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 94675f436a..120b127d3e 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.Cooldowns; @@ -2565,7 +2565,8 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, 0f, ModContent.ProjectileType(), blazeDamage, 5f, Player.whoAmI, 0f, 1f); } // TODO -- Make Deific Amulet and Rampart of Deities' retaliation effects way cooler - // In the meantime, gave them homing astral bombers instead of the lame falling stars + // In the meantime, gave them homing astral stars instead of the lame falling stars. + // This also serves to make the Honeycomb in Sweetheart Necklace make sense if (dAmulet) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 7cbd973aba..a135ce2a79 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -246,15 +246,7 @@ namespace CalamityMod [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] - public bool Interlude1 { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool Interlude2 { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool Interlude3 { get; set; } + public bool Interludes { get; set; } [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index b40c85cbda..200d9ee9ec 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -215,6 +215,7 @@ namespace CalamityMod CooldownAddition, CooldownRemoval, SyncCooldownDictionary, + ExaltationDirection, // Syncs for specific bosses or entities SyncDestroyerLaserColor, diff --git a/DataStructures/GemTechArmorState.cs b/DataStructures/GemTechArmorState.cs index 9ec1260c35..d571a9cd05 100644 --- a/DataStructures/GemTechArmorState.cs +++ b/DataStructures/GemTechArmorState.cs @@ -314,6 +314,7 @@ namespace CalamityMod.DataStructures if (IsGreenGemActive) { + Owner.Calamity().ammoCost *= GemTechHeadgear.RangedAmmoReduction; Owner.GetCritChance() += (int)(GemTechHeadgear.RangedCritBoost * 100f); Owner.GetDamage() += GemTechHeadgear.RangedDamageBoost; } diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index f7428ad488..25c3d2c67a 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -189,6 +189,7 @@ namespace CalamityMod.ILEditing // Removal of vanilla stupidity IL_Player.StatusFromNPC += RemoveExpertBrainRandomDebuffs; + IL_NPC.VanillaHitEffect += PreventLavaSlimeLavaDrop; IL_NPC.StrikeNPC_HitInfo_bool_bool += LetDetonatingBubblesTakeDamage; IL_Player.ItemCheck_EmitUseVisuals += MakeMagmaStoneFireGauntletDustToggleable; IL_Projectile.EmitEnchantmentVisualsAt += MakeMagmaStoneFireGauntletProjectileDustToggleable; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 23a8521e64..c37d030846 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -33,6 +33,7 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Tiles; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; using CalamityMod.Waterfalls; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -1865,7 +1866,7 @@ namespace CalamityMod.ILEditing if (Style == 2) { // Check if it's an Abyss wall - if (t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType()) + if (t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType()) { // If an Abyss wall is detected, try to find another teleportation location bool canSpawn = false; @@ -1894,7 +1895,7 @@ namespace CalamityMod.ILEditing // Potion of Return triggers Jared if used in the Abyss if (Style == 8) { - if (t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType()) + if (t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType()) self.AddBuff(BuffID.ChaosState, 2); } } diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index d8b2adea5e..cc0f5ccb85 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -181,6 +181,25 @@ namespace CalamityMod.ILEditing } #endregion + #region Prevent Lava Slime Dropping Lava + private static void PreventLavaSlimeLavaDrop(ILContext il) + { + // Disable Lava Slimes dropping lava if its respective config is enabled. + var cursor = new ILCursor(il); + + // Go to the check for Remix world. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdsfld
("remixWorld"))) + { + LogFailure("Prevent Lava Slime Dropping Lava", "Could not find the check for Remix World."); + return; + } + + // Add an additional check for the config. + cursor.Remove(); + cursor.EmitDelegate>(() => CalamityServerConfig.Instance.RemoveLavaDropsFromLavaSlimes || Main.remixWorld); + } + #endregion + #region Disable Detonating Bubble StrikeNPC Hardcoded Override private static void LetDetonatingBubblesTakeDamage(ILContext il) { diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 623491d97d..8ac8d4bb91 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -1,9 +1,14 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -23,20 +28,61 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + #region Toggleable Panic Necklace + + bool panicNecklaceEnabled = true; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", panicNecklaceEnabled ? this.GetLocalizedValue("ToggleEffect") : ""); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + panicNecklaceEnabled = !panicNecklaceEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("panic", panicNecklaceEnabled); + } + + public override void LoadData(TagCompound tag) + { + panicNecklaceEnabled = tag.GetBool("panic"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(panicNecklaceEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + panicNecklaceEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, panicNecklaceEnabled); + } + #endregion + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); player.longInvince = true; modPlayer.dAmulet = true; + player.panic = panicNecklaceEnabled; } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.StarVeil). + AddIngredient(ItemID.SweetheartNecklace). AddIngredient(10). - AddIngredient(15). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.TinkerersWorkbench). Register(); } } diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index 0e565a1163..5199378c81 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -1,10 +1,15 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -19,14 +24,53 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; Item.rare = ModContent.RarityType(); } + #region Toggleable Mana Flower + bool manaFlowerEnabled = true; + public override void ModifyTooltips(List tooltips) + { + if (!manaFlowerEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip3"); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + manaFlowerEnabled = !manaFlowerEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("manaFlower", manaFlowerEnabled); + } + + public override void LoadData(TagCompound tag) + { + manaFlowerEnabled = tag.GetBool("manaFlower"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(manaFlowerEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + manaFlowerEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, manaFlowerEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.eTalisman = true; player.manaMagnet = true; - if (!hideVisual) + if (manaFlowerEnabled) player.manaFlower = true; player.statManaMax2 += 150; diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 091ecaaa0c..68bc76f46d 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -1,11 +1,17 @@ using System; +using System.Collections.Generic; +using System.IO; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -13,6 +19,7 @@ namespace CalamityMod.Items.Accessories public class RampartofDeities : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() { Item.width = 64; @@ -23,6 +30,45 @@ namespace CalamityMod.Items.Accessories Item.rare = ModContent.RarityType(); } + #region Toggleable Panic Necklace + + bool panicNecklaceEnabled = true; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", panicNecklaceEnabled ? this.GetLocalizedValue("ToggleEffect") : ""); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + panicNecklaceEnabled = !panicNecklaceEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("panic", panicNecklaceEnabled); + } + + public override void LoadData(TagCompound tag) + { + panicNecklaceEnabled = tag.GetBool("panic"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(panicNecklaceEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + panicNecklaceEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, panicNecklaceEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -31,6 +77,9 @@ namespace CalamityMod.Items.Accessories player.longInvince = true; modPlayer.dAmulet = true; + //Panic Necklace effect if enabled + player.panic = panicNecklaceEnabled; + // Large hit iframe effect taken from Seraph Tracers modPlayer.rampartOfDeities = true; diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index e42a2bbca1..b8f26b85fb 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -1,10 +1,14 @@ -using CalamityMod.CalPlayer.Dashes; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -25,6 +29,47 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Purple; Item.accessory = true; } + #region Toggleable Tiger Gear + + bool toggleEnabled = true; + + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", toggleEnabled ? this.GetLocalizedValue("ToggleEffect") : ""); + base.ModifyTooltips(tooltips); + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -35,7 +80,8 @@ namespace CalamityMod.Items.Accessories player.blackBelt = true; player.dashType = 0; player.Calamity().DashID = StatisNinjaBeltDash.ID; - player.spikedBoots = 2; + if (toggleEnabled) + player.spikedBoots = 2; player.accFlipper = true; player.Calamity().statisNinjaBelt = true; diff --git a/Items/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index 062c5d0a14..870570d09a 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; using CalamityMod.Rarities; @@ -11,6 +13,7 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -35,7 +38,47 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } + #region Toggleable Tiger Gear + bool toggleEnabled = true; + + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", toggleEnabled ? this.GetLocalizedValue("ToggleEffect") : ""); + base.ModifyTooltips(tooltips); + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -49,7 +92,8 @@ namespace CalamityMod.Items.Accessories player.blackBelt = true; modPlayer.DashID = StatisVoidSashDash.ID; player.dashType = 0; - player.spikedBoots = 2; + if (toggleEnabled) + player.spikedBoots = 2; player.accFlipper = true; player.Calamity().statisVoidSash = true; diff --git a/Items/Accessories/Wings/BaseWings.cs b/Items/Accessories/Wings/BaseWings.cs index f7417150bb..7a58793775 100644 --- a/Items/Accessories/Wings/BaseWings.cs +++ b/Items/Accessories/Wings/BaseWings.cs @@ -50,6 +50,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { + if (Item.wingSlot == -1) return; ascentWhenFalling = BonusAscentWhileFalling; ascentWhenRising = BonusAscentWhileRising; maxCanAscendMultiplier = RisingSpeedThreshold; @@ -67,7 +68,15 @@ namespace CalamityMod.Items.Accessories.Wings public override void ModifyTooltips(List list) { - WingStats stats = ArmorIDs.Wing.Sets.Stats[Item.wingSlot]; + if (Item.wingSlot == -1) return; + WingStats stats = new(); + if (Item.type == ModContent.ItemType()) + stats = ArmorIDs.Wing.Sets.Stats[TracersCelestial.wingSlot]; + else if (Item.type == ModContent.ItemType()) + stats = ArmorIDs.Wing.Sets.Stats[TracersElysian.wingSlot]; + else if (Item.type == ModContent.ItemType()) + stats = ArmorIDs.Wing.Sets.Stats[TracersSeraph.wingSlot]; + else stats = ArmorIDs.Wing.Sets.Stats[Item.wingSlot]; int time = stats.FlyTime; float run = stats.AccRunSpeedOverride; float rAcc = stats.AccRunAccelerationMult * 0.08f; diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index c52e62c867..05af56d6c3 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -1,10 +1,15 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -17,7 +22,12 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.5f; public override float BaseAscent => 0.125f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f); + public static int wingSlot = 0; + public override void SetStaticDefaults() + { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { @@ -27,10 +37,57 @@ namespace CalamityMod.Items.Accessories.Wings Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; } + #region Toggleable Wings + bool toggleEnabled + { + get { return Item.wingSlot != -1; } + set + { + if (value) + Item.wingSlot = wingSlot; + else + Item.wingSlot = -1; + } + } + public override void ModifyTooltips(List tooltips) + { + if (!toggleEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip0"); + base.ModifyTooltips(tooltips); + } + + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (toggleEnabled && player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { player.rocketDelay2--; if (player.rocketDelay2 <= 0) @@ -95,7 +152,6 @@ namespace CalamityMod.Items.Accessories.Wings // Mirrors the +5% luck from Lucky Horseshoe (vanilla behavior). player.Calamity().calamityBonusLuck += 0.05f; } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/MOAB.png b/Items/Accessories/Wings/MOAB.png index ecafba2594..742a5ede38 100644 Binary files a/Items/Accessories/Wings/MOAB.png and b/Items/Accessories/Wings/MOAB.png differ diff --git a/Items/Accessories/Wings/TracersCelestial.cs b/Items/Accessories/Wings/TracersCelestial.cs index eb1ea60ce8..f6403a0ff2 100644 --- a/Items/Accessories/Wings/TracersCelestial.cs +++ b/Items/Accessories/Wings/TracersCelestial.cs @@ -1,4 +1,7 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -7,6 +10,7 @@ using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -20,20 +24,70 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.5f; public override float BaseAscent => 0.125f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(160, 9f, 2.6f); + public static int wingSlot = 0; + + public override void SetStaticDefaults() { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(160, 9f, 2.6f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { base.SetDefaults(); Item.width = 36; - Item.height = 32; + Item.height = 40; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; } - + #region Toggleable Wings + bool toggleEnabled + { + get { return Item.wingSlot != -1; } + set + { + if (value) + Item.wingSlot = wingSlot; + else + Item.wingSlot = -1; + } + } + public override void ModifyTooltips(List tooltips) + { + if (!toggleEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip0"); + base.ModifyTooltips(tooltips); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual && toggleEnabled) { int dustXOffset = 4; if (player.direction == 1) @@ -57,7 +111,13 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; - modPlayer.tracersDust = !hideVisual; + player.noFallDmg = true; + if (!toggleEnabled) //Both these effects just boost flight time, but we don't want Tracers to boost it's own flight time when functioning as wings. All other Angel Tread effects are covered above. + { + player.rocketBoots = player.vanityRocketBoots = 4; + modPlayer.angelTreads = true; + } + modPlayer.tracersDust = !hideVisual && toggleEnabled; modPlayer.tracersCelestial = true; } @@ -73,18 +133,18 @@ namespace CalamityMod.Items.Accessories.Wings public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - CalamityUtils.DrawInventoryCustomScale( - spriteBatch, - texture: TextureAssets.Item[Type].Value, - position, - frame, - drawColor, - itemColor, - origin, - scale, - wantedScale: 0.9f, - drawOffset: new(1f, 0f) - ); + var tex = TextureAssets.Item[Type].Value; + frame = tex.Frame(2, 1, toggleEnabled ? 0 : 1); + spriteBatch.Draw(tex, position, frame, Color.White, 0, frame.Size() * 0.5f, Main.inventoryScale * 0.8f, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + + var tex = TextureAssets.Item[Type].Value; + var frame = tex.Frame(2, 1, toggleEnabled ? 0 : 1); + spriteBatch.Draw(tex, Item.Center - Main.screenPosition, frame, lightColor, rotation, frame.Size() * 0.5f, scale, SpriteEffects.None, 0); return false; } } diff --git a/Items/Accessories/Wings/TracersCelestial.png b/Items/Accessories/Wings/TracersCelestial.png index 11e351774f..ccb6df8508 100644 Binary files a/Items/Accessories/Wings/TracersCelestial.png and b/Items/Accessories/Wings/TracersCelestial.png differ diff --git a/Items/Accessories/Wings/TracersElysian.cs b/Items/Accessories/Wings/TracersElysian.cs index f203b59f54..0126398f52 100644 --- a/Items/Accessories/Wings/TracersElysian.cs +++ b/Items/Accessories/Wings/TracersElysian.cs @@ -1,4 +1,7 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -10,6 +13,7 @@ using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -23,7 +27,12 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.7f; public override float BaseAscent => 0.135f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(220, 10f, 2.7f); + public static int wingSlot = 0; + public override void SetStaticDefaults() + { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(220, 10f, 2.7f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { @@ -33,10 +42,55 @@ namespace CalamityMod.Items.Accessories.Wings Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } - + #region Toggleable Wings + bool toggleEnabled + { + get { return Item.wingSlot != -1; } + set + { + if (value) + Item.wingSlot = wingSlot; + else + Item.wingSlot = -1; + } + } + public override void ModifyTooltips(List tooltips) + { + if (!toggleEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip0"); + base.ModifyTooltips(tooltips); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual && toggleEnabled) { int dustXOffset = 4; if (player.direction == 1) @@ -60,7 +114,14 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; - modPlayer.tracersDust = !hideVisual; + player.noFallDmg = true; + player.socialShadowRocketBoots = true; + if (!toggleEnabled) //Both these effects just boost flight time, but we don't want Tracers to boost it's own flight time when functioning as wings. All other Angel Tread effects are covered above. + { + player.rocketBoots = player.vanityRocketBoots = 1; + modPlayer.angelTreads = true; + } + modPlayer.tracersDust = !hideVisual && toggleEnabled; modPlayer.tracersElysian = true; } @@ -74,22 +135,5 @@ namespace CalamityMod.Items.Accessories.Wings AddTile(). Register(); } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - CalamityUtils.DrawInventoryCustomScale( - spriteBatch, - texture: TextureAssets.Item[Type].Value, - position, - frame, - drawColor, - itemColor, - origin, - scale, - wantedScale: 0.9f, - drawOffset: new(1f, 0f) - ); - return false; - } } } diff --git a/Items/Accessories/Wings/TracersElysian.png b/Items/Accessories/Wings/TracersElysian.png index 4bb21bbcbf..86bc3b4e8e 100644 Binary files a/Items/Accessories/Wings/TracersElysian.png and b/Items/Accessories/Wings/TracersElysian.png differ diff --git a/Items/Accessories/Wings/TracersSeraph.cs b/Items/Accessories/Wings/TracersSeraph.cs index 1e27c261a9..a0c7d02e61 100644 --- a/Items/Accessories/Wings/TracersSeraph.cs +++ b/Items/Accessories/Wings/TracersSeraph.cs @@ -1,5 +1,9 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -10,6 +14,7 @@ using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -23,8 +28,13 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.9f; public override float BaseAscent => 0.145f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 11f, 2.8f); + public static int wingSlot = 0; + public override void SetStaticDefaults() + { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 11f, 2.8f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { base.SetDefaults(); @@ -33,10 +43,56 @@ namespace CalamityMod.Items.Accessories.Wings Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } + #region Toggleable Wings + bool toggleEnabled + { + get { return Item.wingSlot != -1; } + set + { + if (value) + Item.wingSlot = wingSlot; + else + Item.wingSlot = -1; + } + } + public override void ModifyTooltips(List tooltips) + { + if (!toggleEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip0"); + base.ModifyTooltips(tooltips); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual && toggleEnabled) { int dustXOffset = 4; if (player.direction == 1) @@ -60,7 +116,13 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; - modPlayer.tracersDust = !hideVisual; + player.noFallDmg = true; + if (!toggleEnabled) //Both these effects just boost flight time, but we don't want Tracers to boost it's own flight time when functioning as wings. All other Angel Tread effects are covered above. + { + player.rocketBoots = player.vanityRocketBoots = 2; + modPlayer.angelTreads = true; + } + modPlayer.tracersDust = !hideVisual && toggleEnabled; modPlayer.tracersSeraph = true; // Grants immunity to Auric Rejection and other walk-on-block effects } @@ -73,22 +135,5 @@ namespace CalamityMod.Items.Accessories.Wings AddTile(). Register(); } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - CalamityUtils.DrawInventoryCustomScale( - spriteBatch, - texture: TextureAssets.Item[Type].Value, - position, - frame, - drawColor, - itemColor, - origin, - scale, - wantedScale: 0.8f, - drawOffset: new(1f, 0f) - ); - return false; - } } } diff --git a/Items/Accessories/Wings/TracersSeraph.png b/Items/Accessories/Wings/TracersSeraph.png index 1608a8dc7c..3d36a37708 100644 Binary files a/Items/Accessories/Wings/TracersSeraph.png and b/Items/Accessories/Wings/TracersSeraph.png differ diff --git a/Items/Armor/Astral/AstralBreastplate.cs b/Items/Armor/Astral/AstralBreastplate.cs index 90efeb9ebf..84468763e7 100644 --- a/Items/Armor/Astral/AstralBreastplate.cs +++ b/Items/Armor/Astral/AstralBreastplate.cs @@ -12,8 +12,9 @@ namespace CalamityMod.Items.Armor.Astral public new string LocalizationCategory => "Items.Armor.Hardmode"; public static int MaxManaBoost = 80; + public static float AmmoReduction = 0.75f; public static float DamageBoost = 0.07f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, DamageBoost.ToPercent()); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, DamageBoost.ToPercent(), (1f - AmmoReduction).ToPercent()); public override void SetDefaults() { @@ -26,6 +27,8 @@ namespace CalamityMod.Items.Armor.Astral public override void UpdateEquip(Player player) { + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; player.statManaMax2 += MaxManaBoost; player.GetDamage() += DamageBoost; } diff --git a/Items/Armor/Auric/AuricTeslaCuisses.cs b/Items/Armor/Auric/AuricTeslaCuisses.cs index 8d7918c639..82d63d49bb 100644 --- a/Items/Armor/Auric/AuricTeslaCuisses.cs +++ b/Items/Armor/Auric/AuricTeslaCuisses.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.IO; using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Armor.Silva; @@ -6,10 +7,13 @@ using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Armor.Auric { @@ -31,13 +35,49 @@ namespace CalamityMod.Items.Armor.Auric Item.defense = 42; Item.rare = ModContent.RarityType(); } + #region Toggleable Magic Carpet + + bool toggleEnabled = true; + + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } +#endregion public override void UpdateEquip(Player player) { player.GetDamage() += DamageBoost; player.GetCritChance() += CritBoost; player.moveSpeed += MoveSpeedBoost; - player.carpet = true; + player.carpet = toggleEnabled; } public override void ModifyTooltips(List tooltips) @@ -51,6 +91,9 @@ namespace CalamityMod.Items.Armor.Auric { Main.LocalPlayer.armor[0].ModItem.ModifyTooltips(tooltips); } + + if (!toggleEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip2"); } public override void AddRecipes() diff --git a/Items/Armor/Auric/AuricTeslaHeadRanged.cs b/Items/Armor/Auric/AuricTeslaHeadRanged.cs index cd28653a58..fa54b263bd 100644 --- a/Items/Armor/Auric/AuricTeslaHeadRanged.cs +++ b/Items/Armor/Auric/AuricTeslaHeadRanged.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Items.Armor.Auric public static float RangedDamageBoost = 0.22f; public static int RangedCritBoost = 20; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost); + public static float AmmoReduction = 0.7f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); public override void SetDefaults() { @@ -57,6 +58,8 @@ namespace CalamityMod.Items.Armor.Auric public override void UpdateEquip(Player player) { + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; player.GetDamage() += RangedDamageBoost; player.GetCritChance() += RangedCritBoost; } diff --git a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs index f21e5bd410..52693da3f5 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs @@ -17,8 +17,9 @@ namespace CalamityMod.Items.Armor.Bloodflare public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/BloodflareRangerActivation"); public static float RangedDamageBoost = 0.1f; + public static float AmmoReduction = 0.75f; public static int RangedCritBoost = 10; // NOTE: Tooltip shares this number with damage % as they're equal - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent()); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), (1f - AmmoReduction).ToPercent()); // Set Bonus public static int SoulCooldown = CalamityUtils.SecondsToFrames(30); @@ -52,6 +53,8 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void UpdateEquip(Player player) { + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; player.GetDamage() += RangedDamageBoost; player.GetCritChance() += RangedCritBoost; } diff --git a/Items/Armor/Daedalus/DaedalusHeadRanged.cs b/Items/Armor/Daedalus/DaedalusHeadRanged.cs index 22eff4e7fb..5874e283de 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRanged.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRanged.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Armor.Daedalus public static float RangedDamageBoost = 0.13f; public static int RangedCritBoost = 7; - // NOTE: Ammo conservation is a bool so the number is manually added in the tooltip and equip - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost); + public static float AmmoReduction = 0.8f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); // Set Bonus public static int ShardDamage => CalamityUtils.ScaleWithDifficulty(30); @@ -47,9 +47,10 @@ namespace CalamityMod.Items.Armor.Daedalus public override void UpdateEquip(Player player) { + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; player.GetDamage() += RangedDamageBoost; player.GetCritChance() += RangedCritBoost; - player.ammoCost80 = true; } public override void AddRecipes() diff --git a/Items/Armor/Demonshade/DemonshadeBreastplate.cs b/Items/Armor/Demonshade/DemonshadeBreastplate.cs index 343b4d953b..f7ed18f5e7 100644 --- a/Items/Armor/Demonshade/DemonshadeBreastplate.cs +++ b/Items/Armor/Demonshade/DemonshadeBreastplate.cs @@ -16,10 +16,11 @@ namespace CalamityMod.Items.Armor.Demonshade public string FrontArmTexture => "CalamityMod/Items/Armor/Demonshade/DemonshadeBreastplate_Arms"; public static int MaxManaBoost = 200; + public static float AmmoReduction = 0.7f; public static float DamageBoost = 0.15f; public static int CritBoost = 15; // NOTE: Tooltip shares this number with damage % as they're equal public static float MeleeSpeedBoost = 0.25f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, DamageBoost.ToPercent(), MeleeSpeedBoost.ToPercent()); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, DamageBoost.ToPercent(), MeleeSpeedBoost.ToPercent(), (1f - AmmoReduction).ToPercent()); public override void SetDefaults() { @@ -35,6 +36,7 @@ namespace CalamityMod.Items.Armor.Demonshade { var modPlayer = player.Calamity(); modPlayer.shadeRegen = true; + modPlayer.ammoCost *= AmmoReduction; player.statManaMax2 += MaxManaBoost; player.GetDamage() += DamageBoost; player.GetCritChance() += CritBoost; diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index a8733ae713..0d1f29c072 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Armor.GemTech public const float MeleeSpeedBoost = 0.26f; public const int MaxFlechettes = 8; + public static float RangedAmmoReduction = 0.7f; public const float RangedDamageBoost = 0.5f; public const float RangedCritBoost = 0.16f; diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs index 8e88861af9..2ebf7198d3 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Items.Armor.GodSlayer public static float RangedDamageBoost = 0.1f; public static int RangedCritBoost = 12; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost); + public static float AmmoReduction = 0.7f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); // Set Bonus public static int ShrapnelRoundCooldown = CalamityUtils.SecondsToFrames(2.5f); @@ -54,6 +55,8 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void UpdateEquip(Player player) { + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; player.GetDamage() += RangedDamageBoost; player.GetCritChance() += RangedCritBoost; } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs index 728599f3c6..929c234733 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Armor.Hydrothermic public static float RangedDamageBoost = 0.12f; public static int RangedCritBoost = 10; - // NOTE: Ammo conservation is a bool so the number is manually added in the tooltip and equip - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost); + public static float AmmoReduction = 0.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); // Set Bonus public static int FlareCooldown = CalamityUtils.SecondsToFrames(0.33f); @@ -49,9 +49,10 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateEquip(Player player) { + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; player.GetDamage() += RangedDamageBoost; player.GetCritChance() += RangedCritBoost; - player.ammoCost75 = true; } public override void AddRecipes() diff --git a/Items/Armor/LunicCorps/LunicCorpsVest.cs b/Items/Armor/LunicCorps/LunicCorpsVest.cs index 8ec6dfab11..5ddd112b9f 100644 --- a/Items/Armor/LunicCorps/LunicCorpsVest.cs +++ b/Items/Armor/LunicCorps/LunicCorpsVest.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.Armor.LunicCorps public static float RangedDamageBoost = 0.15f; public static int RangedCritBoost = 15; // NOTE: Tooltip shares this number with damage % as they're equal - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent()); + public static float AmmoReduction = 0.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), (1f - AmmoReduction).ToPercent()); public override void SetDefaults() { @@ -28,6 +29,8 @@ namespace CalamityMod.Items.Armor.LunicCorps public override void UpdateEquip(Player player) { + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; player.GetDamage() += RangedDamageBoost; player.GetCritChance() += RangedCritBoost; } diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index 1cc46af3a9..c64855988e 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -14,9 +14,10 @@ namespace CalamityMod.Items.Armor.OmegaBlue { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + public static float AmmoReduction = 0.75f; public static float DamageBoost = 0.18f; public static int CritBoost = 12; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost, (1f - AmmoReduction).ToPercent()); public override void SetStaticDefaults() { @@ -43,6 +44,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue var modPlayer = player.Calamity(); player.GetDamage() += DamageBoost; player.GetCritChance() += CritBoost; + modPlayer.ammoCost *= AmmoReduction; modPlayer.omegaBlueChestplate = true; modPlayer.noLifeRegen = true; } diff --git a/Items/Armor/PlagueReaper/PlagueReaperMask.cs b/Items/Armor/PlagueReaper/PlagueReaperMask.cs index 22a247b1e7..d0567771bb 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperMask.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperMask.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Armor.PlagueReaper public static float RangedDamageBoost = 0.1f; public static int RangedCritBoost = 8; - // NOTE: Ammo conservation is a bool so the number is manually added in the tooltip and equip - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost); + public static float AmmoReduction = 0.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); // Set Bonus public static float SetBonusFlightTimeBoost = 0.05f; @@ -63,9 +63,10 @@ namespace CalamityMod.Items.Armor.PlagueReaper public override void UpdateEquip(Player player) { + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; player.GetDamage() += RangedDamageBoost; player.GetCritChance() += RangedCritBoost; - player.ammoCost75 = true; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadRanged.cs b/Items/Armor/Tarragon/TarragonHeadRanged.cs index 0fee5f6616..1245b69731 100644 --- a/Items/Armor/Tarragon/TarragonHeadRanged.cs +++ b/Items/Armor/Tarragon/TarragonHeadRanged.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Items.Armor.Tarragon public static float RangedDamageBoost = 0.1f; public static int RangedCritBoost = 7; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost); + public static float AmmoReduction = 0.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); // Set Bonus public static int OnHitEffectCooldown = CalamityUtils.SecondsToFrames(1); @@ -52,6 +53,8 @@ namespace CalamityMod.Items.Armor.Tarragon public override void UpdateEquip(Player player) { + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; player.GetDamage() += RangedDamageBoost; player.GetCritChance() += RangedCritBoost; } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 583ab42e22..655834a6a5 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -240,6 +240,10 @@ namespace CalamityMod.Items if (item.accessory) CannotBeEnchanted = true; + // Music boxes are pre-boss and sold from the Merchant, so they should now use the blue rarity. + if (item.type == ItemID.MusicBox || item.createTile == TileID.MusicBoxes || ItemID.Sets.ShimmerTransformToItem[item.type] == ItemID.MusicBox) + item.rare = ItemRarityID.Blue; + // Modified Pearlwood items are now Light Red. if (item.type == ItemID.PearlwoodBow || item.type == ItemID.PearlwoodHammer || item.type == ItemID.PearlwoodSword) item.rare = ItemRarityID.LightRed; diff --git a/Items/Materials/SeaRemains.cs b/Items/Materials/SeaRemains.cs index ff70b1ad9f..9fda545da4 100644 --- a/Items/Materials/SeaRemains.cs +++ b/Items/Materials/SeaRemains.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,16 +20,15 @@ namespace CalamityMod.Items.Materials Item.width = 30; Item.height = 24; Item.maxStack = Item.CommonMaxStack; - Item.value = Item.sellPrice(silver: 36); + Item.value = Item.sellPrice(silver: 6); Item.rare = ItemRarityID.Green; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(2). - AddIngredient(ItemID.Coral, 2). - AddIngredient(ItemID.Starfish, 2). - AddIngredient(ItemID.Seashell, 2). + AddIngredient(1). + //AddIngredient(2). + AddIngredient(3). AddTile(TileID.Furnaces). Register(); } diff --git a/Items/Materials/WillOWisp.cs b/Items/Materials/WillOWisp.cs new file mode 100644 index 0000000000..0ac1f354dc --- /dev/null +++ b/Items/Materials/WillOWisp.cs @@ -0,0 +1,87 @@ +using System; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Wulfrum; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Items.Materials +{ + public class WillOWisp : ModItem, ILocalizedModType + { + public int textureVariant = 0; + + public static Asset altTexture = null; + public new string LocalizationCategory => "Items.Materials"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 25; + ItemID.Sets.SortingPriorityMaterials[Type] = 60; // Meteorite + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 26; + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 1); + Item.rare = ItemRarityID.Green; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Material; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + var tex = textureVariant == 0 ? TextureAssets.Item[Type] : CalamityUtils.GetTextureEfficient(ref altTexture, "CalamityMod/Items/Materials/WillOWisp2"); + float rotationAmount = 0.25f; + float rotationSpeedMult = 0.033f; + spriteBatch.Draw(tex.Value, Item.Center - Main.screenPosition, null, lightColor, rotation + (rotationAmount * (float)Math.Sin(Item.whoAmI + Main.timeForVisualEffects * rotationSpeedMult)), tex.Size() / 2, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (textureVariant == 0) + return true; + else + { + var tex = CalamityUtils.GetTextureEfficient(ref altTexture, "CalamityMod/Items/Materials/WillOWisp2"); + spriteBatch.Draw(tex.Value, position, null, drawColor, 0, tex.Size() / 2, scale, SpriteEffects.None, 0); + return false; + } + } + public override void OnSpawn(IEntitySource source) + { + textureVariant = Main.rand.NextBool().ToInt(); + } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + + if (Collision.SolidCollision(Item.position, Item.width, Item.height + CalamityUtils.TilesToPixels(3), true)) + gravity *= 0.2f; + maxFallSpeed *= 0.1f; + if (Collision.SolidCollision(Item.position, Item.width, Item.height + CalamityUtils.TilesToPixels(2), true)) + gravity *= -1; + Item.velocity.X /= 0.95f; + Item.velocity.X *= 0.975f; + if (Main.rand.NextBool(10)) + { + var d = Dust.NewDustDirect(Item.position, Item.width, Item.height, DustID.Obsidian, newColor: Color.Red, Scale: 0.9f); + d.velocity *= 1f; + d.noGravity = true; + } + } + } +} diff --git a/Items/Materials/WillOWisp.png b/Items/Materials/WillOWisp.png new file mode 100644 index 0000000000..1c20a1c44b Binary files /dev/null and b/Items/Materials/WillOWisp.png differ diff --git a/Items/Materials/WillOWisp2.png b/Items/Materials/WillOWisp2.png new file mode 100644 index 0000000000..678e703357 Binary files /dev/null and b/Items/Materials/WillOWisp2.png differ diff --git a/Items/Placeables/Abyss/SulphurousSand.cs b/Items/Placeables/Abyss/SulphurousSand.cs index e2b44467ba..59087ec75f 100644 --- a/Items/Placeables/Abyss/SulphurousSand.cs +++ b/Items/Placeables/Abyss/SulphurousSand.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Items.Placeables.Abyss Item.ResearchUnlockCount = 100; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - // +5 flat damage, equal to other sand variants - ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 0); } public override void SetDefaults() diff --git a/Items/Placeables/Astral/AstralSand.cs b/Items/Placeables/Astral/AstralSand.cs index 1ddc465fb5..a7e732363b 100644 --- a/Items/Placeables/Astral/AstralSand.cs +++ b/Items/Placeables/Astral/AstralSand.cs @@ -13,8 +13,7 @@ namespace CalamityMod.Items.Placeables.Astral Item.ResearchUnlockCount = 100; ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.SandBlock, 1); - // +5 flat damage, equal to other sand variants - ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 0); } public override void SetDefaults() diff --git a/Items/Placeables/SunkenSea/Dunesand.cs b/Items/Placeables/SunkenSea/Dunesand.cs index af03dbc96c..495107affc 100644 --- a/Items/Placeables/SunkenSea/Dunesand.cs +++ b/Items/Placeables/SunkenSea/Dunesand.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.SunkenSea @@ -11,8 +12,16 @@ namespace CalamityMod.Items.Placeables.SunkenSea { Item.ResearchUnlockCount = 100; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + //+5 flat damage + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.ammo = AmmoID.Sand; + Item.notAmmo = true; + } } } diff --git a/Items/Placeables/SunkenSea/EutrophicSand.cs b/Items/Placeables/SunkenSea/EutrophicSand.cs index 903c1b2618..a198e8970c 100644 --- a/Items/Placeables/SunkenSea/EutrophicSand.cs +++ b/Items/Placeables/SunkenSea/EutrophicSand.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Placeables.SunkenSea Item.ResearchUnlockCount = 100; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - // +5 flat damage, equal to other sand variants - ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); + // -5 flat damage + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(),-5); } public override void SetDefaults() @@ -24,14 +24,5 @@ namespace CalamityMod.Items.Placeables.SunkenSea Item.ammo = AmmoID.Sand; Item.notAmmo = true; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(4). - AddTile(TileID.WorkBenches). - DisableDecraft(). - Register(); - } } } diff --git a/Items/Placeables/SunkenSea/Navystone.cs b/Items/Placeables/SunkenSea/Navystone.cs index c38fb7d2e3..42b3e5b407 100644 --- a/Items/Placeables/SunkenSea/Navystone.cs +++ b/Items/Placeables/SunkenSea/Navystone.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). + AddIngredient(4). AddTile(TileID.WorkBenches). DisableDecraft(). Register(); diff --git a/Items/Placeables/SunkenSea/PolypSand.cs b/Items/Placeables/SunkenSea/PolypSand.cs index 50c699626f..cc20b3828f 100644 --- a/Items/Placeables/SunkenSea/PolypSand.cs +++ b/Items/Placeables/SunkenSea/PolypSand.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.SunkenSea @@ -9,8 +10,15 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 0); } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.ammo = AmmoID.Sand; + Item.notAmmo = true; + } } } diff --git a/Items/Placeables/SunkenSea/TableCoralLeft.cs b/Items/Placeables/SunkenSea/TableCoralLeft.cs deleted file mode 100644 index 2d75ce2b27..0000000000 --- a/Items/Placeables/SunkenSea/TableCoralLeft.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.SunkenSea -{ - public class TableCoralLeft : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 100; - } - - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); - } -} diff --git a/Items/Placeables/SunkenSea/TableCoralLeft.png b/Items/Placeables/SunkenSea/TableCoralLeft.png deleted file mode 100644 index db7fa149c0..0000000000 Binary files a/Items/Placeables/SunkenSea/TableCoralLeft.png and /dev/null differ diff --git a/Items/Placeables/SunkenSea/VolcanicSand.cs b/Items/Placeables/SunkenSea/VolcanicSand.cs index 277f746966..c7003f7cb6 100644 --- a/Items/Placeables/SunkenSea/VolcanicSand.cs +++ b/Items/Placeables/SunkenSea/VolcanicSand.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.SunkenSea @@ -9,8 +10,14 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 0); } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.ammo = AmmoID.Sand; + Item.notAmmo = true; + } } } diff --git a/Items/Placeables/Walls/AbyssGravelWallItem.cs b/Items/Placeables/Walls/AbyssGravelWallItem.cs index 943045e744..ab1cb9705c 100644 --- a/Items/Placeables/Walls/AbyssGravelWallItem.cs +++ b/Items/Placeables/Walls/AbyssGravelWallItem.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralDirtWall.cs b/Items/Placeables/Walls/AstralDirtWall.cs index 92f04ca230..70ec1c3246 100644 --- a/Items/Placeables/Walls/AstralDirtWall.cs +++ b/Items/Placeables/Walls/AstralDirtWall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralGrassWall.cs b/Items/Placeables/Walls/AstralGrassWall.cs index 4b733618b7..abb874af44 100644 --- a/Items/Placeables/Walls/AstralGrassWall.cs +++ b/Items/Placeables/Walls/AstralGrassWall.cs @@ -12,6 +12,6 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); } } diff --git a/Items/Placeables/Walls/AstralIceWall.cs b/Items/Placeables/Walls/AstralIceWall.cs index c97435081c..10f38bc8d5 100644 --- a/Items/Placeables/Walls/AstralIceWall.cs +++ b/Items/Placeables/Walls/AstralIceWall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralSandstoneWall.cs b/Items/Placeables/Walls/AstralSandstoneWall.cs index aba828d058..43a2277c27 100644 --- a/Items/Placeables/Walls/AstralSandstoneWall.cs +++ b/Items/Placeables/Walls/AstralSandstoneWall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralSnowWall.cs b/Items/Placeables/Walls/AstralSnowWall.cs index ad137271ff..8771a360bf 100644 --- a/Items/Placeables/Walls/AstralSnowWall.cs +++ b/Items/Placeables/Walls/AstralSnowWall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralStoneWall.cs b/Items/Placeables/Walls/AstralStoneWall.cs index 25f2ec002e..07b8f957dd 100644 --- a/Items/Placeables/Walls/AstralStoneWall.cs +++ b/Items/Placeables/Walls/AstralStoneWall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/EutrophicSandWall.png b/Items/Placeables/Walls/EutrophicSandWall.png deleted file mode 100644 index 04e425d8b5..0000000000 Binary files a/Items/Placeables/Walls/EutrophicSandWall.png and /dev/null differ diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.cs b/Items/Placeables/Walls/EutrophicSandWallSafe.cs deleted file mode 100644 index d1558ba3c6..0000000000 --- a/Items/Placeables/Walls/EutrophicSandWallSafe.cs +++ /dev/null @@ -1,27 +0,0 @@ -using CalamityMod.Items.Placeables.SunkenSea; -using Terraria.ID; -using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls; - -namespace CalamityMod.Items.Placeables.Walls -{ - public class EutrophicSandWallSafe : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 400; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - } - - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); - - public override void AddRecipes() - { - CreateRecipe(4). - AddIngredient(). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.png b/Items/Placeables/Walls/EutrophicSandWallSafe.png deleted file mode 100644 index 04e425d8b5..0000000000 Binary files a/Items/Placeables/Walls/EutrophicSandWallSafe.png and /dev/null differ diff --git a/Items/Placeables/Walls/HardenedAstralSandWall.cs b/Items/Placeables/Walls/HardenedAstralSandWall.cs index 23e5cebc10..5740900953 100644 --- a/Items/Placeables/Walls/HardenedAstralSandWall.cs +++ b/Items/Placeables/Walls/HardenedAstralSandWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/NavystoneWall.cs b/Items/Placeables/Walls/NavystoneWall.cs index 86d37219d1..b486ddeba7 100644 --- a/Items/Placeables/Walls/NavystoneWall.cs +++ b/Items/Placeables/Walls/NavystoneWall.cs @@ -1,18 +1,28 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; namespace CalamityMod.Items.Placeables.Walls { + [LegacyName("NavystoneWallSafe")] public class NavystoneWall : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 400; - ItemID.Sets.DrawUnsafeIndicator[Type] = true; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } } } diff --git a/Items/Placeables/Walls/NavystoneWallSafe.cs b/Items/Placeables/Walls/NavystoneWallSafe.cs deleted file mode 100644 index 7dd6ce6ca0..0000000000 --- a/Items/Placeables/Walls/NavystoneWallSafe.cs +++ /dev/null @@ -1,26 +0,0 @@ -using CalamityMod.Items.Placeables.SunkenSea; -using Terraria.ID; -using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls; -namespace CalamityMod.Items.Placeables.Walls -{ - public class NavystoneWallSafe : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 400; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - } - - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); - - public override void AddRecipes() - { - CreateRecipe(4). - AddIngredient(). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Placeables/Walls/SulphurousSandWall.cs b/Items/Placeables/Walls/SulphurousSandWall.cs index a975584667..526057ed0c 100644 --- a/Items/Placeables/Walls/SulphurousSandWall.cs +++ b/Items/Placeables/Walls/SulphurousSandWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SulphurousSandstoneWall.cs b/Items/Placeables/Walls/SulphurousSandstoneWall.cs index 994455af66..fdcf4a4b3a 100644 --- a/Items/Placeables/Walls/SulphurousSandstoneWall.cs +++ b/Items/Placeables/Walls/SulphurousSandstoneWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SulphurousShaleWall.cs b/Items/Placeables/Walls/SulphurousShaleWall.cs index 2801be9e26..d245987b63 100644 --- a/Items/Placeables/Walls/SulphurousShaleWall.cs +++ b/Items/Placeables/Walls/SulphurousShaleWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/EutrophicSandWall.cs b/Items/Placeables/Walls/UnsafeNavystoneWall.cs similarity index 63% rename from Items/Placeables/Walls/EutrophicSandWall.cs rename to Items/Placeables/Walls/UnsafeNavystoneWall.cs index f7e9ef7d62..484b95edda 100644 --- a/Items/Placeables/Walls/EutrophicSandWall.cs +++ b/Items/Placeables/Walls/UnsafeNavystoneWall.cs @@ -1,19 +1,19 @@ using Terraria.ID; using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls; - +using WallTiles = CalamityMod.Walls.UnsafeWalls; +using CalamityMod.Items.Placeables.Walls; namespace CalamityMod.Items.Placeables.Walls { - public class EutrophicSandWall : ModItem, ILocalizedModType + public class UnsafeNavystoneWall : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 400; ItemID.Sets.DrawUnsafeIndicator[Type] = true; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); } } diff --git a/Items/Placeables/Walls/NavystoneWallSafe.png b/Items/Placeables/Walls/UnsafeNavystoneWall.png similarity index 100% rename from Items/Placeables/Walls/NavystoneWallSafe.png rename to Items/Placeables/Walls/UnsafeNavystoneWall.png diff --git a/Items/Weapons/DraedonsArsenal/Auger.cs b/Items/Weapons/DraedonsArsenal/Auger.cs index cac2c11b2f..6f20e1189a 100644 --- a/Items/Weapons/DraedonsArsenal/Auger.cs +++ b/Items/Weapons/DraedonsArsenal/Auger.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; @@ -64,6 +66,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal AddIngredient(7). AddIngredient(4). AddIngredient(7). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(1, out Func condition), condition). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index 08eb0c16d4..931763931f 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -47,6 +47,13 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) < 67) + return true; + return false; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/BlossomFlux.cs b/Items/Weapons/Ranged/BlossomFlux.cs index fb099727e2..68d69d3396 100644 --- a/Items/Weapons/Ranged/BlossomFlux.cs +++ b/Items/Weapons/Ranged/BlossomFlux.cs @@ -71,5 +71,12 @@ namespace CalamityMod.Items.Weapons.Ranged } return false; } + + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) < 50) + return true; + return false; + } } } diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.cs b/Items/Weapons/Ranged/BulletFilledShotgun.cs index 428aac80cd..35ca568391 100644 --- a/Items/Weapons/Ranged/BulletFilledShotgun.cs +++ b/Items/Weapons/Ranged/BulletFilledShotgun.cs @@ -46,6 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { type = Item.shoot; + position += player.itemRotation.ToRotationVector2() * player.direction * 48f; int bulletAmt = 40; for (int i = 0; i < bulletAmt; i++) { diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index cf5737a4f1..8fa44cc137 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -67,12 +67,14 @@ namespace CalamityMod.Items.Weapons.Ranged } return false; } + public override bool CanConsumeAmmo(Item ammo, Player player) { - if (Main.rand.Next(0, 100) > 80 && SineCounter % 4 == 0) + if (Main.rand.Next(0, 100) < 20 && SineCounter % 4 == 0) return true; return false; } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 485b234366..447a6bf36e 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -1,10 +1,12 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; +using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -59,7 +61,20 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - public override bool AltFunctionUse(Player player) => player.ownedProjectileCounts[Item.shoot] > 0; + public override bool CanRightClick() + { + if (!Main.keyState.PressingShift()) + return false; + return true; + } + public override void RightClick(Player player) + { + Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; + if (Main.netMode != NetmodeID.SinglePlayer) + ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + } + + public override bool ConsumeItem(Player player) => false; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -103,6 +118,24 @@ namespace CalamityMod.Items.Weapons.Summon } return false; } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + var tex = TextureAssets.Item[Type].Value; + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + tex, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.75f, + spriteEffects: Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + rotation: Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections ? MathHelper.PiOver2 : 0 + ); + return false; + } public override void AddRecipes() { diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 2c7217deb6..d66862a277 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -1,11 +1,14 @@ -using CalamityMod.Buffs.Summon; +using System.IO; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; +using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon @@ -46,8 +49,6 @@ namespace CalamityMod.Items.Weapons.Summon public static float SwordDmgMult => 1f; #endregion - - private static Texture2D BladeOutline = null; public static Texture2D GetBladeOutlineTex() { @@ -92,6 +93,39 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.rare = ModContent.RarityType(); } + + public override bool CanRightClick() + { + if (!Main.keyState.PressingShift()) + return false; + return true; + } + public override void RightClick(Player player) + { + Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; + if (Main.netMode != NetmodeID.SinglePlayer) + ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + } + + public override bool ConsumeItem(Player player) => false; + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + var tex = TextureAssets.Item[Type].Value; + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + tex, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.9f, + spriteEffects: Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections ? SpriteEffects.FlipHorizontally : SpriteEffects.None + ); + return false; + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float totalSlots = 0f; @@ -143,4 +177,5 @@ namespace CalamityMod.Items.Weapons.Summon Register(); } } + } diff --git a/Localization/en-US/Mods.CalamityMod.Common.hjson b/Localization/en-US/Mods.CalamityMod.Common.hjson index de36dce08e..4956034623 100644 --- a/Localization/en-US/Mods.CalamityMod.Common.hjson +++ b/Localization/en-US/Mods.CalamityMod.Common.hjson @@ -12,6 +12,7 @@ DoubleTapDown: Double tap {0} // Miscellaneous stats/info AggroBoost: Enemies are more likely to target you AggroReduction: Enemies are less likely to target you +AmmoUseReduction: "{0}% chance to save ammo" KnockbackImmunity: Grants immunity to knockback AbyssLightLevel1: Provides a small amount of light in the abyss AbyssLightLevel2: Provides a moderate amount of light in the abyss diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index 67581d30a2..0b4b021b61 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -171,19 +171,15 @@ CalamityClientConfig: { ''' } - Interlude1: { - Label: "[i:CalamityModMusic/Interlude1MusicBox] Interlude 1" - Tooltip: Plays Calamity Mod OST - "Silence before the storms", after Calamitas Clone has been defeated. - } - - Interlude2: { - Label: "[i:CalamityModMusic/Interlude2MusicBox] Interlude 2" - Tooltip: Plays Calamity Mod OST - "Storms before the catastrophes", after the Moon Lord has been defeated. - } - - Interlude3: { - Label: "[i:CalamityModMusic/Interlude3MusicBox] Interlude 3" - Tooltip: Plays Calamity Mod OST - "Catastrophes before the calamity", after Yharon has been defeated. + Interludes: { + Label: "[i:CalamityModMusic/Interlude1MusicBox] Interludes" + Tooltip: + ''' + Enables the playing of three interlude tracks in-game: + Plays Calamity Mod OST - "Silence before the storms", after Calamitas Clone has been defeated. + Plays Calamity Mod OST - "Storms before the catastrophes", after the Moon Lord has been defeated. + Plays Calamity Mod OST - "Catastrophes before the calamity", after Yharon has been defeated. + ''' } MeterPosLock: { @@ -528,7 +524,7 @@ CalamityServerConfig: { RemoveLavaDropsFromLavaSlimes: { Label: "[i:LavaWaders] Remove Lava Drops From Lava Slimes" - Tooltip: When enabled, Lava Slimes will be replaced with a new Lava Slime that no longer drops lava. + Tooltip: When enabled, Lava Slimes will be prevented from dropping lava in Expert Mode. } RemoveReforgeRNG: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 574e9cfe10..b4429b069f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -53,6 +53,7 @@ MOAB: { {$CommonItemTooltip.FlightAndSlowfall} 32% increased jump speed and allows auto-jump Grants the player cloud, blizzard, and sandstorm mid-air jumps + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:Jetpack] [c/aaaaaa:jetpack] 'The Mother Of All Balloons' ''' } @@ -103,9 +104,10 @@ TracersCelestial: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - 24% increased running acceleration and greater mobility on ice - Provides the ability to walk on water, honey, and lava - Grants immunity to fire and lava + 24% increased running acceleration + Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads + Provides immunity to lava + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:AngelWings] [c/aaaaaa:wings] 'Ludicrous speed!' ''' } @@ -115,9 +117,10 @@ TracersElysian: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - 36% increased running acceleration and greater mobility on ice - Provides the ability to walk on water, honey, and lava - Grants immunity to fire and lava + 36% increased running acceleration + Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads + Provides immunity to lava + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:AngelWings] [c/aaaaaa:wings] 'Ludicrous speed!' ''' } @@ -127,9 +130,10 @@ TracersSeraph: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - 50% increased running acceleration and greater mobility on ice - Provides the ability to walk on water, honey, and lava - Grants immunity to fire, lava, and harmful block effects + 50% increased running acceleration + Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads + Provides immunity to lava and damaging tiles, including [i:CalamityMod/AuricOre] Auric Ore + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:AngelWings] [c/aaaaaa:wings] 'Taking speed EVEN FURTHER BEYOND!' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 0d606a5fae..2e82e9d3e5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -573,10 +573,13 @@ DeificAmulet: { DisplayName: Deific Amulet Tooltip: ''' - Causes stars to fall and increases length of invincibility after taking damage - Grants bonus invincibility frames based on your missing health + Releases a burst of homing stars [TOGGLE]after taking damage + Increases the length of invincibility from various sources + Grants bonus invincibility frames when hurt, based on your missing health This effect scales from 10 frames at full HP to 40 frames at 25% or less HP + [c/aaaaaa:Shift- this item in your inventory to toggle] [i:PanicNecklace] [c/aaaaaa:Panic Necklace's effect] ''' + ToggleEffect: "and increases movement speed " } DepthCharm: { @@ -751,7 +754,8 @@ EtherealTalisman: { 15% increased magic damage, 5% increased magic critical strike chance +150 max mana and 10% decreased mana usage Increases pickup range for mana stars - You automatically use mana potions when needed if visibility is on + You automatically use mana potions when needed + [c/aaaaaa:Shift- in your inventory to toggle] [i:ManaFlower] [c/aaaaaa:Mana Flower's effect] ''' } @@ -1433,14 +1437,17 @@ RampartofDeities: { DisplayName: Rampart of Deities Tooltip: ''' - Causes stars to fall and increases length of invincibility after taking damage - Grants bonus invincibility frames based on your missing health + Releases a burst of homing stars [TOGGLE]after taking damage + Increases the length of invincibility from various sources + Grants bonus invincibility frames when struck, based on your missing health This effect scales from 10 frames at full HP to 40 frames at 25% or less HP Being struck for over 200 damage grants 30 additional invincibility frames Grants immunity to knockback Puts a shell around the owner when below 50% life that reduces damage by 25% Absorbs 25% of damage done to players on your team when above 25% life + [c/aaaaaa:Shift- this item in your inventory to toggle] [i:PanicNecklace] [c/aaaaaa:Panic Necklace's effect] ''' + ToggleEffect: "and increases movement speed " } RareElementalinaBottle: { @@ -1732,8 +1739,10 @@ StatisNinjaBelt: { Provides a high-speed dash 10% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage Increases movement acceleration and deceleration by 1.6x - Grants the ability to swim, climb walls, and dodge attacks + Grants the ability to swim[TOGGLE] and dodge attacks + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:ClimbingClaws] [c/aaaaaa:Climbing Claws] ''' + ToggleEffect: ", climb walls," HoldShiftTooltip: "{$Common.DodgeInformation}" } @@ -1744,9 +1753,11 @@ StatisVoidSash: { Provides a high-speed dash 20% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage Increases movement acceleration and deceleration by 1.85x - Grants the ability to swim, climb walls, and dodge attacks + Grants the ability to swim[TOGGLE] and dodge attacks Visual effects are reduced if visibility is disabled + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:ClimbingClaws] [c/aaaaaa:Climbing Claws] ''' + ToggleEffect: ", climb walls," HoldShiftTooltip: "{$Common.DodgeInformation}" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index b2b3e048b1..6f12eb6c9d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -4,6 +4,7 @@ AstralBreastplate: { ''' {$CommonItemTooltip.IncreasesMaxManaBy} {$CommonItemTooltip.PercentIncreasedDamage@1} + {$Common.AmmoUseReduction@2} ''' } @@ -95,7 +96,7 @@ DaedalusHeadRanged: { Tooltip: ''' {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} - 20% chance to save ammo + {$Common.AmmoUseReduction@2} ''' SetBonus: Getting hit causes you to emit a blast of crystal shards } @@ -238,7 +239,7 @@ HydrothermicHeadRanged: { Tooltip: ''' {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} - 25% chance to save ammo + {$Common.AmmoUseReduction@2} ''' SetBonus: ''' @@ -317,7 +318,11 @@ LunicCorpsHelmet: { LunicCorpsVest: { DisplayName: Lunic Corps Vest - Tooltip: "{$CommonItemTooltip.PercentIncreasedRangedDamageCritChance}" + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedRangedDamageCritChance} + {$Common.AmmoUseReduction@1} + ''' } MolluskShelleggings: { @@ -393,7 +398,7 @@ PlagueReaperMask: { Tooltip: ''' {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} - 25% chance to save ammo + {$Common.AmmoUseReduction@2} ''' SetBonus: ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index b664e39301..35b2d0b788 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -9,13 +9,18 @@ AuricTeslaCuisses: { ''' {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} - Magic carpet effect + Provides a magical flying carpet + [c/aaaaaa:Shift- in your inventory to toggle] [i:FlyingCarpet] [c/aaaaaa:Flying Carpet's effect] ''' } AuricTeslaHeadRanged: { DisplayName: Auric Tesla Hooded Facemask - Tooltip: "{$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1}" + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} + {$Common.AmmoUseReduction@2} + ''' SetBonus: ''' Ranged Tarragon, Bloodflare and God Slayer armor effects @@ -217,7 +222,11 @@ BloodflareHeadMelee: { BloodflareHeadRanged: { DisplayName: Bloodflare Horned Helm - Tooltip: "{$CommonItemTooltip.PercentIncreasedRangedDamageCritChance}" + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedRangedDamageCritChance} + {$Common.AmmoUseReduction@1} + ''' SetBonus: "{$BloodflareHeadRanged.SetBonusEffect}" SetBonusEffect: ''' @@ -277,6 +286,7 @@ DemonshadeBreastplate: { {$CommonItemTooltip.IncreasesMaxManaBy} {$CommonItemTooltip.PercentIncreasedDamageCritChance@1} {$CommonItemTooltip.PercentIncreasedMeleeSpeed@2} + {$Common.AmmoUseReduction@3} Standing still absorbs shadows to grant exponentially accelerating life regen ''' } @@ -443,7 +453,11 @@ GodSlayerHeadMelee: { GodSlayerHeadRanged: { DisplayName: God Slayer Helmet - Tooltip: "{$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1}" + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} + {$Common.AmmoUseReduction@2} + ''' SetBonus: "{$GodSlayerHeadRanged.SetBonusEffect}" SetBonusEffect: ''' @@ -486,6 +500,7 @@ OmegaBlueChestplate: { Tooltip: ''' {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} + {$Common.AmmoUseReduction@2} Your attacks inflict Hadopelagic Pressure No positive life regen ''' @@ -664,7 +679,11 @@ TarragonHeadMelee: { TarragonHeadRanged: { DisplayName: Tarragon Visage - Tooltip: "{$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1}" + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} + {$Common.AmmoUseReduction@2} + ''' SetBonus: "{$TarragonHeadRanged.SetBonusEffect}" SetBonusEffect: ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson index 020e9628dd..ba2ebe56aa 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson @@ -326,3 +326,8 @@ AnodizedWulfrumMetal: { DisplayName: Anodized Wulfrum Metal Tooltip: "" } + +WillOWisp: { + DisplayName: Will O Wisp + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index c3a3783cdf..746f0693ae 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -4144,16 +4144,6 @@ EutrophicGlassWall: { Tooltip: "" } -EutrophicSandWall: { - DisplayName: Unsafe Eutrophic Sand Wall - Tooltip: "" -} - -EutrophicSandWallSafe: { - DisplayName: Eutrophic Sand Wall - Tooltip: "" -} - ExoPlatingWallItem: { DisplayName: Exo Plating Wall Tooltip: "" @@ -4195,11 +4185,6 @@ NavyplateWall: { } NavystoneWall: { - DisplayName: Unsafe Navystone Wall - Tooltip: "" -} - -NavystoneWallSafe: { DisplayName: Navystone Wall Tooltip: "" } @@ -4653,3 +4638,8 @@ BasaltSlab: { DisplayName: Basalt Slab Tooltip: "" } + +UnsafeNavystoneWall: { + DisplayName: Unsafe Navystone Wall + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index f729f662d8..848a34535d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -126,7 +126,11 @@ AstralBlaster: { AstrealDefeat: { DisplayName: Astreal Defeat - Tooltip: All arrows are converted to Astreal Arrows that emit flames as they travel + Tooltip: + ''' + All arrows are converted to Astreal Arrows that emit flames as they travel + 33% chance to save ammo + ''' } Auralis: { @@ -210,6 +214,7 @@ BlossomFlux: { ''' Fires a stream of leaves Press to fire a spore orb that explodes into a cloud of spore gas + 50% chance to save ammo ''' LegendaryText: ''' @@ -635,6 +640,7 @@ Infinity: { ''' Fires a twin stream of energy bolts that split Press to fire a barrage of normal bullets + 80% chance to save ammo 'They say infinity is neverending, yet you hold it in your hands' ''' } @@ -1127,6 +1133,7 @@ Shredder: { ''' Fires a barrage of energy bolts that split and bounce Press to fire a barrage of normal bullets instead + 60% chance to save ammo 'The myth, the legend, the weapon that drops more frames than any other' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 174b0909cb..dce0a53cc5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -487,6 +487,7 @@ IgneousExaltation: { Summons an Igneous blade that orbits around you When your minion slots are full, again to launch all blades towards the cursor This ability has a two-second cooldown that requires holding this item + Shift- this item in your inventory to change the rotation direction ''' } @@ -864,6 +865,7 @@ ViridVanguard: { All weapons inflict Sage Poison, which becomes more powerful the more weapons are summoned When all minion slots are full, again to spin up a flurry of slashes aimed at your cursor This ability has a five-second cooldown that requires holding this item + Shift- this item in your inventory to change the rotation direction ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index fe21625893..b9c79438a1 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -163,3 +163,13 @@ XykDeathAnim.DisplayName: Xyk Death Animation XykWings.DisplayName: Xyk Wings BatholithBangleProjectile.DisplayName: Batholith Bangle Projectile ScionsCurioMini.DisplayName: Scions Curio Mini +BlackPearlFalling.DisplayName: Black Pearl Falling +DunesandBallFalling.DisplayName: Dunesand Ball Falling +EutrophicSandBallFalling.DisplayName: Eutrophic Sand Ball Falling +PinkPearlFalling.DisplayName: Pink Pearl Falling +PolypSandBallFalling.DisplayName: Polyp Sand Ball Falling +VolcanicSandBallFalling.DisplayName: Volcanic Sand Ball Falling +WhitePearlFalling.DisplayName: White Pearl Falling +DuneSandBallGun.DisplayName: Dunesandball +PolypSandBallGun.DisplayName: Polyp Sandball +VolcanicSandBallGun.DisplayName: Volcanic Sandball diff --git a/NPCs/BaseWormNPC.cs b/NPCs/BaseWormNPC.cs index 6a7bd0bfe3..778d4f4fec 100644 --- a/NPCs/BaseWormNPC.cs +++ b/NPCs/BaseWormNPC.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -117,9 +118,9 @@ namespace CalamityMod.NPCs /// /// Applies this animation for the given frame /// - /// + /// /// - public void ApplyAnimationFrame(BaseWormNPC HeadNPC, float frame) + public void ApplyAnimationFrame(Entity HeadEntity, float frame) { var orderedKeyframes = AnimationKeyframes.OrderBy(x => x.Key); (int, float[], float)? prev = null; @@ -163,42 +164,136 @@ namespace CalamityMod.NPCs AnimationKeyframes[next.Value.Item1] = (AnimationKeyframes[next.Value.Item1].Item1, next.Value.Item3); } } - if (HeadNPC.Segments.Count > 0) + //We use the same animation framework for both projectiles and NPCs, but applying it is different for each type and so we do the final applications here. + if (HeadEntity is NPC) { - if (applyRotation && !(float.IsNaN(goalRotation))) + BaseWormNPC HeadNPC = ((NPC)HeadEntity).ModNPC(); + if (HeadNPC.Segments.Count > 0) { - HeadNPC.NPC.rotation = goalRotation * (mirror ? HeadNPC.NPC.velocity.X.DirectionalSign() : 1); - } - for (int i = 0; i < HeadNPC.Segments.Count; i++) - { - - Vector2 pos1 = HeadNPC.NPC.Center; - float dist = HeadNPC.SegmentTypePositionOffsets[0]; - if (i != 0) + if (applyRotation && !(float.IsNaN(goalRotation))) { - dist = HeadNPC.SegmentTypePositionOffsets[HeadNPC.Segments[i - 1].segmentType + 1]; + HeadNPC.NPC.rotation = goalRotation * (mirror ? HeadNPC.NPC.velocity.X.DirectionalSign() : 1); } - dist *= HeadNPC.NPC.scale; - Vector2 rot = (HeadNPC.NPC.rotation - MathHelper.PiOver2).ToRotationVector2(); - if (rot == Vector2.Zero) - rot = HeadNPC.Segments[0].Center.AngleTo(HeadNPC.NPC.Center).ToRotationVector2(); - if (i >= 1) + for (int i = 0; i < HeadNPC.Segments.Count; i++) { - pos1 = HeadNPC.Segments[i - 1].Center; - rot = HeadNPC.Segments[i - 1].velocity.SafeNormalize(Vector2.Zero); - } - rot = rot.RotatedBy(goalSegmentRotOffsets[i] * (mirror ? HeadNPC.NPC.velocity.X.DirectionalSign() : 1)); - var dir = HeadNPC.Segments[i].Center.DirectionFrom(pos1); - HeadNPC.Segments[i].Center = pos1 + Vector2.Lerp(dir, -(rot), segmentRigidity) * dist; - HeadNPC.Segments[i].velocity = HeadNPC.Segments[i].Center.DirectionTo(pos1); - HeadNPC.Segments[i].rotation = HeadNPC.Segments[i].velocity.ToRotation() + MathHelper.PiOver2; - } - for (int i = 1; i < HeadNPC.Segments.Count - 1; i++) - { - HeadNPC.Segments[i].rotation = HeadNPC.Segments[i + 1].Center.DirectionTo(HeadNPC.Segments[i - 1].Center).ToRotation() + MathHelper.PiOver2; + Vector2 pos1 = HeadNPC.NPC.Center; + float dist = HeadNPC.SegmentTypePositionOffsets[0]; + if (i != 0) + { + dist = HeadNPC.SegmentTypePositionOffsets[HeadNPC.Segments[i - 1].segmentType + 1]; + } + dist *= HeadNPC.NPC.scale; + Vector2 rot = (HeadNPC.NPC.rotation - MathHelper.PiOver2).ToRotationVector2(); + if (rot == Vector2.Zero) + rot = HeadNPC.Segments[0].Center.AngleTo(HeadNPC.NPC.Center).ToRotationVector2(); + if (i >= 1) + { + pos1 = HeadNPC.Segments[i - 1].Center; + rot = HeadNPC.Segments[i - 1].velocity.SafeNormalize(Vector2.Zero); + } + rot = rot.RotatedBy(goalSegmentRotOffsets[i] * (mirror ? HeadNPC.NPC.velocity.X.DirectionalSign() : 1)); + var dir = HeadNPC.Segments[i].Center.DirectionFrom(pos1); + HeadNPC.Segments[i].Center = pos1 + Vector2.Lerp(dir, -(rot), segmentRigidity) * dist; + HeadNPC.Segments[i].velocity = HeadNPC.Segments[i].Center.DirectionTo(pos1); + HeadNPC.Segments[i].rotation = HeadNPC.Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + } + + for (int i = 1; i < HeadNPC.Segments.Count - 1; i++) + { + HeadNPC.Segments[i].rotation = HeadNPC.Segments[i + 1].Center.DirectionTo(HeadNPC.Segments[i - 1].Center).ToRotation() + MathHelper.PiOver2; + } } } + else if (HeadEntity is Projectile) + { + BaseWormProjectile HeadProjectile = ((Projectile)HeadEntity).ModProjectile(); + if (HeadProjectile.Segments.Count > 0) + { + if (applyRotation && !(float.IsNaN(goalRotation))) + { + HeadProjectile.Projectile.rotation = goalRotation * (mirror ? HeadProjectile.Projectile.velocity.X.DirectionalSign() : 1); + } + for (int i = 0; i < HeadProjectile.Segments.Count; i++) + { + + Vector2 pos1 = HeadProjectile.Projectile.Center; + float dist = HeadProjectile.SegmentTypePositionOffsets[0]; + if (i != 0) + { + dist = HeadProjectile.SegmentTypePositionOffsets[HeadProjectile.Segments[i - 1].segmentType + 1]; + } + dist *= HeadProjectile.Projectile.scale; + Vector2 rot = (HeadProjectile.Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + if (rot == Vector2.Zero) + rot = HeadProjectile.Segments[0].Center.AngleTo(HeadProjectile.Projectile.Center).ToRotationVector2(); + if (i >= 1) + { + pos1 = HeadProjectile.Segments[i - 1].Center; + rot = HeadProjectile.Segments[i - 1].velocity.SafeNormalize(Vector2.Zero); + } + rot = rot.RotatedBy(goalSegmentRotOffsets[i] * (mirror ? HeadProjectile.Projectile.velocity.X.DirectionalSign() : 1)); + var dir = HeadProjectile.Segments[i].Center.DirectionFrom(pos1); + HeadProjectile.Segments[i].Center = pos1 + Vector2.Lerp(dir, -(rot), segmentRigidity) * dist; + HeadProjectile.Segments[i].velocity = HeadProjectile.Segments[i].Center.DirectionTo(pos1); + HeadProjectile.Segments[i].rotation = HeadProjectile.Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + } + + for (int i = 1; i < HeadProjectile.Segments.Count - 1; i++) + { + HeadProjectile.Segments[i].rotation = HeadProjectile.Segments[i + 1].Center.DirectionTo(HeadProjectile.Segments[i - 1].Center).ToRotation() + MathHelper.PiOver2; + } + } + } + } + } + #endregion + + #region Segment Class + /// + /// This class is used to store the information of each segment's location, size, and texture path + /// Due to the amount of segments, there is only one actual NPC for this boss + /// + public class BaseWormSegment + { + /// + /// The type of segment this is. Segment type is used to determine spacing and textures. + /// + public int segmentType = 0; + + /// + /// The position of the center of this segment + /// + public Vector2 Center = Vector2.Zero; + + /// + /// The rotation of this segment in radians + /// + public float rotation = 0; + + /// + /// The velocity this segment has. + /// Currently doesn't actually do anything besides be a token value if needed to be read by something + /// + public Vector2 velocity = Vector2.Zero; + /// + /// How opaque this segment is. Ranges from 1 (fully opaque) to 0 (fully transparent) + /// + public float Opacity = 1; + public BaseWormSegment(ModNPC Head, int segmentStyle = 0) + { + Center = Head.NPC.Center; + rotation = Head.NPC.rotation; + velocity = Head.NPC.velocity; + segmentType = segmentStyle; + } + + public BaseWormSegment(ModProjectile Head, int segmentStyle = 0) + { + Center = Head.Projectile.Center; + rotation = Head.Projectile.rotation; + velocity = Head.Projectile.velocity; + segmentType = segmentStyle; } } #endregion @@ -244,7 +339,7 @@ namespace CalamityMod.NPCs /// /// The list of all segments of this worm /// - public List Segments = new(); + public List Segments = new(); /// /// The textures for each segment type of this worm. Works like getting a texture from TextureAssets @@ -272,40 +367,6 @@ namespace CalamityMod.NPCs /// private List> internalTexAssets = new List>(); - /// - /// This class is used to store the information of each segment's location, size, and texture path - /// Due to the amount of segments, there is only one actual NPC for this boss - /// - public class Segment - { - /// - /// The type of segment this is. Segment type is used to determine spacing and textures. - /// - public int segmentType = 0; - - /// - /// The position of the center of this segment - /// - public Vector2 Center = Vector2.Zero; - - /// - /// The rotation of this segment in radians - /// - public float rotation = 0; - - /// - /// The velocity this segment has. - /// Currently doesn't actually do anything besides be a token value if needed to be read by something - /// - public Vector2 velocity = Vector2.Zero; - public Segment(ModNPC Head, int segmentStyle = 0) - { - Center = Head.NPC.Center; - rotation = Head.NPC.rotation; - velocity = Head.NPC.velocity; - segmentType = segmentStyle; - } - } public enum SegmentFollowLogic { Regular = 0, //Traditional worm segment logic @@ -336,7 +397,7 @@ namespace CalamityMod.NPCs NPC.position += NPC.velocity; //Update this segment's movement so that all other segments use this as the base. This is undone at the end of the method. if (ActiveAnimation is not null) { - ActiveAnimation.ApplyAnimationFrame(this, AnimationFrame); + ActiveAnimation.ApplyAnimationFrame(NPC, AnimationFrame); AnimationFrame++; if (AnimationFrame > ActiveAnimation.AnimationKeyframes.Keys.Max()) { @@ -377,7 +438,7 @@ namespace CalamityMod.NPCs { float segmentDistance = SegmentTypePositionOffsets[0]; var thisSeg = Segments[i]; - var aheadSeg = new Segment(this); + var aheadSeg = new BaseWormSegment(this); if (i != 0) { aheadSeg = Segments[i - 1]; @@ -403,7 +464,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < Segments.Count; i++) { var thisSeg = Segments[i]; - var aheadSeg = new Segment(this); + var aheadSeg = new BaseWormSegment(this); if (i != 0) aheadSeg = Segments[i - 1]; bool hasMoved = false; @@ -446,7 +507,6 @@ namespace CalamityMod.NPCs Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; hasMoved = true; - hasMoved = true; break; } } @@ -486,9 +546,9 @@ namespace CalamityMod.NPCs { for (var i = 0; i < SegmentCount - 1; i++) { - Segments.Add(new Segment(this, 0)); + Segments.Add(new BaseWormSegment(this, 0)); } - Segments.Add(new Segment(this, 1)); + Segments.Add(new BaseWormSegment(this, 1)); } #endregion @@ -504,7 +564,7 @@ namespace CalamityMod.NPCs return false; } - public virtual void DrawSegment(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor, Segment segment) + public virtual void DrawSegment(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor, BaseWormSegment segment) { var color = Lighting.GetColor(segment.Center.ToTileCoordinates()); if (!SegmentTextureAssets.IndexInRange(segment.segmentType)) @@ -512,7 +572,7 @@ namespace CalamityMod.NPCs return; } var tex = SegmentTextureAssets[segment.segmentType].Value; - spriteBatch.Draw(tex, segment.Center - Main.screenPosition, null, color, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), NPC.scale, SpriteEffects.None, 1); + spriteBatch.Draw(tex, segment.Center - Main.screenPosition, null, color * segment.Opacity, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), NPC.scale, SpriteEffects.None, 1); } #endregion } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 7f927e6643..d5256ecdf6 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6110,13 +6110,6 @@ namespace CalamityMod.NPCs pool[NPCID.ChaosElemental] = SpawnCondition.Cavern.Chance * 0.125f; } - // Replace vanilla Lava Slimes with Calamity Lava Slimes to avoid annoying lava drops - if (spawnInfo.Player.ZoneUnderworldHeight && !calamityBiomeZone && CalamityServerConfig.Instance.RemoveLavaDropsFromLavaSlimes && Main.expertMode) - { - pool.Add(NPCType(), SpawnCondition.Underworld.Chance); - pool.Remove(NPCID.LavaSlime); - } - // Spawn Green Jellyfish in prehm and Blue Jellyfish in hardmode if (spawnInfo.Player.ZoneRockLayerHeight && spawnInfo.Water && !calamityBiomeZone) { diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 04e4c25760..6cd8ea55a7 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1157,6 +1157,7 @@ namespace CalamityMod.NPCs { shop.InsertBefore(ItemID.LesserHealingPotion, ItemID.Bottle) .InsertAfter(ItemID.ManaPotion, ItemID.WormholePotion, Condition.HappyEnoughToSellPylons) + .InsertAfter(ItemID.Safe, ItemID.MusicBox) .InsertAfter(ItemID.Flare, ItemID.Flare, hasFlareGunUpgrade) .InsertAfter(ItemID.BlueFlare, ItemID.BlueFlare, hasFlareGunUpgrade) .AddWithCustomValue(ItemID.AngelStatue, Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCType())); diff --git a/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs b/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs deleted file mode 100644 index 3ec2597317..0000000000 --- a/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class LavaSlimeNoLavaDrop : ModNPC - { - public override string Texture => $"Terraria/Images/NPC_{NPCID.LavaSlime}"; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 2; - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.aiStyle = NPCAIStyleID.Slime; - AIType = NPCID.LavaSlime; - AnimationType = NPCID.LavaSlime; - NPC.width = 24; - NPC.height = 18; - NPC.damage = 15; - NPC.defense = 10; - NPC.lifeMax = 50; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.scale = 1.1f; - NPC.alpha = 50; - NPC.lavaImmune = true; - NPC.value = 120f; - if (Main.remixWorld) - { - NPC.damage = 7; - NPC.defense = 2; - NPC.lifeMax = 25; - NPC.value = 25f; - } - //Banner = NPCID.LavaSlime; - //BannerItem = ItemID.LavaSlimeBanner; - - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToWater = true; - } - - public override void HitEffect(NPC.HitInfo hit) - { - if (NPC.life > 0) - { - for (int i = 0; (double)i < hit.Damage / (double)NPC.lifeMax * 80D; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection * 2, -1f, NPC.alpha, default, 1.5f); - if (Main.rand.Next(8) != 0) - Main.dust[dust].noGravity = true; - } - - return; - } - - for (int i = 0; i < 40; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection * 2, -1f, NPC.alpha, default, 1.5f); - if (Main.rand.Next(8) != 0) - Main.dust[dust].noGravity = true; - } - } - } -} diff --git a/NPCs/SunkenSea/CarrionSwallower.cs b/NPCs/SunkenSea/CarrionSwallower.cs index 0d092cd892..d072498999 100644 --- a/NPCs/SunkenSea/CarrionSwallower.cs +++ b/NPCs/SunkenSea/CarrionSwallower.cs @@ -1,6 +1,9 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; @@ -216,5 +219,9 @@ namespace CalamityMod.NPCs.SunkenSea spriteBatch.Draw(tex, NPC.Center - screenPos, frame, drawColor, NPC.rotation, frame.Size() / 2f, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); return false; } + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 1, 1, 2); + } } } diff --git a/NPCs/SunkenSea/FesteringRemains.cs b/NPCs/SunkenSea/FesteringRemains.cs index 971696be5d..21f70be2af 100644 --- a/NPCs/SunkenSea/FesteringRemains.cs +++ b/NPCs/SunkenSea/FesteringRemains.cs @@ -11,6 +11,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using System.IO; +using CalamityMod.Items.Materials; namespace CalamityMod.NPCs.SunkenSea { @@ -179,5 +180,9 @@ namespace CalamityMod.NPCs.SunkenSea } return true; } + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 1, 1, 2); + } } } diff --git a/NPCs/SunkenSea/Probesnout.cs b/NPCs/SunkenSea/Probesnout.cs index 48c6d7c384..b1e1a8228a 100644 --- a/NPCs/SunkenSea/Probesnout.cs +++ b/NPCs/SunkenSea/Probesnout.cs @@ -411,6 +411,7 @@ namespace CalamityMod.NPCs.SunkenSea { base.SetDefaults(); + Banner = Type; BannerItem = ItemType(); NPC.lifeMax = 5; diff --git a/NPCs/SunkenSea/SunkenSeaNPC.cs b/NPCs/SunkenSea/SunkenSeaNPC.cs index f448f03fef..0d9a00f454 100644 --- a/NPCs/SunkenSea/SunkenSeaNPC.cs +++ b/NPCs/SunkenSea/SunkenSeaNPC.cs @@ -99,8 +99,6 @@ namespace CalamityMod.NPCs.SunkenSea BiomeDesignation.HasFlag(flag)) .Select(flag => SunkenSeaBiomeCorrespondentDict.Dict[flag].BiomeType) .ToArray(); - - Banner = Type; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/Packets/Players/ExaltationDirectionSyncPacket.cs b/Packets/Players/ExaltationDirectionSyncPacket.cs new file mode 100644 index 0000000000..1a1c483d76 --- /dev/null +++ b/Packets/Players/ExaltationDirectionSyncPacket.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Packets +{ + public sealed class ExaltationDirectionSyncPacket : CalamityPacket + { + public static ExaltationDirectionSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.ExaltationDirection; + + public static void Send(CalamityPlayer playerToSync, int toClient = -1, int ignoreClient = -1) + { + if (playerToSync is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(playerToSync); + packet.Write(playerToSync.InvertExaltationLineRotationDirections); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + var invertDir = packet.ReadBoolean(); + + if (player is null) + return; + + player.InvertExaltationLineRotationDirections = invertDir; + + if (Main.dedServ) + Send(player, ignoreClient: sender); + } + } +} diff --git a/Projectiles/BaseProjectiles/BaseWormProjectile.cs b/Projectiles/BaseProjectiles/BaseWormProjectile.cs new file mode 100644 index 0000000000..65a276480f --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseWormProjectile.cs @@ -0,0 +1,294 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.BaseProjectiles +{ + /// + /// Implementation to make ModProjectile worms much easier to make. + /// Modified version of BaseWormNPC to function on a ModProjectile instead of ModNPC + /// + public abstract class BaseWormProjectile : ModProjectile + { + #region Abstracts / Commonly Overridden Fields + /// + /// The amount of segments of this worm. This does not include the head + /// + public abstract int SegmentCount { get; } + /// + /// A list of the offsets to the next segment in the worm from this segment + /// DOES include the head + /// + public abstract List SegmentTypePositionOffsets { get; } + /// + /// A list of all textures for the segments to draw with + /// does NOT include the head + /// + public abstract List SegmentTextures { get; } + /// + /// Offsets for drawing each segment + /// + public List SegmentTypeDrawOffsets = new List(); + + /// + /// How far through the current animation this worm is + /// + public float AnimationFrame = 0; + /// + /// The active animation for the worm + /// + public WormAnimation ActiveAnimation = null; + #endregion + #region Segments + /// + /// The textures for each segment type of this worm. Works like getting a texture from TextureAssets + /// + public List> SegmentTextureAssets + { + get + { + if (internalTexAssets.Count == 0) + for (var i = 0; i < SegmentTextures.Count; i++) + { + internalTexAssets.Add(ModContent.Request(SegmentTextures[i])); + if (SegmentTypeDrawOffsets.Count <= i) + { + SegmentTypeDrawOffsets.Add(Vector2.Zero); + } + } + return internalTexAssets; + } + } + + /// + /// Internal list that stores the textureassets. + /// Use SegmentTextureAssets to get the data stored here. + /// + private List> internalTexAssets = new List>(); + + public List Segments = new(); + + public enum SegmentFollowLogic + { + Regular = 0, //Traditional worm segment logic + Exact = 1, //Follows the path the head took exactly + // In the future, add a segment logic that supports solid tile collisions and forces applied to *any* segment + } + + /// + /// Which type of segment following logic this worm should currently use + /// + public SegmentFollowLogic SegmentFollowType; + + /// + /// How rigid the segment should be when using default segment logic + /// + public float SegmentRigidity = 0.2f; + + /// + /// The points used by ExactSegmentLogic to exactly follow the head + /// + private List segmentPoints = new List(); + + /// + /// Updates the positions of the segments based on the value set in SegmentFollowType + /// + public void UpdateSegments() + { + Projectile.position += Projectile.velocity; //Update this segment's movement so that all other segments use this as the base. This is undone at the end of the method. + if (ActiveAnimation is not null) + { + ActiveAnimation.ApplyAnimationFrame(Projectile, AnimationFrame); + AnimationFrame++; + if (AnimationFrame > ActiveAnimation.AnimationKeyframes.Keys.Max()) + { + AnimationFrame = 0; + ActiveAnimation = null; + } + } + else + { + if (segmentPoints.Count < 1 || segmentPoints[0].Distance(Projectile.Center) > 8) + { + segmentPoints.Insert(0, Projectile.Center); + } + while (segmentPoints.Count > 300) + { + segmentPoints.RemoveAt(segmentPoints.Count - 1); + } + switch (SegmentFollowType) + { + case (SegmentFollowLogic.Regular): + RegularSegmentLogic(); + break; + case (SegmentFollowLogic.Exact): + ExactSegmentLogic(); + break; + } + } + Projectile.position -= Projectile.velocity; + + } + + private void RegularSegmentLogic() + { + for (int i = 0; i < Segments.Count; i++) + { + float segmentDistance = SegmentTypePositionOffsets[0]; + var thisSeg = Segments[i]; + var aheadSeg = new BaseWormSegment(this); + if (i != 0) + { + aheadSeg = Segments[i - 1]; + segmentDistance = SegmentTypePositionOffsets[Segments[i - 1].segmentType + 1]; + } + segmentDistance *= Projectile.scale; + Vector2 nexSegDir = aheadSeg.Center - thisSeg.Center; + if (aheadSeg.rotation != thisSeg.rotation) + { + nexSegDir = nexSegDir.RotatedBy(MathHelper.WrapAngle(aheadSeg.rotation - thisSeg.rotation) * SegmentRigidity); + nexSegDir = nexSegDir.MoveTowards((aheadSeg.rotation - thisSeg.rotation).ToRotationVector2(), 1f); + } + thisSeg.rotation = nexSegDir.ToRotation() + MathHelper.PiOver2; + thisSeg.Center = aheadSeg.Center - nexSegDir.SafeNormalize(Vector2.Zero) * segmentDistance; + + } + } + + private void ExactSegmentLogic() + { + float dist = 40f; + int segmentPointInUse = 0; + for (int i = 0; i < Segments.Count; i++) + { + var thisSeg = Segments[i]; + var aheadSeg = new BaseWormSegment(this); + if (i != 0) + aheadSeg = Segments[i - 1]; + bool hasMoved = false; + while (segmentPointInUse < segmentPoints.Count) + { + if (segmentPointInUse == 0) + { + if (aheadSeg.Center.Distance(segmentPoints[0]) >= dist) + { + thisSeg.Center = aheadSeg.Center + aheadSeg.Center.DirectionTo(segmentPoints[0]) * dist; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + else + { + segmentPointInUse++; + } + } + else + { + if (aheadSeg.Center.Distance(segmentPoints[segmentPointInUse]) >= dist) + { + thisSeg.Center = aheadSeg.Center + aheadSeg.Center.DirectionTo(segmentPoints[segmentPointInUse]) * dist; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + else + { + segmentPointInUse++; + } + } + } + if (!hasMoved && segmentPointInUse >= segmentPoints.Count) + { + thisSeg.Center = segmentPoints[segmentPoints.Count - 1]; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + } + } + #endregion + + #region Defaults + public override void SetStaticDefaults() + { + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 1600; //100 tiles offscreen + } + public override void SetDefaults() + { + for (var i = 0; i < SegmentCount - 1; i++) + { + Segments.Add(new BaseWormSegment(this, 0)); + } + Segments.Add(new BaseWormSegment(this, 1)); + } + #endregion + + #region Draw + public override bool PreDraw(ref Color lightColor) + { + for (int i = Segments.Count - 1; i >= 0; i--) + { + DrawSegment(ref lightColor, Segments[i]); + } + Main.spriteBatch.Draw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, TextureAssets.Projectile[Type].Value.Size() / 2, Projectile.scale, SpriteEffects.None, 1); + return false; + } + + public virtual void DrawSegment(ref Color lightColor, BaseWormSegment segment) + { + var color = Lighting.GetColor(segment.Center.ToTileCoordinates()); + if (!SegmentTextureAssets.IndexInRange(segment.segmentType)) + { + return; + } + var tex = SegmentTextureAssets[segment.segmentType].Value; + Main.spriteBatch.Draw(tex, segment.Center - Main.screenPosition, null, color *segment.Opacity, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), Projectile.scale, SpriteEffects.None, 1); + } + #endregion + + #region Netcode + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(AnimationFrame); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + AnimationFrame = reader.ReadSingle(); + } + #endregion + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + for (var i = 0; i < Segments.Count; i++) + { + var prevSeg = new BaseWormSegment(this); + if (i != 0) + { + prevSeg = Segments[i - 1]; + } + float cpoint = 0; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), prevSeg.Center, Segments[i].Center, 16, ref cpoint)) + { + return true; + } + } + return base.Colliding(projHitbox, targetHitbox); + } + } +} diff --git a/Projectiles/Magic/VolterionHoldout.cs b/Projectiles/Magic/VolterionHoldout.cs index aca54af815..8d12d3b4d0 100644 --- a/Projectiles/Magic/VolterionHoldout.cs +++ b/Projectiles/Magic/VolterionHoldout.cs @@ -48,9 +48,8 @@ namespace CalamityMod.Projectiles.Magic public override void KillHoldoutLogic() { - // Only times out if at the final frame (post-firing resting time) - bool noMana = !Owner.CheckMana(Owner.ActiveItem()) && Projectile.frame == 14; - if (HeldItem.type != Owner.ActiveItem().type || noMana) + // Override typical CantUseHoldout such that the weapon typically runs through the use animation while not channeled + if (HeldItem.type != Owner.ActiveItem().type || Owner.dead || !Owner.active) { Projectile.Kill(); Projectile.netUpdate = true; @@ -76,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic // Subtract a flat 42 from the use time because the firing animation consists of 14 frames at 20 FPS if (Projectile.frameCounter >= MathHelper.Clamp(Owner.ActiveItem().useAnimation - 42, 0f, Owner.ActiveItem().useAnimation)) { - if (Owner.CantUseHoldout()) + if (Owner.CantUseHoldout() || !Owner.CheckMana(Owner.ActiveItem())) Projectile.Kill(); Projectile.frame = 0; diff --git a/Projectiles/Summon/IgneousBlade.cs b/Projectiles/Summon/IgneousBlade.cs index 6709397595..f602fbbcd8 100644 --- a/Projectiles/Summon/IgneousBlade.cs +++ b/Projectiles/Summon/IgneousBlade.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon if (projectileCounts <= 1f) projectileCounts = 1f; - return MathHelper.WrapAngle(MathHelper.TwoPi * BladeIndex / projectileCounts + MathHelper.TwoPi * (Owner.miscCounter % 60 / 60f)); + return MathHelper.WrapAngle(MathHelper.TwoPi * BladeIndex / projectileCounts + MathHelper.TwoPi * (Owner.miscCounter % 60 / 60f)) * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1); } } @@ -230,7 +230,7 @@ namespace CalamityMod.Projectiles.Summon Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + SpriteEffects direction = Projectile.spriteDirection == 1 ^ Owner.Calamity().InvertExaltationLineRotationDirections ? SpriteEffects.FlipHorizontally : SpriteEffects.None; // Draw the afterimage trail. @@ -252,11 +252,12 @@ namespace CalamityMod.Projectiles.Summon outlineOpacity = 0.75f; } var outlineTex = IgneousExaltation.GetBladeOutlineTex(); - Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(2, 0) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, Projectile.rotation - MathHelper.PiOver4, origin, Projectile.scale, direction, 0); - Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, 2) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, Projectile.rotation - MathHelper.PiOver4, origin, Projectile.scale, direction, 0); - Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(-2, 0) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, Projectile.rotation - MathHelper.PiOver4, origin, Projectile.scale, direction, 0); - Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, -2) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, Projectile.rotation - MathHelper.PiOver4, origin, Projectile.scale, direction, 0); - Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation - MathHelper.PiOver4, origin, Projectile.scale, direction, 0); + float rotation = Projectile.rotation - MathHelper.PiOver4 * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(2, 0) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, 2) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(-2, 0) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, -2) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0); // Draw the gleam at the tip of the blade. Texture2D shineTex = ModContent.Request("CalamityMod/Particles/HalfStar").Value; diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs index eec31f918a..12833d3ce9 100644 --- a/Projectiles/Summon/ViridVanguardBlade.cs +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon { get { - return MathHelper.TwoPi * BladeIndex / CurrentViridCount + Owner.Calamity().ViridVanguardRotation; + return MathHelper.TwoPi * BladeIndex / CurrentViridCount + Owner.Calamity().ViridVanguardRotation * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1); } } @@ -225,7 +225,7 @@ namespace CalamityMod.Projectiles.Summon ReturnToIdleState(); return; } - var offset = MathHelper.TwoPi * MathF.Floor(BladeIndex * 0.5f) / MathF.Ceiling(CurrentViridCount * 0.5f) + Owner.Calamity().ViridVanguardRotation; + var offset = MathHelper.TwoPi * MathF.Floor(BladeIndex * 0.5f) / MathF.Ceiling(CurrentViridCount * 0.5f) + Owner.Calamity().ViridVanguardRotation * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1); Vector2 hoverDestination = Owner.Center + offset.ToRotationVector2() * 200f; Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, 32f); Projectile.velocity *= 0.8f; @@ -425,7 +425,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.MaxUpdates = 2; float completion = AITimer / (ViridVanguard.ActiveAttackStartup * (float)Projectile.MaxUpdates); - Vector2 hoverDestination = Owner.Center + BladeAngleForPhripperZenith.ToRotationVector2() * MathHelper.Lerp(200f, 116f, completion); + Vector2 hoverDestination = Owner.Center + (BladeAngleForPhripperZenith * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1)).ToRotationVector2() * MathHelper.Lerp(200f, 116f, completion); Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, MathHelper.Lerp(16f, 64f, completion)); Projectile.velocity *= 0.8f; @@ -471,7 +471,7 @@ namespace CalamityMod.Projectiles.Summon dotResult /= 2f; if (!ActiveAttacking) { - Vector2 hoverDestination = Owner.Center + BladeAngleForPhripperZenith.ToRotationVector2() * 116f; + Vector2 hoverDestination = Owner.Center + (BladeAngleForPhripperZenith * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1)).ToRotationVector2() * 116f; Projectile.Center = hoverDestination; Projectile.velocity *= 0.8f; @@ -488,7 +488,7 @@ namespace CalamityMod.Projectiles.Summon float distance = Owner.Distance(StoredAttackMousePos); float endSize = MathHelper.Clamp(distance * 0.25f, 164f, 300f); Vector2 hoverCenter = Vector2.Lerp(Owner.Center, Owner.Center + Owner.Center.DirectionTo(StoredAttackMousePos) * (distance > 164 ? distance - endSize : 0), dotResult); - Vector2 finalHoverDestination = hoverCenter + BladeAngleForPhripperZenith.ToRotationVector2() * MathHelper.Lerp(116f, endSize, dotResult); + Vector2 finalHoverDestination = hoverCenter + (BladeAngleForPhripperZenith * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1)).ToRotationVector2() * MathHelper.Lerp(116f, endSize, dotResult); Projectile.Center = finalHoverDestination; Projectile.velocity *= 0.8f; Projectile.rotation = Projectile.AngleFrom(hoverCenter) + MathHelper.PiOver2; @@ -509,7 +509,7 @@ namespace CalamityMod.Projectiles.Summon ActiveTimer = ViridVanguard.ActiveAttackCooldown; completion = 1; } - Vector2 hoverDestination = Owner.Center + BladeAngleForPhripperZenith.ToRotationVector2() * MathHelper.Lerp(200f, 116f, completion); + Vector2 hoverDestination = Owner.Center + (BladeAngleForPhripperZenith * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1)).ToRotationVector2() * MathHelper.Lerp(200f, 116f, completion); Projectile.Center = hoverDestination; Projectile.velocity *= 0.8f; Owner.Calamity().ViridVanguardRotationToAdd = MathHelper.Lerp(1, ViridVanguard.ActiveAttackCirclingSpeedMultiplier, completion) * ViridVanguard.IdleCirclingSpeed; @@ -597,7 +597,7 @@ namespace CalamityMod.Projectiles.Summon Rectangle frame = texture.Frame(2, 1, DrawAsAxe ? 0 : 1, 0); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + SpriteEffects direction = Projectile.spriteDirection == 1 ^ Owner.Calamity().InvertExaltationLineRotationDirections ? SpriteEffects.FlipHorizontally : SpriteEffects.None; // Draw the afterimage trail. TrailDrawer ??= new(); @@ -619,7 +619,7 @@ namespace CalamityMod.Projectiles.Summon outlineOpacity = 0.75f; } var outlineTex = ViridVanguard.GetBladeOutlineTex(); - var rotation = Projectile.rotation + (DrawAsAxe ? -0.2f : 0.2f); + var rotation = Projectile.rotation + (DrawAsAxe ^ Owner.Calamity().InvertExaltationLineRotationDirections ? -0.2f : 0.2f); Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(2, 0) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, 2) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(-2, 0) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); diff --git a/Projectiles/Typeless/BlackPearl.png b/Projectiles/Typeless/BlackPearl.png new file mode 100644 index 0000000000..5c7aaa722a Binary files /dev/null and b/Projectiles/Typeless/BlackPearl.png differ diff --git a/Projectiles/Typeless/PinkPearl.png b/Projectiles/Typeless/PinkPearl.png new file mode 100644 index 0000000000..2689197f96 Binary files /dev/null and b/Projectiles/Typeless/PinkPearl.png differ diff --git a/Projectiles/Typeless/SandBall.cs b/Projectiles/Typeless/SandBall.cs index 6a43186f50..4e9072fa7d 100644 --- a/Projectiles/Typeless/SandBall.cs +++ b/Projectiles/Typeless/SandBall.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Astral; using CalamityMod.Items.Placeables.SunkenSea; @@ -21,12 +22,121 @@ namespace CalamityMod.Projectiles.Typeless public override int DustType => 108; } + public class EutrophicSandBallFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallEutrophic"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Titanium; + } + + public class DunesandBallFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallDune"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Hive; + } + + public class PolypSandBallFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallPolyp"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Ice_Red; + } + + public class VolcanicSandBallFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallVolcanic"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.t_PearlWood; + } + + public class WhitePearlFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/WhitePearl"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Slush; + } + + public class PinkPearlFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/PinkPearl"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Ice_Pink; + } + + public class BlackPearlFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/BlackPearl"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Lead; + } + public class AstralSandBallGun : SandBall { public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallAstral"; public override int TileType => ModContent.TileType(); public override int ItemType => ModContent.ItemType(); public override int DustType => 108; + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one hits only one target but splits on impact into seeking mini sands + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = 1; + Projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.usesIDStaticNPCImmunity = false; + } + public override bool PreAI() + { + if (Projectile.ai[2] == 1) + { + Projectile.scale = 0.75f; + if (Projectile.ai[1] == 0) + { + Projectile.originalDamage = Projectile.damage; + Projectile.damage = 0; + } + if (Projectile.ai[1] == 30) + { + Projectile.Calamity().conditionalHomingRange = 600; + Projectile.damage = Projectile.originalDamage; + } + } + return base.PreAI(); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.ai[2] != 1) + { + for (var i = 0; i < 4; i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.75f) * Main.rand.NextFloat(0.5f,0.75f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, ai2: 1); + } + } + + public override bool PreKill(int timeLeft) + { + if (Projectile.penetrate == 0) + Projectile.active = false; + return Projectile.active; + } + } public class EutrophicSandBallGun : SandBall @@ -35,6 +145,19 @@ namespace CalamityMod.Projectiles.Typeless public override int TileType => ModContent.TileType(); public override int ItemType => ModContent.ItemType(); public override int DustType => 108; // Weirdly same dusts as Astral + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one hits only one target and does 5 less damage, but inflicts a relatively long stun debuff + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = 1; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + } } public class SulphurousSandBallGun : SandBall @@ -43,6 +166,128 @@ namespace CalamityMod.Projectiles.Typeless public override int TileType => ModContent.TileType(); public override int ItemType => ModContent.ItemType(); // Uses normal sand dust + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one hits only two targets but inflicts Irradiated + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = 2; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 150); + } + } + public class DuneSandBallGun : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallDune"; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Sand; + + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one has much less velocity and no gravity for the first 3 seconds, pierces infinitely, and does 5 extra damage + public override void AI() + { + if (Projectile.ai[1] == 0 ) + { + Projectile.velocity *= 0.5f; + } + if (Main.rand.NextBool()) + { + int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustType); + Main.dust[i].velocity.X *= 0.4f; + Main.dust[i].velocity.Y += Fired ? 0f : Projectile.velocity.Y * 0.5f; + } + + Projectile.ai[1]++; + Projectile.rotation += 0.1f; + if (Projectile.ai[1] >= 180f) + { + Projectile.ai[1] = 180f; + Projectile.velocity.Y += 0.2f; + } + if (Projectile.velocity.Y > 10f) + Projectile.velocity.Y = 10f; + + Point p = Projectile.Center.ToTileCoordinates(); + // Don't check out of bounds + if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) + return; + Tile placer = Main.tile[p.X, p.Y + 1]; + if (placer.HasTile && TileID.Sets.Platforms[placer.TileType] && Projectile.ai[1] >= 60f) + Projectile.Kill(); + + } + } + public class PolypSandBallGun : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallPolyp"; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Sand; + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one has a small homing range and can go through platforms + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = true; + return true; + } + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = 1; + Projectile.Calamity().conditionalHomingRange = 160; + } + } + public class VolcanicSandBallGun : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallVolcanic"; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => -1; + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one fires a shotgun of mini sands, but every sand deals less damage + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.usesIDStaticNPCImmunity = false; + } + public override bool PreAI() + { + if (Projectile.ai[2] == 1) + { + if (Projectile.ai[1] == 0) + { + Projectile.scale = 0.75f; + Projectile.penetrate = 1; + Projectile.timeLeft = 30; + } + } else + { + if (Projectile.ai[1] == 0) + { + for (var i = 0; i < 5; i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f) * 0.75f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, ai2: 1); + Projectile.damage = (int)(Projectile.damage * 0.5f); + + } + } + return base.PreAI(); + } + public override bool PreKill(int timeLeft) + { + if (Projectile.ai[2] == 1) //Baby sands should always vanish without placing blocks + Projectile.active = false; + return Projectile.active; + } } // All the setups go here to prevent mass blocks of copypasting @@ -80,7 +325,7 @@ namespace CalamityMod.Projectiles.Typeless // Using clones will not allow for custom dust types sadly public override void AI() { - if (Main.rand.NextBool()) + if (Main.rand.NextBool() && DustType >= 0) { int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustType); Main.dust[i].velocity.X *= 0.4f; @@ -96,21 +341,19 @@ namespace CalamityMod.Projectiles.Typeless } if (Projectile.velocity.Y > 10f) Projectile.velocity.Y = 10f; + } - Point p = Projectile.Center.ToTileCoordinates(); - // Don't check out of bounds - if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) - return; - Tile placer = Main.tile[p.X, p.Y + 1]; - if (placer.HasTile && TileID.Sets.Platforms[placer.TileType] && Projectile.ai[1] >= 60f) - Projectile.Kill(); + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac); } public override void OnKill(int timeLeft) { Point p = Projectile.Center.ToTileCoordinates(); - // If the sand is dying outside the world border, cancel placing sand. - if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) + // If the sand is dying outside the world border, or having used all of it's pierce, cancel placing sand. + if ( p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) return; Tile placer = Main.tile[p.X, p.Y]; diff --git a/Projectiles/Typeless/SandBallDune.png b/Projectiles/Typeless/SandBallDune.png new file mode 100644 index 0000000000..15c62d95a8 Binary files /dev/null and b/Projectiles/Typeless/SandBallDune.png differ diff --git a/Projectiles/Typeless/SandBallPolyp.png b/Projectiles/Typeless/SandBallPolyp.png new file mode 100644 index 0000000000..531e9d5fc8 Binary files /dev/null and b/Projectiles/Typeless/SandBallPolyp.png differ diff --git a/Projectiles/Typeless/SandBallVolcanic.png b/Projectiles/Typeless/SandBallVolcanic.png new file mode 100644 index 0000000000..8b5fa1bb6d Binary files /dev/null and b/Projectiles/Typeless/SandBallVolcanic.png differ diff --git a/Projectiles/Typeless/WhitePearl.png b/Projectiles/Typeless/WhitePearl.png new file mode 100644 index 0000000000..a6492a5ea8 Binary files /dev/null and b/Projectiles/Typeless/WhitePearl.png differ diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index 619d469e95..5c0256885e 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -962,6 +962,10 @@ namespace CalamityMod.Systems // Enchanted Sword and Terragrim shimmer into each other convert[ItemID.EnchantedSword] = ItemID.Terragrim; convert[ItemID.Terragrim] = ItemID.EnchantedSword; + + // Allow Cascade and Gray Zapinator to be obtained in Hardmode + convert[ItemID.HelFire] = ItemID.Cascade; + convert[ItemID.ZapinatorOrange] = ItemID.ZapinatorGray; } #endregion @@ -1597,6 +1601,7 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.ChaosFish, 5); r.AddTile(TileID.MythrilAnvil); r.Register(); + r.DisableDecraft(); // Sergeant United Shield r = Recipe.Create(ItemID.BouncingShield); diff --git a/Systems/Sound/MusicEventSystem.cs b/Systems/Sound/MusicEventSystem.cs index 1746e62840..3a6d20612e 100644 --- a/Systems/Sound/MusicEventSystem.cs +++ b/Systems/Sound/MusicEventSystem.cs @@ -54,17 +54,17 @@ namespace CalamityMod.Systems } AddEntry("CloneDefeated", "Interlude1", TimeSpan.FromSeconds(214.577d), - () => DownedBossSystem.downedCalamitasClone, () => CalamityClientConfig.Instance.Interlude1); + () => DownedBossSystem.downedCalamitasClone, () => CalamityClientConfig.Instance.Interludes); AddEntry("MLDefeated", "Interlude2", TimeSpan.FromSeconds(191.912d), () => NPC.downedMoonlord, - () => CalamityClientConfig.Instance.Interlude2, outroSilence: TimeSpan.FromSeconds(1f)); + () => CalamityClientConfig.Instance.Interludes, outroSilence: TimeSpan.FromSeconds(1f)); // Alternative Interlude 2 -> AddEntry("MLDefeated", "Interlude2_CutIntro", TimeSpan.FromSeconds(160.989d), // () => NPC.downedMoonlord, () => CalamityClientConfig.Instance.Interlude2, // outroSilence: TimeSpan.FromSeconds(1f)); AddEntry("YharonDefeated", "Interlude3", TimeSpan.FromSeconds(295.932d), - () => DownedBossSystem.downedYharon, () => CalamityClientConfig.Instance.Interlude3); + () => DownedBossSystem.downedYharon, () => CalamityClientConfig.Instance.Interludes); AddEntry("DoGDefeated", "DevourerofGodsEulogy", TimeSpan.FromSeconds(203.620d), () => DownedBossSystem.downedDoG, () => CalamityClientConfig.Instance.DevourerofGodsEulogy, diff --git a/Systems/Tile/BiomeTileCounterSystem.cs b/Systems/Tile/BiomeTileCounterSystem.cs index 01ee1780ba..4baf2a8202 100644 --- a/Systems/Tile/BiomeTileCounterSystem.cs +++ b/Systems/Tile/BiomeTileCounterSystem.cs @@ -10,6 +10,8 @@ using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; using Terraria; using Terraria.ModLoader; +using CalamityMod.Walls; +using Terraria.ID; namespace CalamityMod.Systems { @@ -27,7 +29,7 @@ namespace CalamityMod.Systems public static int ArsenalLabTiles = 0; public static int AbyssTiles = 0; public static int FloralParadiseTiles = 0; - + public static int UndergroundTiles = 0; public static int Layer1Tiles = 0; public static int Layer2Tiles = 0; public static int Layer3Tiles = 0; @@ -46,6 +48,7 @@ namespace CalamityMod.Systems SulphurTiles = 0; AbyssTiles = 0; ArsenalLabTiles = 0; + UndergroundTiles = 0; Layer1Tiles = 0; Layer2Tiles = 0; @@ -58,15 +61,16 @@ namespace CalamityMod.Systems { BrimstoneCragTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaPolypTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaPolypTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaReefsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaBurrowsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaBurrowsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaBasaltTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; AbyssTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SulphurTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; FloralParadiseTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; ArsenalLabTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + UndergroundTiles = tileCounts[TileID.Stone]; Layer1Tiles = tileCounts[ModContent.TileType()]; Layer2Tiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; diff --git a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs index 207c4bc4ea..c0035e5be1 100644 --- a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs +++ b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs @@ -120,26 +120,30 @@ namespace CalamityMod.Systems // Sliced Drawing for (int i = 0; i < sliceLength; i++) { - var drawRect = sliceRects[i]; - drawRect.X += rect.X; - drawRect.Y += rect.Y; + // Calculate the source rectangle for the specific slice from the blend texture sheet + var sourceSliceRect = sliceRects[i]; + sourceSliceRect.X += rect.X; + sourceSliceRect.Y += rect.Y; + + // Calculate the destination position for the slice on the screen + var destinationSlicePos = drawPos + sliceRects[i].Location.ToVector2(); var drawColorVec = (tileLight.ToVector3() + slices[i]) * 0.5f; drawColorVec *= drawData.colorTint.ToVector3(); - // Tile is Actucated, Reduce brightness + // Tile is Actuated, Reduce brightness if (tile.IsActuated) { drawColorVec *= 0.4f; } - // Tile is shine + // Tile is shining if (shouldTileShine) { Main.shine(ref drawColorVec, tileType); } - Main.spriteBatch.Draw(texture, drawPos, rect, new Color(drawColorVec), rotation: 0.0f, origin: default, scale: 1.0f, SpriteEffects.None, layerDepth: 0.0f); + Main.spriteBatch.Draw(texture, destinationSlicePos, sourceSliceRect, new Color(drawColorVec), 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0f); } } } diff --git a/Systems/World/BestiaryRegistrySystem.cs b/Systems/World/BestiaryRegistrySystem.cs index 42b2228f25..94b29f2688 100644 --- a/Systems/World/BestiaryRegistrySystem.cs +++ b/Systems/World/BestiaryRegistrySystem.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Systems ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; - ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCID.LavaSlime]; } } } diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index edfe124d57..03ccf999ab 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -241,11 +241,12 @@ namespace CalamityMod.Systems progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.PolypForest").Value; SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); SunkenSea.PlaceClamDen(sunkenSeaX, sunkenSeaY + 630); + SunkenSea.PlaceGleamingBurrowsGeodes(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.GleamingBurrows").Value; SunkenSea.PlaceTimelessShores(sunkenSeaX, sunkenSeaY); - SunkenSea.PlaceSunkenSeaAmbience(); - SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BasaltGully").Value; + //SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + SunkenSea.PlaceSunkenSeaAmbience(); })); } @@ -531,20 +532,6 @@ namespace CalamityMod.Systems } } - // Fix vanilla's stupidity with Gold Chests being able to have Meteorite Bars in them near the Underworld - if (isGoldChest) - { - for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) - { - if (chest.item[inventoryIndex].type == ItemID.MeteoriteBar) - { - int oldStack = chest.item[inventoryIndex].stack; - chest.item[inventoryIndex].SetDefaults(WorldGen.genRand.NextBool() ? ItemID.PlatinumBar : ItemID.GoldBar); - chest.item[inventoryIndex].stack = oldStack; - } - } - } - // Give Dead Man's Chests better loot. if (isDeadManChest) { diff --git a/Tiles/Merges/AridSoilMerge.cs b/Tiles/Merges/AridSoilMerge.cs new file mode 100644 index 0000000000..d612d6d2ca --- /dev/null +++ b/Tiles/Merges/AridSoilMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class AridSoilMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/AridSoilMerge.png b/Tiles/Merges/AridSoilMerge.png new file mode 100644 index 0000000000..cdd750fcbf Binary files /dev/null and b/Tiles/Merges/AridSoilMerge.png differ diff --git a/Tiles/Merges/BasaltMerge.cs b/Tiles/Merges/BasaltMerge.cs new file mode 100644 index 0000000000..2bfd887153 --- /dev/null +++ b/Tiles/Merges/BasaltMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class BasaltMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/BasaltMerge.png b/Tiles/Merges/BasaltMerge.png new file mode 100644 index 0000000000..a3a1159043 Binary files /dev/null and b/Tiles/Merges/BasaltMerge.png differ diff --git a/Tiles/Merges/DunesandMerge.png b/Tiles/Merges/DunesandMerge.png index afa839e413..53c2ac41f4 100644 Binary files a/Tiles/Merges/DunesandMerge.png and b/Tiles/Merges/DunesandMerge.png differ diff --git a/Tiles/Merges/PolypSandMerge.png b/Tiles/Merges/PolypSandMerge.png index 9b36426426..46df8a4b5b 100644 Binary files a/Tiles/Merges/PolypSandMerge.png and b/Tiles/Merges/PolypSandMerge.png differ diff --git a/Tiles/Merges/RunestoneMerge.png b/Tiles/Merges/RunestoneMerge.png index 084eb1d80a..ed589b1070 100644 Binary files a/Tiles/Merges/RunestoneMerge.png and b/Tiles/Merges/RunestoneMerge.png differ diff --git a/Tiles/Merges/ScarletSeaGrassTileMerge.png b/Tiles/Merges/ScarletSeaGrassTileMerge.png index 9b36426426..46df8a4b5b 100644 Binary files a/Tiles/Merges/ScarletSeaGrassTileMerge.png and b/Tiles/Merges/ScarletSeaGrassTileMerge.png differ diff --git a/Tiles/Merges/ShellstoneMerge.png b/Tiles/Merges/ShellstoneMerge.png index 30e9733f65..1b4e76e78e 100644 Binary files a/Tiles/Merges/ShellstoneMerge.png and b/Tiles/Merges/ShellstoneMerge.png differ diff --git a/Tiles/Merges/SuperheatedObsidian.png b/Tiles/Merges/SuperheatedObsidian.png new file mode 100644 index 0000000000..37c2a0baae Binary files /dev/null and b/Tiles/Merges/SuperheatedObsidian.png differ diff --git a/Tiles/Merges/VolcanicSandMerge.png b/Tiles/Merges/VolcanicSandMerge.png index 2f351b6d1a..860fd97de2 100644 Binary files a/Tiles/Merges/VolcanicSandMerge.png and b/Tiles/Merges/VolcanicSandMerge.png differ diff --git a/Tiles/SunkenSea/Ambient/BrainCoral.cs b/Tiles/SunkenSea/Ambient/BrainCoral.cs index c115b322ca..eaf4e4c8ce 100644 --- a/Tiles/SunkenSea/Ambient/BrainCoral.cs +++ b/Tiles/SunkenSea/Ambient/BrainCoral.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Typeless; +using System; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -27,6 +29,26 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { num = fail ? 1 : 3; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + float glowbrightness = 1f; + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + float glowspeed = (float)(Main.timeForVisualEffects * 0.01); + glowbrightness *= MathF.Sin(i / 60f + glowspeed); + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/BrainCoral").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White * glowbrightness; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } public override void NearbyEffects(int i, int j, bool closer) { diff --git a/Tiles/SunkenSea/Ambient/DepthVines.cs b/Tiles/SunkenSea/Ambient/DepthVines.cs index 01c06706dd..35dc66eb9b 100644 --- a/Tiles/SunkenSea/Ambient/DepthVines.cs +++ b/Tiles/SunkenSea/Ambient/DepthVines.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileNoAttach[Type] = true; TileID.Sets.IsVine[Type] = true; TileID.Sets.VineThreads[Type] = true; - AddMapEntry(new Color(41, 97, 126)); + AddMapEntry(new Color(48, 106, 100)); DustType = DustID.Grass; HitSound = SoundID.Grass; } @@ -45,9 +45,10 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void RandomUpdate(int i, int j) { Tile tileBelow = Framing.GetTileSafely(i, j + 1); - if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) + Tile tile = Framing.GetTileSafely(i, j); + if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) { - bool PlaceVine = false; + bool PlaceVine = false; int Test = j; while (Test > j - 10) { @@ -56,7 +57,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { break; } - else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) + else if (!testTile.HasTile || testTile.TileType != ModContent.TileType() && tile.LiquidType == LiquidID.Water) { Test--; continue; @@ -74,6 +75,8 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); } } + + } } } diff --git a/Tiles/SunkenSea/Ambient/GilHerb.cs b/Tiles/SunkenSea/Ambient/GilHerb.cs index a3b6f3b65d..3d3b6415cc 100644 --- a/Tiles/SunkenSea/Ambient/GilHerb.cs +++ b/Tiles/SunkenSea/Ambient/GilHerb.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileNoAttach[Type] = true; TileID.Sets.IsVine[Type] = true; TileID.Sets.VineThreads[Type] = true; - AddMapEntry(new Color(41, 97, 126)); + AddMapEntry(new Color(124, 67, 197)); DustType = DustID.Grass; HitSound = SoundID.Grass; } diff --git a/Tiles/SunkenSea/Ambient/LargeShoresFlower.cs b/Tiles/SunkenSea/Ambient/LargeShoresFlower.cs new file mode 100644 index 0000000000..50bdf1c778 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/LargeShoresFlower.cs @@ -0,0 +1,68 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class LargeShoresFlower : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileLighted[Type] = true; + + TileID.Sets.FramesOnKillWall[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16 }; + TileObjectData.newTile.Origin = new Point16(1, 1); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + + TileObjectData.addTile(Type); + + AddMapEntry(new Color(20, 100, 220)); + DustType = DustID.MagicMirror; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float pulse = 0.95f + 0.15f * (0.5f + 0.5f * (float)System.Math.Sin(Main.GlobalTimeWrappedHourly * 4.2f)); + r = 0.1f * pulse; + g = 0.3f * pulse; + b = 0.8f * pulse; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + float pulse = 0.95f + 0.15f * (float)System.Math.Sin(Main.GlobalTimeWrappedHourly * 4.2f); + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/LargeShoresFlower").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White * pulse; + Tile trackTile = Main.tile[i, j]; + + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/LargeShoresFlower_Center").Value, i, j, 2); + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LargeShoresFlower.png b/Tiles/SunkenSea/Ambient/LargeShoresFlower.png new file mode 100644 index 0000000000..9c040277a7 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LargeShoresFlower.png differ diff --git a/Tiles/SunkenSea/Ambient/LargeShoresFlower_Center.png b/Tiles/SunkenSea/Ambient/LargeShoresFlower_Center.png new file mode 100644 index 0000000000..b907c78161 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LargeShoresFlower_Center.png differ diff --git a/Tiles/SunkenSea/Ambient/LimeslabPile.png b/Tiles/SunkenSea/Ambient/LimeslabPile.png deleted file mode 100644 index 68e89cff52..0000000000 Binary files a/Tiles/SunkenSea/Ambient/LimeslabPile.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/MediumDunesandPile.cs b/Tiles/SunkenSea/Ambient/MediumDunesandPile.cs new file mode 100644 index 0000000000..909aee6412 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/MediumDunesandPile.cs @@ -0,0 +1,42 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class MediumDunesandPile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + + TileObjectData.addTile(Type); + + AddMapEntry(new Color(185, 104, 80)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/MediumDunesandPile.png b/Tiles/SunkenSea/Ambient/MediumDunesandPile.png new file mode 100644 index 0000000000..e58ff96cd4 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/MediumDunesandPile.png differ diff --git a/Tiles/SunkenSea/Ambient/MediumLimeslabPile.png b/Tiles/SunkenSea/Ambient/MediumLimeslabPile.png deleted file mode 100644 index e772b931db..0000000000 Binary files a/Tiles/SunkenSea/Ambient/MediumLimeslabPile.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/MediumShorePile.cs b/Tiles/SunkenSea/Ambient/MediumShorePile.cs new file mode 100644 index 0000000000..4743988be3 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/MediumShorePile.cs @@ -0,0 +1,42 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class MediumShorePile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + + TileObjectData.addTile(Type); + + AddMapEntry(new Color(158, 129, 177)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/MediumShorePile.png b/Tiles/SunkenSea/Ambient/MediumShorePile.png new file mode 100644 index 0000000000..bc84d45181 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/MediumShorePile.png differ diff --git a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs index 51cb82f638..0604b3e416 100644 --- a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs +++ b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileNoSunLight[Type] = false; TileID.Sets.IsVine[Type] = true; TileID.Sets.VineThreads[Type] = true; - AddMapEntry(new Color(96, 109, 154)); + AddMapEntry(new Color(76, 133, 191)); DustType = DustID.Grass; HitSound = SoundID.Grass; } diff --git a/Tiles/SunkenSea/Ambient/ShellstonePiles.png b/Tiles/SunkenSea/Ambient/ShellstonePiles.png deleted file mode 100644 index b4f58858c3..0000000000 Binary files a/Tiles/SunkenSea/Ambient/ShellstonePiles.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/ShorePile.cs b/Tiles/SunkenSea/Ambient/ShorePile.cs new file mode 100644 index 0000000000..4dd8fca547 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/ShorePile.cs @@ -0,0 +1,45 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Microsoft.Xna.Framework; +using Terraria.GameContent; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class ShorePileBase : ModTile + { + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/ShorePile"; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + DustType = DustID.Stone; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + + + AddMapEntry(new Color(189, 120, 94)); + DustType = 96; + HitSound = SoundID.Dig; + } + } + + public class ShorePile : ShorePileBase + { + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + + TileID.Sets.BreakableWhenPlacing[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + + TileObjectData.GetTileData(Type, 0).LavaDeath = false; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/ShorePile.png b/Tiles/SunkenSea/Ambient/ShorePile.png new file mode 100644 index 0000000000..b9d0c26efd Binary files /dev/null and b/Tiles/SunkenSea/Ambient/ShorePile.png differ diff --git a/Tiles/SunkenSea/Ambient/ShoresFlower.cs b/Tiles/SunkenSea/Ambient/ShoresFlower.cs new file mode 100644 index 0000000000..5c276682b0 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/ShoresFlower.cs @@ -0,0 +1,75 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class ShoresFlower : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileLighted[Type] = true; + + TileID.Sets.FramesOnKillWall[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16 }; + + TileObjectData.newTile.AnchorWall = true; + TileObjectData.newTile.AnchorTop = AnchorData.Empty; + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorLeft = AnchorData.Empty; + TileObjectData.newTile.AnchorRight = AnchorData.Empty; + + TileObjectData.newTile.Origin = new Point16(1, 1); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + + TileObjectData.addTile(Type); + + AddMapEntry(new Color(20, 100, 220)); + DustType = DustID.MagicMirror; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float pulse = 0.95f + 0.15f * (0.5f + 0.5f * (float)System.Math.Sin(Main.GlobalTimeWrappedHourly * 4.2f)); + r = 0.1f * pulse; + g = 0.3f * pulse; + b = 0.8f * pulse; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + float pulse = 0.95f + 0.15f * ((float)System.Math.Sin(Main.GlobalTimeWrappedHourly * 4.2f)); + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/ShoresFlower").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White * pulse; + Tile trackTile = Main.tile[i, j]; + + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/ShoresFlower_Center").Value, i, j, 2); + } + } +} diff --git a/Tiles/SunkenSea/Ambient/ShoresFlower.png b/Tiles/SunkenSea/Ambient/ShoresFlower.png new file mode 100644 index 0000000000..6ae51dd2ac Binary files /dev/null and b/Tiles/SunkenSea/Ambient/ShoresFlower.png differ diff --git a/Tiles/SunkenSea/Ambient/ShoresFlower_Center.png b/Tiles/SunkenSea/Ambient/ShoresFlower_Center.png new file mode 100644 index 0000000000..ccc3c4061c Binary files /dev/null and b/Tiles/SunkenSea/Ambient/ShoresFlower_Center.png differ diff --git a/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs b/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs index 85db49466c..b666e44459 100644 --- a/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs +++ b/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Typeless; +using System; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -27,6 +29,26 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { num = fail ? 1 : 3; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + float glowbrightness = 1f; + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + float glowspeed = (float)(Main.timeForVisualEffects * 0.01); + glowbrightness *= MathF.Sin(i / 60f + glowspeed); + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/SmallBrainCoral").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White * glowbrightness; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } public override void NearbyEffects(int i, int j, bool closer) { diff --git a/Tiles/SunkenSea/Ambient/SmallLimeslabPile.png b/Tiles/SunkenSea/Ambient/SmallLimeslabPile.png deleted file mode 100644 index b3849fe572..0000000000 Binary files a/Tiles/SunkenSea/Ambient/SmallLimeslabPile.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.cs b/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.cs new file mode 100644 index 0000000000..0341b9a4f4 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.cs @@ -0,0 +1,45 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Microsoft.Xna.Framework; +using Terraria.GameContent; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class SmallLimestoneCobblePileBase : ModTile + { + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile"; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + DustType = DustID.Stone; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + + + AddMapEntry(new Color(174, 120, 91)); + DustType = 96; + HitSound = SoundID.Dig; + } + } + + public class SmallLimestoneCobblePile : SmallLimestoneCobblePileBase + { + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + + TileID.Sets.BreakableWhenPlacing[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + + TileObjectData.GetTileData(Type, 0).LavaDeath = false; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.png b/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.png new file mode 100644 index 0000000000..21b14f9f2c Binary files /dev/null and b/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.png differ diff --git a/Tiles/SunkenSea/Ambient/TableCoral.cs b/Tiles/SunkenSea/Ambient/TableCoral.cs index 8d37481116..bce49ca9f4 100644 --- a/Tiles/SunkenSea/Ambient/TableCoral.cs +++ b/Tiles/SunkenSea/Ambient/TableCoral.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient TileObjectData.addTile(Type); DustType = 253; - AddMapEntry(new Color(54, 69, 72)); + AddMapEntry(new Color(23, 56, 75)); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/SunkenSea/Ambient/TableCoralLeft.cs b/Tiles/SunkenSea/Ambient/TableCoralLeft.cs index 7eedd3acc3..c8ce04485a 100644 --- a/Tiles/SunkenSea/Ambient/TableCoralLeft.cs +++ b/Tiles/SunkenSea/Ambient/TableCoralLeft.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient TileObjectData.addTile(Type); DustType = 253; - AddMapEntry(new Color(54, 69, 72)); + AddMapEntry(new Color(23, 56, 75)); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/SunkenSea/AridSoil.cs b/Tiles/SunkenSea/AridSoil.cs index 789e2915dc..c8cd653bfe 100644 --- a/Tiles/SunkenSea/AridSoil.cs +++ b/Tiles/SunkenSea/AridSoil.cs @@ -21,15 +21,10 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - Main.tileShine2[Type] = true; + Main.tileShine2[Type] = false; DustType = DustID.Hive; - AddMapEntry(new Color(171, 101, 87)); - - //Stone merges - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + AddMapEntry(new Color(203, 123, 107)); //Sand merges this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); diff --git a/Tiles/SunkenSea/AridSoil.png b/Tiles/SunkenSea/AridSoil.png index e03a0d0ed3..bdb1c641e5 100644 Binary files a/Tiles/SunkenSea/AridSoil.png and b/Tiles/SunkenSea/AridSoil.png differ diff --git a/Tiles/SunkenSea/Basalt.cs b/Tiles/SunkenSea/Basalt.cs index 54afa0857e..d80056fa42 100644 --- a/Tiles/SunkenSea/Basalt.cs +++ b/Tiles/SunkenSea/Basalt.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileShine2[Type] = false; - Main.tileBlendAll[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); @@ -58,55 +57,6 @@ namespace CalamityMod.Tiles.SunkenSea } public override void RandomUpdate(int i, int j) { - Tile tUP = Main.tile[i, j - 1]; - Tile tDOWN = Main.tile[i, j + 1]; - Tile tLEFT = Main.tile[i - 1, j]; - Tile tRIGHT = Main.tile[i + 1, j]; - Tile tUPLEFT = Main.tile[i - 1, j - 1]; - Tile tDOWNLEFT = Main.tile[i - 1, j + 1]; - Tile tUPRIGHT = Main.tile[i + 1, j - 1]; - Tile tDOWNRIGHT = Main.tile[i + 1, j + 1]; - if (tUP.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tUP.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tDOWN.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tDOWN.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tLEFT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tRIGHT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - - if (tUPLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tUPLEFT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tDOWNLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tDOWNLEFT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tUPRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tUPRIGHT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tDOWNRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tDOWNRIGHT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } Dust dust; dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, DustID.Smoke, 0f, -1.9069767f, 195, new Color(255, 255, 255), 1f)]; dust.noGravity = false; diff --git a/Tiles/SunkenSea/BlackPearlPile.cs b/Tiles/SunkenSea/BlackPearlPile.cs index 1a9223e6af..189d5dc4b8 100644 --- a/Tiles/SunkenSea/BlackPearlPile.cs +++ b/Tiles/SunkenSea/BlackPearlPile.cs @@ -1,10 +1,12 @@ using System; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Sounds; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -29,9 +31,11 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = CommonCalamitySounds.VoidstoneMine; DustType = DustID.Lead; - AddMapEntry(new Color(29, 33, 38)); + AddMapEntry(new Color(48, 55, 63)); TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 15); //Stone merges this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); diff --git a/Tiles/SunkenSea/CyanCoral.cs b/Tiles/SunkenSea/CyanCoral.cs index 795f8b51e4..e1e77df893 100644 --- a/Tiles/SunkenSea/CyanCoral.cs +++ b/Tiles/SunkenSea/CyanCoral.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; DustType = DustID.HallowSpray; - AddMapEntry(new Color(92, 168, 198)); + AddMapEntry(new Color(109, 190, 221)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; diff --git a/Tiles/SunkenSea/Dunesand.cs b/Tiles/SunkenSea/Dunesand.cs index e9c49ead2d..9493a12f8f 100644 --- a/Tiles/SunkenSea/Dunesand.cs +++ b/Tiles/SunkenSea/Dunesand.cs @@ -1,6 +1,8 @@ -using CalamityMod.Systems; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -22,10 +24,19 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - Main.tileShine2[Type] = true; + Main.tileShine2[Type] = false; DustType = DustID.Hive; - AddMapEntry(new Color(206, 124, 97)); + AddMapEntry(new Color(231, 135, 100)); + + Main.tileSand[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileID.Sets.Suffocate[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Conversion.Sand[Type] = true; + TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 10); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); diff --git a/Tiles/SunkenSea/Dunesand.png b/Tiles/SunkenSea/Dunesand.png index f6ad7b21b3..2ff9dbac71 100644 Binary files a/Tiles/SunkenSea/Dunesand.png and b/Tiles/SunkenSea/Dunesand.png differ diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 0abb684e97..a695859acc 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; @@ -33,7 +34,16 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.Titanium; - AddMapEntry(new Color(163, 194, 212)); + AddMapEntry(new Color(157, 183, 206)); + + Main.tileSand[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileID.Sets.Suffocate[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Conversion.Sand[Type] = true; + TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 5); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.cs b/Tiles/SunkenSea/HardenedEutrophicSand.cs index 957214a8c7..380e2cc7e0 100644 --- a/Tiles/SunkenSea/HardenedEutrophicSand.cs +++ b/Tiles/SunkenSea/HardenedEutrophicSand.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.Titanium; - AddMapEntry(new Color(61, 151, 194)); + AddMapEntry(new Color(66, 162, 209)); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); @@ -56,17 +56,6 @@ namespace CalamityMod.Tiles.SunkenSea if (!up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { - //brain corals - if (WorldGen.genRand.NextBool(18)) - { - ushort[] BrainCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - ushort newObject = Main.rand.Next(BrainCorals); - - WorldGen.PlaceObject(i, j - 1, newObject, true); - NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); - } - //tube corals if (WorldGen.genRand.NextBool(8)) { diff --git a/Tiles/SunkenSea/LimeCoral.cs b/Tiles/SunkenSea/LimeCoral.cs index 3bf70a96fd..0abae7fa80 100644 --- a/Tiles/SunkenSea/LimeCoral.cs +++ b/Tiles/SunkenSea/LimeCoral.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; DustType = DustID.Terra; - AddMapEntry(new Color(139, 206, 56)); + AddMapEntry(new Color(176, 242, 96)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; diff --git a/Tiles/SunkenSea/Limestone.cs b/Tiles/SunkenSea/Limestone.cs index fc73aec080..ea405e8d98 100644 --- a/Tiles/SunkenSea/Limestone.cs +++ b/Tiles/SunkenSea/Limestone.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; DustType = DustID.Pot; - AddMapEntry(new Color(206, 166, 142)); + AddMapEntry(new Color(184, 138, 113)); //Stone merges this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); diff --git a/Tiles/SunkenSea/LimestoneCobble.cs b/Tiles/SunkenSea/LimestoneCobble.cs index 5ac2b5fd70..e91b859ac6 100644 --- a/Tiles/SunkenSea/LimestoneCobble.cs +++ b/Tiles/SunkenSea/LimestoneCobble.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; DustType = DustID.Pot; - AddMapEntry(new Color(154, 119, 119)); + AddMapEntry(new Color(200, 120, 101)); //Stone merges this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); diff --git a/Tiles/SunkenSea/MagentaCoral.cs b/Tiles/SunkenSea/MagentaCoral.cs index 483238fafe..7368068537 100644 --- a/Tiles/SunkenSea/MagentaCoral.cs +++ b/Tiles/SunkenSea/MagentaCoral.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; DustType = DustID.Ice_Pink; - AddMapEntry(new Color(206, 56, 123)); + AddMapEntry(new Color(253, 112, 186)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal.cs b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs index 97f84eec2c..02cbdf969f 100644 --- a/Tiles/SunkenSea/MediumSeaPrismCrystal.cs +++ b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.SunkenSea MinPick = 55; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + AddMapEntry(new Color(53, 136, 207), CalamityUtils.GetItemName()); // Attach to ground TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); diff --git a/Tiles/SunkenSea/Mire.cs b/Tiles/SunkenSea/Mire.cs index cd3711da53..3776206d23 100644 --- a/Tiles/SunkenSea/Mire.cs +++ b/Tiles/SunkenSea/Mire.cs @@ -15,12 +15,11 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileBlendAll[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - Main.tileShine2[Type] = true; + Main.tileShine2[Type] = false; DustType = DustID.Hive; AddMapEntry(new Color(71, 38, 30)); @@ -35,6 +34,8 @@ namespace CalamityMod.Tiles.SunkenSea this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AridSoilMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/DunesandMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 112f32cfe5..01569563b2 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; DustType = DustID.BlueMoss; - AddMapEntry(new Color(17, 53, 77)); + AddMapEntry(new Color(28, 72, 96)); HitSound = SoundID.Tink; this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); diff --git a/Tiles/SunkenSea/OrangeCoral.cs b/Tiles/SunkenSea/OrangeCoral.cs index e9d21cfd6d..fe93c8e402 100644 --- a/Tiles/SunkenSea/OrangeCoral.cs +++ b/Tiles/SunkenSea/OrangeCoral.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; DustType = DustID.Pixie; - AddMapEntry(Color.Orange); + AddMapEntry(new Color(255, 144, 63)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; diff --git a/Tiles/SunkenSea/PinkPearlPile.cs b/Tiles/SunkenSea/PinkPearlPile.cs index 2ef85911ee..1bc2ac98bd 100644 --- a/Tiles/SunkenSea/PinkPearlPile.cs +++ b/Tiles/SunkenSea/PinkPearlPile.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Sounds; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss; @@ -33,6 +34,10 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 15); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); diff --git a/Tiles/SunkenSea/PolypSand.cs b/Tiles/SunkenSea/PolypSand.cs index 4910ac35f5..a92a145606 100644 --- a/Tiles/SunkenSea/PolypSand.cs +++ b/Tiles/SunkenSea/PolypSand.cs @@ -1,10 +1,12 @@ -using CalamityMod.Systems; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -29,7 +31,16 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.Ice_Red; - AddMapEntry(new Color(221, 180, 182)); + AddMapEntry(new Color(215, 170, 170)); + + Main.tileSand[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileID.Sets.Suffocate[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Conversion.Sand[Type] = true; + TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 10); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); diff --git a/Tiles/SunkenSea/Runestone.cs b/Tiles/SunkenSea/Runestone.cs index b89e465acd..fd3e738726 100644 --- a/Tiles/SunkenSea/Runestone.cs +++ b/Tiles/SunkenSea/Runestone.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; DustType = DustID.Pot; - AddMapEntry(new Color(151, 91, 81)); - Main.tileShine2[Type] = true; + AddMapEntry(new Color(162, 98, 85)); + Main.tileShine2[Type] = false; TileID.Sets.CanBeDugByShovel[Type] = true; @@ -38,6 +38,7 @@ namespace CalamityMod.Tiles.SunkenSea this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AridSoilMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); diff --git a/Tiles/SunkenSea/Runestone.png b/Tiles/SunkenSea/Runestone.png index f2ace3dbb4..b247e5fac6 100644 Binary files a/Tiles/SunkenSea/Runestone.png and b/Tiles/SunkenSea/Runestone.png differ diff --git a/Tiles/SunkenSea/ScarletSeaGrassTile.cs b/Tiles/SunkenSea/ScarletSeaGrassTile.cs index b93be293bd..bc551c75fa 100644 --- a/Tiles/SunkenSea/ScarletSeaGrassTile.cs +++ b/Tiles/SunkenSea/ScarletSeaGrassTile.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.SunkenSea.Ambient; @@ -6,6 +7,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +35,16 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.Hive; - AddMapEntry(new Color(187, 43, 44)); + AddMapEntry(new Color(216, 50, 50)); + + Main.tileSand[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileID.Sets.Suffocate[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Conversion.Sand[Type] = true; + TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 15); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs index 8c008a9ff8..76e66126d8 100644 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ b/Tiles/SunkenSea/SeaPrismCrystals.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = true; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + AddMapEntry(new Color(53, 136, 207), CalamityUtils.GetItemName()); HitSound = SoundID.Item27; DustType = 67; Main.tileSpelunker[Type] = true; diff --git a/Tiles/SunkenSea/Shellstone.cs b/Tiles/SunkenSea/Shellstone.cs index 6efd98b21d..5924abee9d 100644 --- a/Tiles/SunkenSea/Shellstone.cs +++ b/Tiles/SunkenSea/Shellstone.cs @@ -25,7 +25,16 @@ namespace CalamityMod.Tiles.SunkenSea DustType = DustID.CorruptPlants; AddMapEntry(new Color(123, 127, 170)); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/SuperheatedObsidian.cs b/Tiles/SunkenSea/SuperheatedObsidian.cs new file mode 100644 index 0000000000..6f6d521783 --- /dev/null +++ b/Tiles/SunkenSea/SuperheatedObsidian.cs @@ -0,0 +1,119 @@ +using System; +using CalamityMod.Sounds; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class SuperheatedObsidian : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLighted[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; + + //Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = true; + + HitSound = CommonCalamitySounds.VoidstoneMine; + DustType = DustID.Slush; + AddMapEntry(new Color(67, 61, 91)); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/BasaltMerge"); + + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + + private static float GetFade1(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + } + + private static float GetFade2(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + float transparency = 1f; + + // Must be set here + Main.tileBlockLight[Type] = false; + + Texture2D tex = ModContent.Request(Texture + "_Tile").Value; + + Tile tile = Main.tile[i, j]; + int xPos = i % 1; + int yPos = j % 1; + int frameXOffset = xPos * 1; + int frameYOffset = yPos * 1; + Rectangle frame = new Rectangle(tile.TileFrameX + frameXOffset, tile.TileFrameY + frameYOffset, 16, 16); + + Color color = Lighting.GetColor(i, j) * transparency; + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, color, false), default); + + //IF this glint effect below runs poorly on lower end PC's we should keep it as a setting for those with good PC's + + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; + Texture2D GlintTex = ModContent.Request(Texture + "_Glint").Value; + + Vector2 glintDir = new Vector2(1f, 1f); + glintDir.Normalize(); + + Vector2 screenPos = position; + + float projection = Vector2.Dot(screenPos, glintDir); + + // this sets the length between the glints diagonally + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + float[] beamCenters = new float[] + { + screenDiagonalLength * 0.53f, // upper glint + screenDiagonalLength * 0.63f, // middle glint + screenDiagonalLength * 0.73f // lower glint + }; + + float stripeWidth = 100f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + + if (strength > 0f) + { + spriteBatch.Draw(GlintTex, position, frame, (Lighting.GetColor(i, j)) * (strength * 1f), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + return true; + } + } +} diff --git a/Tiles/SunkenSea/SuperheatedObsidian.png b/Tiles/SunkenSea/SuperheatedObsidian.png new file mode 100644 index 0000000000..9fc5ba9d95 Binary files /dev/null and b/Tiles/SunkenSea/SuperheatedObsidian.png differ diff --git a/Tiles/SunkenSea/SuperheatedObsidian_Glint.png b/Tiles/SunkenSea/SuperheatedObsidian_Glint.png new file mode 100644 index 0000000000..dba241c470 Binary files /dev/null and b/Tiles/SunkenSea/SuperheatedObsidian_Glint.png differ diff --git a/Tiles/SunkenSea/SuperheatedObsidian_Tile.png b/Tiles/SunkenSea/SuperheatedObsidian_Tile.png new file mode 100644 index 0000000000..63b6ac62c8 Binary files /dev/null and b/Tiles/SunkenSea/SuperheatedObsidian_Tile.png differ diff --git a/Tiles/SunkenSea/VolcanicSand.cs b/Tiles/SunkenSea/VolcanicSand.cs index b2beb345d4..e0c17c2c33 100644 --- a/Tiles/SunkenSea/VolcanicSand.cs +++ b/Tiles/SunkenSea/VolcanicSand.cs @@ -1,6 +1,8 @@ -using CalamityMod.Systems; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -23,11 +25,32 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.t_PearlWood; + AddMapEntry(new Color(102, 101, 106)); + Main.tileSand[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileID.Sets.Suffocate[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Conversion.Sand[Type] = true; + TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 10); + + //Stone merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -41,55 +64,6 @@ namespace CalamityMod.Tiles.SunkenSea } public override void RandomUpdate(int i, int j) { - Tile tUP = Main.tile[i, j - 1]; - Tile tDOWN = Main.tile[i, j + 1]; - Tile tLEFT = Main.tile[i - 1, j]; - Tile tRIGHT = Main.tile[i + 1, j]; - Tile tUPLEFT = Main.tile[i - 1, j - 1]; - Tile tDOWNLEFT = Main.tile[i - 1, j + 1]; - Tile tUPRIGHT = Main.tile[i + 1, j - 1]; - Tile tDOWNRIGHT = Main.tile[i + 1, j + 1]; - if (tUP.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tUP.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tDOWN.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tDOWN.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tLEFT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tRIGHT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - - if (tUPLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tUPLEFT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tDOWNLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tDOWNLEFT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tUPRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tUPRIGHT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } - if (tDOWNRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) - { - tDOWNRIGHT.LiquidAmount = 0; - WorldGen.SquareTileFrame(i, j); - } Dust dust; dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, DustID.Smoke, 0f, -1.9069767f, 195, new Color(255, 255, 255), 1f)]; dust.noGravity = false; diff --git a/Tiles/SunkenSea/VolcanicSand.png b/Tiles/SunkenSea/VolcanicSand.png index 624e5b075c..1be4406780 100644 Binary files a/Tiles/SunkenSea/VolcanicSand.png and b/Tiles/SunkenSea/VolcanicSand.png differ diff --git a/Tiles/SunkenSea/WhitePearlPile.cs b/Tiles/SunkenSea/WhitePearlPile.cs index 6d01cbef09..467d779d58 100644 --- a/Tiles/SunkenSea/WhitePearlPile.cs +++ b/Tiles/SunkenSea/WhitePearlPile.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Sounds; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss; @@ -32,6 +33,10 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 15); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); diff --git a/Tiles/SunkenSea/YellowCoral.cs b/Tiles/SunkenSea/YellowCoral.cs index 1bb6bbad74..37eb470bfb 100644 --- a/Tiles/SunkenSea/YellowCoral.cs +++ b/Tiles/SunkenSea/YellowCoral.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; DustType = DustID.Firework_Yellow; - AddMapEntry(new Color(198, 169, 24)); + AddMapEntry(new Color(238, 207, 37)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; diff --git a/UI/DialogueDisplay/DialogueDisplayDebugItem.cs b/UI/DialogueDisplay/DialogueDisplayDebugItem.cs index 68fd8d5325..ad53038fe6 100644 --- a/UI/DialogueDisplay/DialogueDisplayDebugItem.cs +++ b/UI/DialogueDisplay/DialogueDisplayDebugItem.cs @@ -20,10 +20,12 @@ namespace CalamityMod.UI.DialogueDisplay } public override bool? UseItem(Player player) { - if (DialogueDisplayUI.Dialogues.ContainsKey("OceanBlue")) - DialogueDisplaySystem.ProgressDialogue("OceanBlue"); + int slot = DialogueDisplaySystem.GetSlot("OceanBlue"); + + if (slot != -1) + DialogueDisplaySystem.ProgressDialogue(slot); else - DialogueDisplaySystem.StartDialogue("OceanBlue", Main.npc.First(n => n.active), -1, effects: new WhisperingPearlEffects()); + DialogueDisplaySystem.StartDialogue("OceanBlue", player.Center, 0, -1, effects: new WhisperingPearlEffects()); return true; } diff --git a/UI/DialogueDisplay/DialogueDisplayUI.cs b/UI/DialogueDisplay/DialogueDisplayUI.cs index 8a8c51b0f3..8705c674f2 100644 --- a/UI/DialogueDisplay/DialogueDisplayUI.cs +++ b/UI/DialogueDisplay/DialogueDisplayUI.cs @@ -24,99 +24,98 @@ namespace CalamityMod.UI.DialogueDisplay { internal class DialogueDisplayUI : UIState { - internal static readonly Dictionary Dialogues = []; - internal static readonly Dictionary DialogueEntities = []; - internal static readonly Dictionary DialogueUptimes = []; - internal static readonly List DialoguesToRemove = []; + internal static readonly Dictionary Dialogues = []; + internal static readonly List DialoguesToRemove = []; public override void Update(GameTime gameTime) { - foreach (string key in DialoguesToRemove) + foreach (int index in DialoguesToRemove) { - RemoveChild(Dialogues[key].ui); - Dialogues.Remove(key); - DialogueEntities.Remove(key); - DialogueUptimes.Remove(key); + RemoveChild(Dialogues[index].ui); + Dialogues.Remove(index); } DialoguesToRemove.Clear(); - foreach (var pair in DialogueEntities) - { - if (pair.Value != null && pair.Value.active) - Dialogues[pair.Key].ui.Position = pair.Value.Center; - else - Dialogues[pair.Key].ui.ClosingDialogue = true; - } - - foreach (var pair in DialogueUptimes) - { - if (Dialogues[pair.Key].ui.Uptime >= pair.Value) - { - if (Dialogues[pair.Key].ui.ProgressDialogue) - Dialogues[pair.Key].ui.SwitchingPage = true; - else - Dialogues[pair.Key].ui.ClosingDialogue = true; - } - } - foreach (var pair in Dialogues) { - float distFromSource = 0; - DialogueDisplay dialogue = pair.Value.ui; - DialogueTextData data = pair.Value.data; - if (dialogue.DisplayEffects.FadeWhenTooFar) + int slot = pair.Key; + var dialog = pair.Value; + + DialogueDisplay ui = dialog.ui; + DialogueTextData data = dialog.data; + + if (ui.DisplayEffects.FadeWhenTooFar) { - distFromSource = Vector2.Distance(Main.LocalPlayer.Center, dialogue.Position); + float distFromSource = Vector2.Distance(Main.LocalPlayer.Center, ui.Position); // If the player is too far, cancel the dialogue - if (distFromSource > dialogue.DisplayEffects.FadeBuffer + dialogue.DisplayEffects.FadeDistance) + if (distFromSource > ui.DisplayEffects.FadeBuffer + ui.DisplayEffects.FadeDistance) { - DialoguesToRemove.Add(pair.Key); + DialoguesToRemove.Add(slot); continue; } } - if (dialogue.DialoguePage.Event != null) + if (dialog.entity != null) { - if (dialogue.DialoguePage.Event.IsOver) + if (dialog.entity.active) + dialog.ui.Position = dialog.entity.Center; + else + dialog.ui.ClosingDialogue = true; + } + + if (dialog.upTime != -1) + { + if (ui.Uptime >= dialog.upTime) { - if (!dialogue.ProgressDialogue) - DialoguesToRemove.Add(pair.Key); + if (ui.ProgressDialogue) + ui.SwitchingPage = true; + else + ui.ClosingDialogue = true; + } + } + + if (ui.DialoguePage.Event != null) + { + if (ui.DialoguePage.Event.IsOver) + { + if (!ui.ProgressDialogue) + DialoguesToRemove.Add(slot); else { if (++data.Page >= data.PageCount) - DialoguesToRemove.Add(pair.Key); + DialoguesToRemove.Add(slot); else { - dialogue.DialoguePage = data.Pages[data.Page]; - dialogue.SwitchingPage = false; - dialogue.SwitchCounter = 0; + ui.DialoguePage = data.Pages[data.Page]; + ui.SwitchingPage = false; + ui.SwitchCounter = 0; Activate(); } } return; } } - if (dialogue.Switching) + if (ui.Switching) { - if (dialogue.SwitchCounter >= dialogue.DisplayEffects.TimeToDisappear) + if (ui.SwitchCounter >= ui.DisplayEffects.TimeToDisappear) { - if (dialogue.ClosingDialogue || !dialogue.ProgressDialogue) - DialoguesToRemove.Add(pair.Key); + if (ui.ClosingDialogue || !ui.ProgressDialogue) + DialoguesToRemove.Add(slot); else { if (++data.Page >= data.PageCount) - DialoguesToRemove.Add(pair.Key); + DialoguesToRemove.Add(slot); else { - dialogue.DialoguePage = data.Pages[data.Page]; - dialogue.SwitchingPage = false; - dialogue.SwitchCounter = 0; + ui.DialoguePage = data.Pages[data.Page]; + ui.SwitchingPage = false; + ui.SwitchCounter = 0; Activate(); } } continue; } - dialogue.SwitchCounter++; + ui.SwitchCounter++; } } @@ -919,14 +918,14 @@ namespace CalamityMod.UI.DialogueDisplay Converters = { new JsonStringEnumConverter() } }; - public static DialogueTextData Deserialize(string key) + public static DialogueTextData Deserialize(string name) { string activeExtension = LanguageManager.Instance.ActiveCulture.Name; - string path = "UI/DialogueDisplay/" + activeExtension + "/" + key + ".json"; + string path = "UI/DialogueDisplay/" + activeExtension + "/" + name + ".json"; // Fall back to english if not found if (!CalamityMod.Instance.FileExists(path)) - path = "UI/DialogueDisplay/en-US/" + key + ".json"; + path = "UI/DialogueDisplay/en-US/" + name + ".json"; // Throw if we cant find english either if (!CalamityMod.Instance.FileExists(path)) @@ -950,12 +949,23 @@ namespace CalamityMod.UI.DialogueDisplay return new Color(r, g, b); } + /// + /// Returns the slot of the first dialogue instance with the coorisponding name + /// + public static int GetSlot(string name) + { + foreach(var pair in DialogueDisplayUI.Dialogues) + if(pair.Value.name == name) + return pair.Key; + return -1; + } + /// /// Manually progresses dialogue /// - public static void ProgressDialogue(string pearlKey) + public static void ProgressDialogue(int slot) { - if (DialogueDisplayUI.Dialogues.TryGetValue(pearlKey, out var val)) + if (DialogueDisplayUI.Dialogues.TryGetValue(slot, out var val)) { DialogueDisplay display = val.ui; if (display.SwitchingPage) @@ -973,30 +983,30 @@ namespace CalamityMod.UI.DialogueDisplay /// /// Ends the dialogue if it exists in the world /// - /// The name of the dialogue's localization key - public static void EndDialogue(string key) + /// The name of the dialogue's localization key + public static void EndDialogue(int slot) { - if (DialogueDisplayUI.Dialogues.TryGetValue(key, out var val)) + if (DialogueDisplayUI.Dialogues.TryGetValue(slot, out var val)) val.ui.ClosingDialogue = true; } - public static void RemoveDialogue(string key) + public static void RemoveDialogue(int slot) { - DialogueDisplayUI.DialoguesToRemove.Add(key); + DialogueDisplayUI.DialoguesToRemove.Add(slot); } /// /// Creates a dialogue instance in the world /// - /// The name of the dialogue's localization key + /// The name of the dialogue's localization key /// The position of the text in the world - public static void StartDialogue(string key, Vector2 startPosition, int startIndex = 0, int Uptime = -1, bool progressDialogue = true, DisplayEffect effects = null, float wrapWidth = -1) + public static int StartDialogue(string name, Vector2 startPosition, int startIndex = 0, int Uptime = -1, bool progressDialogue = true, DisplayEffect effects = null, float wrapWidth = -1) { UI ??= new(); State ??= new(); effects ??= new DisplayEffect(); - DialogueTextData textData = Deserialize(key); + DialogueTextData textData = Deserialize(name); if (startIndex >= textData.PageCount) startIndex = textData.PageCount - 1; @@ -1006,29 +1016,36 @@ namespace CalamityMod.UI.DialogueDisplay Position = startPosition, ProgressDialogue = progressDialogue, }; - DialogueDisplayUI.Dialogues.Add(key, (display, textData)); - if (Uptime != -1) - DialogueDisplayUI.DialogueUptimes.Add(key, Uptime); + + int slot; + for (slot = 0; slot <= DialogueDisplayUI.Dialogues.Count; slot++) + if (!DialogueDisplayUI.Dialogues.ContainsKey(slot)) + break; + + DialogueDisplayUI.Dialogues.Add(slot, (name, display, textData, null, Uptime)); + State.Append(display); display.Activate(); if (UI.CurrentState != State) UI?.SetState(State); + + return slot; } /// /// Creates a dialogue instance in the world /// - /// The name of the dialogue's localization key + /// The name of the dialogue's localization key /// The entity this dialogue will appear with /// The entity this dialogue will appear with - public static void StartDialogue(string key, Entity entity, int startIndex = 0, int Uptime = -1, DisplayEffect effects = null, float wrapWidth = -1) + public static int StartDialogue(string name, Entity entity, int startIndex = 0, int Uptime = -1, DisplayEffect effects = null, float wrapWidth = -1) { UI ??= new(); State ??= new(); effects ??= new DisplayEffect(); - DialogueTextData textData = Deserialize(key); + DialogueTextData textData = Deserialize(name); if (startIndex >= textData.PageCount) startIndex = textData.PageCount - 1; @@ -1037,15 +1054,21 @@ namespace CalamityMod.UI.DialogueDisplay { Position = entity.Center }; - DialogueDisplayUI.Dialogues.Add(key, (display, textData)); - DialogueDisplayUI.DialogueEntities.Add(key, entity); - if (Uptime != -1) - DialogueDisplayUI.DialogueUptimes.Add(key, Uptime); + + int slot; + for (slot = 0; slot <= DialogueDisplayUI.Dialogues.Count; slot++) + if (!DialogueDisplayUI.Dialogues.ContainsKey(slot)) + break; + + DialogueDisplayUI.Dialogues.Add(slot, (name, display, textData, entity, Uptime)); + State.Append(display); display.Activate(); if (UI.CurrentState != State) UI?.SetState(State); + + return slot; } /// diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index ce5b774884..34fbc5e607 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -55,6 +55,22 @@ namespace CalamityMod return backgroundMatrix; } } + /// + /// Gets the texture for the passed string and stores it in the referenced field + /// If the texture is already stored in the field, it will not request it again. + /// Use this instead of requesting every frame. + /// + /// + /// + /// + public static Asset GetTextureEfficient(ref Asset textureAsset, string texture) + { + if (textureAsset is null) + { + textureAsset = ModContent.Request(texture); + } + return textureAsset; + } #region Projectile Afterimages /// @@ -269,12 +285,27 @@ namespace CalamityMod /// /// /// - public static void DrawInventoryCustomScale(SpriteBatch spriteBatch, Texture2D texture, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale, float wantedScale = 1f, Vector2 drawOffset = default) + public static void DrawInventoryCustomScale(SpriteBatch spriteBatch, Texture2D texture, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale, float wantedScale = 1f, Vector2 drawOffset = default, SpriteEffects spriteEffects = SpriteEffects.None, float rotation = 0f) { wantedScale = Math.Max(scale, wantedScale * Main.inventoryScale); float scaleDifference = wantedScale - scale; position += drawOffset * wantedScale; - spriteBatch.Draw(texture, position, frame, drawColor, 0f, origin, wantedScale, SpriteEffects.None, 0); + if (itemColor == Color.Transparent) itemColor = Color.White; + spriteBatch.Draw(texture, position, frame, itemColor.MultiplyRGB(drawColor), 0f, origin, wantedScale, SpriteEffects.None, 0); + } + + static Asset ItemDotTexture; + /// + /// Draws an enabled/disabled dot at the bottom right of the item's sprite + /// Used for effects that are enabled/disabled + /// + /// + /// + public static void DrawInventoryDot(SpriteBatch spriteBatch, Vector2 itemPosition, Vector2 dotOffset, bool enabled) + { + var tex = CalamityUtils.GetTextureEfficient(ref ItemDotTexture, "Terraria/Images/Extra_20").Value; + var dotFrame = tex.Frame(1,4, frameY: enabled ? 1 : 2); + spriteBatch.Draw(tex, itemPosition + dotOffset, dotFrame, Color.White, 0, dotFrame.Size() * 0.5f, Main.inventoryScale, SpriteEffects.None, 0); } /// diff --git a/Walls/AbyssGravelWall.cs b/Walls/AbyssGravelWall.cs index 44e781e3a0..81c87aa517 100644 --- a/Walls/AbyssGravelWall.cs +++ b/Walls/AbyssGravelWall.cs @@ -1,32 +1,19 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AbyssGravelWallSafe")] public class AbyssGravelWall : ModWall { public override void SetStaticDefaults() { - DustType = 33; + Main.wallHouse[Type] = true; AddMapEntry(new Color(6, 10, 54)); + DustType = 33; } - public override void RandomUpdate(int i, int j) - { - if (Main.tile[i, j].LiquidAmount == 0 && j < Main.maxTilesY - 205) - { - Main.tile[i, j].Get().LiquidType = LiquidID.Water; - Main.tile[i, j].LiquidAmount = byte.MaxValue; - WorldGen.SquareTileFrame(i, j); - if (Main.dedServ) - NetMessage.sendWater(i, j); - } - } - - public override void KillWall(int i, int j, ref bool fail) => fail = true; - public override bool CanExplode(int i, int j) => false; public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/AbyssGravelWallSafe.cs b/Walls/AbyssGravelWallSafe.cs deleted file mode 100644 index 47910b7661..0000000000 --- a/Walls/AbyssGravelWallSafe.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class AbyssGravelWallSafe : ModWall - { - public override string Texture => "CalamityMod/Walls/AbyssGravelWall"; - public override void SetStaticDefaults() - { - Main.wallHouse[Type] = true; - AddMapEntry(new Color(6, 10, 54)); - DustType = 33; - } - - public override bool CanExplode(int i, int j) => false; - - public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; - } -} diff --git a/Walls/AstralDirtWall.cs b/Walls/AstralDirtWall.cs index ae80a7a4dd..3484205805 100644 --- a/Walls/AstralDirtWall.cs +++ b/Walls/AstralDirtWall.cs @@ -1,21 +1,19 @@ using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralDirtWallSafe")] public class AstralDirtWall : ModWall { - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralDirtWallUnsafe",this, "CalamityMod/Walls/AstralD" ); - return true; - }*/ public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Dirt. DustType = DustID.Shadowflame; + Main.wallHouse[Type] = true; WallID.Sets.Conversion.Dirt[Type] = true; AddMapEntry(new Color(26, 22, 32)); } diff --git a/Walls/AstralGrassWall.cs b/Walls/AstralGrassWall.cs index 95ff468205..8c8b7c5d25 100644 --- a/Walls/AstralGrassWall.cs +++ b/Walls/AstralGrassWall.cs @@ -8,16 +8,12 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralGrassWallSafe")] public class AstralGrassWall : ModWall { public static Asset leafTexture = null; public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralGrassWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ public override void SetStaticDefaults() { @@ -26,6 +22,8 @@ namespace CalamityMod.Walls WallID.Sets.Conversion.Grass[Type] = true; + Main.wallHouse[Type] = true; + AddMapEntry(new Color(60, 48, 64)); if (!Main.dedServ) @@ -37,7 +35,7 @@ namespace CalamityMod.Walls { if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) { - Texture2D tex = leafTexture.Value; + Texture2D tex = AstralGrassWall.leafTexture.Value; var rand = new Random(i + (j * 100000)); float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; diff --git a/Walls/AstralIceWall.cs b/Walls/AstralIceWall.cs index 4c0802f5a5..8e3431c427 100644 --- a/Walls/AstralIceWall.cs +++ b/Walls/AstralIceWall.cs @@ -1,20 +1,17 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralIceWallSafe")] public class AstralIceWall : ModWall { - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralIceWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Ice. + Main.wallHouse[Type] = true; DustType = DustID.Shadowflame; WallID.Sets.Conversion.Ice[Type] = true; AddMapEntry(new Color(83, 76, 92)); diff --git a/Walls/AstralSandstoneWall.cs b/Walls/AstralSandstoneWall.cs index 7d24446445..ad9bcab1c8 100644 --- a/Walls/AstralSandstoneWall.cs +++ b/Walls/AstralSandstoneWall.cs @@ -1,21 +1,18 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralSandstoneWallSafe")] public class AstralSandstoneWall : ModWall { - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralSandstoneWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Sandstone. DustType = DustID.Shadowflame; + Main.wallHouse[Type] = true; WallID.Sets.Conversion.Sandstone[Type] = true; diff --git a/Walls/AstralSnowWall.cs b/Walls/AstralSnowWall.cs index 586060389a..87e48f1d0d 100644 --- a/Walls/AstralSnowWall.cs +++ b/Walls/AstralSnowWall.cs @@ -1,14 +1,17 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralSnowWallSafe")] public class AstralSnowWall : ModWall { + public override void SetStaticDefaults() { DustType = ModContent.DustType(); + Main.wallHouse[Type] = true; WallID.Sets.Conversion.Snow[Type] = true; AddMapEntry(new Color(135, 145, 149)); } diff --git a/Walls/AstralStoneWall.cs b/Walls/AstralStoneWall.cs index 0de91add8b..1ba76b2331 100644 --- a/Walls/AstralStoneWall.cs +++ b/Walls/AstralStoneWall.cs @@ -1,21 +1,18 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralStoneWallSafe")] public class AstralStoneWall : ModWall { - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralStoneWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Stone. DustType = DustID.Shadowflame; + Main.wallHouse[Type] = true; WallID.Sets.Conversion.Stone[Type] = true; diff --git a/Walls/EutrophicSandWall.png b/Walls/EutrophicSandWall.png deleted file mode 100644 index 1e65f4f49e..0000000000 Binary files a/Walls/EutrophicSandWall.png and /dev/null differ diff --git a/Walls/EutrophicSandWallSafe.cs b/Walls/EutrophicSandWallSafe.cs deleted file mode 100644 index 3bfe9329d3..0000000000 --- a/Walls/EutrophicSandWallSafe.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class EutrophicSandWallSafe : ModWall - { - public override string Texture => "CalamityMod/Walls/EutrophicSandWall"; - public override void SetStaticDefaults() - { - Main.wallHouse[Type] = true; - DustType = 108; - AddMapEntry(new Color(11, 56, 81)); - } - - public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; - } -} diff --git a/Walls/HardenedAstralSandWall.cs b/Walls/HardenedAstralSandWall.cs index 4766efcb6e..567269b30b 100644 --- a/Walls/HardenedAstralSandWall.cs +++ b/Walls/HardenedAstralSandWall.cs @@ -1,21 +1,19 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("HardenedAstralSandWallSafe")] public class HardenedAstralSandWall : ModWall { - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("HardenedAstralSandWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ + public override string Texture => "CalamityMod/Walls/HardenedAstralSandWall"; public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Hardened Astral Sand. DustType = DustID.Shadowflame; + Main.wallHouse[Type] = true; WallID.Sets.Conversion.HardenedSand[Type] = true; diff --git a/Walls/LargeBasaltWall.png b/Walls/LargeBasaltWall.png index 775d0dc9d9..9ee40d2c04 100644 Binary files a/Walls/LargeBasaltWall.png and b/Walls/LargeBasaltWall.png differ diff --git a/Walls/LimestoneWall.cs b/Walls/LimestoneWall.cs index 2061ef7c8a..a23494e1ef 100644 --- a/Walls/LimestoneWall.cs +++ b/Walls/LimestoneWall.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { DustType = 22; - this.AddMapEntryWithWaterVisibility(new Color(147, 92, 63)); + AddMapEntry(new Color(125, 85, 61)); + this.AddMapEntryWithWaterVisibility(new Color(78, 76, 127)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/NavyslateWall.cs b/Walls/NavyslateWall.cs index 4024292c23..5272d6d750 100644 --- a/Walls/NavyslateWall.cs +++ b/Walls/NavyslateWall.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("EutrophicSandWall")] public class NavyslateWall : ModWall, IVisibleThroughWater { int IVisibleThroughWater.WaterMapEntry { get; set; } diff --git a/Walls/NavystoneWall.cs b/Walls/NavystoneWall.cs index feedbf7e15..1c5f327811 100644 --- a/Walls/NavystoneWall.cs +++ b/Walls/NavystoneWall.cs @@ -1,22 +1,22 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Walls { + [LegacyName("NavystoneWallSafe")] public class NavystoneWall : ModWall, IVisibleThroughWater { - internal static FramedMaskTexture GlowMask; + public override string Texture => "CalamityMod/Walls/NavystoneWall"; int IVisibleThroughWater.WaterMapEntry { get; set; } - + public override void SetStaticDefaults() { + Main.wallHouse[Type] = true; DustType = 96; - this.AddMapEntryWithWaterVisibility(new Color(16, 45, 48)); + this.AddMapEntryWithWaterVisibility(new Color(0, 50, 50)); } - + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; } } diff --git a/Walls/NavystoneWallSafe.cs b/Walls/NavystoneWallSafe.cs deleted file mode 100644 index b2dd4387ad..0000000000 --- a/Walls/NavystoneWallSafe.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class NavystoneWallSafe : ModWall, IVisibleThroughWater - { - public override string Texture => "CalamityMod/Walls/NavystoneWall"; - int IVisibleThroughWater.WaterMapEntry { get; set; } - - public override void SetStaticDefaults() - { - Main.wallHouse[Type] = true; - DustType = 96; - this.AddMapEntryWithWaterVisibility(new Color(0, 50, 50)); - } - - public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; - } -} diff --git a/Walls/ScarletSeaGrassWall.cs b/Walls/ScarletSeaGrassWall.cs index 75ea6d474c..c8550a7e30 100644 --- a/Walls/ScarletSeaGrassWall.cs +++ b/Walls/ScarletSeaGrassWall.cs @@ -16,13 +16,12 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { - // 18APR2025: Ozzatron: guessed a red dust for scarlet sea grass DustType = DustID.CrimsonPlants; WallID.Sets.Conversion.Grass[Type] = true; - AddMapEntry(new Color(103, 24, 24)); - this.AddMapEntryWithWaterVisibility(new Color(89, 49, 108)); + AddMapEntry(new Color(144, 33, 33)); + this.AddMapEntryWithWaterVisibility(new Color(96, 53, 116)); if (!Main.dedServ) { leafTexture = ModContent.Request("CalamityMod/Walls/ScarletSeaGrassWall_Leaves"); diff --git a/Walls/ShellstoneWall.cs b/Walls/ShellstoneWall.cs index 89cde319b8..d94ab83478 100644 --- a/Walls/ShellstoneWall.cs +++ b/Walls/ShellstoneWall.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { - Main.wallHouse[Type] = false; + Main.wallHouse[Type] = true; DustType = 24; this.AddMapEntryWithWaterVisibility(new Color(74, 71, 84)); diff --git a/Walls/SulphurousSandWall.cs b/Walls/SulphurousSandWall.cs index 4ea9b6bf5e..f5e33c2e17 100644 --- a/Walls/SulphurousSandWall.cs +++ b/Walls/SulphurousSandWall.cs @@ -1,14 +1,16 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("SulphurousSandWallSafe")] public class SulphurousSandWall : ModWall { + public override string Texture => "CalamityMod/Walls/SulphurousSandWall"; public override void SetStaticDefaults() { + Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(84, 71, 46)); } diff --git a/Walls/SulphurousSandstoneWall.cs b/Walls/SulphurousSandstoneWall.cs index 24b9f1da62..a8eb0523bf 100644 --- a/Walls/SulphurousSandstoneWall.cs +++ b/Walls/SulphurousSandstoneWall.cs @@ -1,14 +1,16 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("SulphurousSandstoneWallSafe")] public class SulphurousSandstoneWall : ModWall { + public override string Texture => "CalamityMod/Walls/SulphurousSandstoneWall"; public override void SetStaticDefaults() { + Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(57, 45, 38)); } diff --git a/Walls/SulphurousShaleWall.cs b/Walls/SulphurousShaleWall.cs index a7a9c9e46d..4cfa1e731d 100644 --- a/Walls/SulphurousShaleWall.cs +++ b/Walls/SulphurousShaleWall.cs @@ -1,14 +1,16 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("SulphurousShaleWallSafe")] public class SulphurousShaleWall : ModWall { + public override string Texture => "CalamityMod/Walls/SulphurousShaleWall"; public override void SetStaticDefaults() { + Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(59, 40, 63)); } diff --git a/Walls/EutrophicSandWall.cs b/Walls/UnsafeWalls/UnsafeAbyssGravelWall.cs similarity index 65% rename from Walls/EutrophicSandWall.cs rename to Walls/UnsafeWalls/UnsafeAbyssGravelWall.cs index d6b6bb71c2..f202f68ad7 100644 --- a/Walls/EutrophicSandWall.cs +++ b/Walls/UnsafeWalls/UnsafeAbyssGravelWall.cs @@ -3,14 +3,15 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class EutrophicSandWall : ModWall + public class UnsafeAbyssGravelWall : ModWall { + public override string Texture => "CalamityMod/Walls/AbyssGravelWall"; public override void SetStaticDefaults() { - DustType = 108; - AddMapEntry(new Color(11, 56, 81)); + DustType = 33; + AddMapEntry(new Color(6, 10, 54)); } public override void RandomUpdate(int i, int j) @@ -25,6 +26,10 @@ namespace CalamityMod.Walls } } + public override void KillWall(int i, int j, ref bool fail) => fail = true; + + public override bool CanExplode(int i, int j) => false; + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; } } diff --git a/Walls/AstralDirtWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralDirtWall.cs similarity index 81% rename from Walls/AstralDirtWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralDirtWall.cs index 8305333479..3e8494b5f9 100644 --- a/Walls/AstralDirtWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralDirtWall.cs @@ -1,11 +1,10 @@ using Microsoft.Xna.Framework; -using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralDirtWallSafe : ModWall + public class UnsafeAstralDirtWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralDirtWall"; @@ -13,7 +12,6 @@ namespace CalamityMod.Walls { // TODO -- Change this dust to be one more befitting Astral Dirt. DustType = DustID.Shadowflame; - Main.wallHouse[Type] = true; WallID.Sets.Conversion.Dirt[Type] = true; AddMapEntry(new Color(26, 22, 32)); } diff --git a/Walls/AstralGrassWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralGrassWall.cs similarity index 73% rename from Walls/AstralGrassWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralGrassWall.cs index b7f0877466..1a115e39ff 100644 --- a/Walls/AstralGrassWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralGrassWall.cs @@ -2,16 +2,23 @@ using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralGrassWallSafe : ModWall + public class UnsafeAstralGrassWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralGrassWall"; + public static Asset leafTexture = null; public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; + /*public override bool Autoload(ref string name, ref string texture) + { + mod.AddWall("AstralGrassWallUnsafe", this, texture); + return base.Autoload(ref name, ref texture); + }*/ public override void SetStaticDefaults() { @@ -20,15 +27,18 @@ namespace CalamityMod.Walls WallID.Sets.Conversion.Grass[Type] = true; - Main.wallHouse[Type] = true; - AddMapEntry(new Color(60, 48, 64)); + + if (!Main.dedServ) + { + leafTexture = ModContent.Request("CalamityMod/Walls/AstralGrassWallLeaves"); + } } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) { - Texture2D tex = AstralGrassWall.leafTexture.Value; + Texture2D tex = leafTexture.Value; var rand = new Random(i + (j * 100000)); float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; diff --git a/Walls/AstralIceWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralIceWall.cs similarity index 76% rename from Walls/AstralIceWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralIceWall.cs index 0b93d98546..cef160b93f 100644 --- a/Walls/AstralIceWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralIceWall.cs @@ -1,17 +1,15 @@ -using Microsoft.Xna.Framework; -using Terraria; + +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralIceWallSafe : ModWall + public class UnsafeAstralIceWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralIceWall"; - public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Ice. - Main.wallHouse[Type] = true; DustType = DustID.Shadowflame; WallID.Sets.Conversion.Ice[Type] = true; AddMapEntry(new Color(83, 76, 92)); diff --git a/Walls/AstralSandstoneWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralSandstoneWall.cs similarity index 76% rename from Walls/AstralSandstoneWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralSandstoneWall.cs index af458c22e4..eaa00bad12 100644 --- a/Walls/AstralSandstoneWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralSandstoneWall.cs @@ -1,18 +1,16 @@ -using Microsoft.Xna.Framework; -using Terraria; + +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralSandstoneWallSafe : ModWall + public class UnsafeAstralSandstoneWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralSandstoneWall"; - public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Sandstone. DustType = DustID.Shadowflame; - Main.wallHouse[Type] = true; WallID.Sets.Conversion.Sandstone[Type] = true; diff --git a/Walls/AstralSnowWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralSnowWall.cs similarity index 74% rename from Walls/AstralSnowWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralSnowWall.cs index fe7d6b8b19..56771bbc1e 100644 --- a/Walls/AstralSnowWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralSnowWall.cs @@ -1,17 +1,15 @@ -using Microsoft.Xna.Framework; -using Terraria; + +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralSnowWallSafe : ModWall + public class UnsafeAstralSnowWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralSnowWall"; - public override void SetStaticDefaults() { DustType = ModContent.DustType(); - Main.wallHouse[Type] = true; WallID.Sets.Conversion.Snow[Type] = true; AddMapEntry(new Color(135, 145, 149)); } diff --git a/Walls/AstralStoneWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralStoneWall.cs similarity index 76% rename from Walls/AstralStoneWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralStoneWall.cs index 80b21ac42d..3b707574ee 100644 --- a/Walls/AstralStoneWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralStoneWall.cs @@ -1,18 +1,16 @@ -using Microsoft.Xna.Framework; -using Terraria; + +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralStoneWallSafe : ModWall + public class UnsafeAstralStoneWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralStoneWall"; - public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Stone. DustType = DustID.Shadowflame; - Main.wallHouse[Type] = true; WallID.Sets.Conversion.Stone[Type] = true; diff --git a/Walls/BrimstoneSlagWallUnsafe.cs b/Walls/UnsafeWalls/UnsafeBrimstoneSlagWall.cs similarity index 84% rename from Walls/BrimstoneSlagWallUnsafe.cs rename to Walls/UnsafeWalls/UnsafeBrimstoneSlagWall.cs index 4485858ca2..a05946e17c 100644 --- a/Walls/BrimstoneSlagWallUnsafe.cs +++ b/Walls/UnsafeWalls/UnsafeBrimstoneSlagWall.cs @@ -1,10 +1,12 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class BrimstoneSlagWallUnsafe : MultiVariantModWall + [LegacyName("BrimstoneSlagWallUnsafe")] + public class UnsafeBrimstoneSlagWall : MultiVariantModWall { public override string Texture => "CalamityMod/Walls/BrimstoneSlagWall"; public override void SetStaticDefaults() diff --git a/Walls/HardenedAstralSandWallSafe.cs b/Walls/UnsafeWalls/UnsafeHardenedAstralSandWall.cs similarity index 76% rename from Walls/HardenedAstralSandWallSafe.cs rename to Walls/UnsafeWalls/UnsafeHardenedAstralSandWall.cs index f95658aff1..ebf7d57c2b 100644 --- a/Walls/HardenedAstralSandWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeHardenedAstralSandWall.cs @@ -1,18 +1,16 @@ -using Microsoft.Xna.Framework; -using Terraria; + +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class HardenedAstralSandWallSafe : ModWall + public class UnsafeHardenedAstralSandWall : ModWall { public override string Texture => "CalamityMod/Walls/HardenedAstralSandWall"; - public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Hardened Astral Sand. DustType = DustID.Shadowflame; - Main.wallHouse[Type] = true; WallID.Sets.Conversion.HardenedSand[Type] = true; diff --git a/Walls/UnsafeWalls/UnsafeLargeBasaltWall.cs b/Walls/UnsafeWalls/UnsafeLargeBasaltWall.cs new file mode 100644 index 0000000000..fa88417a27 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeLargeBasaltWall.cs @@ -0,0 +1,106 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeLargeBasaltWall : MultiVariantModWall + { + public override string Texture => "CalamityMod/Walls/LargeBasaltWall"; + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + + AddMapEntry(new Color(65, 64, 68)); + } + public override void RandomUpdate(int i, int j) + { + Tile t = Main.tile[i, j]; + Tile tUP = Main.tile[i, j - 1]; + Tile tDOWN = Main.tile[i, j + 1]; + Tile tLEFT = Main.tile[i - 1, j]; + Tile tRIGHT = Main.tile[i + 1, j]; + Tile tUPLEFT = Main.tile[i -1, j - 1]; + Tile tDOWNLEFT = Main.tile[i - 1, j + 1]; + Tile tUPRIGHT = Main.tile[i + 1, j -1]; + Tile tDOWNRIGHT = Main.tile[i + 1, j + 1]; + if (t.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + t.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tUP.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tUP.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tDOWN.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tDOWN.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tLEFT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tRIGHT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + + if (tUPLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tUPLEFT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tDOWNLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tDOWNLEFT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tUPRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tUPRIGHT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tDOWNRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tDOWNRIGHT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, DustID.Smoke, 0f, -1.9069767f, 195, new Color(255, 255, 255), 1f)]; + dust.noGravity = false; + dust.fadeIn = 1.4209302f; + } + public override void PlaceInWorld(int i, int j, Item item) + { + Tile t = Main.tile[i, j]; + if (t.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + t.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Ash, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 4) * 468; + frameYOffset = (j % 4) * 180; + } + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeLimestoneWall.cs b/Walls/UnsafeWalls/UnsafeLimestoneWall.cs new file mode 100644 index 0000000000..db214dae30 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeLimestoneWall.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeLimestoneWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/LimestoneWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + DustType = 22; + AddMapEntry(new Color(125, 85, 61)); + this.AddMapEntryWithWaterVisibility(new Color(78, 76, 127)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeNavyslateWall.cs b/Walls/UnsafeWalls/UnsafeNavyslateWall.cs new file mode 100644 index 0000000000..c6a01d7eda --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeNavyslateWall.cs @@ -0,0 +1,27 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.GameContent; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeNavyslateWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/NavyslateWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + DustType = 96; + this.AddMapEntryWithWaterVisibility(new Color(11, 40, 43)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeNavystoneWall.cs b/Walls/UnsafeWalls/UnsafeNavystoneWall.cs new file mode 100644 index 0000000000..4253d42fa2 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeNavystoneWall.cs @@ -0,0 +1,27 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.GameContent; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeNavystoneWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/NavystoneWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + DustType = 96; + this.AddMapEntryWithWaterVisibility(new Color(16, 45, 48)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeRunestoneWall.cs b/Walls/UnsafeWalls/UnsafeRunestoneWall.cs new file mode 100644 index 0000000000..5f22703f03 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeRunestoneWall.cs @@ -0,0 +1,26 @@ +using CalamityMod.Dusts.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeRunestoneWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/RunestoneWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + + this.AddMapEntryWithWaterVisibility(new Color(122, 59, 48)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs b/Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs new file mode 100644 index 0000000000..d7175d3781 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs @@ -0,0 +1,53 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeScarletSeaGrassWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/ScarletSeaGrassWall"; + public static Asset leafTexture = null; + int IVisibleThroughWater.WaterMapEntry { get; set; } + public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; + + public override void SetStaticDefaults() + { + // 18APR2025: Ozzatron: guessed a red dust for scarlet sea grass + DustType = DustID.CrimsonPlants; + Main.wallHouse[Type] = false; + WallID.Sets.Conversion.Grass[Type] = true; + + AddMapEntry(new Color(144, 33, 33)); + this.AddMapEntryWithWaterVisibility(new Color(96, 53, 116)); + if (!Main.dedServ) + { + leafTexture = ModContent.Request("CalamityMod/Walls/ScarletSeaGrassWall_Leaves"); + } + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) + { + Texture2D tex = leafTexture.Value; + var rand = new Random(i + (j * 100000)); + + float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; + float sin = (float)Math.Sin(Main.GameUpdateCount / 45f + offset); + + spriteBatch.Draw(tex, (new Vector2(i + 0.5f, j + 0.5f) + TileAdj) * 16 + new Vector2(1, 0.5f) * sin * 2.2f - Main.screenPosition, + new Rectangle(rand.Next(4) * 26, 0, 24, 24), Lighting.GetColor(i, j), offset + sin * 0.09f, new Vector2(12, 12), 1 + sin / 14f, 0, 0); + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeSeaPrismWall.cs b/Walls/UnsafeWalls/UnsafeSeaPrismWall.cs new file mode 100644 index 0000000000..f2d8b7972c --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeSeaPrismWall.cs @@ -0,0 +1,90 @@ +using System; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeSeaPrismWall : MultiVariantModWall + { + public override string Texture => "CalamityMod/Walls/SeaPrismWall"; + internal static FramedMaskTexture GlowMaskBlue; + internal static FramedMaskTexture GlowMaskPurple; + internal static FramedMaskTexture GlowMaskGreen; + public override void SetStaticDefaults() + { + GlowMaskBlue = new("CalamityMod/Walls/SeaPrismWall_Blue", 36, 36); + GlowMaskPurple = new("CalamityMod/Walls/SeaPrismWall_Purple", 36, 36); + GlowMaskGreen = new("CalamityMod/Walls/SeaPrismWall_Green", 36, 36); + Main.wallHouse[Type] = false; + DustType = 108; + + AddMapEntry(new Color(27, 123, 131)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 8) * 468; + frameYOffset = (j % 8) * 180; + } + private static float GetFade1(int i, int j) => + (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + + private static float GetFade2(int i, int j) => + (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + + public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + int xLength = 32; + + int frameXOffset = (i % 8) * 468; + int frameYOffset = (j % 8) * 180; + + int xPos = tile.WallFrameX + frameXOffset; + int yPos = tile.WallFrameY + frameYOffset; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; + + // base wall + spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8, -8), frame, Lighting.GetColor(i, j)); + + // glow layers + float fade1 = GetFade1(i, j); + float fade2 = GetFade2(i, j); + + if (GlowMaskBlue.HasContentInFramePos(xPos, yPos)) + { + spriteBatch.Draw(GlowMaskBlue.Texture, pos + new Vector2(-8, -8), frame, (Color.White * 1.1f)); + } + if (GlowMaskPurple.HasContentInFramePos(xPos, yPos)) + { + spriteBatch.Draw(GlowMaskPurple.Texture, pos + new Vector2(-8, -8), frame, Color.White * (fade1 * 1.1f)); + } + if (GlowMaskGreen.HasContentInFramePos(xPos, yPos)) + { + spriteBatch.Draw(GlowMaskGreen.Texture, pos + new Vector2(-8, -8), frame, Color.White * (fade2 * 1.5f)); + } + + Color wallColor = Lighting.GetColor(i, j) * 1.2f; // brighten a bit + wallColor.A = 255; + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + DrawWallGlow(Type, i, j, spriteBatch); + return false; + } + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeShellstoneWall.cs b/Walls/UnsafeWalls/UnsafeShellstoneWall.cs new file mode 100644 index 0000000000..2d29b3f210 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeShellstoneWall.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeShellstoneWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/ShellstoneWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + DustType = 24; + + this.AddMapEntryWithWaterVisibility(new Color(74, 71, 84)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/SulphurousSandWallSafe.cs b/Walls/UnsafeWalls/UnsafeSulphurousSandWall.cs similarity index 77% rename from Walls/SulphurousSandWallSafe.cs rename to Walls/UnsafeWalls/UnsafeSulphurousSandWall.cs index e757dc2851..8f8caa9554 100644 --- a/Walls/SulphurousSandWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeSulphurousSandWall.cs @@ -1,15 +1,15 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class SulphurousSandWallSafe : ModWall + public class UnsafeSulphurousSandWall : ModWall { public override string Texture => "CalamityMod/Walls/SulphurousSandWall"; public override void SetStaticDefaults() { - Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(84, 71, 46)); } diff --git a/Walls/SulphurousSandstoneWallSafe.cs b/Walls/UnsafeWalls/UnsafeSulphurousSandstoneWall.cs similarity index 77% rename from Walls/SulphurousSandstoneWallSafe.cs rename to Walls/UnsafeWalls/UnsafeSulphurousSandstoneWall.cs index 8a7091113c..a39c9f24fc 100644 --- a/Walls/SulphurousSandstoneWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeSulphurousSandstoneWall.cs @@ -1,15 +1,15 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class SulphurousSandstoneWallSafe : ModWall + public class UnsafeSulphurousSandstoneWall : ModWall { public override string Texture => "CalamityMod/Walls/SulphurousSandstoneWall"; public override void SetStaticDefaults() { - Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(57, 45, 38)); } diff --git a/Walls/SulphurousShaleWallSafe.cs b/Walls/UnsafeWalls/UnsafeSulphurousShaleWall.cs similarity index 77% rename from Walls/SulphurousShaleWallSafe.cs rename to Walls/UnsafeWalls/UnsafeSulphurousShaleWall.cs index d0e37e5a12..cbd6f77b3a 100644 --- a/Walls/SulphurousShaleWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeSulphurousShaleWall.cs @@ -1,15 +1,15 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class SulphurousShaleWallSafe : ModWall + public class UnsafeSulphurousShaleWall : ModWall { public override string Texture => "CalamityMod/Walls/SulphurousShaleWall"; public override void SetStaticDefaults() { - Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(59, 40, 63)); } diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/UnsafeWalls/UnsafeVoidstoneWall.cs similarity index 97% rename from Walls/VoidstoneWallUnsafe.cs rename to Walls/UnsafeWalls/UnsafeVoidstoneWall.cs index 2f8aa9fc12..54954c556a 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/UnsafeWalls/UnsafeVoidstoneWall.cs @@ -7,9 +7,9 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class VoidstoneWallUnsafe : ModWall + public class UnsafeVoidstoneWall : ModWall { internal static FramedMaskTexture GlowMask; public override string Texture => "CalamityMod/Walls/VoidstoneWall"; diff --git a/Waters/SunkenSeaShoresWater.cs b/Waters/SunkenSeaShoresWater.cs index 032e3322b9..ae828a4fa8 100644 --- a/Waters/SunkenSeaShoresWater.cs +++ b/Waters/SunkenSeaShoresWater.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Waters public class SunkenSeaShoresWater : CalamityModWaterStyle { - private readonly Vector3 WaterGlowColor = new Color(140, 222, 239).ToVector3(); + private readonly Vector3 WaterGlowColor = new Color(82, 223, 255).ToVector3(); public static int Type { get; private set; } public static CalamityModWaterStyle Instance { get; private set; } diff --git a/Waters/SunkenSeaShoresWater.png b/Waters/SunkenSeaShoresWater.png index d9ead26b53..3a361affdf 100644 Binary files a/Waters/SunkenSeaShoresWater.png and b/Waters/SunkenSeaShoresWater.png differ diff --git a/Waters/SunkenSeaShoresWater_Block.png b/Waters/SunkenSeaShoresWater_Block.png index c828d653e2..4b0007eecf 100644 Binary files a/Waters/SunkenSeaShoresWater_Block.png and b/Waters/SunkenSeaShoresWater_Block.png differ diff --git a/Waters/SunkenSeaShoresWater_Slope.png b/Waters/SunkenSeaShoresWater_Slope.png index 179eb74a64..cd9bf6cfc6 100644 Binary files a/Waters/SunkenSeaShoresWater_Slope.png and b/Waters/SunkenSeaShoresWater_Slope.png differ diff --git a/Waters/SunkenSeaShoresWaterflow.png b/Waters/SunkenSeaShoresWaterflow.png index 3d605a0e35..7ca2c5df22 100644 Binary files a/Waters/SunkenSeaShoresWaterflow.png and b/Waters/SunkenSeaShoresWaterflow.png differ diff --git a/World/Abyss.cs b/World/Abyss.cs index 9a563fdc90..676ad09e8c 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -18,6 +18,7 @@ using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.FurnitureVoid; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -91,13 +92,13 @@ namespace CalamityMod.World if (Y <= rockLayer - (int)((y - 200) * 0.6f)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition else if (Y <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3 else if (Y <= rockLayer - (int)((y - 200) * 0.4f)) @@ -115,7 +116,7 @@ namespace CalamityMod.World else if (Y <= rockLayer - (int)((y - 200) * 0.2f)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition else if (Y <= rockLayer - (int)((y - 200) * 0.19f)) @@ -123,19 +124,19 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } //layer 1 else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } //basically places smaller clusters everywhere else? @@ -147,13 +148,13 @@ namespace CalamityMod.World if (Y <= rockLayer - (int)((y - 200) * 0.6f)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition else if (Y <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3 else if (Y <= rockLayer - (int)((y - 200) * 0.4f)) @@ -171,7 +172,7 @@ namespace CalamityMod.World else if (Y <= rockLayer - (int)((y - 200) * 0.2f)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition else if (Y <= rockLayer - (int)((y - 200) * 0.19f)) @@ -179,19 +180,19 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } //layer 1 else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } } @@ -207,13 +208,13 @@ namespace CalamityMod.World if (Y > (rockLayer + y * 0.270)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition else if (Y > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3 else if (Y > (rockLayer + y * 0.145)) @@ -233,19 +234,19 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } //layer 1 else if (Y <= rockLayer - 10) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 2 (default block for the abyss) else @@ -263,13 +264,13 @@ namespace CalamityMod.World if (Y > (rockLayer + y * 0.270)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition else if (Y > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3 else if (Y > (rockLayer + y * 0.145)) @@ -289,19 +290,19 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } //layer 1 else if (Y <= rockLayer - 10) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 2 (default block for the abyss) else diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index 40f0d73511..ddfd043bb4 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -10,6 +10,7 @@ using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -775,33 +776,33 @@ namespace CalamityMod.World if (Main.tile[x, y] != null) { - if (wallType != WallID.None && wallType != ModContent.WallType() && wallType != ModContent.WallType() && - wallType != ModContent.WallType() && wallType != ModContent.WallType() && - wallType != ModContent.WallType() && wallType != ModContent.WallType() && - wallType != ModContent.WallType() && wallType != ModContent.WallType() && + if (wallType != WallID.None && wallType != ModContent.WallType() && wallType != ModContent.WallType() && + wallType != ModContent.WallType() && wallType != ModContent.WallType() && + wallType != ModContent.WallType() && wallType != ModContent.WallType() && + wallType != ModContent.WallType() && wallType != ModContent.WallType() && wallType != ModContent.WallType()) { if (WallID.Sets.Conversion.Grass[wallType]) { - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (WallID.Sets.Conversion.HardenedSand[wallType]) { - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (WallID.Sets.Conversion.Sandstone[wallType]) { - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (WallID.Sets.Conversion.Stone[wallType]) { - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } @@ -816,12 +817,12 @@ namespace CalamityMod.World case WallID.DirtUnsafe4: case WallID.Cave6Unsafe: case WallID.Dirt: - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case WallID.SnowWallUnsafe: - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; @@ -831,7 +832,7 @@ namespace CalamityMod.World NetMessage.SendTileSquare(-1, x, y, 1); break; case WallID.IceUnsafe: - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; @@ -1174,11 +1175,11 @@ namespace CalamityMod.World #region WALL if (Main.tile[x, y] != null) { - if (wallType == ModContent.WallType()) + if (wallType == ModContent.WallType()) { Main.tile[x, y].WallType = WallID.DirtUnsafe; } - else if (wallType == ModContent.WallType() || wallType == ModContent.WallType()) + else if (wallType == ModContent.WallType() || wallType == ModContent.WallType()) { Main.tile[x, y].WallType = WallID.SnowWallUnsafe; } @@ -1186,7 +1187,7 @@ namespace CalamityMod.World { Main.tile[x, y].WallType = WallID.DesertFossil; } - else if (wallType == ModContent.WallType()) + else if (wallType == ModContent.WallType()) { switch (convert) { @@ -1204,15 +1205,15 @@ namespace CalamityMod.World break; } } - else if (wallType == ModContent.WallType()) + else if (wallType == ModContent.WallType()) { Main.tile[x, y].WallType = WallID.IceUnsafe; } else if (wallType == ModContent.WallType()) { - Main.tile[x, y].WallType = WallID.LivingWood; + Main.tile[x, y].WallType = WallID.LivingWoodUnsafe; } - else if (wallType == ModContent.WallType()) + else if (wallType == ModContent.WallType()) { switch (convert) { diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 68bd573d06..d984d756f6 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -8,6 +8,7 @@ using CalamityMod.Tiles.Crags.Spike; using CalamityMod.Tiles.Crags.Tree; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -59,7 +60,7 @@ namespace CalamityMod.World Tile tile = Main.tile[x, y]; tile.TileType = (ushort)ModContent.TileType(); tile.HasTile = true; - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } @@ -146,7 +147,7 @@ namespace CalamityMod.World //place more walls behind slag so theres not just a box of walls from the initial rectangle if (tile.HasTile && tileDown.HasTile && tileDown2.HasTile && Main.tile[x, y + 5].HasTile) { - Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); } if (tile.LiquidType == LiquidID.Water && tile.LiquidAmount > 0) diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 9b34b7222f..d4f69609b4 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -51,7 +51,7 @@ namespace CalamityMod.World tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.WallType == ModContent.WallType() || // hardened eutrophic sand doesnt have a wall lol - tile.WallType == ModContent.WallType() || tile.WallType == ModContent.WallType() || + tile.WallType == ModContent.WallType() || tile.WallType == ModContent.WallType() || // nor polyp sand tile.WallType == ModContent.WallType()) // ... nor dunesand { diff --git a/World/GiantHive.cs b/World/GiantHive.cs index 03fadea3de..cca8d6cd37 100644 --- a/World/GiantHive.cs +++ b/World/GiantHive.cs @@ -25,6 +25,7 @@ using Terraria.IO; using Terraria.ModLoader; using Terraria.Utilities; using Terraria.WorldBuilding; +using CalamityMod.World; namespace CalamityMod.World { @@ -316,83 +317,6 @@ namespace CalamityMod.World } } } - public static void CreateTunnel(int startX, int startY, int endX, int endY, int width = 6, int tileType = TileID.Hive) - { - int dx = endX - startX; - int dy = endY - startY; - int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); - - for (int i = 0; i <= steps; i++) - { - float t = (float)i / steps; - int x = (int)(startX + dx * t); - int y = (int)(startY + dy * t); - - // Draw a small circular path - for (int xi = -width; xi <= width; xi++) - { - for (int yi = -width; yi <= width; yi++) - { - if (xi * xi + yi * yi <= width * width) - { - int tileX = x + xi; - int tileY = y + yi; - - if (WorldGen.InWorld(tileX, tileY)) - { - Tile tTile = Main.tile[tileX, tileY]; - tTile.HasTile = true; - tTile.TileType = (ushort)tileType; - WorldGen.SquareTileFrame(tileX, tileY); - } - } - } - } - } - } - public static void ClearTunnel(int startX, int startY, int endX, int endY, int width = 3) - { - int dx = endX - startX; - int dy = endY - startY; - int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); - - for (int i = 0; i <= steps; i++) - { - float t = (float)i / steps; - int x = (int)(startX + dx * t); - int y = (int)(startY + dy * t); - - for (int xi = -width; xi <= width; xi++) - { - for (int yi = -width; yi <= width; yi++) - { - if (xi * xi + yi * yi <= width * width) - { - int tileX = x + xi; - int tileY = y + yi; - - if (WorldGen.InWorld(tileX, tileY)) - { - Tile tTile = Main.tile[tileX, tileY]; - tTile.HasTile = false; - tTile.WallType = (ushort)ModContent.WallType(); - tTile.LiquidAmount = 0; - - WorldGen.SquareWallFrame(tileX, tileY); - - // Optional: Add honey with low chance - if (WorldGen.genRand.NextBool(10)) - { - tTile.LiquidAmount = 100; - tTile.LiquidType = LiquidID.Honey; - WorldGen.SquareTileFrame(tileX, tileY); - } - } - } - } - } - } - } public static void CreateHexagon(int centerX, int centerY, int hexagonSize, int tileType, bool doWalls = false) { int halfHexagonSize = hexagonSize / 2; @@ -600,9 +524,9 @@ namespace CalamityMod.World int hexRadius = WorldGen.genRand.Next(30, 45); CreateGiantHiveHexagon(newX, newY - 15, hexRadius - 1, TileID.Hive, true); CreateHexagon(newX, newY - 15, hexRadius, TileID.Hive); - ClearTunnel(x, y + 30, newX, newY, 5); - CreateTunnel(x, y + 30, newX, newY); - ClearTunnel(x, y + 30, newX, newY, 3); + MiscWorldgenRoutines.ClearTunnel(x, y + 30, newX, newY, 5, 0, 2, true, true); + MiscWorldgenRoutines.CreateTunnel(x, y + 30, newX, newY, 6, TileID.Hive); + MiscWorldgenRoutines.ClearTunnel(x, y + 30, newX, newY, 3, (ushort)ModContent.WallType(), 2, true, true); GiantHiveWallHexagon(newX, newY - 10, WorldGen.genRand.Next(19, 26)); // Place honey chest in this cell with a small chance diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index 6b92ec1073..412df60374 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -145,6 +145,93 @@ namespace CalamityMod.World } #endregion + #region Tunnel Tools + public static void CreateTunnel(int startX, int startY, int endX, int endY, int width = 6, int tileType = TileID.Dirt) + { + int dx = endX - startX; + int dy = endY - startY; + int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); + + for (int i = 0; i <= steps; i++) + { + float t = (float)i / steps; + int x = (int)(startX + dx * t); + int y = (int)(startY + dy * t); + + // Draw a small circular path + for (int xi = -width; xi <= width; xi++) + { + for (int yi = -width; yi <= width; yi++) + { + if (xi * xi + yi * yi <= width * width) + { + int tileX = x + xi; + int tileY = y + yi; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = true; + tTile.TileType = (ushort)tileType; + WorldGen.SquareTileFrame(tileX, tileY); + } + } + } + } + } + } + public static void ClearTunnel(int startX, int startY, int endX, int endY, int width = 3, int wallType = WallID.Dirt, int liquidType = LiquidID.Water, bool liquidOn = true, bool wallOn = true) + { + int dx = endX - startX; + int dy = endY - startY; + int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); + + for (int i = 0; i <= steps; i++) + { + float t = (float)i / steps; + int x = (int)(startX + dx * t); + int y = (int)(startY + dy * t); + + for (int xi = -width; xi <= width; xi++) + { + for (int yi = -width; yi <= width; yi++) + { + if (xi * xi + yi * yi <= width * width) + { + int tileX = x + xi; + int tileY = y + yi; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = false; + if (wallOn) + { + tTile.WallType = (ushort)wallType; + } + + tTile.LiquidAmount = 0; + + WorldGen.SquareWallFrame(tileX, tileY); + + // Optional: Add liquid with low chance + if (liquidOn) + { + if (WorldGen.genRand.NextBool(10)) + { + tTile.LiquidAmount = 100; + tTile.LiquidType = liquidType; + WorldGen.SquareTileFrame(tileX, tileY); + } + } + } + } + } + } + } + } + #endregion + #region Chasm Generator public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) { diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index 7d8174109c..34ec893c17 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -10,6 +10,7 @@ using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.Abyss.Stalactite; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.RGB; @@ -244,7 +245,7 @@ namespace CalamityMod.World int width = BiomeWidth + 1; int maxDepth = BlockDepth; ushort blockTileType = (ushort)ModContent.TileType(); - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); for (int i = 1; i < width; i++) { @@ -326,7 +327,7 @@ namespace CalamityMod.World for (int y = top; y < bottom; y++) { if (y >= top + DepthForWater) - Main.tile[x, y + WorldGen.genRand.Next(22, 25)].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y + WorldGen.genRand.Next(22, 25)].WallType = (ushort)ModContent.WallType(); Main.tile[x, y].LiquidAmount = byte.MaxValue; Main.tile[x, y].Get().HasTile = false; } @@ -343,7 +344,7 @@ namespace CalamityMod.World int right = (int)(BiomeWidth * IslandWidthPercentage); int maxDepth = MaxTopWaterDepth; ushort blockTileType = (ushort)ModContent.TileType(); - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); for (int i = left; i < right; i++) { @@ -384,7 +385,7 @@ namespace CalamityMod.World if (maxCaveWidth > 15) maxCaveWidth = 15; - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); for (int i = 2; i < shallowWaterCaveCount; i++) { @@ -441,7 +442,7 @@ namespace CalamityMod.World { int width = BiomeWidth; int depth = (int)(BlockDepth * 0.96f); - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); for (int c = 0; c < SpaghettiCaveCarveOutThresholds.Length; c++) { @@ -485,7 +486,7 @@ namespace CalamityMod.World { int width = BiomeWidth; int depth = (int)(BlockDepth * 0.96f); - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); for (int c = 0; c < CheeseCaveCarveOutThresholds.Length; c++) { @@ -818,7 +819,7 @@ namespace CalamityMod.World int beachWidth = WorldGen.genRand.Next(150, 190 + 1); var searchCondition = Searches.Chain(new Searches.Down(3000), new Conditions.IsSolid()); ushort sandID = (ushort)ModContent.TileType(); - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); // Stop immediately if for some strange reason a valid tile could not be located for the beach starting point. if (!WorldUtils.Find(new Point(BiomeWidth + 4, Main.remixWorld ? YStart : (int)GenVars.worldSurfaceLow - 20), searchCondition, out Point determinedPoint)) @@ -1052,7 +1053,7 @@ namespace CalamityMod.World { int sandstoneSeed = WorldGen.genRand.Next(); ushort sandstoneID = (ushort)ModContent.TileType(); - ushort sandstoneWallID = (ushort)ModContent.WallType(); + ushort sandstoneWallID = (ushort)ModContent.WallType(); // Edge score evaluation function that determines the propensity a tile has to become sandstone. // This is based on how much nearby empty areas there are, allowing for "edges" to appear. @@ -1256,7 +1257,7 @@ namespace CalamityMod.World for (int dy = 0; dy < 2; dy++) { Main.tile[chestPoint.X + dx, chestPoint.Y - dy].LiquidAmount = 0; - Main.tile[chestPoint.X + dx, chestPoint.Y - dy].WallType = (ushort)ModContent.WallType(); + Main.tile[chestPoint.X + dx, chestPoint.Y - dy].WallType = (ushort)ModContent.WallType(); Main.tile[chestPoint.X + dx, chestPoint.Y - dy].Get().HasTile = false; } } @@ -1578,7 +1579,7 @@ namespace CalamityMod.World int depth = BlockDepth; ushort columnID = (ushort)ModContent.TileType(); ushort hardenedSandstoneWallID = (ushort)ModContent.WallType(); - ushort sandWallID = (ushort)ModContent.WallType(); + ushort sandWallID = (ushort)ModContent.WallType(); short variantFrameOffset = (short)(WorldGen.genRand.Next(3) * 36); for (int x = left; x < left + 2; x++) diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index a33f23598e..fe847dcf80 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -1,11 +1,15 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Reflection.Metadata; using System.Threading.Tasks; +using Terraria.ObjectData; using CalamityMod.Tiles.SunkenSea; using CalamityMod.Tiles.SunkenSea.Ambient; using CalamityMod.Utilities; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; +using Microsoft.VisualBasic; using Microsoft.Xna.Framework; using ReLogic.Threading; using ReLogic.Utilities; @@ -64,8 +68,6 @@ namespace CalamityMod.World } /* checklist: - - -Add the wall corals properly -Make sunken sea walls produce water cut a half oval out of the top of forest in anticipation of structure placement */ @@ -87,69 +89,64 @@ namespace CalamityMod.World int biomeSize = 250 + (Main.maxTilesX / 180); - // - // Places a trapezoid of circles to serve as the main area for the biome. - // - const float steepness = 25f; - static float trapezoidLateralSteep(float x) + int XLeft = GenVars.UndergroundDesertLocation.Left; + + int XRight = GenVars.UndergroundDesertLocation.Right; + + const int totalCuveDepth = 90; + // this converts basalt to runestone directy in line to the desert to make the shape look perfect to blend well with the rest of the desert + ParallelFor(XLeft, XRight, 20, (x) => { - if (x <= 1f / steepness) - return steepness * x; - else if (x > 1f / steepness && x < 1f - 1f / steepness) - return 1f; - else - return -steepness * x + steepness; - } - ParallelFor(startX - biomeSize - 5, startX + biomeSize + 20, 15, (X) => - { - float height = MathHelper.Lerp(startY + 35, startY - 15, trapezoidLateralSteep(Utils.GetLerpValue(startX - biomeSize - 20, startX + biomeSize + 20, X))); - for (int Y = startY + 25; Y >= height; Y -= 10) + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 30, startX + biomeSize - 200, x, true))); + int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 30, startX - biomeSize + 200, x, true))); + + for (int y = startY + 100; y >= startY - 175; y -= 15) { - ShapeData circle = new ShapeData(); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Rectangle(20, 20), Actions.Chain(new GenAction[] { - // new Modifiers.RadialDither(1, 30).Output(circle), - new Modifiers.Blotches().Output(circle), + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.SetTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + } }); - // // Makes the bottom borders of the Timeless Shores curved downwards. // - const int totalCuveDepth = 90; - ParallelFor(startX - biomeSize - 10, startX - biomeSize + 200, 10, (x) => + ParallelFor(startX - biomeSize, startX - biomeSize + 200, 10, (x) => { int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, x, true))); for (int y = startY + 50; y <= startY + 70 + curveDepth; y += 5) { ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Slime(30), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y), new Shapes.Slime(20), Actions.Chain(new GenAction[] { // new Modifiers.RadialDither(1, 30).Output(circle), new Modifiers.Blotches().Output(circle) })); WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.PlaceWall((ushort)ModContent.WallType())); } }); - ParallelFor(startX + biomeSize - 200, startX + biomeSize + 10, 5, (x) => + ParallelFor(startX + biomeSize - 200, startX + biomeSize, 5, (x) => { int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, x, true))); for (int y = startY + 50; y <= startY + 70 + curveDepth; y += 5) { ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Slime(30), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y), new Shapes.Slime(20), Actions.Chain(new GenAction[] { // new Modifiers.RadialDither(1, 30).Output(circle), new Modifiers.Blotches().Output(circle) })); WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.PlaceWall((ushort)ModContent.WallType())); } }); - // Clear a smaller square out of the center where the biomes stuff will be - // Added curves to the top of the biome via curve depth -hpu 02/19/25 + // Clears out a curved cavity inside the timeless shores, this creates the main large open space inside the biome ParallelFor(startX - biomeSize + 10, startX + biomeSize - 10, 1, (X) => { int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, X, true))); @@ -175,27 +172,28 @@ namespace CalamityMod.World // // Places slopes at the sides of the shores to actually make shores. // - ParallelFor(startX - biomeSize - 15, startX - biomeSize + 200, 20, (moundX) => + ParallelFor(startX - biomeSize - 85, startX - biomeSize + 200, 20, (moundX) => { int RandomX = Main.rand.Next(15, 20); ShapeData mound = new(); GenAction blotchMod = new Modifiers.Blotches().Output(mound); int moundY = startY + 75; - int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize + 27, startX - biomeSize + 200, moundX))); + int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize, startX - biomeSize + 200, moundX))); WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); }); - ParallelFor(startX + biomeSize - 200, startX + biomeSize - 15, 20, (moundX) => + ParallelFor(startX + biomeSize - 200, startX + biomeSize + 85, 20, (moundX) => { ShapeData mound = new(); GenAction blotchMod = new Modifiers.Blotches().Output(mound); int moundY = startY + 75; - int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize - 27, startX + biomeSize - 200, moundX))); + int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize, startX + biomeSize - 200, moundX))); WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); }); @@ -215,10 +213,14 @@ namespace CalamityMod.World { // Clear all tiles and place tiles. new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()) + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) })); } }); + // + // Makes the platform have a curve on top + // ParallelFor(startX - platformSize / 2, startX + platformSize / 2, 1, (x) => { float interpolator = CalamityUtils.Convert01To010(Utils.GetLerpValue(startX - platformSize / 2, startX + platformSize / 2, x, true)); @@ -227,35 +229,71 @@ namespace CalamityMod.World }); // Plateau - ParallelFor(startX - biomeSize, startX + biomeSize, 100, (wallPillarX) => + ParallelFor(startX - biomeSize, startX + biomeSize, 100, (wallPlateauX) => { - int randomDisplacement = WorldGen.genRand.Next(-27, 46); - int RandomX = Main.rand.Next(15, 20); - int RandomH = Main.rand.Next(20, 35); + int randomDisplacement = WorldGen.genRand.Next(-46, -27); + int RandomX = Main.rand.Next(7, 15); + int RandomH = Main.rand.Next(15, 25); - for (int wallPillarY = startY + RandomH; wallPillarY <= startY + 60; wallPillarY += 10) + for (int wallPlateauY = startY + RandomH; wallPlateauY <= startY + 60; wallPlateauY += 10) { // Along the height of the pillar, it becomes shorter the more closer to the center we get. - int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - RandomH, startY + 45, wallPillarY)) * 25); + int PlateauWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - RandomH, startY + 45, wallPlateauY)) * 25); - ShapeData rectangle = new ShapeData(); + ShapeData Circle = new ShapeData(); GenAction blotchFilter = new Modifiers.Blotches(1, 0.4); - GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startY + 30, startY + 70, wallPillarY) + 0.25, 1)); - - WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Circle(RandomX - pillarWidth + 3, RandomX), Actions.Chain(new GenAction[] + if (Main.tile[startX, startY].WallType == (ushort)ModContent.WallType()) { - // Applies a blotch filter to the rectangle. - blotchFilter.Output(rectangle) - })); + WorldUtils.Gen(new Point(randomDisplacement + wallPlateauX + PlateauWidth / 2, randomDisplacement + wallPlateauY), new Shapes.Circle(RandomH - PlateauWidth + 3, RandomX), Actions.Chain(new GenAction[] + { + blotchFilter.Output(Circle) + })); - WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 4, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] - { - new Actions.SetTile((ushort)ModContent.TileType()) - })) - ; + WorldUtils.Gen(new Point(randomDisplacement + wallPlateauX + PlateauWidth / 4, randomDisplacement + wallPlateauY), new ModShapes.All(Circle), Actions.Chain(new GenAction[] + { + new Actions.SetTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) + })) + ; + } } - }); + } + ); + + //Poop emote for gfb + //ParallelFor(startX - biomeSize, startX + biomeSize, 100, (wallPillarX) => + //{ + // int randomDisplacement = WorldGen.genRand.Next(-46, -27); + // int RandomX = Main.rand.Next(7, 15); + // int RandomH = Main.rand.Next(15, 25); + + // for (int wallPillarY = startY + RandomH; wallPillarY <= startY + 60; wallPillarY += 10) + // { + // // Along the height of the pillar, it becomes shorter the more closer to the center we get. + // int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - RandomH, startY + 45, wallPillarY)) * 25); + + // ShapeData rectangle = new ShapeData(); + // GenAction blotchFilter = new Modifiers.Blotches(1, 0.4); + // GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startY + 30, startY + 70, wallPillarY) + 0.25, 1)); + // if (Main.tile[startX, startY].WallType == (ushort)ModContent.WallType()) + // { + // WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 2, randomDisplacement + wallPillarY), new Shapes.Circle(RandomH - pillarWidth + 3, RandomX), Actions.Chain(new GenAction[] + // { + // // Applies a blotch filter to the rectangle. + // blotchFilter.Output(rectangle) + // })); + + // WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 4, randomDisplacement + wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] + // { + // new Actions.SetTile((ushort)ModContent.TileType()) + // })) + // ; + // } + // } + + //} + //); //place water below the clear barrier for the islands so that theres water inbetween them ParallelFor(startX - biomeSize + 35, startX + biomeSize - 35, 1, (WaterX) => @@ -273,7 +311,7 @@ namespace CalamityMod.World const int furthestDistanceFromCenter = 100; ParallelFor(startX - (biomeSize / 2) - furthestDistanceFromCenter, startX + (biomeSize / 2) + furthestDistanceFromCenter, 100, (wallPillarX) => { - int randomDisplacementX = WorldGen.genRand.Next(-10, 10); + int randomDisplacementX = WorldGen.genRand.Next(-25, 25); int RandomX = Main.rand.Next(3, 6); for (int wallPillarY = startY - 75; wallPillarY <= startY + 80; wallPillarY += 10) @@ -293,18 +331,45 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] { - new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. + new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. })) ; } }); + // places wall flowers in the curved cavity inside the timeless shores. This is done here to prevent them from appearing in the transiton area + ParallelFor(startX - biomeSize + 10, startX + biomeSize - 10, 1, (X) => + { + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, X, true))); + int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, X, true))); + + for (int Y = startY - 60 + curveDepth + curveDepth2; Y <= startY + 30; Y++) + { + int Rand3() => WorldGen.genRand.Next(3); + int ShoresFlowerVariants = Rand3(); + + if (Main.tile[X, Y].WallType == ModContent.WallType() && WorldGen.EmptyTileCheck(X - 1, Y - 1, 3, 3)) + { + if (WorldGen.genRand.NextBool(60)) + { + WorldGen.PlaceObject(X - 1, Y - 1, ModContent.TileType(), mute: true, style: ShoresFlowerVariants); + } + } + + if (Main.tile[X, Y].WallType == ModContent.WallType() && WorldGen.EmptyTileCheck(X - 1, Y - 1, 2, 2)) + { + if (WorldGen.genRand.NextBool(60)) + WorldGen.PlaceObject(X - 1, Y - 1, ModContent.TileType(), mute: true, style: ShoresFlowerVariants); + } + } + }); + // // Makes the transition area to the Timeless Shores. // Replaces tiles, walls, and places some water spots. // - ParallelFor(startX - biomeSize - 30, startX + biomeSize + 30, 20, (x) => - { + ParallelFor(startX - biomeSize - 15, startX + biomeSize + 30, 20, (x) => + { int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 30, startX + biomeSize - 200, x, true))); int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 30, startX - biomeSize + 200, x, true))); @@ -312,28 +377,28 @@ namespace CalamityMod.World { float interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - - + //WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + //{ + // new Modifiers.OnlyTiles(TileID.Sand), + // new Actions.ClearTile(), + // new Actions.PlaceTile((ushort)ModContent.TileType()), + // new Actions.PlaceWall((ushort)ModContent.WallType()) + //})); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { - new Modifiers.OnlyTiles(TileID.Sand), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(TileID.HardenedSand), + new Modifiers.OnlyTiles(TileID.HardenedSand, TileID.Sand,TileID.Copper,TileID.Tin, TileID.Iron, TileID.Lead), new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) })); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { - new Modifiers.OnlyTiles(TileID.DesertFossil), + new Modifiers.OnlyTiles(TileID.DesertFossil,TileID.Tungsten,TileID.Silver,TileID.Gold,TileID.Platinum,TileID.Demonite,TileID.Crimtane), new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) })); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] @@ -349,7 +414,7 @@ namespace CalamityMod.World { new Modifiers.OnlyWalls(WallID.Sandstone, WallID.HardenedSand), new Actions.ClearWall(), - new Actions.PlaceWall((ushort)ModContent.WallType()), + new Actions.PlaceWall((ushort)ModContent.WallType()), })); interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); @@ -358,6 +423,7 @@ namespace CalamityMod.World new Modifiers.OnlyTiles(TileID.Sandstone), new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) })); interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] @@ -366,7 +432,15 @@ namespace CalamityMod.World new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), })); - + + interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyWalls((ushort)ModContent.WallType()), + new Actions.ClearWall(), + new Actions.PlaceWall((ushort)ModContent.WallType()) + })); + if (Main.tile[x, y].Get().LiquidType == LiquidID.Lava) WorldUtils.Gen(new Point(x, y), new Shapes.Rectangle(5, 5), new Actions.SetLiquid(LiquidID.Lava, 0)); @@ -385,12 +459,16 @@ namespace CalamityMod.World { for (int Y = startY - 100; Y <= startY + 100; Y++) { - bool canPlaceSand = - Main.tile[X, Y].TileType == ModContent.TileType() && - ColumnClearOrDecor(X, Y, 5); + bool canPlaceSand = Main.tile[X, Y].TileType == ModContent.TileType() && ColumnClearOrDecor(X, Y, 5); if (canPlaceSand) + { + if (Main.tile[X, Y - 1].WallType == 0) + { + WorldGen.KillWall(X, Y); + } PlaceSand(X, Y, 5, ModContent.TileType()); + } // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; @@ -447,7 +525,7 @@ namespace CalamityMod.World Vector2 bottomFoci = center + fociOffset; ushort Shellstone = (ushort)ModContent.TileType(); - ushort ShellstoneWall = (ushort)ModContent.WallType(); + ushort ShellstoneWall = (ushort)ModContent.WallType(); // Generate the actual caverns bool runOnce = false; // This is used to make the wall on the left side go boom on the second run @@ -465,18 +543,20 @@ namespace CalamityMod.World // Place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself if (!runOnce) { - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), Shellstone, true, 0f, 0f, true, true); + t.WallType = ShellstoneWall; runOnce = true; } // Place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself if (runOnce) - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), false, 0f, 0f, true, true); + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), Shellstone, false, 0f, 0f, true, true); + t.WallType = ShellstoneWall; } else { // Clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); + t.ClearEverything(); // Generate perlin noise caves float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 90f, Y / 90f, 3, unchecked(cavePerlinSeed + 1)) * 0.01f; @@ -512,8 +592,8 @@ namespace CalamityMod.World if (caveNoiseMapWalls * caveNoiseMapWalls < (caveCreationThresholdWalls - (caveNoiseMapWalls * 0.2f))) WorldGen.KillTile(X, Y); - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; + t.Get().LiquidType = LiquidID.Water; + t.LiquidAmount = byte.MaxValue; } } } @@ -626,7 +706,7 @@ namespace CalamityMod.World Vector2 bottomFoci = center + fociOffset; ushort Limestone = (ushort)ModContent.TileType(); - ushort LimestoneWall = (ushort)ModContent.WallType(); + ushort LimestoneWall = (ushort)ModContent.WallType(); // Place the polyp forest caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) @@ -698,7 +778,7 @@ namespace CalamityMod.World if ((caveNoiseMapWalls + 0.085f) * (caveNoiseMapWalls + 0.085f) > caveCreationThresholdWalls) { if (t.WallType == 0) - t.WallType = (ushort)ModContent.WallType(); + t.WallType = (ushort)ModContent.WallType(); } Main.tile[X, Y].Get().LiquidType = LiquidID.Water; Main.tile[X, Y].LiquidAmount = byte.MaxValue; @@ -840,15 +920,13 @@ namespace CalamityMod.World } } //bottom of the biome (gleaming burrows) - public static void PlaceGleamingBurrows(int startPosX, int startPosY) + public static void PlaceGleamingBurrowsGeodes(int startPosX, int startPosY) + { int startX = startPosX + SSOffsets.GlobalX + SSOffsets.GleamingBurrowsX; int startY = startPosY + SSOffsets.GlobalY + SSOffsets.GleamingBurrowsY; - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - Point origin = new Point(startX, startY); Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); @@ -867,177 +945,9 @@ namespace CalamityMod.World Vector2 bottomFoci = center + fociOffset; ushort Navystone = (ushort)ModContent.TileType(); - ushort NavystoneWall = (ushort)ModContent.WallType(); - - int XStart = origin.X - biomeSize - 3; - int XEnd = origin.X + biomeSize + 3; - - int YStart = (int)(origin.Y - verticalRadius * 0.4f) - 3; - int YEnd = origin.Y + verticalRadius + 3; - - //place another barrier so the gleaming burrows doesnt just burst into the gully - - var basaltcircle = new Shapes.Circle(30); - GenAction paintBasalt = Actions.Chain( - new Actions.Clear(), - new Actions.SetTile((ushort)ModContent.TileType()), - new Actions.SetFrames(true) - ); - - for (int X = XStart; X < XEnd; X += 14) - { - for (int Y = YStart; Y <= YEnd; Y += 12) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float _, true) - && Y > origin.Y - 10) - { - WorldUtils.Gen(new Point(X - 5, Y + 5), basaltcircle, paintBasalt); - } - } - } - //place the gleaming burrows caverns - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - Tile t = Main.tile[X, Y]; - float percent = dist / constant; - float blurPercent = 0.99f; - - if (percent > blurPercent) - { - if (Y > origin.Y - 15) - { - //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); - } - - //place clean transition between the burrows and the other biomes - if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - else - { - //clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); - - //generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; - - //kill or place tiles depending on the noise map - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { - WorldGen.KillTile(X, Y); - } - else - { - t.TileType = Navystone; - t.HasTile = true; - } - - float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWallsinner; - float cavePerlinValue2Wallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWallsinner = (cavePerlinValueWallsinner + cavePerlinValue2Wallsinner) * 0.5f; - float caveCreationThresholdWallsinner = horizontalOffsetNoiseWallsinner * 5.5f + 0.435f; - - if (caveNoiseMapWallsinner * caveNoiseMapWallsinner > caveCreationThresholdWallsinner) - { - t.WallType = (ushort)ModContent.WallType(); - } - - //place walls in the biome using a different "seed" so it differs from the cave generation - //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; - - if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { - if (t.WallType == 0) - t.WallType = NavystoneWall; - } - - - - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; - } - } - } - } + ushort NavystoneWall = (ushort)ModContent.WallType(); - //cleanup the perlin caves - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - } - } - } - - - //place extra tiles - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - bool canPlaceSand = false; - - //place sand clumps on top of exposed navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 4, ModContent.TileType()); - } - } - } - } //cleanup again, also place geodes for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) @@ -1081,6 +991,242 @@ namespace CalamityMod.World } } } + public static void PlaceGleamingBurrows(int startPosX, int startPosY) + { + int startX = startPosX + SSOffsets.GlobalX + SSOffsets.GleamingBurrowsX; + + int startY = startPosY + SSOffsets.GlobalY + SSOffsets.GleamingBurrowsY; + + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); + + Point origin = new Point(startX, startY); + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); + + float angle = MathHelper.Pi * 0.15f; + float otherAngle = MathHelper.PiOver2 - angle; + + int biomeSize = 220 + (Main.maxTilesX / 180); + float actualSize = biomeSize * 16f; + float constant = actualSize * 2f / (float)Math.Sin(angle); + + float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); + int verticalRadius = (int)(constant / 16f); + + Vector2 fociOffset = Vector2.UnitY * fociSpacing; + Vector2 topFoci = center - fociOffset; + Vector2 bottomFoci = center + fociOffset; + + ushort Navystone = (ushort)ModContent.TileType(); + ushort NavystoneWall = (ushort)ModContent.WallType(); + + int XStart = origin.X - biomeSize - 3; + int XEnd = origin.X + biomeSize + 3; + + int YStart = (int)(origin.Y - verticalRadius * 0.4f) - 3; + int YEnd = origin.Y + verticalRadius + 3; + + int newTunnelXLeft = (startX - 300); + int newTunnelYLeft = (startY - 10); + + int newTunnelXRight = (startX + 300); + int newTunnelYRight = (startY - 10); + + + //place another barrier so the gleaming burrows doesnt just burst into the gully + + var basaltcircle = new Shapes.Circle(30); + GenAction paintBasalt = Actions.Chain( + new Actions.Clear(), + new Actions.SetTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()), + new Actions.SetFrames(true) + ); + + for (int X = XStart; X < XEnd; X += 14) + { + for (int Y = YStart; Y <= YEnd; Y += 12) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float _, true) + && Y > origin.Y - 10) + { + WorldUtils.Gen(new Point(X - 5, Y + 5), basaltcircle, paintBasalt); + } + } + } + + var Obsidiancircle = new Shapes.Circle(13); + GenAction paintObsidian = Actions.Chain( + new Actions.Clear(), + new Actions.SetTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()), + new Actions.SetFrames(true) + ); + + for (int X = XStart; X < XEnd; X += 5) + { + for (int Y = YStart; Y <= YEnd; Y += 5) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float _, true) + && Y > origin.Y - 10) + { + WorldUtils.Gen(new Point(X - 2, Y + 7), Obsidiancircle, paintObsidian); + } + } + } + + + //place the gleaming burrows caverns + for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + Tile t = Main.tile[X, Y]; + float percent = dist / constant; + float blurPercent = 0.99f; + + if (percent > blurPercent) + { + if (Y > origin.Y - 15) + { + //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + t.WallType = (ushort)ModContent.WallType(); + } + + //place clean transition between the burrows and the other biomes + if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), new Actions.PlaceWall((ushort)ModContent.WallType()) + })); + } + } + else + { + + + //clear absolutely everything before generating the caverns + Main.tile[X, Y].ClearEverything(); + + //generate perlin noise caves + float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; + float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; + float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; + + //kill or place tiles depending on the noise map + if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) + { + WorldGen.KillTile(X, Y); + } + else + { + t.TileType = Navystone; + t.HasTile = true; + } + + float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWallsinner; + float cavePerlinValue2Wallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float caveNoiseMapWallsinner = (cavePerlinValueWallsinner + cavePerlinValue2Wallsinner) * 0.5f; + float caveCreationThresholdWallsinner = horizontalOffsetNoiseWallsinner * 5.5f + 0.435f; + + if (caveNoiseMapWallsinner * caveNoiseMapWallsinner > caveCreationThresholdWallsinner) + { + t.WallType = (ushort)ModContent.WallType(); + } + + //place walls in the biome using a different "seed" so it differs from the cave generation + //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through + float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; + float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; + + if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) + { + if (t.WallType == 0) + t.WallType = NavystoneWall; + } + + + + Main.tile[X, Y].Get().LiquidType = LiquidID.Water; + Main.tile[X, Y].LiquidAmount = byte.MaxValue; + } + } + } + } + + //Tunnels + MiscWorldgenRoutines.ClearTunnel(startX - 200, startY + 40, newTunnelXLeft, newTunnelYLeft, 3, (ushort)ModContent.WallType(), 2, false, false); + MiscWorldgenRoutines.ClearTunnel(startX + 200, startY + 40, newTunnelXRight, newTunnelYRight, 3, (ushort)ModContent.WallType(), 2, false, false); + + //cleanup the perlin caves + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } + } + } + } + + //place extra tiles + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + bool canPlaceSand = false; + + //place sand clumps on top of exposed navystone + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 4, ModContent.TileType()); + } + } + } + } + + + } //Very bottom of the biome (Clam Den) public static void PlaceClamDen(int startPosX, int startPosY) @@ -1126,18 +1272,12 @@ namespace CalamityMod.World { //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + t.WallType = (ushort)ModContent.WallType(); } //place clean transition between the burrows and the other biomes if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] { new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) })); @@ -1158,7 +1298,7 @@ namespace CalamityMod.World if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) { - t.WallType = (ushort)ModContent.WallType(); + t.WallType = (ushort)ModContent.WallType(); } Main.tile[X, Y].Get().LiquidType = LiquidID.Water; @@ -1257,7 +1397,6 @@ namespace CalamityMod.World } } - //basalt biome underneath the sunken sea //public static void PlaceBasaltGullyBorderBlend(int startPosX, int startPosY) //{ // int startX = (startPosX + SSOffsets.GlobalX + SSOffsets.BasaltGullyX); @@ -1338,10 +1477,7 @@ namespace CalamityMod.World int startY = startPosY + SSOffsets.GlobalY + SSOffsets.BasaltGullyY; - int biomeSize = 250 + (Main.maxTilesX / 180); - - int XLeft = GenVars.UndergroundDesertLocation.Left + 40; - int XRight = GenVars.UndergroundDesertLocation.Right - 70; + int biomeSize = 270 + (Main.maxTilesX / 180); ushort Basalt = (ushort)ModContent.TileType(); ushort BasaltWall = (ushort)ModContent.WallType(); @@ -1356,8 +1492,8 @@ namespace CalamityMod.World int rightEdge = startX + biomeSize + 60; int basaltbordernoise = 270 + Main.rand.Next(0, 4); int basaltbordernoisetop = 625 + Main.rand.Next(0, 4); - const int totalCurveDepth = -320; - const int totalCurveDepthTop = 45; + const int totalCurveDepth = -475; + const int totalCurveDepthTop = -100; var squrt = MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true)); var squrt2 = MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true)); @@ -1415,8 +1551,8 @@ namespace CalamityMod.World } float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWallsinner; - float cavePerlinValue2Wallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float cavePerlinValueWallsinner = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWallsinner; + float cavePerlinValue2Wallsinner = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; float caveNoiseMapWallsinner = (cavePerlinValueWallsinner + cavePerlinValue2Wallsinner) * 0.5f; float caveCreationThresholdWallsinner = horizontalOffsetNoiseWallsinner * 5.5f + 0.435f; @@ -1487,21 +1623,7 @@ namespace CalamityMod.World Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); } Tile.SmoothSlope(X, Y); - } - } - } - - //cleanup is done separately because for whatever reason it keeps placing water inside of the gully if the cleanup is done before it - public static void BasaltGullyLavaCleanup(int startPosX, int startPosY) - { - ushort BasaltWall = (ushort)ModContent.WallType(); - int biomeSize = 230 + (Main.maxTilesX / 180); - - for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) - { - for (int Y = startPosY + 50; Y <= Main.maxTilesY - 200; Y++) - { Tile t = Main.tile[X, Y]; if (Main.tile[X, Y].WallType == BasaltWall) { @@ -1520,6 +1642,22 @@ namespace CalamityMod.World } } } + + + //cleanup is done separately because for whatever reason it keeps placing water inside of the gully if the cleanup is done before it + //public static void BasaltGullyLavaCleanup(int startPosX, int startPosY) + //{ + // ushort BasaltWall = (ushort)ModContent.WallType(); + // int biomeSize = 230 + (Main.maxTilesX / 180); + + // for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) + // { + // for (int Y = startPosY + 50; Y <= Main.maxTilesY - 200; Y++) + // { + + // } + // } + //} //place all the ambient tiles in the sunken sea @@ -1556,21 +1694,38 @@ namespace CalamityMod.World //Timeless Shores ambiant tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { + int Rand3() => WorldGen.genRand.Next(3); + int MediumShorePileVariants = Rand3(); int Rand6() => WorldGen.genRand.Next(6); int DriftwoodVariants = Rand6(); + int Rand9() => WorldGen.genRand.Next(9); + int ShorePileVariants = Rand9(); //Driftwood Ambiance - if (WorldGen.genRand.NextBool(60)) + if (WorldGen.genRand.NextBool(100)) { WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); } - if (WorldGen.genRand.NextBool(30)) + if (WorldGen.genRand.NextBool(100)) {; WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); } - if (WorldGen.genRand.NextBool(30)) + if (WorldGen.genRand.NextBool(100)) { WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); } + //Shore piles + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: ShorePileVariants); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: MediumShorePileVariants); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: MediumShorePileVariants); + } } @@ -1580,7 +1735,7 @@ namespace CalamityMod.World if (Y > 0) { Tile above = Main.tile[X, Y - 1]; - + // only if it's open air (no solid tile), and we don't overwrite other special liquids other than lava (just incase) if (!above.HasTile && above.Get().LiquidType != LiquidID.Honey && @@ -1597,31 +1752,34 @@ namespace CalamityMod.World int Rand6() => WorldGen.genRand.Next(6); int DriftwoodVariants = Rand6(); //Driftwood Ambiance - if (WorldGen.genRand.NextBool(60)) + if (WorldGen.genRand.NextBool(80)) { WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); } - if (WorldGen.genRand.NextBool(30)) + if (WorldGen.genRand.NextBool(60)) { WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); } - if (WorldGen.genRand.NextBool(30)) + if (WorldGen.genRand.NextBool(60)) { WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); } } + + + //gleaming burrows ambient tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { int Rand6() => WorldGen.genRand.Next(6); int NavystonePileVariants = Rand6(); //brain coral - if (WorldGen.genRand.NextBool(10)) + if (WorldGen.genRand.NextBool(30)) { WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); } //small brain coral - if (WorldGen.genRand.NextBool(5)) + if (WorldGen.genRand.NextBool(30)) { WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); } @@ -1731,12 +1889,12 @@ namespace CalamityMod.World int Rand6() => WorldGen.genRand.Next(6); int NavystonePileVariants = Rand6(); - if (WorldGen.genRand.NextBool(5) && !Main.tile[X + 1, Y].HasTile) + if (WorldGen.genRand.NextBool(30) && !Main.tile[X + 1, Y].HasTile) { WorldGen.PlaceTile(X + 2, Y, ModContent.TileType(), true, false, -1, TableCoralVariants); } - if (WorldGen.genRand.NextBool(5) && !Main.tile[X - 1, Y].HasTile) + if (WorldGen.genRand.NextBool(30) && !Main.tile[X - 1, Y].HasTile) { WorldGen.PlaceTile(X - 2, Y, ModContent.TileType(), true, false, -1, TableCoralVariants); } @@ -1889,7 +2047,12 @@ namespace CalamityMod.World if (WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), mute: true)) shipPlaced = true; } - + //small limestone piles + if (WorldGen.genRand.NextBool(25)) + { + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: DriftwoodVariants); + } + } //radiant reefs ambient tiles @@ -2122,7 +2285,7 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] { - new Actions.PlaceWall((ushort)ModContent.WallType()) + new Actions.PlaceWall((ushort)ModContent.WallType()) })); return true; @@ -2133,21 +2296,28 @@ namespace CalamityMod.World { List blockTileTypes = new() { + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), }; void getAttachedPoints(int x, int y, List points) diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 199fd4b84a..b5b3f95e9d 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -47,8 +47,7 @@ namespace CalamityMod.World } if (tile.TileType == TileType() || tile.TileType == TileType() || - tile.WallType == WallType() || - tile.WallType == WallType()) + tile.WallType == WallType()) { return true; }