diff --git a/Backgrounds/AstralSurfaceBGStyle.cs b/Backgrounds/AstralSurfaceBGStyle.cs index c89092d701..bc53eed640 100644 --- a/Backgrounds/AstralSurfaceBGStyle.cs +++ b/Backgrounds/AstralSurfaceBGStyle.cs @@ -8,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Backgrounds { + //this is just a blank background, so each custom background will draw over it public class AstralSurfaceBGStyle : ModSurfaceBackgroundStyle { internal static readonly FieldInfo screenOffField = typeof(Main).GetField("screenOff", BindingFlags.Instance | BindingFlags.NonPublic); @@ -25,13 +26,17 @@ namespace CalamityMod.Backgrounds { fades[i] += transitionSpeed; if (fades[i] > 1f) + { fades[i] = 1f; + } } else { fades[i] -= transitionSpeed; if (fades[i] < 0f) + { fades[i] = 0f; + } } } } diff --git a/Backgrounds/FloralParadiseBGStyle.cs b/Backgrounds/FloralParadiseBGStyle.cs new file mode 100644 index 0000000000..9f987956f8 --- /dev/null +++ b/Backgrounds/FloralParadiseBGStyle.cs @@ -0,0 +1,14 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Backgrounds +{ + public class FloralParadiseBGStyle : ModUndergroundBackgroundStyle + { + public override void FillTextureArray(int[] textureSlots) + { + // Corresponds to underground jungle backgrounds. Something custom could probably be made, but for what it is it works sufficiently for the minibiome. + for (int i = 0; i <= 3; i++) + textureSlots[i] = i + 153; + } + } +} diff --git a/Backgrounds/SunkenSeaBGStyle.cs b/Backgrounds/SunkenSeaBGStyle.cs index 8911537bb3..cfd743dd4f 100644 --- a/Backgrounds/SunkenSeaBGStyle.cs +++ b/Backgrounds/SunkenSeaBGStyle.cs @@ -1,4 +1,5 @@ -using Terraria.ModLoader; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Backgrounds { @@ -7,7 +8,10 @@ namespace CalamityMod.Backgrounds public override void FillTextureArray(int[] textureSlots) { for (int i = 0; i <= 3; i++) - textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG" + i.ToString()); + { + textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + //textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG" + i.ToString()); + } } } } diff --git a/Backgrounds/SunkenSeaBurrowsBG.cs b/Backgrounds/SunkenSeaBurrowsBG.cs new file mode 100644 index 0000000000..e096f3fdfd --- /dev/null +++ b/Backgrounds/SunkenSeaBurrowsBG.cs @@ -0,0 +1,128 @@ +using Terraria; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace CalamityMod.Backgrounds +{ + internal static class SunkenSeaBurrowsBG + { + public static void Load() + { + if (Main.dedServ) + { + return; + } + + On_Main.DrawBackgroundBlackFill += DrawBurrowsBG; + } + + public static float Transparency; + + public static float TransitionSpeed => 0.02f; + + private static void DrawBurrowsBG(On_Main.orig_DrawBackgroundBlackFill orig, Main self) + { + if (Main.gameMenu || Main.screenPosition.Y + Main.screenHeight < ((int)Main.worldSurface) * 16f) + { + orig(self); + + return; + } + + orig(self); + + if (Main.LocalPlayer.InModBiome(ModContent.GetInstance())) + { + Transparency += TransitionSpeed; + + if (Transparency > 1f) + { + Transparency = 1f; + } + } + else + { + //make transparency immediately go down so it doesnt look weird, since vanilla underground backgrounds dont have the fade-in effect this background has + Transparency -= 1f; + + if (Transparency < 0f) + { + Transparency = 0f; + } + } + + //dont bother running any of the background drawing if the transparency is zero (meaning the background isnt actually active) + //also do not run any of the background drawing if you have the vanilla background config option turned off + if (Transparency > 0f && Main.BackgroundEnabled) + { + Vector2 vector = Main.screenPosition + new Vector2((Main.screenWidth >> 1), (Main.screenHeight >> 1)); + float num = (Main.GameViewMatrix.Zoom.Y - 1f) * 0.5f * 200f; + float Scale = 1.5f; + + for (int Layers = 4; Layers >= 0; Layers--) + { + //get each background texture + Texture2D BGTexture = ModContent.Request("CalamityMod/Backgrounds/SunkenSeaBurrowsBG" + Layers).Value; + + Vector2 vector2 = new Vector2(BGTexture.Width, BGTexture.Height) * 0.5f; + float num2 = (Layers * 2 + 3f); + Vector2 vector3 = new Vector2(1f / num2); + Rectangle rectangle = new Rectangle(0, 0, BGTexture.Width, BGTexture.Height); + Vector2 zero = Vector2.Zero; + + switch (Layers) + { + case 0: + { + zero.Y += 800f; + break; + } + case 1: + { + zero.Y += 200f; + break; + } + case 2: + { + zero.Y += 450f; + break; + } + case 3: + { + zero.Y += 45f; + break; + } + case 4: + { + zero.Y += 45f; + break; + } + } + + vector2 *= Scale; + + zero.Y -= num; + float LoopWidth = Scale * rectangle.Width; + //float LoopHeight = Scale * rectangle.Height; + int LoopX = (int)((vector.X * vector3.X - vector2.X + zero.X - (Main.screenWidth >> 1)) / LoopWidth); + //int LoopY = (int)((vector.Y * vector3.Y - vector2.Y + zero.Y - (Main.screenWidth >> 1)) / LoopWidth); + + //for (int i = LoopY - 2; i < LoopY + 4 + (int)(Main.screenWidth / LoopHeight); i++) + //{ + for (int j = LoopX - 2; j < LoopX + 4 + (int)(Main.screenWidth / LoopWidth); j++) + { + Vector2 drawPosition = (new Vector2(j * Scale * (rectangle.Width / vector3.X), ((Main.LocalPlayer.Center.Y / 16f) - 90) * 16f) + vector2 - vector) * vector3 + vector - Main.screenPosition - vector2 + zero; + + var frame = rectangle; + var color = Color.MediumTurquoise * Transparency; + + Main.spriteBatch.Draw(BGTexture, drawPosition, frame, color, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f); + } + //} + } + } + } + } +} \ No newline at end of file diff --git a/Backgrounds/SunkenSeaBurrowsBG0.png b/Backgrounds/SunkenSeaBurrowsBG0.png new file mode 100644 index 0000000000..26ad2b3f50 Binary files /dev/null and b/Backgrounds/SunkenSeaBurrowsBG0.png differ diff --git a/Backgrounds/SunkenSeaBurrowsBG1.png b/Backgrounds/SunkenSeaBurrowsBG1.png new file mode 100644 index 0000000000..452e46c78c Binary files /dev/null and b/Backgrounds/SunkenSeaBurrowsBG1.png differ diff --git a/Backgrounds/SunkenSeaBurrowsBG2.png b/Backgrounds/SunkenSeaBurrowsBG2.png new file mode 100644 index 0000000000..3eb8e53eb6 Binary files /dev/null and b/Backgrounds/SunkenSeaBurrowsBG2.png differ diff --git a/Backgrounds/SunkenSeaBurrowsBG3.png b/Backgrounds/SunkenSeaBurrowsBG3.png new file mode 100644 index 0000000000..13524864b4 Binary files /dev/null and b/Backgrounds/SunkenSeaBurrowsBG3.png differ diff --git a/Backgrounds/SunkenSeaBurrowsBG4.png b/Backgrounds/SunkenSeaBurrowsBG4.png new file mode 100644 index 0000000000..33a816d561 Binary files /dev/null and b/Backgrounds/SunkenSeaBurrowsBG4.png differ diff --git a/BiomeManagers/FloralParadiseBiome.cs b/BiomeManagers/FloralParadiseBiome.cs new file mode 100644 index 0000000000..9789259705 --- /dev/null +++ b/BiomeManagers/FloralParadiseBiome.cs @@ -0,0 +1,18 @@ +using CalamityMod.Systems; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class FloralParadiseBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/FloralParadiseWater"); + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/FloralParadiseBGStyle"); + public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; + + public override bool IsBiomeActive(Player player) + { + return BiomeTileCounterSystem.FloralParadiseTiles >= 300; + } + } +} diff --git a/BiomeManagers/SunkenSeaBiome.cs b/BiomeManagers/SunkenSeaBiome.cs index 394241a43b..eda95f35b0 100644 --- a/BiomeManagers/SunkenSeaBiome.cs +++ b/BiomeManagers/SunkenSeaBiome.cs @@ -1,18 +1,65 @@ -using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Systems; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Graphics.Light; +using Microsoft.Xna.Framework; +using System; +using Mono.Cecil.Cil; +using MonoMod.Cil; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Systems; namespace CalamityMod.BiomeManagers { + //this is just a global sunken sea biome to check if you are in any of the existing biomes public class SunkenSeaBiome : ModBiome { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaWater"); - public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); - public override int BiomeTorchItemType => ModContent.ItemType(); - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; + + public override void Load() + { + //apply the drawblack edits here since all sunken sea biomes will have custom backgrounds + IL_Main.DrawBlack += ChangeBlackThreshold; + On_Main.DrawBlack += ForceDrawBlack; + } + + private void ForceDrawBlack(On_Main.orig_DrawBlack orig, Main self, bool force) + { + if (Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && Main.BackgroundEnabled) + { + orig(self, true); + } + else + { + orig(self, force); + } + } + + private float NewThreshold(float orig) + { + if (Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && Main.BackgroundEnabled) + { + return 0.1f; + } + else + { + return orig; + } + } + + private void ChangeBlackThreshold(ILContext il) + { + if (Main.BackgroundEnabled) + { + var c = new ILCursor(il); + c.TryGotoNext(n => n.MatchLdloc(6), n => n.MatchStloc(13)); //beginning of the loop, local 11 is a looping variable + c.Index++; //this is kinda goofy since I dont think you could actually ever write c# to compile to the resulting IL from emitting here. + c.Emit(OpCodes.Ldloc, 3); //pass the original value so we can set that instead if we dont want to change the threshold + c.EmitDelegate>(NewThreshold); //check if were in the biome to set, else set the original value + c.Emit(OpCodes.Stloc, 3); //num2 in vanilla, controls minimum threshold to turn a tile black + } + } + public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; // Placeholder until we get a dedicated Sunken Sea background public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; @@ -20,7 +67,8 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return BiomeTileCounterSystem.SunkenSeaTiles > 150; + return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 500 || BiomeTileCounterSystem.SunkenSeaPolypTiles > 500 || + BiomeTileCounterSystem.SunkenSeaReefsTiles > 500 || BiomeTileCounterSystem.SunkenSeaShoresTiles > 500; } } } diff --git a/BiomeManagers/SunkenSeaBurrowsBiome.cs b/BiomeManagers/SunkenSeaBurrowsBiome.cs new file mode 100644 index 0000000000..a0980ce333 --- /dev/null +++ b/BiomeManagers/SunkenSeaBurrowsBiome.cs @@ -0,0 +1,29 @@ +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Systems; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class SunkenSeaBurrowsBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaBurrowsWater"); + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); + public override int BiomeTorchItemType => ModContent.ItemType(); + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; + // Placeholder until we get a dedicated Sunken Sea background + public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + + public override bool IsBiomeActive(Player player) + { + bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; + bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; + + return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 500 && MoreThanReefs && MoreThanPolyp; + } + } +} diff --git a/BiomeManagers/SunkenSeaPolypBiome.cs b/BiomeManagers/SunkenSeaPolypBiome.cs new file mode 100644 index 0000000000..3c2fdeaeda --- /dev/null +++ b/BiomeManagers/SunkenSeaPolypBiome.cs @@ -0,0 +1,29 @@ +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Systems; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class SunkenSeaPolypBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaPolypWater"); + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); + public override int BiomeTorchItemType => ModContent.ItemType(); + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; + // Placeholder until we get a dedicated Sunken Sea background + public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + + public override bool IsBiomeActive(Player player) + { + bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaPolypTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; + bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaPolypTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; + + return BiomeTileCounterSystem.SunkenSeaPolypTiles > 500 && MoreThanReefs && MoreThanBurrows; + } + } +} diff --git a/BiomeManagers/SunkenSeaReefsBiome.cs b/BiomeManagers/SunkenSeaReefsBiome.cs new file mode 100644 index 0000000000..d9d7fe0c79 --- /dev/null +++ b/BiomeManagers/SunkenSeaReefsBiome.cs @@ -0,0 +1,29 @@ +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Systems; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class SunkenSeaReefsBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaReefsWater"); + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); + public override int BiomeTorchItemType => ModContent.ItemType(); + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; + // Placeholder until we get a dedicated Sunken Sea background + public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + + public override bool IsBiomeActive(Player player) + { + bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; + bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; + + return BiomeTileCounterSystem.SunkenSeaReefsTiles > 500 && MoreThanBurrows && MoreThanPolyp; + } + } +} diff --git a/BiomeManagers/SunkenSeaShoresBiome.cs b/BiomeManagers/SunkenSeaShoresBiome.cs new file mode 100644 index 0000000000..4f6252a37b --- /dev/null +++ b/BiomeManagers/SunkenSeaShoresBiome.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Systems; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class SunkenSeaShoresBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaShoresWater"); + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); + public override int BiomeTorchItemType => ModContent.ItemType(); + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; + // Placeholder until we get a dedicated Sunken Sea background + public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + + public override bool IsBiomeActive(Player player) + { + return BiomeTileCounterSystem.SunkenSeaShoresTiles > 500; + } + } +} diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 93d68380d4..a8239f952a 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -88,13 +88,6 @@ namespace CalamityMod.Buffs { player.endurance += BalancingConstants.SolarFlareShieldDR; } - - else if (type == BuffID.Warmth) - { - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Chilled] = true; - } else if (type == BuffID.Rabies) { player.GetDamage() -= 0.2f; diff --git a/Buffs/Placeables/CirrusBlueCandleBuff.cs b/Buffs/Placeables/CirrusBlueCandleBuff.cs index 5552456597..1080599c10 100644 --- a/Buffs/Placeables/CirrusBlueCandleBuff.cs +++ b/Buffs/Placeables/CirrusBlueCandleBuff.cs @@ -6,17 +6,29 @@ namespace CalamityMod.Buffs.Placeables { public class CirrusBlueCandleBuff : ModBuff { + public static float MoveSpeedBoost = 0.1f; + public static double WingTimeBoost = 0.1D; + public static float AccelerationBoost = 0.1f; + public override void SetStaticDefaults() { - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; + // These settings are standard for a "opt-in eternal" buff, which has the following properties: + // - Is not removed on death + // - Saves with the player / is not removed on logout + // - Does not display its time + // - Never reduces its duration + // - Can be manually canceled Main.pvpBuff[Type] = true; + Main.persistentBuff[Type] = true; Main.buffNoSave[Type] = false; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + BuffID.Sets.TimeLeftDoesNotDecrease[Type] = true; } + // Implementation is partially performed elsewhere using the blueCandle bool. public override void Update(Player player, ref int buffIndex) { + player.moveSpeed += MoveSpeedBoost; player.Calamity().blueCandle = true; } } diff --git a/Buffs/Placeables/CirrusPinkCandleBuff.cs b/Buffs/Placeables/CirrusPinkCandleBuff.cs index eaeb003cbc..8cf6bc1437 100644 --- a/Buffs/Placeables/CirrusPinkCandleBuff.cs +++ b/Buffs/Placeables/CirrusPinkCandleBuff.cs @@ -6,18 +6,24 @@ namespace CalamityMod.Buffs.Placeables { public class CirrusPinkCandleBuff : ModBuff { + public static double PercentHealthPerSecond = 0.004D; + public override void SetStaticDefaults() { - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; + // These settings are standard for a "opt-in eternal" buff, which has the following properties: + // - Is not removed on death + // - Saves with the player / is not removed on logout + // - Does not display its time + // - Never reduces its duration + // - Can be manually canceled Main.pvpBuff[Type] = true; + Main.persistentBuff[Type] = true; Main.buffNoSave[Type] = false; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + BuffID.Sets.TimeLeftDoesNotDecrease[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().pinkCandle = true; - } + // Implementation is performed elsewhere using the pinkCandle bool. + public override void Update(Player player, ref int buffIndex) => player.Calamity().pinkCandle = true; } } diff --git a/Buffs/Placeables/CirrusPurpleCandleBuff.cs b/Buffs/Placeables/CirrusPurpleCandleBuff.cs index a56d3e179b..3ad0e23b18 100644 --- a/Buffs/Placeables/CirrusPurpleCandleBuff.cs +++ b/Buffs/Placeables/CirrusPurpleCandleBuff.cs @@ -10,11 +10,17 @@ namespace CalamityMod.Buffs.Placeables public override void SetStaticDefaults() { - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; + // These settings are standard for a "opt-in eternal" buff, which has the following properties: + // - Is not removed on death + // - Saves with the player / is not removed on logout + // - Does not display its time + // - Never reduces its duration + // - Can be manually canceled Main.pvpBuff[Type] = true; + Main.persistentBuff[Type] = true; Main.buffNoSave[Type] = false; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + BuffID.Sets.TimeLeftDoesNotDecrease[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Placeables/CirrusYellowCandleBuff.cs b/Buffs/Placeables/CirrusYellowCandleBuff.cs index 8ad664c83a..1b5f9a7f96 100644 --- a/Buffs/Placeables/CirrusYellowCandleBuff.cs +++ b/Buffs/Placeables/CirrusYellowCandleBuff.cs @@ -1,24 +1,37 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.NPC; namespace CalamityMod.Buffs.Placeables { public class CirrusYellowCandleBuff : ModBuff { + public static float ExtraChipDamageRatio = 0.07f; + public override void SetStaticDefaults() { - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; + // These settings are standard for a "opt-in eternal" buff, which has the following properties: + // - Is not removed on death + // - Saves with the player / is not removed on logout + // - Does not display its time + // - Never reduces its duration + // - Can be manually canceled Main.pvpBuff[Type] = true; + Main.persistentBuff[Type] = true; Main.buffNoSave[Type] = false; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; - - // Spite (the +5% final damage effect of Yellow Candle) is a tag buff. Nothing is immune to it. - // They may however be unaffected by it (including only temporarily) if they have incredibly high DR. - BuffID.Sets.IsATagBuff[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + BuffID.Sets.TimeLeftDoesNotDecrease[Type] = true; } + // Implementation is performed elsewhere using the yellowCandle bool. public override void Update(Player player, ref int buffIndex) => player.Calamity().yellowCandle = true; + + // Yellow Candle is implemented as a dirty modifier. + internal static void ModifyHitInfo_Spite(ref HitInfo info) + { + int damageBoost = (int)(info.SourceDamage * ExtraChipDamageRatio); + info.Damage += damageBoost; + } } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 774b08df3f..80e3ffea0c 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4,6 +4,7 @@ using System.Linq; using CalamityMod.Balancing; using CalamityMod.BiomeManagers; using CalamityMod.Buffs; +using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.Dashes; @@ -54,6 +55,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.CalPlayer { @@ -533,6 +535,8 @@ namespace CalamityMod.CalPlayer public bool honeyDewHalveDebuffs = false; public bool livingDewHalveDebuffs = false; public int jewelBonusDefense = 0; + public float pulseCounter = 0; // Toxic Heart + public float pulseRate = 1; // Toxic Heart public bool aAmpoule = false; public bool rOoze = false; public bool JustWasDebuffed = false; @@ -794,6 +798,7 @@ namespace CalamityMod.CalPlayer public bool astralStarRain = false; public int astralStarRainCooldown = 0; public int AbaddonCooldown = 0; + public int AlchFlaskCooldown = 0; public bool plagueReaper = false; public bool plaguebringerPatronSet = false; public bool plaguebringerCarapace = false; @@ -901,6 +906,9 @@ namespace CalamityMod.CalPlayer public bool wither = false; public bool ManaBurn = false; + public int ImmobilityDebuffImmunityTimer = 0; + public const int ImmobilityDebuffImmunityTimerMax = 300; + public const int SulphSeaWaterSafetyTime = 720; public const int SulphSeaWaterRecoveryTime = 150; #endregion @@ -1096,13 +1104,21 @@ namespace CalamityMod.CalPlayer #region Biome public bool ZoneCalamity => Player.InModBiome(ModContent.GetInstance()); public bool ZoneAstral => Player.InModBiome(ModContent.GetInstance()) && !ZoneAbyss; - public bool ZoneSunkenSea => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneSunkenSea => ZoneSunkenBurrows || ZoneSunkenSeaReefs || ZoneSunkenSeaPolyp || ZoneSunkenSeaShores; + public bool ZoneSunkenBurrows => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneSunkenSeaReefs => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneSunkenSeaPolyp => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneSunkenSeaShores => Player.InModBiome(ModContent.GetInstance()); public bool ZoneSulphur => Player.InModBiome(ModContent.GetInstance()); public bool ZoneAbyss => ZoneAbyssLayer1 || ZoneAbyssLayer2 || ZoneAbyssLayer3 || ZoneAbyssLayer4; public bool ZoneAbyssLayer1 => Player.InModBiome(ModContent.GetInstance()); public bool ZoneAbyssLayer2 => Player.InModBiome(ModContent.GetInstance()); public bool ZoneAbyssLayer3 => Player.InModBiome(ModContent.GetInstance()); public bool ZoneAbyssLayer4 => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneFloralParadise => Player.InModBiome(ModContent.GetInstance()); + + public bool InAnyCalamityBiome => ZoneAbyss || ZoneCalamity || ZoneFloralParadise || ZoneSulphur || ZoneSunkenSea || ZoneAstral; + public bool abyssDeath = false; public int abyssBreathCD; public float caveDarkness = 0f; @@ -1785,7 +1801,6 @@ namespace CalamityMod.CalPlayer corrosiveSpine = false; RustyMedallionDroplets = false; MiniSwarmers = false; - noStupidNaturalARSpawns = false; rottenDogTooth = false; angelicAlliance = false; BloomStoneRegen = false; @@ -2156,7 +2171,8 @@ namespace CalamityMod.CalPlayer StellarTorus = false; LiliesOfFinalityBool = false; - /* + /* Spawn blockers from back when they used to work by being favorited and not a toggleable item + noStupidNaturalARSpawns = false disableVoodooSpawns = false; disablePerfCystSpawns = false; disableHiveCystSpawns = false; @@ -2316,6 +2332,7 @@ namespace CalamityMod.CalPlayer gSabatonTempJumpSpeed = 0; astralStarRainCooldown = 0; AbaddonCooldown = 0; + AlchFlaskCooldown = 0; silvaMageCooldown = 0; bloodflareMageCooldown = 0; tarraRangedCooldown = 0; @@ -2383,6 +2400,7 @@ namespace CalamityMod.CalPlayer banishingFire = false; wither = false; PurityHealSlowdownFrames = 0; + ImmobilityDebuffImmunityTimer = 0; #endregion #region Rogue @@ -2703,6 +2721,15 @@ namespace CalamityMod.CalPlayer if (Player.dead) return; + if (ascendantInsignia && Main.myPlayer == Player.whoAmI && CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0) + { + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + Projectile.NewProjectileDirect(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate")); + ascendantInsigniaCooldown = 2400; + ascendantInsigniaBuffTime = 240; //4 seconds + } + //Only increment hotkey holdtime if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset hold time to zero if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != Player.oldVelocity.Y) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) { @@ -3701,7 +3728,7 @@ namespace CalamityMod.CalPlayer (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + - (blueCandle ? 0.05f : 0f) + + (blueCandle ? CirrusBlueCandleBuff.AccelerationBoost : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + (hasteLevel * 0.05f); @@ -4852,15 +4879,8 @@ namespace CalamityMod.CalPlayer if (CalamityConfig.Instance.SpeedrunTimer) CalamityMod.SpeedrunTimer.Restart(); - // - // 04JAN2024: Ozzatron: Added a temporary message for the Gimme Swag plushie campaign. - // This message should not exist indefinitely. It is being pushed as a silent public update just for itself. - // As this message always displays and is not configurable, the previous rules about startup messages have been replaced with always-true. - // - // Set a random delay between 12 and 20 seconds. When this delay hits zero, startup messages display - bool plushieMessage = true; - if (plushieMessage || CalamityConfig.Instance.WikiStatusMessage) + if (CalamityConfig.Instance.WikiStatusMessage) { startMessageDisplayDelay = Main.rand.Next(CalamityUtils.SecondsToFrames(12), CalamityUtils.SecondsToFrames(20) + 1); } diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index d5326f5e54..19d13db305 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -330,6 +330,24 @@ namespace CalamityMod.CalPlayer } } + // Prideful Hunter's Planar Ripper movement speed boost + if (calamityPlayer.planarSpeedBoost > 0 && drawInfo.shadow == 0f) + { + int spawnChance = (int)(13 - (calamityPlayer.planarSpeedBoost / 2)); + if (Main.rand.NextBool(spawnChance)) + { + Vector2 sparkVelocity = -(Vector2.UnitY * Main.rand.NextFloat(2.5f, 5f)).RotatedByRandom(MathHelper.Pi / 10); + Vector2 sparkPos = new Vector2(Player.position.X + Main.rand.NextFloat(-8f, 40f), Player.position.Y + Main.rand.NextFloat(-8f, 56f)); + Particle movementSpark = new AltLineParticle(sparkPos, sparkVelocity, false, 20, Main.rand.NextFloat(0.375f, 0.5f), new Color(130, 255, 255)); + GeneralParticleHandler.SpawnParticle(movementSpark); + + sparkVelocity = -(Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f)).RotatedByRandom(MathHelper.Pi / 6); + sparkPos = new Vector2(Player.position.X + Main.rand.NextFloat(-8f, 40f), Player.position.Y + Main.rand.NextFloat(-8f, 56f)); + Particle addSparks = new CustomPulse(sparkPos, sparkVelocity, new Color(180, 255, 255), "CalamityMod/Particles/ElectricSpark", Vector2.One, 0f, 0.5f, 0.65f, 20); + GeneralParticleHandler.SpawnParticle(addSparks); + } + } + // Some extraneous and probably undocumented visual effect caused by the heart lad pet thing if ((calamityPlayer.ladHearts > 0) && !Player.loveStruck && Main.netMode != NetmodeID.Server && drawInfo.shadow == 0f) { diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 7430951616..aca930da03 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -3,6 +3,7 @@ using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.Cooldowns; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.Dashes; @@ -37,6 +38,7 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; +using Mono.Cecil; using Terraria; using Terraria.Audio; using Terraria.Chat; @@ -523,6 +525,14 @@ namespace CalamityMod.CalPlayer // Apply all Calamity multipliers as a sum total to TML New Damage in a single step modifiers.SourceDamage *= totalDamageMult; + // 01JUN2024: Ozzatron: apply Yellow Candle "chip damage" as a dirty modifier + // The registration of the dirty modifier is conditional to ensure it doesn't apply to "near invincible" targets + // + // FinalDamage cannot be used for the intended effect because there is no way to access the actual damage of the hit + CalamityGlobalNPC cgn = target.Calamity(); + if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) + modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; + // Excalibur and True Excalibur deal +100% damage to targets above 75% HP. if (item.type == ItemID.Excalibur || item.type == ItemID.TrueExcalibur) { @@ -589,6 +599,14 @@ namespace CalamityMod.CalPlayer // Apply all Calamity multipliers as a sum total to TML New Damage in a single step modifiers.SourceDamage *= totalDamageMult; + // 01JUN2024: Ozzatron: apply Yellow Candle "chip damage" as a dirty modifier + // The registration of the dirty modifier is conditional to ensure it doesn't apply to "near invincible" targets + // + // FinalDamage cannot be used for the intended effect because there is no way to access the actual damage of the hit + CalamityGlobalNPC cgn = target.Calamity(); + if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) + modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; + // Stealth strike damage multipliers are applied here. // TODO -- stealth should be its own damage class and this should be applied as player StealthDamage *= XYZ if (proj.Calamity().stealthStrike && proj.CountsAsClass()) @@ -1219,6 +1237,22 @@ namespace CalamityMod.CalPlayer GeneralParticleHandler.SpawnParticle(spark); } } + + if (alchFlask) + { + for (int i = 0; i < 9; i++) + { + int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(15); + seekerDamage = Player.ApplyArmorAccDamageBonusesTo(seekerDamage); + + Projectile bee = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f), ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); + bee.ArmorPenetration = 35; + bee.penetrate = 6; + bee.extraUpdates = 2; + bee.timeLeft = 600; + } + Player.AddBuff(BuffID.Honey, 900); + } } public override void OnHitByProjectile(Projectile proj, Player.HurtInfo hurtInfo) @@ -1306,10 +1340,6 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(BuffID.BrokenArmor, 600); } - else if (proj.type == ProjectileID.FrostBeam && !Player.frozen && !gState) - { - Player.AddBuff(ModContent.BuffType(), 60); - } else if (proj.type == ProjectileID.DeathLaser || proj.type == ProjectileID.RocketSkeleton || proj.type == ProjectileID.BombSkeletronPrime) { Player.AddBuff(BuffID.OnFire, 180); @@ -1345,7 +1375,9 @@ namespace CalamityMod.CalPlayer } else if (proj.type == ProjectileID.CultistBossIceMist) { - Player.AddBuff(BuffID.Frozen, 60); + if (!Player.frozen) + Player.AddBuff(BuffID.Frozen, 60); + Player.AddBuff(BuffID.Chilled, 180); } else if (proj.type == ProjectileID.CultistBossLightningOrbArc) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index c9b3239176..8ddeca6781 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -2,17 +2,21 @@ using System.Linq; using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Placeables; using CalamityMod.Cooldowns; using CalamityMod.Items.Accessories; using CalamityMod.NPCs; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.CalPlayer { @@ -21,9 +25,6 @@ namespace CalamityMod.CalPlayer #region Update Bad Life Regen public override void UpdateBadLifeRegen() { - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - noLifeRegen = true; - // Universal +25% increase to DoT debuff damage in Death Mode float deathNegativeRegenBonus = 0.25f; float calamityDebuffMultiplier = 1f + (CalamityWorld.death ? deathNegativeRegenBonus : 0f); @@ -736,7 +737,7 @@ namespace CalamityMod.CalPlayer if (pinkCandle && !noLifeRegen) { // Every frame, add up 1/60th of the healing value (0.4% max HP per second) - pinkCandleHealFraction += Player.statLifeMax2 * 0.004 / 60; + pinkCandleHealFraction += Player.statLifeMax2 * CirrusPinkCandleBuff.PercentHealthPerSecond / 60; if (pinkCandleHealFraction >= 1D) { @@ -879,6 +880,26 @@ namespace CalamityMod.CalPlayer } } } + + if (toxicHeart) // Since it needs to know your life regen, it must be placed here + { + int auraDamage = (int)Player.GetBestClassDamage().ApplyTo(200); + auraDamage = Player.ApplyArmorAccDamageBonusesTo(auraDamage); + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + pulseRate = Utils.Remap(Player.lifeRegen, -30, 10, 20, 1, true); + if (pulseCounter >= 420) + { + Projectile.NewProjectileDirect(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, Player.whoAmI, 0, 0, 0); + pulseCounter = 0; + float soundVolume = Utils.Remap(Player.lifeRegen, -30, 10, 1f, 0.3f, true); + SoundStyle heartbeat = new("CalamityMod/Sounds/Item/Heartbeat"); + SoundEngine.PlaySound(heartbeat with { Volume = soundVolume, PitchVariance = 0.2f }, Player.Center); + } + else + { + pulseCounter += MathHelper.Clamp(pulseRate, 1, 20); + } + } } #endregion } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 03434292cc..24254b82e2 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; @@ -144,6 +145,9 @@ namespace CalamityMod.CalPlayer // Check if schematics are present on the mouse, for the sake of registering their recipes. CheckIfMouseItemIsSchematic(); + // Do environmental effects. + DoEnvironmentalEffects(); + // Handle Androomba's Right Click function AndroombaRightClick(); @@ -1337,6 +1341,22 @@ namespace CalamityMod.CalPlayer if (expiredCooldowns.Count > 0) SyncCooldownRemoval(Main.netMode == NetmodeID.Server, expiredCooldowns); + // Grant the player 5 seconds of immunity to immobilizing debuffs after an immobilizing debuff wears off. + if (Player.stoned || Player.frozen || Player.webbed || gState) + { + ImmobilityDebuffImmunityTimer = ImmobilityDebuffImmunityTimerMax; + } + else if (ImmobilityDebuffImmunityTimer > 0) + { + ImmobilityDebuffImmunityTimer--; + Player.buffImmune[BuffID.Stoned] = true; + Player.buffImmune[BuffID.Frozen] = true; + Player.buffImmune[BuffID.Webbed] = true; + Player.buffImmune[ModContent.BuffType()] = true; + } + + if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) + ascendantInsigniaCooldown--; if (DragonsBreathAudioCooldown > 0) DragonsBreathAudioCooldown--; if (DragonsBreathAudioCooldown2 > 0) @@ -1373,6 +1393,8 @@ namespace CalamityMod.CalPlayer astralStarRainCooldown--; if (AbaddonCooldown > 0) AbaddonCooldown--; + if (AlchFlaskCooldown > 0) + AlchFlaskCooldown--; if (tarraRangedCooldown > 0) tarraRangedCooldown--; if (bloodflareMageCooldown > 0) @@ -2012,6 +2034,13 @@ namespace CalamityMod.CalPlayer } // This section of code ensures set bonuses and accessories with cooldowns go on cooldown immediately if the armor or accessory is removed. + if (!ascendantInsignia && ascendantInsigniaBuffTime > 0) + { + ascendantInsigniaBuffTime = 0; + ascendantInsigniaCooldown = 2400; + Player.AddCooldown(AscendEffect.ID, 2400); + } + if (!brimflameSet && brimflameFrenzy) { brimflameFrenzy = false; @@ -2069,6 +2098,31 @@ namespace CalamityMod.CalPlayer } #endregion + #region Biome Effects + public void DrawPollenInFloralParadise() + { + if (!ZoneFloralParadise || !Main.rand.NextBool(7) || Main.netMode == NetmodeID.Server) + return; + + for (int i = 0; i < 15; i++) + { + Vector2 dustSpawnPosition = Player.Center + Main.rand.NextVector2Square(-360f, 360f); + dustSpawnPosition.Y += 200f; + Tile tile = CalamityUtils.ParanoidTileRetrieval((int)(dustSpawnPosition.X / 16f), (int)(dustSpawnPosition.Y / 16f)); + if (WorldGen.SolidTile(tile) || tile.LiquidAmount > 0) + continue; + + Dust pollen = Dust.NewDustPerfect(dustSpawnPosition, 261); + pollen.velocity = Main.rand.NextVector2Circular(0.4f, 0.4f); + pollen.scale = Main.rand.NextFloat(0.8f, 1f); + pollen.fadeIn = 2f; + pollen.color = Color.YellowGreen; + pollen.noGravity = true; + break; + } + } + #endregion Biome Effects + #region Abyss Effects private void AbyssEffects() { @@ -2519,6 +2573,21 @@ namespace CalamityMod.CalPlayer if (AdamantiteSet) Player.statDefense += AdamantiteSetDefenseBoost; + // Warmth makes Chilled, Frozen, and Glacial State tick down 3x as fast + if (Player.HasBuff(BuffID.Warmth)) + { + for (int b = 0; b < Player.MaxBuffs; b++) + { + if (Player.buffType[b] == BuffID.Chilled || Player.buffType[b] == BuffID.Frozen || Player.buffType[b] == ModContent.BuffType()) + { + if (Player.buffTime[b] > 3) + { + Player.buffTime[b] -= 2; + } + } + } + } + if (astralInjection) { if (Player.statMana < Player.statManaMax2) @@ -2822,16 +2891,13 @@ namespace CalamityMod.CalPlayer (harpyRing ? 0.2 : 0D) + (reaverSpeed ? 0.1 : 0D) + (angelTreads ? 0.1 : 0D) + - (blueCandle ? 0.05 : 0D) + + (blueCandle ? CirrusBlueCandleBuff.WingTimeBoost : 0D) + (soaring ? 0.1 : 0D) + (prismaticGreaves ? 0.1 : 0D) + (plagueReaper ? 0.05 : 0D) + (ascendantInsignia ? 0.05 : 0D) + // Added to soaring insignia's flight to get 30% (Player.empressBrooch ? 0.25 : 0D); - if (blueCandle) - Player.moveSpeed += 0.05f; - if (community) { float baseBoost = TheCommunity.CalculatePower(); @@ -2925,9 +2991,6 @@ namespace CalamityMod.CalPlayer if (pFlames && !purity) { - if (!alchFlask) - Player.blind = true; - Player.GetDamage() -= 0.1f; } @@ -3077,27 +3140,13 @@ namespace CalamityMod.CalPlayer } } - if (ascendantInsignia) + if (ascendantInsignia && ascendantInsigniaBuffTime > 0) { - if (CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0) - { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - Projectile.NewProjectileDirect(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate")); - ascendantInsigniaCooldown = 2400; - ascendantInsigniaBuffTime = 240; //4 seconds - } - - if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) - ascendantInsigniaCooldown--; + ascendantTrail = true; + infiniteFlight = true; if (ascendantInsigniaBuffTime == 1) Player.AddCooldown(AscendEffect.ID, 2400); - if (ascendantInsigniaBuffTime > 0) - { - ascendantTrail = true; - infiniteFlight = true; - ascendantInsigniaBuffTime--; - } + ascendantInsigniaBuffTime--; } if (abyssalDivingSuit && !Player.IsUnderwater()) @@ -4147,9 +4196,6 @@ namespace CalamityMod.CalPlayer CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus1"); CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus2"); } - - // 04JAN2024: Ozzatron: Plushie message always appears. - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.GimmeSwagPlushieCampaign"); } --startMessageDisplayDelay; diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index d4463c46bd..2464cd250f 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -595,14 +595,17 @@ namespace CalamityMod.CalPlayer if (!proj.CountsAsClass() && !proj.CountsAsClass() && Player.meleeEnchant == 7) Projectile.NewProjectile(source, position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner); - if (alchFlask && Player.ownedProjectileCounts[ProjectileType()] < 3 && hasClass) + if (alchFlask && AlchFlaskCooldown == 0 && proj.type != ModContent.ProjectileType()) { - int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(30); + int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(10); seekerDamage = Player.ApplyArmorAccDamageBonusesTo(seekerDamage); + Vector2 seekerVelocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f); - Projectile projectile = CalamityUtils.SpawnOrb(proj, seekerDamage, ProjectileType(), 400f, 12f); - if (projectile.whoAmI.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile.whoAmI].DamageType = DamageClass.Generic; + Projectile bee = Projectile.NewProjectileDirect(source, position, seekerVelocity, ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); + bee.ArmorPenetration = 20; + bee.penetrate = 2; + bee.extraUpdates = 1; + AlchFlaskCooldown = 7; } bool lifeAndShieldCondition = Player.statLife >= Player.statLifeMax2 && (!HasAnyEnergyShield || TotalEnergyShielding >= TotalMaxShieldDurability); @@ -1237,9 +1240,6 @@ namespace CalamityMod.CalPlayer if (divineBless) target.AddBuff(BuffType(), 60); - if (holyMinions) - target.AddBuff(BuffType(), 180); - if (shadowMinions) target.AddBuff(BuffID.ShadowFlame, 180); diff --git a/CalPlayer/PlayerEnvironmentEffects.cs b/CalPlayer/PlayerEnvironmentEffects.cs new file mode 100644 index 0000000000..e440513db4 --- /dev/null +++ b/CalPlayer/PlayerEnvironmentEffects.cs @@ -0,0 +1,37 @@ +using CalamityMod.Projectiles.Environment; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.CalPlayer +{ + public partial class CalamityPlayer : ModPlayer + { + public void DoEnvironmentalEffects() + { + CreateLilyglowInFloralParadise(); + } + + public void CreateLilyglowInFloralParadise() + { + // Don't do anything if the player is not in the floral paradise of if this code is called by anyone other than the player. + if (!ZoneFloralParadise || Main.myPlayer != Player.whoAmI) + return; + + if (!Main.rand.NextBool(12)) + return; + + for (int tries = 0; tries < 50; tries++) + { + Vector2 potentialSpawnPosition = Player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(200f, 800f); + if (Collision.SolidCollision(potentialSpawnPosition, 1, 1)) + continue; + + Vector2 spawnVelocity = -Vector2.UnitY.RotatedByRandom(0.82f) * Main.rand.NextFloat(0.5f, 1.35f); + Projectile.NewProjectile(new EntitySource_WorldEvent(), potentialSpawnPosition, spawnVelocity, ModContent.ProjectileType(), 0, 0f, Player.whoAmI); + break; + } + } + } +} diff --git a/CalamityConfig.cs b/CalamityConfig.cs index eedd4de7ed..2a46a809b2 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -175,6 +175,27 @@ namespace CalamityMod public float FlightBarPosY { get; set; } #endregion + #region Music Events + [Header("MusicEvents")] + + [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; } + + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool DevourerofGodsEulogy { get; set; } + + #endregion + #region General Gameplay Changes [Header("Gameplay")] diff --git a/CalamityLists.cs b/CalamityLists.cs index cb15f1a441..94639a9912 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -1943,6 +1943,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/CalamityMod.cs b/CalamityMod.cs index 62b15634c1..962bf1d33b 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -100,7 +100,7 @@ namespace CalamityMod // Astral Snow Sky/BG public static Texture2D AstralSnowSurfaceMiddle; - // Sulpher Sea Sky/BG + // Sulphur Sea Sky/BG public static Texture2D SulphurSeaSky; public static Texture2D SulphurSeaSkyFront; public static Texture2D SulphurSeaSurface; @@ -132,8 +132,10 @@ namespace CalamityMod internal static CalamityMod Instance; // TODO -- Mod references should be contained in a ModSystem (example name "ModLoadedChecker") - internal Mod musicMod = null; // This is Calamity's official music mod, CalamityModMusic - internal bool MusicAvailable => !(musicMod is null); + + // This is Calamity's official music mod, CalamityModMusic. It is now a hard dependency. + internal Mod musicMod = null; + internal bool MusicAvailable => musicMod is not null; // Please keep this in alphabetical order so it's easy to read internal Mod ancientsAwakened = null; @@ -246,29 +248,6 @@ namespace CalamityMod BalancingChangesManager.Load(); BaseIdleHoldoutProjectile.LoadAll(); PlayerDashManager.Load(); - - /* - //keep this disabled for now, hell bg system isnt used and there is a better way to load it - //hell background loading - HellBGManager.Load(); - - //load stuff for hell background - loadCache = new List(); - - foreach (Type type in Code.GetTypes()) - { - if (!type.IsAbstract && type.GetInterfaces().Contains(typeof(HellBGLoad))) - { - var instance = Activator.CreateInstance(type); - loadCache.Add(instance as HellBGLoad); - } - } - - for (int k = 0; k < loadCache.Count; k++) - { - loadCache[k].Load(); - } - */ } private void LoadClient() @@ -483,21 +462,6 @@ namespace CalamityMod carpetOriginal = null; - /* - //unload hell background stuff - HellBGManager.Unload(); - - if (loadCache != null) - { - foreach (var loadable in loadCache) - { - loadable.Unload(); - } - } - - loadCache = null; - */ - Instance = null; base.Unload(); } diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index a75cbdfe5c..c498f8c37c 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -6,6 +6,7 @@ using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Systems; using CalamityMod.TileEntities; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -300,6 +301,17 @@ namespace CalamityMod SyncCalamityWorldDifficulties(sender); break; + // + // Music event syncs + // + case CalamityModMessageType.MusicEventSyncRequest: + MusicEventSystem.FulfillSyncRequest(whoAmI); + break; + + case CalamityModMessageType.MusicEventSyncResponse: + MusicEventSystem.ReceiveSyncResponse(reader); + break; + // // Default case: with no idea how long the packet is, we can't safely read data. // Throw an exception now instead of allowing the network stream to corrupt. @@ -421,6 +433,10 @@ namespace CalamityMod MousePositionSync, // World state sync - SyncDifficulties + SyncDifficulties, + + // Music events + MusicEventSyncRequest, + MusicEventSyncResponse } } diff --git a/DamageClasses/MeleeRangedHybridDamageClass.cs b/DamageClasses/MeleeRangedHybridDamageClass.cs new file mode 100644 index 0000000000..1dc965aade --- /dev/null +++ b/DamageClasses/MeleeRangedHybridDamageClass.cs @@ -0,0 +1,27 @@ +using Terraria.ModLoader; + +namespace CalamityMod +{ + public class MeleeRangedHybridDamageClass : DamageClass + { + internal static MeleeRangedHybridDamageClass Instance; + + internal static readonly StatInheritanceData FiftyPercentBoost = new(0.5f, 0.5f, 0.5f, 0.5f, 0.5f); + + public override void Load() => Instance = this; + public override void Unload() => Instance = null; + + public override StatInheritanceData GetModifierInheritance(DamageClass damageClass) + { + if (damageClass == Melee || damageClass == Ranged) + return FiftyPercentBoost; + if (damageClass == Generic) + return StatInheritanceData.Full; + + return StatInheritanceData.None; + } + + // Inherits from both melee and ranged + public override bool GetEffectInheritance(DamageClass damageClass) => damageClass == Melee || damageClass == Ranged; + } +} diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index c98734482d..1000912ace 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -126,6 +126,12 @@ namespace CalamityMod.Effects // Used by Devourer of Gods. Renders the portal that he escapes through at the end of phase 1. internal static Effect DoGPortalShader; + // Used to render all-encompassing fog in the Floral Paradise biome. + internal static Effect FogShader; + + // Used to render background water features in the Floral Paradise biome. + internal static Effect WaterfallShader; + // Metaballs. See the MetaballManager class for comments on how this system works. // These shaders are leveraged to render the results of the metaball simulation to the screen. // The "Base" shader draws the particles themselves. @@ -351,6 +357,12 @@ namespace CalamityMod.Effects DoGPortalShader = LoadShader("ScreenShaders/DoGPortalShader"); RegisterMiscShader(DoGPortalShader, "ScreenPass", "DoGPortal"); + FogShader = LoadShader("ScreenShaders/Fog"); + RegisterMiscShader(FogShader, "DyePass", "Fog"); + + WaterfallShader = LoadShader("WaterfallShader"); + RegisterMiscShader(WaterfallShader, "TrailPass", "Waterfall"); + // These two shaders are often (but not always) used together. MetaballEdgeShader = LoadShader("Metaballs/MetaballEdgeShader"); RegisterMiscShader(MetaballEdgeShader, "ParticlePass", "MetaballEdge"); diff --git a/Effects/ScreenShaders/Fog.fx b/Effects/ScreenShaders/Fog.fx new file mode 100644 index 0000000000..28001e61ab --- /dev/null +++ b/Effects/ScreenShaders/Fog.fx @@ -0,0 +1,61 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +float fogMovementSpeed; +float4 uShaderSpecificData; + +float Random(float2 coords) +{ + return frac(sin(dot(coords, float2(49, 81)) * 100) * 100); +} +float PerlinNoise(float2 coords) +{ + float2 integerPart = floor(coords); + float2 fractionalPart = frac(coords); + float a = Random(integerPart); + float b = Random(integerPart + float2(1, 0)); + float c = Random(integerPart + float2(0, 1)); + float d = Random(integerPart + float2(1, 1)); + float2 cubic = fractionalPart * fractionalPart * (3 - fractionalPart * 2); + return lerp(a, b, cubic.x) + (c - a) * cubic.y * (1 - cubic.x) + (d - b) * cubic.x * cubic.y; +} + +float ScaledNoise(float2 coords) +{ + float result = 0; + float2 coordsCopy = coords; + float scale = 0.5; + for (int i = 0; i < 4; i++) + { + result += PerlinNoise(coordsCopy) * scale; + coordsCopy *= 2; + scale *= 0.5; + } + return result; +} + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float motion = ScaledNoise(coords * uSaturation * 12 + float2(uTime * fogMovementSpeed * -0.23, uTime * fogMovementSpeed * 0.64)); + float2 motion2D = motion; + float3 noise = ScaledNoise(coords * uSaturation * 15 + motion2D + float2(0, uTime * 0.78)); + return lerp(float4(noise, 1), float4(uColor, 1), 0.67) * uOpacity * 0.2; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/ScreenShaders/Fog.xnb b/Effects/ScreenShaders/Fog.xnb new file mode 100644 index 0000000000..22323159b2 Binary files /dev/null and b/Effects/ScreenShaders/Fog.xnb differ diff --git a/Effects/WaterfallShader.fx b/Effects/WaterfallShader.fx new file mode 100644 index 0000000000..f7fab820fe --- /dev/null +++ b/Effects/WaterfallShader.fx @@ -0,0 +1,67 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +sampler uImage2 : register(s2); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; +float4 uShaderSpecificData; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// The X coordinate is the trail completion, the Y coordinate is the same as any other. +// This is simply how the primitive TextCoord is layed out in the C# code. +// Inputted images go into uImage1 sampler, in case you have a noise map or something similar. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + float2 pixellatedCoords = round(coords * 20) / 20; + float4 noiseColor = tex2D(uImage1, float2(pixellatedCoords.x - uTime * 1.3, pixellatedCoords.y) * float2(0.5, 1)); + float4 noiseColor2 = tex2D(uImage1, float2(pixellatedCoords.x - uTime * 1.1, pixellatedCoords.y + uTime * 0.44) * float2(0.5, 1)); + float4 baseColor = lerp(noiseColor, noiseColor2, sin(uTime * 5.1 + coords.x * 3.4) * 0.5 + 0.5); + baseColor = pow(baseColor, 2); + return lerp(color * 0.4, 1, baseColor.r) * uOpacity; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/WaterfallShader.xnb b/Effects/WaterfallShader.xnb new file mode 100644 index 0000000000..718ba268ef Binary files /dev/null and b/Effects/WaterfallShader.xnb differ diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index 5c8491e682..76b1624211 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -156,8 +156,6 @@ namespace CalamityMod.Events new Boss(ModContent.NPCType(), spawnContext: type => { NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, ModContent.NPCType()); - NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, ModContent.NPCType()); - NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, ModContent.NPCType()); }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), diff --git a/ExtraTextures/WorleyNoise.png b/ExtraTextures/WorleyNoise.png new file mode 100644 index 0000000000..f614e21acc Binary files /dev/null and b/ExtraTextures/WorleyNoise.png differ diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index c2ea95f2b1..d448d79d77 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -3,6 +3,7 @@ using System.Reflection; using CalamityMod.Graphics.Renderers.CalamityRenderers; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.FurnitureExo; +using CalamityMod.Walls; using Terraria; using Terraria.DataStructures; using Terraria.GameContent; @@ -39,6 +40,7 @@ namespace CalamityMod.ILEditing // Graphics IL_Main.DoDraw += AdditiveDrawing; + IL_Main.DoDraw += DrawFloralParadiseFog; On_Main.DrawGore += DrawForegroundStuff; On_Main.DrawCursor += UseCoolFireCursorEffect; On_Main.SortDrawCacheWorms += DrawFusableParticles; @@ -171,6 +173,14 @@ namespace CalamityMod.ILEditing //HeldOnlyItem detours Player.dropItemCheck, ItemSlot.Draw (Sb, itemarray, int, int, vector2, color) and ItemSlot.LeftClick_ItemArray to make its stuff work } + /// + /// Loads things which need to be instantiated later in the load order. + /// + public override void AddRecipes() + { + WallVisibleThroughWater.InitializeWaterMapEntryLookups(); + } + /// /// Unloads all IL Editing changes in the mod. /// diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index fb4fe1510e..d760dabb3a 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -22,6 +22,7 @@ using CalamityMod.Projectiles; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss; +using CalamityMod.Waterfalls; using CalamityMod.Waters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -724,6 +725,42 @@ namespace CalamityMod.ILEditing } #endregion + #region Fog Effect in Floral Paradise + private static void DrawFloralParadiseFog(ILContext il) + { + ILCursor cursor = new ILCursor(il); + + cursor.GotoNext(MoveType.Before, i => i.MatchCallOrCallvirt
("DrawInfernoRings")); + cursor.EmitDelegate(() => + { + if (Main.netMode != NetmodeID.Server && BiomeTileCounterSystem.FloralParadiseTiles > 0) + DrawFog(Utils.GetLerpValue(0f, 250f, BiomeTileCounterSystem.FloralParadiseTiles, true)); + }); + } + + private static void DrawFog(float intensity) + { + Main.spriteBatch.EnterShaderRegion(); + WaterfallRenderer.DrawWaterfalls(); + + Texture2D fogTexture = ModContent.Request("Terraria/Images/Misc/Perlin").Value; + Vector2 scale = new Vector2(Main.screenWidth, Main.screenHeight) / fogTexture.Size(); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + GameShaders.Misc["CalamityMod:Fog"].UseOpacity(intensity * 0.74f); + GameShaders.Misc["CalamityMod:Fog"].UseColor(Color.Lerp(Color.Lime, Color.Black, 0.85f)); + GameShaders.Misc["CalamityMod:Fog"].UseSaturation(1.67f); + GameShaders.Misc["CalamityMod:Fog"].Shader.Parameters["fogMovementSpeed"].SetValue(1.75f); + GameShaders.Misc["CalamityMod:Fog"].Apply(); + + Main.spriteBatch.Draw(fogTexture, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(); + } + #endregion Fog Effect in Floral Paradise + #region Custom Draw Layers private static void AdditiveDrawing(ILContext il) { @@ -864,7 +901,11 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ldloc, 4); // Caching these values can save a LOT of overhead at runtime. - ModWaterStyle sunkenSeaWater = ModContent.GetInstance(); + ModWaterStyle basaltWater = ModContent.GetInstance(); + ModWaterStyle burrowsWater = ModContent.GetInstance(); + ModWaterStyle polypWater = ModContent.GetInstance(); + ModWaterStyle reefsWater = ModContent.GetInstance(); + ModWaterStyle shoresWater = ModContent.GetInstance(); ModWaterStyle sulphuricWater = ModContent.GetInstance(); ModWaterStyle sulphuricDepthsWater = ModContent.GetInstance(); ModWaterStyle upperAbyssWater = ModContent.GetInstance(); @@ -878,8 +919,11 @@ namespace CalamityMod.ILEditing { initialColor = SelectLavaQuadColor(initialTexture, ref initialColor, liquidType == 1); } - - if (liquidType == sunkenSeaWater.Slot || + if (liquidType == burrowsWater.Slot || + liquidType == basaltWater.Slot || + liquidType == polypWater.Slot || + liquidType == shoresWater.Slot || + liquidType == reefsWater.Slot || liquidType == sulphuricWater.Slot || liquidType == sulphuricDepthsWater.Slot || liquidType == upperAbyssWater.Slot || @@ -1000,13 +1044,13 @@ namespace CalamityMod.ILEditing return; Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.LiquidAmount <= 0 || tile.HasTile || (Main.waterStyle != SulphuricWater.Type && - Main.waterStyle != SulphuricDepthsWater.Type && Main.waterStyle != SunkenSeaWater.Type)) + if (tile.LiquidAmount <= 0 || tile.HasTile || tile.Get().LiquidType != LiquidID.Water || (Main.waterStyle != SulphuricWater.Type && + Main.waterStyle != SulphuricDepthsWater.Type && Main.waterStyle != SunkenSeaBurrowsWater.Type && Main.waterStyle != SunkenSeaPolypWater.Type && + Main.waterStyle != SunkenSeaReefsWater.Type && Main.waterStyle != SunkenSeaShoresWater.Type && Main.waterStyle != BasaltGullyWater.Type)) return; Tile above = CalamityUtils.ParanoidTileRetrieval(x, y - 1); - if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9) && - Main.waterStyle == SulphuricWater.Type) + if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9) && Main.waterStyle == SulphuricWater.Type) { MediumMistParticle acidFoam = new(new(x * 16f + Main.rand.NextFloat(16f), y * 16f + 8f), -Vector2.UnitY.RotatedByRandom(0.67f) * Main.rand.NextFloat(1f, 2.4f), Color.LightSeaGreen, Color.White, 0.16f, 128f, 0.02f); GeneralParticleHandler.SpawnParticle(acidFoam); @@ -1073,8 +1117,34 @@ namespace CalamityMod.ILEditing if (Main.waterStyle == SulphuricDepthsWater.Type) outputColor = Vector3.Lerp(outputColor, Color.MediumSeaGreen.ToVector3(), 0.18f); - if (Main.waterStyle == SunkenSeaWater.Type) + if (Main.waterStyle == SunkenSeaBurrowsWater.Type || Main.waterStyle == SunkenSeaPolypWater.Type || Main.waterStyle == SunkenSeaReefsWater.Type || + Main.waterStyle == SunkenSeaShoresWater.Type || Main.waterStyle == BasaltGullyWater.Type) { + //default to white + Color waterGlowColor = Color.White; + + //set the glow colors for each sunken sea biome water style + if (Main.waterStyle == SunkenSeaShoresWater.Type) + { + waterGlowColor = new Color(233, 170, 184); + } + if (Main.waterStyle == SunkenSeaPolypWater.Type) + { + waterGlowColor = new Color(213, 185, 178); + } + if (Main.waterStyle == SunkenSeaReefsWater.Type) + { + waterGlowColor = new Color(140, 222, 239); + } + if (Main.waterStyle == SunkenSeaBurrowsWater.Type) + { + waterGlowColor = new Color(76, 211, 231); + } + if (Main.waterStyle == BasaltGullyWater.Type) + { + waterGlowColor = new Color(144, 174, 200); + } + float brightness = MathHelper.Clamp(0.07f, 0f, 0.07f); float waveScale1 = Main.GameUpdateCount * 0.028f; float waveScale2 = Main.GameUpdateCount * 0.1f; @@ -1094,7 +1164,7 @@ namespace CalamityMod.ILEditing float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5)); float wave6angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave6)); float bigwaveangle = 0.55f + 0.80f * (float)Math.Sin(MathHelper.ToRadians(bigwave)); - outputColor = Vector3.Lerp(outputColor, Color.DeepSkyBlue.ToVector3(), 0.07f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle + wave6angle + bigwaveangle); + outputColor = Vector3.Lerp(outputColor, Color.DarkSlateGray.ToVector3(), 0.07f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle + wave6angle + bigwaveangle); outputColor *= brightness; } } diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index 9a430ec383..c4bb8be5ee 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Reflection; -using CalamityMod.Balancing; using CalamityMod.Items.Fishing; using CalamityMod.Items.Materials; using CalamityMod.Items.TreasureBags.MiscGrabBags; @@ -13,14 +12,20 @@ using Mono.Cecil.Cil; using MonoMod.Cil; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.ID; -using Terraria.Map; using Terraria.ModLoader; namespace CalamityMod.ILEditing { public partial class ILChanges { + public static WindGrid Windgrid + { + get; + internal set; + } + #region Decrease Sandstorm Wind Speed Requirement private static void DecreaseSandstormWindSpeedRequirement(ILContext il) { @@ -957,5 +962,17 @@ namespace CalamityMod.ILEditing c.Emit(OpCodes.Stloc, relativeMapTypeIndex); } #endregion + + // 02JUN2024: Ozzatron: The below code is being kept in its initial state for historic value. + #region Store The Stupid Fucking Private Wind Map In Public Property + private static void StoreWindGrid(On_TileDrawing.orig_Update orig, TileDrawing self) + { + orig(self); + + // FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK YOU FUCK + if (Windgrid is null) + Windgrid = typeof(TileDrawing).GetField("_windGrid", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(self) as WindGrid; + } + #endregion Store The Stupid Fucking Private Wind Map In Public Property } } diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index 86d4aa1de4..aea37c1bf8 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.cs @@ -29,8 +29,9 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(ItemID.BeeWax, 5). - AddIngredient(10). + AddIngredient(ItemID.HoneyComb). + AddIngredient(ItemID.BeeWax, 8). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs deleted file mode 100644 index c0bc650ec9..0000000000 --- a/Items/Accessories/PlagueHive.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories -{ - public class PlagueHive : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - public override void SetDefaults() - { - Item.width = 42; - Item.height = 48; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; - Item.rare = ItemRarityID.Red; - Item.accessory = true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.HoneyComb). - AddTile(TileID.LunarCraftingStation). - Register(); - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.uberBees = true; - modPlayer.alchFlask = true; - player.buffImmune[ModContent.BuffType()] = true; - } - } -} diff --git a/Items/Accessories/PlagueHive.png b/Items/Accessories/PlagueHive.png deleted file mode 100644 index 1cd4a7baaa..0000000000 Binary files a/Items/Accessories/PlagueHive.png and /dev/null differ diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index 9fc54df8eb..eb6eb0c6b2 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -213,7 +213,7 @@ namespace CalamityMod.Items.Accessories string stats3 = "\n" + this.GetLocalization("GenericStats").Format( player.GetCurrentDefense(false), TwoPlaces(100f * player.endurance), - player.lifeRegen, // Normally we'd divide this by 2 in Expert without Well Fed, but we disable that shit + OnePlace((float)player.lifeRegen / 2f), // Divided by 2 to show HP/s, because vanilla! Also normally we'd divide this by 2 in Expert without Well Fed, but we disable that shit Sign(moveSpeedBoost) + TwoPlaces(100f * moveSpeedBoost), TwoPlaces(20f * player.GetJumpBoost())); // Show wing stats only if over 0 flight time diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index 72fa58ce65..a08ba8d9a7 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.holyMinions = true; player.GetKnockback() += 2.5f; - player.GetDamage() += 0.1f; + player.GetDamage() += 0.12f; } public override void AddRecipes() diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index e16ebd5b2e..efe65bb8df 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories modPlayer.shadowMinions = true; modPlayer.holyMinions = true; player.GetKnockback() += 2.75f; - player.GetDamage() += 0.1f; + player.GetDamage() += 0.12f; player.buffImmune[ModContent.BuffType()] = true; } diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index cd3aa3500e..7a4ee85420 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 24; - Item.defense = 15; + Item.defense = 10; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.accessory = true; diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index ee4b89c267..ca3e9c0e5a 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -12,6 +13,7 @@ namespace CalamityMod.Items.Accessories public class ToxicHeart : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public float pulseCounter = 0; public override void SetDefaults() { Item.width = 28; @@ -25,44 +27,6 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.toxicHeart = true; - player.buffImmune[ModContent.BuffType()] = true; - int plagueCounter = 0; - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.05f, 1f, 0.1f); - int plagueDebuff = ModContent.BuffType(); - bool shouldInflictPlague = plagueCounter % 60 == 0; - - int auraDamage = (int)player.GetBestClassDamage().ApplyTo(50); - auraDamage = player.ApplyArmorAccDamageBonusesTo(auraDamage); - - int random = Main.rand.Next(10); - var source = player.GetSource_Accessory(Item); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0) - { - foreach (NPC nPC in Main.ActiveNPCs) - { - if (nPC.IsAnEnemy() && !nPC.dontTakeDamage && !nPC.buffImmune[plagueDebuff] && Vector2.Distance(player.Center, nPC.Center) <= 300f) - { - if (nPC.FindBuffIndex(plagueDebuff) == -1) - { - nPC.AddBuff(plagueDebuff, 120, false); - } - if (shouldInflictPlague) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectileDirect(source, nPC.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, player.whoAmI, nPC.whoAmI); - } - } - } - } - } - } - plagueCounter++; - if (plagueCounter >= 180) - { - } } } } diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 3cff630860..9f596ebdba 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -16,6 +16,7 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -29,7 +30,26 @@ namespace CalamityMod.Items #region Main ModifyTooltips Function public override void ModifyTooltips(Item item, List tooltips) { - // Apply rarity coloration to the item's name. + // Get the first index, last index and total count of standard vanilla tooltip lines. + // The first index and count are used to delete all vanilla tooltips when holding SHIFT, if requested. + // The last index is used to insert various extra tooltip lines in the right position. + // + // This code used to be in the HoldShiftTooltip utility, but is needed to correctly place other tooltips. + int firstTooltipIndex = -1; + int lastTooltipIndex = -1; + int standardTooltipCount = 0; + for (int i = 0; i < tooltips.Count; i++) + { + if (tooltips[i].Name.StartsWith("Tooltip")) + { + if (firstTooltipIndex == -1) + firstTooltipIndex = i; + lastTooltipIndex = i; + standardTooltipCount++; + } + } + + // Apply custom rarity coloration to the item's name if applicable. TooltipLine nameLine = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.Mod == "Terraria"); if (nameLine != null) ApplyRarityColor(item, nameLine); @@ -40,20 +60,21 @@ namespace CalamityMod.Items // Adds "Does extra damage to enemies shot at point-blank range" to weapons capable of it. if (canFirePointBlankShots) { - TooltipLine line = new TooltipLine(Mod, "PointBlankShot", "Does extra damage to enemies shot at point-blank range"); - tooltips.Add(line); + var lineText = CalamityUtils.GetText("Misc.PointBlank"); + TooltipLine line = new TooltipLine(Mod, "CalamityMod:PointBlankTooltip", lineText.Value); + tooltips.Insert(++lastTooltipIndex, line); } - // If an item has an enchantment, show its prefix in the first tooltip line and append its description to the - // tooltip list. + // If an item has an enchantment, show its prefix in the first tooltip line and append its description to the tooltip list. EnchantmentTooltips(item, tooltips); - // Replace rogue with rouge in gfb + // In GFB, replace all instances of "rogue" with "rouge". if (Main.zenithWorld) { tooltips.FindAndReplace("Rogue", "Rouge"); tooltips.FindAndReplace("rogue", "rouge"); } + // Everything below this line can only apply to modded items. If the item is vanilla, stop here for efficiency. if (item.type < ItemID.Count) return; @@ -65,27 +86,68 @@ namespace CalamityMod.Items // Convert current charge ratio into a percentage. float displayedPercent = ChargeRatio * 100f; TooltipLine line = new TooltipLine(Mod, "CalamityCharge", $"Current Charge: {displayedPercent:N1}%"); - tooltips.Add(line); + tooltips.Insert(++lastTooltipIndex, line); + } + + // Generic support for any and all Hold SHIFT tooltips. + // For more information, see IHoldShiftTooltipItem. + if (item.ModItem is IHoldShiftTooltipItem holdShiftItem) + { + string dynamicKey = $"{Mod.Name}:{item.ModItem.Name}_HoldShift"; + string lineText = item.ModItem.GetLocalizedValue(holdShiftItem.TooltipExtensionKey); + var line = new TooltipLine(Mod, dynamicKey, lineText); + if (holdShiftItem.TooltipExtensionColor is not null) + line.OverrideColor = holdShiftItem.TooltipExtensionColor; + TooltipLine[] lines = { line }; + + // + // Original code lifted from Iban's extended armor tooltips. + // + bool holdingShift = Main.keyState.IsKeyDown(Keys.LeftShift); + + // If holding SHIFT, actually display the extended tooltip. + if (holdingShift && firstTooltipIndex != -1) + { + // If asked to, remove all standard tooltip lines. This moves the last tooltip index. + if (holdShiftItem.HidesNormalTooltip) + { + tooltips.RemoveRange(firstTooltipIndex, standardTooltipCount); + lastTooltipIndex -= standardTooltipCount; + } + + // Append every "Hold SHIFT" tooltip at the end of standard tooltips. + tooltips.InsertRange(++lastTooltipIndex, lines); + } + + // If not holding SHIFT, display the extension indicator if appropriate. + if (!holdingShift && holdShiftItem.ShowExtensionIndicator) + { + LocalizedText indicatorText = CalamityUtils.GetText(holdShiftItem.ExtensionIndicatorKey); + var indicator = new TooltipLine(Mod, IHoldShiftTooltipItem.ExtensionIndicatorTooltipID, indicatorText.Value); + if (holdShiftItem.ExtensionIndicatorColor is not null) + indicator.OverrideColor = holdShiftItem.ExtensionIndicatorColor; + tooltips.Insert(++lastTooltipIndex, indicator); + } } // Adds "Donor Item" and "Developer Item" to donor items and developer items respectively. - if (donorItem) - { - TooltipLine line = new TooltipLine(Mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", CalamityUtils.DonatorItemColor)); - tooltips.Add(line); - } + // This is intentionally at the bottom, below everything else. if (devItem) { TooltipLine line = new TooltipLine(Mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", CalamityUtils.DevItemColor)); tooltips.Add(line); } + else if (donorItem) + { + TooltipLine line = new TooltipLine(Mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", CalamityUtils.DonatorItemColor)); + tooltips.Add(line); + } } #endregion #region Rarity Coloration - private void ApplyRarityColor(Item item, TooltipLine nameLine) + private static void ApplyRarityColor(Item item, TooltipLine nameLine) { - #region Uniquely Colored Items if (item.type == ModContent.ItemType()) nameLine.OverrideColor = Color.Lerp(Color.Red, Color.White, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f); if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) @@ -192,7 +254,6 @@ namespace CalamityMod.Items nameLine.OverrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f); } } - #endregion } #endregion @@ -262,6 +323,10 @@ namespace CalamityMod.Items if (item.type == ModContent.ItemType()) EditTooltipByName("Damage", (line) => line.Text = LiliesOfFinality.TheNumber + " summon damage"); + // Apparently 612 is a homestuck reference + if (item.type == ModContent.ItemType()) + EditTooltipByName("AxePower", (line) => line.Text = line.Text.Replace("610%", "612%")); + // Master Mode items also drop in Revengeance // Only affects vanilla and Calamity items if (item.master && (item.type < ItemID.Count || item.ModItem?.Mod is CalamityMod)) @@ -323,10 +388,13 @@ namespace CalamityMod.Items if (item.type == ItemID.HamBat) EditTooltipByNum(1, (line) => line.Text = "Defeating enemies temporarily grants +3 HP/s life regen"); - // Warmth Potion provides debuff immunities + if (item.type == ItemID.AegisCrystal) + EditTooltipByNum(0, (line) => line.Text = "Permanently boosts natural life regeneration"); + + // Warmth Potion reduces debuff durations if (item.type == ItemID.WarmthPotion) { - string immunityLine = "\nGrants immunity to Chilled, Frozen and Glacial State"; + string immunityLine = "\nGreatly reduces the duration of Chilled, Frozen, and Glacial State"; EditTooltipByNum(0, (line) => line.Text += immunityLine); } @@ -619,7 +687,7 @@ namespace CalamityMod.Items { EditTooltipByNum(0, (line) => line.Text = "Multiplies all fire-based debuff damage by 1.25\n" + "All attacks light enemies on fire\n" + - "'Never get cold feet again'\n"); + "'Never get cold feet again'"); } // Hellfire Treads buff. @@ -920,6 +988,8 @@ namespace CalamityMod.Items // Solar Flare if (item.type == ItemID.SolarFlareHelmet) EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("26%", "20%")); + if (item.type == ItemID.SolarFlareHelmet || item.type == ItemID.SolarFlareBreastplate || item.type == ItemID.SolarFlareLeggings) + EditTooltipByNum(1, (line) => line.Text = "Grants +1 HP/s life regeneration"); // Vortex if (item.type == ItemID.VortexHelmet) diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 7cb2d01cd2..107986fa4e 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -45,8 +45,9 @@ namespace CalamityMod.Items { ItemID.Bananarang, Do(DamageExact(76), UseExact(14)) }, { ItemID.BatScepter, Do(DamageExact(56)) }, { ItemID.BeamSword, Do(UseMeleeSpeed, DamageExact(142), UseAnimationExact(45), ShootSpeedExact(23f), KnockbackExact(8)) }, - { ItemID.BeeGun, Do(DamageExact(10), ManaExact(4)) }, - { ItemID.BeesKnees, Do(PointBlank, DamageExact(18), UseExact(38)) }, + { ItemID.BeeGun, Do(DamageExact(13), ManaExact(4)) }, + { ItemID.BeeKeeper, Do((UseTurn),DamageExact(32)) }, + { ItemID.BeesKnees, Do(PointBlank, DamageExact(24), UseExact(38)) }, { ItemID.Bladetongue, Do(UseTurn, UseRatio(0.8f), DamageExact(120)) }, { ItemID.BlizzardStaff, Do(DamageExact(41), ManaExact(7)) }, { ItemID.BloodyMachete, Do(AutoReuse, DamageExact(24)) }, @@ -127,7 +128,7 @@ namespace CalamityMod.Items { ItemID.HellwingBow, Do(PointBlank, DamageExact(16)) }, { ItemID.HighVelocityBullet, Do(DamageExact(13)) }, { ItemID.HiveFive, Do(AutoReuse, DamageExact(26)) }, - { ItemID.HornetStaff, Do(AutoReuse, DamageExact(13), UseExact(30)) }, + { ItemID.HornetStaff, Do(AutoReuse, DamageExact(18), UseExact(30)) }, { ItemID.IceBlade, Do(UseMeleeSpeed) }, { ItemID.IceBoomerang, Do(UseExact(25), ShootSpeedExact(9)) }, { ItemID.IceRod, Do(UseExact(6), DamageExact(30), ShootSpeedExact(20)) }, @@ -185,7 +186,7 @@ namespace CalamityMod.Items { ItemID.PalladiumSword, Do(UseTurn, DamageExact(100)) }, { ItemID.PearlwoodBow, Do(AutoReuse, PointBlank, DamageExact(20), UseDelta(+8), ShootSpeedDelta(+3.4f), KnockbackDelta(+1f)) }, { ItemID.PearlwoodSword, Do(UseTurn, DamageExact(45)) }, - { ItemID.PewMaticHorn, Do(DamageExact(24)) }, + { ItemID.PewMaticHorn, Do(DamageExact(25), ShootSpeedExact(15)) }, { ItemID.Phantasm, Do(PointBlank, DamageExact(48)) }, { ItemID.PhoenixBlaster, Do(AutoReuse, PointBlank, UseExact(18)) }, { ItemID.PiranhaGun, Do(DamageExact(48)) }, @@ -511,7 +512,6 @@ namespace CalamityMod.Items #region CATEGORY 7: Other Quality of Life (AutoReuse / UseTurn) { ItemID.Amarok, autoReuse }, { ItemID.BatBat, autoReuse }, - { ItemID.BeeKeeper, Do(UseTurn) }, { ItemID.BladeofGrass, Do(AutoReuse, UseTurn) }, { ItemID.BloodButcherer, Do(AutoReuse, UseTurn) }, { ItemID.BoneSword, Do(AutoReuse, UseTurn) }, diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs index c2c7f48aec..7242d6591c 100644 --- a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches // Materials itemLoot.Add(ModContent.ItemType(), 1, 10, 30); itemLoot.Add(ModContent.ItemType(), 1, 10, 30); + itemLoot.Add(ModContent.ItemType(), 1, 30, 60); postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); diff --git a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs index ecf064395c..1c5eeedd9f 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs @@ -54,6 +54,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches // Materials itemLoot.Add(ModContent.ItemType(), 1, 10, 30); itemLoot.Add(ModContent.ItemType(), 1, 10, 30); + itemLoot.Add(ModContent.ItemType(), 1, 30, 60); postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); postHardmodeClam.Add(ModContent.ItemType(), new Fraction(12, 100), 2, 5); diff --git a/Items/IHoldShiftTooltipItem.cs b/Items/IHoldShiftTooltipItem.cs new file mode 100644 index 0000000000..afd8537be5 --- /dev/null +++ b/Items/IHoldShiftTooltipItem.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items +{ + // This interface is used on items where you can hold Left SHIFT for an expanded tooltip. + // All actual implementation of this behavior is done in CalamityGlobalItemTooltip. + public interface IHoldShiftTooltipItem + { + /// + /// Internal ID for the TooltipLine which contains Calamity items' "Hold SHIFT" extension indicators. + /// + internal const string ExtensionIndicatorTooltipID = "CalamityMod:HoldShiftExtensionIndicator"; + + /// + /// The lang/localization key of the default tooltip extension indicator message. + /// + public const string DefaultExtensionIndicatorKey = "UI.HoldShiftTooltipExtensionIndicator"; + + /// + /// The default color of the default tooltip extension indicator message. + /// + public static readonly Color DefaultExtensionIndicatorColor = new Color(184, 184, 184); // #B8B8B8 + + /// + /// The default lang/localization key which is queried to show an item's tooltip extension. + /// + public const string DefaultTooltipExtensionKey = "HoldShiftTooltip"; + + /// + /// Whether holding Left SHIFT for the tooltip extension hides the normal tooltip. Typically this is false. + /// + public virtual bool HidesNormalTooltip => false; + + /// + /// Whether the "Hold SHIFT for more" extension indicator appears by default. Should essentially always be true.
+ /// You can set this to false for "secret" flavor or easter egg tooltips, like the one on Midas Prime. + ///
+ public virtual bool ShowExtensionIndicator => true; + + /// + /// The lang/localization key of this item's tooltip extension indicator message. + /// + public virtual string ExtensionIndicatorKey => DefaultExtensionIndicatorKey; + + /// + /// The color of this item's tooltip extension indicator message. If set to null, the indicator will not be colored. + /// + public virtual Color? ExtensionIndicatorColor => DefaultExtensionIndicatorColor; + + /// + /// The lang/localization key which this item uses for its tooltip extension. + /// + public virtual string TooltipExtensionKey => DefaultTooltipExtensionKey; + + /// + /// The color of this item's tooltip extension. If set to null, the tooltip extension will not be colored. + /// + public virtual Color? TooltipExtensionColor => null; + + } +} diff --git a/Items/LoreItems/LoreItem.cs b/Items/LoreItems/LoreItem.cs index ef983c0434..193dde3a8f 100644 --- a/Items/LoreItems/LoreItem.cs +++ b/Items/LoreItems/LoreItem.cs @@ -1,21 +1,25 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { - public abstract class LoreItem : ModItem, ILocalizedModType + public abstract class LoreItem : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Lore"; - // All lore items initially have a short tooltip which indicates there is more to be read. - public override LocalizedText Tooltip => CalamityUtils.GetText($"{LocalizationCategory}.ShortTooltip"); + // When holding SHIFT on a lore item, the default tooltip is removed entirely. + public bool HidesNormalTooltip => true; - // By default, lore text appears in white, but this can be changed. - public virtual Color? LoreColor => null; + // Lore items have a flavorful extension indicator tooltip. + public string ExtensionIndicatorKey => $"{LocalizationCategory}.ShortTooltip"; + + // Each line of the extension indicator tooltip is manually colored, so don't provide an override color. + public Color? ExtensionIndicatorColor => null; + + // The localization key for all lore items' full lore content is just "Lore". + public string TooltipExtensionKey => "Lore"; public override void SetStaticDefaults() { @@ -30,14 +34,5 @@ namespace CalamityMod.Items.LoreItems { itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.LoreItems; } - - // All lore items use the same code for holding SHIFT to extend tooltips. - public override void ModifyTooltips(List tooltips) - { - TooltipLine fullLore = new(Mod, "CalamityMod:Lore", this.GetLocalizedValue("Lore")); - if (LoreColor.HasValue) - fullLore.OverrideColor = LoreColor.Value; - CalamityUtils.HoldShiftTooltip(tooltips, new TooltipLine[] { fullLore }, true); - } } } diff --git a/Items/Pets/AbyssShellFossil.cs b/Items/Pets/AbyssShellFossil.cs index 48415c3dd9..617e861792 100644 --- a/Items/Pets/AbyssShellFossil.cs +++ b/Items/Pets/AbyssShellFossil.cs @@ -20,11 +20,9 @@ namespace CalamityMod.Items.Pets Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; - Item.value = Item.sellPrice(platinum: 1); Item.rare = ItemRarityID.Cyan; Item.Calamity().devItem = true; - Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); Item.UseSound = SoundID.Item2; diff --git a/Items/Placeables/AlgalSlateItem.cs b/Items/Placeables/AlgalSlateItem.cs new file mode 100644 index 0000000000..b6d48487fb --- /dev/null +++ b/Items/Placeables/AlgalSlateItem.cs @@ -0,0 +1,30 @@ +using CalamityMod.Tiles.FloralParadise; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AlgalSlateItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; + } + } +} diff --git a/Items/Placeables/AlgalSlateItem.png b/Items/Placeables/AlgalSlateItem.png new file mode 100644 index 0000000000..a589261603 Binary files /dev/null and b/Items/Placeables/AlgalSlateItem.png differ diff --git a/Items/Placeables/Basalt.cs b/Items/Placeables/Basalt.cs new file mode 100644 index 0000000000..487fd1f7ac --- /dev/null +++ b/Items/Placeables/Basalt.cs @@ -0,0 +1,28 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class Basalt : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Basalt.png b/Items/Placeables/Basalt.png new file mode 100644 index 0000000000..3f4786a23a Binary files /dev/null and b/Items/Placeables/Basalt.png differ diff --git a/Items/Placeables/BlackPearlPile.cs b/Items/Placeables/BlackPearlPile.cs new file mode 100644 index 0000000000..2f44d3cd68 --- /dev/null +++ b/Items/Placeables/BlackPearlPile.cs @@ -0,0 +1,37 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class BlackPearlPile : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.rare = ItemRarityID.Blue; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(ItemID.BlackPearl). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/BlackPearlPile.png b/Items/Placeables/BlackPearlPile.png new file mode 100644 index 0000000000..c35a65ebbc Binary files /dev/null and b/Items/Placeables/BlackPearlPile.png differ diff --git a/Items/Placeables/CyanCoral.cs b/Items/Placeables/CyanCoral.cs new file mode 100644 index 0000000000..b5d7d106bd --- /dev/null +++ b/Items/Placeables/CyanCoral.cs @@ -0,0 +1,37 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CyanCoral : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.rare = ItemRarityID.Blue; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + //public override void AddRecipes() + //{ + // CreateRecipe(4). + // AddIngredient(ItemID.PinkPearl). + // AddTile(TileID.HeavyWorkBench). + // Register(); + //} + } +} diff --git a/Items/Placeables/CyanCoral.png b/Items/Placeables/CyanCoral.png new file mode 100644 index 0000000000..3f705ee85b Binary files /dev/null and b/Items/Placeables/CyanCoral.png differ diff --git a/Items/Placeables/Driftwood.cs b/Items/Placeables/Driftwood.cs new file mode 100644 index 0000000000..72db8e2f9f --- /dev/null +++ b/Items/Placeables/Driftwood.cs @@ -0,0 +1,42 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class Driftwood : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Wood; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood; + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Driftwood.png b/Items/Placeables/Driftwood.png new file mode 100644 index 0000000000..25ff08f299 Binary files /dev/null and b/Items/Placeables/Driftwood.png differ diff --git a/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.png b/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.png index cfbfe599d3..077568f1c7 100644 Binary files a/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.png and b/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.png differ diff --git a/Items/Placeables/Furniture/ResilientCandle.cs b/Items/Placeables/Furniture/ResilientCandle.cs index 87c79ac75d..68052c8dfe 100644 --- a/Items/Placeables/Furniture/ResilientCandle.cs +++ b/Items/Placeables/Furniture/ResilientCandle.cs @@ -19,8 +19,9 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.value = Item.buyPrice(0, 25, 0, 0); - Item.rare = ItemRarityID.LightRed; + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 20); + Item.rare = ItemRarityID.Pink; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/SpitefulCandle.cs b/Items/Placeables/Furniture/SpitefulCandle.cs index cef61b3d9b..c4b222be8d 100644 --- a/Items/Placeables/Furniture/SpitefulCandle.cs +++ b/Items/Placeables/Furniture/SpitefulCandle.cs @@ -19,8 +19,9 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.value = Item.buyPrice(0, 25, 0, 0); - Item.rare = ItemRarityID.LightRed; + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 20); + Item.rare = ItemRarityID.Pink; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/VigorousCandle.cs b/Items/Placeables/Furniture/VigorousCandle.cs index f5457c0f4a..7e82334566 100644 --- a/Items/Placeables/Furniture/VigorousCandle.cs +++ b/Items/Placeables/Furniture/VigorousCandle.cs @@ -19,8 +19,9 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.value = Item.buyPrice(0, 25, 0, 0); - Item.rare = ItemRarityID.LightRed; + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 20); + Item.rare = ItemRarityID.Pink; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/WeightlessCandle.cs b/Items/Placeables/Furniture/WeightlessCandle.cs index 903f707f04..904a2d2654 100644 --- a/Items/Placeables/Furniture/WeightlessCandle.cs +++ b/Items/Placeables/Furniture/WeightlessCandle.cs @@ -19,8 +19,9 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.value = Item.buyPrice(0, 25, 0, 0); - Item.rare = ItemRarityID.LightRed; + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 20); + Item.rare = ItemRarityID.Pink; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/LimeCoral.cs b/Items/Placeables/LimeCoral.cs new file mode 100644 index 0000000000..67ed0a5725 --- /dev/null +++ b/Items/Placeables/LimeCoral.cs @@ -0,0 +1,37 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class LimeCoral : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.rare = ItemRarityID.Blue; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + //public override void AddRecipes() + //{ + // CreateRecipe(4). + // AddIngredient(ItemID.PinkPearl). + // AddTile(TileID.HeavyWorkBench). + // Register(); + //} + } +} diff --git a/Items/Placeables/LimeCoral.png b/Items/Placeables/LimeCoral.png new file mode 100644 index 0000000000..e5388e3811 Binary files /dev/null and b/Items/Placeables/LimeCoral.png differ diff --git a/Items/Placeables/Limestone.cs b/Items/Placeables/Limestone.cs new file mode 100644 index 0000000000..d238c192a1 --- /dev/null +++ b/Items/Placeables/Limestone.cs @@ -0,0 +1,28 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class Limestone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Limestone.png b/Items/Placeables/Limestone.png new file mode 100644 index 0000000000..65742f7ba5 Binary files /dev/null and b/Items/Placeables/Limestone.png differ diff --git a/Items/Placeables/MagentaCoral.cs b/Items/Placeables/MagentaCoral.cs new file mode 100644 index 0000000000..a78ffb95c0 --- /dev/null +++ b/Items/Placeables/MagentaCoral.cs @@ -0,0 +1,37 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class MagentaCoral : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.rare = ItemRarityID.Blue; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + //public override void AddRecipes() + //{ + // CreateRecipe(4). + // AddIngredient(ItemID.PinkPearl). + // AddTile(TileID.HeavyWorkBench). + // Register(); + //} + } +} diff --git a/Items/Placeables/MagentaCoral.png b/Items/Placeables/MagentaCoral.png new file mode 100644 index 0000000000..1f394b1b66 Binary files /dev/null and b/Items/Placeables/MagentaCoral.png differ diff --git a/Items/Placeables/OrangeCoral.cs b/Items/Placeables/OrangeCoral.cs new file mode 100644 index 0000000000..d0dc22fe52 --- /dev/null +++ b/Items/Placeables/OrangeCoral.cs @@ -0,0 +1,37 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class OrangeCoral : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.rare = ItemRarityID.Blue; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + //public override void AddRecipes() + //{ + // CreateRecipe(4). + // AddIngredient(ItemID.PinkPearl). + // AddTile(TileID.HeavyWorkBench). + // Register(); + //} + } +} diff --git a/Items/Placeables/OrangeCoral.png b/Items/Placeables/OrangeCoral.png new file mode 100644 index 0000000000..cfe3fccb6a Binary files /dev/null and b/Items/Placeables/OrangeCoral.png differ diff --git a/Items/Placeables/PeatItem.cs b/Items/Placeables/PeatItem.cs new file mode 100644 index 0000000000..3a66f54c81 --- /dev/null +++ b/Items/Placeables/PeatItem.cs @@ -0,0 +1,30 @@ +using CalamityMod.Tiles.FloralParadise; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PeatItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; + } + } +} diff --git a/Items/Placeables/PeatItem.png b/Items/Placeables/PeatItem.png new file mode 100644 index 0000000000..2c060a37a8 Binary files /dev/null and b/Items/Placeables/PeatItem.png differ diff --git a/Items/Placeables/PeatMossItem.cs b/Items/Placeables/PeatMossItem.cs new file mode 100644 index 0000000000..716931ef05 --- /dev/null +++ b/Items/Placeables/PeatMossItem.cs @@ -0,0 +1,30 @@ +using CalamityMod.Tiles.FloralParadise; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PeatMossItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; + } + } +} diff --git a/Items/Placeables/PeatMossItem.png b/Items/Placeables/PeatMossItem.png new file mode 100644 index 0000000000..e7b019ef74 Binary files /dev/null and b/Items/Placeables/PeatMossItem.png differ diff --git a/Items/Placeables/PinkPearlPile.cs b/Items/Placeables/PinkPearlPile.cs new file mode 100644 index 0000000000..2307018521 --- /dev/null +++ b/Items/Placeables/PinkPearlPile.cs @@ -0,0 +1,37 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PinkPearlPile : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.rare = ItemRarityID.Blue; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(ItemID.PinkPearl). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/PinkPearlPile.png b/Items/Placeables/PinkPearlPile.png new file mode 100644 index 0000000000..1b346005d3 Binary files /dev/null and b/Items/Placeables/PinkPearlPile.png differ diff --git a/Items/Placeables/PolishedNavystoneBrick.cs b/Items/Placeables/PolishedNavystoneBrick.cs new file mode 100644 index 0000000000..d8866493c8 --- /dev/null +++ b/Items/Placeables/PolishedNavystoneBrick.cs @@ -0,0 +1,36 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PolishedNavystoneBrick : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(2). + AddTile(TileID.Furnaces). + Register(); + } + } +} diff --git a/Items/Placeables/PolishedNavystoneBrick.png b/Items/Placeables/PolishedNavystoneBrick.png new file mode 100644 index 0000000000..7bb337525e Binary files /dev/null and b/Items/Placeables/PolishedNavystoneBrick.png differ diff --git a/Items/Placeables/PolypSand.cs b/Items/Placeables/PolypSand.cs new file mode 100644 index 0000000000..89c5bb8aa1 --- /dev/null +++ b/Items/Placeables/PolypSand.cs @@ -0,0 +1,28 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PolypSand : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/PolypSand.png b/Items/Placeables/PolypSand.png new file mode 100644 index 0000000000..a83aa99230 Binary files /dev/null and b/Items/Placeables/PolypSand.png differ diff --git a/Items/Placeables/RuneSand.cs b/Items/Placeables/RuneSand.cs new file mode 100644 index 0000000000..1dc5aebddb --- /dev/null +++ b/Items/Placeables/RuneSand.cs @@ -0,0 +1,29 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class RuneSand : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/RuneSand.png b/Items/Placeables/RuneSand.png new file mode 100644 index 0000000000..60335c3ac5 Binary files /dev/null and b/Items/Placeables/RuneSand.png differ diff --git a/Items/Placeables/Runestone.cs b/Items/Placeables/Runestone.cs new file mode 100644 index 0000000000..29e003cc66 --- /dev/null +++ b/Items/Placeables/Runestone.cs @@ -0,0 +1,33 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class Runestone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 200; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.rare = ItemRarityID.Blue; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Runestone.png b/Items/Placeables/Runestone.png new file mode 100644 index 0000000000..d0d3ec7b6e Binary files /dev/null and b/Items/Placeables/Runestone.png differ diff --git a/Items/Placeables/ScintillatingBloom.cs b/Items/Placeables/ScintillatingBloom.cs new file mode 100644 index 0000000000..cb8daca949 --- /dev/null +++ b/Items/Placeables/ScintillatingBloom.cs @@ -0,0 +1,31 @@ +using CalamityMod.Tiles.FloralParadise; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ScintillatingBloom : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 10; + } + + public override void SetDefaults() + { + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.maxStack = 999; + } + } +} diff --git a/Items/Placeables/ScintillatingBloom.png b/Items/Placeables/ScintillatingBloom.png new file mode 100644 index 0000000000..12b82912c8 Binary files /dev/null and b/Items/Placeables/ScintillatingBloom.png differ diff --git a/Items/Placeables/Shellstone.cs b/Items/Placeables/Shellstone.cs new file mode 100644 index 0000000000..f0e23fd388 --- /dev/null +++ b/Items/Placeables/Shellstone.cs @@ -0,0 +1,28 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class Shellstone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Shellstone.png b/Items/Placeables/Shellstone.png new file mode 100644 index 0000000000..12c46ba411 Binary files /dev/null and b/Items/Placeables/Shellstone.png differ diff --git a/Items/Placeables/ShellstoneSlab.cs b/Items/Placeables/ShellstoneSlab.cs new file mode 100644 index 0000000000..4ddac14904 --- /dev/null +++ b/Items/Placeables/ShellstoneSlab.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ShellstoneSlab : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.HeavyWorkBench). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/ShellstoneSlab.png b/Items/Placeables/ShellstoneSlab.png new file mode 100644 index 0000000000..de0ea708a5 Binary files /dev/null and b/Items/Placeables/ShellstoneSlab.png differ diff --git a/Items/Placeables/VolcanicSand.cs b/Items/Placeables/VolcanicSand.cs new file mode 100644 index 0000000000..7f79888f53 --- /dev/null +++ b/Items/Placeables/VolcanicSand.cs @@ -0,0 +1,28 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VolcanicSand : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/VolcanicSand.png b/Items/Placeables/VolcanicSand.png new file mode 100644 index 0000000000..5cdd030ddb Binary files /dev/null and b/Items/Placeables/VolcanicSand.png differ diff --git a/Items/Placeables/Walls/DriftwoodWall.cs b/Items/Placeables/Walls/DriftwoodWall.cs new file mode 100644 index 0000000000..61d8eaada7 --- /dev/null +++ b/Items/Placeables/Walls/DriftwoodWall.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class DriftwoodWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/DriftwoodWall.png b/Items/Placeables/Walls/DriftwoodWall.png new file mode 100644 index 0000000000..27ae1c07a6 Binary files /dev/null and b/Items/Placeables/Walls/DriftwoodWall.png differ diff --git a/Items/Placeables/Walls/ShellstoneSlabWall.cs b/Items/Placeables/Walls/ShellstoneSlabWall.cs new file mode 100644 index 0000000000..2cfe2a0d1c --- /dev/null +++ b/Items/Placeables/Walls/ShellstoneSlabWall.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class ShellstoneSlabWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/ShellstoneSlabWall.png b/Items/Placeables/Walls/ShellstoneSlabWall.png new file mode 100644 index 0000000000..ceb19599d8 Binary files /dev/null and b/Items/Placeables/Walls/ShellstoneSlabWall.png differ diff --git a/Items/Placeables/Walls/ShellstoneWall.cs b/Items/Placeables/Walls/ShellstoneWall.cs new file mode 100644 index 0000000000..aa28237ecd --- /dev/null +++ b/Items/Placeables/Walls/ShellstoneWall.cs @@ -0,0 +1,29 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class ShellstoneWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + } +} diff --git a/Items/Placeables/Walls/ShellstoneWall.png b/Items/Placeables/Walls/ShellstoneWall.png new file mode 100644 index 0000000000..652e1d0e20 Binary files /dev/null and b/Items/Placeables/Walls/ShellstoneWall.png differ diff --git a/Items/Placeables/WhitePearlPile.cs b/Items/Placeables/WhitePearlPile.cs new file mode 100644 index 0000000000..2c771bf04d --- /dev/null +++ b/Items/Placeables/WhitePearlPile.cs @@ -0,0 +1,37 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class WhitePearlPile : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.rare = ItemRarityID.Blue; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(ItemID.WhitePearl). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/WhitePearlPile.png b/Items/Placeables/WhitePearlPile.png new file mode 100644 index 0000000000..3a896ab3da Binary files /dev/null and b/Items/Placeables/WhitePearlPile.png differ diff --git a/Items/Placeables/YellowCoral.cs b/Items/Placeables/YellowCoral.cs new file mode 100644 index 0000000000..410cc62fe5 --- /dev/null +++ b/Items/Placeables/YellowCoral.cs @@ -0,0 +1,37 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class YellowCoral : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.rare = ItemRarityID.Blue; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + //public override void AddRecipes() + //{ + // CreateRecipe(4). + // AddIngredient(ItemID.PinkPearl). + // AddTile(TileID.HeavyWorkBench). + // Register(); + //} + } +} diff --git a/Items/Placeables/YellowCoral.png b/Items/Placeables/YellowCoral.png new file mode 100644 index 0000000000..0a9f3779aa Binary files /dev/null and b/Items/Placeables/YellowCoral.png differ diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index e674edd64a..964b55b6ed 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 60, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 80); } } } diff --git a/Items/Potions/Alcohol/CaribbeanRum.cs b/Items/Potions/Alcohol/CaribbeanRum.cs index b8d4a37cec..fb3b0a0705 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 5, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); } } } diff --git a/Items/Potions/Alcohol/CinnamonRoll.cs b/Items/Potions/Alcohol/CinnamonRoll.cs index 0973b19847..1910bad0c8 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 5, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Potions/Alcohol/Everclear.cs b/Items/Potions/Alcohol/Everclear.cs index 677e4b775c..33e4888e93 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(60f); - Item.value = Item.buyPrice(0, 2, 0, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 80); } } } diff --git a/Items/Potions/Alcohol/EvergreenGin.cs b/Items/Potions/Alcohol/EvergreenGin.cs index 86db743607..0453782cd2 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 5, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); } } } diff --git a/Items/Potions/Alcohol/FabsolsVodka.cs b/Items/Potions/Alcohol/FabsolsVodka.cs index 4ca2edb060..0ba3d02d36 100644 --- a/Items/Potions/Alcohol/FabsolsVodka.cs +++ b/Items/Potions/Alcohol/FabsolsVodka.cs @@ -31,7 +31,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(900f); - Item.value = Item.buyPrice(0, 2, 60, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); } public override void AddRecipes() diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index d8b5cf82c3..a177520b66 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 0, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); } } } diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 36f309e56b..c1462f6d78 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.healMana = 100; Item.consumable = true; Item.potion = true; - Item.value = Item.buyPrice(0, 0, 20, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 3); } public override void OnConsumeItem(Player player) diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index c3070a7bd8..04ebc3f9af 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -31,7 +31,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.potion = true; Item.healLife = 200; Item.healMana = 200; - Item.value = Item.buyPrice(0, 5, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); } public override void OnConsumeItem(Player player) diff --git a/Items/Potions/Alcohol/Moonshine.cs b/Items/Potions/Alcohol/Moonshine.cs index 761978e62a..165545297f 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 1, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index 68360b9557..10433f63b9 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 5, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Potions/Alcohol/OddMushroom.cs b/Items/Potions/Alcohol/OddMushroom.cs index 6ef47a0421..f3e1efa5f3 100644 --- a/Items/Potions/Alcohol/OddMushroom.cs +++ b/Items/Potions/Alcohol/OddMushroom.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(3600f); - Item.value = Item.buyPrice(0, 50, 0, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 10); } public override void OnConsumeItem(Player player) diff --git a/Items/Potions/Alcohol/OldFashioned.cs b/Items/Potions/Alcohol/OldFashioned.cs index d1a68bde36..a440396e3d 100644 --- a/Items/Potions/Alcohol/OldFashioned.cs +++ b/Items/Potions/Alcohol/OldFashioned.cs @@ -31,7 +31,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(360f); - Item.value = Item.buyPrice(0, 5, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); } } } diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index 5f3cc7a515..a0f4c67292 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.healLife = 200; Item.consumable = true; Item.potion = true; - Item.value = Item.buyPrice(0, 0, 65, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); } public override bool? UseItem(Player player) diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index 3872d3d561..a6ac51a739 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 1, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); } } } diff --git a/Items/Potions/Alcohol/Screwdriver.cs b/Items/Potions/Alcohol/Screwdriver.cs index c4636851ca..299d0ff7fb 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 4, 0, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 40); } } } diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index 8c920d9a0b..f279ce4f8d 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 4, 0, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 80); } } } diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index ac1c240cc0..3a87ad876d 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 1, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); } } } diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index c3cbf82664..c6c181562c 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 6, 60, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index ce5fda48ed..56a28b6ecf 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 1, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 40); } } } diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index 3a69589efd..1b79dd7714 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.consumable = true; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 1, 30, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); } } } diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index d640b9b56e..a75ba175dc 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Items.Potions.Alcohol Item.healMana = 300; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(300f); - Item.value = Item.buyPrice(0, 4, 0, 0); + // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 40); } public override bool? UseItem(Player player) diff --git a/Items/Tools/AcidwoodAxe.cs b/Items/Tools/AcidwoodAxe.cs new file mode 100644 index 0000000000..a14997a250 --- /dev/null +++ b/Items/Tools/AcidwoodAxe.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Placeables; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public class AcidwoodAxe : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + public override void SetDefaults() + { + Item.damage = 8; + Item.knockBack = 3f; + Item.useTime = 16; + Item.useAnimation = 23; + Item.axe = 55 / 5; + + Item.DamageType = DamageClass.Melee; + Item.width = 40; + Item.height = 32; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; + Item.rare = ItemRarityID.White; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Tools/AcidwoodAxe.png b/Items/Tools/AcidwoodAxe.png new file mode 100644 index 0000000000..55652b2c68 Binary files /dev/null and b/Items/Tools/AcidwoodAxe.png differ diff --git a/Items/Tools/AcidwoodHammer.cs b/Items/Tools/AcidwoodHammer.cs new file mode 100644 index 0000000000..fb19a29600 --- /dev/null +++ b/Items/Tools/AcidwoodHammer.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Placeables; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public class AcidwoodHammer : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + public override void SetDefaults() + { + Item.damage = 10; + Item.knockBack = 3.5f; + Item.useTime = 10; + Item.useAnimation = 20; + Item.hammer = 25; + + Item.DamageType = DamageClass.Melee; + Item.width = 40; + Item.height = 40; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; + Item.rare = ItemRarityID.White; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Tools/AcidwoodHammer.png b/Items/Tools/AcidwoodHammer.png new file mode 100644 index 0000000000..2ebde81d4b Binary files /dev/null and b/Items/Tools/AcidwoodHammer.png differ diff --git a/Items/Tools/AcidwoodPickaxe.cs b/Items/Tools/AcidwoodPickaxe.cs new file mode 100644 index 0000000000..986357d323 --- /dev/null +++ b/Items/Tools/AcidwoodPickaxe.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public class AcidwoodPickaxe : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + public override void SetDefaults() + { + Item.damage = 5; + Item.knockBack = 1f; + Item.useTime = 9; + Item.useAnimation = 18; + Item.pick = 40; + + Item.DamageType = DamageClass.Melee; + Item.width = 36; + Item.height = 36; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; + Item.rare = ItemRarityID.White; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Tools/AcidwoodPickaxe.png b/Items/Tools/AcidwoodPickaxe.png new file mode 100644 index 0000000000..800c0698de Binary files /dev/null and b/Items/Tools/AcidwoodPickaxe.png differ diff --git a/Items/Tools/DriftwoodAxe.cs b/Items/Tools/DriftwoodAxe.cs new file mode 100644 index 0000000000..0c772ac67e --- /dev/null +++ b/Items/Tools/DriftwoodAxe.cs @@ -0,0 +1,54 @@ +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public class DriftwoodAxe : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + public override void SetDefaults() + { + Item.damage = 9; + Item.knockBack = 3.5f; + Item.useTime = 13; + Item.useAnimation = 30; + Item.axe = 60 / 5; + + Item.DamageType = DamageClass.Melee; + Item.width = 40; + Item.height = 34; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; + Item.rare = ItemRarityID.White; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + bool surface = player.Center.Y < Main.worldSurface * 16.0; + bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); + if (GetEffects) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 160); + Item.useTime = 7; + Item.useAnimation = 20; + } + else + { + Item.useTime = 13; + Item.useAnimation = 30; + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Tools/DriftwoodAxe.png b/Items/Tools/DriftwoodAxe.png new file mode 100644 index 0000000000..9fb519983f Binary files /dev/null and b/Items/Tools/DriftwoodAxe.png differ diff --git a/Items/Tools/DriftwoodHammer.cs b/Items/Tools/DriftwoodHammer.cs new file mode 100644 index 0000000000..56870482ce --- /dev/null +++ b/Items/Tools/DriftwoodHammer.cs @@ -0,0 +1,55 @@ +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public class DriftwoodHammer : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + public override void SetDefaults() + { + Item.damage = 13; + Item.knockBack = 4f; + Item.useTime = 12; + Item.useAnimation = 31; + Item.hammer = 45; + + Item.DamageType = DamageClass.Melee; + Item.width = 40; + Item.height = 42; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; + Item.rare = ItemRarityID.White; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + bool surface = player.Center.Y < Main.worldSurface * 16.0; + bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); + if (GetEffects) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 160); + Item.useTime = 7; + Item.useAnimation = 21; + } + else + { + Item.useTime = 12; + Item.useAnimation = 31; + } + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Tools/DriftwoodHammer.png b/Items/Tools/DriftwoodHammer.png new file mode 100644 index 0000000000..aa27de07a6 Binary files /dev/null and b/Items/Tools/DriftwoodHammer.png differ diff --git a/Items/Tools/DriftwoodPickaxe.cs b/Items/Tools/DriftwoodPickaxe.cs new file mode 100644 index 0000000000..5fec674b3a --- /dev/null +++ b/Items/Tools/DriftwoodPickaxe.cs @@ -0,0 +1,54 @@ +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public class DriftwoodPickaxe : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + public override void SetDefaults() + { + Item.damage = 7; + Item.knockBack = 1.5f; + Item.useTime = 9; + Item.useAnimation = 18; + Item.pick = 55; + + Item.DamageType = DamageClass.Melee; + Item.width = 38; + Item.height = 38; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; + Item.rare = ItemRarityID.White; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + bool surface = player.Center.Y < Main.worldSurface * 16.0; + bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); + if (GetEffects) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 160); + Item.useTime = 7; + Item.useAnimation = 14; + } + else + { + Item.useTime = 9; + Item.useAnimation = 18; + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Tools/DriftwoodPickaxe.png b/Items/Tools/DriftwoodPickaxe.png new file mode 100644 index 0000000000..8e7156c574 Binary files /dev/null and b/Items/Tools/DriftwoodPickaxe.png differ diff --git a/Items/Tools/MonolithAxe.cs b/Items/Tools/MonolithAxe.cs new file mode 100644 index 0000000000..5ed613a3d3 --- /dev/null +++ b/Items/Tools/MonolithAxe.cs @@ -0,0 +1,44 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public class MonolithAxe : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + public override void SetDefaults() + { + Item.damage = 25; + Item.knockBack = 2f; + Item.useTime = 6; + Item.useAnimation = 8; + Item.axe = 75 / 5; + + Item.DamageType = DamageClass.Melee; + Item.width = 38; + Item.height = 36; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()); + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Tools/MonolithAxe.png b/Items/Tools/MonolithAxe.png new file mode 100644 index 0000000000..b87a887ee3 Binary files /dev/null and b/Items/Tools/MonolithAxe.png differ diff --git a/Items/Tools/MonolithHammer.cs b/Items/Tools/MonolithHammer.cs new file mode 100644 index 0000000000..aa50f8cb3d --- /dev/null +++ b/Items/Tools/MonolithHammer.cs @@ -0,0 +1,45 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public class MonolithHammer : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + public override void SetDefaults() + { + Item.damage = 29; + Item.knockBack = 2.5f; + Item.useTime = 6; + Item.useAnimation = 9; + Item.hammer = 40; + + Item.DamageType = DamageClass.Melee; + Item.width = 46; + Item.height = 44; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Tools/MonolithHammer.png b/Items/Tools/MonolithHammer.png new file mode 100644 index 0000000000..c25333f352 Binary files /dev/null and b/Items/Tools/MonolithHammer.png differ diff --git a/Items/Tools/MonolithPickaxe.cs b/Items/Tools/MonolithPickaxe.cs new file mode 100644 index 0000000000..132c26cd51 --- /dev/null +++ b/Items/Tools/MonolithPickaxe.cs @@ -0,0 +1,44 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public class MonolithPickaxe : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + public override void SetDefaults() + { + Item.damage = 19; + Item.knockBack = 0.8f; + Item.useTime = 6; + Item.useAnimation = 6; + Item.pick = 70; + + Item.DamageType = DamageClass.Melee; + Item.width = 38; + Item.height = 40; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()); + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Tools/MonolithPickaxe.png b/Items/Tools/MonolithPickaxe.png new file mode 100644 index 0000000000..d4e945293c Binary files /dev/null and b/Items/Tools/MonolithPickaxe.png differ diff --git a/Items/VanillaArmorChanges/NebulaArmorSetChange.cs b/Items/VanillaArmorChanges/NebulaArmorSetChange.cs new file mode 100644 index 0000000000..ebab9693fb --- /dev/null +++ b/Items/VanillaArmorChanges/NebulaArmorSetChange.cs @@ -0,0 +1,25 @@ +using System.Text; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.VanillaArmorChanges +{ + public class NebulaArmorSetChange : VanillaArmorChange + { + public override int? HeadPieceID => ItemID.NebulaHelmet; + + public override int? BodyPieceID => ItemID.NebulaBreastplate; + + public override int? LegPieceID => ItemID.NebulaLeggings; + + public override string ArmorSetName => "Nebula"; + + // The only thing this class does is change the set bonus text. + // Buff booster nerfs are handled separately as IL edits. + public override void UpdateSetBonusText(ref string setBonusText) + { + setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + } + } +} diff --git a/Items/VanillaArmorChanges/PalladiumArmorSetChange.cs b/Items/VanillaArmorChanges/PalladiumArmorSetChange.cs index 7d0756257c..064aa47036 100644 --- a/Items/VanillaArmorChanges/PalladiumArmorSetChange.cs +++ b/Items/VanillaArmorChanges/PalladiumArmorSetChange.cs @@ -28,5 +28,10 @@ namespace CalamityMod.Items.VanillaArmorChanges { player.GetDamage() += LeggingsDamagePercentageBoost * 0.01f; } + + public override void UpdateSetBonusText(ref string setBonusText) + { + setBonusText = $"{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + } } } diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 04e2185db0..6c06402f6e 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 62; Item.height = 22; Item.DamageType = DamageClass.Magic; - Item.damage = 23; + Item.damage = 27; Item.knockBack = 0f; Item.useTime = Item.useAnimation = 21; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/Taser.cs b/Items/Weapons/DraedonsArsenal/Taser.cs index 52c92a47a3..1fb627359e 100644 --- a/Items/Weapons/DraedonsArsenal/Taser.cs +++ b/Items/Weapons/DraedonsArsenal/Taser.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 50; Item.height = 26; Item.DamageType = DamageClass.Ranged; - Item.damage = 15; + Item.damage = 20; Item.knockBack = 0f; Item.useTime = Item.useAnimation = 28; Item.autoReuse = true; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 15f; + Item.shootSpeed = 25f; modItem.UsesCharge = true; modItem.MaxCharge = 50f; diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index f69d253b41..3292e3fc4b 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 30; Item.height = 34; - Item.damage = 16; + Item.damage = 19; Item.DamageType = RogueDamageClass.Instance; Item.useTime = 40; Item.useAnimation = 40; diff --git a/Items/Weapons/Magic/TheCauldron.cs b/Items/Weapons/Magic/TheCauldron.cs new file mode 100644 index 0000000000..c05c1dd41c --- /dev/null +++ b/Items/Weapons/Magic/TheCauldron.cs @@ -0,0 +1,79 @@ +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class TheCauldron : ModItem, ILocalizedModType + { + float manaReductionMult = 0.2f; + public new string LocalizationCategory => "Items.Weapons.Magic"; + public static Asset Glow; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + Glow = ModContent.Request(Texture + "Glow"); + } + } + public override void SetDefaults() + { + Item.width = 46; + Item.height = 46; + Item.damage = 59; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 60; + Item.useTime = 60; + Item.knockBack = 8f; + Item.mana = 18; + Item.UseSound = SoundID.DD2_MonkStaffSwing; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.DamageType = DamageClass.Magic; + Item.channel = true; + Item.Calamity().donorItem = true; + } + + // Reduce mana cost while in lava or the underworld + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.lavaWet || player.ZoneUnderworldHeight) + { + mult = manaReductionMult; + } + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Glow.Value); + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 46); + return false; + } + + public override void AddRecipes() + { + CreateRecipe() + .AddIngredient(ItemID.LavaBucket, 1) + .AddIngredient(ItemID.HellstoneBar, 8) + .AddIngredient(ItemID.Obsidian, 20) + .AddIngredient(ItemID.AshBlock, 20) + .AddTile(TileID.Anvils) + .Register(); + } + } +} diff --git a/Items/Weapons/Magic/TheCauldron.png b/Items/Weapons/Magic/TheCauldron.png new file mode 100644 index 0000000000..475a726020 Binary files /dev/null and b/Items/Weapons/Magic/TheCauldron.png differ diff --git a/Items/Weapons/Magic/TheCauldronGlow.png b/Items/Weapons/Magic/TheCauldronGlow.png new file mode 100644 index 0000000000..04cb3a66a5 Binary files /dev/null and b/Items/Weapons/Magic/TheCauldronGlow.png differ diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index 64a725372a..1119ef868d 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 28; Item.height = 30; - Item.damage = 23; + Item.damage = 27; Item.DamageType = DamageClass.Magic; Item.mana = 5; Item.useTime = 12; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item7; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 20f; + Item.shootSpeed = 25.5f; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/AcidwoodSword.cs b/Items/Weapons/Melee/AcidwoodSword.cs new file mode 100644 index 0000000000..3d8eaf9876 --- /dev/null +++ b/Items/Weapons/Melee/AcidwoodSword.cs @@ -0,0 +1,34 @@ +using CalamityMod.Items.Placeables; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class AcidwoodSword : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() + { + Item.damage = 11; + Item.width = 36; + Item.height = 40; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useTurn = true; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; + Item.rare = ItemRarityID.White; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(7). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/AcidwoodSword.png b/Items/Weapons/Melee/AcidwoodSword.png new file mode 100644 index 0000000000..cf8d56267c Binary files /dev/null and b/Items/Weapons/Melee/AcidwoodSword.png differ diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index 9fff13ee27..1ab080f85e 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 28; Item.height = 28; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 26; + Item.damage = 29; Item.knockBack = 4f; Item.useTime = 22; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/Aorta.cs b/Items/Weapons/Melee/Aorta.cs index 182dab333b..62b40b8710 100644 --- a/Items/Weapons/Melee/Aorta.cs +++ b/Items/Weapons/Melee/Aorta.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 30; Item.height = 26; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 29; + Item.damage = 31; Item.knockBack = 4.25f; Item.useTime = 22; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/DriftwoodSword.cs b/Items/Weapons/Melee/DriftwoodSword.cs new file mode 100644 index 0000000000..57f1ca8924 --- /dev/null +++ b/Items/Weapons/Melee/DriftwoodSword.cs @@ -0,0 +1,53 @@ +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class DriftwoodSword : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() + { + Item.damage = 14; + Item.width = 42; + Item.height = 46; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useTurn = true; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; + Item.rare = ItemRarityID.White; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + bool surface = player.Center.Y < Main.worldSurface * 16.0; + bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); + if (GetEffects) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 160); + Item.useTime = 12; + Item.useAnimation = 12; + Item.knockBack = 5.5f; + } + else + { + Item.useTime = 20; + Item.useAnimation = 20; + Item.knockBack = 4f; + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(7). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/DriftwoodSword.png b/Items/Weapons/Melee/DriftwoodSword.png new file mode 100644 index 0000000000..4a95e5f996 Binary files /dev/null and b/Items/Weapons/Melee/DriftwoodSword.png differ diff --git a/Items/Weapons/Melee/GoldplumeSpear.cs b/Items/Weapons/Melee/GoldplumeSpear.cs index d2b38a87c0..3bd09d84d9 100644 --- a/Items/Weapons/Melee/GoldplumeSpear.cs +++ b/Items/Weapons/Melee/GoldplumeSpear.cs @@ -18,14 +18,14 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 54; Item.height = 54; - Item.damage = 27; + Item.damage = 37; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 23; + Item.useAnimation = 28; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 23; + Item.useTime = 28; Item.knockBack = 5.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index 1732260e9d..b2ded44e87 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 78; Item.height = 78; - Item.damage = 40; + Item.damage = 85; Item.DamageType = DamageClass.Melee; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Melee/MonolithSword.cs b/Items/Weapons/Melee/MonolithSword.cs new file mode 100644 index 0000000000..3af19b0da7 --- /dev/null +++ b/Items/Weapons/Melee/MonolithSword.cs @@ -0,0 +1,54 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class MonolithSword : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() + { + Item.damage = 30; + Item.width = 40; + Item.height = 46; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useTurn = true; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + float scale = 2.5f; + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } + public override void UseAnimation(Player player) + { + float Rot = (player.direction == -1 ? 5.5f : -5.5f) * Main.rand.NextFloat(0.99f, 1.1f); + Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, (Main.rand.NextBool() ? Color.DarkTurquoise : Color.Coral) * 0.7f, Rot, Main.rand.NextFloat(1.48f, 1.53f), new Vector2(1, 1), 6, true, false, true); + GeneralParticleHandler.SpawnParticle(Smear); + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(3)) + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()); + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(7). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/MonolithSword.png b/Items/Weapons/Melee/MonolithSword.png new file mode 100644 index 0000000000..7448de2787 Binary files /dev/null and b/Items/Weapons/Melee/MonolithSword.png differ diff --git a/Items/Weapons/Melee/PerfectDark.cs b/Items/Weapons/Melee/PerfectDark.cs index 25216877bd..666b744d04 100644 --- a/Items/Weapons/Melee/PerfectDark.cs +++ b/Items/Weapons/Melee/PerfectDark.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 50; Item.height = 50; - Item.damage = 26; + Item.damage = 29; Item.DamageType = DamageClass.Melee; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Swing; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 14.5f; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index f86e75a993..81ad513f31 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -48,10 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.useTime = Item.useAnimation = 13; Item.useTurn = true; - // TODO -- Prismatic Breaker should have its own damage type which is half Ranged, half Melee. - // Right now, it uses a hacky damage formula, see below. - // Its custom damage class should CountAs both melee AND ranged for the sake of effects. - Item.DamageType = DamageClass.Melee; + Item.DamageType = MeleeRangedHybridDamageClass.Instance; Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -65,12 +62,6 @@ namespace CalamityMod.Items.Weapons.Melee // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 8; - public override void ModifyWeaponDamage(Player player, ref StatModifier damage) - { - StatModifier halfMelee = damage.Scale(0.5f); - damage = halfMelee.CombineWith(player.GetTotalDamage().Scale(0.5f)); - } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow").Value); @@ -80,11 +71,11 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X * 0.5f, velocity.Y * 0.5f, type, (int)(damage * 1.1f), knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity * 0.5f, type, (int)(damage * 1.1f), knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/Respiteblock.cs b/Items/Weapons/Melee/Respiteblock.cs new file mode 100644 index 0000000000..b7fff3656f --- /dev/null +++ b/Items/Weapons/Melee/Respiteblock.cs @@ -0,0 +1,54 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class Respiteblock : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + + public override void SetDefaults() + { + Item.width = 108; + Item.height = 40; + Item.damage = 70; + Item.knockBack = 9f; + Item.useTime = 10; + Item.useAnimation = 20; + // In-game, the displayed axe power is 5x the value set here. + // This corrects for trees having 500% hardness internally. + // So that the axe power in the code looks like the axe power you see on screen, divide by 5. + Item.axe = 610 / 5; + // The axe power is entirely for show. It instantly one shots trees. + // ***Axe Power is an integer which increments in 5s. So any number not divisible by 5 is impossible without tooltip modifications. + // See CalamityGlobalItemTooltip for axe power tooltip edit + + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = false; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; + + Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.Calamity().donorItem = true; + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.ButchersChainsaw). + AddIngredient(ItemID.FragmentSolar, 4). // 413 is also a homestuck referene I think... + AddIngredient(13). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/Respiteblock.png b/Items/Weapons/Melee/Respiteblock.png new file mode 100644 index 0000000000..8e3bfa165c Binary files /dev/null and b/Items/Weapons/Melee/Respiteblock.png differ diff --git a/Items/Weapons/Melee/TheDarkMaster.cs b/Items/Weapons/Melee/TheDarkMaster.cs index 5054b7ed5a..e37cb358fb 100644 --- a/Items/Weapons/Melee/TheDarkMaster.cs +++ b/Items/Weapons/Melee/TheDarkMaster.cs @@ -61,6 +61,13 @@ namespace CalamityMod.Items.Weapons.Melee { SoundEngine.PlaySound(SoundID.Item71, player.Center); } + + // force clones to shoot regardless of health + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) + p.ai[1] = 1f; + } } else { @@ -72,7 +79,9 @@ namespace CalamityMod.Items.Weapons.Melee // summon the clones. position is determined by ai[0] for (int i = 0; i < 3; i++) { - Projectile.NewProjectile(Item.GetSource_FromThis(), player.Center.X, player.Center.Y, 0, 0, ModContent.ProjectileType(), damage, knockback, player.whoAmI, i); + // Stats are set to dynamically update, so damage, kb, crit have to be feeded + Projectile clone = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), player.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, Item.knockBack, player.whoAmI, i); + clone.OriginalCritChance = Item.crit; } } } diff --git a/Items/Weapons/Melee/VeinBurster.cs b/Items/Weapons/Melee/VeinBurster.cs index fe8d0adf61..206efd2059 100644 --- a/Items/Weapons/Melee/VeinBurster.cs +++ b/Items/Weapons/Melee/VeinBurster.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 52; Item.height = 50; - Item.damage = 42; + Item.damage = 47; Item.DamageType = DamageClass.Melee; Item.useAnimation = 41; Item.useStyle = ItemUseStyleID.Swing; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; + Item.shootSpeed = 16f; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Items/Weapons/Melee/WindBlade.cs b/Items/Weapons/Melee/WindBlade.cs index 8676601b68..1a580759cc 100644 --- a/Items/Weapons/Melee/WindBlade.cs +++ b/Items/Weapons/Melee/WindBlade.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 3f; + Item.shootSpeed = 5f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/AcidwoodBow.cs b/Items/Weapons/Ranged/AcidwoodBow.cs new file mode 100644 index 0000000000..f57096b36e --- /dev/null +++ b/Items/Weapons/Ranged/AcidwoodBow.cs @@ -0,0 +1,48 @@ +using Terraria.DataStructures; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class AcidwoodBow : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetDefaults() + { + Item.damage = 8; + Item.DamageType = DamageClass.Ranged; + Item.width = 20; + Item.height = 50; + Item.useTime = 27; + Item.useAnimation = 27; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; + Item.rare = ItemRarityID.White; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 6.6f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + return false; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/AcidwoodBow.png b/Items/Weapons/Ranged/AcidwoodBow.png new file mode 100644 index 0000000000..2fd33d341f Binary files /dev/null and b/Items/Weapons/Ranged/AcidwoodBow.png differ diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index 55fe5c3db9..142c00c383 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item61; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 22f; + Item.shootSpeed = 30f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/Arietes41.cs b/Items/Weapons/Ranged/Arietes41.cs index be78f5ede0..17bcbe0b77 100644 --- a/Items/Weapons/Ranged/Arietes41.cs +++ b/Items/Weapons/Ranged/Arietes41.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles; using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.UseSound = SoundID.Item41; + Item.UseSound = Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/GunShotSmall") with { Volume = 0.65f }; Item.autoReuse = true; Item.shootSpeed = 13f; Item.shoot = ProjectileID.PurificationPowder; diff --git a/Items/Weapons/Ranged/BladedgeRailbow.cs b/Items/Weapons/Ranged/BladedgeRailbow.cs index ebf3c143c0..c870e43a22 100644 --- a/Items/Weapons/Ranged/BladedgeRailbow.cs +++ b/Items/Weapons/Ranged/BladedgeRailbow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; #region GFB Arrow Array - public int[] arrowArr = + public static int[] arrowArr = { ProjectileID.WoodenArrowFriendly, ProjectileID.FireArrow, @@ -143,7 +143,7 @@ namespace CalamityMod.Items.Weapons.Ranged int projType; if (Main.zenithWorld) - projType = arrowArr[Main.rand.Next(0, arrowArr.Length)]; + projType = arrowArr[Main.rand.Next(arrowArr.Length)]; else projType = ProjectileID.Leaf; diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index ec7d6f4b76..c3162d97ca 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -22,14 +22,13 @@ namespace CalamityMod.Items.Weapons.Ranged public SlotId WeldSoundSlot; - public int BetweenShotsPause = 14; - public float Counter = 2; - public float MaxFirerateShots = 20; - public float WeldingShots = 50; - public bool StrongShotMode = false; - public int DragonsBreathSetUseTime = 5; - public int DragonsBreathSetUseAnimation = 9; - private Player Owner; + public static int BaseReuseDelay = 14; + public static int MinReuseDelay = 4; + public static int ShotsToMaxFirerate = 20; + public static int ShotsToFireBeams = ShotsToMaxFirerate + 20; + public static int ShotsToReset = ShotsToFireBeams + 50; + + public int Counter = 0; public override void SetDefaults() { @@ -37,9 +36,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 72; Item.damage = 478; Item.DamageType = DamageClass.Ranged; - Item.useTime = DragonsBreathSetUseTime; - Item.useAnimation = DragonsBreathSetUseAnimation; - Item.reuseDelay = BetweenShotsPause; + Item.useTime = 5; + Item.useAnimation = 9; + Item.reuseDelay = BaseReuseDelay; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; @@ -53,69 +52,58 @@ namespace CalamityMod.Items.Weapons.Ranged Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } - public override bool CanConsumeAmmo(Item ammo, Player player) => !StrongShotMode && Main.rand.NextFloat() > 0.80f; + public override bool CanConsumeAmmo(Item ammo, Player player) => Counter < ShotsToFireBeams && Main.rand.NextFloat() > 0.80f; - public override Vector2? HoldoutOffset() => new Vector2(27, 10); + public override Vector2? HoldoutOffset() => new Vector2(27, 6); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (!StrongShotMode) + Counter++; + if (Counter < ShotsToFireBeams) { - if (Counter == 2) + if (Counter % 2 == 1) SoundEngine.PlaySound(FireballSound, player.Center); + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(2.5f)); Projectile.NewProjectile(source, position, newVel * Main.rand.NextFloat(1.2f, 0.8f), type, damage, knockback, player.whoAmI); - Counter--; - if (MaxFirerateShots > 0 && BetweenShotsPause == 4) - MaxFirerateShots--; - if (Counter <= 0) - { - if (BetweenShotsPause > 4) - { - BetweenShotsPause -= 1; - Item.reuseDelay = BetweenShotsPause; - } - Counter = 2; - } - if (BetweenShotsPause <= 4 && MaxFirerateShots == 0) - { - BetweenShotsPause = 0; - Item.reuseDelay = BetweenShotsPause; - StrongShotMode = true; - DragonsBreathSetUseTime = 2; - DragonsBreathSetUseAnimation = 2; - SoundEngine.PlaySound(WeldingStart, player.Center); - } + Item.reuseDelay = (int)Utils.Remap(Counter, 0, ShotsToMaxFirerate, BaseReuseDelay, MinReuseDelay); } - else if (StrongShotMode) + else { + if (Counter == ShotsToFireBeams) + SoundEngine.PlaySound(WeldingStart, player.Center); + if (SoundEngine.TryGetActiveSound(WeldSoundSlot, out var WeldSound) && WeldSound.IsPlaying) WeldSound.Position = player.Center; - if ((player.Calamity().DragonsBreathAudioCooldown2 == 0) && (WeldingShots < 45)) + if (player.Calamity().DragonsBreathAudioCooldown2 == 0 && Counter >= ShotsToFireBeams + 5) { player.Calamity().DragonsBreathAudioCooldown2 = 30; WeldSoundSlot = SoundEngine.PlaySound(WeldingShoot, player.Center); } - Projectile.NewProjectile(source, position, velocity * 2f, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1); - WeldingShots--; - if (WeldingShots <= 0) + + Projectile.NewProjectile(source, position, velocity * 2f, type, damage, knockback, player.whoAmI, 1); + Item.reuseDelay = 0; + + if (Counter >= ShotsToReset) { - Counter = 2; - BetweenShotsPause = 14; - Item.reuseDelay = BetweenShotsPause; + Counter = 0; + Item.reuseDelay = BaseReuseDelay; SoundEngine.PlaySound(SpeedBlaster.Empty, player.Center); Projectile.NewProjectile(source, player.Center, new Vector2(5 * -player.direction, -5), ModContent.ProjectileType(), Main.zenithWorld ? 250000 : 1, knockback, player.whoAmI); - MaxFirerateShots = 20; - WeldingShots = 50; WeldSound?.Stop(); - StrongShotMode = false; - DragonsBreathSetUseTime = 5; - DragonsBreathSetUseAnimation = 9; } } return false; } + + public override void UpdateInventory(Player player) + { + // Reset speed back to initial once swapped to another item (including one of itself) + if (player.ActiveItem() != Item) + Counter = 0; + } + public override void UseStyle(Player player, Rectangle heldItemFrame) { player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); @@ -137,7 +125,7 @@ namespace CalamityMod.Items.Weapons.Ranged float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; if (animProgress < 0.4f) - rotation += StrongShotMode && WeldingShots == 1 ? -0.25f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction : 0; + rotation += Counter == 0 ? -0.25f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction : 0; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); } diff --git a/Items/Weapons/Ranged/DriftwoodBow.cs b/Items/Weapons/Ranged/DriftwoodBow.cs new file mode 100644 index 0000000000..f79dfada00 --- /dev/null +++ b/Items/Weapons/Ranged/DriftwoodBow.cs @@ -0,0 +1,68 @@ +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class DriftwoodBow : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetDefaults() + { + Item.damage = 10; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 42; + Item.useTime = 28; + Item.useAnimation = 28; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; + Item.rare = ItemRarityID.White; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 6.6f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + bool surface = player.Center.Y < Main.worldSurface * 16.0; + bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); + if (GetEffects) + { + for (int i = 0; i <= 18; i++) + { + Dust dust = Dust.NewDustPerfect(position + velocity * 3, 160, velocity.RotatedByRandom(MathHelper.ToRadians(19f)) * Main.rand.NextFloat(0.8f, 3.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + } + Item.useTime = 23; + Item.useAnimation = 23; + Item.knockBack = 1f; + Item.shootSpeed = 8.6f; + } + else + { + Item.useTime = 28; + Item.useAnimation = 28; + Item.knockBack = 0f; + Item.shootSpeed = 6.6f; + } + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + return false; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/DriftwoodBow.png b/Items/Weapons/Ranged/DriftwoodBow.png new file mode 100644 index 0000000000..e6ecd72f56 Binary files /dev/null and b/Items/Weapons/Ranged/DriftwoodBow.png differ diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index 75849b1bb2..9dacc5018b 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 58; Item.height = 22; - Item.damage = 65; + Item.damage = 70; Item.DamageType = DamageClass.Ranged; Item.useTime = 60; Item.useAnimation = 60; diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index 0a3822976f..31868841d0 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -13,8 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged public class Infinity : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - internal int rotation = 0; - internal bool limit = true; + public int SineCounter = 0; public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; @@ -24,12 +25,10 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 56; Item.height = 24; - Item.damage = 110; + Item.damage = 85; Item.DamageType = DamageClass.Ranged; - Item.useTime = 2; - Item.useAnimation = 12; - Item.reuseDelay = 12; - Item.useLimitPerAnimation = 9; + Item.useTime = 1; + Item.useAnimation = 4; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; @@ -38,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item31; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = 12f; + Item.shootSpeed = 6f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } @@ -55,63 +54,30 @@ 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) { - if (player.altFunctionUse == 2) + int shotType = (player.altFunctionUse == 2 ? type : ModContent.ProjectileType()); + position = position + (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.UnitX) * 65; + float sine = (float)Math.Sin(SineCounter * 0.175f / MathHelper.Pi) * 3.5f; + SineCounter++; + if (SineCounter % 4 == 0) { - //If you right click, shoots a helix of normal bullets - Vector2 helixVel1 = velocity.RotatedBy(MathHelper.ToRadians(rotation)); - Vector2 helixVel2 = velocity.RotatedBy(MathHelper.ToRadians(-rotation)); - int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, type, damage, knockback, player.whoAmI, 0f, 0f); - Main.projectile[shot1].timeLeft = 180; - int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, type, damage, knockback, player.whoAmI, 0f, 0f); - Main.projectile[shot2].timeLeft = 180; - //Code to constantly make the shooting go side to side to make the helix - if (limit) - { - rotation += 2; - } - else - { - rotation -= 2; - } - if (rotation >= 11) - { - limit = false; - } - else if (rotation <= -11) - { - limit = true; - } - return false; + Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine)); + Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine)); + int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 1f); + int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 1f); } - else + else if (player.altFunctionUse != 2) { - //If left click, do the same as above but spawn Charged Blasts instead - Vector2 helixVel1 = velocity.RotatedBy(MathHelper.ToRadians(rotation)); - Vector2 helixVel2 = velocity.RotatedBy(MathHelper.ToRadians(-rotation)); - int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - Main.projectile[shot1].timeLeft = 180; - int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - Main.projectile[shot2].timeLeft = 180; - if (limit) - { - rotation += 2; - } - else - { - rotation -= 2; - } - if (rotation >= 11) - { - limit = false; - } - else if (rotation <= -11) - { - limit = true; - } - return false; + Particle spark2 = new LineParticle(position + Main.rand.NextVector2Circular(6, 6), (velocity * 4).RotatedByRandom(0.2f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(1.5f, 2f), new Color(229, 49, 39)); + GeneralParticleHandler.SpawnParticle(spark2); } + return false; + } + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) > 80 && SineCounter % 4 == 0) + return true; + return false; } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/MidasPrime.cs b/Items/Weapons/Ranged/MidasPrime.cs index 0a15438517..80ec7fb0ed 100644 --- a/Items/Weapons/Ranged/MidasPrime.cs +++ b/Items/Weapons/Ranged/MidasPrime.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -10,9 +9,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class MidasPrime : ModItem, ILocalizedModType + public class MidasPrime : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + // The Hold SHIFT tooltip is an easter egg and is not indicated to the player in any way. + public bool ShowExtensionIndicator => false; + + // Easter egg has a special tooltip key and color. + public string TooltipExtensionKey => "UltrakillEasterEgg"; + public Color? TooltipExtensionColor => Color.Red; + internal static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/CrackshotColtShot") { Volume = 0.5f, PitchVariance = 0.1f }; // Internal storage used to keep track between UseItem and Shoot hooks whether a gold coin was queued up @@ -138,14 +145,6 @@ namespace CalamityMod.Items.Weapons.Ranged return base.Shoot(player, source, position, velocity, type, damage, knockback); } - #region Hidden ULTRAKILL Reference Tooltip - public override void ModifyTooltips(List tooltips) - { - TooltipLine ultrakillIntro = new TooltipLine(Mod, "CalamityMod:UltrakillIntroReference", this.GetLocalizedValue("UltrakillEasterEgg")) { OverrideColor = Color.Red }; - CalamityUtils.HoldShiftTooltip(tooltips, new TooltipLine[] { ultrakillIntro }); - } - #endregion - // Make the gun have visible recoil when fired for extra cool factor. #region Firing Animation public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Weapons/Ranged/MonolithBow.cs b/Items/Weapons/Ranged/MonolithBow.cs new file mode 100644 index 0000000000..e467e12c49 --- /dev/null +++ b/Items/Weapons/Ranged/MonolithBow.cs @@ -0,0 +1,55 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class MonolithBow : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetDefaults() + { + Item.damage = 19; + Item.DamageType = DamageClass.Ranged; + Item.width = 24; + Item.height = 54; + Item.useTime = 5; + Item.useAnimation = 20; + Item.reuseDelay = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 9f; + Item.useAmmo = AmmoID.Arrow; + Item.consumeAmmoOnFirstShotOnly = true; + Item.Calamity().canFirePointBlankShots = true; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(position + velocity * 3, Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType(), velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + } + Projectile.NewProjectile(source, position + velocity * 2, velocity.RotatedByRandom(0.165f), type, damage, knockback, player.whoAmI); + return false; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/MonolithBow.png b/Items/Weapons/Ranged/MonolithBow.png new file mode 100644 index 0000000000..46a995c5bc Binary files /dev/null and b/Items/Weapons/Ranged/MonolithBow.png differ diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index 458fc149e1..dd50793b44 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -8,7 +8,9 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Rarities; +using Terraria.Audio; using CalamityMod.Items.Materials; +using Steamworks; namespace CalamityMod.Items.Weapons.Ranged { @@ -32,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 3f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item41; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/GunShotSmall") with { Volume = 0.65f }; Item.autoReuse = true; Item.shootSpeed = 14f; Item.shoot = ProjectileID.PurificationPowder; diff --git a/Items/Weapons/Ranged/Shadethrower.cs b/Items/Weapons/Ranged/Shadethrower.cs index ddb3786745..a3e0f85b9d 100644 --- a/Items/Weapons/Ranged/Shadethrower.cs +++ b/Items/Weapons/Ranged/Shadethrower.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 76; Item.height = 30; - Item.damage = 23; + Item.damage = 22; Item.DamageType = DamageClass.Ranged; Item.useTime = 10; Item.useAnimation = 40; diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index 6665770842..4996c2f66a 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Items.Weapons.Ranged { @@ -20,11 +21,11 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 56; Item.height = 24; - Item.damage = 31; + Item.damage = 45; Item.DamageType = DamageClass.Ranged; Item.useTime = 4; - Item.useAnimation = 24; - Item.reuseDelay = 20; + Item.useAnimation = 32; + Item.reuseDelay = 35; Item.useLimitPerAnimation = 8; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item31; Item.autoReuse = true; Item.shoot = ProjectileID.Bullet; - Item.shootSpeed = 9f; + Item.shootSpeed = 5f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } @@ -45,33 +46,21 @@ 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) { - int bulletAmt = 4; - if (player.altFunctionUse == 2) + int shotType = (player.altFunctionUse == 2 ? type : ModContent.ProjectileType()); + int bulletAmt = 3; + Vector2 newPosition = position + velocity.SafeNormalize(Vector2.UnitY) * 50f; + for (int index = 0; index < bulletAmt; index++) { - velocity *= 2f; - Vector2 newPosition = position + velocity.SafeNormalize(Vector2.UnitY) * 50f; - Vector2 cachedVelocity = velocity; - for (int index = 0; index < bulletAmt; index++) - { - velocity += new Vector2(Main.rand.Next(-30, 31) * 0.05f, Main.rand.Next(-30, 31) * 0.05f); - int shot = Projectile.NewProjectile(source, newPosition, velocity, type, damage, knockback, player.whoAmI); - Main.projectile[shot].timeLeft = 180; - velocity = cachedVelocity; - } - } - else - { - Vector2 newPosition = position + velocity.SafeNormalize(Vector2.UnitY) * 50f; - Vector2 cachedVelocity = velocity; - for (int index = 0; index < bulletAmt; index++) - { - velocity += new Vector2(Main.rand.Next(-30, 31) * 0.05f, Main.rand.Next(-30, 31) * 0.05f); - Projectile.NewProjectile(source, newPosition, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - velocity = cachedVelocity; - } + Projectile.NewProjectile(source, newPosition, (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedByRandom(0.2f), shotType, damage, knockback, player.whoAmI); } return false; } + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) < 60) + return false; + return true; + } public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index efb03041fc..e304c42a43 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -1,5 +1,7 @@ using System; using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -13,16 +15,19 @@ namespace CalamityMod.Items.Weapons.Ranged public class Svantechnical : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public int SineCounter = 0; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } public override void SetDefaults() { Item.width = 60; Item.height = 26; - Item.damage = 150; + Item.damage = 200; Item.DamageType = DamageClass.Ranged; - Item.useTime = 2; - Item.useAnimation = 24; - Item.reuseDelay = 10; - Item.useLimitPerAnimation = 12; + Item.useTime = 1; + Item.useAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; @@ -33,70 +38,53 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item31; Item.autoReuse = true; - Item.shootSpeed = 12f; + Item.shootSpeed = 6f; Item.shoot = ProjectileID.PurificationPowder; Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - - public override void HoldItem(Player player) => player.scope = true; - - public override bool CanConsumeAmmo(Item ammo, Player player) + public override bool AltFunctionUse(Player player) { - if (Main.rand.Next(0, 100) < 70) - return false; return true; } + public override void HoldItem(Player player) => player.scope = false; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int i = Main.myPlayer; - float sSpeed = Item.shootSpeed; - player.itemTime = Item.useTime; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) + int shotType = (player.altFunctionUse == 2 ? type : ModContent.ProjectileType()); + position = position + (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.UnitX) * 65; + float sine = (float)Math.Sin(SineCounter * 0.175f / MathHelper.Pi) * 4f; + float sine2 = (float)Math.Sin(SineCounter * 0.275f / MathHelper.Pi) * 2f; + SineCounter++; + if (SineCounter % 4 == 0) { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; + Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine)); + Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine)); + Vector2 helixVel3 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine2)); + int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 2f); + int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 4f); + int shot3 = Projectile.NewProjectile(source, position.X, position.Y, helixVel3.X, helixVel3.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 3f); } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) + else if (player.altFunctionUse != 2) { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - } - else - { - mouseDistance = sSpeed / mouseDistance; - } - float randXOffset = mouseXDist; - float randYOffset = mouseYDist; - randXOffset += (float)Main.rand.Next(-1, 2) * 0.5f; - randYOffset += (float)Main.rand.Next(-1, 2) * 0.5f; - if (Collision.CanHitLine(player.Center, 0, 0, realPlayerPos + new Vector2(randXOffset, randYOffset) * 2f, 0, 0)) - { - realPlayerPos += new Vector2(randXOffset, randYOffset); - } - Projectile.NewProjectile(source, position.X, position.Y - player.gravDir * 4f, randXOffset, randYOffset, type, damage, knockback, i, 0f, (float)Main.rand.Next(12) / 6f); - int bulletAmt = Main.rand.Next(2, 4); - for (int index = 0; index < bulletAmt; ++index) - { - float SpeedX = velocity.X + (float)Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-60, 61) * 0.05f; - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Particle spark2 = new LineParticle(position + Main.rand.NextVector2Circular(6, 6), (velocity * 4).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(1.5f, 2f), Main.rand.NextBool() ? Color.MediumOrchid : Color.DarkViolet); + GeneralParticleHandler.SpawnParticle(spark2); } return false; } + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) > 90 && SineCounter % 4 == 0) + return true; + return false; + } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.SoulofMight, 10). - AddIngredient(ItemID.SoulofSight, 10). - AddIngredient(ItemID.SoulofFright, 10). + AddIngredient(). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index 545601781a..c90f06dd71 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -38,6 +38,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Orange; } + public override float StealthDamageMultiplier => 0.80f; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike diff --git a/Items/Weapons/Rogue/NanoblackReaper.cs b/Items/Weapons/Rogue/NanoblackReaper.cs index cc1a2987ba..a6a56bbc4a 100644 --- a/Items/Weapons/Rogue/NanoblackReaper.cs +++ b/Items/Weapons/Rogue/NanoblackReaper.cs @@ -12,8 +12,11 @@ namespace CalamityMod.Items.Weapons.Rogue { // Deny me no longer! [LegacyName("NanoblackReaperMelee", "NanoblackReaperRogue")] - public class NanoblackReaper : RogueWeapon + public class NanoblackReaper : RogueWeapon, IHoldShiftTooltipItem { + public bool ShowExtensionIndicator => false; + public Color? TooltipExtensionColor => new Color(31, 223, 128); // #1FDF80 + public static float Knockback = 9f; public static float Speed = 16f; diff --git a/Items/Weapons/Rogue/Turbulance.cs b/Items/Weapons/Rogue/Turbulance.cs index 00536460cd..ce7c035e66 100644 --- a/Items/Weapons/Rogue/Turbulance.cs +++ b/Items/Weapons/Rogue/Turbulance.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 14; Item.height = 14; - Item.damage = 18; + Item.damage = 28; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 18; diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index 2f1cacf427..535ad630a2 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { float speed = Item.shootSpeed; - player.itemTime = Item.useTime; Vector2 spawnPos = player.RotatedRelativePoint(player.MountedCenter, true); float xPos = (float)Main.mouseX + Main.screenPosition.X - spawnPos.X; float yPos = (float)Main.mouseY + Main.screenPosition.Y - spawnPos.Y; diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index 3a40da3bcc..ad9e9a42a6 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 58; Item.height = 58; - Item.damage = 9; + Item.damage = 14; Item.mana = 10; Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index de42c89bb1..0cface095a 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - player.itemTime = Item.useTime; CalamityUtils.KillShootProjectileMany(player, new int[] { type, diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index a0ed0e586b..1373817513 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 42; Item.height = 42; - Item.damage = 15; + Item.damage = 20; Item.DamageType = DamageClass.Summon; Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 377c934395..63625ec5e3 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); vector2.X = Main.mouseX + Main.screenPosition.X; vector2.Y = Main.mouseY + Main.screenPosition.Y; diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index e5befad427..6566d75dab 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - player.itemTime = Item.useTime; Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); float directionX = Main.mouseX + Main.screenPosition.X - playerPos.X; float directionY = Main.mouseY + Main.screenPosition.Y - playerPos.Y; diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index d91f467d4c..67a1b45685 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Items.Weapons.Summon { int i = Main.myPlayer; float projSpeed = Item.shootSpeed; - player.itemTime = Item.useTime; Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index 8a8ccb1a7c..80bf331521 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -25,9 +25,9 @@ AcidEel: Though they are predators themselves, acid eels lay near the bottom of BabyFlakCrab: Adolescent flak crabs make no attempt to fight off predators, and simply flee from any threats. Their species only learns to pelt their targets from afar later in life, leaving the adolescents defenseless and dependent on their parents. Bloodworm: Bloodworms are an exceedingly rare creature to stumble upon, as they burrow at the first sign of danger. It takes both exceedingly great patience, wisdom, and agility to catch one, leaving the worms ever having but a single natural predator. CragmawMire: A mostly immobile creature that dwells in the depths of the radioactive wasteland, it boasts an exoskeleton harder than titanium to defend its core. To compensate for its lack of movement, it has formed a symbiotic relationship with a worm that reels in prey in exchange for protection. -FlakCrab: Needing to hide themselves from the roaming creatures, flak crabs disguise themselves as the sulfurous gas vents scattered across the Sulphurous Sea. As they reproduce quickly, stumbling upon these and their offspring is a rather common occurrence. +FlakCrab: Needing to hide themselves from the roaming creatures, flak crabs disguise themselves as the sulphurous gas vents scattered across the Sulphurous Sea. As they reproduce quickly, stumbling upon these and their offspring is a rather common occurrence. GammaSlime: A slime overloaded with radiation from Draedon's long-since abandoned experiments with nuclear energy. Though methods of generating power involving nuclear energy surpassed all others that came before in terms of raw efficiency, not even these advancements were enough to satisfy the enigmatic engineer. -IrradiatedSlime: Though slime is known to fall from the sky on occasion, slime in the sky condenses far quicker here in the Sulphurous Sea, as its air is thick with sulfur and radiation. It isn't uncommon for full sized slimes to fall from the heavens during acid rain storms, never mind a fully-fledged slime rain. +IrradiatedSlime: Though slime is known to fall from the sky on occasion, slime in the sky condenses far quicker here in the Sulphurous Sea, as its air is thick with sulphur and radiation. It isn't uncommon for full sized slimes to fall from the heavens during acid rain storms, never mind a fully-fledged slime rain. Mauler: Powerful radiation has caused prehistoric genes to reawaken in this shark, granting it overwhelming speed and strength. The insatiable hunger of this beast draws it to the shoreline during acidic rainstorms for a feeding frenzy. NuclearTerror: The effects of our actions are never immediately obvious. Centuries of poison and constant fighting for its own life created such monstrosity, now dragged to the shore by the unrelenting torrents. Whatever it may have been before, all that is left now is its will to survive. NuclearToad: These toads expand like a pufferfish when creatures are near and burst when in danger. The otherwise terrifying inhabitants of the sea have learned well to avoid these critters due to their particularly explosive nature. @@ -111,7 +111,7 @@ Viruling: Unlike derplings, who use their proboscis to drain the blood of other //Sulphur Sea Enemies AnthozoanCrab: Though disguised as simple rocks, they are capable of hurling entire boulders at creatures with ease, and will retreat swiftly if approached. Elsewhere, a creature such as this would thrive due to its might; yet in such a hostile environment as this, this much is required merely to survive. AquaticUrchin: Closely related to sea urchins, aquatic urchins have been forced to adapt to the acidic water and radioactive waste. Their venomous spikes would normally deter predators, but in the environment it lives in, a painful meal is still a meal. Nothing in this sea can afford to be a picky eater. -BelchingCoral: Although all coral is alive to some extent, this species possesses above average intelligence. They are capable of fending off creatures attempting to consume them by releasing pressurized bursts of sulfuric gas when approached. Occasionally, this process makes a noise resembling music. +BelchingCoral: Although all coral is alive to some extent, this species possesses above average intelligence. They are capable of fending off creatures attempting to consume them by releasing pressurized bursts of sulphuric gas when approached. Occasionally, this process makes a noise resembling music. Gnasher: Though gnashers are relatively slow, these mutated snapping turtles boast an unnaturally strong shell. Attempting to kill and eat one would injure most creatures greatly due to its terrifying biting power and spiked shell easily capable of impaling flesh. Sulflounder: A relative to certain hadopelagic creatures living in the depths, the Sulflounders are a branch in their evolution with a fragile exterior. This allowed them not to sink to the bottom of the Abyss, though their flesh is barely enough to withstand the acidic water. Toxicatfish: Though these fish once threatened none other than their prey, the radiation from nuclear waste generated from Draedon's old experiments has rotted both their bodies and minds. Attacking anything that comes near, this once flourishing species is now on the verge of extinction. diff --git a/Localization/en-US/Mods.CalamityMod.Biomes.hjson b/Localization/en-US/Mods.CalamityMod.Biomes.hjson index f6834ea4a1..aa99aff816 100644 --- a/Localization/en-US/Mods.CalamityMod.Biomes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Biomes.hjson @@ -76,7 +76,32 @@ AstralUnderground: { TownNPCDialogueName: Underground Astral Infection } +SunkenSeaBurrowsBiome: { + DisplayName: Sunken Sea Burrows Biome + TownNPCDialogueName: the Sunken Sea Burrows Biome +} + +SunkenSeaPolypBiome: { + DisplayName: Sunken Sea Polyp Biome + TownNPCDialogueName: the Sunken Sea Polyp Biome +} + +SunkenSeaReefsBiome: { + DisplayName: Sunken Sea Reefs Biome + TownNPCDialogueName: the Sunken Sea Reefs Biome +} + +SunkenSeaShoresBiome: { + DisplayName: Sunken Sea Shores Biome + TownNPCDialogueName: the Sunken Sea Shores Biome +} + AstralCaveDesert: { DisplayName: Astral Cave Desert TownNPCDialogueName: the Astral Cave Desert } + +FloralParadiseBiome: { + DisplayName: Floral Paradise + TownNPCDialogueName: the Floral Paradise +} diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 9bc3da8b53..584d66e432 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -364,8 +364,8 @@ Dreamfog: { } EidolonSnailBuff: { - DisplayName: Escargidolon Snail - Description: What a silly little prehistoric snail + DisplayName: Eidolon Snail + Description: What a silly little snail } ElectricTroublemaker: { @@ -470,17 +470,17 @@ CirrusBlueCandleBuff: { CirrusPinkCandleBuff: { DisplayName: Vigor - Description: Its brilliant light suffuses those nearby with hope + Description: The brilliant light suffuses you with hope } CirrusPurpleCandleBuff: { DisplayName: Resilience - Description: Neither rain nor wind can snuff its undying flame + Description: Neither rain nor wind can snuff your undying flame } CirrusYellowCandleBuff: { DisplayName: Spite - Description: Its hateful glow flickers with ire + Description: The hateful, flickering glow fuels your ire } CorruptionEffigyBuff: { diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index ac8eba1fec..ed1ed29342 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -8,6 +8,7 @@ CalamityConfig: { Revengeance: Revengeance Mode Changes UI: UI Changes BaseBoosts: Base Stat Boosts + MusicEvents: Music Events } AdrenalineMeterPosX: { @@ -130,6 +131,11 @@ CalamityConfig: { Tooltip: Adds an array of debuff icons above all bosses and minibosses. } + DevourerofGodsEulogy: { + Label: "[i:CalamityModMusic/DevourerofGodsEulogyMusicBox] Eulogy for the Ego" + Tooltip: Plays Calamity Mod OST - "Scourge of the Universe (Eulogy for the Ego)", after the Devourer of Gods has been defeated. + } + EarlyHardmodeProgressionRework: { Label: "[i:Pwnhammer] Early Hardmode Progression Rework" Tooltip: @@ -226,6 +232,21 @@ CalamityConfig: { ''' } + 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. + } + MeterPosLock: { Label: "[i:GemLockTopaz] Lock Meter Positions" Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson b/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson index 5b565b8e71..b261db6100 100644 --- a/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson +++ b/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson @@ -1,5 +1,6 @@ AverageDamageClass.DisplayName: average damage +MeleeRangedHybridDamageClass.DisplayName: melee/ranged damage RogueDamageClass.DisplayName: rogue damage +StealthDamageClass.DisplayName: stealth damage TrueMeleeDamageClass.DisplayName: true melee damage TrueMeleeNoSpeedDamageClass.DisplayName: true melee damage -StealthDamageClass.DisplayName: Stealth Damage Class diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 3404dbabe0..069adda0db 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -104,6 +104,7 @@ AlchemicalFlask: { ''' All attacks inflict the Plague and reduces damage taken from the Plague Projectiles spawn plague seekers on enemy hits + Releases plague bees when damaged and douses you in honey ''' } @@ -1260,16 +1261,6 @@ PlaguedFuelPack: { ''' } -PlagueHive: { - DisplayName: Plague Hive - Tooltip: - ''' - All attacks inflict the Plague and grants immunity to the Plague - Releases bees when damaged that inflict the Plague - Projectiles spawn plague seekers on enemy hits - ''' -} - ProfanedSoulArtifact: { DisplayName: Profaned Soul Artifact Tooltip: @@ -1616,9 +1607,8 @@ StatisBlessing: { DisplayName: Statis' Blessing Tooltip: ''' - Increased max minions by 2 and 10% increased summon damage + Increased max minions by 2 and 12% increased summon damage Increased minion knockback - Minions inflict holy flames on hit ''' } @@ -1627,9 +1617,9 @@ StatisCurse: { Tooltip: ''' Increases max minions by 3, does not stack with downgrades - 10% increased summon damage + 12% increased summon damage Increased minion knockback - Minions inflict holy flames and shadowflames on hit + Minions inflict shadowflames on hit Grants immunity to Shadowflame ''' } @@ -1721,7 +1711,7 @@ StatMeter: { // Other stats GenericStats: ''' - Defense: {0} | DR: {1}% | Life Regen: {2} + Defense: {0} | DR: {1}% | Life Regen: {2} HP/s Move Speed: {3}% | Jump Boost: {4}% ''' FlightTime: " | Wing Flight Time: {0} seconds" @@ -1883,8 +1873,9 @@ ToxicHeart: { DisplayName: Toxic Heart Tooltip: ''' - Summons a plague aura around you that damages nearby enemies - Makes you immune to the Plague debuff + Causes your heart to beat with powerful plague pulses, inflicting all nearby enemies with the Plague + The rate of these pulses scales with how low your life regen is + Pulses that kill targets create additional pulses and heal you Multiplies all sickness-based debuff damage by 1.5 ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index f4e3ddf84b..a0c60646cb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -232,7 +232,7 @@ FearmongerGreathelm: { ''' 20% increased summon damage and +2 max minions Minions no longer deal less damage while wielding non-summoner weapons - Immunity to all forms of frost and flame + Immunity to all but the strongest forms of frost and flame Minion attacks grant +3.5 HP/s life regen and massively accelerate life regen 15% increased damage reduction during the Pumpkin and Frost Moons This extra damage reduction ignores the soft cap diff --git a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson index 90e1bb38a2..fad6ef1784 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson @@ -17,6 +17,7 @@ LoreAbyss: { Her great roots continue to thrash and tear at the impossibly dense stone, growing uncontrollably. She will soon remake it in her image. I can think of no worse fate for this accursed, hadal domain. ''' + Tooltip: "" } LoreAquaticScourge: { @@ -29,6 +30,7 @@ LoreAquaticScourge: { What a stark contrast to the rest of the ecosystem. Nearly every other creature in the Sulphur Sea is hostile. A shame that its last bastion of tranquility has fallen. ''' + Tooltip: "" } LoreArchmage: { @@ -42,6 +44,7 @@ LoreArchmage: { As my crusade evolved and my ambitions grew, he expressed vehement disapproval. Where justice was once seen, tyranny had blinded it. He departed along with the Witch not long after. ''' + Tooltip: "" } LoreAstralInfection: { @@ -57,6 +60,7 @@ LoreAstralInfection: { Those whose minds can grasp the true form of the universe are largely immune. They cannot be starstruck by a supposed higher truth, let alone one preached by a pustule. ''' + Tooltip: "" } LoreAstrumAureus: { @@ -70,6 +74,7 @@ LoreAstrumAureus: { However… even the finest silicon is not beyond its reach. Draedon prefers his creations to serve after all. With this experiment concluded, he will certainly be examining you next. Watch yourself. ''' + Tooltip: "" } LoreAstrumDeus: { @@ -83,6 +88,7 @@ LoreAstrumDeus: { Thankfully, such a grandiose being that walks amongst the stars is likely not truly dead. While the land has paid a terrible price, the price of a wrongful conviction is higher still. ''' + Tooltip: "" } LoreAwakening: { @@ -95,6 +101,7 @@ LoreAwakening: { Look upon my works, as they are… Ruined. None would dare seek me out; tread my path. Naught awaits them in this cruel world. ''' + Tooltip: "" } LoreAzafure: { @@ -107,6 +114,7 @@ LoreAzafure: { It pains me to say this even in hindsight, but their own artisanry paved the downfall of the entire city. For the Witch and I… the air here will forever be laden with regret. There is nothing to be done. ''' + Tooltip: "" } LoreBloodMoon: { @@ -119,6 +127,7 @@ LoreBloodMoon: { Those with fire in their veins may strike out on their own, to revel in the slaughter. That is how I remember the sleepless nights from my younger days… Knee deep in corpses. ''' + Tooltip: "" } LoreBrainofCthulhu: { @@ -130,6 +139,7 @@ LoreBrainofCthulhu: { My decimation of the falsely divine left many old horrors unconstrained, with new ones birthed every year. Now, they are your stepping stones. ''' + Tooltip: "" } LoreBrimstoneElemental: { @@ -145,6 +155,7 @@ LoreBrimstoneElemental: { They fought to a standstill, fire against fire. Neither were victorious, with the city razed by flames despite her intentions. ''' + Tooltip: "" } LoreCalamitas: { @@ -163,6 +174,7 @@ LoreCalamitas: { The weight of her deeds haunts her to this day. She despises me, and I cannot blame her. Please, if you would... show her respect where I did not. ''' + Tooltip: "" } LoreCalamitasClone: { @@ -175,6 +187,7 @@ LoreCalamitasClone: { Surely Calamitas would want nothing to do with such a project. I know not how it wields her brimstone magic. Perhaps some day one of us may find answers. ''' + Tooltip: "" } LoreCeaselessVoid: { @@ -190,6 +203,7 @@ LoreCeaselessVoid: { Its eerie persistence gnawed at my mind. It did not just threaten me. It threatened everyone. Everything. Even when faced with blatant lies and harrowing danger, I simply walked away and did not return…. ''' + Tooltip: "" } LoreCorruption: { @@ -200,6 +214,7 @@ LoreCorruption: { Having slain my first Gods, I turned a blind eye as corrupt essence gushed from their rent forms and burrowed into the bowels of Terraria. The mere existence of this putrid place proves that the Gods of old were beyond redemption. ''' + Tooltip: "" } LoreCrabulon: { @@ -210,6 +225,7 @@ LoreCrabulon: { These mushrooms possess a disturbing amount of tenacity. Nothing that lays down to die in their domain is left to rest. It is this sort of ghastly, forceful exertion of control over the unwilling that led me down my path. ''' + Tooltip: "" } LoreCrimson: { @@ -220,6 +236,7 @@ LoreCrimson: { The essence of a God does not simply vanish when the body dies. It must be properly disposed of or destroyed entirely. Essence of a pious God could never fester into a mire as dreadful as this. ''' + Tooltip: "" } LoreCynosure: { @@ -236,6 +253,7 @@ LoreCynosure: { When you are prepared: seek the grave of the Light, at the summit of the Dragon Aerie. I await your challenge. ''' + Tooltip: "" } LoreDesertScourge: { @@ -246,6 +264,7 @@ LoreDesertScourge: { After Ilmeris was incinerated, it became familiar with the hunt. To survive, it quickly learned to seek greater prey. Unfortunately for the scourge, it seems that it too was prey in the end. After all, there is always a bigger fish in the sea. ''' + Tooltip: "" } LoreDestroyer: { @@ -259,6 +278,7 @@ LoreDestroyer: { Draedon understood well and granted them these massive forms. Bristling with weaponry and interlocked armor forged of blessed metal. While in truth it was repurposed mining equipment, their sheer presence on the battlefield was immense. ''' + Tooltip: "" } LoreDevourerofGods: { @@ -275,6 +295,7 @@ LoreDevourerofGods: { The Devourer's alien capabilities and domineering tactics hint that his allegiance lay elsewhere. Is he but one soldier, a mere pawn of a malevolence far beyond…? ''' + Tooltip: "" } LoreDragonfolly: { @@ -289,6 +310,7 @@ LoreDragonfolly: { It is known that Fishrons, Follies, and the Abyssal Wyrms survived the purging hunts of the Deific Era. Notably, they now are all reclusive or exceedingly violent. It is tragic how they evolved to be that way. ''' + Tooltip: "" } LoreDukeFishron: { @@ -301,6 +323,7 @@ LoreDukeFishron: { While there are many such tales of creatures hailing from draconic descent, this case is factual. Genetic heritage or not: the Fishrons lack Dragonblood and Auric souls. I would well know. ''' + Tooltip: "" } LoreEaterofWorlds: { @@ -312,6 +335,7 @@ LoreEaterofWorlds: { One will not need to search long for examples. We are all surrounded by rampant superstition and assumption. I myself have been subjected to a litany of baseless boasts and accusations in my time. ''' + Tooltip: "" } LoreEmpressofLight: { @@ -325,6 +349,7 @@ LoreEmpressofLight: { It made her sickeningly obedient. Dependent, but willingly so as they enabled her to slake her base thirst. I had deigned to slay her myself for her treachery, but she was a notoriously evasive mark. ''' + Tooltip: "" } LoreExoMechs: { @@ -341,6 +366,7 @@ LoreExoMechs: { Were he to lose his temper: if he even has one, all of life's hopes would be smothered in an instant, silenced by a torrent of silicon. Though, perhaps you may leverage his unimaginable craft to your advantage, and seek insight from him. ''' + Tooltip: "" } LoreEyeofCthulhu: { @@ -351,6 +377,7 @@ LoreEyeofCthulhu: { Now they run rampant, spawning from vile influences left unchecked. They blend well with the horrific injustice of their forebears. Slaying one merely paves the way for a dozen more. Surely this does not concern you, either. ''' + Tooltip: "" } LoreGolem: { @@ -364,6 +391,7 @@ LoreGolem: { While I believe this insignificant construct deserves no mention, the Lihzahrds revere it unflinchingly. I see no need to intervene in affairs beneath me and my people. ''' + Tooltip: "" } LoreHiveMind: { @@ -375,6 +403,7 @@ LoreHiveMind: { Fortunately for us, the futility of this effort is unmatched. The biomass obeys; even though nothing is accomplished. Divine power is known to be rooted in faith. Gods are forged of their own strength, and the mindless spread of corruption is its own foul reverence. ''' + Tooltip: "" } LoreKingSlime: { @@ -385,6 +414,7 @@ LoreKingSlime: { There is little need to worry about this. Naturally, slimes are nearly mindless and amass only by chance. Though it appears they are capable of absorbing knowledge, if only in rudimentary form. ''' + Tooltip: "" } LoreLeviathanAnahita: { @@ -398,6 +428,7 @@ LoreLeviathanAnahita: { Regardless of what you believe, they are inseparable even in death. Such stalwart loyalty! It reminds me of Yharon. ''' + Tooltip: "" } LoreMechs: { @@ -411,6 +442,7 @@ LoreMechs: { I dismissed them from duty, yet they linger here still. Scouring the land for evidence of the divine. Unfortunately for you that puts you in their crosshairs. Give them a battle worth dying in. ''' + Tooltip: "" } LoreOldDuke: { @@ -424,6 +456,7 @@ LoreOldDuke: { This particular Duke's guile is self-evident: It evaded centuries of hunting, and until now had survived a most thorough poisoning. Above almost all others, this creature was a living fable. One must wonder what goes through the mind of a fading legend…. ''' + Tooltip: "" } LorePerforators: { @@ -435,6 +468,7 @@ LorePerforators: { The mire reeks of centuries of vile manipulation and callous domination of the hapless. Judgment has long passed and only extinction is left waiting. ''' + Tooltip: "" } LorePlaguebringerGoliath: { @@ -449,6 +483,7 @@ LorePlaguebringerGoliath: { In my later days I was far from virtuous. But I would never shackle a creature to fight in my name. That would make me no better than the divine scoundrels I pursued. ''' + Tooltip: "" } LorePlantera: { @@ -463,6 +498,7 @@ LorePlantera: { Now that you have slain it, more disorderly spiritual energies are flooding the lands. The village's ignorance was shameful in its own right, but this is worse still. ''' + Tooltip: "" } LorePolterghast: { @@ -478,6 +514,7 @@ LorePolterghast: { The dragon cult was furious, their leader demanding I put the haunt down myself. I did not answer. I had long since become deaf to the world outside my crusade. Do not fall as I have. ''' + Tooltip: "" } LorePrelude: { @@ -493,6 +530,7 @@ LorePrelude: { Zeratros himself was gravely injured. It seemed his power, along with his life, would be lost forever. One mortal, sworn to the service of the Dragons, rose in determination to save their virtuous King. ''' + Tooltip: "" } LoreProfanedGuardians: { @@ -505,6 +543,7 @@ LoreProfanedGuardians: { After all, it was you that finished off the star-spawned horror that catalyzed the downfall of the Dragons. Draw her out from hiding. Have no mercy, for the Profaned Goddess shows none herself. ''' + Tooltip: "" } LoreProvidence: { @@ -519,6 +558,7 @@ LoreProvidence: { Those devoted to her were weak-willed, yet she reigned as one of the mightiest Gods. Perhaps it was their easily-swayed nature that let her draw so much power from them…. ''' + Tooltip: "" } LoreQueenBee: { @@ -530,6 +570,7 @@ LoreQueenBee: { Though its death is understandable given the circumstances, I do feel pity for these majestic beings. Fate was cruel to many of their kind. ''' + Tooltip: "" } LoreQueenSlime: { @@ -541,6 +582,7 @@ LoreQueenSlime: { Or perhaps it was overcome by desperation for survival. A glorious hunt, a fine foe. Now you know that you must chase them to the ends of Terraria. ''' + Tooltip: "" } LoreRavager: { @@ -555,6 +597,7 @@ LoreRavager: { Now caked in fresh blood, it hungered for more, setting off on an aimless rampage. I suppose its brutality serves as a reminder to be careful what you believe. ''' + Tooltip: "" } LoreRequiem: { @@ -571,6 +614,7 @@ LoreRequiem: { Wherever your journey may lead, whether you are with me or against…. May fortune favor you. For nothing else will. ''' + Tooltip: "" } LoreSignus: { @@ -585,6 +629,7 @@ LoreSignus: { The serpent ensnared both my assailants in a dimensional vortex. Assuring me they were as good as dead. Yet, Statis must have struck a bargain with Signus. He escaped his banishment unscathed. ''' + Tooltip: "" } LoreSkeletron: { @@ -596,6 +641,7 @@ LoreSkeletron: { The very walls of that place are cursed further still. The magic has long since faded as the soldiers rotted within. Do not expect to learn much from those tarnished tomes. They were penned with misguided zeal. ''' + Tooltip: "" } LoreSkeletronPrime: { @@ -608,6 +654,7 @@ LoreSkeletronPrime: { Leveling places of worship and torching those falsely devout, their expertise lay in unmaking faith with flame. Draedon understood this well. For them he crafted a visage so grim, it evoked oblivion itself. ''' + Tooltip: "" } LoreSlimeGod: { @@ -620,6 +667,7 @@ LoreSlimeGod: { Alas, the Slime god is wise enough to be cowardly. Fleeing battles it cannot win when its servants are vanquished. Perhaps fortune will aid you if you catch it unaware. ''' + Tooltip: "" } LoreStormWeaver: { @@ -634,6 +682,7 @@ LoreStormWeaver: { In his mind, the lesser serpent's similar powers could lead it to be too threatening for him to let live. Little does he know, he has forever stood in a similar position. He thinks himself invincible after all. ''' + Tooltip: "" } LoreSulphurSea: { @@ -646,6 +695,7 @@ LoreSulphurSea: { Long considered uninhabitable, its further deterioration led Draedon to designate it as a dumping ground. Years of careless waste disposal has now left the coast's transformation irreversible. ''' + Tooltip: "" } LoreTwins: { @@ -659,6 +709,7 @@ LoreTwins: { His assistance was infallible, his calculus cold and cruel. Not even the most evasive target stood a chance. ''' + Tooltip: "" } LoreUnderworld: { @@ -671,6 +722,7 @@ LoreUnderworld: { Yet despite being surrounded by magma, Azafure simply burned when their wishes were not met. Such is the unfortunate price of war, though I have no regrets fighting for my people. ''' + Tooltip: "" } LoreWallofFlesh: { @@ -684,6 +736,7 @@ LoreWallofFlesh: { My methods have since evolved. I need not contain such essences, when they can be devoured. May you channel my valor in combating the resulting outpour of energies. ''' + Tooltip: "" } LoreYharon: { @@ -705,4 +758,5 @@ LoreYharon: { Now, that hope is long withered. I am but a husk of the hero I once was, and this is the ultimate proof. Yharon may yet return, as he does, but he… he has bade me farewell. ''' + Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index ddb61fbc36..fc6fc8ce4d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -729,7 +729,9 @@ ResilientCandle: { DisplayName: Resilient Candle Tooltip: ''' - When placed, nearby players' defense blocks 10% more damage + when placed to make defense block 10% more damage + (60% in Classic, 85% in Expert, and 110% in Master) + This cannot be stacked with other Cirrus Candle buffs 'Neither rain nor wind can snuff its undying flame' ''' } @@ -748,8 +750,9 @@ SpitefulCandle: { DisplayName: Spiteful Candle Tooltip: ''' - When placed, nearby enemies take 5% more damage. - This extra damage bypasses enemy damage reduction and defense + when placed to deal 1.07x damage to all enemies + The extra 0.07x damage bypasses enemy defense and damage reduction + This cannot be stacked with other Cirrus Candle buffs 'Its hateful glow flickers with ire' ''' } @@ -973,8 +976,9 @@ VigorousCandle: { DisplayName: Vigorous Candle Tooltip: ''' - When placed, nearby players regenerate 0.4% of their maximum health per second + when placed to regenerate 0.4% of your maximum health per second This regeneration is at full power even while moving and bypasses Revengeance Mode caps + This cannot be stacked with other Cirrus Candle buffs 'Its brilliant light suffuses those nearby with hope' ''' } @@ -983,7 +987,8 @@ WeightlessCandle: { DisplayName: Weightless Candle Tooltip: ''' - When placed, nearby players gain 5% increased movement speed, wing time and acceleration + when placed to gain 10% increased movement speed, wing time and acceleration + This cannot be stacked with other Cirrus Candle buffs 'The floating flame seems to uplift your very spirit' ''' } @@ -2980,11 +2985,51 @@ DraedonTalkMusicBox: { Tooltip: Plays a variant of 'Signal Received' by CDMusic } +Basalt: { + DisplayName: Basalt + Tooltip: "" +} + +Driftwood: { + DisplayName: Driftwood + Tooltip: "" +} + Navystone: { DisplayName: Navystone Tooltip: "" } +Shellstone: { + DisplayName: Shellstone + Tooltip: "" +} + +PolishedNavystoneBrick: { + DisplayName: Polished Navystone Brick + Tooltip: "" +} + +ShellstoneSlab: { + DisplayName: Shellstone Slab + Tooltip: "" +} + +BlackPearlPile: { + DisplayName: Black Pearl Pile + Tooltip: "" +} + +PinkPearlPile: { + DisplayName: Pink Pearl Pile + Tooltip: "" +} + +WhitePearlPile: { + DisplayName: White Pearl Pile + Tooltip: "" +} + NovaeSlag: { DisplayName: Novae Slag Tooltip: "" @@ -3410,6 +3455,16 @@ ScoriaBrickWall: { Tooltip: "" } +ShellstoneSlabWall: { + DisplayName: Shellstone Slab Wall + Tooltip: "" +} + +ShellstoneWall: { + DisplayName: Shellstone Wall + Tooltip: "" +} + SilvaWall: { DisplayName: Silva Wall Tooltip: "" @@ -3577,3 +3632,78 @@ WaterTurret: { Cannot attack while a boss is alive ''' } + +CyanCoral: { + DisplayName: Cyan Coral + Tooltip: "" +} + +MagentaCoral: { + DisplayName: Magenta Coral + Tooltip: "" +} + +OrangeCoral: { + DisplayName: Orange Coral + Tooltip: "" +} + +LimeCoral: { + DisplayName: Lime Coral + Tooltip: "" +} + +YellowCoral: { + DisplayName: Yellow Coral + Tooltip: "" +} + +Runestone: { + DisplayName: Runestone + Tooltip: "" +} + +RuneSand: { + DisplayName: Runesand + Tooltip: "" +} + +Limestone: { + DisplayName: Limestone + Tooltip: "" +} + +PolypSand: { + DisplayName: Polyp Sand + Tooltip: "" +} + +VolcanicSand: { + DisplayName: Volcanic Sand + Tooltip: "" +} + +DriftwoodWall: { + DisplayName: Driftwood Wall + Tooltip: "" +} + +AlgalSlateItem: { + DisplayName: Algal Slate + Tooltip: "" +} + +PeatItem: { + DisplayName: Peat + Tooltip: "" +} + +PeatMossItem: { + DisplayName: Peat Moss + Tooltip: "" +} + +ScintillatingBloom: { + DisplayName: Scintillating Bloom + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 94bfd6c74c..d90f4519fd 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -105,7 +105,7 @@ PhotosynthesisPotion: { Tooltip: ''' Grants +0.5 HP/s life regen and accelerates natural life regen while not moving - This natural life regen effect is five times as strong during daytime + This natural life regen effect is five times as strong during daytime Dropped hearts heal more HP ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index 7d1594a478..d6ff87ed24 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -210,3 +210,48 @@ WulfrumTreasurePinger: { This contraption seems incredibly shoddy. [c/FC4903:It'll break sooner than later for sure] ''' } + +AcidwoodPickaxe: { + DisplayName: Acidwood Pickaxe + Tooltip: "" +} + +DriftwoodPickaxe: { + DisplayName: Driftwood Pickaxe + Tooltip: Improved efficiency while you are wet +} + +MonolithPickaxe: { + DisplayName: Monolith Pickaxe + Tooltip: "" +} + +AcidwoodAxe: { + DisplayName: Acidwood Axe + Tooltip: "" +} + +DriftwoodAxe: { + DisplayName: Driftwood Axe + Tooltip: Improved efficiency while you are wet +} + +MonolithAxe: { + DisplayName: Monolith Axe + Tooltip: "" +} + +AcidwoodHammer: { + DisplayName: Acidwood Hammer + Tooltip: "" +} + +DriftwoodHammer: { + DisplayName: Driftwood Hammer + Tooltip: Improved efficiency while you are wet +} + +MonolithHammer: { + DisplayName: Monolith Hammer + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 7c20016cf2..9960bc50ca 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -792,6 +792,16 @@ Teslastaff: { ''' } +TheCauldron: { + DisplayName: The Cauldron + Tooltip: + ''' + Launches lava bombs which explode into more lava bombs + 80% reduced mana usage while submerged in lava or while in the underworld + 'Believe it or not, its original wielder was only a few centimeters tall!' + ''' +} + TheDanceofLight: { DisplayName: The Dance of Light Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 88b9e92839..0d11ae3872 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -970,6 +970,16 @@ RemsRevenge: { ''' } +Respiteblock: { + DisplayName: Respiteblock + Tooltip: + ''' + A glistening white chainsaw that spews green and purple blood all over + Hitting enemies with the blade will heal you and deal immense damage + [c/0e8401:'It's Ok To Be Dangerous'] + ''' +} + Riptide: { DisplayName: Riptide Tooltip: Sprays a spiral of aqua streams @@ -1425,3 +1435,18 @@ YinYo: { A very agile yoyo ''' } + +AcidwoodSword: { + DisplayName: Acidwood Sword + Tooltip: "" +} + +DriftwoodSword: { + DisplayName: Driftwood Sword + Tooltip: This sword is stronger while you are wet +} + +MonolithSword: { + DisplayName: Monolith Sword + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 548c6fcb2c..2d382e0806 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -646,7 +646,7 @@ Infinity: { DisplayName: Infinity Tooltip: ''' - Fires a barrage of energy bolts that split and bounce + Fires a twin stream of energy bolts that split Press to fire a barrage of normal bullets 'They say infinity is neverending, yet you hold it in your hands' ''' @@ -1260,8 +1260,9 @@ Svantechnical: { DisplayName: Svantechnical Tooltip: ''' - Fires several barrages of bullets - Press to zoom out + Fires a trinity of energy bolts that split into beams that track your cursor + Press to fire a barrage of normal bullets + 'The age old balance of trading damage for frames' ''' } @@ -1434,3 +1435,18 @@ WulfrumBlunderbuss: { [c/83B87E:In fact, it is quite common for a robot to be turned into ammo right after it stops functioning.'] ''' } + +AcidwoodBow: { + DisplayName: Acidwood Bow + Tooltip: "" +} + +DriftwoodBow: { + DisplayName: Driftwood Bow + Tooltip: This bow is stronger while you are wet +} + +MonolithBow: { + DisplayName: Monolith Bow + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 69ed27ce98..f3b984bfb6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -777,6 +777,7 @@ NanoblackReaper: { Stealth strikes cause the scythe to create a large amount of homing afterimages instead of energy blades 'She smothered them in Her hatred' ''' + HoldShiftTooltip: "'He who picks up the pen writes the script. She plans to never let go.'" } NastyCholla: { diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 9a650f9ea6..0066b7de9b 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -21,12 +21,6 @@ RecipeGroup: { // Status WikiStatus1: "[i:Book] [c/EE4939:Note: The Fandom wiki is no longer supported by Calamity.] [i:Book]" WikiStatus2: "[i:Book] [c/EE4939:Check out the Official Calamity Mod Wiki at ][c/3989FF:calamitymod.wiki.gg][c/EE4939:!] [i:Book]" -MusicModReminder: "[i:MusicBoxMartians] [c/71DFF5:Remember to also install the Calamity Music Mod to experience our soundtrack!] [i:MusicBoxMartians]" -GimmeSwagPlushieCampaign: - ''' - - [i:GreenPresent] [c/3BE022:NOW AVAILABLE! Supreme Calamitas Plushie!] [c/3989FF:calamitymod.com/plush] [i:GreenPresent] - ''' // Recipe Conditions Tier1ArsenalRecipeCondition: View an unencrypted schematic from the lab near the Sunken Sea Tier2ArsenalRecipeCondition: Decrypt a schematic from the lab in the large planetoid in the sky @@ -62,3 +56,5 @@ EtherealCoreText: You have already used an Ethereal Core. Your brain would escap PhantomHeartText: You have already used a Phantom Heart. The voices are telling you it's a bad idea to use it again. SulphurSwitchLeft: The Sulphurous Sea is now on the left side of the world. SulphurSwitchRight: The Sulphurous Sea is now on the right side of the world. +// Point Blank +PointBlank: Does extra damage to enemies shot at point-blank range diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 6510a1aba6..7c05554882 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -41,6 +41,8 @@ BrimstoneFireball.DisplayName: Brimstone Fireball BrimstoneHellfireballFriendly.DisplayName: Hellfireball BrimstoneHomer.DisplayName: Brimstone Homer BrimstoneTentacle.DisplayName: Brimstone Tentacle +CauldronProj.DisplayName: Smauldron +CauldronProjSmall.DisplayName: Smaullerdron ChronoIcicleLarge.DisplayName: Chrono Icicle ChronoIcicleSmall.DisplayName: Chrono Icicle ChronomancersScytheHoldout.DisplayName: Chronomancer's Scythe diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index f49ed13e17..2116398cd1 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -316,3 +316,5 @@ WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YateveoBloomProj.DisplayName: Yateveo Bloom YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard +RespiteblockHoldout.DisplayName: Respiteblock +RespiteblockBlood.DisplayName: Respiteblock Blood diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson index 2afb5dbc69..867973a1e3 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson @@ -68,3 +68,5 @@ PlagueShot.DisplayName: Plague Shot PlagueShotBuffer.DisplayName: Plague Shot WaterShot.DisplayName: Water Shot WaterShotBuffer.DisplayName: Water Shot +Lilyglow.DisplayName: Lilyglow +WaterAlgae.DisplayName: Water Algae diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 6759b07c22..bdb56aaf63 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -253,3 +253,4 @@ WildfireBloomFire.DisplayName: Wildfire Fire WildfireBloomFlare.DisplayName: Wildfire Flare WulfrumScrapBullet.DisplayName: High Speed Scrap NitroShot.DisplayName: Nitro Shot +ChargedBlastSplit.DisplayName: Charged Blast Split diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index f56e0e7b4a..f7c34ecdda 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -94,6 +94,7 @@ PauldronExplosion.DisplayName: Pauldron Explosion PendantProjectile1.DisplayName: Prism Shard PendantProjectile2.DisplayName: Prism Shard PendantProjectile3.DisplayName: Prism Shard +PlaguePulse.DisplayName: Plague Pulse PoisonousSeawater.DisplayName: Seawater PscTransformAnimation.DisplayName: Psc Transform Animation PscTransformRocks.DisplayName: Psc Transform Rocks diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 47a076ebb1..1ed917404e 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -615,3 +615,5 @@ DraedonFacility: Other minor research projects Abyss: Disposing of Silva's remains SulphurSea2: Irradiating one of the oceans Roxcalibur: I wanna rock +// Hold Shift tooltip default +HoldShiftTooltipExtensionIndicator: Hold "Left Shift" for more diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson index f1625a0e8f..3e221f5442 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -88,6 +88,12 @@ SetBonus: { Enemy hits release mythril flares, which home in on enemies after a short delay Once a flare is created, there is a {0} frame delay before another one can appear ''' + Nebula: + ''' + Pink damage boosters grant 7.5% damage per stack + Orange life boosters grant +2 HP/s life regen per stack + Blue mana boosters grant +5 MP/s mana regen per stack + ''' Necro: ''' Allows you to temporarily survive fatal damage @@ -99,6 +105,11 @@ SetBonus: { Increases minion damage by 15% Grants immunity to fire blocks and temporary immunity to lava ''' + Palladium: + ''' + Grants +2 HP/s life regeneration after striking an enemy + This life regeneration bypasses negative life regeneration + ''' PlatinumChainmail: 3% increased critical strike chance Platinum: ''' diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index aed63d706f..4373a9e37f 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -4,7 +4,7 @@ BuffDescription: { BeetleMight: Melee damage and speed increase by {0}% and {1}% respectively ChaosState: Rod of Discord teleports are disabled LeafCrystal: Emits powerful life pulses at nearby enemies - WarmthExtra: Grants immunity to Chilled, Frozen and Glacial State + WarmthExtra: Reduced durations of Chilled, Frozen, and Glacial State WeaponImbueConfetti: All attacks cause confetti to appear WeaponImbueCursedFlames: Melee, Whip, and Rogue attacks inflict enemies with cursed flames WeaponImbueFire: Melee, Whip, and Rogue attacks set enemies on fire diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs index 0eca2a663d..14a0dbf9f7 100644 --- a/NPCs/Abyss/SlabCrab.cs +++ b/NPCs/Abyss/SlabCrab.cs @@ -309,7 +309,7 @@ namespace CalamityMod.NPCs.Abyss { if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) { - return SpawnCondition.OceanMonster.Chance; + return SpawnCondition.CaveJellyfish.Chance; } return 0f; } diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index 2731b95647..adbefe7503 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -108,10 +108,8 @@ namespace CalamityMod.NPCs.CalClone start = false; } - NPC.TargetClosest(); - float projectileSpeed = 9f; - Vector2 velocity = Main.player[NPC.target].Center - NPC.Center; + Vector2 velocity = Main.player[parent.target].Center - NPC.Center; velocity.Normalize(); velocity *= projectileSpeed; NPC.rotation = velocity.ToRotation() + MathHelper.Pi; @@ -126,7 +124,7 @@ namespace CalamityMod.NPCs.CalClone int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 1f, NPC.target, 1f, 0f, projectileSpeed * 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 1f, parent.target, 1f, 0f, projectileSpeed * 2f); } timer = 0; } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs index b1086e7143..2ddd4e677e 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs @@ -87,10 +87,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - Player player = Main.player[npc.target]; bool notOcean = player.position.Y < 300f || diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs index 5a651886f6..e91a6698d7 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs @@ -41,6 +41,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Variables bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; @@ -58,13 +59,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs calamityGlobalNPC.DR = exhausted ? 0.25f : 0.5f; npc.defense = exhausted ? npc.defDefense / 2 : npc.defDefense; - // Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit - float noProjectileOrPhaseIncrementTime = 240f; - - bool dontAttack = npc.localAI[3] > 0f; - if (dontAttack) - npc.localAI[3] -= 1f; - // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -75,6 +69,19 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Player player = Main.player[npc.target]; + // Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit + float noProjectileOrPhaseIncrementTime = 240f; + + bool dontAttack = npc.localAI[3] > 0f; + if (dontAttack) + { + npc.localAI[3] -= 1f; + if (npc.justHit) + npc.localAI[3] -= masterMode ? 7f : expertMode ? 5f : 3f; + if (npc.Distance(player.Center) < 240f) + npc.localAI[3] -= masterMode ? 4f : expertMode ? 2f : 1f; + } + float enrageScale = bossRush ? 1f : 0f; if ((Main.IsItDay() && !player.Calamity().ZoneAstral) || bossRush) { @@ -336,6 +343,11 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Stay vulnerable for 3 seconds npc.ai[1] += 1f; + if (npc.justHit) + npc.ai[1] += masterMode ? 7f : expertMode ? 5f : 3f; + if (npc.Distance(player.Center) < 240f) + npc.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; + if (npc.ai[1] >= 180f || bossRush) { // Set AI to random state and reset other AI arrays @@ -442,7 +454,11 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Walk for a maximum of 6 seconds if (!dontAttack) + { npc.ai[1] += 1f; + if (npc.Distance(player.Center) < 240f) + npc.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; + } if (npc.ai[1] >= ((bossRush ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f))) { diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs index 77a9dc6558..6cc79b9e1b 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs @@ -46,10 +46,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - Player player = Main.player[npc.target]; bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; @@ -99,6 +95,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Variables for buffing the AI bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; @@ -253,7 +250,12 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; - if (npc.localAI[1] >= (bossRush ? 5f : death ? 30f : 180f)) + if (npc.justHit) + npc.localAI[1] += masterMode ? 7f : expertMode ? 5f : 3f; + if (npc.Distance(player.Center) < 160f) + npc.localAI[1] += masterMode ? 4f : expertMode ? 2f : 1f; + + if (npc.localAI[1] >= (bossRush ? 60f : death ? 120f : 180f)) { npc.TargetClosest(); npc.localAI[1] = 0f; @@ -307,7 +309,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 1f; } - npc.alpha += bossRush ? 4 : death ? 3 : 2; + npc.alpha += bossRush ? 15 : death ? 5 : revenge ? 4 : expertMode ? 3 : 2; if (npc.alpha >= 255) { int spawnType = brimmy.currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType(); diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs index 2551962926..885505f155 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs @@ -185,10 +185,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - // Target variable Player player = Main.player[npc.target]; @@ -556,7 +552,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (death) npc.localAI[0] = 1f; - npc.TargetClosest(); npc.netUpdate = true; } @@ -645,7 +640,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (death) npc.localAI[0] = 1f; - npc.TargetClosest(); npc.netUpdate = true; } } @@ -706,11 +700,11 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.ai[2] = 0f; npc.rotation = rotation; - npc.TargetClosest(); npc.netUpdate = true; if (npc.ai[3] >= 2f) { + npc.TargetClosest(); npc.ai[1] = 0f; npc.ai[3] = 0f; return; @@ -727,8 +721,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.ai[2] += 1f; if (npc.ai[2] >= (phase4 ? 15f : 30f)) { - npc.TargetClosest(); - npc.ai[1] = 2f; npc.ai[2] = 0f; if (death) @@ -768,10 +760,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - Player player = Main.player[npc.target]; float enrageScale = bossRush ? 1f : 0f; @@ -914,7 +902,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.ai[2] += 1f; if (npc.ai[2] >= (240f - (death ? 120f * (1f - lifeRatio) : 0f))) { - npc.TargetClosest(); npc.ai[1] = 1f; npc.ai[2] = 0f; npc.target = 255; @@ -1047,7 +1034,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.ai[2] = 0f; npc.target = 255; npc.rotation = calCloneBroRotation; - npc.TargetClosest(); if (npc.ai[3] >= 3f) { npc.ai[1] = 0f; @@ -1089,10 +1075,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - Player player = Main.player[npc.target]; float enrageScale = bossRush ? 1f : 0f; @@ -1235,7 +1217,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.ai[2] += 1f; if (npc.ai[2] >= (180f - (death ? 90f * (1f - lifeRatio) : 0f))) { - npc.TargetClosest(); npc.ai[1] = 1f; npc.ai[2] = 0f; npc.target = 255; @@ -1366,7 +1347,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.TargetClosest(); npc.rotation = calCloneBroRotation; if (npc.ai[3] >= 4f) { diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs index 6f7fa5b9bd..e33ab45fd9 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs @@ -448,7 +448,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs void Movement(bool succ) { float velocity = moveVeryFast ? 25f : bossRush ? 15f : ((expertMode ? 7.5f : 6f) + (float)(death ? 2f * (1D - lifeRatio) : 0f)) * tileEnrageMult; - float acceleration = moveVeryFast ? 0.75f : bossRush ? 0.3f : death ? 0.2f : expertMode ? 0.16f : 0.12f; + float acceleration = (moveVeryFast ? 0.75f : bossRush ? 0.3f : death ? 0.2f : expertMode ? 0.16f : 0.12f) + (float)(death ? 0.04f * (1D - lifeRatio) : 0f) * tileEnrageMult; // Increase speed dramatically in succ phase if (succ) @@ -472,7 +472,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { // Move to a new location every few seconds calamityGlobalNPC.newAI[2] += 1f; - float newPositionGateValue = bossRush ? 180f : death ? 270f : revenge ? 300f : expertMode ? 360f : 480f; + float newPositionGateValue = bossRush ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; if (calamityGlobalNPC.newAI[2] > newPositionGateValue) { calamityGlobalNPC.newAI[2] = 0f; @@ -520,7 +520,18 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Vector2 distanceFromDestination = destination - npc.Center; // Movement - CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); + if (npc.Distance(destination) > maxDistance || succ) + { + CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); + } + else + { + // Slow down + if (npc.velocity.Length() > 0.5f) + npc.velocity *= 0.8f; + else + npc.velocity = Vector2.Zero; + } } // Spawn more Dark Energies as the fight progresses diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 69712bf4e7..1e6ab76f66 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3201,7 +3201,7 @@ namespace CalamityMod.NPCs // Damage reduction on spawn for certain worm bosses. if (CalamityLists.EaterofWorldsIDs.Contains(npc.type)) - modifiers.FinalDamage *= 1f - MathHelper.Lerp(BossRushEvent.BossRushActive ? 0.8f : 0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / EaterOfWorldsAI.DRIncreaseTime, 0f, 1f)); + modifiers.FinalDamage *= 1f - MathHelper.Lerp(BossRushEvent.BossRushActive ? 0.6f : 0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / EaterOfWorldsAI.DRIncreaseTime, 0f, 1f)); if (CalamityLists.DestroyerIDs.Contains(npc.type)) modifiers.FinalDamage *= 1f - MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / DestroyerAI.DRIncreaseTime, 0f, 1f)); if (CalamityLists.AstrumDeusIDs.Contains(npc.type)) @@ -3225,14 +3225,6 @@ namespace CalamityMod.NPCs if (effectiveDR <= 0f) effectiveDR = 0f; - // Add Yellow Candle damage if the NPC isn't supposed to be "near invincible" - // Armor penetration has already been applied as bonus damage. - // Yellow Candle provides +5% damage which ignores both DR and defense. - // This means Yellow Candle is buffing armor penetration and technically not ignoring defense, - // but it's small enough to let it slide. - if (npc.HasBuff() && DR < 0.99f && npc.takenDamageMultiplier > 0.05f) - finalMultiplier += 0.05f; - // Calculate extra DR based on kill time, similar to the Hush boss from The Binding of Isaac // Cirrus being active makes the extra DR cease to function bool cirrusBossActive = false; @@ -3495,6 +3487,73 @@ namespace CalamityMod.NPCs return DukeFishronAI.BuffedDetonatingBubbleAI(npc, Mod); } + // Expert+ Hive Mind Vile Spits + if (npc.type == NPCID.VileSpitEaterOfWorlds) + { + if (Main.expertMode || BossRushEvent.BossRushActive) + { + if (npc.ai[1] >= 69f) + { + if (npc.target == Main.maxPlayers) + { + npc.TargetClosest(); + + float velocity = Main.getGoodWorld ? 10f : (Main.masterMode || BossRushEvent.BossRushActive) ? 8f : 6f; + if (npc.ai[1] == 70f) + velocity *= 0.6f; + + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; + } + + if (Main.getGoodWorld && !npc.dontTakeDamage) + { + if ((double)(npc.Center.Y / 16f) < Main.worldSurface) + npc.dontTakeDamage = true; + } + + npc.damage = npc.GetAttackDamage_ScaledByStrength(32f); + + npc.ai[0] += 1f; + if (npc.ai[0] > 3f) + npc.ai[0] = 3f; + + if (npc.ai[0] == 2f) + { + npc.position += npc.velocity; + SoundEngine.PlaySound(SoundID.NPCDeath9, npc.Center); + for (int i = 0; i < 20; i++) + { + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f) + npc.netOffset, npc.width, npc.height, 18, 0f, 0f, 100, default, 1.8f); + Main.dust[dust].velocity *= 1.3f; + Main.dust[dust].velocity += npc.velocity; + Main.dust[dust].noGravity = true; + } + } + + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.StrikeInstantKill(); + } + + npc.EncourageDespawn(100); + + npc.position += npc.netOffset; + for (int i = 0; i < 2; i++) + { + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 1.3f); + Main.dust[dust].velocity *= 0.3f; + Main.dust[dust].noGravity = true; + } + + npc.rotation += 0.4f * npc.direction; + npc.position -= npc.netOffset; + + return false; + } + } + } + if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { switch (npc.type) diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index ae24263c1f..abf91440b3 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -94,6 +94,7 @@ namespace CalamityMod.NPCs { "Tavish DeGroot", // <@!442447226992721930> (magicoal) "Fimmy", // <@!407348617079160832> (darkmega5) + "Dorira", // <@!215269032360804352> (crimsoncb) }; private static readonly string[] DryadNames = { diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 8a3a648268..b7e2cb704c 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -146,6 +146,12 @@ namespace CalamityMod.NPCs.CeaselessVoid return minDist <= 50f; } + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(BuffID.VortexDebuff, 60, true); + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 202e8d1e86..c5fee54bad 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -282,10 +282,11 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { - int debufftype = Main.zenithWorld ? BuffID.Obstructed : BuffID.VortexDebuff; - int duration = Main.zenithWorld ? 30 : 60; - if (hurtInfo.Damage > 0) - target.AddBuff(debufftype, duration, true); + if (Main.zenithWorld) + { + if (hurtInfo.Damage > 0) + target.AddBuff(BuffID.Obstructed, 30, true); + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index c3dda3d521..af96c9a5b1 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -76,7 +76,10 @@ namespace CalamityMod.NPCs.Crabulon float xVelocityLimit = BossRushEvent.BossRushActive ? 12f : death ? 8f : revenge ? 6f : 5f; float yVelocityLimit = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.25f : death ? 0.75f : revenge ? 0.9f : 1f; - NPC.TargetClosest(); + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + Player player = Main.player[NPC.target]; NPC.velocity.Y += 0.02f; diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index c22d47736d..31653519f3 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -127,6 +127,7 @@ namespace CalamityMod.NPCs.Crabulon bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; NPC.spriteDirection = NPC.direction; @@ -141,10 +142,6 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - NPC.TargetClosest(); - Player player = Main.player[NPC.target]; if (!player.active || player.dead) { @@ -258,6 +255,10 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[1] += 1f; if (phase3) NPC.ai[1] += 2f; + if (NPC.justHit) + NPC.ai[1] += masterMode ? 7f : expertMode ? 5f : 3f; + if (NPC.Distance(player.Center) < 160f) + NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; float idleTime = death ? 30f : expertMode ? 60f : 120f; if (NPC.ai[1] >= idleTime) @@ -351,10 +352,12 @@ namespace CalamityMod.NPCs.Crabulon } NPC.ai[1] += 1f; + if (NPC.Distance(player.Center) < 160f) + NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; + float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 120f * (1f - lifeRatio) : 0f); if (NPC.ai[1] >= stompPhaseGateValue) { - NPC.TargetClosest(); NPC.noGravity = false; NPC.noTileCollide = false; NPC.ai[0] = 2f; @@ -505,8 +508,6 @@ namespace CalamityMod.NPCs.Crabulon } } - NPC.TargetClosest(); - NPC.ai[2] += 1f; if (NPC.ai[2] >= (phase2 ? 4f : 3f)) { diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index a5cb29f29e..36f0b6388c 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -180,10 +180,6 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - NPC.TargetClosest(); - Player player = Main.player[NPC.target]; bool bossRush = BossRushEvent.BossRushActive; @@ -381,7 +377,6 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.localAI[0] >= 120f) { NPC.localAI[0] = 0f; - NPC.TargetClosest(); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center); @@ -449,7 +444,6 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.localAI[0] >= 120f) { NPC.localAI[0] = 0f; - NPC.TargetClosest(); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center); @@ -639,7 +633,6 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.localAI[0] >= 120f) { NPC.localAI[0] = 0f; - NPC.TargetClosest(); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center); @@ -759,11 +752,10 @@ namespace CalamityMod.NPCs.Cryogen NPC.ai[1] -= 1f; if (NPC.ai[1] == chargeGateValue) { - NPC.TargetClosest(); - calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] > 1f) { + NPC.TargetClosest(); NPC.ai[1] = 0f; NPC.localAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; @@ -855,16 +847,13 @@ namespace CalamityMod.NPCs.Cryogen NPC.localAI[2] += 1f; if (NPC.localAI[2] >= 180f) { - NPC.TargetClosest(); NPC.localAI[2] = 0f; int attackTimer = 0; - int playerTileX; - int playerTileY; - while (true) + int playerTileX = (int)player.Center.X / 16; + int playerTileY = (int)player.Center.Y / 16; + while (attackTimer <= 100) { attackTimer++; - playerTileX = (int)player.Center.X / 16; - playerTileY = (int)player.Center.Y / 16; int min = 16; int max = 20; @@ -882,15 +871,13 @@ namespace CalamityMod.NPCs.Cryogen if (!WorldGen.SolidTile(playerTileX, playerTileY) && Collision.CanHit(new Vector2(playerTileX * 16, playerTileY * 16), 1, 1, player.position, player.width, player.height)) break; - if (attackTimer > 100) - goto Block; + playerTileX = (int)player.Center.X / 16; + playerTileY = (int)player.Center.Y / 16; } NPC.ai[1] = 1f; teleportLocationX = playerTileX; calamityGlobalNPC.newAI[2] = playerTileY; NPC.netUpdate = true; -Block: - ; } } } @@ -951,6 +938,7 @@ Block: } } + NPC.TargetClosest(); NPC.ai[1] = 2f; NPC.netUpdate = true; } @@ -1046,7 +1034,6 @@ Block: if (NPC.ai[1] <= 0f) // Set the next charge, or switch back to floating above the player { NPC.ai[3] += 1f; - NPC.TargetClosest(); if (NPC.ai[3] > 2f) { NPC.ai[0] = 5f; diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index a9328ad75e..a6e676023c 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -25,7 +26,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.height = 70; NPC.defense = 6; - NPC.lifeMax = 90; + NPC.lifeMax = 120; if (BossRushEvent.BossRushActive) NPC.lifeMax = 2000; if (Main.getGoodWorld) @@ -58,10 +59,13 @@ namespace CalamityMod.NPCs.HiveMind // Avoid cheap bullshit NPC.damage = 0; - NPC.TargetClosest(); + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + bool masterMode = Main.masterMode; bool revenge = CalamityWorld.revenge; - float speed = revenge ? 12f : 11f; + float speed = masterMode ? 15f : revenge ? 13f : 11f; if (BossRushEvent.BossRushActive) speed = 18f; @@ -73,56 +77,66 @@ namespace CalamityMod.NPCs.HiveMind NPC.rotation = NPC.velocity.X * 0.05f; Vector2 targetDirection = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); - float playerXDist = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - targetDirection.X; - float playerYDist = Main.player[NPC.target].Center.Y - targetDirection.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - float timeToReachTarget = speed / playerDistance; - playerXDist *= timeToReachTarget; - playerYDist *= timeToReachTarget; + Vector2 targetLocation = Main.player[NPC.target].Center; - NPC.ai[0] -= 1f; - if (playerDistance < 200f || NPC.ai[0] > 0f) + // Fly above if below 25% HP and burst to spawn a Rain Cloud when high enough + bool killYourself = NPC.life / (float)NPC.lifeMax < 0.25f; + if (killYourself && (Main.expertMode || BossRushEvent.BossRushActive)) { - // Set damage - NPC.damage = NPC.defDamage; + targetLocation -= Vector2.UnitY * 400f; + if (NPC.Distance(targetLocation) < 80f) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); + return; + } + } - if (playerDistance < 200f) - NPC.ai[0] = 20f; + if (!killYourself) + { + NPC.ai[0] -= 1f; + bool dash = NPC.Distance(targetLocation) < 200f; + if (dash || NPC.ai[0] > 0f) + { + // Set damage + NPC.damage = NPC.defDamage; - if (NPC.velocity.X < 0f) - NPC.direction = -1; - else - NPC.direction = 1; + if (dash) + NPC.ai[0] = 20f; + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + return; + } + } + + float inertia = (NPC.Distance(targetLocation) < 300f || killYourself) ? 8f : NPC.Distance(targetLocation) < 400f ? 20f : 50f; + Vector2 idealVelocity = (targetLocation - targetDirection).SafeNormalize(Vector2.UnitX * NPC.direction) * speed; + NPC.velocity = (NPC.velocity * inertia + idealVelocity) / (inertia + 1f); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage < 0) return; - } - NPC.velocity.X = (NPC.velocity.X * 50f + playerXDist) / 51f; - NPC.velocity.Y = (NPC.velocity.Y * 50f + playerYDist) / 51f; - if (playerDistance < 350f) - { - NPC.velocity.X = (NPC.velocity.X * 10f + playerXDist) / 11f; - NPC.velocity.Y = (NPC.velocity.Y * 10f + playerYDist) / 11f; - } - if (playerDistance < 300f) - { - NPC.velocity.X = (NPC.velocity.X * 7f + playerXDist) / 8f; - NPC.velocity.Y = (NPC.velocity.Y * 7f + playerYDist) / 8f; - } + target.AddBuff(ModContent.BuffType(), 180); } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Glass, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Glass, hit.HitDirection, -1f, 0, default, 1f); - } + if (Main.netMode != NetmodeID.Server) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DankCreeperGore").Type, 1f); diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 0449ae3853..3432898fdc 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -60,67 +60,86 @@ namespace CalamityMod.NPCs.HiveMind // Setting this in SetDefaults will disable expert mode scaling, so put it here instead NPC.damage = 0; + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - NPC.TargetClosest(); - float npcSpeed = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 8f : revenge ? 4.5f : 4f; - float velocityMult = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 1f : revenge ? 0.8f : 0.75f; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Float around the player + NPC.rotation = NPC.velocity.X / 20f; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : death ? 7f : revenge ? 6f : 4f; + float acceleration = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.5f : death ? 0.35f : revenge ? 0.3f : 0.2f; + float deceleration = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.9f : death ? 0.95f : revenge ? 0.96f : 0.98f; + if (masterMode) + { + velocity += 2f; + acceleration += 0.2f; + deceleration -= 0.05f; + } if (BossRushEvent.BossRushActive) { - npcSpeed *= 2f; - velocityMult *= 2f; + velocity *= 2f; + acceleration *= 2f; } - Vector2 npcCenter = new Vector2(NPC.Center.X, NPC.Center.Y); - float playerXDist = Main.player[NPC.target].Center.X - npcCenter.X; - float playerYDist = Main.player[NPC.target].Center.Y - npcCenter.Y - ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 500f : 400f); - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - if (playerDistance < ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : 20f)) + if (NPC.position.Y > Main.player[NPC.target].position.Y - 350f) { - playerXDist = NPC.velocity.X; - playerYDist = NPC.velocity.Y; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= deceleration; + + NPC.velocity.Y -= acceleration; + + if (NPC.velocity.Y > velocity) + NPC.velocity.Y = velocity; } - else + else if (NPC.position.Y < Main.player[NPC.target].position.Y - 450f) { - playerDistance = npcSpeed / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= deceleration; + + NPC.velocity.Y += acceleration; + + if (NPC.velocity.Y < -velocity) + NPC.velocity.Y = -velocity; } - if (NPC.velocity.X < playerXDist) + + bool dropRain = NPC.Bottom.Y < Main.player[NPC.target].position.Y - 300f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height); + float distanceX = masterMode ? 200f : 400f; + float velocityX = velocity * 1.5f; + if (NPC.Center.X > Main.player[NPC.target].Center.X + distanceX) { - NPC.velocity.X = NPC.velocity.X + velocityMult; - if (NPC.velocity.X < 0f && playerXDist > 0f) - { - NPC.velocity.X = NPC.velocity.X + velocityMult * 2f; - } + dropRain = false; + + if (NPC.velocity.X > 0f) + NPC.velocity.X *= deceleration; + + NPC.velocity.X -= acceleration; + + if (NPC.velocity.X > velocityX) + NPC.velocity.X = velocityX; } - else if (NPC.velocity.X > playerXDist) + if (NPC.Center.X < Main.player[NPC.target].Center.X - distanceX) { - NPC.velocity.X = NPC.velocity.X - velocityMult; - if (NPC.velocity.X > 0f && playerXDist < 0f) - { - NPC.velocity.X = NPC.velocity.X - velocityMult * 2f; - } + dropRain = false; + + if (NPC.velocity.X < 0f) + NPC.velocity.X *= deceleration; + + NPC.velocity.X += acceleration; + + if (NPC.velocity.X < -velocityX) + NPC.velocity.X = -velocityX; } - if (NPC.velocity.Y < playerYDist) - { - NPC.velocity.Y = NPC.velocity.Y + velocityMult; - if (NPC.velocity.Y < 0f && playerYDist > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + velocityMult * 2f; - } - } - else if (NPC.velocity.Y > playerYDist) - { - NPC.velocity.Y = NPC.velocity.Y - velocityMult; - if (NPC.velocity.Y > 0f && playerYDist < 0f) - { - NPC.velocity.Y = NPC.velocity.Y - velocityMult * 2f; - } - } - if (NPC.position.X + NPC.width > Main.player[NPC.target].position.X && NPC.position.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width && NPC.position.Y + NPC.height < Main.player[NPC.target].position.Y && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && Main.netMode != NetmodeID.MultiplayerClient) + + if (dropRain && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] += 1f; - if (NPC.ai[0] >= (Main.getGoodWorld ? 12f : 24f)) + float rainDropRate = Main.getGoodWorld ? 8f : death ? 16f : revenge ? 20f : 24f; + if (NPC.ai[0] >= rainDropRate) { NPC.ai[0] = 0f; int shaderainXPos = (int)(NPC.position.X + 10f + Main.rand.Next(NPC.width - 20)); @@ -128,7 +147,8 @@ namespace CalamityMod.NPCs.HiveMind int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); float randomXVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.rand.NextFloat() * 5f : 0f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), shaderainXPos, shaderainYos, randomXVelocity, 4f, type, damage, 0f, Main.myPlayer); + float velocityY = 8f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), shaderainXPos, shaderainYos, randomXVelocity, velocityY, type, damage, 0f, Main.myPlayer); } } } @@ -143,15 +163,12 @@ namespace CalamityMod.NPCs.HiveMind public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); - } } } } diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index cd07a4b5fe..6e7c638703 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -14,6 +14,10 @@ namespace CalamityMod.NPCs.HiveMind { public class HiveBlob : ModNPC { + private const float ShootGateValue = 240f; + private const float TelegraphDuration = 120f; + private const float ShowTelegraphValue = ShootGateValue - TelegraphDuration; + public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -54,6 +58,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.damage = 0; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -69,6 +74,20 @@ namespace CalamityMod.NPCs.HiveMind return; } + // When Hive Mind starts flying around + bool phase2 = Main.npc[hiveMind].life / (float)Main.npc[hiveMind].lifeMax < 0.8f; + + if (phase2) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; + return; + } + + NPC.alpha = Main.npc[hiveMind].alpha; + if (NPC.ai[3] > 0f) hiveMind = (int)NPC.ai[3] - 1; @@ -85,50 +104,49 @@ namespace CalamityMod.NPCs.HiveMind } } - NPC.TargetClosest(true); - + float hiveMindVelocity = Main.npc[hiveMind].velocity.Length(); float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; - Vector2 randomLocationVector = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); - float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - randomLocationVector.X; - float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - randomLocationVector.Y; - float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); - float hiveMindX = Main.npc[hiveMind].position.X + (Main.npc[hiveMind].width / 2); - float hiveMindY = Main.npc[hiveMind].position.Y + (Main.npc[hiveMind].height / 2); + float acceleration = 0.8f; + float distanceFromMind = Main.getGoodWorld ? 256f : 128f; + + float hiveMindX = Main.npc[hiveMind].Center.X; + float hiveMindY = Main.npc[hiveMind].Center.Y; Vector2 hiveMindPos = new Vector2(hiveMindX, hiveMindY); float randomPosX = hiveMindX + NPC.ai[0]; float randomPosY = hiveMindY + NPC.ai[1]; float finalRandPosX = randomPosX - hiveMindPos.X; float finalRandPosY = randomPosY - hiveMindPos.Y; float finalRandDistance = (float)Math.Sqrt(finalRandPosX * finalRandPosX + finalRandPosY * finalRandPosY); - finalRandDistance = (Main.getGoodWorld ? 256f : 128f) / finalRandDistance; + finalRandDistance = distanceFromMind / finalRandDistance; finalRandPosX *= finalRandDistance; finalRandPosY *= finalRandDistance; + if (NPC.position.X < hiveMindX + finalRandPosX) { - NPC.velocity.X = NPC.velocity.X + relocateSpeed; + NPC.velocity.X += relocateSpeed; if (NPC.velocity.X < 0f && finalRandPosX > 0f) - NPC.velocity.X = NPC.velocity.X * 0.8f; + NPC.velocity.X *= acceleration; } else if (NPC.position.X > hiveMindX + finalRandPosX) { - NPC.velocity.X = NPC.velocity.X - relocateSpeed; + NPC.velocity.X -= relocateSpeed; if (NPC.velocity.X > 0f && finalRandPosX < 0f) - NPC.velocity.X = NPC.velocity.X * 0.8f; + NPC.velocity.X *= acceleration; } if (NPC.position.Y < hiveMindY + finalRandPosY) { - NPC.velocity.Y = NPC.velocity.Y + relocateSpeed; + NPC.velocity.Y += relocateSpeed; if (NPC.velocity.Y < 0f && finalRandPosY > 0f) - NPC.velocity.Y = NPC.velocity.Y * 0.8f; + NPC.velocity.Y *= acceleration; } else if (NPC.position.Y > hiveMindY + finalRandPosY) { - NPC.velocity.Y = NPC.velocity.Y - relocateSpeed; + NPC.velocity.Y -= relocateSpeed; if (NPC.velocity.Y > 0f && finalRandPosY < 0f) - NPC.velocity.Y = NPC.velocity.Y * 0.8f; + NPC.velocity.Y *= acceleration; } - float velocityLimit = getFuckedAI ? 32f : 8f; + float velocityLimit = relocateSpeed * 16f; if (NPC.velocity.X > velocityLimit) NPC.velocity.X = velocityLimit; if (NPC.velocity.X < -velocityLimit) @@ -140,23 +158,36 @@ namespace CalamityMod.NPCs.HiveMind if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) - NPC.localAI[1] = 180f; + if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) + NPC.localAI[1] = ShootGateValue * 0.5f; - NPC.localAI[1] += Main.rand.Next(2) + 1f; - if (NPC.localAI[1] >= 360f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 80f) + float shootGateValue = ShootGateValue; + if (NPC.localAI[1] < shootGateValue) + { + NPC.localAI[1] += 1f; + if (NPC.localAI[1] < ShowTelegraphValue) + NPC.localAI[1] += Main.rand.Next(2); + if (masterMode) + NPC.localAI[1] += 1f; + } + + if (NPC.alpha > 0) + return; + + if (NPC.localAI[1] >= shootGateValue && Vector2.Distance(Main.player[Main.npc[hiveMind].target].Center, NPC.Center) > 80f) { NPC.localAI[1] = 0f; - NPC.TargetClosest(true); - if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) { - float projSpeed = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f; + float projSpeed = death ? 8f : revenge ? 7f : expertMode ? 6f : 4f; + if (masterMode) + projSpeed += 2f; if (Main.getGoodWorld) - projSpeed *= 2.4f; + projSpeed *= 1.5f; - Vector2 projDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2)); - float playerX = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - projDirection.X; - float playerY = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - projDirection.Y; + Vector2 projDirection = NPC.Center; + float playerX = Main.player[Main.npc[hiveMind].target].Center.X - projDirection.X; + float playerY = Main.player[Main.npc[hiveMind].target].Center.Y - projDirection.Y; float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY); playerDist = projSpeed / playerDist; playerX *= playerDist; @@ -166,7 +197,7 @@ namespace CalamityMod.NPCs.HiveMind Vector2 projectileVelocity = new Vector2(playerX, playerY); if (type == ProjectileID.CursedFlameHostile) { - Vector2 v = Main.player[NPC.target].Center - NPC.Center - Main.player[NPC.target].velocity * 20f; + Vector2 v = Main.player[Main.npc[hiveMind].target].Center - NPC.Center - Main.player[Main.npc[hiveMind].target].velocity * 20f; projectileVelocity = v.SafeNormalize(Vector2.UnitY) * projSpeed; } Projectile.NewProjectile(NPC.GetSource_FromAI(), projDirection, projectileVelocity, type, damage, 0f, Main.myPlayer); @@ -176,6 +207,8 @@ namespace CalamityMod.NPCs.HiveMind } } + public override bool CanHitNPC(NPC target) => NPC.alpha == 0; // Can only be hit while fully visible + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -190,8 +223,8 @@ namespace CalamityMod.NPCs.HiveMind vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); - if (NPC.localAI[1] > 240f) - color = Color.Lerp(color, Color.Green, MathHelper.Clamp((NPC.localAI[1] - 240f) / 120f, 0f, 1f)); + if (NPC.localAI[1] > ShowTelegraphValue) + color = Color.Lerp(color, Color.LimeGreen * NPC.Opacity, MathHelper.Clamp((NPC.localAI[1] - ShowTelegraphValue) / TelegraphDuration, 0f, 1f)); spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index 1d704aa619..9b3e44fd1f 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -14,6 +14,10 @@ namespace CalamityMod.NPCs.HiveMind { public class HiveBlob2 : ModNPC { + private const float ShootGateValue = 180f; + private const float TelegraphDuration = 120f; + private const float ShowTelegraphValue = ShootGateValue - TelegraphDuration; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.HiveBlob.DisplayName"); public override string Texture => "CalamityMod/NPCs/HiveMind/HiveBlob"; @@ -57,6 +61,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.damage = 0; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -72,6 +77,20 @@ namespace CalamityMod.NPCs.HiveMind return; } + // When Hive Mind starts flying around + bool phase2 = Main.npc[hiveMind].life / (float)Main.npc[hiveMind].lifeMax < 0.8f; + + if (phase2) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; + return; + } + + NPC.alpha = Main.npc[hiveMind].alpha; + if (NPC.ai[3] > 0f) hiveMind = (int)NPC.ai[3] - 1; @@ -88,50 +107,49 @@ namespace CalamityMod.NPCs.HiveMind } } - NPC.TargetClosest(true); - + float hiveMindVelocity = Main.npc[hiveMind].velocity.Length(); float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; - Vector2 randomRelocateVector = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); - float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - randomRelocateVector.X; - float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - randomRelocateVector.Y; - float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); - float hiveMindX = Main.npc[hiveMind].position.X + (Main.npc[hiveMind].width / 2); - float hiveMindY = Main.npc[hiveMind].position.Y + (Main.npc[hiveMind].height / 2); + float acceleration = 0.8f; + float distanceFromMind = Main.getGoodWorld ? 192f : 96f; + + float hiveMindX = Main.npc[hiveMind].Center.X; + float hiveMindY = Main.npc[hiveMind].Center.Y; Vector2 hiveMindPos = new Vector2(hiveMindX, hiveMindY); float randomPosX = hiveMindX + NPC.ai[0]; float randomPosY = hiveMindY + NPC.ai[1]; float finalRandPosX = randomPosX - hiveMindPos.X; float finalRandPosY = randomPosY - hiveMindPos.Y; float finalRandDistance = (float)Math.Sqrt(finalRandPosX * finalRandPosX + finalRandPosY * finalRandPosY); - finalRandDistance = (Main.getGoodWorld ? 192f : 96f) / finalRandDistance; + finalRandDistance = distanceFromMind / finalRandDistance; finalRandPosX *= finalRandDistance; finalRandPosY *= finalRandDistance; + if (NPC.position.X < hiveMindX + finalRandPosX) { - NPC.velocity.X = NPC.velocity.X + relocateSpeed; + NPC.velocity.X += relocateSpeed; if (NPC.velocity.X < 0f && finalRandPosX > 0f) - NPC.velocity.X = NPC.velocity.X * 0.8f; + NPC.velocity.X *= acceleration; } else if (NPC.position.X > hiveMindX + finalRandPosX) { - NPC.velocity.X = NPC.velocity.X - relocateSpeed; + NPC.velocity.X -= relocateSpeed; if (NPC.velocity.X > 0f && finalRandPosX < 0f) - NPC.velocity.X = NPC.velocity.X * 0.8f; + NPC.velocity.X *= acceleration; } if (NPC.position.Y < hiveMindY + finalRandPosY) { - NPC.velocity.Y = NPC.velocity.Y + relocateSpeed; + NPC.velocity.Y += relocateSpeed; if (NPC.velocity.Y < 0f && finalRandPosY > 0f) - NPC.velocity.Y = NPC.velocity.Y * 0.8f; + NPC.velocity.Y *= acceleration; } else if (NPC.position.Y > hiveMindY + finalRandPosY) { - NPC.velocity.Y = NPC.velocity.Y - relocateSpeed; + NPC.velocity.Y -= relocateSpeed; if (NPC.velocity.Y > 0f && finalRandPosY < 0f) - NPC.velocity.Y = NPC.velocity.Y * 0.8f; + NPC.velocity.Y *= acceleration; } - float velocityLimit = getFuckedAI ? 32f : 8f; + float velocityLimit = relocateSpeed * 16f; if (NPC.velocity.X > velocityLimit) NPC.velocity.X = velocityLimit; if (NPC.velocity.X < -velocityLimit) @@ -143,23 +161,36 @@ namespace CalamityMod.NPCs.HiveMind if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) - NPC.localAI[1] = 180f; + if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) + NPC.localAI[1] = ShootGateValue * 0.5f; - NPC.localAI[1] += Main.rand.Next(3) + 1f; - if (NPC.localAI[1] >= 360f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 80f) + float shootGateValue = ShootGateValue; + if (NPC.localAI[1] < shootGateValue) + { + NPC.localAI[1] += 1f; + if (NPC.localAI[1] < ShowTelegraphValue) + NPC.localAI[1] += Main.rand.Next(2); + if (masterMode) + NPC.localAI[1] += 1f; + } + + if (NPC.alpha > 0) + return; + + if (NPC.localAI[1] >= shootGateValue && Vector2.Distance(Main.player[Main.npc[hiveMind].target].Center, NPC.Center) > 80f) { NPC.localAI[1] = 0f; - NPC.TargetClosest(true); - if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) { - float projSpeed = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f; + float projSpeed = death ? 8f : revenge ? 7f : expertMode ? 6f : 4f; + if (masterMode) + projSpeed += 2f; if (Main.getGoodWorld) - projSpeed *= 2.4f; + projSpeed *= 1.5f; - Vector2 projDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2)); - float playerX = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - projDirection.X; - float playerY = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - projDirection.Y; + Vector2 projDirection = NPC.Center; + float playerX = Main.player[Main.npc[hiveMind].target].Center.X - projDirection.X; + float playerY = Main.player[Main.npc[hiveMind].target].Center.Y - projDirection.Y; float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY); playerDist = projSpeed / playerDist; playerX *= playerDist; @@ -169,7 +200,7 @@ namespace CalamityMod.NPCs.HiveMind Vector2 projectileVelocity = new Vector2(playerX, playerY); if (type == ProjectileID.CursedFlameHostile) { - Vector2 v = Main.player[NPC.target].Center - NPC.Center - Main.player[NPC.target].velocity * 20f; + Vector2 v = Main.player[Main.npc[hiveMind].target].Center - NPC.Center - Main.player[Main.npc[hiveMind].target].velocity * 20f; projectileVelocity = v.SafeNormalize(Vector2.UnitY) * projSpeed; } Projectile.NewProjectile(NPC.GetSource_FromAI(), projDirection, projectileVelocity, type, damage, 0f, Main.myPlayer); @@ -179,6 +210,8 @@ namespace CalamityMod.NPCs.HiveMind } } + public override bool CanHitNPC(NPC target) => NPC.alpha == 0; // Can only be hit while fully visible + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -193,8 +226,8 @@ namespace CalamityMod.NPCs.HiveMind vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); - if (NPC.localAI[1] > 240f) - color = Color.Lerp(color, Color.Green, MathHelper.Clamp((NPC.localAI[1] - 240f) / 120f, 0f, 1f)); + if (NPC.localAI[1] > ShowTelegraphValue) + color = Color.Lerp(color, Color.LimeGreen * NPC.Opacity, MathHelper.Clamp((NPC.localAI[1] - ShowTelegraphValue) / TelegraphDuration, 0f, 1f)); spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index fee10f41f3..415eae29bc 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1,4 +1,5 @@ using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; @@ -70,6 +71,7 @@ namespace CalamityMod.NPCs.HiveMind private int lungeFade = 15; // Divide 255 by this for duration of hive mind spin before slowing for lunge private double lungeRots = 0.2; // Number of revolutions made while spinning/fading in for lunge private bool dashStarted = false; + private int vileSpitFireRate = 24; // Fire rate for Expert-exclusive Vile Spits during phase 1 teleports private int phase2timer = 360; private int rotationDirection; private double rotation; @@ -129,13 +131,19 @@ namespace CalamityMod.NPCs.HiveMind NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - if (Main.expertMode) + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + if (expertMode) { minimumDriftTime = 120; reelbackFade = 4; } - if (CalamityWorld.revenge) + if (revenge) { lungeRots = 0.3; minimumDriftTime = 90; @@ -143,19 +151,21 @@ namespace CalamityMod.NPCs.HiveMind lungeTime = 28; driftSpeed = 2f; driftBoost = 2f; + vileSpitFireRate = 18; } - if (CalamityWorld.death) + if (death) { lungeRots = 0.4; minimumDriftTime = 60; reelbackFade = 6; lungeTime = 23; - driftSpeed = 3f; - driftBoost = 1f; + driftSpeed = 3.5f; + driftBoost = 1.5f; + vileSpitFireRate = 15; } - if (BossRushEvent.BossRushActive) + if (bossRush) { lungeRots = 0.4; minimumDriftTime = 40; @@ -163,6 +173,18 @@ namespace CalamityMod.NPCs.HiveMind lungeTime = 16; driftSpeed = 6f; driftBoost = 1f; + vileSpitFireRate = 12; + } + + if (masterMode) + { + lungeRots += 0.1; + minimumDriftTime /= 2; + reelbackFade *= 2; + lungeTime -= 5; + driftSpeed += ((death && !bossRush) ? 0.5f : 1f); + driftBoost += ((death && !bossRush) ? 0.5f : 1f); + vileSpitFireRate -= 6; } if (Main.getGoodWorld) @@ -319,7 +341,13 @@ namespace CalamityMod.NPCs.HiveMind private void SpawnStuff() { - int maxSpawns = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 5 : CalamityWorld.revenge ? 4 : Main.expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + int maxSpawns = death ? 5 : revenge ? 4 : expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); for (int i = 0; i < maxSpawns; i++) { int type = NPCID.EaterofSouls; @@ -357,11 +385,14 @@ namespace CalamityMod.NPCs.HiveMind private void ReelBack() { + bool bossRush = BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || bossRush; + NPC.alpha = 0; phase2timer = 0; deceleration = NPC.velocity / 255f * reelbackFade; - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) + if (revenge) { state = 2; SoundEngine.PlaySound(FastRoarSound, NPC.Center); @@ -387,14 +418,11 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - NPC.TargetClosest(); - Player player = Main.player[NPC.target]; bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; @@ -515,7 +543,7 @@ namespace CalamityMod.NPCs.HiveMind maxBlobs = 50; for (int i = 0; i < maxBlobs; i++) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(), NPC.whoAmI); } } @@ -524,13 +552,34 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.life > 0) { - if (Main.netMode != NetmodeID.MultiplayerClient) + int fivePercentHP = (int)(NPC.lifeMax * 0.05); + if ((NPC.life + fivePercentHP) < NPC.ai[3]) { - int fivePercentHP = (int)(NPC.lifeMax * 0.05); - if ((NPC.life + fivePercentHP) < NPC.ai[3]) - { - NPC.ai[3] = NPC.life; + SoundEngine.PlaySound(SoundID.NPCDeath22, NPC.Center); + NPC.ai[3] = NPC.life; + + for (int i = 0; i < 20; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 35; j++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 2f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { int maxSpawns = bossRush ? 10 : death ? 5 : revenge ? 4 : expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); int maxDankSpawns = bossRush ? 4 : death ? Main.rand.Next(2, 4) : revenge ? 2 : expertMode ? Main.rand.Next(1, 3) : 1; @@ -539,14 +588,14 @@ namespace CalamityMod.NPCs.HiveMind int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32)); - int type = ModContent.NPCType(); + int type = Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(); if (NPC.CountNPCS(ModContent.NPCType()) < maxDankSpawns) type = ModContent.NPCType(); int fivePercentMinions = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type); Main.npc[fivePercentMinions].SetDefaults(type); if (Main.netMode == NetmodeID.Server && fivePercentMinions < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, fivePercentMinions, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, fivePercentMinions); } return; @@ -569,6 +618,8 @@ namespace CalamityMod.NPCs.HiveMind { NPC.scale += 0.0165f; NPC.alpha -= 4; + if (NPC.alpha < 0) + NPC.alpha = 0; int burrowedDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, DustID.Demonite, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[burrowedDust].velocity *= 2f; @@ -586,6 +637,15 @@ namespace CalamityMod.NPCs.HiveMind burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, DustID.Demonite, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[burrowedDust2].velocity *= 1f; } + + if (expertMode) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && burrowTimer % vileSpitFireRate == 0) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 69f); + } + } } else if (burrowTimer == -60) { @@ -602,6 +662,16 @@ namespace CalamityMod.NPCs.HiveMind tilePosY++; NPC.position.Y += 16; } + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC hiveBlob = Main.npc[i]; + if (hiveBlob.active && (hiveBlob.type == ModContent.NPCType() || hiveBlob.type == ModContent.NPCType())) + { + hiveBlob.position.X = NPC.position.X; + hiveBlob.position.Y = NPC.position.Y; + } + } } NPC.netUpdate = true; NPC.netSpam = 0; @@ -610,6 +680,8 @@ namespace CalamityMod.NPCs.HiveMind { NPC.scale -= 0.0165f; NPC.alpha += 4; + if (NPC.alpha > 255) + NPC.alpha = 255; int burrowedDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, DustID.Demonite, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[burrowedDust].velocity *= 2f; @@ -627,6 +699,15 @@ namespace CalamityMod.NPCs.HiveMind burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, DustID.Demonite, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[burrowedDust2].velocity *= 1f; } + + if (expertMode) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && burrowTimer % vileSpitFireRate == 0) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 69f); + } + } } else if (burrowTimer == 0) { @@ -652,7 +733,11 @@ namespace CalamityMod.NPCs.HiveMind NPC.damage = 0; if (NPC.alpha > 0) + { NPC.alpha -= 3; + if (NPC.alpha < 0) + NPC.alpha = 0; + } if (nextState == 0) { @@ -691,7 +776,7 @@ namespace CalamityMod.NPCs.HiveMind else { reelCount++; - if (Main.expertMode && reelCount == 2) + if (expertMode && reelCount == 2) { reelCount = 0; nextState = 2; @@ -711,11 +796,11 @@ namespace CalamityMod.NPCs.HiveMind NPC.netSpam = 0; } - if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 5000f) + if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 8000f) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 5000f) + if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 8000f) { if (NPC.timeLeft > 60) NPC.timeLeft = 60; @@ -738,9 +823,28 @@ namespace CalamityMod.NPCs.HiveMind return; } + if (expertMode) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[2] += 1f; + if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % (vileSpitFireRate * 2) == 0) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 69f); + } + } + NPC.velocity = player.Center - NPC.Center; phase2timer--; + + // Use an attack sooner if being hit + if (NPC.justHit) + phase2timer -= masterMode ? 7 : expertMode ? 5 : 3; + + // Use an attack sooner if target is close + if (NPC.Distance(player.Center) < 160f) + phase2timer -= 2; + if (phase2timer <= -180) // No stalling drift mode forever { NPC.velocity *= 2f / 255f * (reelbackFade + 2 * (int)enrageScale); @@ -779,7 +883,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.position.Y = NPC.ai[2] * 16 - height_Phase2 / 2; } - phase2timer = minimumDriftTime + Main.rand.Next(121); + phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); NPC.netUpdate = true; NPC.netSpam = 0; } @@ -844,13 +948,24 @@ namespace CalamityMod.NPCs.HiveMind NPC.netSpam = 0; if (NPC.alpha > 0) { - NPC.alpha -= lungeFade; - if (Main.netMode != NetmodeID.MultiplayerClient) + { NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); + if (masterMode) + { + NPC.localAI[2] += 1f; + if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % vileSpitFireRate == 0) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 70f); + } + } + rotation += rotationIncrement * rotationDirection; phase2timer = lungeDelay; + + NPC.alpha -= lungeFade; + if (NPC.alpha < 0) + NPC.alpha = 0; } else { @@ -872,8 +987,17 @@ namespace CalamityMod.NPCs.HiveMind else { if (Main.netMode != NetmodeID.MultiplayerClient) + { NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); + if (masterMode) + { + NPC.localAI[2] += 1f; + if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % vileSpitFireRate == 0) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 70f); + } + } + rotation += rotationIncrement * rotationDirection * phase2timer / lungeDelay; } } @@ -903,12 +1027,16 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.alpha > 0) { - NPC.alpha -= 5; if (Main.netMode != NetmodeID.MultiplayerClient) { NPC.Center = player.Center; NPC.position.Y += teleportRadius; } + + NPC.alpha -= masterMode ? 10 : 5; + if (NPC.alpha < 0) + NPC.alpha = 0; + NPC.netUpdate = true; NPC.netSpam = 0; } @@ -937,24 +1065,25 @@ namespace CalamityMod.NPCs.HiveMind if (phase2timer == (int)arcTime / 6) { phase2timer = 0; - NPC.ai[0]++; + NPC.ai[0] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient && Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height)) { - if (NPC.ai[0] == 2 || NPC.ai[0] == 4) + if (NPC.ai[0] == 2f || (NPC.ai[0] == 4f && death)) { - if (expertMode && !NPC.AnyNPCs(ModContent.NPCType())) + int maxHearts = revenge ? 2 : 1; + if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < maxHearts) NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); } else if (!NPC.AnyNPCs(NPCID.EaterofSouls)) NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.EaterofSouls); } - if (NPC.ai[0] == 6) + if (NPC.ai[0] == 6f) { NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); SpawnStuff(); state = 6; - NPC.ai[0] = 0; + NPC.ai[0] = 0f; deceleration = NPC.velocity / decelerationTime; } } @@ -970,13 +1099,17 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.alpha > 0) { - NPC.alpha -= 5; if (Main.netMode != NetmodeID.MultiplayerClient) { NPC.Center = player.Center; NPC.position.Y -= teleportRadius; NPC.position.X += teleportRadius * rotationDirection; } + + NPC.alpha -= masterMode ? 10 : 5; + if (NPC.alpha < 0) + NPC.alpha = 0; + NPC.netUpdate = true; NPC.netSpam = 0; } @@ -1003,7 +1136,7 @@ namespace CalamityMod.NPCs.HiveMind if (phase2timer == (int)arcTime / 20) { phase2timer = 0; - NPC.ai[0]++; + NPC.ai[0] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); @@ -1013,10 +1146,10 @@ namespace CalamityMod.NPCs.HiveMind Projectile.NewProjectile(NPC.GetSource_FromAI(), cloudSpawnPos, randomVelocity, type, damage, 0, Main.myPlayer, 11f); } - if (NPC.ai[0] == 10) + if (NPC.ai[0] == 10f) { state = 6; - NPC.ai[0] = 0; + NPC.ai[0] = 0f; deceleration = NPC.velocity / decelerationTime; } } @@ -1034,7 +1167,7 @@ namespace CalamityMod.NPCs.HiveMind phase2timer++; if (phase2timer == decelerationTime) { - phase2timer = minimumDriftTime + Main.rand.Next(121); + phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); state = 0; NPC.netUpdate = true; NPC.netSpam = 0; @@ -1067,6 +1200,14 @@ namespace CalamityMod.NPCs.HiveMind return minDist <= 60f && NPC.alpha == 0 && NPC.scale == 1f; // No damage while not fully visible or shrunk } + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage < 0) + return; + + target.AddBuff(ModContent.BuffType(), 300); + } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => NPC.scale == 1f; // Only draw HP bar while at full size public override void ModifyIncomingHit(ref NPC.HitModifiers modifiers) @@ -1094,28 +1235,20 @@ namespace CalamityMod.NPCs.HiveMind for (int k = 0; k < hit.Damage / NPC.lifeMax * 100.0; k++) Dust.NewDust(NPC.position, NPC.width, phase2 ? height_Phase2 : NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); - if (phase2) + if (!phase2) { - if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld ? NPC.CountNPCS(ModContent.NPCType()) < 10 : (Main.rand.NextBool(15) && NPC.CountNPCS(ModContent.NPCType()) < 2)) + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 spawnAt = NPC.Center + new Vector2(0f, height_Phase2 / 2f); - NPC.NewNPC(NPC.GetSource_FromThis(), (int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); - } - } - else - { - if (NPC.CountNPCS(NPCID.EaterofSouls) < 3 && NPC.CountNPCS(NPCID.DevourerHead) < 1) - { - if (Main.rand.NextBool(60) && Main.netMode != NetmodeID.MultiplayerClient) + if (Main.rand.NextBool(60)) { - Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); - NPC.NewNPC(NPC.GetSource_FromThis(), (int)spawnAt.X, (int)spawnAt.Y, NPCID.EaterofSouls); + if (NPC.CountNPCS(NPCID.EaterofSouls) < 3) + NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.EaterofSouls); } - if (Main.rand.NextBool(150) && Main.netMode != NetmodeID.MultiplayerClient) + if (Main.rand.NextBool(150)) { - Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); - NPC.NewNPC(NPC.GetSource_FromThis(), (int)spawnAt.X, (int)spawnAt.Y, NPCID.DevourerHead); + if (!NPC.AnyNPCs(NPCID.DevourerHead)) + NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.DevourerHead); } } } diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 89f9538999..7ea2b7e4e1 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.AnyNPCs(NPC.type)) return 0f; - return 0.1f; + return 0.05f; } public override void FindFrame(int frameHeight) diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index 9333fa56dd..a2ac0b57eb 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSunkenSea) + if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().InAnyCalamityBiome) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 6109809617..6a432d29cf 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) + if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().InAnyCalamityBiome) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index f90f0c6d88..aa32b01389 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -98,7 +98,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) + if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().InAnyCalamityBiome) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index b5c103278c..a53c26e4a7 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) + if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().InAnyCalamityBiome) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 982d5b5027..187e18bbe4 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) + if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().InAnyCalamityBiome) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 9c03ee3ba8..7a70aadd97 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) + if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().InAnyCalamityBiome) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index 2f61eac7b6..67894c8546 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) + if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().InAnyCalamityBiome) { return 0f; } diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index a5d17eb520..36752b68e0 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) + if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().InAnyCalamityBiome) { return 0f; } diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 24b57edf9b..df48e4ee91 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -822,6 +822,9 @@ namespace CalamityMod.NPCs.TownNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + if (Main.LocalPlayer.Calamity().trippy) + return false; + var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); return false; @@ -882,42 +885,49 @@ namespace CalamityMod.NPCs.TownNPCs public override void AddShops() { - Condition potionSells = CalamityConditions.PotionSellingConfig; - Condition downedAureus = CalamityConditions.DownedAstrumAureus; + Mod musicMod = CalamityMod.Instance.musicMod; + musicMod.TryFind("Interlude1MusicBox", out ModItem interlude1Box); + musicMod.TryFind("Interlude2MusicBox", out ModItem interlude2Box); + musicMod.TryFind("Interlude3MusicBox", out ModItem interlude3Box); + musicMod.TryFind("DevourerofGodsEulogyMusicBox", out ModItem eulogyBox); NPCShop shop = new(Type); - shop.AddWithCustomValue(ItemID.LovePotion, Item.buyPrice(silver: 25), potionSells, Condition.HappyEnough) + shop.AddWithCustomValue(ItemID.LovePotion, Item.buyPrice(silver: 25), CalamityConditions.PotionSellingConfig, Condition.HappyEnough) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(silver: 30)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 1)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 2)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 2)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 2)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 2), Condition.DownedMechBossAll) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedMechBossAll) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedMechBossAll) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), Condition.DownedPlantera) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) .AddWithCustomValue(ItemID.EmpressButterfly, Item.buyPrice(gold: 10), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3), downedAureus) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), downedAureus, Condition.BloodMoon) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), downedAureus, Condition.TimeNight) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 2), Condition.DownedGolem) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), Condition.DownedGolem) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), Condition.DownedGolem) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), CalamityConditions.DownedAstrumAureus) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), CalamityConditions.DownedAstrumAureus, Condition.BloodMoon) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), CalamityConditions.DownedAstrumAureus, Condition.TimeNight) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) .AddWithCustomValue(ItemID.BloodyMoscato, Item.buyPrice(gold: 1), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) .AddWithCustomValue(ItemID.BananaDaiquiri, Item.buyPrice(silver: 75), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) .AddWithCustomValue(ItemID.PeachSangria, Item.buyPrice(silver: 50), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) .AddWithCustomValue(ItemID.PinaColada, Item.buyPrice(gold: 1), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 50)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 50)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 50)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 50)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(1)) + .AddWithCustomValue(interlude1Box.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedCalamitasClone) + .AddWithCustomValue(interlude2Box.Type, Item.buyPrice(gold: 10), Condition.DownedMoonLord) + .AddWithCustomValue(interlude3Box.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedYharon) + .AddWithCustomValue(eulogyBox.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedDevourerOfGods) .AddWithCustomValue(ItemID.UnicornHorn, Item.buyPrice(0, 2, 50), Condition.HappyEnough, Condition.InHallow) .AddWithCustomValue(ItemID.Milkshake, Item.buyPrice(gold: 5), Condition.HappyEnough, Condition.InHallow, Condition.NpcIsPresent(NPCID.Stylist)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 25), Condition.HappyEnough, Condition.NpcIsPresent(NPCID.Stylist), Condition.NpcIsPresent(NPCID.BestiaryGirl)) diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index c9ea97d8d4..ff591a3aea 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -103,12 +103,12 @@ namespace CalamityMod.NPCs.TownNPCs public override List SetNPCNameList() => new List() { // Patron names - "Xplizzy", // <@!98826096237109248> (Whitegiraffe#6342) - "Freakish", // <@!750363283520749598> (Freakish#0001) + "Xplizzy", // <@!98826096237109248> (whitegiraffe) + "Freakish", // <@!750363283520749598> (freak5650) "Calder", // <@!601897959176798228> (hardlightcaster) - "Hunter Jinx", // <@!757401399783850134> (Jinx_enthusiast#1580) - "Goose", // <@!591421917706321962> (DullElili#8016) - "Jackson", // <@!525827730646892549> (ChowChow, Sin of Sleep Schedules#1235) + "Hunter Jinx", // <@!757401399783850134> (dragonslayerornstein.) + "Goose", // <@!591421917706321962> (dullelili) + "Jackson", // <@!525827730646892549> (chowchow360) "Altarca", // <@!1140673052108128337> (altarca_27226_49175) "Jackie", // <@!353241811717718016> (jackalchan) @@ -244,6 +244,9 @@ namespace CalamityMod.NPCs.TownNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + if (Main.LocalPlayer.Calamity().trippy) + return false; + var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); return false; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index 3e40e48be0..e49f711b79 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -414,6 +414,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = setDamage; npc.netUpdate = true; + npc.TargetClosest(); float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); float speedMult = 1f; @@ -686,6 +687,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = 5f; if (Main.netMode != NetmodeID.MultiplayerClient) { + npc.TargetClosest(false); Point point3 = npc.Center.ToTileCoordinates(); Point point4 = Main.player[npc.target].Center.ToTileCoordinates(); Vector2 vector30 = Main.player[npc.target].Center - npc.Center; @@ -872,6 +874,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = npc.defDamage; npc.netUpdate = true; + npc.TargetClosest(); + if (npc.ai[1] == 3f) { npc.velocity.Y = -13f; @@ -971,6 +975,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static void GetPlaceToTeleportTo(NPC npc) { + npc.TargetClosest(false); float distanceAhead = 800f; Vector2 randomDefault = Main.rand.NextBool() ? Vector2.UnitX : -Vector2.UnitX; Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(randomDefault) * distanceAhead; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index e8bb17fb34..f7b4de517e 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -422,7 +422,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool spawnBee = phase4 && calamityGlobalNPC.newAI[0] % beeSpawnGateValue == 0f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (spawnBee) { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); + SoundEngine.PlaySound(SoundID.NPCHit18, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -615,10 +615,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn bees if (Collision.CanHit(beeSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee && (!beeLimitReached || !hornetLimitReached)) { - if (!phase3 || Main.zenithWorld) - SoundEngine.PlaySound(SoundID.NPCHit1, beeSpawnLocation); - else - SoundEngine.PlaySound(SoundID.NPCHit18, beeSpawnLocation); + SoundEngine.PlaySound(SoundID.NPCHit18, beeSpawnLocation); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -717,9 +714,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Get target location and shoot from ass float stingerAttackSpeed = 16f + enrageScale * 4f; - float stingerAttackAccel = phase6 ? 0.32f : 0.24f; + float stingerAttackAccel = phase6 ? 0.24f : 0.18f; if (enrageScale > 0f) - stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.4f : 0.32f, phase6 ? 0.8f : 0.64f, enrageScale / maxEnrageScale); + stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.3f : 0.24f, phase6 ? 0.6f : 0.48f, enrageScale / maxEnrageScale); if (masterMode) { @@ -1359,7 +1356,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Collision.CanHit(beeSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag35) { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); + SoundEngine.PlaySound(SoundID.NPCHit18, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int num670 = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs index 1ce6e0c5c6..5b0ba579c7 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs @@ -68,6 +68,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.netUpdate = true; + npc.TargetClosest(false); Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 800f; Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates(); int randomTeleportOffset = 5; @@ -402,6 +403,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses speedMult = 2f; npc.netUpdate = true; + npc.TargetClosest(); + if (npc.ai[2] == 3f) { npc.velocity.Y = -13f * speedMult; @@ -929,6 +932,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.netUpdate = true; + npc.TargetClosest(false); Point point = npc.Center.ToTileCoordinates(); Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); Vector2 vector = Main.player[npc.target].Center - npc.Center; @@ -1248,6 +1252,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = npc.defDamage; npc.netUpdate = true; + npc.TargetClosest(); + if (npc.ai[2] == 3f) { npc.velocity.Y = -13f; diff --git a/Particles/DeathAshParticle.cs b/Particles/DeathAshParticle.cs index 58284da0b3..9687520e99 100644 --- a/Particles/DeathAshParticle.cs +++ b/Particles/DeathAshParticle.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Particles public Vector2 BottomRight => Center + Vector2.One * Scale * 3.5f; public Vector2 BottomLeft => Center + new Vector2(-1f, 1f) * Scale * 3.5f; - public static HashSet Ashes = new HashSet(); + public static HashSet Ashes = new(); public const int PrimitiveBatchSize = 256; public const int AshCountLimit = 45000; public static BasicEffect BasicShader diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index ddcc4ff9da..6791e8a9ed 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Core; @@ -15,6 +16,7 @@ namespace CalamityMod.Particles public static class GeneralParticleHandler { private static List particles; + private static Queue particlesToSpawnNextFrame; //List containing the particles to delete private static List particlesToKill; //Static list for details concerning every particle type @@ -53,6 +55,7 @@ namespace CalamityMod.Particles internal static void Load() { particles = new List(); + particlesToSpawnNextFrame = new Queue(); particlesToKill = new List(); particleTypes = new Dictionary(); particleTextures = new Dictionary(); @@ -66,6 +69,7 @@ namespace CalamityMod.Particles internal static void Unload() { particles = null; + particlesToSpawnNextFrame = null; particlesToKill = null; particleTypes = null; particleTextures = null; @@ -82,8 +86,8 @@ namespace CalamityMod.Particles { // Don't queue particles if the game is paused. // This precedent is established with how Dust instances are created. - //Don't spawn particles if on the server side either, or if the particles dict is somehow null - if (Main.gamePaused || Main.dedServ || particles == null) + // Don't spawn particles if on the server either, or if the particles dictionary is somehow null. + if (Main.gamePaused || Main.netMode == NetmodeID.Server || particles == null) return; if (particles.Count >= CalamityConfig.Instance.ParticleLimit && !particle.Important) @@ -93,8 +97,22 @@ namespace CalamityMod.Particles particle.Type = particleTypes[particle.GetType()]; } + public static void QueueParticleForNextFrame(Particle particle) + { + // Don't queue particles if the game is paused. + // This precedent is established with how Dust instances are created. + // Don't spawn particles if on the server side, or if the particles dictionary is somehow null. + if (Main.gamePaused || Main.netMode == NetmodeID.Server || particles == null) + return; + + particlesToSpawnNextFrame.Enqueue(particle); + } + public static void Update() { + while (particlesToSpawnNextFrame.Count > 0) + SpawnParticle(particlesToSpawnNextFrame.Dequeue()); + foreach (Particle particle in particles) { if (particle == null) diff --git a/Particles/SemiCircularSmearFade.cs b/Particles/SemiCircularSmearFade.cs new file mode 100644 index 0000000000..8ee2296013 --- /dev/null +++ b/Particles/SemiCircularSmearFade.cs @@ -0,0 +1,59 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Particles +{ + public class SemiCircularSmearFade : Particle + { + public override string Texture => "CalamityMod/Particles/SemiCircularSmearVertical"; + public override bool UseAdditiveBlend => true; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + public Player player = Main.player[Main.myPlayer]; + public Color InitialColor; + public bool PlayerCentered; + public bool RotateToVelocity; + public Vector2 Squish; + public bool ProduceLight; + public SemiCircularSmearFade(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, Vector2 squish, int lifetime, bool playerCentered = false, bool rotateToVelocity = false, bool produceLight = true) + { + Position = position; + Velocity = velocity; + Color = InitialColor = color; + Scale = scale; + Squish = squish; + Rotation = rotation; + Lifetime = lifetime; + PlayerCentered = playerCentered; + RotateToVelocity = rotateToVelocity; + ProduceLight = produceLight; + + } + public override void Update() + { + if (PlayerCentered) + Position = player.MountedCenter; + if (RotateToVelocity) + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + if (ProduceLight) + { + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + } + + Scale *= 0.95f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + } + + //Use custom draw for the squish + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, tex.Size() * 0.5f, Scale * Squish, 0, 0f); + } + } +} diff --git a/Particles/SemiCircularSmearVFX.cs b/Particles/SemiCircularSmearVFX.cs index d7ad76efb0..6fba683ae4 100644 --- a/Particles/SemiCircularSmearVFX.cs +++ b/Particles/SemiCircularSmearVFX.cs @@ -1,7 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Particles { @@ -11,9 +13,11 @@ namespace CalamityMod.Particles public override bool UseAdditiveBlend => true; public override bool UseCustomDraw => true; public override bool SetLifetime => true; + public Player player = Main.player[Main.myPlayer]; + public bool PlayerCentered; public Vector2 Squish; - public SemiCircularSmearVFX(Vector2 position, Color color, float rotation, float scale, Vector2 squish) + public SemiCircularSmearVFX(Vector2 position, Color color, float rotation, float scale, Vector2 squish, bool playerCentered = false) { Position = position; Velocity = Vector2.Zero; @@ -22,6 +26,12 @@ namespace CalamityMod.Particles Squish = squish; Rotation = rotation; Lifetime = 2; + PlayerCentered = playerCentered; + } + public override void Update() + { + if (PlayerCentered) + Position = player.MountedCenter; } //Use custom draw for the squish diff --git a/Particles/WaterFoam.png b/Particles/WaterFoam.png new file mode 100644 index 0000000000..71ed6ff84b Binary files /dev/null and b/Particles/WaterFoam.png differ diff --git a/Particles/WaterFoamParticle.cs b/Particles/WaterFoamParticle.cs new file mode 100644 index 0000000000..3b873bed48 --- /dev/null +++ b/Particles/WaterFoamParticle.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class WaterFoamParticle : Particle + { + public Color InitialColor; + public bool HasCreatedFoam = false; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => true; + + public override string Texture => "CalamityMod/Particles/WaterFoam"; + + public WaterFoamParticle(Vector2 relativePosition, Vector2 velocity, int lifetime, float scale, Color color) + { + Position = relativePosition; + Velocity = velocity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + } + + public override void Update() + { + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 1.7D)); + + if (Collision.WetCollision(Position, 1, 1)) + { + if (!HasCreatedFoam) + { + Vector2 foamVelocity = Main.rand.NextVector2Circular(2f, 0.3f); + if (foamVelocity.Y < -0.2f) + foamVelocity.Y = -0.2f; + + // Spawning the particle directly will result in the particle list collection being modified prematurely within the update loop. + // Doing it the next frame results in a single-frame buffer, but that shouldn't really be a problem and it ensures that the loop is + // not interrupted in unanticipated ways. + GeneralParticleHandler.QueueParticleForNextFrame(new MediumMistParticle(Position, foamVelocity, Color.LightCyan * 0.6f, Color.White * 0.6f, 0.2f, 255f, 0.03f)); + HasCreatedFoam = true; + } + + Velocity.Y *= 0.7f; + Time += 4; + } + else + Velocity.Y = MathHelper.Clamp(Velocity.Y + 0.12f, -8f, 12f); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + float brightness = (float)Math.Pow(Lighting.Brightness((int)(Position.X / 16f), (int)(Position.Y / 16f)), 0.15); + Texture2D texture = ModContent.Request(Texture).Value; + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color * brightness, Rotation, texture.Size() * 0.5f, Scale, 0, 0f); + } + } +} diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 85a46e55e9..b9e79f2352 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -94,10 +94,8 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.Opacity == 1f) { - int debufftype = Main.zenithWorld ? BuffID.Obstructed : BuffID.VortexDebuff; - int duration = Main.zenithWorld ? 30 : 60; - if (info.Damage > 0) - target.AddBuff(debufftype, duration, true); + if (Main.zenithWorld) + target.AddBuff(BuffID.Obstructed, 30, true); } } diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 8cf3a9e8b2..7ad6d26771 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -92,10 +92,8 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.Opacity == 1f) { - int debufftype = Main.zenithWorld ? BuffID.Obstructed : BuffID.VortexDebuff; - int duration = Main.zenithWorld ? 30 : 60; - if (info.Damage > 0) - target.AddBuff(debufftype, duration, true); + if (Main.zenithWorld) + target.AddBuff(BuffID.Obstructed, 30, true); } } diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index d963860aff..ce60e05cb7 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -101,7 +101,9 @@ namespace CalamityMod.Projectiles.Boss { target.AddBuff(BuffID.Frostburn, 180, true); target.AddBuff(BuffID.Chilled, 90, true); - target.AddBuff(ModContent.BuffType(), 60); + + if (!target.Calamity().gState) + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index 4c9005206e..9ebf0fb51a 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ai[0] = 0f; int rainSpawnX = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); int rainSpawnY = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)rainSpawnX, (float)rainSpawnY, 0f, 4f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)rainSpawnX, (float)rainSpawnY, 0f, 8f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); } } } @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index acb42b090b..8fd4a72096 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -9,19 +9,15 @@ namespace CalamityMod.Projectiles.Boss public class ShaderainHostile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetDefaults() { Projectile.width = 4; Projectile.height = 40; Projectile.hostile = true; - Projectile.extraUpdates = 1; Projectile.penetrate = -1; Projectile.ignoreWater = true; Projectile.timeLeft = 300; - } - - public override void AI() - { Projectile.alpha = 50; } @@ -36,17 +32,14 @@ namespace CalamityMod.Projectiles.Boss dust.scale = 0.95f; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(102, 255, 102, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(100, 255, 100, Projectile.alpha); public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 916a1412a8..d10155dc4f 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -116,7 +116,8 @@ namespace CalamityMod.Projectiles { ProjectileID.AdamantiteChainsaw, standardChainsawTweaks }, { ProjectileID.AdamantiteDrill, standardDrillTweaks }, { ProjectileID.Anchor, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.Bee, Do(PiercingExact(2)) }, + { ProjectileID.Bee, Do(PiercingExact(2), ExtraUpdatesExact(2)) }, + { ProjectileID.BeeArrow, Do(PointBlank, ExtraUpdatesExact(1)) }, { ProjectileID.BlackCounterweight, counterweightTweaks }, { ProjectileID.BlueCounterweight, counterweightTweaks }, { ProjectileID.BlueMoon, Do(ExtraUpdatesExact(1)) }, @@ -153,7 +154,7 @@ namespace CalamityMod.Projectiles { ProjectileID.FlyingKnife, Do(ExtraUpdatesExact(1)) }, { ProjectileID.FrostBoltStaff, Do(ExtraUpdatesExact(1)) }, { ProjectileID.FruitcakeChakram, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.GiantBee, Do(PiercingExact(2)) }, + { ProjectileID.GiantBee, Do(PiercingExact(2), ExtraUpdatesExact(2)) }, { ProjectileID.GoldenBullet, standardBulletTweaks }, { ProjectileID.GoldenShowerFriendly, Do(PiercingExact(2)) }, { ProjectileID.GreenCounterweight, counterweightTweaks }, @@ -209,6 +210,7 @@ namespace CalamityMod.Projectiles { ProjectileID.VenomFang, Do(LocalIFrames(10)) }, { ProjectileID.VortexDrill, standardDrillTweaks }, { ProjectileID.Wasp, Do(PiercingExact(2)) }, + { ProjectileID.WeatherPainShot, Do(ExtraUpdatesExact(2), TimeLeftExact(1400)) }, { ProjectileID.YellowCounterweight, counterweightTweaks }, #endregion @@ -251,7 +253,6 @@ namespace CalamityMod.Projectiles #endregion #region CATEGORY 4: Point Blank support - { ProjectileID.BeeArrow, pointBlank }, { ProjectileID.Blizzard, pointBlank }, // Blizzard Staff projectiles, re-used in Frostbite Blaster. { ProjectileID.BlueFlare, pointBlank }, { ProjectileID.BoneArrow, pointBlank }, @@ -268,8 +269,8 @@ namespace CalamityMod.Projectiles { ProjectileID.Flare, pointBlank }, { ProjectileID.FrostburnArrow, pointBlank }, { ProjectileID.Harpoon, pointBlank }, - { ProjectileID.HellfireArrow, pointBlank }, { ProjectileID.Hellwing, pointBlank }, + { ProjectileID.HellfireArrow, pointBlank }, { ProjectileID.HolyArrow, pointBlank }, { ProjectileID.IchorArrow, pointBlank }, { ProjectileID.JestersArrow, pointBlank }, diff --git a/Projectiles/Environment/Lilyglow.cs b/Projectiles/Environment/Lilyglow.cs new file mode 100644 index 0000000000..b984a03d89 --- /dev/null +++ b/Projectiles/Environment/Lilyglow.cs @@ -0,0 +1,61 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Environment +{ + public class Lilyglow : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float Direction => ref Projectile.ai[0]; + + public override void SetDefaults() + { + Projectile.width = 360; + Projectile.height = 360; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.penetrate = 1; + Projectile.scale = Main.rand?.NextFloat(0.02f, 0.035f) ?? 0.03f; + Projectile.Size /= Projectile.scale; + } + + public override void AI() + { + Projectile.Opacity = Utils.GetLerpValue(0f, 120f, Projectile.timeLeft, true) * Utils.GetLerpValue(600f, 540f, Projectile.timeLeft, true); + if (Projectile.timeLeft < 60f) + Projectile.scale *= 0.98f; + + // Oh? You're inside of blocks? DIEDIEDIEDIEDIEDIE + if (Collision.SolidCollision(Projectile.Center, 1, 1)) + Projectile.timeLeft -= 8; + + Projectile.Size = Vector2.One * 360f; + Projectile.hide = Projectile.Opacity < 0.15f; + + // Rotate around. + Projectile.velocity = Projectile.velocity.RotatedBy((float)Math.Cos(Projectile.timeLeft / 33f + Projectile.identity) * 0.0283f); + + Point left = (Projectile.Center - Vector2.UnitX * 24f).ToTileCoordinates(); + Point right = (Projectile.Center + Vector2.UnitX * 24f).ToTileCoordinates(); + Point top = (Projectile.Center - Vector2.UnitY * 24f).ToTileCoordinates(); + Point bottom = (Projectile.Center + Vector2.UnitY * 24f).ToTileCoordinates(); + + DelegateMethods.v3_1 = Projectile.GetAlpha(Color.White).ToVector3(); + Utils.PlotLine(left, right, DelegateMethods.CastLight); + Utils.PlotLine(top, bottom, DelegateMethods.CastLight); + } + + public override Color? GetAlpha(Color lightColor) + { + float fadeToPink = (float)Math.Pow(Projectile.identity % 8f / 8f, 0.93); + Color c = Color.Lerp(Color.Yellow, new Color(255, 110, 105), fadeToPink) * Projectile.Opacity; + c.A = (byte)Projectile.alpha; + return c; + } + } +} diff --git a/Projectiles/Environment/WaterAlgae.cs b/Projectiles/Environment/WaterAlgae.cs new file mode 100644 index 0000000000..d28cbb522b --- /dev/null +++ b/Projectiles/Environment/WaterAlgae.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Environment +{ + public class WaterAlgae : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + + public ref float Direction => ref Projectile.ai[0]; + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.CanDistortWater[Projectile.type] = false; + } + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.ignoreWater = true; + Projectile.timeLeft = 720; + Projectile.penetrate = 1; + Projectile.scale = Main.rand?.NextFloat(0.4f, 0.75f) ?? 1f; + Projectile.hide = true; + } + + public override void AI() + { + Projectile.Opacity = Utils.GetLerpValue(0f, 120f, Projectile.timeLeft, true) * Utils.GetLerpValue(720f, 660f, Projectile.timeLeft, true); + Projectile.hide = Projectile.Opacity < 0.2f; + if (Projectile.localAI[0] == 0f) + { + Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.localAI[0] = 1f; + } + + if (Collision.WetCollision(Projectile.position, Projectile.width, Projectile.height)) + { + if (Direction == 0f) + Direction = Projectile.identity % 2; + if (Collision.SolidCollision(Projectile.Center + Vector2.UnitX * Direction * 100f, 1, 1)) + Direction *= -1f; + + Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, Direction * MathHelper.Lerp(0.3f, 0.7f, Projectile.identity % 9f / 9f), 0.025f); + Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y - 0.008f, -0.4f, 0.4f); + } + else + { + Projectile.velocity.X *= 0.985f; + Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.1f, -1f, 5f); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.velocity.X *= 0.5f; + if (Projectile.timeLeft > 210) + Projectile.timeLeft = 210; + + return false; + } + } +} diff --git a/Projectiles/Environment/WaterAlgae.png b/Projectiles/Environment/WaterAlgae.png new file mode 100644 index 0000000000..e6a4ac5636 Binary files /dev/null and b/Projectiles/Environment/WaterAlgae.png differ diff --git a/Projectiles/Magic/CauldronHoldout.cs b/Projectiles/Magic/CauldronHoldout.cs new file mode 100644 index 0000000000..80d327c3ef --- /dev/null +++ b/Projectiles/Magic/CauldronHoldout.cs @@ -0,0 +1,127 @@ +using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Magic +{ + public class CauldronHoldout : ModProjectile, ILocalizedModType + { + public override LocalizedText DisplayName => GetItemName(); + + public override string Texture => "CalamityMod/Items/Weapons/Magic/TheCauldron"; + + public static int FireRate = 60; + + public override void SetDefaults() + { + Projectile.width = 46; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + } + public override void AI() + { + Player player = Main.player[Projectile.owner]; + float rotoffset = MathHelper.PiOver4; + Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true); + bool shouldBeHeld = !player.CantUseHoldout(); + Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); + if (Projectile.ai[0] > 0f) + { + Projectile.ai[0] -= 1f; + } + if (Main.myPlayer == Projectile.owner) + { + if (shouldBeHeld) + { + float holdscale = player.ActiveItem().shootSpeed * Projectile.scale; + Vector2 playerpos2 = playerpos; + Vector2 going = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - Projectile.Center; + if (player.gravDir == -1f) + { + going.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - Projectile.Center.Y; + } + Vector2 normalizedgoing = Vector2.Normalize(going); + if (float.IsNaN(normalizedgoing.X) || float.IsNaN(normalizedgoing.Y)) + { + normalizedgoing = -Vector2.UnitY; + } + normalizedgoing *= holdscale; + if (normalizedgoing.X != Projectile.velocity.X || normalizedgoing.Y != Projectile.velocity.Y) + { + Projectile.netUpdate = true; + } + Projectile.velocity = normalizedgoing * 0.55f; + + if (Projectile.ai[0] <= 0) + { + bool manaCostPaid = player.CheckMana(player.ActiveItem(), -1, true, false); + if (manaCostPaid) + { + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, Projectile.Center); + + int projType = ModContent.ProjectileType(); + int projDamage = Projectile.damage; + float speedscale = 18f; + Vector2 shotSpeed = Vector2.Normalize(Projectile.velocity) * speedscale; + if (float.IsNaN(shotSpeed.X) || float.IsNaN(shotSpeed.Y)) + { + shotSpeed = -Vector2.UnitY; + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shotSpeed, projType, projDamage, Projectile.knockBack, player.whoAmI); + + for (int i = 0; i < 6; i++) + { + Vector2 burstSpeed = (Projectile.rotation - rotoffset).ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(45f)) * Main.rand.NextFloat(8f, 14f); + SquishyLightParticle energy = new(Projectile.Center + Projectile.rotation.ToRotationVector2() * 5, burstSpeed, Main.rand.NextFloat(0.2f, 0.3f), Color.Orange, Main.rand.Next(6, 11), 3, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + } + Projectile.ai[0] = FireRate; + } + else + { + Projectile.Kill(); + } + } + } + else + { + Projectile.Kill(); + } + } + Projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) - new Vector2(player.direction == 1 ? 6 : 0, 30); + Projectile.rotation = Projectile.velocity.ToRotation() + rotoffset; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi); + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi); + } + + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(TheCauldron.Glow.Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Projectiles/Magic/CauldronProj.cs b/Projectiles/Magic/CauldronProj.cs new file mode 100644 index 0000000000..4c6b92ca08 --- /dev/null +++ b/Projectiles/Magic/CauldronProj.cs @@ -0,0 +1,105 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class CauldronProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + + public static Asset Glow; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + if (!Main.dedServ) + { + Glow = ModContent.Request(Texture + "Glow"); + } + } + + public override void SetDefaults() + { + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Magic; + } + public override void AI() + { + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 10f) + { + Projectile.ai[0] = 10f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) + { + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) + { + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; + } + } + Projectile.velocity.Y += 0.4f; + } + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 3) + { + Projectile.tileCollide = true; + } + Projectile.rotation += Projectile.velocity.X * 0.05f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, Scale: Main.rand.NextFloat(1f, 1.4f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + } + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, Projectile.Center); + Projectile.ExpandHitboxBy(128); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage = (int)(Projectile.damage * 0.66f); + Projectile.Damage(); + if (Projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 3; i++) + { + Vector2 smauldronSpeed = (Vector2.UnitY * Main.rand.NextFloat(-10f, -8f)).RotatedByRandom(MathHelper.ToRadians(30f)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, smauldronSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 3f, Projectile.owner); // 33% damage + } + } + for (int i = 0; i < 40; i++) + { + int size = 16; + Vector2 position = Projectile.Center; + Vector2 velocity = Main.rand.NextVector2Circular(size, size); + SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.2f, 0.3f), Color.Orange, Main.rand.Next(6, 9), 1, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(position, DustID.Torch, velocity, 0, default, Main.rand.NextFloat(1f, 2f)); + dust.noGravity = true; + } + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + Vector2 origin = Glow.Value.Size() / 2f; + Main.EntitySpriteDraw(Glow.Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire3, 90); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire3, 90); + } +} diff --git a/Projectiles/Magic/CauldronProj.png b/Projectiles/Magic/CauldronProj.png new file mode 100644 index 0000000000..f50600398a Binary files /dev/null and b/Projectiles/Magic/CauldronProj.png differ diff --git a/Projectiles/Magic/CauldronProjGlow.png b/Projectiles/Magic/CauldronProjGlow.png new file mode 100644 index 0000000000..41b8852012 Binary files /dev/null and b/Projectiles/Magic/CauldronProjGlow.png differ diff --git a/Projectiles/Magic/CauldronProjSmall.cs b/Projectiles/Magic/CauldronProjSmall.cs new file mode 100644 index 0000000000..e3d01d3509 --- /dev/null +++ b/Projectiles/Magic/CauldronProjSmall.cs @@ -0,0 +1,93 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class CauldronProjSmall : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + + public static Asset Glow; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + if (!Main.dedServ) + { + Glow = ModContent.Request(Texture + "Glow"); + } + } + + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Magic; + } + public override void AI() + { + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 8f) + { + Projectile.ai[0] = 8f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) + { + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) + { + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; + } + } + Projectile.velocity.Y += 0.38f; + } + Projectile.rotation += Projectile.velocity.X * 0.05f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, Scale: Main.rand.NextFloat(0.6f, 0.8f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + } + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = 0.8f, Volume = 0.6f }, Projectile.Center); + Projectile.ExpandHitboxBy(46); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); + for (int i = 0; i < 10; i++) + { + int size = 10; + Vector2 position = Projectile.Center; + Vector2 velocity = Main.rand.NextVector2Circular(size, size); + SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.1f, 0.2f), Color.Orange, Main.rand.Next(5, 8), 1, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(position, DustID.Torch, velocity, 0, default, Main.rand.NextFloat(0.8f, 1.2f)); + dust.noGravity = true; + } + } + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + Vector2 origin = Glow.Value.Size() / 2f; + Main.EntitySpriteDraw(Glow.Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } + + public override bool? CanDamage() => Projectile.velocity.Y < 0f ? false : null; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire3, 90); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire3, 90); + } +} diff --git a/Projectiles/Magic/CauldronProjSmall.png b/Projectiles/Magic/CauldronProjSmall.png new file mode 100644 index 0000000000..feac67f62f Binary files /dev/null and b/Projectiles/Magic/CauldronProjSmall.png differ diff --git a/Projectiles/Magic/CauldronProjSmallGlow.png b/Projectiles/Magic/CauldronProjSmallGlow.png new file mode 100644 index 0000000000..d9d146d319 Binary files /dev/null and b/Projectiles/Magic/CauldronProjSmallGlow.png differ diff --git a/Projectiles/Magic/ShadeNimbusCloud.cs b/Projectiles/Magic/ShadeNimbusCloud.cs index 2556ed189a..a94a50d56c 100644 --- a/Projectiles/Magic/ShadeNimbusCloud.cs +++ b/Projectiles/Magic/ShadeNimbusCloud.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0, 0, 0, default, 0.5f); } - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index c2c0650580..da5645ebb2 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/BansheeHookBoom.cs b/Projectiles/Melee/BansheeHookBoom.cs index 98a6105057..033293a215 100644 --- a/Projectiles/Melee/BansheeHookBoom.cs +++ b/Projectiles/Melee/BansheeHookBoom.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,8 +9,11 @@ namespace CalamityMod.Projectiles.Melee public class BansheeHookBoom : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private const int TimeLeft = 5; + public override void SetDefaults() { Projectile.width = 8; @@ -18,8 +22,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.alpha = 255; Projectile.ignoreWater = true; - Projectile.timeLeft = 6; Projectile.tileCollide = false; + Projectile.timeLeft = TimeLeft; Projectile.penetrate = -1; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; @@ -27,49 +31,46 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Projectile.ai[1] += 0.01f; - Projectile.scale = Projectile.ai[1]; - Projectile.ai[0] += 1f; - Projectile.alpha -= 63; - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } Lighting.AddLight(Projectile.Center, 1.5f, 0f, 0.15f); - if (Projectile.ai[0] == 1f) + + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= TimeLeft) { Projectile.position = Projectile.Center; Projectile.width = Projectile.height = (int)(52f * Projectile.scale); Projectile.Center = Projectile.position; - Projectile.Damage(); + for (int i = 0; i < 2; i++) { int bansheeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.5f); - Main.dust[bansheeDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[bansheeDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; } + for (int j = 0; j < 5; j++) { int bansheeDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 200, default, 2.7f); - Main.dust[bansheeDust2].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[bansheeDust2].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[bansheeDust2].noGravity = true; Main.dust[bansheeDust2].velocity *= 3f; bansheeDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[bansheeDust2].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Main.dust[bansheeDust2].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[bansheeDust2].velocity *= 2f; Main.dust[bansheeDust2].noGravity = true; Main.dust[bansheeDust2].fadeIn = 2.5f; } + for (int k = 0; k < 2; k++) { int bansheeDust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.7f); - Main.dust[bansheeDust3].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; + Main.dust[bansheeDust3].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; Main.dust[bansheeDust3].noGravity = true; Main.dust[bansheeDust3].velocity *= 3f; } + for (int l = 0; l < 5; l++) { int spiritDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 180, 0f, 0f, 0, default, 1.5f); - Main.dust[spiritDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; + Main.dust[spiritDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; Main.dust[spiritDust].noGravity = true; Main.dust[spiritDust].velocity *= 3f; } diff --git a/Projectiles/Melee/BansheeHookScythe.cs b/Projectiles/Melee/BansheeHookScythe.cs index 18dc5b5112..36677f7cf3 100644 --- a/Projectiles/Melee/BansheeHookScythe.cs +++ b/Projectiles/Melee/BansheeHookScythe.cs @@ -2,11 +2,13 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class BansheeHookScythe : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override void SetDefaults() { Projectile.width = 38; @@ -24,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.timeLeft = 90; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; + Projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/DarkMasterClone.cs b/Projectiles/Melee/DarkMasterClone.cs index d225c57331..be519e6b44 100644 --- a/Projectiles/Melee/DarkMasterClone.cs +++ b/Projectiles/Melee/DarkMasterClone.cs @@ -15,25 +15,32 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public Player clone; + public override void SetDefaults() { Projectile.width = 20; Projectile.height = 42; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 300; - Projectile.penetrate = -1; Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void AI() { + // if the player isn't holding the sword, DIE. + if (Owner.HeldItem.type != ModContent.ItemType() || !Owner.active || Owner.CCed || Owner == null) + { + Projectile.Kill(); + return; + } // if the velocity is not zero, the visuals get offset weirdly Projectile.velocity = Vector2.Zero; - Player owner = Main.player[Projectile.owner]; // how far the clone should move from the player - Vector2 moveTo = new Vector2(0, -160); + Vector2 moveTo = Vector2.UnitY * -160f; switch (Projectile.ai[0]) { case 1: @@ -43,39 +50,34 @@ namespace CalamityMod.Projectiles.Melee moveTo = new Vector2(180, 120); break; default: - moveTo = new Vector2(0, -160); break; } - // if the player isn't holding the sword, DIE. - if (owner.HeldItem.type != ModContent.ItemType() || !owner.active || owner.CCed || owner == null) - { - Projectile.Kill(); - } // if all conditions above aren't met, the clone can stick around forever - Projectile.timeLeft = 30; + Projectile.timeLeft = 2; // move the clone to the desired position - Projectile.Center = Vector2.Lerp(Projectile.Center, owner.Center + moveTo, 0.4f); + Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Center + moveTo, 0.4f); // produce smoke during initial move - if (Projectile.Distance(owner.Center + moveTo) < 16) + if (Projectile.Distance(Owner.Center + moveTo) < 16) { Projectile.ai[2] = 1; } if (Projectile.ai[2] == 0) { - float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); + float angle = Main.rand.NextFloat(0f, MathHelper.TwoPi); Vector2 angleVec = angle.ToRotationVector2(); Particle smoke = new HeavySmokeParticle(Projectile.Center, angleVec * Main.rand.NextFloat(1f, 2f), Color.Black, 30, Main.rand.NextFloat(0.25f, 1f), 0.5f, 0.1f); GeneralParticleHandler.SpawnParticle(smoke); } // shoot beams while the player is left clicking - if (owner.itemTime == owner.itemTimeMax && owner.altFunctionUse != 2 && owner.HeldItem.type == ModContent.ItemType()) + if (Projectile.ai[1] > 0) { + Projectile.ai[1] = 0; Vector2 direction = Projectile.Center.DirectionTo(Main.MouseWorld); Projectile.direction = Math.Sign(direction.X); if (Projectile.owner == Main.myPlayer) { // ai[1] not being 0 determines if the projectile should always ignore tiles - Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, direction * owner.HeldItem.shootSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), Projectile.knockBack, Projectile.owner, 1, 1); + Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, direction * Owner.HeldItem.shootSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), Projectile.knockBack, Projectile.owner, 1, 1); } } } @@ -86,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 8; i++) { - float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); + float angle = Main.rand.NextFloat(0f, MathHelper.TwoPi); Vector2 angleVec = angle.ToRotationVector2(); Particle smoke = new HeavySmokeParticle(Projectile.Center, angleVec * Main.rand.NextFloat(2f, 4f), Color.Black, 60, Main.rand.NextFloat(0.45f, 1.22f), 0.6f, 0.1f); GeneralParticleHandler.SpawnParticle(smoke); @@ -96,58 +98,51 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { // make a player visual clone. it inherits the player's hair type and clothes style and is otherwise all black with red pupils - Main.playerVisualClone[Projectile.owner] ??= new(); - Player owner = Main.player[Projectile.owner]; - - Player player = Main.playerVisualClone[Projectile.owner]; - player.CopyVisuals(Main.player[Projectile.owner]); - player.hair = owner.hair; - player.skinVariant = owner.skinVariant; - player.skinColor = Color.Black; - player.shirtColor = Color.Black; - player.underShirtColor = Color.Black; - player.pantsColor = Color.Black; - player.shoeColor = Color.Black; - player.hairColor = Color.Black; - player.eyeColor = Color.Red; + // Main.playerVisualClone[Projectile.owner] will throw stack trace errors on reloads + clone ??= new Player(); + clone.CopyVisuals(Owner); + clone.skinColor = Color.Black; + clone.shirtColor = Color.Black; + clone.underShirtColor = Color.Black; + clone.pantsColor = Color.Black; + clone.shoeColor = Color.Black; + clone.hairColor = Color.Black; + clone.eyeColor = Color.Red; // become one with the shadows - for (int i = 0; i < player.dye.Length; i++) + for (int i = 0; i < clone.dye.Length; i++) { - if (player.dye[i].type != ItemID.ShadowDye) + if (clone.dye[i].type != ItemID.ShadowDye) { - player.dye[i].SetDefaults(ItemID.ShadowDye); + clone.dye[i].SetDefaults(ItemID.ShadowDye); } } // update everything for our little dummy player - player.ResetEffects(); - player.ResetVisibleAccessories(); - player.DisplayDollUpdate(); - player.UpdateSocialShadow(); - player.UpdateDyes(); - player.PlayerFrame(); + clone.ResetEffects(); + clone.ResetVisibleAccessories(); + clone.DisplayDollUpdate(); + clone.UpdateSocialShadow(); + clone.UpdateDyes(); + clone.PlayerFrame(); // copy the player's arm movements while swinging, otherwise idle - if (owner.ItemAnimationActive && owner.altFunctionUse != 2) - player.bodyFrame = owner.bodyFrame; + if (Owner.ItemAnimationActive && Owner.altFunctionUse != 2) + clone.bodyFrame = Owner.bodyFrame; else - player.bodyFrame.Y = 0; + clone.bodyFrame.Y = 0; // legs never jump or walk - player.legFrame.Y = 0; + clone.legFrame.Y = 0; // face towards the player's cursor - player.direction = Math.Sign(Projectile.DirectionTo(Main.MouseWorld).X); - Main.PlayerRenderer.DrawPlayer(Main.Camera, player, Projectile.position, 0f, player.fullRotationOrigin, 0f, 1f); + clone.direction = Math.Sign(Projectile.DirectionTo(Main.MouseWorld).X); + Main.PlayerRenderer.DrawPlayer(Main.Camera, clone, Projectile.position, 0f, clone.fullRotationOrigin, 0f, 1f); // draw the sword - if (owner.ItemAnimationActive && owner.altFunctionUse != 2) + if (Owner.ItemAnimationActive && Owner.altFunctionUse != 2) { Texture2D Sword = ModContent.Request("CalamityMod/Items/Weapons/Melee/TheDarkMaster").Value; - Vector2 distToPlayer = Projectile.position - owner.position; - Main.EntitySpriteDraw(Sword, (Vector2)owner.HandPosition + distToPlayer - Main.screenPosition, null, lightColor, owner.direction == player.direction ? owner.itemRotation : -owner.itemRotation, new Vector2(player.direction == 1 ? 0 : Sword.Width, Sword.Height), 1f, player.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + Vector2 distToPlayer = Projectile.position - Owner.position; + Main.EntitySpriteDraw(Sword, (Vector2)Owner.HandPosition + distToPlayer - Main.screenPosition, null, lightColor, Owner.direction == clone.direction ? Owner.itemRotation : -Owner.itemRotation, new Vector2(clone.direction == 1 ? 0 : Sword.Width, Sword.Height), 1f, clone.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); } return false; } - public override bool? CanDamage() - { - return false; - } + public override bool? CanDamage() => false; } } diff --git a/Projectiles/Melee/Feather.cs b/Projectiles/Melee/Feather.cs index fade5444c1..507f59ee20 100644 --- a/Projectiles/Melee/Feather.cs +++ b/Projectiles/Melee/Feather.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.timeLeft = TimeLeft; Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.extraUpdates = 1; } public override void AI() diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index 49de81f947..0137b32032 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - int whiteLightTimer = 5; + int whiteLightTimer = 15; public override void SetDefaults() { @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.timeLeft = 60; + Projectile.timeLeft = 90; Projectile.DamageType = DamageClass.Melee; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; @@ -41,15 +41,15 @@ namespace CalamityMod.Projectiles.Melee for (i = 0; i < 1; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + int projectile2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); Main.projectile[projectile1].velocity.X *= 0.1f; Main.projectile[projectile1].velocity.Y *= 0.1f; Main.projectile[projectile2].velocity.X *= 0.1f; Main.projectile[projectile2].velocity.Y *= 0.1f; } } - whiteLightTimer = 5; + whiteLightTimer = 15; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); @@ -62,16 +62,14 @@ namespace CalamityMod.Projectiles.Melee Main.dust[shinyDust].velocity += Projectile.velocity * 0.1f; } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 9f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f); } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item122, Projectile.position); if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Melee/PrismaticBeam.cs b/Projectiles/Melee/PrismaticBeam.cs index e043fec076..34a62917e7 100644 --- a/Projectiles/Melee/PrismaticBeam.cs +++ b/Projectiles/Melee/PrismaticBeam.cs @@ -61,8 +61,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 6; Projectile.height = 6; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = MeleeRangedHybridDamageClass.Instance; Projectile.scale = 1.5f; Projectile.penetrate = -1; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/PrismaticWave.cs b/Projectiles/Melee/PrismaticWave.cs index 582a55ff9b..532d89d457 100644 --- a/Projectiles/Melee/PrismaticWave.cs +++ b/Projectiles/Melee/PrismaticWave.cs @@ -50,8 +50,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 36; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = MeleeRangedHybridDamageClass.Instance; Projectile.penetrate = 2; Projectile.timeLeft = 360; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/RespiteblockBlood.cs b/Projectiles/Melee/RespiteblockBlood.cs new file mode 100644 index 0000000000..ef683feae8 --- /dev/null +++ b/Projectiles/Melee/RespiteblockBlood.cs @@ -0,0 +1,78 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using SteelSeries.GameSense; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class RespiteblockBlood : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Color mainColor = Color.White; + public int time = 0; + + public override void SetDefaults() + { + Projectile.width = 45; + Projectile.height = 45; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; // Because it has a large hitbox it has custom tile kill + Projectile.penetrate = -1; + Projectile.timeLeft = 900; + Projectile.extraUpdates = 7; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Melee; + } + public override void AI() + { + if (mainColor == Color.White) + { + mainColor = Main.rand.NextBool() ? Color.Green : Color.Purple; + } + + if (Collision.SolidCollision(Projectile.Center, 5, 5)) + Projectile.Kill(); + + Lighting.AddLight(Projectile.Center, Color.Lerp(mainColor, Color.White, 0.5f).ToVector3()); + + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); //used for some drawing prevention for when it's offscreen since it makes a fuck load of particles + if (Projectile.timeLeft % 2 == 0 && time >= 1f && targetDist < 1400f) + { + Particle spark = new WaterFlavoredParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 0.8f, (mainColor * 0.65f) * Utils.GetLerpValue(0, 90, time, true)); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, mainColor == Color.Green ? 89 : 86, -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.8f, 1.1f)); + dust.noGravity = true; + dust.noLight = true; + dust.noLightEmittence = true; + dust.alpha = 90; + } + + Projectile.velocity.X *= 0.998f; + Projectile.velocity.Y += 0.01f; + + time++; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 4; i++) + { + Particle blood = new PointParticle(Projectile.Center, (-Projectile.velocity * 2).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.9f) + new Vector2(0, Main.rand.NextFloat(-5, -1 + 1)), true, 20, Main.rand.NextFloat(0.7f, 1.2f), mainColor * 0.5f, false); + GeneralParticleHandler.SpawnParticle(blood); + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45, targetHitbox); + } +} diff --git a/Projectiles/Melee/RespiteblockHoldout.cs b/Projectiles/Melee/RespiteblockHoldout.cs new file mode 100644 index 0000000000..63838d7431 --- /dev/null +++ b/Projectiles/Melee/RespiteblockHoldout.cs @@ -0,0 +1,203 @@ +using System; +using CalamityMod.Particles; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Achievements; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class RespiteblockHoldout : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 4; + + public override void SetDefaults() + { + Projectile.width = 108; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ownerHitCheck = true; + // No reason to ID-static the chainsaw -- multiple players can true melee simultaneously! + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.ArmorPenetration = 15; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + return false; + } + + public override void AI() + { + // Recalculate damage every frame for balance reasons, as this is a long-lasting holdout. + // This is important because you could start using it while benefitting from Auric Tesla standstill bonus, for example. + Projectile.damage = Owner.ActiveItem() is null ? 0 : Owner.GetWeaponDamage(Owner.ActiveItem()); + + PlayChainsawSounds(); + + // Determines the owner's position whilst incorporating their fullRotation field. + // It uses vector transformation on a Z rotation matrix based on said rotation under the hood. + // This is essentially just the pure mathematical definition of the RotatedBy method. + Vector2 playerRotatedPosition = Owner.RotatedRelativePoint(Owner.MountedCenter); + if (Main.myPlayer == Projectile.owner) + { + if (!Owner.CantUseHoldout() && Owner.active && !Owner.dead) + HandleChannelMovement(playerRotatedPosition); + else + Projectile.Kill(); + } + + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); + + for (int i = 0; i <= 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + (Projectile.velocity.RotatedBy(MathHelper.ToRadians(45f * Projectile.direction)) * 10) + Main.rand.NextVector2Circular(13, 13), Main.rand.NextBool() ? 89 : 86, (Projectile.velocity * 30).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.05f, 0.9f), 0, default, Main.rand.NextFloat(0.4f, 0.95f)); + dust.noGravity = true; + dust.noLight = true; + dust.noLightEmittence = true; + dust.alpha = 90; + } + if (Time % 4 == 0) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + (Projectile.velocity.RotatedBy(MathHelper.ToRadians(45f * Projectile.direction)) * 10) + Main.rand.NextVector2Circular(13, 13) + Projectile.velocity * Main.rand.Next(10, 20 + 1), Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.01f, -0.25f) * Projectile.direction) * 4, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), Projectile.knockBack, Projectile.owner, 0); + } + + DetermineVisuals(playerRotatedPosition); + ManipulatePlayerValues(); + + // Prevent the projectile from dying normally. However, if anything for whatever reason + // goes wrong it will immediately be destroyed on the next frame. + Projectile.timeLeft = 2; + + Time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 500); + + Player player = Main.player[Projectile.owner]; + Vector2 spawnPos = Projectile.Center + (Projectile.velocity.RotatedBy(MathHelper.ToRadians(45f * Projectile.direction)) * 10) + Main.rand.NextVector2Circular(13, 13); + for (int i = 0; i <= 3; i++) + { + spawnPos = Projectile.Center + (Projectile.velocity.RotatedBy(MathHelper.ToRadians(45f * Projectile.direction)) * 10) + Main.rand.NextVector2Circular(13, 13); + Particle blood = new PointParticle(spawnPos, (Projectile.velocity * 30).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.9f) + new Vector2(0, Main.rand.NextFloat(-7, -2 + 1)), true, 25, Main.rand.NextFloat(0.7f, 1.2f), (Main.rand.NextBool() ? Color.Green : Color.Purple) * 0.5f, false); + GeneralParticleHandler.SpawnParticle(blood); + + Dust dust = Dust.NewDustPerfect(spawnPos, 263, (Projectile.velocity * 50).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.05f, 0.9f), 0, default, Main.rand.NextFloat(0.6f, 0.95f)); + dust.noGravity = true; + dust.color = Color.White; + } + + SoundStyle fire = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit", 2); + SoundEngine.PlaySound(fire with { Volume = 0.55f, Pitch = 0.3f }, Projectile.Center); + + if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) + return; + + int heal = Main.rand.NextBool(4) ? 2 : 1; + player.lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; + } + + public void PlayChainsawSounds() + { + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.Item22 with { Pitch = 0.3f}, Projectile.Center); + Projectile.soundDelay = 6; + } + } + public void DetermineVisuals(Vector2 playerRotatedPosition) + { + float directionAngle = Projectile.velocity.ToRotation(); + Projectile.rotation = directionAngle; + + int oldDirection = Projectile.spriteDirection; + if (oldDirection == -1) + Projectile.rotation += MathHelper.Pi; + + Projectile.direction = Projectile.spriteDirection = (Math.Cos(directionAngle) > 0).ToDirectionInt(); + + // If the direction differs from what it originaly was, undo the previous 180 degree turn. + // If this is not done, the chainsaw will have 1 frame of rotational "jitter" when the direction changes based on the + // original angle. This effect looks very strange in-game. + if (Projectile.spriteDirection != oldDirection) + Projectile.rotation -= MathHelper.Pi; + + // Positioning close to the player's arm. + Projectile.position = playerRotatedPosition - Projectile.Size * 0.5f + (directionAngle.ToRotationVector2().RotatedBy(MathHelper.ToRadians(-45f * Projectile.direction)) * 10f) + directionAngle.ToRotationVector2() * 30; + + // Update the position a tiny bit every frame at random to make it look like the saw is vibrating. + // It is reset on the next frame. + Projectile.position += Main.rand.NextVector2Circular(1.4f, 1.4f); + + Projectile.frameCounter += 33; + if (Projectile.frameCounter >= 32) + { + Projectile.frame = (Projectile.frame + 1) % 4; + Projectile.frameCounter = 0; + } + } + + public void HandleChannelMovement(Vector2 playerRotatedPosition) + { + Vector2 idealAimDirection = (Main.MouseWorld - playerRotatedPosition).SafeNormalize(Vector2.UnitX * Owner.direction); + + float angularAimVelocity = 0.15f; + float directionAngularDisparity = Projectile.velocity.AngleBetween(idealAimDirection) / MathHelper.Pi; + + // Increase the turn speed if close to the ideal direction, since successive linear interpolations + // are asymptotic. + angularAimVelocity += MathHelper.Lerp(0f, 0.25f, Utils.GetLerpValue(0.28f, 0.08f, directionAngularDisparity, true)); + + if (directionAngularDisparity > 0.02f) + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealAimDirection, angularAimVelocity); + else + Projectile.velocity = idealAimDirection; + + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); + } + + public void ManipulatePlayerValues() + { + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.ChangeDir(Projectile.direction); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + // Collision is done as a line to bypass the fact that hitboxes cannot rotate and that + // this projectile is notably flat in terms of sprite shape. + float _ = 0f; + float width = Projectile.scale * 36f; + Vector2 start = Projectile.Center; + Vector2 end = Projectile.Center + Projectile.velocity * 60f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, width, ref _); + } + } +} diff --git a/Projectiles/Melee/RespiteblockHoldout.png b/Projectiles/Melee/RespiteblockHoldout.png new file mode 100644 index 0000000000..fa4fc9b55e Binary files /dev/null and b/Projectiles/Melee/RespiteblockHoldout.png differ diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index d78dc5d844..f93eefbdd9 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public class BansheeHookProj : BaseSpearProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override void SetDefaults() { Projectile.width = 40; @@ -38,8 +39,9 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity * 0.5f, Projectile.velocity * 0.8f, ModContent.ProjectileType(), - Projectile.damage, Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); + (int)(Projectile.damage * 0.85f), Projectile.knockBack * 0.85f, Projectile.owner); }; + public override void ExtraBehavior() { Player player = Main.player[Projectile.owner]; @@ -123,13 +125,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), - target.Center, Vector2.Zero, - ModContent.ProjectileType(), (int)(hit.Damage * 0.25), - 10f, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(hit.Damage * 0.25), hit.Knockback * 0.25f, Projectile.owner); } } } diff --git a/Projectiles/Melee/WhiteBoltAura.cs b/Projectiles/Melee/WhiteBoltAura.cs index d361a79873..f6778cd633 100644 --- a/Projectiles/Melee/WhiteBoltAura.cs +++ b/Projectiles/Melee/WhiteBoltAura.cs @@ -43,8 +43,9 @@ namespace CalamityMod.Projectiles.Melee } } } + Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 10f) + if (Projectile.localAI[0] >= 20f) { Projectile.localAI[0] = 0f; int projTimer = 0; @@ -70,5 +71,7 @@ namespace CalamityMod.Projectiles.Melee } } } + + public override bool? CanDamage() => false; } } diff --git a/Projectiles/Melee/WhiteOrb.cs b/Projectiles/Melee/WhiteOrb.cs index 84ae9ebcf4..75df233253 100644 --- a/Projectiles/Melee/WhiteOrb.cs +++ b/Projectiles/Melee/WhiteOrb.cs @@ -25,13 +25,11 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); - for (int i = 0; i < 2; i++) - { - int shiny = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemDiamond, 0f, 0f, 100, default, 1.25f); - Main.dust[shiny].noGravity = true; - Main.dust[shiny].velocity *= 0.5f; - Main.dust[shiny].velocity += Projectile.velocity * 0.1f; - } + + int shiny = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemDiamond, 0f, 0f, 100, default, 1.25f); + Main.dust[shiny].noGravity = true; + Main.dust[shiny].velocity *= 0.5f; + Main.dust[shiny].velocity += Projectile.velocity * 0.1f; } } } diff --git a/Projectiles/Melee/Whiterain.cs b/Projectiles/Melee/Whiterain.cs index 6e7978918c..0bf0617dfa 100644 --- a/Projectiles/Melee/Whiterain.cs +++ b/Projectiles/Melee/Whiterain.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item125 with { Volume = 0.7f }, Projectile.Center); } Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[shiny].velocity += Projectile.velocity * 0.1f; } - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, true, 320f, 14f, 20f); } } } diff --git a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs index 4475b6d6b5..f43f41c800 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 30f * MaxUpdates; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 320f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 330f; ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 32f / MaxUpdates; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; diff --git a/Projectiles/Melee/Yoyos/AortaYoyo.cs b/Projectiles/Melee/Yoyos/AortaYoyo.cs index 50fc877468..64dd6c5d35 100644 --- a/Projectiles/Melee/Yoyos/AortaYoyo.cs +++ b/Projectiles/Melee/Yoyos/AortaYoyo.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 24f * MaxUpdates; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 320f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 330f; ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 25f / MaxUpdates; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; diff --git a/Projectiles/Ranged/Aquashard.cs b/Projectiles/Ranged/Aquashard.cs index 4194e268b6..b07fbb4dd9 100644 --- a/Projectiles/Ranged/Aquashard.cs +++ b/Projectiles/Ranged/Aquashard.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.extraUpdates = 1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < projAmt; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), 0f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index f044a6e80b..0fc3c0e6eb 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -17,18 +17,19 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.timeLeft = 180; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 1; Projectile.aiStyle = ProjAIStyleID.Arrow; } - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 280 && target.CanBeChasedBy(Projectile); public override void AI() { Projectile.velocity.X *= 0.9995f; Projectile.velocity.Y += 0.01f; - if (Projectile.timeLeft < 150) + if (Projectile.timeLeft < 280) CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, Projectile.ai[1] == 1f ? 8f : 6f, 20f); } diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index 52af9cd48f..6f18a4673f 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -186,7 +186,7 @@ namespace CalamityMod.Projectiles.Ranged { if (!Main.player[Projectile.owner].moonLeech) { - int bonusHeal = Main.rand.NextBool(3) ? 6 : 4; + int bonusHeal = Main.rand.NextBool(3) ? 5 : 3; int heal = improvedHeal ? bonusHeal : 2; if (Main.player[Main.myPlayer].lifeSteal <= 0f) diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index 82c8855ae5..1d96edd43d 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -43,9 +43,9 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 90); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 90); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 240); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Ranged/ChargedBlast.cs b/Projectiles/Ranged/ChargedBlast.cs index caacfc330d..30a3a8ef6f 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -1,4 +1,7 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -10,7 +13,14 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/LaserProj"; - + public Color baseColor = Color.White; + public bool outOfTime = false; + public Vector2 baseVel; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } public override void SetDefaults() { Projectile.width = 5; @@ -18,43 +28,78 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.MaxUpdates = 2; - Projectile.alpha = 255; + Projectile.extraUpdates = 6; Projectile.timeLeft = 360; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { - if (Projectile.alpha > 0) - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; + bool Shredder = Projectile.ai[2] == 0; + bool Infinity = Projectile.ai[2] == 1; + bool Svant = Projectile.ai[2] == 2 || Projectile.ai[2] == 3 || Projectile.ai[2] == 4; - float lightScale = 1f - Projectile.alpha / 255f; - Projectile.ai[2] = lightScale; - Lighting.AddLight(Projectile.Center, 0f, 0.3f * lightScale, 0.7f * lightScale); + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - float beamLength = 60f; - float beamLengthGrowth = 1f; - Projectile.localAI[0] += beamLengthGrowth; - if (Projectile.localAI[0] > beamLength) - Projectile.localAI[0] = beamLength; - } - - public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0) * Projectile.ai[2]; - - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item62, Projectile.position); - int projectiles = 2; - if (Projectile.owner == Main.myPlayer) + if (baseColor == Color.White) { - for (int k = 0; k < projectiles; k++) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2CircularEdge(5f, 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.8f, Main.myPlayer); + baseColor = (Infinity ? new Color(229, 49, 39) : Svant ? Color.DarkViolet : Color.DodgerBlue); + if (Projectile.ai[2] == 3) + { + baseColor = Color.DarkOrchid; + } + if (Projectile.ai[2] == 4) + { + baseColor = Color.MediumOrchid; + } + baseVel = Projectile.velocity; + if (Svant) + Projectile.ArmorPenetration = 100; + if (Infinity) + Projectile.ArmorPenetration = 25; + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.timeLeft == 2) + outOfTime = true; + if ((Svant || Infinity) && Projectile.timeLeft % 2 == 0 && targetDist < 1400f && Projectile.timeLeft < 340) + { + Particle spark = new LineParticle(Projectile.Center - Projectile.velocity * 3, -Projectile.velocity * 0.05f, false, 5, 2f, baseColor * 0.65f); + GeneralParticleHandler.SpawnParticle(spark); } } + public override void OnKill(int timeLeft) + { + if (!outOfTime) + { + SoundEngine.PlaySound(SoundID.Item62, Projectile.Center); + int projectiles = 2; + if (Projectile.owner == Main.myPlayer) + { + for (int k = 0; k < projectiles; k++) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, -baseVel.RotatedByRandom(0.9f) * Main.rand.NextFloat(0.6f, 0.7f), ModContent.ProjectileType(), (int)(Projectile.damage * (Projectile.ai[2] > 0 ? 0.3f : 0.5f)), Projectile.knockBack * 0.8f, Main.myPlayer, 0, 0, Projectile.ai[2]); + } + for (int k = 0; k < 3; k++) + { + Particle spark2 = new LineParticle(Projectile.Center, (-baseVel * 4).RotatedByRandom(0.9f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(25, 32 + 1), Main.rand.NextFloat(1.5f, 2f), baseColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Projectile.ai[2] == 1) + { + Particle spark2 = new LineParticle(Projectile.Center, (-baseVel * 5).RotatedByRandom(0.9f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(35, 48 + 1), Main.rand.NextFloat(2.3f, 3f), baseColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + } + public override bool PreDraw(ref Color lightColor) + { + if (baseColor == Color.White) + return false; + Texture2D texture = ModContent.Request("CalamityMod/Particles/DrainLineBloom").Value; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], (baseColor * 0.7f) with { A = 0 }, 1, texture); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, baseColor with { A = 0 }, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20, targetHitbox); } } diff --git a/Projectiles/Ranged/ChargedBlast2.cs b/Projectiles/Ranged/ChargedBlast2.cs deleted file mode 100644 index 89318cc187..0000000000 --- a/Projectiles/Ranged/ChargedBlast2.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ChargedBlast2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/LaserProj"; - - public override void SetDefaults() - { - Projectile.width = 5; - Projectile.height = 5; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 3; - Projectile.MaxUpdates = 2; - Projectile.alpha = 255; - Projectile.timeLeft = 180; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - if (Projectile.timeLeft < 60) - { - Projectile.alpha += 5; - if (Projectile.alpha >= 255) - Projectile.Kill(); - } - else - { - if (Projectile.alpha > 0) - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - - float lightScale = 1f - Projectile.alpha / 255f; - Projectile.ai[2] = lightScale; - Lighting.AddLight(Projectile.Center, 0f, 0.3f * lightScale, 0.7f * lightScale); - - float beamLength = 30f; - float beamLengthGrowth = 0.5f; - Projectile.localAI[0] += beamLengthGrowth; - if (Projectile.localAI[0] > beamLength) - Projectile.localAI[0] = beamLength; - } - - public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0) * Projectile.ai[2]; - - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); - - public override bool OnTileCollide(Vector2 oldVelocity) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); - } - else - { - if (Projectile.velocity.X != oldVelocity.X) - Projectile.velocity.X = -oldVelocity.X; - if (Projectile.velocity.Y != oldVelocity.Y) - Projectile.velocity.Y = -oldVelocity.Y; - } - - return false; - } - } -} diff --git a/Projectiles/Ranged/ChargedBlastSplit.cs b/Projectiles/Ranged/ChargedBlastSplit.cs new file mode 100644 index 0000000000..fb72db7217 --- /dev/null +++ b/Projectiles/Ranged/ChargedBlastSplit.cs @@ -0,0 +1,143 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities.Terraria.Utilities; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ChargedBlastSplit : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public Color baseColor = Color.White; + public int tileHits = 4; + public Vector2 startVel; + public bool goToMouse = true; + bool direction; + public float homeSpeed; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 3; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 240; + Projectile.scale = 0.7f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + bool Shredder = Projectile.ai[2] == 0; + bool Infinity = Projectile.ai[2] == 1; + bool Svant = Projectile.ai[2] == 2 || Projectile.ai[2] == 3 || Projectile.ai[2] == 4; + + if (baseColor == Color.White) + { + baseColor = (Infinity ? new Color(229, 49, 39) : Svant ? Color.DarkViolet : Color.DodgerBlue); + if (Projectile.ai[2] == 3) + baseColor = Color.DarkOrchid; + if (Projectile.ai[2] == 4) + baseColor = Color.MediumOrchid; + startVel = Projectile.velocity; + if (Infinity) + { + Projectile.timeLeft = 340; + Projectile.ArmorPenetration = 25; + } + if (Svant) + { + Projectile.timeLeft = 640; + Projectile.ArmorPenetration = 100; + } + direction = Main.rand.NextBool(); + homeSpeed = Main.rand.NextFloat(5, 8); + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Projectile.timeLeft < 290 && Infinity) + { + Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, -startVel.X, 0.02f); + Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, -startVel.Y, 0.02f); + } + if (Projectile.timeLeft <= 500 && Svant && goToMouse && Projectile.timeLeft % Projectile.extraUpdates == 0) + { + Vector2 mouseSpot = (player.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * homeSpeed; + Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, mouseSpot.X, 0.085f); + Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, mouseSpot.Y, 0.085f); + if (Vector2.Distance(Projectile.Center, player.Calamity().mouseWorld) < 80) + { + Projectile.timeLeft = 300; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * homeSpeed / 2; + goToMouse = false; + } + } + if (!goToMouse) + { + float sine = (float)Math.Sin(Projectile.timeLeft * 0.175f / MathHelper.Pi) * 1.2f; + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (direction ? 1 : -1); + Projectile.Center += offset; + } + if (Infinity || Svant) + { + Projectile.tileCollide = false; + Projectile.penetrate = -1; + } + } + public override void OnKill(int timeLeft) + { + bool Svant = Projectile.ai[2] == 2 || Projectile.ai[2] == 3 || Projectile.ai[2] == 4; + for (int k = 0; k < (Svant ? 2 : 3); k++) + { + Particle spark2 = new LineParticle(Projectile.Center, (Projectile.velocity * 5).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(8, 11 + 1), Main.rand.NextFloat(0.5f, 1f), baseColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + + } + public override bool PreDraw(ref Color lightColor) + { + if (baseColor == Color.White) + return false; + Texture2D texture = ModContent.Request("CalamityMod/Particles/DrainLineBloom").Value; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], (baseColor * 0.7f) with { A = 0 }, 1, texture); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, baseColor with { A = 0 }, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 10, targetHitbox); + + public override bool OnTileCollide(Vector2 oldVelocity) + { + tileHits--; + if (tileHits <= 0) + { + Projectile.Kill(); + } + else + { + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; + } + + return false; + } + } +} diff --git a/Projectiles/Ranged/HolyFireBulletProj.cs b/Projectiles/Ranged/HolyFireBulletProj.cs index d02a941194..501562259e 100644 --- a/Projectiles/Ranged/HolyFireBulletProj.cs +++ b/Projectiles/Ranged/HolyFireBulletProj.cs @@ -87,6 +87,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.damage = (int)(Projectile.damage * HolyFireBullet.ExplosionMultiplier); Projectile.penetrate = -1; Projectile.ExpandHitboxBy((25 * SizeVariance) * SizeBonus); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; Projectile.Damage(); } SoundEngine.PlaySound(HolyFireBullet.Explosion with { Pitch = -0.15f, Volume = 0.3f }, Projectile.Center); diff --git a/Projectiles/Ranged/KingsbaneHoldout.cs b/Projectiles/Ranged/KingsbaneHoldout.cs index 7d27d3545b..09d7d84584 100644 --- a/Projectiles/Ranged/KingsbaneHoldout.cs +++ b/Projectiles/Ranged/KingsbaneHoldout.cs @@ -99,9 +99,12 @@ namespace CalamityMod.Projectiles.Ranged //recoil Owner.velocity += -Projectile.velocity * fullRevShots * (Main.zenithWorld ? 0.028f : 0.013f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition + Projectile.velocity * 5 + Main.rand.NextVector2Circular(7, 7), shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), ModContent.ProjectileType(), (int)(Projectile.damage * 0.9f), Projectile.knockBack, Projectile.owner); - SoundEngine.PlaySound(SoundID.Item40 with { PitchVariance = 0.4f }, Projectile.Center); + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmall"); + if (fullRevShots % 2 == 0) + SoundEngine.PlaySound(fire with { Volume = 0.8f }, Projectile.Center); + //SoundEngine.PlaySound(SoundID.Item40 with { PitchVariance = 0.4f }, Projectile.Center); Owner.channel = true; - //SoundEngine.PlaySound(Kingsbane.AuricFire with { PitchVariance = 0.4f }, Projectile.Center); + fullRevShots--; } } @@ -129,7 +132,8 @@ namespace CalamityMod.Projectiles.Ranged dust3.scale = Main.rand.NextFloat(0.9f, 1.6f); } Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); - SoundEngine.PlaySound(SoundID.Item41 with { Volume = 0.75f }, Projectile.Center); + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotMid"); + SoundEngine.PlaySound(fire with { Volume = 0.6f }, Projectile.Center); framesBetweenShots = 3; } if (framesBetweenShots > 0) diff --git a/Projectiles/Ranged/ShadeFire.cs b/Projectiles/Ranged/ShadeFire.cs index 0bb282dd6b..805fe68972 100644 --- a/Projectiles/Ranged/ShadeFire.cs +++ b/Projectiles/Ranged/ShadeFire.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 3; Projectile.timeLeft = Lifetime; // 20 effectively Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 15; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index b3a9087d3e..59ecdedeb3 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -24,10 +24,10 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 255; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.timeLeft = 180; + Projectile.timeLeft = 240; } - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 200 && target.CanBeChasedBy(Projectile); public override void AI() { diff --git a/Projectiles/Summon/FleshBlood.cs b/Projectiles/Summon/FleshBlood.cs index 1a850a0e03..cb94a352f8 100644 --- a/Projectiles/Summon/FleshBlood.cs +++ b/Projectiles/Summon/FleshBlood.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minion = true; Projectile.penetrate = 1; Projectile.timeLeft = LifeTime; + Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Typeless/BasicPlagueBee.cs b/Projectiles/Typeless/BasicPlagueBee.cs index a3ea930c7b..6122f85d3a 100644 --- a/Projectiles/Typeless/BasicPlagueBee.cs +++ b/Projectiles/Typeless/BasicPlagueBee.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.penetrate = 2; Projectile.timeLeft = 300; Projectile.ignoreWater = true; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; } public override void AI() @@ -81,9 +81,8 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 303, -Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.2f, 0.6f), 0, default, Main.rand.NextFloat(0.35f, 0.55f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 89, -Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.2f, 0.6f), 0, default, Main.rand.NextFloat(0.5f, 0.8f)); dust.noGravity = true; - dust.color = Color.Black; dust.alpha = Main.rand.Next(90, 220 + 1); } } @@ -125,7 +124,7 @@ namespace CalamityMod.Projectiles.Typeless center.X = Projectile.Center.X + Projectile.velocity.X * 100f; center.Y = Projectile.Center.Y + Projectile.velocity.Y * 100f; } - float speed = 10f; + float speed = 8f; float velocityTweak = 0.30f; Vector2 projPos = Projectile.Center; Vector2 velocity = center - projPos; @@ -202,7 +201,11 @@ namespace CalamityMod.Projectiles.Typeless } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), (int)(Projectile.ai[1])); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), (int)(Projectile.ai[1])); + Projectile.ai[0] = 15; + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), (int)(Projectile.ai[1])); diff --git a/Projectiles/Typeless/CoralBubble.cs b/Projectiles/Typeless/CoralBubble.cs index 35ffc0fa32..c3218486a7 100644 --- a/Projectiles/Typeless/CoralBubble.cs +++ b/Projectiles/Typeless/CoralBubble.cs @@ -20,6 +20,11 @@ namespace CalamityMod.Projectiles.Typeless Projectile.penetrate = 1; } + public override bool? CanCutTiles() + { + return false; + } + public override void AI() { if (Projectile.localAI[0] > 2f) diff --git a/Projectiles/Typeless/CoralBubbleSmall.cs b/Projectiles/Typeless/CoralBubbleSmall.cs index 9732d39497..1ab46a05b0 100644 --- a/Projectiles/Typeless/CoralBubbleSmall.cs +++ b/Projectiles/Typeless/CoralBubbleSmall.cs @@ -23,6 +23,11 @@ namespace CalamityMod.Projectiles.Typeless Projectile.penetrate = 1; } + public override bool? CanCutTiles() + { + return false; + } + public override void AI() { if (Projectile.localAI[0] > 2f) diff --git a/Projectiles/Typeless/LeviAmberDash.cs b/Projectiles/Typeless/LeviAmberDash.cs index 7e9848ebc4..627a1b1aad 100644 --- a/Projectiles/Typeless/LeviAmberDash.cs +++ b/Projectiles/Typeless/LeviAmberDash.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.CalPlayer; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -34,11 +35,13 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.boss && target.IsAnEnemy(true, true)) + bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust; + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false)) { target.velocity.Y += -1.8f; target.velocity.X += 4.2f * Owner.direction; } + target.AddBuff(BuffID.Wet, 300); target.AddBuff(ModContent.BuffType(), 180); SoundEngine.PlaySound(SoundID.Item85 with { Volume = 0.4f, PitchVariance = 0.4f }, Projectile.Center); diff --git a/Projectiles/Typeless/PlaguePulse.cs b/Projectiles/Typeless/PlaguePulse.cs new file mode 100644 index 0000000000..c9439dbd73 --- /dev/null +++ b/Projectiles/Typeless/PlaguePulse.cs @@ -0,0 +1,99 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using CalamityMod.Particles; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using SteelSeries.GameSense; +using CalamityMod.Buffs.DamageOverTime; +using Mono.Cecil; + +namespace CalamityMod.Projectiles.Typeless +{ + public class PlaguePulse : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public ref float radius => ref Projectile.ai[1]; + public float maxRadius = 300; + public int startDamage; + public override void SetDefaults() + { + Projectile.width = 96; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.extraUpdates = 1; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (time == 0) + startDamage = Projectile.damage; + + Player player = Main.player[Projectile.owner]; + if (Projectile.ai[2] == 0) + Projectile.Center = player.MountedCenter; + if (Projectile.ai[2] == 1) + { + maxRadius = 200; + } + + if (Main.rand.NextBool(5)) + { + DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center + Main.rand.NextVector2Circular(radius, radius), Vector2.Zero, (Main.rand.NextBool(3) ? Color.LimeGreen : Color.Green) * 0.6f, new Vector2(1, 1), 0, Main.rand.NextFloat(0.07f, 0.23f), 0f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + } + if (Main.rand.NextBool(3)) + { + for (int i = 0; i < 2; i++) + { + int DustID = 89; + Vector2 spawnPos = Projectile.Center + Main.rand.NextVector2Circular(radius, radius); + Dust dust2 = Dust.NewDustPerfect(spawnPos, DustID); + dust2.scale = Main.rand.NextFloat(0.5f, 0.9f); + dust2.velocity = (spawnPos - Projectile.Center).SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(5, 10); + dust2.noGravity = true; + } + } + + radius = Utils.Remap(time, 0, 60, 30, maxRadius, true); + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.85f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Player player = Main.player[Projectile.owner]; + target.AddBuff(ModContent.BuffType(), 420); + + if (target.life <= 0) + { + player.Heal(10); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(startDamage * 0.8f), 0f, Projectile.owner, 0, 0, 1); + } + } + public override bool PreDraw(ref Color lightColor) + { + Player player = Main.player[Projectile.owner]; + + Texture2D rexture = ModContent.Request("CalamityMod/Particles/HighResHollowCircleHardEdge").Value; + Main.EntitySpriteDraw(rexture, Projectile.Center - Main.screenPosition, null, (Color.Green * Utils.Remap(time, 30, 60, 0.35f, 0, true)) with { A = 0 }, Projectile.rotation, rexture.Size() * 0.5f, (Utils.Remap(time, 0, 60, 1, 6, true) / 21) * (maxRadius == 300 ? 1 : 0.7f), SpriteEffects.None, 0); + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); + } +} diff --git a/Skies/AstralSurfaceCloseGlow.png b/Skies/AstralSurfaceCloseGlow.png new file mode 100644 index 0000000000..3fafef6c36 Binary files /dev/null and b/Skies/AstralSurfaceCloseGlow.png differ diff --git a/Skies/AstralSurfaceFrontGlow.png b/Skies/AstralSurfaceFrontGlow.png new file mode 100644 index 0000000000..6fca957aaa Binary files /dev/null and b/Skies/AstralSurfaceFrontGlow.png differ diff --git a/Skies/AstralSurfaceMiddleGlow.png b/Skies/AstralSurfaceMiddleGlow.png new file mode 100644 index 0000000000..30f1c4e6d6 Binary files /dev/null and b/Skies/AstralSurfaceMiddleGlow.png differ diff --git a/Sounds/Custom/MossMine.ogg b/Sounds/Custom/MossMine.ogg new file mode 100644 index 0000000000..dc05fe4cb8 Binary files /dev/null and b/Sounds/Custom/MossMine.ogg differ diff --git a/Sounds/Item/GunShotBig.ogg b/Sounds/Item/GunShotBig.ogg new file mode 100644 index 0000000000..b3a4c111d6 Binary files /dev/null and b/Sounds/Item/GunShotBig.ogg differ diff --git a/Sounds/Item/GunShotHeavy.ogg b/Sounds/Item/GunShotHeavy.ogg new file mode 100644 index 0000000000..b5f0892a2c Binary files /dev/null and b/Sounds/Item/GunShotHeavy.ogg differ diff --git a/Sounds/Item/GunShotMid.ogg b/Sounds/Item/GunShotMid.ogg new file mode 100644 index 0000000000..45d9fa7160 Binary files /dev/null and b/Sounds/Item/GunShotMid.ogg differ diff --git a/Sounds/Item/GunShotSmall.ogg b/Sounds/Item/GunShotSmall.ogg new file mode 100644 index 0000000000..4efc70fb90 Binary files /dev/null and b/Sounds/Item/GunShotSmall.ogg differ diff --git a/Sounds/Item/GunShotSmallHeavy.ogg b/Sounds/Item/GunShotSmallHeavy.ogg new file mode 100644 index 0000000000..b23c4ff131 Binary files /dev/null and b/Sounds/Item/GunShotSmallHeavy.ogg differ diff --git a/Sounds/Item/Heartbeat.ogg b/Sounds/Item/Heartbeat.ogg index b0121df73c..f0a789db21 100644 Binary files a/Sounds/Item/Heartbeat.ogg and b/Sounds/Item/Heartbeat.ogg differ diff --git a/Systems/BiomeTileCounterSystem.cs b/Systems/BiomeTileCounterSystem.cs index 252b0236de..4c96f125a0 100644 --- a/Systems/BiomeTileCounterSystem.cs +++ b/Systems/BiomeTileCounterSystem.cs @@ -4,6 +4,7 @@ using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.FloralParadise; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; @@ -16,10 +17,15 @@ namespace CalamityMod.Systems { public static int BrimstoneCragTiles = 0; public static int SulphurTiles = 0; - public static int AbyssTiles = 0; public static int AstralTiles = 0; public static int SunkenSeaTiles = 0; + public static int SunkenSeaShoresTiles = 0; + public static int SunkenSeaPolypTiles = 0; + public static int SunkenSeaReefsTiles = 0; + public static int SunkenSeaBurrowsTiles = 0; public static int ArsenalLabTiles = 0; + public static int AbyssTiles = 0; + public static int FloralParadiseTiles = 0; public static int Layer1Tiles = 0; public static int Layer2Tiles = 0; @@ -31,6 +37,10 @@ namespace CalamityMod.Systems BrimstoneCragTiles = 0; AstralTiles = 0; SunkenSeaTiles = 0; + SunkenSeaShoresTiles = 0; + SunkenSeaPolypTiles = 0; + SunkenSeaReefsTiles = 0; + SunkenSeaBurrowsTiles = 0; SulphurTiles = 0; AbyssTiles = 0; ArsenalLabTiles = 0; @@ -39,14 +49,20 @@ namespace CalamityMod.Systems Layer2Tiles = 0; Layer3Tiles = 0; Layer4Tiles = 0; + FloralParadiseTiles = 0; } public override void TileCountsAvailable(ReadOnlySpan tileCounts) { BrimstoneCragTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaTiles = tileCounts[ModContent.TileType()] + 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()]; + SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + + tileCounts[ModContent.TileType()]; + SunkenSeaPolypTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaReefsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaBurrowsTiles = 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()]; Layer1Tiles = tileCounts[ModContent.TileType()]; diff --git a/Systems/MusicEventSystem.cs b/Systems/MusicEventSystem.cs new file mode 100644 index 0000000000..803a27df18 --- /dev/null +++ b/Systems/MusicEventSystem.cs @@ -0,0 +1,310 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using CalamityMod.NPCs; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Systems +{ + public record class MusicEventEntry(string Id, int Song, TimeSpan Length, TimeSpan IntroSilence, TimeSpan OutroSilence, Func ShouldPlay, Func Enabled); + + public class MusicEventSystem : ModSystem + { + #region Statics + + public static MusicEventEntry CurrentEvent { get; set; } = null; + + public static DateTime? TrackStart { get; set; } = null; + + // This allows for some additional silence at the end of a track + public static DateTime? TrackEnd { get; set; } = null; + + public static int LastPlayedEvent { get; set; } = -1; + + public static TimeSpan? OutroSilence { get; set; } = null; + + // This allows skipping track fade in + public static bool NoFade { get; set; } = false; + + public static Thread EventTrackerThread { get; set; } = null; + + public static List PlayedEvents { get; set; } = []; + + public static List EventCollection { get; set; } = []; + + // This is to make sure that old worlds don't immediately queue a bunch of tracks on player entry + private static bool oldWorld { get; set; } = true; + + #endregion + + #region Events List + + public override void OnModLoad() + { + static void AddEntry(string eventId, string songName, TimeSpan length, Func shouldPlay, Func enabled, TimeSpan? introSilence = null, TimeSpan? outroSilence = null) + { + MusicEventEntry entry = new(eventId, CalamityMod.Instance.GetMusicFromMusicMod(songName).Value, length, introSilence ?? TimeSpan.Zero, outroSilence ?? TimeSpan.Zero, shouldPlay, enabled); + EventCollection.Add(entry); + } + + AddEntry("CloneDefeated", "Interlude1", TimeSpan.FromSeconds(214.577d), + () => DownedBossSystem.downedCalamitasClone, () => CalamityConfig.Instance.Interlude1); + + AddEntry("MLDefeated", "Interlude2", TimeSpan.FromSeconds(191.912d), () => NPC.downedMoonlord, + () => CalamityConfig.Instance.Interlude2, outroSilence: TimeSpan.FromSeconds(1f)); + + // Alternative Interlude 2 -> AddEntry("MLDefeated", "Interlude2_CutIntro", TimeSpan.FromSeconds(160.989d), + // () => NPC.downedMoonlord, () => CalamityConfig.Instance.Interlude2, + // outroSilence: TimeSpan.FromSeconds(1f)); + + AddEntry("YharonDefeated", "Interlude3", TimeSpan.FromSeconds(295.932d), + () => DownedBossSystem.downedYharon, () => CalamityConfig.Instance.Interlude3); + + AddEntry("DoGDefeated", "DevourerofGodsEulogy", TimeSpan.FromSeconds(203.620d), + () => DownedBossSystem.downedDoG, () => CalamityConfig.Instance.DevourerofGodsEulogy, + introSilence: TimeSpan.FromSeconds(7.5f)); + + // Acceptance is NOT toggleable in the config + AddEntry("ScalDefeated", "CalamitasDefeat_LongFade", TimeSpan.FromSeconds(58.689d), + () => CalamityGlobalNPC.SCalAcceptance != -1, () => true); + } + + public override void Unload() => EventCollection.Clear(); + + #endregion + + #region Event Handling + + public override void PostUpdateTime() + { + // If the player has already completed conditions to trigger certain music events, we don't + // want to queue a bunch of tracks to play as soon as they enter the world, so instead just mark them as played + if (oldWorld) + { + foreach (MusicEventEntry entry in EventCollection) + { + if (entry.ShouldPlay()) + PlayedEvents.Add(entry.Id); + } + + oldWorld = false; + } + + //PlayedEvents.Remove("MLDefeated"); + + // If the event has just finished, we want a little silence before fading back to normal + if (TrackEnd is not null) + { + // `silence` is the time after a track ends before music goes back to normal + TimeSpan silence = OutroSilence.Value; + TimeSpan postTrack = DateTime.Now - TrackEnd.Value; + + // Play silence for the time specified + if (postTrack < silence) + { + int silenceSlot = MusicLoader.GetMusicSlot(Mod, "Sounds/Music/Silence"); + Main.musicBox2 = silenceSlot; + } + + else + { + LastPlayedEvent = -1; + TrackEnd = null; + OutroSilence = null; + } + + return; + } + + // Only check for new events to play if none is currently playing + // This makes sure events always finish before a new one starts + if (CurrentEvent is null) + { + foreach (MusicEventEntry musicEvent in EventCollection) + { + // Make sure the event hasn't already played and SHOULD play + if (!PlayedEvents.Contains(musicEvent.Id) && musicEvent.ShouldPlay()) + { + // Even if an event isn't marked as enabled, it should be counted + // as "played" so it isn't played when the player doesn't expect it + PlayedEvents.Add(musicEvent.Id); + + // Events are always enabled on the server + if (Main.dedServ || musicEvent.Enabled()) + { + // Assign the current event and start time + CurrentEvent = musicEvent; + TrackStart = DateTime.Now + musicEvent.IntroSilence; + + // On clients, use a background thread to make sure the track always plays for exactly + // the specified length, regardless of if the game gets minimized, lags, or time becomes + // detangled from a consistent 60fps in any other way + if (!Main.dedServ) + { + EventTrackerThread = new(WatchMusicEvent); + EventTrackerThread.Start(); + } + + break; + } + } + } + } + + if (TrackStart is not null) + { + if (TrackStart > DateTime.Now) + { + int silenceSlot = MusicLoader.GetMusicSlot(Mod, "Sounds/Music/Silence"); + Main.musicBox2 = silenceSlot; + NoFade = true; + } + + else + { + Main.musicBox2 = CurrentEvent.Song; + + if (NoFade) + { + Main.musicFade[CurrentEvent.Song] = 1f; + NoFade = false; + } + + // If the event has finished playing, mark the end as now and clear the current event + if (DateTime.Now - TrackStart >= CurrentEvent.Length) + { + int silenceSlot = MusicLoader.GetMusicSlot(Mod, "Sounds/Music/Silence"); + Main.musicBox2 = silenceSlot; + Main.musicFade[CurrentEvent.Song] = 0f; + + TrackEnd = DateTime.Now; + LastPlayedEvent = CurrentEvent.Song; + OutroSilence = CurrentEvent.OutroSilence; + + TrackStart = null; + CurrentEvent = null; + } + } + } + } + + /// + /// Watches for the game minimizing at any point, and adjusts the amount of time to play the song for accordingly + /// + public static void WatchMusicEvent() + { + DateTime? minimized = null; + + while (CurrentEvent is not null) + { + bool musicPaused = !Main.instance.IsActive; + + if (musicPaused && !minimized.HasValue) + minimized = DateTime.Now; + + else if (!musicPaused && minimized.HasValue) + { + TrackStart += DateTime.Now - minimized.Value; + minimized = null; + } + } + + EventTrackerThread = null; + } + + #endregion + + #region Event Saving + + public override void SaveWorldData(TagCompound tag) + { + tag["calamityPlayedMusicEventCount"] = PlayedEvents.Count; + for (int i = 0; i < PlayedEvents.Count; i++) + tag[$"calamityPlayedMusicEvent{i}"] = PlayedEvents[i]; + } + + public override void LoadWorldData(TagCompound tag) + { + PlayedEvents.Clear(); + + if (tag.TryGet("calamityPlayedMusicEventCount", out int playedMusicEventCount)) + { + for (int i = 0; i < playedMusicEventCount; i++) + { + if (tag.TryGet($"calamityPlayedMusicEvent{i}", out string playedEvent)) + PlayedEvents.Add(playedEvent); + } + } + + oldWorld = false; + } + + public override void OnWorldUnload() + { + oldWorld = true; + TrackStart = null; + TrackEnd = null; + CurrentEvent = null; + PlayedEvents.Clear(); + NoFade = false; + LastPlayedEvent = -1; + } + + #endregion + + #region Event Syncing + + public static void SendSyncRequest() + { + ModPacket packet = CalamityMod.Instance.GetPacket(); + packet.Write((byte)CalamityModMessageType.MusicEventSyncRequest); + packet.Send(); + } + + public static void FulfillSyncRequest(int requester) + { + // Only fulfill requests as the server host + if (!Main.dedServ) + return; + + ModPacket packet = CalamityMod.Instance.GetPacket(); + packet.Write((byte)CalamityModMessageType.MusicEventSyncResponse); + + int trackCount = PlayedEvents.Count; + packet.Write(trackCount); + + for (int i = 0; i < trackCount; i++) + packet.Write(PlayedEvents[i]); + + packet.Send(toClient: requester); + } + + public static void ReceiveSyncResponse(BinaryReader reader) + { + // Only receive info on clients + if (Main.dedServ) + return; + + PlayedEvents.Clear(); + int trackCount = reader.ReadInt32(); + + for (int i = 0; i < trackCount; i++) + PlayedEvents.Add(reader.ReadString()); + } + + #endregion + } + + public class CalamityModMusicEventPlayer : ModPlayer + { + public override void OnEnterWorld() + { + if (Main.netMode == NetmodeID.MultiplayerClient && Player.whoAmI != Main.myPlayer) + MusicEventSystem.SendSyncRequest(); + } + } +} diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/WorldMiscUpdateSystem.cs index 074ff42332..c172445a7b 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -269,7 +269,7 @@ namespace CalamityMod.Systems { Tile tile = Main.tile[x, y]; bool growTile = !tile.HasTile && tile.LiquidAmount >= 128; - bool isSunkenSeaTile = tileType == ModContent.TileType() || tileType == ModContent.TileType() || tileType == ModContent.TileType(); + bool isSunkenSeaTile = tileType == ModContent.TileType() || tileType == ModContent.TileType(); bool meetsAdditionalGrowConditions = tile.Slope == SlopeType.Solid && !tile.IsHalfBlock && tile.LiquidType != LiquidID.Lava; if (growTile && meetsAdditionalGrowConditions) diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 822a6dac34..36a6baef26 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using CalamityMod.Items.SummonItems; using CalamityMod.World; +using CalamityMod.World.Minibiomes; using CalamityMod.World.Planets; using Microsoft.Xna.Framework; using Terraria; @@ -57,6 +58,14 @@ namespace CalamityMod.Systems CustomTemple.NewJungleTemple(); }); + // Floral Paradise Biome + tasks.Insert(JungleTempleIndex + 1, new PassLegacy("FloralParadise", (progress, config) => + { + progress.Message = "Growing a floral paradise underground"; + if (FloralParadiseMinibiome.SHOULD_GENERATE) + FloralParadiseMinibiome.GenerateInstances(); + })); + // Improved Golem arena int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => @@ -116,18 +125,26 @@ namespace CalamityMod.Systems })); } - // Sunken sea - int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Settle Liquids Again")); + // sunken sea + int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral")); if (SunkenSeaIndex != -1) { tasks.Insert(SunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => { progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SunkenSea").Value; - int sunkenSeaX = GenVars.UndergroundDesertLocation.Left; - int sunkenSeaY = Main.maxTilesY - 400; + int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; + int sunkenSeaY = Main.maxTilesY / 2; - SunkenSea.Place(new Point(sunkenSeaX, sunkenSeaY)); + //place each piece of the sunken sea based on the above positons + SunkenSea.PlaceRadiantReefs(sunkenSeaX - 100, sunkenSeaY + 75, true); + SunkenSea.PlaceRadiantReefs(sunkenSeaX + 100, sunkenSeaY + 75, false); + SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 75); + SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); + SunkenSea.PlaceSunkenSeaAmbience(); + SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + SunkenSea.PlaceTimelessShores(sunkenSeaX, sunkenSeaY); })); } @@ -135,8 +152,9 @@ namespace CalamityMod.Systems int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); if (FinalIndex != -1) { - // Reallocate gems so rarity corresponds to depth int currentFinalIndex = FinalIndex; + + // Reallocate gems so rarity corresponds to depth tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) => { progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.GemAdjustment").Value; @@ -272,6 +290,7 @@ namespace CalamityMod.Systems { progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.Abyss").Value; Abyss.PlaceAbyss(); + Abyss.AbyssCleanup(); })); // Sulphurous Sea (Part 2, after Abyss) diff --git a/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs b/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs index 5685b37c6e..cea4527b3c 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs @@ -35,6 +35,26 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient base.SetStaticDefaults(); } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + int type = -1; + + if (tileBelow.HasTile) + { + type = tileBelow.TileType; + } + + if (type == ModContent.TileType() || type == ModContent.TileType()) + { + return true; + } + + WorldGen.KillTile(i, j); + + return true; + } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { offsetY = -16; diff --git a/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs b/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs index 50f56211b8..c8d77c9451 100644 --- a/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs +++ b/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs @@ -34,6 +34,26 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient base.SetStaticDefaults(); } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + int type = -1; + + if (tileBelow.HasTile) + { + type = tileBelow.TileType; + } + + if (type == ModContent.TileType()) + { + return true; + } + + WorldGen.KillTile(i, j); + + return true; + } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { offsetY = -30; diff --git a/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs b/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs index 6d10d5c19c..e69543aebd 100644 --- a/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs +++ b/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs @@ -35,6 +35,26 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient base.SetStaticDefaults(); } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + int type = -1; + + if (tileBelow.HasTile) + { + type = tileBelow.TileType; + } + + if (type == ModContent.TileType()) + { + return true; + } + + WorldGen.KillTile(i, j); + + return true; + } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { offsetY = -30; diff --git a/Tiles/Abyss/AbyssCoral.cs b/Tiles/Abyss/AbyssCoral.cs new file mode 100644 index 0000000000..29a66b7009 --- /dev/null +++ b/Tiles/Abyss/AbyssCoral.cs @@ -0,0 +1,54 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace CalamityMod.Tiles.Abyss +{ + public class AbyssCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + Main.tileLighted[Type] = true; + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Dig; + DustType = 119; + AddMapEntry(new Color(70, 115, 144)); + Main.tileShine2[Type] = true; + + TileID.Sets.CanBeDugByShovel[Type] = true; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) + { + float brightness = 0.9f; + Color Color1 = new Color(52, 84, 107); + Color Color2 = new Color(29, 38, 56); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + r = (value.R + value1.R) / 300f; + g = (value.G + value1.G) / 300f; + b = (value.B + value1.B) / 300f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/Abyss/AbyssCoral.png b/Tiles/Abyss/AbyssCoral.png new file mode 100644 index 0000000000..de7a2145b0 Binary files /dev/null and b/Tiles/Abyss/AbyssCoral.png differ diff --git a/Tiles/Abyss/Atoxicoral.png b/Tiles/Abyss/Atoxicoral.png new file mode 100644 index 0000000000..e3037845a0 Binary files /dev/null and b/Tiles/Abyss/Atoxicoral.png differ diff --git a/Tiles/Abyss/SulphurCoral.png b/Tiles/Abyss/SulphurCoral.png new file mode 100644 index 0000000000..5bd7eeb270 Binary files /dev/null and b/Tiles/Abyss/SulphurCoral.png differ diff --git a/Tiles/Abyss/SulphurousShale.cs b/Tiles/Abyss/SulphurousShale.cs index 22bddd38b4..dbd4219573 100644 --- a/Tiles/Abyss/SulphurousShale.cs +++ b/Tiles/Abyss/SulphurousShale.cs @@ -1,11 +1,6 @@ -//using CalamityMod.Tiles.Abyss.AbyssAmbient; -using System; -using System.Collections.Generic; -using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.World; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; diff --git a/Tiles/Abyss/ViperVines.cs b/Tiles/Abyss/ViperVines.cs index 3e26bd5505..d3ce6d3043 100644 --- a/Tiles/Abyss/ViperVines.cs +++ b/Tiles/Abyss/ViperVines.cs @@ -61,48 +61,39 @@ namespace CalamityMod.Tiles.Abyss } public override void RandomUpdate(int i, int j) - { - if (Main.tile[i, j + 1] != null) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) { - if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) + bool PlaceVine = false; + int Test = j; + while (Test > j - 10) { - if (Main.tile[i, j + 1].LiquidAmount >= 128 && Main.tile[i, j + 1].LiquidType != LiquidID.Lava) + Tile testTile = Framing.GetTileSafely(i, Test); + if (testTile.BottomSlope) { - bool canGrowVine = false; - for (int k = j; k > j - 10; j--) - { - if (Main.tile[i, k].BottomSlope) - { - canGrowVine = false; - break; - } - if (Main.tile[i, k].HasTile && !Main.tile[i, k].BottomSlope) - { - canGrowVine = true; - break; - } - } - if (canGrowVine) - { - int vineX = i; - int vineY = j + 1; - Main.tile[vineX, vineY].TileType = (ushort)ModContent.TileType(); - Main.tile[vineX, vineY].TileFrameX = (short)(WorldGen.genRand.Next(8) * 18); - Main.tile[vineX, vineY].TileFrameY = (short)(4 * 18); - Main.tile[vineX, vineY - 1].TileFrameX = (short)(WorldGen.genRand.Next(12) * 18); - Main.tile[vineX, vineY - 1].TileFrameY = (short)(WorldGen.genRand.Next(4) * 18); - Main.tile[vineX, vineY].Get().HasTile = true; - WorldGen.SquareTileFrame(vineX, vineY, true); - WorldGen.SquareTileFrame(vineX, vineY - 1, true); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); - NetMessage.SendTileSquare(-1, vineX, vineY - 1, 3, TileChangeType.None); - } - } - } - } - } - } + break; + } + else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) + { + Test--; + continue; + } + PlaceVine = true; + break; + } + + if (PlaceVine) + { + tileBelow.TileType = Type; + tileBelow.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } } } diff --git a/Tiles/Astral/AstralShortPlants.cs b/Tiles/Astral/AstralShortPlants.cs index 2aa49d66a1..33f5e65517 100644 --- a/Tiles/Astral/AstralShortPlants.cs +++ b/Tiles/Astral/AstralShortPlants.cs @@ -33,6 +33,26 @@ namespace CalamityMod.Tiles.Astral base.SetStaticDefaults(); } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + int type = -1; + + if (tileBelow.HasTile) + { + type = tileBelow.TileType; + } + + if (type == ModContent.TileType()) + { + return true; + } + + WorldGen.KillTile(i, j); + + return true; + } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { offsetY = 2; diff --git a/Tiles/BaseTiles/BranchDrawer.cs b/Tiles/BaseTiles/BranchDrawer.cs new file mode 100644 index 0000000000..9f331ddd07 --- /dev/null +++ b/Tiles/BaseTiles/BranchDrawer.cs @@ -0,0 +1,373 @@ +using Terraria; +using System.Linq; +using System.Collections.Generic; +using CalamityMod.DataStructures; +using Terraria.Utilities; +using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ObjectData; +using Terraria.Enums; + +namespace CalamityMod.Tiles.BaseTiles +{ + public class BranchDrawer + { + public class Branch + { + public BezierCurve Curve; + + public Vector2 EndOfCurve; + + public float Direction; + + public float CurveLength; + + public float StartingWidth; + + public float EndingWidth; + + public Branch PreviousBranch = null; + + public int Generation + { + get + { + int generation = 0; + var parent = PreviousBranch; + while (parent != null) + { + parent = parent.PreviousBranch; + generation++; + } + + return generation; + } + } + + public Branch(BezierCurve curve, Vector2 end, float length, float direction, float startWidth, float endWidth, Branch previousBranch = null) + { + Curve = curve; + EndOfCurve = end; + CurveLength = length; + Direction = direction; + StartingWidth = startWidth; + EndingWidth = endWidth; + PreviousBranch = previousBranch; + } + } + + internal BasicEffect basicShader = null; + + internal Point PreviousPoint; + + internal VertexPositionColorTexture[] vertexCache = Array.Empty(); + + internal short[] indexCache = Array.Empty(); + + internal UnifiedRandom RNG = new(0); + + public BasicEffect BasicShader + { + get + { + if (Main.netMode != NetmodeID.Server && basicShader is null) + { + basicShader = new BasicEffect(Main.instance.GraphicsDevice) + { + VertexColorEnabled = true, + TextureEnabled = true + }; + } + return basicShader; + } + } + + public static int GetSeed(int x, int y) => unchecked(x * 55867 + y * 49311329 + WorldGen.currentWorldSeed.GetHashCode()); + + public Texture2D BarkTexture; + + // The max amount that branches can travel. Once the distance of the branches reaches or exceeds this threshold, the tree is done growing. + public float MaxDistanceBeforeCutoff; + + public float DistanceUsedForTrunk; + + public float BranchMaxBendFactor; + + public float BranchTurnAngleVariance; + + // The shortest possible length a branch can have. + public float MinBranchLength; + + // The width of the trunk. Successive branches have a dynamic, random width, but the trunk should be static. + public float TrunkWidth; + + // Chance to create new branches instead of extending existing ones. + public float ChanceToCreateNewBranches; + + public float VerticalStretchFactor; + + public float DownwardBiasFactor; + + public float BranchGrowthWidthDecay; + + public int MaxCutoffBranchesPerBranch; + + public const int ControlPointCountPerBranch = 8; + + public virtual void DrawThingAtEndOfBranch(Branch branch) { } + + public Dictionary> GenerateBranches(Point p) + { + RNG = new(GetSeed(p.X, p.Y)); + float cutoffDistance = MaxDistanceBeforeCutoff; + float trunkDirection = RNG.NextFloatDirection() * BranchTurnAngleVariance * 0.1f - MathHelper.PiOver2; + float trunkSize = RNG.NextFloat(-8f, 8f) + DistanceUsedForTrunk; + float distanceTraversed = trunkSize; + Vector2 startOfTrunk = Vector2.UnitY * 10f; + Vector2 endOfTrunk = startOfTrunk + trunkDirection.ToRotationVector2() * trunkSize; + Branch trunk = GenerateBranchCurve(startOfTrunk, endOfTrunk, TrunkWidth, TrunkWidth); + Dictionary> existingBranches = new() + { + [trunk] = new() + }; + + void extendLengthOfBranch(Branch branch, float lengthToAdd) + { + branch.CurveLength += lengthToAdd; + branch.EndOfCurve += branch.Direction.ToRotationVector2() * lengthToAdd; + + // Add the new length to all branches that exist on the current one, ones extented to each of them, and so on. + foreach (Branch attachedBranch in existingBranches[branch]) + extendLengthOfBranch(attachedBranch, lengthToAdd); + } + + int tries = 0; + while (distanceTraversed < cutoffDistance) + { + // Prevent infinite loops if conditions do not permit the distance traveled to reach its maximum. + tries++; + if (tries >= 1500) + break; + + // Sometimes simply extend an existing branch instead of creating new ones. + if (RNG.NextFloat() > ChanceToCreateNewBranches) + { + List potentialBranchesToExtend = existingBranches.Where(b => b.Key.CurveLength < trunkSize * 0.4f && b.Key.CurveLength > MinBranchLength).Select(b => b.Key).ToList(); + if (potentialBranchesToExtend.Count <= 0) + continue; + + Branch branchToExtend = RNG.Next(potentialBranchesToExtend); + + float lengthToAdd = branchToExtend.CurveLength * 0.12f; + extendLengthOfBranch(branchToExtend, lengthToAdd); + distanceTraversed += lengthToAdd; + continue; + } + + // Pick a random branch to attach to and determine the properties of the potential next one. + List validBranches = existingBranches.Where(b => b.Value.Count < MaxCutoffBranchesPerBranch && b.Key.EndingWidth >= 6f).Select(b => b.Key).ToList(); + if (validBranches.Count <= 0) + continue; + + Branch branchToAttachTo = RNG.Next(validBranches); + float maxBranchAngleVariance = BranchTurnAngleVariance * (branchToAttachTo == trunk ? 2.1f : 1f); + float directionOfNextBranch = branchToAttachTo.Direction + RNG.NextFloatDirection() * maxBranchAngleVariance; + float downwardBiasFactor = DownwardBiasFactor; + float downwardBiasFromGeneration = Utils.Remap(branchToAttachTo.Generation, 0f, 5f, 0f, 0.8f); + downwardBiasFactor = MathHelper.Clamp(downwardBiasFactor + downwardBiasFromGeneration, 0f, 0.95f); + + if (downwardBiasFactor > 0f && branchToAttachTo != trunk) + { + float randomBias = RNG.NextFloat(0.67f, 1f) * downwardBiasFactor; + directionOfNextBranch = Vector2.Lerp(directionOfNextBranch.ToRotationVector2(), Vector2.UnitY, randomBias).ToRotation(); + } + + // Try not to create a branch with a direction very similar to other branches attached to the one that this one will attach to. + if (existingBranches[branchToAttachTo].Count >= 1 && + existingBranches[branchToAttachTo].Any(b => b.Direction.ToRotationVector2().AngleBetween(directionOfNextBranch.ToRotationVector2()) < 0.12f)) + { + continue; + } + + float lengthOfNextBranch = MathHelper.Max(MinBranchLength, branchToAttachTo.CurveLength * RNG.NextFloat(0.5f, 0.925f)); + + Vector2 start = branchToAttachTo.EndOfCurve; + Vector2 end = start + directionOfNextBranch.ToRotationVector2() * lengthOfNextBranch; + + // Try not to create branches in already crowded areas. + if (validBranches.Count(b => MathHelper.Distance(b.EndOfCurve.Y, end.Y) < 50f) >= 4f) + continue; + + Branch newBranch = GenerateBranchCurve(start, end, branchToAttachTo.EndingWidth, branchToAttachTo.EndingWidth * BranchGrowthWidthDecay, branchToAttachTo); + + // Create the new branch in the dictionary and make the old branch count count as having one extra branch attached. + existingBranches[branchToAttachTo].Add(newBranch); + existingBranches[newBranch] = new(); + + // Add to traversed distance. + distanceTraversed += lengthOfNextBranch; + } + + // Go back and make all end branches have a small end width. + foreach (Branch branch in existingBranches.Where(b => b.Value.Count <= 0).Select(b => b.Key)) + branch.EndingWidth = MathHelper.Min(3f, branch.EndingWidth); + + return existingBranches; + } + + public void GetVertexData(Point p, out List vertices, out List indices, out IEnumerable outwardmostBranches) + { + // Initialize vertex and index data. + vertices = new(); + indices = new(); + + // Determine branch data. + var branchData = GenerateBranches(p); + var branches = branchData.Select(b => b.Key); + outwardmostBranches = branchData.Where(b => b.Value.Count <= 0f).Select(b => b.Key); + + // Generate vertex data. + int batchIndex = 0; + Vector2 screenOffset = (p.ToWorldCoordinates() - Main.screenPosition).Floor(); + Texture2D barkTexture = BarkTexture; + foreach (Branch branch in branches.OrderBy(b => b.EndOfCurve.Y)) + { + int pointCount = 12; + List smoothenedPoints = branch.Curve.GetPoints(pointCount + 1); + Vector2? prevBottomLeft = null; + Vector2? prevBottomRight = null; + if (branch.PreviousBranch != null) + { + Vector2 previousOrthogonalDirection = (branch.PreviousBranch.Direction + MathHelper.PiOver2).ToRotationVector2(); + prevBottomLeft = branch.PreviousBranch.EndOfCurve + previousOrthogonalDirection * branch.PreviousBranch.EndingWidth * 0.5f; + prevBottomRight = branch.PreviousBranch.EndOfCurve - previousOrthogonalDirection * branch.PreviousBranch.EndingWidth * 0.5f; + } + + for (int i = 0; i < pointCount; i++) + { + Vector2 top = smoothenedPoints[i]; + Vector2 bottom = smoothenedPoints[i + 1]; + float topCompletionRatio = i / (float)pointCount; + float bottomCompletionRatio = (i + 1) / (float)pointCount; + if (i == pointCount - 1f) + { + topCompletionRatio = 1f; + bottomCompletionRatio = 1f; + bottom = branch.EndOfCurve; + } + + // Calculate frame coordinates. + // This sucked to make. + float topWidth = MathHelper.Lerp(branch.StartingWidth, branch.EndingWidth, topCompletionRatio); + float bottomWidth = MathHelper.Lerp(branch.StartingWidth, branch.EndingWidth, bottomCompletionRatio); + float topTexCoord = branch.CurveLength * topCompletionRatio / VerticalStretchFactor / barkTexture.Height; + float bottomTexCoord = branch.CurveLength * bottomCompletionRatio / VerticalStretchFactor / barkTexture.Height; + if (VerticalStretchFactor <= 0f) + { + topTexCoord = topWidth; + bottomTexCoord = bottomWidth; + } + float stretchedHorizontalCoordTop = topWidth / barkTexture.Width; + float stretchedHorizontalCoordBottom = bottomWidth / barkTexture.Width; + if (topWidth > barkTexture.Width * 0.5f) + stretchedHorizontalCoordTop = 1f; + if (bottomWidth > barkTexture.Width * 0.5f) + stretchedHorizontalCoordBottom = 1f; + + // Calculate texture coordinates. + Vector2 topLeftTexCoord = new(stretchedHorizontalCoordTop, topTexCoord); + Vector2 topRightTexCoord = new(0f, topTexCoord); + Vector2 bottomLeftTexCoord = new(stretchedHorizontalCoordBottom, bottomTexCoord); + Vector2 bottomRightTexCoord = new(0f, bottomTexCoord); + + // Calculate draw coordinates. + Vector2 orthogonalDirection = (bottom - top).SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.PiOver2); + Vector2 topLeft = prevBottomLeft ?? top + orthogonalDirection * topWidth * 0.5f; + Vector2 topRight = prevBottomRight ?? top - orthogonalDirection * topWidth * 0.5f; + Vector2 bottomLeft = bottom + orthogonalDirection * bottomWidth * 0.5f; + Vector2 bottomRight = bottom - orthogonalDirection * bottomWidth * 0.5f; + + // Calculate lighting colors. + Vector2 lightOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(-Main.offScreenRange); + Color topLeftColor = Lighting.GetColor((topLeft + p.ToWorldCoordinates() + lightOffset).ToTileCoordinates()); + Color topRightColor = Lighting.GetColor((topRight + p.ToWorldCoordinates() + lightOffset).ToTileCoordinates()); + Color bottomLeftColor = Lighting.GetColor((bottomLeft + p.ToWorldCoordinates() + lightOffset).ToTileCoordinates()); + Color bottomRightColor = Lighting.GetColor((bottomRight + p.ToWorldCoordinates() + lightOffset).ToTileCoordinates()); + + vertices.Add(new VertexPositionColorTexture(new Vector3(topLeft.Floor() + screenOffset, 0f), topLeftColor, topLeftTexCoord)); + vertices.Add(new VertexPositionColorTexture(new Vector3(topRight.Floor() + screenOffset, 0f), topRightColor, topRightTexCoord)); + vertices.Add(new VertexPositionColorTexture(new Vector3(bottomRight.Floor() + screenOffset, 0f), bottomRightColor, bottomRightTexCoord)); + vertices.Add(new VertexPositionColorTexture(new Vector3(bottomLeft.Floor() + screenOffset, 0f), bottomLeftColor, bottomLeftTexCoord)); + + indices.Add((short)(batchIndex * 4)); + indices.Add((short)(batchIndex * 4 + 1)); + indices.Add((short)(batchIndex * 4 + 2)); + indices.Add((short)(batchIndex * 4)); + indices.Add((short)(batchIndex * 4 + 2)); + indices.Add((short)(batchIndex * 4 + 3)); + + prevBottomLeft = bottomLeft; + prevBottomRight = bottomRight; + + batchIndex++; + } + } + } + + public void Draw(Point p) + { + // Declare the vertex cache. + GetVertexData(p, out var vertices, out var indices, out IEnumerable outwardmostBranches); + vertexCache = vertices.ToArray(); + indexCache = indices.ToArray(); + PreviousPoint = p; + + // Redefine the perspective matrices of the shader. + CalamityUtils.CalculatePerspectiveMatricies(out Matrix effectView, out Matrix effectProjection); + BasicShader.Texture = BarkTexture; + BasicShader.View = effectView; + BasicShader.Projection = effectProjection; + + // Draw the tree itself. + Main.instance.GraphicsDevice.Textures[0] = BarkTexture; + Main.instance.GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap; + Main.instance.GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, vertexCache, 0, vertexCache.Length, indexCache, 0, indexCache.Length / 3); + + // Draw things at the end of branches. + foreach (Branch outwardmostBranch in outwardmostBranches) + DrawThingAtEndOfBranch(outwardmostBranch); + } + + public void UseDefaultSize() + { + TileObjectData.newTile.Width = (int)Math.Ceiling(TrunkWidth / 16); + TileObjectData.newTile.Height = (int)Math.Ceiling(DistanceUsedForTrunk / 16); + TileObjectData.newTile.Origin = new Point16(TileObjectData.newTile.Width / 2, TileObjectData.newTile.Height - 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = Enumerable.Repeat(16, TileObjectData.newTile.Height).ToArray(); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 2; + } + + public Branch GenerateBranchCurve(Vector2 start, Vector2 end, float startWidth, float endWidth, Branch previousBranch = null) + { + float distanceBetweenPoints = Vector2.Distance(start, end); + Vector2[] initialPoints = new Vector2[ControlPointCountPerBranch]; + Vector2 orthogonalDirection = (end - start).SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.PiOver2); + for (int i = 0; i < ControlPointCountPerBranch; i++) + initialPoints[i] = Vector2.Lerp(start, end, i / (float)(ControlPointCountPerBranch - 1f)); + + // Create a bend midway. + float bendFactor = (float)Math.Pow(RNG.NextFloat(), 0.66) * RNG.NextBool().ToDirectionInt() * BranchMaxBendFactor; + bendFactor = MathHelper.Lerp(bendFactor, Math.Sign(bendFactor) * BranchMaxBendFactor, Utils.GetLerpValue(DistanceUsedForTrunk * 0.4f, DistanceUsedForTrunk * 0.75f, distanceBetweenPoints, true)); + + initialPoints[ControlPointCountPerBranch / 2] += orthogonalDirection * RNG.NextFloatDirection() * distanceBetweenPoints * bendFactor; + + return new(new(initialPoints), end, distanceBetweenPoints, (end - start).ToRotation(), startWidth, endWidth, previousBranch); + } + } +} diff --git a/Tiles/BaseTiles/DynamicallyGrownTree.cs b/Tiles/BaseTiles/DynamicallyGrownTree.cs new file mode 100644 index 0000000000..e4a3882f33 --- /dev/null +++ b/Tiles/BaseTiles/DynamicallyGrownTree.cs @@ -0,0 +1,144 @@ +using Terraria; +using Terraria.ModLoader; +using System.Linq; +using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ObjectData; +using Terraria.Enums; +using ReLogic.Content; +using Terraria.Utilities; + +namespace CalamityMod.Tiles.BaseTiles +{ + public abstract class DynamicallyGrownTree : ModTile + { + public BranchDrawer BranchDrawer + { + get; + internal set; + } = null; + + public abstract float MaxDistanceBeforeCutoff { get; } + + public abstract float DistanceUsedForTrunk { get; } + + public abstract float BranchMaxBendFactor { get; } + + public abstract float BranchTurnAngleVariance { get; } + + public abstract float MinBranchLength { get; } + + public abstract float TrunkWidth { get; } + + public abstract float ChanceToCreateNewBranches { get; } + + public abstract float VerticalStretchFactor { get; } + + public abstract float DownwardBiasFactor { get; } + + public abstract float BranchGrowthWidthDecay { get; } + + public abstract int MaxCutoffBranchesPerBranch { get; } + + internal int ItemDrop; + + public const int ControlPointCountPerBranch = 8; + + public UnifiedRandom RNG => BranchDrawer.RNG; + + public override void Load() + { + BranchDrawer = new() + { + MaxDistanceBeforeCutoff = MaxDistanceBeforeCutoff, + DistanceUsedForTrunk = DistanceUsedForTrunk, + BranchMaxBendFactor = BranchMaxBendFactor, + BranchTurnAngleVariance = BranchTurnAngleVariance, + MinBranchLength = MinBranchLength, + TrunkWidth = TrunkWidth, + ChanceToCreateNewBranches = ChanceToCreateNewBranches, + VerticalStretchFactor = VerticalStretchFactor, + DownwardBiasFactor = DownwardBiasFactor, + BranchGrowthWidthDecay = BranchGrowthWidthDecay, + MaxCutoffBranchesPerBranch = MaxCutoffBranchesPerBranch + }; + + if (Main.netMode != NetmodeID.Server) + BranchDrawer.BarkTexture = ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value; + } + + public virtual void DrawThingAtEndOfBranch(BranchDrawer.Branch branch) { } + + public void Draw(Point p) + { + // This is necessary to ensure that the primitives properly render. + TileID.Sets.DrawTileInSolidLayer[Type] = true; + BranchDrawer.Draw(p); + + // Determine branch data. + var branchData = BranchDrawer.GenerateBranches(p); + var branches = branchData.Select(b => b.Key); + var outwardmostBranches = branchData.Where(b => b.Value.Count <= 0f).Select(b => b.Key); + + // Draw things at the end of branches. + foreach (BranchDrawer.Branch outwardmostBranch in outwardmostBranches) + DrawThingAtEndOfBranch(outwardmostBranch); + } + + public void UseDefaultSize() + { + TileObjectData.newTile.Width = (int)Math.Ceiling(TrunkWidth / 16); + TileObjectData.newTile.Height = (int)Math.Ceiling(DistanceUsedForTrunk / 16); + TileObjectData.newTile.Origin = new Point16(TileObjectData.newTile.Width / 2, TileObjectData.newTile.Height - 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = Enumerable.Repeat(16, TileObjectData.newTile.Height).ToArray(); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 2; + } + + public override bool CanDrop(int i, int j) => false; + + public override void KillMultiTile(int x, int y, int frameX, int frameY) + { + var branchData = BranchDrawer.GenerateBranches(new(x, y)); + var branches = branchData.Select(b => b.Key); + foreach (var branch in branches) + { + int totalWood = (int)Math.Ceiling(branch.CurveLength / 56f); + int totalDust = totalWood * 3; + int stack = Main.rand.Next(1, 3); + for (int i = 0; i < totalWood; i++) + { + Vector2 woodPosition = branch.Curve.Evaluate(i / (float)(totalWood - 1f)); + woodPosition += new Vector2(x, y).ToWorldCoordinates() + Main.rand.NextVector2Circular(10f, 10f); + woodPosition.Y += DistanceUsedForTrunk; + Item.NewItem(new EntitySource_TileBreak(x, y), woodPosition, ItemDrop); + } + + // Create dust. + for (int i = 0; i < totalDust; i++) + { + Vector2 dustPosition = branch.Curve.Evaluate(i / (float)(totalDust - 1f)); + dustPosition += new Vector2(x, y).ToWorldCoordinates() + Main.rand.NextVector2Circular(5f, 5f); + dustPosition.Y += DistanceUsedForTrunk; + Dust.NewDustDirect(dustPosition, 4, 4, DustType); + } + } + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); + if (t.TileFrameX != 0 || t.TileFrameY != ((int)Math.Ceiling(DistanceUsedForTrunk / 16) - 1) * 18) + return false; + + Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Draw(new(i + (int)screenOffset.X / 16, j + (int)screenOffset.Y / 16)); + return false; + } + } +} diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index bccfbf26c0..77280fa602 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -15,6 +15,7 @@ using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.DraedonSummoner; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -54,6 +55,8 @@ namespace CalamityMod.Tiles { ModContent.TileType(), ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), ModContent.TileType() }; diff --git a/Tiles/CosmiliteBarTile.cs b/Tiles/CosmiliteBarTile.cs index ec0f584276..7ecfadf556 100644 --- a/Tiles/CosmiliteBarTile.cs +++ b/Tiles/CosmiliteBarTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria.ModLoader; namespace CalamityMod.Tiles @@ -18,5 +19,10 @@ namespace CalamityMod.Tiles type = ModContent.DustType(); return true; } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + return false; + } } } diff --git a/Tiles/Crags/CinderBlossomTallPlants.cs b/Tiles/Crags/CinderBlossomTallPlants.cs index 4fb65d3700..77d71ff212 100644 --- a/Tiles/Crags/CinderBlossomTallPlants.cs +++ b/Tiles/Crags/CinderBlossomTallPlants.cs @@ -34,6 +34,26 @@ namespace CalamityMod.Tiles.Crags base.SetStaticDefaults(); } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + int type = -1; + + if (tileBelow.HasTile) + { + type = tileBelow.TileType; + } + + if (type == ModContent.TileType()) + { + return true; + } + + WorldGen.KillTile(i, j); + + return true; + } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { offsetY = -30; diff --git a/Tiles/Crags/LavaPistil.cs b/Tiles/Crags/LavaPistil.cs index c026fb1293..8b2b419784 100644 --- a/Tiles/Crags/LavaPistil.cs +++ b/Tiles/Crags/LavaPistil.cs @@ -36,6 +36,26 @@ namespace CalamityMod.Tiles.Crags base.SetStaticDefaults(); } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + int type = -1; + + if (tileBelow.HasTile) + { + type = tileBelow.TileType; + } + + if (type == ModContent.TileType()) + { + return true; + } + + WorldGen.KillTile(i, j); + + return true; + } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { offsetY = -128; diff --git a/Tiles/FloralParadise/AlgalSlate.cs b/Tiles/FloralParadise/AlgalSlate.cs new file mode 100644 index 0000000000..da26933f6f --- /dev/null +++ b/Tiles/FloralParadise/AlgalSlate.cs @@ -0,0 +1,41 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class AlgalSlate : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileBrick[Type] = true; + TileID.Sets.Stone[Type] = true; + TileID.Sets.Conversion.Stone[Type] = true; + TileID.Sets.CanBeClearedDuringOreRunner[Type] = false; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithOres(Type); + CalamityUtils.MergeWithFloralParadise(Type); + + DustType = 78; + + HitSound = SoundID.Tink; + + AddMapEntry(new Color(33, 56, 27)); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt, false, false, false, true); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FloralParadise/AlgalSlate.png b/Tiles/FloralParadise/AlgalSlate.png new file mode 100644 index 0000000000..86f7743da6 Binary files /dev/null and b/Tiles/FloralParadise/AlgalSlate.png differ diff --git a/Tiles/FloralParadise/BloodOrangePlant.cs b/Tiles/FloralParadise/BloodOrangePlant.cs new file mode 100644 index 0000000000..667236043e --- /dev/null +++ b/Tiles/FloralParadise/BloodOrangePlant.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.PermanentBoosters; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class BloodOrangePlant : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + + DustType = 6; + + AddMapEntry(new Color(250, 142, 4)); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 16, ModContent.ItemType()); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/FloralParadise/BloodOrangePlant.png b/Tiles/FloralParadise/BloodOrangePlant.png new file mode 100644 index 0000000000..c954393284 Binary files /dev/null and b/Tiles/FloralParadise/BloodOrangePlant.png differ diff --git a/Tiles/FloralParadise/LargeLogPiles.cs b/Tiles/FloralParadise/LargeLogPiles.cs new file mode 100644 index 0000000000..fefea2c7ea --- /dev/null +++ b/Tiles/FloralParadise/LargeLogPiles.cs @@ -0,0 +1,49 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class LargeLogPiles : ModTile + { + public const int Variants = 2; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.addTile(Type); + + DustType = 38; + + AddMapEntry(new Color(114, 72, 49)); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/FloralParadise/LargeLogPiles.png b/Tiles/FloralParadise/LargeLogPiles.png new file mode 100644 index 0000000000..e343f8254a Binary files /dev/null and b/Tiles/FloralParadise/LargeLogPiles.png differ diff --git a/Tiles/FloralParadise/LargeMossPiles.cs b/Tiles/FloralParadise/LargeMossPiles.cs new file mode 100644 index 0000000000..bc5e786f47 --- /dev/null +++ b/Tiles/FloralParadise/LargeMossPiles.cs @@ -0,0 +1,48 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class LargeMossPiles : ModTile + { + public const int Variants = 4; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + + DustType = 38; + + AddMapEntry(new Color(56, 56, 56)); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/FloralParadise/LargeMossPiles.png b/Tiles/FloralParadise/LargeMossPiles.png new file mode 100644 index 0000000000..ee20cf395a Binary files /dev/null and b/Tiles/FloralParadise/LargeMossPiles.png differ diff --git a/Tiles/FloralParadise/LargeSubterraneanGrass.cs b/Tiles/FloralParadise/LargeSubterraneanGrass.cs new file mode 100644 index 0000000000..d9b38f6785 --- /dev/null +++ b/Tiles/FloralParadise/LargeSubterraneanGrass.cs @@ -0,0 +1,48 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class LargeSubterraneanGrass : ModTile + { + public const int Variants = 5; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + + DustType = 39; + + AddMapEntry(new Color(106, 163, 74)); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/FloralParadise/LargeSubterraneanGrass.png b/Tiles/FloralParadise/LargeSubterraneanGrass.png new file mode 100644 index 0000000000..4069f95cae Binary files /dev/null and b/Tiles/FloralParadise/LargeSubterraneanGrass.png differ diff --git a/Tiles/FloralParadise/LargeWallFungi.cs b/Tiles/FloralParadise/LargeWallFungi.cs new file mode 100644 index 0000000000..e345cac254 --- /dev/null +++ b/Tiles/FloralParadise/LargeWallFungi.cs @@ -0,0 +1,43 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class LargeWallFungi : ModTile + { + public const int Variants = 3; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + DustType = 0; + + AddMapEntry(new Color(165, 126, 84)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FloralParadise/LargeWallFungi.png b/Tiles/FloralParadise/LargeWallFungi.png new file mode 100644 index 0000000000..89c0975133 Binary files /dev/null and b/Tiles/FloralParadise/LargeWallFungi.png differ diff --git a/Tiles/FloralParadise/LargeWallFungiLeft.cs b/Tiles/FloralParadise/LargeWallFungiLeft.cs new file mode 100644 index 0000000000..e2f84a907b --- /dev/null +++ b/Tiles/FloralParadise/LargeWallFungiLeft.cs @@ -0,0 +1,43 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class LargeWallFungiLeft : ModTile + { + public const int Variants = 3; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + DustType = 0; + + AddMapEntry(new Color(165, 126, 84)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FloralParadise/LargeWallFungiLeft.png b/Tiles/FloralParadise/LargeWallFungiLeft.png new file mode 100644 index 0000000000..8e765ea7fd Binary files /dev/null and b/Tiles/FloralParadise/LargeWallFungiLeft.png differ diff --git a/Tiles/FloralParadise/LushVines.cs b/Tiles/FloralParadise/LushVines.cs new file mode 100644 index 0000000000..eeb8817853 --- /dev/null +++ b/Tiles/FloralParadise/LushVines.cs @@ -0,0 +1,95 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class LushVines : ModTile + { + public override void SetStaticDefaults() + { + Main.tileCut[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + AddMapEntry(new Color(47, 75, 32)); + HitSound = SoundID.Grass; + DustType = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + if (WorldGen.genRand.NextBool(2) && Main.player[(int)Player.FindClosest(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16)].cordage) + Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope); + + if (Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType == Type) + { + WorldGen.KillTile(i, j + 1, false, false, false); + if (!Main.tile[i, j + 1].HasTile && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); + } + } + + if (Main.tile[i, j - 1].HasTile && Main.tile[i, j - 1].TileType == Type) + { + Main.tile[i, j - 1].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18); + Main.tile[i, j - 1].TileFrameY = 54; + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); + } + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j + 1] != null) + { + if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != Type) + { + if (Main.tile[i, j + 1].LiquidAmount >= 128 && Main.tile[i, j + 1].LiquidType == LiquidID.Water) + { + bool canGrow = false; + for (int y = j; y > j - 10; j--) + { + if (Main.tile[i, y].BottomSlope) + { + canGrow = false; + break; + } + if (Main.tile[i, y].HasTile && !Main.tile[i, y].BottomSlope) + { + canGrow = true; + break; + } + } + if (canGrow) + { + int below = j + 1; + Main.tile[i, below].TileType = Type; + Main.tile[i, below].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18); + Main.tile[i, below].TileFrameY = 54; + Main.tile[i, below - 1].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18); + Main.tile[i, below - 1].TileFrameY = (short)(WorldGen.genRand.Next(3) * 18); + Main.tile[i, below].Get().HasTile = true; + WorldGen.SquareTileFrame(i, below, true); + WorldGen.SquareTileFrame(i, below - 1, true); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, below, 3, TileChangeType.None); + NetMessage.SendTileSquare(-1, i, below - 1, 3, TileChangeType.None); + } + } + } + } + } + } + } +} diff --git a/Tiles/FloralParadise/LushVines.png b/Tiles/FloralParadise/LushVines.png new file mode 100644 index 0000000000..2ef0db6a25 Binary files /dev/null and b/Tiles/FloralParadise/LushVines.png differ diff --git a/Tiles/FloralParadise/MediumFloralPlants.cs b/Tiles/FloralParadise/MediumFloralPlants.cs new file mode 100644 index 0000000000..bd764bb33b --- /dev/null +++ b/Tiles/FloralParadise/MediumFloralPlants.cs @@ -0,0 +1,56 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class MediumFloralPlants : ModTile + { + public const int Variants = 8; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileCut[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + + HitSound = SoundID.Grass; + DustType = 2; + AddMapEntry(new Color(106, 135, 69)); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (CalamityUtils.ParanoidTileRetrieval(i, j).LiquidAmount > 64) + WorldGen.KillTile(i, j); + } + } +} diff --git a/Tiles/FloralParadise/MediumFloralPlants.png b/Tiles/FloralParadise/MediumFloralPlants.png new file mode 100644 index 0000000000..643c9e94cc Binary files /dev/null and b/Tiles/FloralParadise/MediumFloralPlants.png differ diff --git a/Tiles/FloralParadise/MediumLargeMossPiles.cs b/Tiles/FloralParadise/MediumLargeMossPiles.cs new file mode 100644 index 0000000000..7af71e6c7f --- /dev/null +++ b/Tiles/FloralParadise/MediumLargeMossPiles.cs @@ -0,0 +1,49 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class MediumLargeMossPiles : ModTile + { + public const int Variants = 4; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.RandomStyleRange = Variants; + + TileObjectData.addTile(Type); + + DustType = 38; + + AddMapEntry(new Color(56, 56, 56)); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/FloralParadise/MediumLargeMossPiles.png b/Tiles/FloralParadise/MediumLargeMossPiles.png new file mode 100644 index 0000000000..cbf4ace032 Binary files /dev/null and b/Tiles/FloralParadise/MediumLargeMossPiles.png differ diff --git a/Tiles/FloralParadise/MediumMossPiles.cs b/Tiles/FloralParadise/MediumMossPiles.cs new file mode 100644 index 0000000000..5094b14dfa --- /dev/null +++ b/Tiles/FloralParadise/MediumMossPiles.cs @@ -0,0 +1,37 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class MediumMossPiles : ModTile + { + public const int Variants = 4; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + + DustType = 38; + + AddMapEntry(new Color(56, 56, 56)); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/FloralParadise/MediumMossPiles.png b/Tiles/FloralParadise/MediumMossPiles.png new file mode 100644 index 0000000000..05ca5e1d5f Binary files /dev/null and b/Tiles/FloralParadise/MediumMossPiles.png differ diff --git a/Tiles/FloralParadise/Peat.cs b/Tiles/FloralParadise/Peat.cs new file mode 100644 index 0000000000..b65eba8b6d --- /dev/null +++ b/Tiles/FloralParadise/Peat.cs @@ -0,0 +1,39 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class Peat : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileBrick[Type] = true; + TileID.Sets.Stone[Type] = true; + TileID.Sets.Conversion.Stone[Type] = true; + TileID.Sets.CanBeClearedDuringOreRunner[Type] = false; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithOres(Type); + CalamityUtils.MergeWithFloralParadise(Type); + + DustType = 78; + + AddMapEntry(new Color(72, 91, 47)); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt, false, false, false, true); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FloralParadise/Peat.png b/Tiles/FloralParadise/Peat.png new file mode 100644 index 0000000000..2ebbd88951 Binary files /dev/null and b/Tiles/FloralParadise/Peat.png differ diff --git a/Tiles/FloralParadise/PeatMoss.cs b/Tiles/FloralParadise/PeatMoss.cs new file mode 100644 index 0000000000..b92e58ecff --- /dev/null +++ b/Tiles/FloralParadise/PeatMoss.cs @@ -0,0 +1,116 @@ +using CalamityMod.Projectiles.Environment; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class PeatMoss : ModTile + { + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/MossMine"); + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileBrick[Type] = true; + + TileID.Sets.Grass[Type] = true; + TileID.Sets.NeedsGrassFraming[Type] = true; + TileID.Sets.NeedsGrassFramingDirt[Type] = ModContent.TileType(); + TileID.Sets.Conversion.Grass[Type] = true; + + CalamityUtils.SetMerge(Type, TileID.Dirt); + CalamityUtils.SetMerge(Type, TileID.Grass); + CalamityUtils.SetMerge(Type, TileID.CorruptGrass); + CalamityUtils.SetMerge(Type, TileID.HallowedGrass); + CalamityUtils.SetMerge(Type, TileID.CrimsonGrass); + CalamityUtils.MergeWithFloralParadise(Type); + + DustType = 39; + HitSound = MineSound; + + AddMapEntry(new Color(65, 142, 101)); + } + + public override void NumDust(int i, int j, bool fail, ref int Type) + { + Type = fail ? 1 : 3; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + if (fail && !effectOnly) + Main.tile[i, j].TileType = (ushort)ModContent.TileType(); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (WorldGen.genRand.NextBool(60) && !Main.gamePaused && CalamityUtils.ParanoidTileRetrieval(i, j - 1).LiquidAmount >= 200) + { + Vector2 algaeVelocity = -Vector2.UnitY.RotatedByRandom(0.91f) * Main.rand.NextFloat(0.85f, 1.6f); + Projectile.NewProjectile(new EntitySource_WorldEvent(), new Vector2(i + 0.5f, j - 0.5f) * 16f, algaeVelocity, ModContent.ProjectileType(), 0, 0f); + } + } + + public override void RandomUpdate(int i, int j) + { + int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + Main.maxTilesY * 0.143)); + int nearbyVineCount = 0; + for (int x = i - 15; x <= i + 15; x++) + { + for (int y = j - 15; y <= j + 15; y++) + { + if (WorldGen.InWorld(x, y)) + { + if (CalamityUtils.ParanoidTileRetrieval(x, y).HasTile && + CalamityUtils.ParanoidTileRetrieval(x, y).TileType == (ushort)ModContent.TileType()) + { + nearbyVineCount++; + } + } + } + } + if (Main.tile[i, j + 1] != null && nearbyVineCount < 5) + { + if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) + { + if (Main.tile[i, j + 1].LiquidAmount == 255 && + Main.tile[i, j + 1].LiquidType == LiquidID.Water) + { + bool growMoss = false; + for (int y = num8; y > num8 - 10; y--) + { + if (Main.tile[i, y].BottomSlope) + { + growMoss = false; + break; + } + if (Main.tile[i, y].HasTile && !Main.tile[i, y].BottomSlope) + { + growMoss = true; + break; + } + } + if (growMoss) + { + int belowY = j + 1; + Main.tile[i, belowY].TileType = (ushort)ModContent.TileType(); + Main.tile[i, belowY].Get().HasTile = true; + WorldGen.SquareTileFrame(i, belowY, true); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, belowY, 3, TileChangeType.None); + } + } + Main.tile[i, j].Get().Slope = SlopeType.Solid; + Main.tile[i, j].Get().IsHalfBlock = false; + } + } + } + } + } +} diff --git a/Tiles/FloralParadise/PeatMoss.png b/Tiles/FloralParadise/PeatMoss.png new file mode 100644 index 0000000000..8a38476c20 Binary files /dev/null and b/Tiles/FloralParadise/PeatMoss.png differ diff --git a/Tiles/FloralParadise/PerennialTree.cs b/Tiles/FloralParadise/PerennialTree.cs new file mode 100644 index 0000000000..ae4c3d6aec --- /dev/null +++ b/Tiles/FloralParadise/PerennialTree.cs @@ -0,0 +1,114 @@ +using System; +using CalamityMod.DataStructures; +using CalamityMod.ILEditing; +using CalamityMod.Tiles.BaseTiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class PerennialTree : DynamicallyGrownTree + { + // The max amount that branches can travel. Once the distance of the branches reaches or exceeds this threshold, the tree is done growing. + public override float MaxDistanceBeforeCutoff => 2100f; + + public override float DistanceUsedForTrunk => 140f; + + public override float BranchMaxBendFactor => 0.7f; + + public override float BranchTurnAngleVariance => 0.4f; + + public override float MinBranchLength => 30f; + + public override float TrunkWidth => 16f; + + public override float ChanceToCreateNewBranches => 0.8f; + + public override float VerticalStretchFactor => 12f; + + public override float DownwardBiasFactor => 0.4f; + + public override float BranchGrowthWidthDecay => 0.61f; + + public override int MaxCutoffBranchesPerBranch => 5; + + public override void SetStaticDefaults() + { + Main.tileAxe[Type] = true; + Main.tileFrameImportant[Type] = true; + DustType = 7; + ItemDrop = ItemID.Wood; + UseDefaultSize(); + TileObjectData.addTile(Type); + + AddMapEntry(Color.SaddleBrown); + } + + public void DrawVine(Vector2 vineTop, Vector2 downwardBottom, int totalVinesToDraw, float swayFactor) + { + Texture2D vineTexture = ModContent.Request("CalamityMod/Tiles/PerennialTreeVines").Value; + + // Determine the initial points for the vines. + Vector2[] controlPoints = new Vector2[8]; + Vector2 lightOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(-Main.offScreenRange); + for (int i = 0; i < controlPoints.Length; i++) + { + float swayOffset = swayFactor; + controlPoints[i] = Vector2.Lerp(vineTop, downwardBottom, i / (float)(controlPoints.Length - 1f)); + + Point p = (controlPoints[i] + lightOffset + BranchDrawer.PreviousPoint.ToWorldCoordinates()).ToTileCoordinates(); + + // 02JUN2024: Ozzatron: directionY did not exist at the time of the creation of the Perennial Tree. As such, it is ignored here. + ILChanges.Windgrid.GetWindTime(p.X, p.Y, 40, out int windTimeLeft, out int direction, out _); + + float windInterpolant = windTimeLeft / 40f; + swayOffset += Utils.GetLerpValue(0f, 0.45f, windInterpolant, true) * Utils.GetLerpValue(1f, 0.55f, windInterpolant, true) * direction * 28f; + controlPoints[i].X += swayOffset * Utils.GetLerpValue(0f, controlPoints.Length - 1f, i, true); + controlPoints[i].Y -= 4f; + } + BezierCurve vineCurve = new(controlPoints); + + int drawCount = (int)(totalVinesToDraw * 2.4f); + for (int i = 0; i < drawCount - 1; i++) + { + Vector2 vineCenter = vineCurve.Evaluate(i / (float)(drawCount - 1f)); + Vector2 ahead = vineCurve.Evaluate((i + 1f) / (float)(drawCount - 1f)); + float rotation = (ahead - vineCenter).ToRotation() - MathHelper.PiOver2; + vineCenter += BranchDrawer.PreviousPoint.ToWorldCoordinates() - Main.screenPosition; + + // Calculate light values. + Vector2 lightPosition = vineCenter + lightOffset + Main.screenPosition; + + int frameX = 0; + int frameY = 0; + if (i > 0) + frameY = RNG.Next(1, 3); + if (i >= drawCount - 3) + { + frameY = 3; + frameX = RNG.Next(3); + } + if (i == drawCount - 2) + frameY = 4; + + Rectangle frame = vineTexture.Frame(3, 5, frameX, frameY, -2, -2); + Color color = Lighting.GetColor(lightPosition.ToTileCoordinates()); + + Main.spriteBatch.Draw(vineTexture, vineCenter, frame, color, rotation, frame.Size() * 0.5f, 1f, 0f, 0); + } + } + + public override void DrawThingAtEndOfBranch(BranchDrawer.Branch branch) + { + int totalVinesToDraw = RNG.Next(4, 7); + float swayFactor = Main.windSpeedCurrent + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.87f + RNG.NextFloat(0.94f)) * 0.4f; + Vector2 top = branch.EndOfCurve + Vector2.UnitY * 12f; + Vector2 bottom = top + Vector2.UnitY * totalVinesToDraw * 30f; + DrawVine(top, bottom, totalVinesToDraw, swayFactor * 35f); + } + } +} diff --git a/Tiles/FloralParadise/PerennialTree.png b/Tiles/FloralParadise/PerennialTree.png new file mode 100644 index 0000000000..77e0372437 Binary files /dev/null and b/Tiles/FloralParadise/PerennialTree.png differ diff --git a/Tiles/FloralParadise/PinkFlower.cs b/Tiles/FloralParadise/PinkFlower.cs new file mode 100644 index 0000000000..9ce0123ad4 --- /dev/null +++ b/Tiles/FloralParadise/PinkFlower.cs @@ -0,0 +1,89 @@ +using CalamityMod.ILEditing; +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class PinkFlower : ModTile + { + public const int Variants = 2; + + public const int WindPushLifetime = 45; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.RandomStyleRange = Variants; + + TileObjectData.addTile(Type); + + HitSound = SoundID.Grass; + DustType = 44; + AddMapEntry(new Color(255, 155, 202)); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (drawData.tileFrameX % 36 == 0 && drawData.tileFrameY == 0) + Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); + } + + public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) + { + // 02JUN2024: Ozzatron: directionY did not exist at the time of the creation of this content. As such, it is ignored here. + ILChanges.Windgrid.GetWindTime(i, j, WindPushLifetime, out int windTimeLeft, out int direction, out _); + + float windInterpolant = windTimeLeft / (float)WindPushLifetime; + float windRotation = Utils.GetLerpValue(0f, 0.5f, windInterpolant, true) * Utils.GetLerpValue(1f, 0.5f, windInterpolant, true) * direction * 0.34f; + + int frameX = Main.tile[i, j].TileFrameX; + Color drawColor = Lighting.GetColor(i, j); + Texture2D stamenTexture = ModContent.Request("CalamityMod/Tiles/FloralParadise/PinkFlowerStamen").Value; + Rectangle stamenFrame = stamenTexture.Frame(2, 1, frameX > 36 ? 1 : 0, 0); + Vector2 stamenOrigin = stamenFrame.Size() * new Vector2(0.5f, 1f); + Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPos = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset + new Vector2(17f, 24f); + + // Create some pollen dust. + if (!Main.gamePaused && windTimeLeft >= 2 && Main.rand.NextBool(6)) + { + Vector2 pollenVelocity = -Vector2.UnitY.RotatedByRandom(windRotation * 2.3f) * 3f; + Dust pollen = Dust.NewDustPerfect(drawPos + Main.screenPosition - drawOffset - Vector2.UnitY * 16f, 44); + pollen.velocity = pollenVelocity; + pollen.scale = 1.4f; + } + + Main.spriteBatch.Draw(stamenTexture, drawPos, stamenFrame, drawColor, windRotation, stamenOrigin, 1f, SpriteEffects.None, 0f); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/FloralParadise/PinkFlower.png b/Tiles/FloralParadise/PinkFlower.png new file mode 100644 index 0000000000..283ca92731 Binary files /dev/null and b/Tiles/FloralParadise/PinkFlower.png differ diff --git a/Tiles/FloralParadise/PinkFlowerBig.cs b/Tiles/FloralParadise/PinkFlowerBig.cs new file mode 100644 index 0000000000..ce416e6c8f --- /dev/null +++ b/Tiles/FloralParadise/PinkFlowerBig.cs @@ -0,0 +1,95 @@ +using System; +using CalamityMod.ILEditing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class PinkFlowerBig : ModTile + { + public const int Variants = 2; + + public const int WindPushLifetime = 48; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + Main.tileLighted[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.RandomStyleRange = Variants; + + HitSound = SoundID.Grass; + TileObjectData.addTile(Type); + + DustType = 44; + AddMapEntry(new Color(255, 155, 202)); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.5f; + g = 0.4f; + b = 0.16f; + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (drawData.tileFrameX % 72 == 0 && drawData.tileFrameY == 0) + Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); + } + + public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) + { + // 02JUN2024: Ozzatron: directionY did not exist at the time of the creation of this content. As such, it is ignored here. + ILChanges.Windgrid.GetWindTime(i, j, WindPushLifetime, out int windTimeLeft, out int direction, out _); + + float windInterpolant = windTimeLeft / (float)WindPushLifetime; + float windRotation = Utils.GetLerpValue(0f, 0.5f, windInterpolant, true) * Utils.GetLerpValue(1f, 0.5f, windInterpolant, true) * direction * 0.34f; + + int frameX = Main.tile[i, j].TileFrameX; + Color drawColor = Lighting.GetColor(i, j); + Texture2D stamenTexture = ModContent.Request("CalamityMod/Tiles/FloralParadise/PinkFlowerBigStamen").Value; + Rectangle stamenFrame = stamenTexture.Frame(2, 1, frameX > 72 ? 1 : 0, 0); + Vector2 stamenOrigin = stamenFrame.Size() * new Vector2(0.5f, 1f); + Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPos = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset + new Vector2(31f, 38f); + if (frameX < 72) + drawPos.X += 4f; + + // Create some pollen dust. + if (!Main.gamePaused && windTimeLeft >= 2 && Main.rand.NextBool(4)) + { + Vector2 pollenVelocity = -Vector2.UnitY.RotatedByRandom(windRotation * 2.3f) * 3f; + Dust pollen = Dust.NewDustPerfect(drawPos + Main.screenPosition - drawOffset - Vector2.UnitY * 16f, 44); + pollen.velocity = pollenVelocity; + pollen.scale = 1.6f; + } + + Main.spriteBatch.Draw(stamenTexture, drawPos, stamenFrame, drawColor, windRotation, stamenOrigin, 1f, SpriteEffects.None, 0f); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/FloralParadise/PinkFlowerBig.png b/Tiles/FloralParadise/PinkFlowerBig.png new file mode 100644 index 0000000000..b8611c19c8 Binary files /dev/null and b/Tiles/FloralParadise/PinkFlowerBig.png differ diff --git a/Tiles/FloralParadise/PinkFlowerBigStamen.png b/Tiles/FloralParadise/PinkFlowerBigStamen.png new file mode 100644 index 0000000000..146950fb0d Binary files /dev/null and b/Tiles/FloralParadise/PinkFlowerBigStamen.png differ diff --git a/Tiles/FloralParadise/PinkFlowerStamen.png b/Tiles/FloralParadise/PinkFlowerStamen.png new file mode 100644 index 0000000000..9641dcb280 Binary files /dev/null and b/Tiles/FloralParadise/PinkFlowerStamen.png differ diff --git a/Tiles/FloralParadise/SmallFloralPlants.cs b/Tiles/FloralParadise/SmallFloralPlants.cs new file mode 100644 index 0000000000..79dcf79fa1 --- /dev/null +++ b/Tiles/FloralParadise/SmallFloralPlants.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class SmallFloralPlants : ModTile + { + public const int Variants = 8; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileCut[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + + HitSound = SoundID.Grass; + DustType = 2; + AddMapEntry(new Color(28, 216, 94)); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (CalamityUtils.ParanoidTileRetrieval(i, j).LiquidAmount > 64) + WorldGen.KillTile(i, j); + } + } +} diff --git a/Tiles/FloralParadise/SmallFloralPlants.png b/Tiles/FloralParadise/SmallFloralPlants.png new file mode 100644 index 0000000000..f16c30cd3a Binary files /dev/null and b/Tiles/FloralParadise/SmallFloralPlants.png differ diff --git a/Tiles/FloralParadise/SmallMossPiles.cs b/Tiles/FloralParadise/SmallMossPiles.cs new file mode 100644 index 0000000000..a927dcd5d1 --- /dev/null +++ b/Tiles/FloralParadise/SmallMossPiles.cs @@ -0,0 +1,48 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class SmallMossPiles : ModTile + { + public const int Variants = 4; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 1; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.RandomStyleRange = Variants; + + TileObjectData.addTile(Type); + + DustType = 38; + + AddMapEntry(new Color(56, 56, 56)); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + } +} diff --git a/Tiles/FloralParadise/SmallMossPiles.png b/Tiles/FloralParadise/SmallMossPiles.png new file mode 100644 index 0000000000..78133c1a7d Binary files /dev/null and b/Tiles/FloralParadise/SmallMossPiles.png differ diff --git a/Tiles/FloralParadise/SmallVines.cs b/Tiles/FloralParadise/SmallVines.cs new file mode 100644 index 0000000000..8cdbfd28dd --- /dev/null +++ b/Tiles/FloralParadise/SmallVines.cs @@ -0,0 +1,95 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class SmallVines : ModTile + { + public override void SetStaticDefaults() + { + Main.tileCut[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + AddMapEntry(new Color(100, 151, 31)); + HitSound = SoundID.Grass; + DustType = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + if (WorldGen.genRand.NextBool(2) && Main.player[(int)Player.FindClosest(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16)].cordage) + Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope); + + if (Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType == Type) + { + WorldGen.KillTile(i, j + 1, false, false, false); + if (!Main.tile[i, j + 1].HasTile && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); + } + } + + if (Main.tile[i, j - 1].HasTile && Main.tile[i, j - 1].TileType == Type) + { + Main.tile[i, j - 1].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18); + Main.tile[i, j - 1].TileFrameY = 54; + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); + } + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j + 1] != null) + { + if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != Type) + { + if (Main.tile[i, j + 1].LiquidAmount >= 128 && Main.tile[i, j + 1].LiquidType == LiquidID.Water) + { + bool canGrow = false; + for (int y = j; y > j - 10; j--) + { + if (Main.tile[i, y].BottomSlope) + { + canGrow = false; + break; + } + if (Main.tile[i, y].HasTile && !Main.tile[i, y].BottomSlope) + { + canGrow = true; + break; + } + } + if (canGrow) + { + int below = j + 1; + Main.tile[i, below].TileType = Type; + Main.tile[i, below].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18); + Main.tile[i, below].TileFrameY = 54; + Main.tile[i, below - 1].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18); + Main.tile[i, below - 1].TileFrameY = (short)(WorldGen.genRand.Next(3) * 18); + Main.tile[i, below].Get().HasTile = true; + WorldGen.SquareTileFrame(i, below, true); + WorldGen.SquareTileFrame(i, below - 1, true); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, below, 3, TileChangeType.None); + NetMessage.SendTileSquare(-1, i, below - 1, 3, TileChangeType.None); + } + } + } + } + } + } + } +} diff --git a/Tiles/FloralParadise/SmallVines.png b/Tiles/FloralParadise/SmallVines.png new file mode 100644 index 0000000000..6b64a467be Binary files /dev/null and b/Tiles/FloralParadise/SmallVines.png differ diff --git a/Tiles/FloralParadise/SmallWallFungi.cs b/Tiles/FloralParadise/SmallWallFungi.cs new file mode 100644 index 0000000000..0897ba3df2 --- /dev/null +++ b/Tiles/FloralParadise/SmallWallFungi.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class SmallWallFungi : ModTile + { + public const int Variants = 3; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 1; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + DustType = 0; + + AddMapEntry(new Color(165, 126, 84)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FloralParadise/SmallWallFungi.png b/Tiles/FloralParadise/SmallWallFungi.png new file mode 100644 index 0000000000..de025416bc Binary files /dev/null and b/Tiles/FloralParadise/SmallWallFungi.png differ diff --git a/Tiles/FloralParadise/SmallWallFungiLeft.cs b/Tiles/FloralParadise/SmallWallFungiLeft.cs new file mode 100644 index 0000000000..5bf26a266e --- /dev/null +++ b/Tiles/FloralParadise/SmallWallFungiLeft.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class SmallWallFungiLeft : ModTile + { + public const int Variants = 3; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 1; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + DustType = 0; + + AddMapEntry(new Color(165, 126, 84)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FloralParadise/SmallWallFungiLeft.png b/Tiles/FloralParadise/SmallWallFungiLeft.png new file mode 100644 index 0000000000..55d42f575c Binary files /dev/null and b/Tiles/FloralParadise/SmallWallFungiLeft.png differ diff --git a/Tiles/FloralParadise/TallFloralPlants.cs b/Tiles/FloralParadise/TallFloralPlants.cs new file mode 100644 index 0000000000..ab4d00e0df --- /dev/null +++ b/Tiles/FloralParadise/TallFloralPlants.cs @@ -0,0 +1,55 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class TallFloralPlants : ModTile + { + public const int Variants = 12; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileCut[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 1; + TileObjectData.newTile.Origin = new Point16(1, 0); + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + + HitSound = SoundID.Grass; + DustType = 2; + AddMapEntry(new Color(106, 135, 69)); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 4; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (CalamityUtils.ParanoidTileRetrieval(i, j).LiquidAmount > 64) + WorldGen.KillTile(i, j); + } + } +} diff --git a/Tiles/FloralParadise/TallFloralPlants.png b/Tiles/FloralParadise/TallFloralPlants.png new file mode 100644 index 0000000000..45e35742a0 Binary files /dev/null and b/Tiles/FloralParadise/TallFloralPlants.png differ diff --git a/Tiles/FloralParadise/VineLoops.cs b/Tiles/FloralParadise/VineLoops.cs new file mode 100644 index 0000000000..f2350cc926 --- /dev/null +++ b/Tiles/FloralParadise/VineLoops.cs @@ -0,0 +1,39 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class VineLoops : ModTile + { + public const int Variants = 3; + + public override void SetStaticDefaults() + { + Main.tileCut[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorTop = new(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + + AddMapEntry(new Color(47, 75, 32)); + HitSound = SoundID.Grass; + DustType = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FloralParadise/VineLoops.png b/Tiles/FloralParadise/VineLoops.png new file mode 100644 index 0000000000..987e3b445d Binary files /dev/null and b/Tiles/FloralParadise/VineLoops.png differ diff --git a/Tiles/FloralParadise/WallLeaves.cs b/Tiles/FloralParadise/WallLeaves.cs new file mode 100644 index 0000000000..ac13b4b1e7 --- /dev/null +++ b/Tiles/FloralParadise/WallLeaves.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class WallLeaves : ModTile + { + public const int Variants = 3; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + + HitSound = SoundID.Grass; + DustType = 0; + + AddMapEntry(new Color(145, 170, 61)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FloralParadise/WallLeaves.png b/Tiles/FloralParadise/WallLeaves.png new file mode 100644 index 0000000000..2a9a284419 Binary files /dev/null and b/Tiles/FloralParadise/WallLeaves.png differ diff --git a/Tiles/FloralParadise/WallLeavesLeft.cs b/Tiles/FloralParadise/WallLeavesLeft.cs new file mode 100644 index 0000000000..2cfbb980bd --- /dev/null +++ b/Tiles/FloralParadise/WallLeavesLeft.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class WallLeavesLeft : ModTile + { + public const int Variants = 3; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.RandomStyleRange = Variants; + TileObjectData.addTile(Type); + + HitSound = SoundID.Grass; + DustType = 0; + + AddMapEntry(new Color(145, 170, 61)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FloralParadise/WallLeavesLeft.png b/Tiles/FloralParadise/WallLeavesLeft.png new file mode 100644 index 0000000000..a82df1d3ea Binary files /dev/null and b/Tiles/FloralParadise/WallLeavesLeft.png differ diff --git a/Tiles/FloralParadise/WaterfallCreator.cs b/Tiles/FloralParadise/WaterfallCreator.cs new file mode 100644 index 0000000000..ad070df5af --- /dev/null +++ b/Tiles/FloralParadise/WaterfallCreator.cs @@ -0,0 +1,42 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FloralParadise +{ + public class WaterfallCreator : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = false; + Main.tileBlockLight[Type] = true; + Main.tileBrick[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithOres(Type); + CalamityUtils.MergeWithFloralParadise(Type); + + HitSound = SoundID.Tink; + + AddMapEntry(new Color(33, 56, 27)); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); + if (Main.netMode == NetmodeID.Server || !Main.rand.NextBool() || Main.gamePaused || tile.LiquidAmount > 0) + return; + + for (int k = 0; k < 16; k++) + { + Vector2 waterVelocity = -Vector2.UnitY.RotatedByRandom(0.29f) * Main.rand.NextFloat(1f, 2.4f); + float waterScale = Main.rand.NextFloat(0.08f, 0.12f); + Color waterColor = Color.Lerp(Color.Cyan, Color.SkyBlue, Main.rand.NextFloat()); + Vector2 particlePosition = new Vector2(i + 0.5f, j + 0.5f) * 16f + Vector2.UnitY * Main.rand.NextFloat(24f); + GeneralParticleHandler.SpawnParticle(new WaterFoamParticle(particlePosition, waterVelocity, 150, waterScale, waterColor)); + } + } + } +} diff --git a/Tiles/FloralParadise/WaterfallCreator.png b/Tiles/FloralParadise/WaterfallCreator.png new file mode 100644 index 0000000000..622533204a Binary files /dev/null and b/Tiles/FloralParadise/WaterfallCreator.png differ diff --git a/Tiles/Furniture/BlueCandle.cs b/Tiles/Furniture/BlueCandle.cs index e174008003..ae874cba1a 100644 --- a/Tiles/Furniture/BlueCandle.cs +++ b/Tiles/Furniture/BlueCandle.cs @@ -2,9 +2,9 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; +using Terraria.Audio; +using Terraria.GameContent.ObjectInteractions; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -12,6 +12,9 @@ namespace CalamityMod.Tiles.Furniture { public class BlueCandle : ModTile { + // TODO -- Unique sounds for each Cirrus Candle. + public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -22,9 +25,39 @@ namespace CalamityMod.Tiles.Furniture AdjTiles = new int[] { TileID.Candles }; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); AddMapEntry(new Color(238, 145, 105), CalamityUtils.GetItemName()); + TileID.Sets.HasOutlines[Type] = true; AnimationFrameHeight = 18; } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Player p = Main.LocalPlayer; + + // Forcibly remove all candle buffs. + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + + // 108000 is the duration used by Ammo Box. + p.AddBuff(ModContent.BuffType(), 108000); + + // Play a sound. + SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); + + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; @@ -35,15 +68,6 @@ namespace CalamityMod.Tiles.Furniture } } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (player is null) - return; - if (!player.dead && player.active) - player.AddBuff(ModContent.BuffType(), 20); - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.35f; diff --git a/Tiles/Furniture/BlueCandle_Highlight.png b/Tiles/Furniture/BlueCandle_Highlight.png new file mode 100644 index 0000000000..02427f1b60 Binary files /dev/null and b/Tiles/Furniture/BlueCandle_Highlight.png differ diff --git a/Tiles/Furniture/BossRelics/AstrumDeusRelic.png b/Tiles/Furniture/BossRelics/AstrumDeusRelic.png index 1fdf1e0d99..c5c314a84d 100644 Binary files a/Tiles/Furniture/BossRelics/AstrumDeusRelic.png and b/Tiles/Furniture/BossRelics/AstrumDeusRelic.png differ diff --git a/Tiles/Furniture/PinkCandle.cs b/Tiles/Furniture/PinkCandle.cs index fd4a947066..3ffb8dbfab 100644 --- a/Tiles/Furniture/PinkCandle.cs +++ b/Tiles/Furniture/PinkCandle.cs @@ -2,9 +2,9 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; +using Terraria.Audio; +using Terraria.GameContent.ObjectInteractions; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -12,6 +12,9 @@ namespace CalamityMod.Tiles.Furniture { public class PinkCandle : ModTile { + // TODO -- Unique sounds for each Cirrus Candle. + public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -22,9 +25,39 @@ namespace CalamityMod.Tiles.Furniture AdjTiles = new int[] { TileID.Candles }; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); AddMapEntry(new Color(238, 145, 105), CalamityUtils.GetItemName()); + TileID.Sets.HasOutlines[Type] = true; AnimationFrameHeight = 18; } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Player p = Main.LocalPlayer; + + // Forcibly remove all candle buffs. + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + + // 108000 is the duration used by Ammo Box. + p.AddBuff(ModContent.BuffType(), 108000); + + // Play a sound. + SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); + + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; @@ -35,15 +68,6 @@ namespace CalamityMod.Tiles.Furniture } } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (player is null) - return; - if (!player.dead && player.active) - player.AddBuff(ModContent.BuffType(), 20); - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.75f; diff --git a/Tiles/Furniture/PinkCandle_Highlight.png b/Tiles/Furniture/PinkCandle_Highlight.png new file mode 100644 index 0000000000..02427f1b60 Binary files /dev/null and b/Tiles/Furniture/PinkCandle_Highlight.png differ diff --git a/Tiles/Furniture/PurpleCandle.cs b/Tiles/Furniture/PurpleCandle.cs index 232603c410..31d1864cf7 100644 --- a/Tiles/Furniture/PurpleCandle.cs +++ b/Tiles/Furniture/PurpleCandle.cs @@ -2,9 +2,9 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; +using Terraria.Audio; +using Terraria.GameContent.ObjectInteractions; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -12,6 +12,9 @@ namespace CalamityMod.Tiles.Furniture { public class PurpleCandle : ModTile { + // TODO -- Unique sounds for each Cirrus Candle. + public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -22,9 +25,39 @@ namespace CalamityMod.Tiles.Furniture AdjTiles = new int[] { TileID.Candles }; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); AddMapEntry(new Color(238, 145, 105), CalamityUtils.GetItemName()); + TileID.Sets.HasOutlines[Type] = true; AnimationFrameHeight = 18; } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Player p = Main.LocalPlayer; + + // Forcibly remove all candle buffs. + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + + // 108000 is the duration used by Ammo Box. + p.AddBuff(ModContent.BuffType(), 108000); + + // Play a sound. + SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); + + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; @@ -35,15 +68,6 @@ namespace CalamityMod.Tiles.Furniture } } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (player is null) - return; - if (!player.dead && player.active) - player.AddBuff(ModContent.BuffType(), 20); - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.65f; diff --git a/Tiles/Furniture/PurpleCandle_Highlight.png b/Tiles/Furniture/PurpleCandle_Highlight.png new file mode 100644 index 0000000000..02427f1b60 Binary files /dev/null and b/Tiles/Furniture/PurpleCandle_Highlight.png differ diff --git a/Tiles/Furniture/YellowCandle.cs b/Tiles/Furniture/YellowCandle.cs index 54779eadf4..177df09292 100644 --- a/Tiles/Furniture/YellowCandle.cs +++ b/Tiles/Furniture/YellowCandle.cs @@ -2,6 +2,8 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -10,6 +12,9 @@ namespace CalamityMod.Tiles.Furniture { public class YellowCandle : ModTile { + // TODO -- Unique sounds for each Cirrus Candle. + public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -19,9 +24,39 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.addTile(Type); AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); AddMapEntry(new Color(238, 145, 105), CalamityUtils.GetItemName()); + TileID.Sets.HasOutlines[Type] = true; AnimationFrameHeight = 18; } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Player p = Main.LocalPlayer; + + // Forcibly remove all candle buffs. + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + + // 108000 is the duration used by Ammo Box. + p.AddBuff(ModContent.BuffType(), 108000); + + // Play a sound. + SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); + + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; @@ -32,29 +67,6 @@ namespace CalamityMod.Tiles.Furniture } } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (player == null || !player.active || player.dead) - return; - player.AddBuff(ModContent.BuffType(), 20); - - if (Main.netMode == NetmodeID.MultiplayerClient) - return; - - // All NPCs within a certain distance of the player get "Tagged" with Spite. - for (int m = 0; m < Main.maxNPCs; m++) - { - NPC npc = Main.npc[m]; - if (npc is null || !npc.active || npc.friendly) - continue; - - float dist2 = npc.DistanceSQ(player.Center); - if (dist2 < 23040000f) // 4800px range - Main.npc[m].AddBuff(ModContent.BuffType(), 20, false); - } - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.75f; diff --git a/Tiles/Furniture/YellowCandle_Highlight.png b/Tiles/Furniture/YellowCandle_Highlight.png new file mode 100644 index 0000000000..02427f1b60 Binary files /dev/null and b/Tiles/Furniture/YellowCandle_Highlight.png differ diff --git a/Tiles/FurnitureExo/ExoWorkBenchTile.cs b/Tiles/FurnitureExo/ExoWorkBenchTile.cs index 09264ba031..9347c89993 100644 --- a/Tiles/FurnitureExo/ExoWorkBenchTile.cs +++ b/Tiles/FurnitureExo/ExoWorkBenchTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -25,6 +26,11 @@ namespace CalamityMod.Tiles.FurnitureExo num = fail ? 1 : 3; } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 16, ModContent.ItemType()); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xFrameOffset = Main.tile[i, j].TileFrameX; diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index 3cc6d1c162..bec39eb551 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -1,6 +1,7 @@  using System; using System.Collections.Generic; +using CalamityMod.Tiles.FloralParadise; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -28,6 +29,7 @@ namespace CalamityMod.Tiles.Ores Main.tileShine2[Type] = true; CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithFloralParadise(Type); TileID.Sets.Ore[Type] = true; TileID.Sets.OreMergesWithMud[Type] = true; diff --git a/Tiles/PerennialTreeVines.png b/Tiles/PerennialTreeVines.png new file mode 100644 index 0000000000..19356dd5fe Binary files /dev/null and b/Tiles/PerennialTreeVines.png differ diff --git a/Tiles/Rubblemaker/SunkenSea/BrainCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/BrainCoralEcho.cs index 2f310a0da3..9de2a1b76e 100644 --- a/Tiles/Rubblemaker/SunkenSea/BrainCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/BrainCoralEcho.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { public class BrainCoralEcho : ModTile { - public override string Texture => "CalamityMod/Tiles/SunkenSea/BrainCoral"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/BrainCoral"; public override void SetStaticDefaults() { diff --git a/Tiles/Rubblemaker/SunkenSea/CoralPileLargeEcho.cs b/Tiles/Rubblemaker/SunkenSea/CoralPileLargeEcho.cs index cbfa9300c9..93a794a6bb 100644 --- a/Tiles/Rubblemaker/SunkenSea/CoralPileLargeEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/CoralPileLargeEcho.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { public class CoralPileLargeEcho : ModTile { - public override string Texture => "CalamityMod/Tiles/SunkenSea/CoralPileLarge"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/CoralPileLarge"; public override void SetStaticDefaults() { Main.tileLighted[Type] = true; diff --git a/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs index 4ee2a05729..621d2a1ccd 100644 --- a/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { public class FanCoralEcho : ModTile { - public override string Texture => "CalamityMod/Tiles/SunkenSea/FanCoral"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/FanCoral"; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Rubblemaker/SunkenSea/MediumCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/MediumCoralEcho.cs index 2583c0c2f7..ce5b492050 100644 --- a/Tiles/Rubblemaker/SunkenSea/MediumCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/MediumCoralEcho.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { public class MediumCoralEcho : ModTile { - public override string Texture => "CalamityMod/Tiles/SunkenSea/MediumCoral"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/MediumCoral"; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -34,6 +34,6 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea public class MediumCoral2Echo : MediumCoralEcho { - public override string Texture => "CalamityMod/Tiles/SunkenSea/MediumCoral2"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/MediumCoral2"; } } diff --git a/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs b/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs index 57c7b8341e..11948f22aa 100644 --- a/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { public class SeaAnemoneEcho : ModTile { - public override string Texture => "CalamityMod/Tiles/SunkenSea/SeaAnemone"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SeaAnemone"; public override void SetStaticDefaults() { AnimationFrameHeight = 36; diff --git a/Tiles/Rubblemaker/SunkenSea/SmallBrainCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/SmallBrainCoralEcho.cs index 7f5d890a8e..8eae4a37e7 100644 --- a/Tiles/Rubblemaker/SunkenSea/SmallBrainCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SmallBrainCoralEcho.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { public class SmallBrainCoralEcho : ModTile { - public override string Texture => "CalamityMod/Tiles/SunkenSea/SmallBrainCoral"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SmallBrainCoral"; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Rubblemaker/SunkenSea/SmallCoralsEcho.cs b/Tiles/Rubblemaker/SunkenSea/SmallCoralsEcho.cs index 099fc82862..d9ab7f41dd 100644 --- a/Tiles/Rubblemaker/SunkenSea/SmallCoralsEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SmallCoralsEcho.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { public class SmallCoralsEcho : ModTile { - public override string Texture => "CalamityMod/Tiles/SunkenSea/SmallCorals"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SmallCorals"; public override void SetStaticDefaults() { Main.tileLighted[Type] = false; diff --git a/Tiles/Rubblemaker/SunkenSea/SmallTubeCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/SmallTubeCoralEcho.cs index 6cf2e9c25e..74b3418a4f 100644 --- a/Tiles/Rubblemaker/SunkenSea/SmallTubeCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SmallTubeCoralEcho.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { public class SmallTubeCoralEcho : ModTile { - public override string Texture => "CalamityMod/Tiles/SunkenSea/SmallTubeCoral"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SmallTubeCoral"; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Rubblemaker/SunkenSea/SmallWideCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/SmallWideCoralEcho.cs index 61a47c4125..468e302c00 100644 --- a/Tiles/Rubblemaker/SunkenSea/SmallWideCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SmallWideCoralEcho.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { public class SmallWideCoralEcho : ModTile { - public override string Texture => "CalamityMod/Tiles/SunkenSea/SmallWideCoral"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SmallWideCoral"; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -29,6 +29,6 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea } public class SmallWideCoral2Echo : SmallWideCoralEcho { - public override string Texture => "CalamityMod/Tiles/SunkenSea/SmallWideCoral2"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SmallWideCoral2"; } } diff --git a/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs index 7bc07af392..d210666410 100644 --- a/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { int subsheetHeight = 34; int subsheetWidth = 108; - public override string Texture => "CalamityMod/Tiles/SunkenSea/TableCoral"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/TableCoral"; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Rubblemaker/SunkenSea/TubeCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/TubeCoralEcho.cs index cf20f621f5..1ca9b428a7 100644 --- a/Tiles/Rubblemaker/SunkenSea/TubeCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/TubeCoralEcho.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { public class TubeCoralEcho : ModTile { - public override string Texture => "CalamityMod/Tiles/SunkenSea/TubeCoral"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/TubeCoral"; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; diff --git a/Tiles/SunkenSea/Ambient/BlueCoralTree.cs b/Tiles/SunkenSea/Ambient/BlueCoralTree.cs new file mode 100644 index 0000000000..eb6976e536 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/BlueCoralTree.cs @@ -0,0 +1,40 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class BlueCoralTree : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(1, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + 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.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(126, 80, 69)); + DustType = 155; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 60f / 255f; + g = 110f / 255f; + b = 146f / 255f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/BlueCoralTree.png b/Tiles/SunkenSea/Ambient/BlueCoralTree.png new file mode 100644 index 0000000000..852e9a8489 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/BlueCoralTree.png differ diff --git a/Tiles/SunkenSea/BrainCoral.cs b/Tiles/SunkenSea/Ambient/BrainCoral.cs similarity index 97% rename from Tiles/SunkenSea/BrainCoral.cs rename to Tiles/SunkenSea/Ambient/BrainCoral.cs index 0d45d6be8b..f3f73b002f 100644 --- a/Tiles/SunkenSea/BrainCoral.cs +++ b/Tiles/SunkenSea/Ambient/BrainCoral.cs @@ -7,7 +7,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class BrainCoral : ModTile { diff --git a/Tiles/SunkenSea/BrainCoral.png b/Tiles/SunkenSea/Ambient/BrainCoral.png similarity index 100% rename from Tiles/SunkenSea/BrainCoral.png rename to Tiles/SunkenSea/Ambient/BrainCoral.png diff --git a/Tiles/SunkenSea/Ambient/BrownCoral.cs b/Tiles/SunkenSea/Ambient/BrownCoral.cs new file mode 100644 index 0000000000..0e76768aa2 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/BrownCoral.cs @@ -0,0 +1,70 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Humanizer; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class BrownCoral1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + 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.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(113, 80, 28)); + DustType = 155; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 244f / 450f; + g = 238f / 450f; + b = 162f / 450f; + } + } + + public class BrownCoral2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + 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.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(113, 80, 28)); + DustType = 155; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 244f / 400f; + g = 238f / 400f; + b = 162f / 400f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/BrownCoral1.png b/Tiles/SunkenSea/Ambient/BrownCoral1.png new file mode 100644 index 0000000000..0462d340c0 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/BrownCoral1.png differ diff --git a/Tiles/SunkenSea/Ambient/BrownCoral2.png b/Tiles/SunkenSea/Ambient/BrownCoral2.png new file mode 100644 index 0000000000..dda7733164 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/BrownCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/CoralPileGiant.cs b/Tiles/SunkenSea/Ambient/CoralPileGiant.cs new file mode 100644 index 0000000000..3951a41547 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/CoralPileGiant.cs @@ -0,0 +1,33 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class CoralPileGiant : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + 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.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(126, 80, 69)); + DustType = 155; + HitSound = SoundID.Dig; + } + } +} \ No newline at end of file diff --git a/Tiles/SunkenSea/Ambient/CoralPileGiant.png b/Tiles/SunkenSea/Ambient/CoralPileGiant.png new file mode 100644 index 0000000000..60bf132e5c Binary files /dev/null and b/Tiles/SunkenSea/Ambient/CoralPileGiant.png differ diff --git a/Tiles/SunkenSea/CoralPileLarge.cs b/Tiles/SunkenSea/Ambient/CoralPileLarge.cs similarity index 96% rename from Tiles/SunkenSea/CoralPileLarge.cs rename to Tiles/SunkenSea/Ambient/CoralPileLarge.cs index 22b5133821..72923bb43f 100644 --- a/Tiles/SunkenSea/CoralPileLarge.cs +++ b/Tiles/SunkenSea/Ambient/CoralPileLarge.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class CoralPileLarge : ModTile { diff --git a/Tiles/SunkenSea/CoralPileLarge.png b/Tiles/SunkenSea/Ambient/CoralPileLarge.png similarity index 100% rename from Tiles/SunkenSea/CoralPileLarge.png rename to Tiles/SunkenSea/Ambient/CoralPileLarge.png diff --git a/Tiles/SunkenSea/Ambient/DepthVines.cs b/Tiles/SunkenSea/Ambient/DepthVines.cs new file mode 100644 index 0000000000..faf1b14f81 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/DepthVines.cs @@ -0,0 +1,88 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class DepthVines : ModTile + { + public override void SetStaticDefaults() + { + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoFail[Type] = true; + Main.tileNoAttach[Type] = true; + TileID.Sets.IsVine[Type] = true; + TileID.Sets.VineThreads[Type] = true; + AddMapEntry(new Color(41, 97, 126)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + Tile tile = Framing.GetTileSafely(i, j + 1); + if (tile.HasTile && tile.TileType == Type) + { + WorldGen.KillTile(i, j + 1); + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileAbove = Framing.GetTileSafely(i, j - 1); + int type = -1; + if (tileAbove.HasTile && !tileAbove.BottomSlope) + { + type = tileAbove.TileType; + } + + if (type == ModContent.TileType() || type == Type) + { + return true; + } + + WorldGen.KillTile(i, j); + return true; + } + + 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) + { + bool PlaceVine = false; + int Test = j; + while (Test > j - 10) + { + Tile testTile = Framing.GetTileSafely(i, Test); + if (testTile.BottomSlope) + { + break; + } + else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) + { + Test--; + continue; + } + PlaceVine = true; + break; + } + + if (PlaceVine) + { + tileBelow.TileType = Type; + tileBelow.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } + } +} diff --git a/Tiles/SunkenSea/Ambient/DepthVines.png b/Tiles/SunkenSea/Ambient/DepthVines.png new file mode 100644 index 0000000000..63ed9cd2b4 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DepthVines.png differ diff --git a/Tiles/SunkenSea/FanCoral.cs b/Tiles/SunkenSea/Ambient/FanCoral.cs similarity index 81% rename from Tiles/SunkenSea/FanCoral.cs rename to Tiles/SunkenSea/Ambient/FanCoral.cs index 9159a92307..26e5feed73 100644 --- a/Tiles/SunkenSea/FanCoral.cs +++ b/Tiles/SunkenSea/Ambient/FanCoral.cs @@ -1,11 +1,12 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Enums; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class FanCoral : ModTile { @@ -22,11 +23,10 @@ namespace CalamityMod.Tiles.SunkenSea base.SetStaticDefaults(); } - public override void NearbyEffects(int i, int j, bool closer) { if (!Main.dedServ) - Main.SceneMetrics.ActiveFountainColor = ModContent.Find("CalamityMod/SunkenSeaWater").Slot; + Main.SceneMetrics.ActiveFountainColor = ModContent.Find("CalamityMod/SunkenSeaBurrowsWater").Slot; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -36,9 +36,9 @@ namespace CalamityMod.Tiles.SunkenSea public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.3f; - g = 0.75f; - b = 0.75f; + r = 225f / 255f; + g = 255f / 255f; + b = 255f / 255f; } } } diff --git a/Tiles/SunkenSea/Ambient/FanCoral.png b/Tiles/SunkenSea/Ambient/FanCoral.png new file mode 100644 index 0000000000..9d6f7aa87d Binary files /dev/null and b/Tiles/SunkenSea/Ambient/FanCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/GiantNavystone.cs b/Tiles/SunkenSea/Ambient/GiantNavystone.cs new file mode 100644 index 0000000000..5d55115998 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/GiantNavystone.cs @@ -0,0 +1,55 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class GiantNavystone1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(2, 4); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + 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.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(0, 62, 84)); + DustType = 96; + HitSound = SoundID.Dig; + } + } + + public class GiantNavystone2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + 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.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(0, 62, 84)); + DustType = 96; + HitSound = SoundID.Dig; + } + } +} \ No newline at end of file diff --git a/Tiles/SunkenSea/Ambient/GiantNavystone1.png b/Tiles/SunkenSea/Ambient/GiantNavystone1.png new file mode 100644 index 0000000000..30991cd306 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/GiantNavystone1.png differ diff --git a/Tiles/SunkenSea/Ambient/GiantNavystone2.png b/Tiles/SunkenSea/Ambient/GiantNavystone2.png new file mode 100644 index 0000000000..05d8cf79f8 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/GiantNavystone2.png differ diff --git a/Tiles/SunkenSea/Ambient/Kelp.png b/Tiles/SunkenSea/Ambient/Kelp.png new file mode 100644 index 0000000000..797e3a4875 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/Kelp.png differ diff --git a/Tiles/SunkenSea/MediumCoral.cs b/Tiles/SunkenSea/Ambient/MediumCoral.cs similarity index 54% rename from Tiles/SunkenSea/MediumCoral.cs rename to Tiles/SunkenSea/Ambient/MediumCoral.cs index 0b81d79d94..5c27fcdb6f 100644 --- a/Tiles/SunkenSea/MediumCoral.cs +++ b/Tiles/SunkenSea/Ambient/MediumCoral.cs @@ -4,7 +4,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class MediumCoral : ModTile { @@ -14,6 +14,7 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); @@ -26,9 +27,31 @@ namespace CalamityMod.Tiles.SunkenSea { num = fail ? 1 : 2; } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 229f / 350f; + g = 137f / 350f; + b = 204f / 350f; + } } public class MediumCoral2 : MediumCoral { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 60f / 400f; + g = 110f / 400f; + b = 146f / 400f; + } + } + + public class MediumCoral3 : MediumCoral + { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 60f / 255f; + g = 110f / 255f; + b = 146f / 255f; + } } } diff --git a/Tiles/SunkenSea/MediumCoral.png b/Tiles/SunkenSea/Ambient/MediumCoral.png similarity index 100% rename from Tiles/SunkenSea/MediumCoral.png rename to Tiles/SunkenSea/Ambient/MediumCoral.png diff --git a/Tiles/SunkenSea/MediumCoral2.png b/Tiles/SunkenSea/Ambient/MediumCoral2.png similarity index 100% rename from Tiles/SunkenSea/MediumCoral2.png rename to Tiles/SunkenSea/Ambient/MediumCoral2.png diff --git a/Tiles/SunkenSea/Ambient/MediumCoral3.png b/Tiles/SunkenSea/Ambient/MediumCoral3.png new file mode 100644 index 0000000000..fdc4826321 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/MediumCoral3.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePile.cs b/Tiles/SunkenSea/Ambient/NavystonePile.cs new file mode 100644 index 0000000000..9f98dc98a6 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/NavystonePile.cs @@ -0,0 +1,33 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class NavystonePile1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(0, 62, 84)); + DustType = 96; + HitSound = SoundID.Dig; + } + } + + public class NavystonePile2 : NavystonePile1 + { + } + + public class NavystonePile3 : NavystonePile1 + { + } +} \ No newline at end of file diff --git a/Tiles/SunkenSea/Ambient/NavystonePile1.png b/Tiles/SunkenSea/Ambient/NavystonePile1.png new file mode 100644 index 0000000000..45709a1865 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystonePile1.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePile2.png b/Tiles/SunkenSea/Ambient/NavystonePile2.png new file mode 100644 index 0000000000..a3ff914034 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystonePile2.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePile3.png b/Tiles/SunkenSea/Ambient/NavystonePile3.png new file mode 100644 index 0000000000..73fa4a8fa4 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystonePile3.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePileSmall1.png b/Tiles/SunkenSea/Ambient/NavystonePileSmall1.png new file mode 100644 index 0000000000..d4e121013f Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystonePileSmall1.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePileSmall2.png b/Tiles/SunkenSea/Ambient/NavystonePileSmall2.png new file mode 100644 index 0000000000..e47f6e8a47 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystonePileSmall2.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePileSmall3.png b/Tiles/SunkenSea/Ambient/NavystonePileSmall3.png new file mode 100644 index 0000000000..3892fee61c Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystonePileSmall3.png differ diff --git a/Tiles/SunkenSea/SeaAnemone.cs b/Tiles/SunkenSea/Ambient/SeaAnemone.cs similarity index 95% rename from Tiles/SunkenSea/SeaAnemone.cs rename to Tiles/SunkenSea/Ambient/SeaAnemone.cs index c4f0fe6c6b..fe95a937cc 100644 --- a/Tiles/SunkenSea/SeaAnemone.cs +++ b/Tiles/SunkenSea/Ambient/SeaAnemone.cs @@ -4,7 +4,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class SeaAnemone : ModTile { diff --git a/Tiles/SunkenSea/SeaAnemone.png b/Tiles/SunkenSea/Ambient/SeaAnemone.png similarity index 100% rename from Tiles/SunkenSea/SeaAnemone.png rename to Tiles/SunkenSea/Ambient/SeaAnemone.png diff --git a/Tiles/SunkenSea/SmallBrainCoral.cs b/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs similarity index 97% rename from Tiles/SunkenSea/SmallBrainCoral.cs rename to Tiles/SunkenSea/Ambient/SmallBrainCoral.cs index 458ca975ea..6013e6ac73 100644 --- a/Tiles/SunkenSea/SmallBrainCoral.cs +++ b/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs @@ -7,7 +7,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class SmallBrainCoral : ModTile { diff --git a/Tiles/SunkenSea/SmallBrainCoral.png b/Tiles/SunkenSea/Ambient/SmallBrainCoral.png similarity index 100% rename from Tiles/SunkenSea/SmallBrainCoral.png rename to Tiles/SunkenSea/Ambient/SmallBrainCoral.png diff --git a/Tiles/SunkenSea/SmallCorals.cs b/Tiles/SunkenSea/Ambient/SmallCorals.cs similarity index 70% rename from Tiles/SunkenSea/SmallCorals.cs rename to Tiles/SunkenSea/Ambient/SmallCorals.cs index 84237a5d3e..e430167287 100644 --- a/Tiles/SunkenSea/SmallCorals.cs +++ b/Tiles/SunkenSea/Ambient/SmallCorals.cs @@ -4,7 +4,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class SmallCorals : ModTile { @@ -29,10 +29,30 @@ namespace CalamityMod.Tiles.SunkenSea base.SetStaticDefaults(); } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + int type = -1; + + if (tileBelow.HasTile) + { + type = tileBelow.TileType; + } + + if (type == ModContent.TileType()) + { + return true; + } + + WorldGen.KillTile(i, j); + + return true; + } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { - offsetY = -16; - height = 32; + offsetY = 0; + height = 16; } } } diff --git a/Tiles/SunkenSea/Ambient/SmallCorals.png b/Tiles/SunkenSea/Ambient/SmallCorals.png new file mode 100644 index 0000000000..1aa6601be7 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/SmallCorals.png differ diff --git a/Tiles/SunkenSea/SmallTubeCoral.cs b/Tiles/SunkenSea/Ambient/SmallTubeCoral.cs similarity index 93% rename from Tiles/SunkenSea/SmallTubeCoral.cs rename to Tiles/SunkenSea/Ambient/SmallTubeCoral.cs index 16d683138f..f37261d8d9 100644 --- a/Tiles/SunkenSea/SmallTubeCoral.cs +++ b/Tiles/SunkenSea/Ambient/SmallTubeCoral.cs @@ -4,7 +4,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class SmallTubeCoral : ModTile { diff --git a/Tiles/SunkenSea/SmallTubeCoral.png b/Tiles/SunkenSea/Ambient/SmallTubeCoral.png similarity index 100% rename from Tiles/SunkenSea/SmallTubeCoral.png rename to Tiles/SunkenSea/Ambient/SmallTubeCoral.png diff --git a/Tiles/SunkenSea/SmallWideCoral.cs b/Tiles/SunkenSea/Ambient/SmallWideCoral.cs similarity index 61% rename from Tiles/SunkenSea/SmallWideCoral.cs rename to Tiles/SunkenSea/Ambient/SmallWideCoral.cs index f0c524f145..5d7641c3f6 100644 --- a/Tiles/SunkenSea/SmallWideCoral.cs +++ b/Tiles/SunkenSea/Ambient/SmallWideCoral.cs @@ -4,7 +4,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class SmallWideCoral : ModTile { @@ -14,6 +14,7 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); @@ -22,8 +23,20 @@ namespace CalamityMod.Tiles.SunkenSea base.SetStaticDefaults(); } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 161f / 500f; + g = 183f / 500f; + b = 73f / 500f; + } } public class SmallWideCoral2 : SmallWideCoral { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 229f / 700f; + g = 137f / 700f; + b = 204f / 700f; + } } } diff --git a/Tiles/SunkenSea/SmallWideCoral.png b/Tiles/SunkenSea/Ambient/SmallWideCoral.png similarity index 100% rename from Tiles/SunkenSea/SmallWideCoral.png rename to Tiles/SunkenSea/Ambient/SmallWideCoral.png diff --git a/Tiles/SunkenSea/SmallWideCoral2.png b/Tiles/SunkenSea/Ambient/SmallWideCoral2.png similarity index 100% rename from Tiles/SunkenSea/SmallWideCoral2.png rename to Tiles/SunkenSea/Ambient/SmallWideCoral2.png diff --git a/Tiles/SunkenSea/SunkenStalactite.cs b/Tiles/SunkenSea/Ambient/SunkenStalactite.cs similarity index 95% rename from Tiles/SunkenSea/SunkenStalactite.cs rename to Tiles/SunkenSea/Ambient/SunkenStalactite.cs index da6c615697..ab84ff433c 100644 --- a/Tiles/SunkenSea/SunkenStalactite.cs +++ b/Tiles/SunkenSea/Ambient/SunkenStalactite.cs @@ -9,7 +9,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { [LegacyName("SunkenStalactites")] public class SunkenStalactite1 : ModTile diff --git a/Tiles/SunkenSea/SunkenStalactite1.png b/Tiles/SunkenSea/Ambient/SunkenStalactite1.png similarity index 100% rename from Tiles/SunkenSea/SunkenStalactite1.png rename to Tiles/SunkenSea/Ambient/SunkenStalactite1.png diff --git a/Tiles/SunkenSea/SunkenStalactite2.png b/Tiles/SunkenSea/Ambient/SunkenStalactite2.png similarity index 100% rename from Tiles/SunkenSea/SunkenStalactite2.png rename to Tiles/SunkenSea/Ambient/SunkenStalactite2.png diff --git a/Tiles/SunkenSea/SunkenStalactite3.png b/Tiles/SunkenSea/Ambient/SunkenStalactite3.png similarity index 100% rename from Tiles/SunkenSea/SunkenStalactite3.png rename to Tiles/SunkenSea/Ambient/SunkenStalactite3.png diff --git a/Tiles/SunkenSea/SunkenStalactites.png b/Tiles/SunkenSea/Ambient/SunkenStalactites.png similarity index 100% rename from Tiles/SunkenSea/SunkenStalactites.png rename to Tiles/SunkenSea/Ambient/SunkenStalactites.png diff --git a/Tiles/SunkenSea/SunkenStalactitesSmall.cs b/Tiles/SunkenSea/Ambient/SunkenStalactitesSmall.cs similarity index 95% rename from Tiles/SunkenSea/SunkenStalactitesSmall.cs rename to Tiles/SunkenSea/Ambient/SunkenStalactitesSmall.cs index a8c2b84f4d..8200dfda84 100644 --- a/Tiles/SunkenSea/SunkenStalactitesSmall.cs +++ b/Tiles/SunkenSea/Ambient/SunkenStalactitesSmall.cs @@ -9,7 +9,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class SunkenStalactitesSmall : ModTile { diff --git a/Tiles/SunkenSea/SunkenStalactitesSmall.png b/Tiles/SunkenSea/Ambient/SunkenStalactitesSmall.png similarity index 100% rename from Tiles/SunkenSea/SunkenStalactitesSmall.png rename to Tiles/SunkenSea/Ambient/SunkenStalactitesSmall.png diff --git a/Tiles/SunkenSea/SunkenStalagmite.cs b/Tiles/SunkenSea/Ambient/SunkenStalagmite.cs similarity index 95% rename from Tiles/SunkenSea/SunkenStalagmite.cs rename to Tiles/SunkenSea/Ambient/SunkenStalagmite.cs index 9f2f977034..43fc2022a2 100644 --- a/Tiles/SunkenSea/SunkenStalagmite.cs +++ b/Tiles/SunkenSea/Ambient/SunkenStalagmite.cs @@ -9,7 +9,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { [LegacyName("SunkenStalagmites")] public class SunkenStalagmite1 : ModTile diff --git a/Tiles/SunkenSea/SunkenStalagmite1.png b/Tiles/SunkenSea/Ambient/SunkenStalagmite1.png similarity index 100% rename from Tiles/SunkenSea/SunkenStalagmite1.png rename to Tiles/SunkenSea/Ambient/SunkenStalagmite1.png diff --git a/Tiles/SunkenSea/SunkenStalagmite2.png b/Tiles/SunkenSea/Ambient/SunkenStalagmite2.png similarity index 100% rename from Tiles/SunkenSea/SunkenStalagmite2.png rename to Tiles/SunkenSea/Ambient/SunkenStalagmite2.png diff --git a/Tiles/SunkenSea/SunkenStalagmite3.png b/Tiles/SunkenSea/Ambient/SunkenStalagmite3.png similarity index 100% rename from Tiles/SunkenSea/SunkenStalagmite3.png rename to Tiles/SunkenSea/Ambient/SunkenStalagmite3.png diff --git a/Tiles/SunkenSea/SunkenStalagmitesSmall.cs b/Tiles/SunkenSea/Ambient/SunkenStalagmitesSmall.cs similarity index 93% rename from Tiles/SunkenSea/SunkenStalagmitesSmall.cs rename to Tiles/SunkenSea/Ambient/SunkenStalagmitesSmall.cs index 708499454c..e38fa0a231 100644 --- a/Tiles/SunkenSea/SunkenStalagmitesSmall.cs +++ b/Tiles/SunkenSea/Ambient/SunkenStalagmitesSmall.cs @@ -9,7 +9,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class SunkenStalagmitesSmall : ModTile { diff --git a/Tiles/SunkenSea/SunkenStalagmitesSmall.png b/Tiles/SunkenSea/Ambient/SunkenStalagmitesSmall.png similarity index 100% rename from Tiles/SunkenSea/SunkenStalagmitesSmall.png rename to Tiles/SunkenSea/Ambient/SunkenStalagmitesSmall.png diff --git a/Tiles/SunkenSea/TableCoral.cs b/Tiles/SunkenSea/Ambient/TableCoral.cs similarity index 72% rename from Tiles/SunkenSea/TableCoral.cs rename to Tiles/SunkenSea/Ambient/TableCoral.cs index 27ebb6385d..7cf5773531 100644 --- a/Tiles/SunkenSea/TableCoral.cs +++ b/Tiles/SunkenSea/Ambient/TableCoral.cs @@ -6,12 +6,10 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class TableCoral : ModTile { - int subsheetHeight = 34; - int subsheetWidth = 108; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -26,20 +24,19 @@ namespace CalamityMod.Tiles.SunkenSea TileObjectData.addTile(Type); DustType = 253; AddMapEntry(new Color(54, 69, 72)); - - base.SetStaticDefaults(); } public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - int xPos = i % 1; - int yPos = j % 3; - frameXOffset = xPos * subsheetWidth; - frameYOffset = yPos * subsheetHeight; - } + } + + public class TableCoral2 : TableCoral + { + } + + public class TableCoral3 : TableCoral + { } } diff --git a/Tiles/SunkenSea/Ambient/TableCoral.png b/Tiles/SunkenSea/Ambient/TableCoral.png new file mode 100644 index 0000000000..45ea42abfd Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TableCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/TableCoral2.png b/Tiles/SunkenSea/Ambient/TableCoral2.png new file mode 100644 index 0000000000..90c37eaa63 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TableCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/TableCoral3.png b/Tiles/SunkenSea/Ambient/TableCoral3.png new file mode 100644 index 0000000000..4b9b83df62 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TableCoral3.png differ diff --git a/Tiles/SunkenSea/TubeCoral.cs b/Tiles/SunkenSea/Ambient/TubeCoral.cs similarity index 95% rename from Tiles/SunkenSea/TubeCoral.cs rename to Tiles/SunkenSea/Ambient/TubeCoral.cs index 31156612a1..e8a7b0fd81 100644 --- a/Tiles/SunkenSea/TubeCoral.cs +++ b/Tiles/SunkenSea/Ambient/TubeCoral.cs @@ -4,7 +4,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.SunkenSea.Ambient { public class TubeCoral : ModTile { diff --git a/Tiles/SunkenSea/TubeCoral.png b/Tiles/SunkenSea/Ambient/TubeCoral.png similarity index 100% rename from Tiles/SunkenSea/TubeCoral.png rename to Tiles/SunkenSea/Ambient/TubeCoral.png diff --git a/Tiles/SunkenSea/Ambient/WallCoral.cs b/Tiles/SunkenSea/Ambient/WallCoral.cs new file mode 100644 index 0000000000..634fe16177 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/WallCoral.cs @@ -0,0 +1,72 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class WallCoral1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSolidTop[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.addAlternate(1); + TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.addTile(Type); + DustType = 253; + AddMapEntry(new Color(54, 69, 72)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 189f / 450f; + g = 72f / 450f; + b = 72f / 450f; + } + } + + public class WallCoral2 : WallCoral1 + { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 96f / 450f; + g = 157f / 450f; + b = 187f / 450f; + } + } + + public class WallCoral3 : WallCoral1 + { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 68f / 450f; + g = 154f / 450f; + b = 128f / 450f; + } + } + + public class WallCoral4 : WallCoral1 + { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 206f / 450f; + g = 88f / 450f; + b = 174f / 450f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/WallCoral1.png b/Tiles/SunkenSea/Ambient/WallCoral1.png new file mode 100644 index 0000000000..5efc01eaec Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WallCoral1.png differ diff --git a/Tiles/SunkenSea/Ambient/WallCoral2.png b/Tiles/SunkenSea/Ambient/WallCoral2.png new file mode 100644 index 0000000000..ab007eeb0f Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WallCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/WallCoral3.png b/Tiles/SunkenSea/Ambient/WallCoral3.png new file mode 100644 index 0000000000..c5017e1401 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WallCoral3.png differ diff --git a/Tiles/SunkenSea/Ambient/WallCoral4.png b/Tiles/SunkenSea/Ambient/WallCoral4.png new file mode 100644 index 0000000000..901f50fcdb Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WallCoral4.png differ diff --git a/Tiles/SunkenSea/Basalt.cs b/Tiles/SunkenSea/Basalt.cs new file mode 100644 index 0000000000..400d198569 --- /dev/null +++ b/Tiles/SunkenSea/Basalt.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class Basalt : ModTile + { + private int sheetWidth = 234; + private int sheetHeight = 90; + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; + + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileShine2[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + + DustType = 36; + HitSound = SoundID.Tink; + + AddMapEntry(new Color(58, 55, 70)); + + MinPick = 100; + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = i % 4 * sheetWidth; + frameYOffset = j % 4 * sheetHeight; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + // 02JUN2024: Ozzatron: unclear if this is the correct framing strategy for Basalt + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/Basalt.png b/Tiles/SunkenSea/Basalt.png new file mode 100644 index 0000000000..05a9bf9830 Binary files /dev/null and b/Tiles/SunkenSea/Basalt.png differ diff --git a/Tiles/SunkenSea/BlackPearlPile.cs b/Tiles/SunkenSea/BlackPearlPile.cs new file mode 100644 index 0000000000..79329bcd99 --- /dev/null +++ b/Tiles/SunkenSea/BlackPearlPile.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class BlackPearlPile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + TileID.Sets.HasSlopeFrames[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Shatter; + DustType = 82; + AddMapEntry(new Color(29, 33, 38)); + + TileID.Sets.CanBeDugByShovel[Type] = true; + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/BlackPearlPile.png b/Tiles/SunkenSea/BlackPearlPile.png new file mode 100644 index 0000000000..9e0e102c2c Binary files /dev/null and b/Tiles/SunkenSea/BlackPearlPile.png differ diff --git a/Tiles/SunkenSea/CyanCoral.cs b/Tiles/SunkenSea/CyanCoral.cs new file mode 100644 index 0000000000..31182aeff1 --- /dev/null +++ b/Tiles/SunkenSea/CyanCoral.cs @@ -0,0 +1,66 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class CyanCoral : ModTile + { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + Main.tileLighted[Type] = true; + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Dig; + DustType = 119; + AddMapEntry(new Color(92, 168, 198)); + Main.tileShine2[Type] = true; + + TileID.Sets.CanBeDugByShovel[Type] = true; + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) + { + float brightness = 0.9f; + Color Color1 = new Color(130, 213, 247); + Color Color2 = new Color(26, 68, 85); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + r = (value.R + value1.R) / 400f; + g = (value.G + value1.G) / 400f; + b = (value.B + value1.B) / 400f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/CyanCoral.png b/Tiles/SunkenSea/CyanCoral.png new file mode 100644 index 0000000000..318df78b1c Binary files /dev/null and b/Tiles/SunkenSea/CyanCoral.png differ diff --git a/Tiles/SunkenSea/Driftwood.cs b/Tiles/SunkenSea/Driftwood.cs new file mode 100644 index 0000000000..87238d3856 --- /dev/null +++ b/Tiles/SunkenSea/Driftwood.cs @@ -0,0 +1,43 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Metadata; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class Driftwood : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Wood"]); + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeDecorativeTiles(Type); + CalamityUtils.MergeWithDesert(Type); + + TileID.Sets.ChecksForMerge[Type] = true; + TileID.Sets.HasSlopeFrames[Type] = true; + HitSound = SoundID.Dig; + DustType = 121; + AddMapEntry(new Color(136, 129, 154)); + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/Driftwood.png b/Tiles/SunkenSea/Driftwood.png new file mode 100644 index 0000000000..d128a364a4 Binary files /dev/null and b/Tiles/SunkenSea/Driftwood.png differ diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 58baf6e83c..88f3b3f72b 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.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -14,6 +15,8 @@ namespace CalamityMod.Tiles.SunkenSea { public override void SetStaticDefaults() { + TileID.Sets.GeneralPlacementTiles[Type] = false; + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); @@ -22,13 +25,13 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithDesert(Type); // Tile blends with sandstone, which it is set to merge with here Main.tileShine[Type] = 1800; - Main.tileShine2[Type] = false; + Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; DustType = 108; - AddMapEntry(new Color(92, 145, 167)); + AddMapEntry(new Color(158, 203, 234)); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); @@ -41,19 +44,76 @@ namespace CalamityMod.Tiles.SunkenSea Tile up = Main.tile[i, j - 1]; Tile up2 = Main.tile[i, j - 2]; - // Place SmallCorals - if (WorldGen.genRand.NextBool(8) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (!up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { - up.TileType = (ushort)ModContent.TileType(); - up.HasTile = true; - up.TileFrameY = 0; + // Place corals + if (WorldGen.genRand.NextBool(3)) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; - // 6 different frames, choose a random one - up.TileFrameX = (short)(WorldGen.genRand.Next(6) * 18); - WorldGen.SquareTileFrame(i, j - 1, true); + // 15 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(15) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) - NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + + //multi-colored corals + if (WorldGen.genRand.NextBool(3)) + { + ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + ushort newObject = Main.rand.Next(ColoredCorals); + + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); + } + + //blue coral trees + if (WorldGen.genRand.NextBool(6)) + { + ushort[] BlueCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + ushort newObject = Main.rand.Next(BlueCorals); + + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); + } + + //brown coral trees + if (WorldGen.genRand.NextBool(6)) + { + ushort[] BrownCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + ushort newObject = Main.rand.Next(BrownCorals); + + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); + } + + //fan coral + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceObject(i, j - 1, (ushort)ModContent.TileType()); + } + + //misc corals + if (WorldGen.genRand.NextBool()) + { + ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + ushort newObject = Main.rand.Next(MiscCorals); + + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); + } } } diff --git a/Tiles/SunkenSea/FanCoral.png b/Tiles/SunkenSea/FanCoral.png deleted file mode 100644 index 0ffee8ecf3..0000000000 Binary files a/Tiles/SunkenSea/FanCoral.png and /dev/null differ diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.cs b/Tiles/SunkenSea/HardenedEutrophicSand.cs index b198501573..df2fd299ba 100644 --- a/Tiles/SunkenSea/HardenedEutrophicSand.cs +++ b/Tiles/SunkenSea/HardenedEutrophicSand.cs @@ -1,4 +1,6 @@ using System.Collections.Generic; +using CalamityMod.Items.Placeables; +using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -18,14 +20,14 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - Main.tileShine[Type] = 2200; - Main.tileShine2[Type] = false; + Main.tileShine[Type] = 1800; + Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; DustType = 108; - AddMapEntry(new Color(67, 107, 143)); + AddMapEntry(new Color(61, 151, 194)); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); @@ -43,5 +45,44 @@ namespace CalamityMod.Tiles.SunkenSea { return TileFraming.BrimstoneFraming(i, j, resetFrame); } + + public override void RandomUpdate(int i, int j) + { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + 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)) + { + ushort[] TubeCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + ushort newObject = Main.rand.Next(TubeCorals); + + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); + } + + //anemonie + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceObject(i, j - 1, (ushort)ModContent.TileType(), true); + NetMessage.SendObjectPlacement(-1, i, j - 1, (ushort)ModContent.TileType(), 0, 0, -1, -1); + } + } + } } } diff --git a/Tiles/SunkenSea/LimeCoral.cs b/Tiles/SunkenSea/LimeCoral.cs new file mode 100644 index 0000000000..057dc93370 --- /dev/null +++ b/Tiles/SunkenSea/LimeCoral.cs @@ -0,0 +1,60 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class LimeCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + Main.tileLighted[Type] = true; + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Dig; + DustType = 119; + AddMapEntry(new Color(139, 206, 56)); + Main.tileShine2[Type] = true; + + TileID.Sets.CanBeDugByShovel[Type] = true; + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) + { + float brightness = 0.9f; + Color Color1 = new Color(176, 242, 96); + Color Color2 = new Color(82, 113, 29); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + r = (value.R + value1.R) / 300f; + g = (value.G + value1.G) / 300f; + b = (value.B + value1.B) / 300f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/LimeCoral.png b/Tiles/SunkenSea/LimeCoral.png new file mode 100644 index 0000000000..b7fb07b8d0 Binary files /dev/null and b/Tiles/SunkenSea/LimeCoral.png differ diff --git a/Tiles/SunkenSea/Limestone.cs b/Tiles/SunkenSea/Limestone.cs new file mode 100644 index 0000000000..d741e2ad16 --- /dev/null +++ b/Tiles/SunkenSea/Limestone.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class Limestone : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Tink; + DustType = 22; + AddMapEntry(new Color(154, 119, 119)); + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/Limestone.png b/Tiles/SunkenSea/Limestone.png new file mode 100644 index 0000000000..8663309de3 Binary files /dev/null and b/Tiles/SunkenSea/Limestone.png differ diff --git a/Tiles/SunkenSea/MagentaCoral.cs b/Tiles/SunkenSea/MagentaCoral.cs new file mode 100644 index 0000000000..80df31c297 --- /dev/null +++ b/Tiles/SunkenSea/MagentaCoral.cs @@ -0,0 +1,65 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class MagentaCoral : ModTile + { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + Main.tileLighted[Type] = true; + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Dig; + DustType = 119; + AddMapEntry(new Color(206, 56, 123)); + Main.tileShine2[Type] = true; + + TileID.Sets.CanBeDugByShovel[Type] = true; + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) + { + float brightness = 0.9f; + Color Color1 = new Color(242, 96, 161); + Color Color2 = new Color(156, 51, 83); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + r = (value.R + value1.R) / 300f; + g = (value.G + value1.G) / 300f; + b = (value.B + value1.B) / 300f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/MagentaCoral.png b/Tiles/SunkenSea/MagentaCoral.png new file mode 100644 index 0000000000..e02ef96fce Binary files /dev/null and b/Tiles/SunkenSea/MagentaCoral.png differ diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 783d94f011..e64618908a 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -1,9 +1,7 @@ -using System.Collections.Generic; +using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea @@ -12,15 +10,18 @@ namespace CalamityMod.Tiles.SunkenSea { public override void SetStaticDefaults() { + TileID.Sets.GeneralPlacementTiles[Type] = false; + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); + Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; DustType = 96; - AddMapEntry(new Color(31, 92, 114)); + AddMapEntry(new Color(17, 53, 77)); HitSound = SoundID.Tink; this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); @@ -38,5 +39,26 @@ namespace CalamityMod.Tiles.SunkenSea { return TileFraming.BrimstoneFraming(i, j, resetFrame); } + + public override void RandomUpdate(int i, int j) + { + Tile Tile = Framing.GetTileSafely(i, j); + Tile Below = Framing.GetTileSafely(i, j + 1); + Tile Above = Framing.GetTileSafely(i, j - 1); + + if (!Below.HasTile && Below.LiquidType <= 0 && !Tile.BottomSlope) + { + if (Main.rand.NextBool(10)) + { + Below.TileType = (ushort)ModContent.TileType(); + Below.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } } } diff --git a/Tiles/SunkenSea/OrangeCoral.cs b/Tiles/SunkenSea/OrangeCoral.cs new file mode 100644 index 0000000000..524eaa2a2c --- /dev/null +++ b/Tiles/SunkenSea/OrangeCoral.cs @@ -0,0 +1,60 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class OrangeCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + Main.tileLighted[Type] = true; + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Dig; + DustType = 119; + AddMapEntry(Color.Orange); + Main.tileShine2[Type] = true; + + TileID.Sets.CanBeDugByShovel[Type] = true; + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) + { + float brightness = 0.9f; + Color Color1 = new Color(255, 177, 120); + Color Color2 = new Color(117, 23, 44); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + r = (value.R + value1.R) / 300f; + g = (value.G + value1.G) / 300f; + b = (value.B + value1.B) / 300f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/OrangeCoral.png b/Tiles/SunkenSea/OrangeCoral.png new file mode 100644 index 0000000000..182cfa6a7d Binary files /dev/null and b/Tiles/SunkenSea/OrangeCoral.png differ diff --git a/Tiles/SunkenSea/PinkPearlPile.cs b/Tiles/SunkenSea/PinkPearlPile.cs new file mode 100644 index 0000000000..73dc8d3d12 --- /dev/null +++ b/Tiles/SunkenSea/PinkPearlPile.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class PinkPearlPile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Shatter; + DustType = 119; + AddMapEntry(new Color(204, 143, 174)); + Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = true; + + TileID.Sets.CanBeDugByShovel[Type] = true; + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/PinkPearlPile.png b/Tiles/SunkenSea/PinkPearlPile.png new file mode 100644 index 0000000000..6fac3acc57 Binary files /dev/null and b/Tiles/SunkenSea/PinkPearlPile.png differ diff --git a/Tiles/SunkenSea/PolishedNavystoneBrick.cs b/Tiles/SunkenSea/PolishedNavystoneBrick.cs new file mode 100644 index 0000000000..f2395b02fe --- /dev/null +++ b/Tiles/SunkenSea/PolishedNavystoneBrick.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class PolishedNavystoneBrick : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + CalamityUtils.MergeWithGeneral(Type); + TileID.Sets.HasSlopeFrames[Type] = true; + + HitSound = SoundID.Tink; + DustType = 96; + AddMapEntry(new Color(53, 99, 117)); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/PolishedNavystoneBrick.png b/Tiles/SunkenSea/PolishedNavystoneBrick.png new file mode 100644 index 0000000000..6707f33131 Binary files /dev/null and b/Tiles/SunkenSea/PolishedNavystoneBrick.png differ diff --git a/Tiles/SunkenSea/PolypSand.cs b/Tiles/SunkenSea/PolypSand.cs new file mode 100644 index 0000000000..a89bd0d3c6 --- /dev/null +++ b/Tiles/SunkenSea/PolypSand.cs @@ -0,0 +1,43 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class PolypSand : ModTile + { + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + Main.tileShine2[Type] = true; + + DustType = 147; + AddMapEntry(new Color(221, 180, 182)); + + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/PolypSand.png b/Tiles/SunkenSea/PolypSand.png new file mode 100644 index 0000000000..561c962c9e Binary files /dev/null and b/Tiles/SunkenSea/PolypSand.png differ diff --git a/Tiles/SunkenSea/RuneSand.cs b/Tiles/SunkenSea/RuneSand.cs new file mode 100644 index 0000000000..b477d06e0a --- /dev/null +++ b/Tiles/SunkenSea/RuneSand.cs @@ -0,0 +1,43 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class RuneSand : ModTile + { + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + Main.tileShine2[Type] = true; + + DustType = 147; + AddMapEntry(new Color(210, 124, 45)); + + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/RuneSand.png b/Tiles/SunkenSea/RuneSand.png new file mode 100644 index 0000000000..06514fde68 Binary files /dev/null and b/Tiles/SunkenSea/RuneSand.png differ diff --git a/Tiles/SunkenSea/Runestone.cs b/Tiles/SunkenSea/Runestone.cs new file mode 100644 index 0000000000..020cb14e1d --- /dev/null +++ b/Tiles/SunkenSea/Runestone.cs @@ -0,0 +1,43 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class Runestone : ModTile + { + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Tink; + DustType = 22; + AddMapEntry(new Color(152, 89, 78)); + Main.tileShine2[Type] = true; + + TileID.Sets.CanBeDugByShovel[Type] = true; + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/Runestone.png b/Tiles/SunkenSea/Runestone.png new file mode 100644 index 0000000000..610bdefa21 Binary files /dev/null and b/Tiles/SunkenSea/Runestone.png differ diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index c0227a3a46..4ffb9390f8 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -1,9 +1,7 @@ -using System.Collections.Generic; +using System; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea @@ -20,13 +18,13 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - + Main.tileLighted[Type] = true; Main.tileShine[Type] = 3500; Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; DustType = 33; - AddMapEntry(new Color(0, 150, 200)); + AddMapEntry(new Color(97, 212, 223)); HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; MinPick = 55; @@ -44,7 +42,21 @@ namespace CalamityMod.Tiles.SunkenSea frameXOffset = i % 2 * subsheetWidth; frameYOffset = j % 2 * subsheetHeight; } - + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.9f; + Color blue = new Color(67, 187, 204); + Color darkviolet = new Color(18, 67, 116); + Color value = Color.Lerp(blue, darkviolet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(blue, darkviolet, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + r = (value.R + value1.R) / 900f; + g = (value.G + value1.G) / 900f; + b = (value.B + value1.B) / 900f; + r *= brightness; + g *= brightness; + b *= brightness; + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { return TileFraming.BrimstoneFraming(i, j, resetFrame); diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs index 9fa9ed36d7..45cd6ba00b 100644 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ b/Tiles/SunkenSea/SeaPrismCrystals.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables; +using System; +using CalamityMod.Items.Placeables; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = true; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(0, 150, 200), CalamityUtils.GetItemName()); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); HitSound = SoundID.Item27; DustType = 67; Main.tileSpelunker[Type] = true; @@ -35,21 +36,46 @@ namespace CalamityMod.Tiles.SunkenSea int xframe = tile.TileFrameX / 18; if (xframe > 7 && xframe < 14) { + //Purple + Color darkviolet = new Color(75, 54, 103); + Color violet = new Color(231, 205, 245); + Color value = Color.Lerp(darkviolet, violet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.037f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(darkviolet, violet, (MathF.Sin((j - 120) / 50f + Main.GameUpdateCount * 0.014f + -i / 30f) + 1f) / 2f); r = lessLightDueToLowWater ? 0.36f : 0.48f; g = lessLightDueToLowWater ? 0.315f : 0.42f; b = lessLightDueToLowWater ? 0.405f : 0.54f; + r *= (value.R + value1.R) / 300f; + g *= (value.G + value1.G) / 300f; + b *= (value.B + value1.B) / 300f; + } else if (xframe >= 14) { + //Green + Color murkeygreen = new Color(28, 68, 54); + Color lightgreen = new Color(166, 234, 198); + Color value2 = Color.Lerp(murkeygreen, lightgreen, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.027f + i / 40f) + 1f) / 2f); + Color value3 = Color.Lerp(murkeygreen, lightgreen, (MathF.Sin((j - 80) / 50f + Main.GameUpdateCount * 0.034f + -i / 30f) + 1f) / 2f); r = lessLightDueToLowWater ? 0.225f : 0.3f; g = lessLightDueToLowWater ? 0.405f : 0.54f; b = lessLightDueToLowWater ? 0.315f : 0.42f; + r *= (value2.R + value3.R) / 300f; + g *= (value2.G + value3.G) / 300f; + b *= (value2.B + value3.B) / 300f; } else { + //Blue + Color blue = new Color(67, 187, 204); + Color darkviolet = new Color(18, 67, 116); + Color value = Color.Lerp(blue, darkviolet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(blue, darkviolet, (MathF.Sin((j - 10) / 50f + Main.GameUpdateCount * 0.064f + -i / 30f) + 1f) / 2f); r = lessLightDueToLowWater ? 0.27f : 0.36f; g = lessLightDueToLowWater ? 0.405f : 0.54f; b = lessLightDueToLowWater ? 0.405f : 0.54f; + r *= (value.R + value1.R) / 300f; + g *= (value.G + value1.G) / 300f; + b *= (value.B + value1.B) / 300f; } } diff --git a/Tiles/SunkenSea/Shellstone.cs b/Tiles/SunkenSea/Shellstone.cs new file mode 100644 index 0000000000..6cd502cd9c --- /dev/null +++ b/Tiles/SunkenSea/Shellstone.cs @@ -0,0 +1,40 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class Shellstone : ModTile + { + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + TileID.Sets.HasSlopeFrames[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Tink; + DustType = 17; + AddMapEntry(new Color(113, 117, 160)); + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/Shellstone.png b/Tiles/SunkenSea/Shellstone.png new file mode 100644 index 0000000000..95d8bdd2d2 Binary files /dev/null and b/Tiles/SunkenSea/Shellstone.png differ diff --git a/Tiles/SunkenSea/ShellstoneSlab.cs b/Tiles/SunkenSea/ShellstoneSlab.cs new file mode 100644 index 0000000000..eac1a96c65 --- /dev/null +++ b/Tiles/SunkenSea/ShellstoneSlab.cs @@ -0,0 +1,28 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class ShellstoneSlab : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + TileID.Sets.HasSlopeFrames[Type] = true; + + HitSound = SoundID.Tink; + DustType = 17; + AddMapEntry(new Color(156, 191, 199)); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/ShellstoneSlab.png b/Tiles/SunkenSea/ShellstoneSlab.png new file mode 100644 index 0000000000..8266d74f7e Binary files /dev/null and b/Tiles/SunkenSea/ShellstoneSlab.png differ diff --git a/Tiles/SunkenSea/SmallCorals.png b/Tiles/SunkenSea/SmallCorals.png deleted file mode 100644 index 6a3fedcf13..0000000000 Binary files a/Tiles/SunkenSea/SmallCorals.png and /dev/null differ diff --git a/Tiles/SunkenSea/TableCoral.png b/Tiles/SunkenSea/TableCoral.png deleted file mode 100644 index 68804bea84..0000000000 Binary files a/Tiles/SunkenSea/TableCoral.png and /dev/null differ diff --git a/Tiles/SunkenSea/VolcanicSand.cs b/Tiles/SunkenSea/VolcanicSand.cs new file mode 100644 index 0000000000..49bdcd390b --- /dev/null +++ b/Tiles/SunkenSea/VolcanicSand.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class VolcanicSand : ModTile + { + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + + DustType = 147; + AddMapEntry(new Color(117, 79, 97)); + + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/VolcanicSand.png b/Tiles/SunkenSea/VolcanicSand.png new file mode 100644 index 0000000000..a85b4c8dee Binary files /dev/null and b/Tiles/SunkenSea/VolcanicSand.png differ diff --git a/Tiles/SunkenSea/WhitePearlPile.cs b/Tiles/SunkenSea/WhitePearlPile.cs new file mode 100644 index 0000000000..5cacbe7df5 --- /dev/null +++ b/Tiles/SunkenSea/WhitePearlPile.cs @@ -0,0 +1,43 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class WhitePearlPile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; + + Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = true; + + HitSound = SoundID.Shatter; + DustType = 149; + AddMapEntry(new Color(217, 209, 213)); + + TileID.Sets.CanBeDugByShovel[Type] = true; + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/WhitePearlPile.png b/Tiles/SunkenSea/WhitePearlPile.png new file mode 100644 index 0000000000..f138f2ab3a Binary files /dev/null and b/Tiles/SunkenSea/WhitePearlPile.png differ diff --git a/Tiles/SunkenSea/YellowCoral.cs b/Tiles/SunkenSea/YellowCoral.cs new file mode 100644 index 0000000000..1a7a29bbfb --- /dev/null +++ b/Tiles/SunkenSea/YellowCoral.cs @@ -0,0 +1,60 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class YellowCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + Main.tileLighted[Type] = true; + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Dig; + DustType = 119; + AddMapEntry(new Color(198, 169, 24)); + Main.tileShine2[Type] = true; + + TileID.Sets.CanBeDugByShovel[Type] = true; + + // 02JUN2024: Ozzatron: RuneSand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) + { + float brightness = 0.9f; + Color Color1 = new Color(218, 203, 67); + Color Color2 = new Color(121, 76, 1); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + r = (value.R + value1.R) / 300f; + g = (value.G + value1.G) / 300f; + b = (value.B + value1.B) / 300f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/YellowCoral.png b/Tiles/SunkenSea/YellowCoral.png new file mode 100644 index 0000000000..ef005dc85b Binary files /dev/null and b/Tiles/SunkenSea/YellowCoral.png differ diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index bc4aefe0a0..12fedcb4bd 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -45,6 +45,7 @@ namespace CalamityMod // Acidwood is Wood RecipeGroup wood = RecipeGroup.recipeGroups[RecipeGroupID.Wood]; wood.ValidItems.Add(ModContent.ItemType()); + wood.ValidItems.Add(ModContent.ItemType()); // Astral Monolith is decidedly not wood-like enough to be used as generic wood. } diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 2a1911dd9e..acb0ed8438 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -132,7 +132,7 @@ namespace CalamityMod } // MELEE (includes tools and whips) - else if (item.CountsAsClass() || item.CountsAsClass()) + else if (item.CountsAsClass() || item.CountsAsClass() || item.CountsAsClass()) { // Terrarian (has its own special "Legendary" for marketing reasons) // Other items that want to use Legendary2 are also compatible @@ -333,51 +333,6 @@ namespace CalamityMod tooltips.FindAndReplace("[KEY]", finalKey); } - // Original code lifted from Iban's extended armor tooltips. - /// - /// Performs standard edits to a list of tooltip lines to add more if the Left SHIFT key is held down.
- /// Optionally, hides the normal tooltip to replace it entirely. - ///
- /// The tooltip list provided to a ModifyTooltips TML hook. - /// An array of tooltip lines to add. Instantiate these yourself with C# elaborate new syntax. - /// Set to true to replace the normal tooltip when holding SHIFT. Otherwise both tooltips will show at once. - public static void HoldShiftTooltip(List tooltips, TooltipLine[] holdShiftTooltips, bool hideNormalTooltip = false) - { - // Only perform any changes while holding SHIFT. - if (!Main.keyState.IsKeyDown(Keys.LeftShift)) - return; - - // Get the first index, last index and total count of standard vanilla tooltip lines. - // The first index and count are used to delete all vanilla tooltips when holding SHIFT, if requested. - // The last index is used to insert the "Hold SHIFT" tooltips in the right position. - int firstTooltipIndex = -1; - int lastTooltipIndex = -1; - int standardTooltipCount = 0; - for (int i = 0; i < tooltips.Count; i++) - { - if (tooltips[i].Name.StartsWith("Tooltip")) - { - if (firstTooltipIndex == -1) - firstTooltipIndex = i; - lastTooltipIndex = i; - standardTooltipCount++; - } - } - - if (firstTooltipIndex != -1) - { - // If asked to, remove all standard tooltip lines. This moves the last tooltip index. - if (hideNormalTooltip) - { - tooltips.RemoveRange(firstTooltipIndex, standardTooltipCount); - lastTooltipIndex -= standardTooltipCount; - } - - // Append every "Hold SHIFT" tooltip at the end of standard tooltips. - tooltips.InsertRange(lastTooltipIndex + 1, holdShiftTooltips); - } - } - private const float WorldInsertionOffset = 15f; /// /// If the given item is outside the world, force it to be within the world boundaries. diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index faf8ed2d66..70e80b71ea 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -343,6 +343,8 @@ namespace CalamityMod public static bool InSulphur(this Player player) => player.Calamity().ZoneSulphur; + public static bool InFloralParadise(this Player player) => player.Calamity().ZoneFloralParadise; + public static bool InAstral(this Player player, int biome = 0) //1 is above ground, 2 is underground, 3 is desert { switch (biome) diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index a657958050..38228f5e3f 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -10,6 +10,7 @@ using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.FurnitureAshen; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 5b6b1e6d5b..b2ca81048b 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -7,6 +7,7 @@ using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.FloralParadise; using CalamityMod.Tiles.FurnitureAbyss; using CalamityMod.Tiles.FurnitureAshen; using CalamityMod.Tiles.FurnitureEutrophic; @@ -335,6 +336,12 @@ namespace CalamityMod TileType(), TileType(), TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), TileType(), TileType(), TileType(), @@ -405,6 +412,15 @@ namespace CalamityMod TileType(), TileType(), // Sunken Sea + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), TileType(), TileType(), TileType(), @@ -461,6 +477,17 @@ namespace CalamityMod TileType(), }); + /// + /// Makes the tile merge with all the tile types that generate within various types of floral paradise tiles. + /// + /// The tile whose merging properties will be set. + public static void MergeWithFloralParadise(int type) => MergeWithSet(type, new int[] { + TileType(), + TileType(), + TileType(), + TileType(), + }); + /// /// Makes the tile merge with all the tile types that generate within various types of astral tiles /// diff --git a/Utilities/WorldgenUtils.cs b/Utilities/WorldgenUtils.cs index 1c18796fbb..9d3bac0ce1 100644 --- a/Utilities/WorldgenUtils.cs +++ b/Utilities/WorldgenUtils.cs @@ -12,6 +12,8 @@ namespace CalamityMod { public static partial class CalamityUtils { + public const int DefaultGenerationLoopLimit = 5000; + /// /// Generates clusters of ore across the world based on various requirements and with various strengths/frequencies. /// @@ -38,6 +40,57 @@ namespace CalamityMod } } + /// + /// Counts the amount of "cells" near a given range in a 2D boolean array. This is specifically used in conjunction with the

+ /// utility. + ///
+ /// The cell states. + /// The X position to count cells by. + /// The Y position to count cells by. + /// Whether to check for active cells ( values) or not ( values). + public static int CountCellsAtPosition(bool[,] map, int x, int y, bool checkForActiveCells) + { + int count = 0; + for (int dx = -1; dx <= 1; dx++) + { + for (int dy = -1; dy <= 1; dy++) + { + // Ignore the center position. + if (dx == 0 && dy == 0) + continue; + + // Ignore cells outside of the range of the map. + if (x + dx < 0 || x + dx >= map.GetLength(0) || y + dy < 0 || y + dy >= map.GetLength(1)) + continue; + + if ((map[x + dx, y + dy] && checkForActiveCells) || (!map[x + dx, y + dy] && !checkForActiveCells)) + count++; + } + } + return count; + } + + /// + /// Generates a cell map based on a cellular automata algorithm. The primary use-case for this is for creating smooth cave patterns,

+ /// with the cell's state representing whether a tile is active or not. + ///
+ /// The original cell states. + public static bool[,] SimulateCelluarAutomata(bool[,] originalMap) + { + bool[,] newMap = (bool[,])originalMap.Clone(); + for (int x = 0; x < originalMap.GetLength(0); x++) + { + for (int y = 0; y < originalMap.GetLength(1); y++) + { + if (originalMap[x, y] && CountCellsAtPosition(originalMap, x, y, true) <= 3) + newMap[x, y] = false; + else if (!originalMap[x, y] && CountCellsAtPosition(originalMap, x, y, true) >= 5) + newMap[x, y] = true; + } + } + return newMap; + } + public static void GrowVines(int VineX, int VineY, int numVines, ushort vineType, bool finished = false) { for (int Y = VineY; Y <= VineY + numVines && !finished; Y++) diff --git a/Walls/DriftwoodWall.cs b/Walls/DriftwoodWall.cs new file mode 100644 index 0000000000..247dc7e021 --- /dev/null +++ b/Walls/DriftwoodWall.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class DriftwoodWall : WallVisibleThroughWater + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + + AddEntries(new Color(69, 56, 58)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/DriftwoodWall.png b/Walls/DriftwoodWall.png new file mode 100644 index 0000000000..f33778a6fe Binary files /dev/null and b/Walls/DriftwoodWall.png differ diff --git a/Walls/LimestoneWall.cs b/Walls/LimestoneWall.cs new file mode 100644 index 0000000000..1f57ec5c49 --- /dev/null +++ b/Walls/LimestoneWall.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class LimestoneWall : WallVisibleThroughWater + { + public override void SetStaticDefaults() + { + DustType = 22; + AddEntries(new Color(147, 92, 63)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/LimestoneWall.png b/Walls/LimestoneWall.png new file mode 100644 index 0000000000..4da1f5d3be Binary files /dev/null and b/Walls/LimestoneWall.png differ diff --git a/Walls/NavystoneWall.png b/Walls/NavystoneWall.png index 4d7669028b..3c3de52f96 100644 Binary files a/Walls/NavystoneWall.png and b/Walls/NavystoneWall.png differ diff --git a/Walls/NavystoneWallSafe.png b/Walls/NavystoneWallSafe.png index 4d7669028b..3c3de52f96 100644 Binary files a/Walls/NavystoneWallSafe.png and b/Walls/NavystoneWallSafe.png differ diff --git a/Walls/RunestoneWall.cs b/Walls/RunestoneWall.cs new file mode 100644 index 0000000000..84d11681f3 --- /dev/null +++ b/Walls/RunestoneWall.cs @@ -0,0 +1,19 @@ +using CalamityMod.Dusts.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class RunestoneWall : WallVisibleThroughWater + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + + AddEntries(new Color(122, 59, 48)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/RunestoneWall.png b/Walls/RunestoneWall.png new file mode 100644 index 0000000000..9a5db46bc6 Binary files /dev/null and b/Walls/RunestoneWall.png differ diff --git a/Walls/ShellstoneSlabWall.cs b/Walls/ShellstoneSlabWall.cs new file mode 100644 index 0000000000..2b28e7dec8 --- /dev/null +++ b/Walls/ShellstoneSlabWall.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ShellstoneSlabWall : WallVisibleThroughWater + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + DustType = 24; + + AddEntries(new Color(100, 127, 137)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/ShellstoneSlabWall.png b/Walls/ShellstoneSlabWall.png new file mode 100644 index 0000000000..3d6e1f138f Binary files /dev/null and b/Walls/ShellstoneSlabWall.png differ diff --git a/Walls/ShellstoneWall.cs b/Walls/ShellstoneWall.cs new file mode 100644 index 0000000000..57edd3df61 --- /dev/null +++ b/Walls/ShellstoneWall.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ShellstoneWall : WallVisibleThroughWater + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + DustType = 24; + + AddEntries(new Color(74, 71, 84)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/ShellstoneWall.png b/Walls/ShellstoneWall.png new file mode 100644 index 0000000000..8e262e884f Binary files /dev/null and b/Walls/ShellstoneWall.png differ diff --git a/Walls/WallVisibleThroughWater.cs b/Walls/WallVisibleThroughWater.cs new file mode 100644 index 0000000000..839304cf49 --- /dev/null +++ b/Walls/WallVisibleThroughWater.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria.Localization; +using Terraria.Map; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public abstract class WallVisibleThroughWater : ModWall + { + public const float WaterTransparency = 0.5f; + public static readonly Color WaterColor = new Color(9, 61, 191); + + public int WaterMapEntry { get; private set; } + + /// + /// Adds the map entry, and further entries for being covered in water. + /// Please use this over AddMapEntry in walls which utilize this base class. + /// + /// + /// + public void AddEntries(Color baseColor, LocalizedText text = null) + { + AddMapEntry(baseColor, text); + AddMapEntry(Color.Lerp(baseColor, WaterColor, WaterTransparency), text); + } + + public static void InitializeWaterMapEntryLookups() + { + foreach (var wall in CalamityMod.Instance.GetContent()) + { + int lookup = MapHelper.wallLookup[wall.Type]; + wall.WaterMapEntry = lookup + 1; + } + } + } +} diff --git a/Waterfalls/WaterfallRenderer.cs b/Waterfalls/WaterfallRenderer.cs new file mode 100644 index 0000000000..ec10d09101 --- /dev/null +++ b/Waterfalls/WaterfallRenderer.cs @@ -0,0 +1,105 @@ +using CalamityMod.Graphics.Primitives; +using CalamityMod.Tiles.FloralParadise; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Waterfalls +{ + public static class WaterfallRenderer + { + private static Vector2 currentWaterfallPosition; + + private static float currentWaterfallBrightness; + + private static float currentWaterfallHeight; + + internal static float PrimitiveWidthFunction(float completionRatio) + { + float baseWidth = MathHelper.Lerp(16f, 6f, Utils.GetLerpValue(36f, 216f, currentWaterfallHeight, true)); + float positionOffset = currentWaterfallPosition.X * 0.17f % 300f + currentWaterfallPosition.Y * 0.33f % 300f; + float x1Offset = (float)(Math.Sin(-Main.GlobalTimeWrappedHourly * 3f + completionRatio * 9f + positionOffset) * 0.5f + 0.5f) * baseWidth * 0.2f; + float x2Offset = (float)(Math.Sin(-Main.GlobalTimeWrappedHourly * 6f + completionRatio * 6f + positionOffset) * 0.5f + 0.5f) * baseWidth * 0.25f; + + if (completionRatio < 0.2f) + return MathHelper.SmoothStep(1f, baseWidth + x2Offset - x1Offset, Utils.GetLerpValue(0f, 0.2f, completionRatio, true)); + return baseWidth + x2Offset + MathHelper.SmoothStep(0f, baseWidth * 0.85f, Utils.GetLerpValue(0.84f, 0.96f, completionRatio, true)) - x1Offset; + } + + internal static Color PrimitiveColorFunction(float completionRatio) + { + Color c = Color.Lerp(Color.Cyan, new Color(1f, 1f, 1f, 0f), (float)Math.Pow(Utils.GetLerpValue(0.75f, 1f, completionRatio, true), 0.68)); + return c; + } + + public static IEnumerable FindNearbyWaterfallRenderers() + { + int waterfallGeneratorID = ModContent.TileType(); + Point center = Main.LocalPlayer.Center.ToTileCoordinates(); + for (int i = -Main.screenWidth / 16 - 10; i < Main.screenWidth / 16 + 10; i++) + { + for (int j = -Main.screenHeight / 16 - 10; j < Main.screenHeight / 16 + 10; j++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(center.X + i, center.Y + j); + if (tile.TileType != waterfallGeneratorID || !tile.HasTile) + continue; + + yield return new Vector2(center.X + i, center.Y + j); + } + } + } + + public static void DrawWaterfalls() + { + foreach (Vector2 drawTilePosition in FindNearbyWaterfallRenderers()) + { + Vector2 drawPosition = drawTilePosition * 16f; + Vector2 bottom = drawPosition; + for (int i = 0; i < 16; i++) + { + if (CalamityUtils.ParanoidTileRetrieval((int)drawTilePosition.X, (int)drawTilePosition.Y + i).LiquidAmount > 0) + { + bottom.Y += i * 16f; + break; + } + } + + bottom.Y += 4f; + currentWaterfallHeight = MathHelper.Distance(bottom.Y, drawPosition.Y); + if (currentWaterfallHeight <= 20f) + continue; + + currentWaterfallBrightness = Lighting.Brightness((int)(drawPosition.X / 16f), (int)(drawPosition.Y / 16f)); + currentWaterfallPosition = drawPosition + Vector2.One * 8f; + + Vector2[] drawPoints = new Vector2[] + { + drawPosition, + Vector2.Lerp(drawPosition, bottom, 0.5f), + bottom + }; + + // Determine the position of the waterfall's ambience sound. + float distanceFromWaterfall = Main.LocalPlayer.Distance(drawPosition + Vector2.One * 8f); + float distanceFromOldWaterfall = 100000f; + if (Main.ambientWaterfallX != -1f && Main.ambientWaterfallY != -1f) + distanceFromOldWaterfall = Main.LocalPlayer.Distance(new Vector2(Main.ambientWaterfallX, Main.ambientWaterfallY)); + + if (distanceFromOldWaterfall > distanceFromWaterfall) + { + Main.ambientWaterfallX = drawPosition.X + 8f; + Main.ambientWaterfallY = drawPosition.Y + 8f; + Main.ambientWaterfallStrength = MathHelper.Max(Main.ambientWaterfallStrength, Utils.GetLerpValue(740f, 300f, distanceFromWaterfall, true)); + } + + GameShaders.Misc["CalamityMod:Waterfall"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/WorleyNoise")); + GameShaders.Misc["CalamityMod:Waterfall"].UseOpacity((float)Math.Pow(currentWaterfallBrightness, 0.62)); + PrimitiveRenderer.RenderTrail(drawPoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, shader: GameShaders.Misc["CalamityMod:Waterfall"]), 80); + } + } + } +} diff --git a/Waters/BasaltGullyWater.cs b/Waters/BasaltGullyWater.cs new file mode 100644 index 0000000000..6aa26ea180 --- /dev/null +++ b/Waters/BasaltGullyWater.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class BasaltGullyWater : ModWaterStyle + { + public static int Type; + public override void SetStaticDefaults() + { + Type = Slot; + } + public override int ChooseWaterfallStyle() + { + return ModContent.Find("CalamityMod/BasaltGullyWaterflow").Slot; + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.DarkGray; + } + } +} diff --git a/Waters/BasaltGullyWater.png b/Waters/BasaltGullyWater.png new file mode 100644 index 0000000000..7ca076e041 Binary files /dev/null and b/Waters/BasaltGullyWater.png differ diff --git a/Waters/BasaltGullyWater_Block.png b/Waters/BasaltGullyWater_Block.png new file mode 100644 index 0000000000..d9af32df36 Binary files /dev/null and b/Waters/BasaltGullyWater_Block.png differ diff --git a/Waters/BasaltGullyWater_Slope.png b/Waters/BasaltGullyWater_Slope.png new file mode 100644 index 0000000000..bceca096bd Binary files /dev/null and b/Waters/BasaltGullyWater_Slope.png differ diff --git a/Waters/SunkenSeaWaterflow.cs b/Waters/BasaltGullyWaterflow.cs similarity index 56% rename from Waters/SunkenSeaWaterflow.cs rename to Waters/BasaltGullyWaterflow.cs index ae61284b07..545ff8daaf 100644 --- a/Waters/SunkenSeaWaterflow.cs +++ b/Waters/BasaltGullyWaterflow.cs @@ -1,8 +1,8 @@ using Terraria.ModLoader; + namespace CalamityMod.Waters { - public class SunkenSeaWaterflow : ModWaterfallStyle + public class BasaltGullyWaterflow : ModWaterfallStyle { - } } diff --git a/Waters/BasaltGullyWaterflow.png b/Waters/BasaltGullyWaterflow.png new file mode 100644 index 0000000000..c366e4d258 Binary files /dev/null and b/Waters/BasaltGullyWaterflow.png differ diff --git a/Waters/FloralParadiseWater.cs b/Waters/FloralParadiseWater.cs new file mode 100644 index 0000000000..9d67d11a46 --- /dev/null +++ b/Waters/FloralParadiseWater.cs @@ -0,0 +1,28 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class FloralParadiseWater : ModWaterStyle + { + public override int ChooseWaterfallStyle() + { + return ModContent.Find("CalamityMod/FloralParadiseWaterflow").Slot; + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.PaleTurquoise; + } + } +} diff --git a/Waters/FloralParadiseWater.png b/Waters/FloralParadiseWater.png new file mode 100644 index 0000000000..d8a0958b63 Binary files /dev/null and b/Waters/FloralParadiseWater.png differ diff --git a/Waters/FloralParadiseWaterWaterflow.cs b/Waters/FloralParadiseWaterWaterflow.cs new file mode 100644 index 0000000000..64a6ce4344 --- /dev/null +++ b/Waters/FloralParadiseWaterWaterflow.cs @@ -0,0 +1,9 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class FloralParadiseWaterflow : ModWaterfallStyle + { + + } +} diff --git a/Waters/FloralParadiseWater_Block.png b/Waters/FloralParadiseWater_Block.png new file mode 100644 index 0000000000..5fe701ea91 Binary files /dev/null and b/Waters/FloralParadiseWater_Block.png differ diff --git a/Waters/FloralParadiseWater_Slope.png b/Waters/FloralParadiseWater_Slope.png new file mode 100644 index 0000000000..a8a6fde86a Binary files /dev/null and b/Waters/FloralParadiseWater_Slope.png differ diff --git a/Waters/FloralParadiseWaterflow.png b/Waters/FloralParadiseWaterflow.png new file mode 100644 index 0000000000..aa0d689eb7 Binary files /dev/null and b/Waters/FloralParadiseWaterflow.png differ diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaBurrowsWater.cs similarity index 87% rename from Waters/SunkenSeaWater.cs rename to Waters/SunkenSeaBurrowsWater.cs index 62c32fbd4c..c7bd8974e5 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaBurrowsWater.cs @@ -3,7 +3,7 @@ using Terraria.ModLoader; namespace CalamityMod.Waters { - public class SunkenSeaWater : ModWaterStyle + public class SunkenSeaBurrowsWater : ModWaterStyle { public static int Type; public override void SetStaticDefaults() @@ -12,7 +12,7 @@ namespace CalamityMod.Waters } public override int ChooseWaterfallStyle() { - return ModContent.Find("CalamityMod/SunkenSeaWaterflow").Slot; + return ModContent.Find("CalamityMod/SunkenSeaBurrowsWaterflow").Slot; } public override int GetSplashDust() diff --git a/Waters/SunkenSeaBurrowsWater.png b/Waters/SunkenSeaBurrowsWater.png new file mode 100644 index 0000000000..eab9dc5435 Binary files /dev/null and b/Waters/SunkenSeaBurrowsWater.png differ diff --git a/Waters/SunkenSeaBurrowsWater_Block.png b/Waters/SunkenSeaBurrowsWater_Block.png new file mode 100644 index 0000000000..975fbe6dee Binary files /dev/null and b/Waters/SunkenSeaBurrowsWater_Block.png differ diff --git a/Waters/SunkenSeaBurrowsWater_Slope.png b/Waters/SunkenSeaBurrowsWater_Slope.png new file mode 100644 index 0000000000..5598cc77c0 Binary files /dev/null and b/Waters/SunkenSeaBurrowsWater_Slope.png differ diff --git a/Waters/SunkenSeaBurrowsWaterflow.cs b/Waters/SunkenSeaBurrowsWaterflow.cs new file mode 100644 index 0000000000..79974dca2a --- /dev/null +++ b/Waters/SunkenSeaBurrowsWaterflow.cs @@ -0,0 +1,8 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SunkenSeaBurrowsWaterflow : ModWaterfallStyle + { + } +} diff --git a/Waters/SunkenSeaBurrowsWaterflow.png b/Waters/SunkenSeaBurrowsWaterflow.png new file mode 100644 index 0000000000..4a4540f32f Binary files /dev/null and b/Waters/SunkenSeaBurrowsWaterflow.png differ diff --git a/Waters/SunkenSeaPolypWater.cs b/Waters/SunkenSeaPolypWater.cs new file mode 100644 index 0000000000..11a8967142 --- /dev/null +++ b/Waters/SunkenSeaPolypWater.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SunkenSeaPolypWater : ModWaterStyle + { + public static int Type; + public override void SetStaticDefaults() + { + Type = Slot; + } + public override int ChooseWaterfallStyle() + { + return ModContent.Find("CalamityMod/SunkenSeaPolypWaterflow").Slot; + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.Coral; + } + } +} diff --git a/Waters/SunkenSeaPolypWater.png b/Waters/SunkenSeaPolypWater.png new file mode 100644 index 0000000000..ff90d56704 Binary files /dev/null and b/Waters/SunkenSeaPolypWater.png differ diff --git a/Waters/SunkenSeaPolypWater_Block.png b/Waters/SunkenSeaPolypWater_Block.png new file mode 100644 index 0000000000..31eaa237d0 Binary files /dev/null and b/Waters/SunkenSeaPolypWater_Block.png differ diff --git a/Waters/SunkenSeaPolypWater_Slope.png b/Waters/SunkenSeaPolypWater_Slope.png new file mode 100644 index 0000000000..8c28641b1b Binary files /dev/null and b/Waters/SunkenSeaPolypWater_Slope.png differ diff --git a/Waters/SunkenSeaPolypWaterflow.cs b/Waters/SunkenSeaPolypWaterflow.cs new file mode 100644 index 0000000000..13c68fbe0b --- /dev/null +++ b/Waters/SunkenSeaPolypWaterflow.cs @@ -0,0 +1,8 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SunkenSeaPolypWaterflow : ModWaterfallStyle + { + } +} diff --git a/Waters/SunkenSeaPolypWaterflow.png b/Waters/SunkenSeaPolypWaterflow.png new file mode 100644 index 0000000000..7632d15e9a Binary files /dev/null and b/Waters/SunkenSeaPolypWaterflow.png differ diff --git a/Waters/SunkenSeaReefsWater.cs b/Waters/SunkenSeaReefsWater.cs new file mode 100644 index 0000000000..b83f7f4b57 --- /dev/null +++ b/Waters/SunkenSeaReefsWater.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SunkenSeaReefsWater : ModWaterStyle + { + public static int Type; + public override void SetStaticDefaults() + { + Type = Slot; + } + public override int ChooseWaterfallStyle() + { + return ModContent.Find("CalamityMod/SunkenSeaReefsWaterflow").Slot; + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.SkyBlue; + } + } +} diff --git a/Waters/SunkenSeaReefsWater.png b/Waters/SunkenSeaReefsWater.png new file mode 100644 index 0000000000..fb72da6384 Binary files /dev/null and b/Waters/SunkenSeaReefsWater.png differ diff --git a/Waters/SunkenSeaReefsWater_Block.png b/Waters/SunkenSeaReefsWater_Block.png new file mode 100644 index 0000000000..e7ec1e6847 Binary files /dev/null and b/Waters/SunkenSeaReefsWater_Block.png differ diff --git a/Waters/SunkenSeaReefsWater_Slope.png b/Waters/SunkenSeaReefsWater_Slope.png new file mode 100644 index 0000000000..f817e2c784 Binary files /dev/null and b/Waters/SunkenSeaReefsWater_Slope.png differ diff --git a/Waters/SunkenSeaReefsWaterflow.cs b/Waters/SunkenSeaReefsWaterflow.cs new file mode 100644 index 0000000000..353e3e372e --- /dev/null +++ b/Waters/SunkenSeaReefsWaterflow.cs @@ -0,0 +1,8 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SunkenSeaReefsWaterflow : ModWaterfallStyle + { + } +} diff --git a/Waters/SunkenSeaReefsWaterflow.png b/Waters/SunkenSeaReefsWaterflow.png new file mode 100644 index 0000000000..d2fe204180 Binary files /dev/null and b/Waters/SunkenSeaReefsWaterflow.png differ diff --git a/Waters/SunkenSeaShoresWater.cs b/Waters/SunkenSeaShoresWater.cs new file mode 100644 index 0000000000..5dd4c5e590 --- /dev/null +++ b/Waters/SunkenSeaShoresWater.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SunkenSeaShoresWater : ModWaterStyle + { + public static int Type; + public override void SetStaticDefaults() + { + Type = Slot; + } + public override int ChooseWaterfallStyle() + { + return ModContent.Find("CalamityMod/SunkenSeaShoresWaterflow").Slot; + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.OrangeRed; + } + } +} diff --git a/Waters/SunkenSeaShoresWater.png b/Waters/SunkenSeaShoresWater.png new file mode 100644 index 0000000000..d9ead26b53 Binary files /dev/null and b/Waters/SunkenSeaShoresWater.png differ diff --git a/Waters/SunkenSeaShoresWater_Block.png b/Waters/SunkenSeaShoresWater_Block.png new file mode 100644 index 0000000000..c828d653e2 Binary files /dev/null and b/Waters/SunkenSeaShoresWater_Block.png differ diff --git a/Waters/SunkenSeaShoresWater_Slope.png b/Waters/SunkenSeaShoresWater_Slope.png new file mode 100644 index 0000000000..179eb74a64 Binary files /dev/null and b/Waters/SunkenSeaShoresWater_Slope.png differ diff --git a/Waters/SunkenSeaShoresWaterflow.cs b/Waters/SunkenSeaShoresWaterflow.cs new file mode 100644 index 0000000000..67620e943c --- /dev/null +++ b/Waters/SunkenSeaShoresWaterflow.cs @@ -0,0 +1,8 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SunkenSeaShoresWaterflow : ModWaterfallStyle + { + } +} diff --git a/Waters/SunkenSeaShoresWaterflow.png b/Waters/SunkenSeaShoresWaterflow.png new file mode 100644 index 0000000000..3d605a0e35 Binary files /dev/null and b/Waters/SunkenSeaShoresWaterflow.png differ diff --git a/Waters/SunkenSeaWater.png b/Waters/SunkenSeaWater.png deleted file mode 100644 index cae58da0f0..0000000000 Binary files a/Waters/SunkenSeaWater.png and /dev/null differ diff --git a/Waters/SunkenSeaWater_Block.png b/Waters/SunkenSeaWater_Block.png deleted file mode 100644 index 3d86838967..0000000000 Binary files a/Waters/SunkenSeaWater_Block.png and /dev/null differ diff --git a/Waters/SunkenSeaWater_Slope.png b/Waters/SunkenSeaWater_Slope.png deleted file mode 100644 index 27f1769586..0000000000 Binary files a/Waters/SunkenSeaWater_Slope.png and /dev/null differ diff --git a/Waters/SunkenSeaWaterflow.png b/Waters/SunkenSeaWaterflow.png deleted file mode 100644 index c063dddf79..0000000000 Binary files a/Waters/SunkenSeaWaterflow.png and /dev/null differ diff --git a/World/Abyss.cs b/World/Abyss.cs index f70e99299c..7dd9c746a4 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -55,11 +55,11 @@ namespace CalamityMod.World int abyssMinX = AtLeftSideOfWorld ? 0 : abyssChasmX - 160; int abyssMaxX = AtLeftSideOfWorld ? abyssChasmX + 160 : x; - for (int abyssIndex = abyssMinX; abyssIndex < abyssMaxX; abyssIndex++) + for (int X = abyssMinX; X < abyssMaxX; X++) { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY + 50; abyssIndex2++) + for (int Y = 0; Y < abyssChasmY + 50; Y++) { - Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); + Tile tile = Framing.GetTileSafely(X, Y); if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) { @@ -74,43 +74,43 @@ namespace CalamityMod.World //i have at least left comments so people reading will know what does what if (Main.remixWorld) { - if (abyssIndex2 <= rockLayer) + if (Y <= rockLayer) { //replaces blocks wand walls that can be converted if (canConvert) { //layer 4 - if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.6f)) + if (Y <= rockLayer - (int)((y - 200) * 0.6f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) + else if (Y <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3 - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.4f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.4f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2-3 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.39f) && WorldGen.genRand.NextBool(2)) + else if (Y <= rockLayer - (int)((y - 200) * 0.39f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2 - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.2f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.2f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.19f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.19f)) { if (WorldGen.genRand.NextBool(2)) { @@ -136,37 +136,37 @@ namespace CalamityMod.World tile.Get().HasTile = true; //layer 4 - if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.6f)) + if (Y <= rockLayer - (int)((y - 200) * 0.6f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) + else if (Y <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3 - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.4f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.4f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2-3 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.39f) && WorldGen.genRand.NextBool(2)) + else if (Y <= rockLayer - (int)((y - 200) * 0.39f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2 - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.2f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.2f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.19f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.19f)) { if (WorldGen.genRand.NextBool(2)) { @@ -190,37 +190,37 @@ namespace CalamityMod.World } else { - if (abyssIndex2 > (rockLayer - Main.maxTilesY / 15) + 35) + if (Y > (rockLayer - Main.maxTilesY / 15) + 35) { - //replaces blocks wand walls that can be converted + //replaces blocks and walls that can be converted if (canConvert) { //layer 4 - if (abyssIndex2 > (rockLayer + y * 0.270)) + if (Y > (rockLayer + y * 0.270)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition - else if (abyssIndex2 > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) + else if (Y > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3 - else if (abyssIndex2 > (rockLayer + y * 0.145)) + else if (Y > (rockLayer + y * 0.145)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2-3 dithering transition - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(2)) + else if (Y > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition - else if (abyssIndex2 >= rockLayer - 10 && abyssIndex2 <= rockLayer) + else if (Y >= rockLayer - 10 && Y <= rockLayer) { if (WorldGen.genRand.NextBool(2)) { @@ -234,7 +234,7 @@ namespace CalamityMod.World } } //layer 1 - else if (abyssIndex2 <= rockLayer - 10) + else if (Y <= rockLayer - 10) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); @@ -252,31 +252,31 @@ namespace CalamityMod.World tile.Get().HasTile = true; //layer 4 - if (abyssIndex2 > (rockLayer + y * 0.270)) + if (Y > (rockLayer + y * 0.270)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition - else if (abyssIndex2 > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) + else if (Y > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3 - else if (abyssIndex2 > (rockLayer + y * 0.145)) + else if (Y > (rockLayer + y * 0.145)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2-3 dithering transition - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(2)) + else if (Y > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition - else if (abyssIndex2 >= rockLayer - 10 && abyssIndex2 <= rockLayer) + else if (Y >= rockLayer - 10 && Y <= rockLayer) { if (WorldGen.genRand.NextBool(2)) { @@ -290,7 +290,7 @@ namespace CalamityMod.World } } //layer 1 - else if (abyssIndex2 <= rockLayer - 10) + else if (Y <= rockLayer - 10) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); @@ -527,27 +527,27 @@ namespace CalamityMod.World } //clean up - for (int abyssIndex = abyssMinX + 5; abyssIndex < abyssMaxX - 5; abyssIndex++) + for (int X = abyssMinX + 5; X < abyssMaxX - 5; X++) { - for (int abyssIndex2 = 5; abyssIndex2 < abyssChasmY; abyssIndex2++) + for (int Y = 5; Y < abyssChasmY; Y++) { - Tile tile = Main.tile[abyssIndex, abyssIndex2]; - Tile tileUp = Main.tile[abyssIndex, abyssIndex2 - 1]; - Tile tileDown = Main.tile[abyssIndex, abyssIndex2 + 1]; - Tile tileLeft = Main.tile[abyssIndex - 1, abyssIndex2]; - Tile tileRight = Main.tile[abyssIndex + 1, abyssIndex2]; + Tile tile = Main.tile[X, Y]; + Tile tileUp = Main.tile[X, Y - 1]; + Tile tileDown = Main.tile[X, Y + 1]; + Tile tileLeft = Main.tile[X - 1, Y]; + Tile tileRight = Main.tile[X + 1, Y]; if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) { //slope tiles - Tile.SmoothSlope(abyssIndex, abyssIndex2, true); + Tile.SmoothSlope(X, Y, true); //kill any individual floating tiles if (!tileUp.HasTile && !tileDown.HasTile && !tileLeft.HasTile && !tileRight.HasTile) { - WorldGen.KillTile(abyssIndex, abyssIndex2); + WorldGen.KillTile(X, Y); } } @@ -561,24 +561,24 @@ namespace CalamityMod.World //kill obsidian if (tile.TileType == TileID.Obsidian) { - WorldGen.KillTile(abyssIndex, abyssIndex2); + WorldGen.KillTile(X, Y); } } } //ambient tiles and pots - for (int abyssIndex = abyssMinX + 5; abyssIndex < abyssMaxX - 5; abyssIndex++) + for (int X = abyssMinX + 5; X < abyssMaxX - 5; X++) { - for (int abyssIndex2 = 0; abyssIndex2 < (Main.remixWorld ? rockLayer : Main.UnderworldLayer); abyssIndex2++) + for (int Y = 0; Y < (Main.remixWorld ? rockLayer : Main.UnderworldLayer); Y++) { - Tile tileToGrowVineOn = Main.tile[abyssIndex, abyssIndex2]; + Tile tileToGrowVineOn = Main.tile[X, Y]; - if (!Main.tile[abyssIndex, abyssIndex2].HasTile) + if (!Main.tile[X, Y].HasTile) { - Tile tile = Main.tile[abyssIndex, abyssIndex2 + 1]; + Tile tile = Main.tile[X, Y + 1]; //above the 4th layer - if (abyssIndex2 < (Main.remixWorld ? rockLayer : Main.UnderworldLayer) && WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1)) + if (Y < (Main.remixWorld ? rockLayer : Main.UnderworldLayer) && WorldGen.SolidTile(X, Y + 1)) { //sulphur shale stuff if (tile.TileType == ModContent.TileType()) @@ -586,7 +586,7 @@ namespace CalamityMod.World //tube coral if (WorldGen.genRand.NextBool(85)) { - WorldGen.PlaceObject(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + WorldGen.PlaceObject(X, Y, (ushort)ModContent.TileType()); } //shale rock piles @@ -595,7 +595,7 @@ namespace CalamityMod.World ushort[] ShalePiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(ShalePiles)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(ShalePiles)); } //pire corals @@ -604,7 +604,7 @@ namespace CalamityMod.World ushort[] PireCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PireCorals)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(PireCorals)); } //sulphur fossils @@ -613,7 +613,7 @@ namespace CalamityMod.World ushort[] SulphuricFossils = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(SulphuricFossils)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(SulphuricFossils)); } //ribs @@ -623,7 +623,7 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Ribs)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(Ribs)); } } @@ -635,17 +635,33 @@ namespace CalamityMod.World ushort[] PlantPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PlantPiles)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(PlantPiles)); } } //abyss gravel stuff if (tile.TileType == ModContent.TileType()) { + //place coral blobs + if (WorldGen.genRand.NextBool(125) && !Main.tile[X, Y - 1].HasTile) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(3, 4)), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } + //rare pearls if (WorldGen.genRand.NextBool(50)) { - WorldGen.PlaceObject(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + WorldGen.PlaceObject(X, Y, (ushort)ModContent.TileType()); } //giant kelp on abyss gravel @@ -654,7 +670,7 @@ namespace CalamityMod.World ushort[] Kelps = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Kelps)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(Kelps)); } //plany mush piles @@ -663,7 +679,7 @@ namespace CalamityMod.World ushort[] PlantPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PlantPiles)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(PlantPiles)); } //gravel rock piles @@ -672,7 +688,7 @@ namespace CalamityMod.World ushort[] GravelPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(GravelPiles)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(GravelPiles)); } //abyss gravel vents @@ -681,7 +697,7 @@ namespace CalamityMod.World ushort[] Vents = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Vents)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(Vents)); } //pirate crates @@ -690,7 +706,7 @@ namespace CalamityMod.World ushort[] PirateCrate = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PirateCrate)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(PirateCrate)); } } @@ -704,7 +720,7 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(SpiderCorals)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(SpiderCorals)); } //thermal vent @@ -713,7 +729,7 @@ namespace CalamityMod.World ushort[] Vents = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Vents)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(Vents)); } } @@ -726,57 +742,57 @@ namespace CalamityMod.World ushort[] BulbTrees = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(BulbTrees)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(BulbTrees)); } } } //pots - if ((tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || - tile.TileType == ModContent.TileType()) && abyssIndex2 > (Main.remixWorld ? rockLayer - (int)((y - 200) * 0.8f) : rockLayer)) + if ((tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType()) && Y > (Main.remixWorld ? rockLayer - (int)((y - 200) * 0.8f) : rockLayer)) { if (WorldGen.genRand.NextBool(5)) { - WorldGen.PlacePot(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); - CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + WorldGen.PlacePot(X, Y, (ushort)ModContent.TileType()); + CalamityUtils.SafeSquareTileFrame(X, Y, true); } } //sulphur pots - else if (tile.TileType == ModContent.TileType() && abyssIndex2 < (Main.remixWorld ? Main.UnderworldLayer : (int)Main.worldSurface)) + else if (tile.TileType == ModContent.TileType() && Y < (Main.remixWorld ? Main.UnderworldLayer : (int)Main.worldSurface)) { if (WorldGen.genRand.NextBool(3)) { - WorldGen.PlacePot(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); - CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + WorldGen.PlacePot(X, Y, (ushort)ModContent.TileType()); + CalamityUtils.SafeSquareTileFrame(X, Y, true); } } } //esentially what this does is grow one vine on the bottom of a tile, then use the util to keep placing the vine until it decides to stop - if (tileToGrowVineOn.TileType == ModContent.TileType() && !Main.tile[abyssIndex, abyssIndex2 + 1].HasTile) + if (tileToGrowVineOn.TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile) { if (WorldGen.genRand.NextBool(2)) { - WorldGen.PlaceTile(abyssIndex, abyssIndex2 + 1, (ushort)ModContent.TileType()); + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); } } if (tileToGrowVineOn.TileType == ModContent.TileType()) { - CalamityUtils.GrowVines(abyssIndex, abyssIndex2, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); } //same as above but for sulphur vines - if (tileToGrowVineOn.TileType == ModContent.TileType() && !Main.tile[abyssIndex, abyssIndex2 + 1].HasTile) + if (tileToGrowVineOn.TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile) { if (WorldGen.genRand.NextBool(5)) { - WorldGen.PlaceTile(abyssIndex, abyssIndex2 + 1, (ushort)ModContent.TileType()); + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); } } if (tileToGrowVineOn.TileType == ModContent.TileType()) { - CalamityUtils.GrowVines(abyssIndex, abyssIndex2, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); } } } @@ -1192,5 +1208,73 @@ namespace CalamityMod.World UnlockChests = false; } + + //method to clean up small clumps of tiles + public static void AbyssCleanup() + { + List blockTileTypes = new() + { + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + }; + + void getAttachedPoints(int x, int y, List points) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); + Point p = new(x, y); + + if (!blockTileTypes.Contains(t.TileType) || !t.HasTile || points.Count > 75 || points.Contains(p)) + { + return; + } + + points.Add(p); + + getAttachedPoints(x + 1, y, points); + getAttachedPoints(x - 1, y, points); + getAttachedPoints(x, y + 1, points); + getAttachedPoints(x, y - 1, points); + } + + for (int x = 20; x < Main.maxTilesX - 20; x++) + { + for (int y = 20; y < Main.maxTilesY - 20; y++) + { + List chunkPoints = new(); + getAttachedPoints(x, y, chunkPoints); + + int cutoffLimit = 75; + if (chunkPoints.Count >= 1 && chunkPoints.Count < cutoffLimit) + { + foreach (Point p in chunkPoints) + { + WorldUtils.Gen(p, new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(true), + new Actions.SetLiquid() + })); + } + } + + Tile tile = Main.tile[x, y]; + + if (blockTileTypes.Contains(tile.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; + 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); + } + } + } + } + } } } diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index f26257c70e..c6c1f1601c 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -325,61 +325,35 @@ namespace CalamityMod.World public static void PlaceSunkenSeaLab(out Point placementPoint, List workshopPoints, StructureMap structures) { - int tries = 0; string mapKey = SunkenSeaLabKey; PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); SchematicMetaTile[,] schematic = TileMaps[mapKey]; int labWidth = schematic.GetLength(0); int labHeight = schematic.GetLength(1); - do - { - // Pick a location based on the Underground Desert, because the Sunken Sea is based on the Underground Desert - Rectangle ugDesert = GenVars.UndergroundDesertLocation; - int placementPositionX = -1; + int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; + int sunkenSeaY = Main.maxTilesY / 2; - // Desperation generation: if 75% of attempts failed, start generating literally anywhere in the Sunken Sea - if (tries >= 1500) - placementPositionX = WorldGen.genRand.Next(ugDesert.Left, ugDesert.Right - labWidth); - // 50% chance to be on either the left or the right. - // If it's on the right then shove it left because all schematics are placed based on their top left corner. - else if (WorldGen.genRand.NextBool()) - placementPositionX = WorldGen.genRand.Next(ugDesert.Left - 20, ugDesert.Left + 10); - else - placementPositionX = WorldGen.genRand.Next(ugDesert.Right - 10, ugDesert.Right + 20) - labWidth; + int placementPositionX = sunkenSeaX < Main.maxTilesX / 2 ? sunkenSeaX - 120 : sunkenSeaX + 120; + int placementPositionY = (sunkenSeaY + (Main.maxTilesY / 4) - 25) - labHeight; - int sunkenSeaY = 0; + placementPoint = new Point(placementPositionX, placementPositionY); + Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); - //copied the desert position code from the sunken sea's generation so the lab always generates within the sunken sea properly - for (int y = Main.UnderworldLayer; y >= Main.worldSurface; y--) - { - if (Main.tile[placementPositionX, y].WallType == ModContent.WallType() || - Main.tile[placementPositionX, y].WallType == ModContent.WallType()) - { - sunkenSeaY = y - 80; //offset so it generates nicely - break; - } - } + /* + I do not think that this check needs to exist for now, no other structures exist in the sunken sea at the moment + Once other sunken sea structures are added, i will likely re-enable this and modify the generation so that it avoids protected areas again + This is just so i can have it generating in time for the patreon beta + */ - int placementPositionY = sunkenSeaY - labHeight; - - placementPoint = new Point(placementPositionX, placementPositionY); - Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); - - if (structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) - { - bool hasPlacedLogAndSchematic = false; - PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillSunkenSeaLaboratoryChest)); - CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); - //Reverted changes to center point placement; the change caused it to not center like it should, offsetting the range at which the bio lab theme plays - CalamityWorld.SunkenSeaLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; - break; - } - //try again if the structure is colliding with a structure from another mod - else - tries++; - } - while (tries <= 2000); + //if (structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + //{ + bool hasPlacedLogAndSchematic = false; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillSunkenSeaLaboratoryChest)); + CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); + //Reverted changes to center point placement; the change caused it to not center like it should, offsetting the range at which the bio lab theme plays + CalamityWorld.SunkenSeaLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; + //} } #endregion diff --git a/World/Minibiomes/FloralParadiseMinibiome.cs b/World/Minibiomes/FloralParadiseMinibiome.cs new file mode 100644 index 0000000000..511652ec56 --- /dev/null +++ b/World/Minibiomes/FloralParadiseMinibiome.cs @@ -0,0 +1,535 @@ +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Tiles.DraedonStructures; +using CalamityMod.Tiles.FloralParadise; +using CalamityMod.Tiles.SunkenSea; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.Utilities; +using Terraria.WorldBuilding; + +namespace CalamityMod.World.Minibiomes +{ + public class FloralParadiseMinibiome + { + // 02JUN2024: Ozzatron: Disable generation of the Floral Paradise biome on the assumption that it will break horribly until tested. + internal static readonly bool SHOULD_GENERATE = false; + + // Constants pertaining to the more important details of the world-gen, to allow for ease-of-change. + // Certain numbers are hardcoded and not present here, but they tend to be in regards to things that either really shouldn't need changing or + // are extremely subtle details. + public const int TotalCavesInMediumWorld = 3; + + public const int MaxHorizontalDistanceFromWorldCenter = 1250; + + public const int MinSurfaceDepth = 250; + + public const int MaxSurfaceDepth = 420; + + public const int BlacklistedTileCheckArea = 50; + + public const float CaveOpennessFactor = 0.08f; + + public const float WallOpennessFactor = 0.135f; + + public const int TotalSecondaryDirtCreationPasses = 1; + + public const float SecondaryPassDirtCreationChance = 0.5f; + + public const int MinVigorousVineLength = 6; + + public const int MaxVigorousVineLength = 16; + + public const int MinSmallVineLength = 9; + + public const int MaxSmallVineLength = 17; + + public const int MinSmallVineCount = 45; + + public const int MaxSmallVineCount = 64; + + public const int MinPondWaterTileCount = 180; + + public const int MaxPondWaterTileCount = 210; + + public static int[] BlacklistedNearbyTiles => new int[] + { + TileID.Sand, + TileID.Sandstone, + TileID.HardenedSand, + TileID.DesertFossil, + TileID.SnowBlock, + TileID.IceBlock, + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + }; + + public static void GenerateInstances() + { + float worldSize = Main.maxTilesX / 4200f; + int totalCaves = (int)(worldSize * TotalCavesInMediumWorld); + int infiniteLoopPreventerIncrement = 0; + List existingCaveAreas = new List(); + for (int i = 0; i < totalCaves - 1; i++) + { + // Use an emergency infinite loop increment. + // The placement loop is left if it exceeds an extremely large quantity. + // This exists primarily due to potential issues in small worlds. + // This will likely never be hit in typical circumstances, but it's better to be safe than sorry. + infiniteLoopPreventerIncrement++; + if (infiniteLoopPreventerIncrement >= 3000) + break; + + int x = Main.maxTilesX / 2 + WorldGen.genRand.Next(-MaxHorizontalDistanceFromWorldCenter, MaxHorizontalDistanceFromWorldCenter); + int y = (int)Main.worldSurface + WorldGen.genRand.Next(MinSurfaceDepth, MaxSurfaceDepth); + int width = (int)(WorldGen.genRand.Next(127, 140) * worldSize); + int height = (int)(WorldGen.genRand.Next(80, 104) * worldSize); + Rectangle caveArea = Utils.CenteredRectangle(new Vector2(x, y), new Vector2(width, height)); + + // Try again if this selected location is near blacklisted tiles. + // This is done to prevent logical consistencies/intrusion on unrelated biomes. + bool needsToTryAgain = false; + for (int dx = -BlacklistedTileCheckArea; dx < BlacklistedTileCheckArea; dx++) + { + for (int dy = -BlacklistedTileCheckArea; dy < BlacklistedTileCheckArea; dy++) + { + if (!needsToTryAgain) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x + dx, y + dy); + needsToTryAgain = tile.HasTile && BlacklistedNearbyTiles.Contains(tile.TileType); + } + else + break; + } + } + + // If the blacklisted tile check was passed, check to see if the potential spot is near. + if (!needsToTryAgain) + needsToTryAgain = existingCaveAreas.Any(c => caveArea.Intersects(c)); + + if (needsToTryAgain) + { + i--; + continue; + } + + Place(caveArea); + existingCaveAreas.Add(caveArea); + } + + // Generate a single, special living tree on the surface with a floral paradise biome underneath. + for (int i = 0; i < 2000; i++) + { + int x = Main.maxTilesX / 2 + WorldGen.genRand.Next(330, MaxHorizontalDistanceFromWorldCenter) * WorldGen.genRand.NextBool().ToDirectionInt(); + int y = (int)Main.worldSurface - 120; + if (!FloralParadiseTree.Create(new(x, y))) + continue; + break; + } + } + + public static void Place(Rectangle placementArea) + { + int seed = WorldGen.genRand.Next(); + int pondCount = WorldGen.genRand.Next(3); + int smallVineCount = WorldGen.genRand.Next(MinSmallVineCount, MaxSmallVineCount); + int waterTileCount = WorldGen.genRand.Next(MinPondWaterTileCount, MaxPondWaterTileCount); + int smallFlowerCount = WorldGen.genRand.Next(150, 200); + int bigTreeCount = WorldGen.genRand.Next(2, 5); + + CutOutCave(placementArea, seed, out bool[,] grassDirtMap); + GenerateDirtBehindGrass(placementArea, grassDirtMap); + GenerateWalls(placementArea, unchecked(seed - 8)); + GenerateVines(placementArea, smallVineCount); + GeneratePonds(placementArea, waterTileCount, pondCount); + CreateScenicPlants(placementArea, smallFlowerCount); + CreateTrees(placementArea, bigTreeCount); + + // Place a blood orange. THIS IS FOR TESTING PURPOSES. + for (int i = 0; i < 1; i++) + { + int x = placementArea.X + WorldGen.genRand.Next(24, placementArea.Width - 24); + int y = placementArea.Y + WorldGen.genRand.Next(18, placementArea.Height - 18); + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (!WorldGen.SolidTile(x, y + 1) || !WorldGen.SolidTile(x + 1, y + 1) || tile.HasTile || tile.LiquidAmount > 0) + { + i--; + continue; + } + x--; + + for (int dx = 0; dx < 3; dx++) + { + for (int dy = 0; dy < 3; dy++) + { + Main.tile[x + dx, y + dy].TileType = (ushort)ModContent.TileType(); + Main.tile[x + dx, y + dy].TileFrameX = (short)(dx * 18); + Main.tile[x + dx, y + dy].TileFrameY = (short)(dy * 18); + Main.tile[x + dx, y + dy].Get().HasTile = true; + } + } + } + } + + public static void CutOutCave(Rectangle placementArea, int seed, out bool[,] grassDirtMap) + { + // Calculate the initial cell states with perlin noise. + // To be specific, it uses values near the midpoint of 0.5 as open caves. + // This helps solve the problem of having disconnected areas that using min/max threshold values causes. + bool[,] caveState = new bool[placementArea.Width, placementArea.Height]; + for (int i = 0; i < placementArea.Width; i++) + { + for (int j = 0; j < placementArea.Height; j++) + { + float noise = CalamityUtils.PerlinNoise2D(i / 240f, j / 180f, 3, seed) * 0.5f + 0.5f; + caveState[i, j] = MathHelper.Distance(noise, 0.56f) < CaveOpennessFactor; + if (WorldGen.genRand.NextBool(3)) + caveState[i, j] = WorldGen.genRand.NextBool(); + } + } + + // Repeatedly smoothen out the cave state with celluar automata. + for (int i = 0; i < 8; i++) + caveState = CalamityUtils.SimulateCelluarAutomata(caveState); + + // Reset tile states based on the above results. + ushort grassID = (ushort)ModContent.TileType(); + ushort stoneID = (ushort)ModContent.TileType(); + grassDirtMap = new bool[placementArea.Width, placementArea.Height]; + for (int x = placementArea.X; x < placementArea.X + placementArea.Width; x++) + { + for (int y = placementArea.Y; y < placementArea.Y + placementArea.Height; y++) + { + // Don't attempt to change tile data if a tile is outside of the world for some reason. + if (!WorldGen.InWorld(x, y, 1)) + continue; + + int arrayRelativeX = x - placementArea.X; + int arrayRelativeY = y - placementArea.Y; + Vector2 normalizedPosition = new Vector2(arrayRelativeX / (float)placementArea.Width, arrayRelativeY / (float)placementArea.Height); + float distanceFromCenter = Vector2.Distance(normalizedPosition, Vector2.One * 0.5f) * 1.75f; + if (distanceFromCenter > 1f) + distanceFromCenter = 1f; + + float ditherChance = Utils.GetLerpValue(0.97f, 0.72f, distanceFromCenter, true); + + Main.tile[x, y].WallType = WallID.None; + if (WorldGen.genRand.NextFloat() < ditherChance) + { + if (!caveState[arrayRelativeX, arrayRelativeY] && distanceFromCenter < 0.7f) + Main.tile[x, y].ClearEverything(); + else + { + bool useGrass = CalamityUtils.CountCellsAtPosition(caveState, arrayRelativeX, arrayRelativeY, false) >= 1 && distanceFromCenter < 0.72f; + grassDirtMap[arrayRelativeX, arrayRelativeY] = useGrass; + Main.tile[x, y].ClearEverything(); + Main.tile[x, y].ResetToType(useGrass ? grassID : stoneID); + WorldGen.SquareTileFrame(x, y); + } + } + } + } + } + + public static void GenerateDirtBehindGrass(Rectangle placementArea, bool[,] grassDirtMap) + { + ushort dirtID = (ushort)ModContent.TileType(); + ushort stoneID = (ushort)ModContent.TileType(); + ushort grassID = (ushort)ModContent.TileType(); + + // Perform secondary passes that overlay dirt behind grass. + for (int i = 0; i < TotalSecondaryDirtCreationPasses + 1; i++) + { + for (int x = placementArea.X; x < placementArea.X + placementArea.Width; x++) + { + for (int y = placementArea.Y; y < placementArea.Y + placementArea.Height; y++) + { + int arrayRelativeX = x - placementArea.X; + int arrayRelativeY = y - placementArea.Y; + bool nearbyGrassOrDirt = false; + if (arrayRelativeX - 1 >= 0 && grassDirtMap[arrayRelativeX - 1, arrayRelativeY]) + nearbyGrassOrDirt = true; + else if (arrayRelativeX + 1 < placementArea.Width && grassDirtMap[arrayRelativeX + 1, arrayRelativeY]) + nearbyGrassOrDirt = true; + else if (arrayRelativeY - 1 >= 0 && grassDirtMap[arrayRelativeX, arrayRelativeY - 1]) + nearbyGrassOrDirt = true; + else if (arrayRelativeY + 1 < placementArea.Height && grassDirtMap[arrayRelativeX, arrayRelativeY + 1]) + nearbyGrassOrDirt = true; + + // The first pass always generates dirt behind grass. + // However, successive passes only generate dirt with a specific probability. + // This makes the dirt feel more natural and connected to the underlying rock. + bool canPerformPlacement = i == 0 || WorldGen.genRand.NextFloat() < SecondaryPassDirtCreationChance; + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (canPerformPlacement && tile.HasTile && tile.TileType == stoneID && nearbyGrassOrDirt) + Main.tile[x, y].TileType = dirtID; + } + } + + // Reset the dirt/grass map for the next pass. + // This is skipped on the last pass for performance reasons, since the map won't be used after that point. + if (i >= TotalSecondaryDirtCreationPasses) + continue; + + for (int x = placementArea.X; x < placementArea.X + placementArea.Width; x++) + { + for (int y = placementArea.Y; y < placementArea.Y + placementArea.Height; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + int arrayRelativeX = x - placementArea.X; + int arrayRelativeY = y - placementArea.Y; + grassDirtMap[arrayRelativeX, arrayRelativeY] = tile.TileType == grassID || tile.TileType == dirtID; + } + } + } + } + + public static void GenerateWalls(Rectangle placementArea, int seed) + { + for (int x = placementArea.X; x < placementArea.X + placementArea.Width; x++) + { + for (int y = placementArea.Y; y < placementArea.Y + placementArea.Height; y++) + { + float noise = CalamityUtils.PerlinNoise2D(x / 160f, y / 160f, 3, seed) * 0.5f + 0.5f; + if (MathHelper.Distance(noise, 0.555f) < WallOpennessFactor) + Main.tile[x, y].WallType = WorldGen.genRand.NextBool(4) ? WallID.GrassUnsafe : WallID.FlowerUnsafe; + } + } + } + + public static void GenerateVines(Rectangle placementArea, int smallVineCount) + { + ushort[] vineIDs = new ushort[] + { + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + }; + + // Place small vines. + for (int i = 0; i < smallVineCount; i++) + { + int x = placementArea.X + WorldGen.genRand.Next(24, placementArea.Width - 24); + int y = placementArea.Y + WorldGen.genRand.Next(18, placementArea.Height - 18); + + // Ensure that the initial tile is empty and that there's a solid tile above for the vine to hang from. + // If these conditions are not met, try again. + if (CalamityUtils.ParanoidTileRetrieval(x, y).HasTile || !WorldGen.SolidTile(x, y - 1)) + { + i--; + continue; + } + + // Search to ensure that nothing is in the way of the vine's potential positions. + // If something is, try again. + int vineLength = WorldGen.genRand.Next(MinSmallVineLength, MaxSmallVineLength + 1); + bool neeedsToTryAgain = false; + for (int dy = 0; dy < vineLength; dy++) + { + if (CalamityUtils.ParanoidTileRetrieval(x, y + dy).HasTile) + { + neeedsToTryAgain = true; + break; + } + } + + if (neeedsToTryAgain) + { + i--; + continue; + } + + // Perform placement. + ushort vineID = WorldGen.genRand.Next(vineIDs); + for (int dy = 0; dy < vineLength; dy++) + { + Main.tile[x, y + dy].TileType = vineID; + if (dy == vineLength - 1) + { + Main.tile[x, y + dy].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18); + Main.tile[x, y + dy].TileFrameY = 54; + } + else + { + Main.tile[x, y + dy].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18); + Main.tile[x, y + dy].TileFrameY = (short)(WorldGen.genRand.Next(3) * 18); + } + Main.tile[x, y + dy].Get().HasTile = true; + WorldGen.SquareTileFrame(x, y, true); + } + } + } + + public static void GeneratePonds(Rectangle placementArea, int waterTileCount, int pondCount) + { + for (int i = 0; i < pondCount; i++) + { + int x = placementArea.X + WorldGen.genRand.Next(24, placementArea.Width - 24); + int y = placementArea.Y + WorldGen.genRand.Next(24, placementArea.Height - 24); + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (tile.HasTile || tile.LiquidAmount > 0) + { + i--; + continue; + } + + // Go upward once an open area is found. This is where water will be created. + Point waterSpawnPoint = new Point(x, y); + for (int dy = 0; dy < 100; dy++) + { + if (CalamityUtils.ParanoidTileRetrieval(x, y - dy).HasTile) + { + waterSpawnPoint.Y -= dy - 1; + break; + } + } + + // Create a predetermined quantity of water via recursion. + // This starts at the initial water spawn point and the expands outward in all four cardinal directions repeatedly until either no more locations + // are valid or the water limit has been reached. + int increment = 0; + RecursivelyFillAreaWithWater(x, y, waterTileCount, ref increment); + + // Settle water and create waterfalls. + Liquid.QuickWater(3); + WorldGen.WaterCheck(); + Liquid.quickSettle = true; + Liquid.UpdateLiquid(); + WorldGen.WaterCheck(); + Liquid.quickSettle = false; + + for (int dy = 0; dy < 50; dy++) + { + if (CalamityUtils.ParanoidTileRetrieval(x, y + dy).LiquidAmount > 0) + { + Main.tile[x, y + dy - 8].Get().HasTile = true; + Main.tile[x, y + dy - 8].TileType = (ushort)ModContent.TileType(); + break; + } + } + } + } + + public static void CreateScenicPlants(Rectangle placementArea, int smallFlowerCount) + { + for (int i = 0; i < smallFlowerCount; i++) + { + int x = placementArea.X + WorldGen.genRand.Next(16, placementArea.Width - 16); + int y = placementArea.Y + WorldGen.genRand.Next(12, placementArea.Height - 12); + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (tile.HasTile || tile.LiquidAmount > 0 || !WorldGen.SolidTile(x, y + 1)) + { + i--; + continue; + } + + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); + Main.tile[x, y].TileFrameX = (short)(WorldGen.genRand.Next(8) * 18); + Main.tile[x, y].TileFrameY = 0; + Main.tile[x, y].Get().HasTile = true; + } + + // TODO -- Move this to another method. + int tries = 0; + WeightedRandom tileSelector = new(WorldGen.genRand); + tileSelector.Add(ModContent.TileType(), 0.66D); + tileSelector.Add(ModContent.TileType(), 0.66D); + tileSelector.Add(ModContent.TileType(), 0.66D); + tileSelector.Add(ModContent.TileType(), 0.66D); + tileSelector.Add(ModContent.TileType(), 0.66D); + tileSelector.Add(ModContent.TileType(), 1D); + tileSelector.Add(ModContent.TileType(), 1D); + tileSelector.Add(ModContent.TileType(), 1D); + tileSelector.Add(ModContent.TileType(), 1D); + tileSelector.Add(ModContent.TileType(), 0.5D); + tileSelector.Add(ModContent.TileType(), 1D); + tileSelector.Add(ModContent.TileType(), 1D); + tileSelector.Add(ModContent.TileType(), 1D); + tileSelector.Add(ModContent.TileType(), 1D); + tileSelector.Add(ModContent.TileType(), 1D); + tileSelector.Add(ModContent.TileType(), 1D); + tileSelector.Add(ModContent.TileType(), 1D); + + for (int i = 0; i < 2400; i++) + { + tries++; + if (tries >= 16000) + break; + + int x = placementArea.X + WorldGen.genRand.Next(16, placementArea.Width - 16); + int y = placementArea.Y + WorldGen.genRand.Next(12, placementArea.Height - 12); + if (WorldGen.genRand.NextBool() && WorldUtils.Find(new(x, y), Searches.Chain(new Searches.Down(400), new Conditions.IsSolid()), out Point result)) + y = result.Y - 1; + + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (tile.HasTile || tile.LiquidAmount > 0) + { + i--; + continue; + } + + int tileID = tileSelector.Get(); + WorldGen.PlaceTile(x, y, tileID, style: WorldGen.genRand.Next(TileObjectData.GetTileData(tileID, 0).RandomStyleRange)); + } + } + + public static void CreateTrees(Rectangle placementArea, int treeCount) + { + int tries = 0; + int treeID = ModContent.TileType(); + + for (int i = 0; i < treeCount; i++) + { + tries++; + + int x = placementArea.X + WorldGen.genRand.Next(16, placementArea.Width - 16); + int y = placementArea.Y + WorldGen.genRand.Next(12, placementArea.Height - 12); + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + Vector2 checkTopLeft = new Vector2(x, y).ToWorldCoordinates() - new Vector2(120f, 300f); + Vector2 checkArea = new Vector2(240f, 200f); + + if (tries >= 2500) + break; + + if (tile.HasTile || tile.LiquidAmount > 0 || !WorldGen.SolidTile(x, y + 1) || + !TileObject.CanPlace(x, y, treeID, 0, 0, out _, true, checkStay: true) || + Collision.SolidCollision(checkTopLeft, (int)checkArea.X, (int)checkArea.Y)) + { + i--; + continue; + } + + WorldGen.PlaceTile(x, y, treeID); + } + } + + #region Biome-Specific Utilities + + public static void RecursivelyFillAreaWithWater(int x, int y, int limit, ref int increment) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (tile.HasTile || tile.LiquidAmount > 127) + return; + + increment++; + if (increment >= limit) + return; + + Main.tile[x, y].LiquidAmount = 255; + RecursivelyFillAreaWithWater(x + 1, y, limit, ref increment); + RecursivelyFillAreaWithWater(x - 1, y, limit, ref increment); + RecursivelyFillAreaWithWater(x, y + 1, limit, ref increment); + RecursivelyFillAreaWithWater(x, y - 1, limit, ref increment); + } + + #endregion Biome-Specific Utilities + } +} diff --git a/World/Minibiomes/FloralParadiseTree.cs b/World/Minibiomes/FloralParadiseTree.cs new file mode 100644 index 0000000000..4858ac842a --- /dev/null +++ b/World/Minibiomes/FloralParadiseTree.cs @@ -0,0 +1,139 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.GameContent.Generation; +using Terraria.ID; +using Terraria.WorldBuilding; + +namespace CalamityMod.World.Minibiomes +{ + public class FloralParadiseTree + { + public const int TrunkHeight = 220; + + public const int TrunkWidth = 10; + + public const int TrunkHollowSpace = 4; + + public const int RootCount = 5; + + public static bool Create(Point placementPosition) + { + float worldSize = Main.maxTilesX / 4200f; + if (!WorldUtils.Find(new Point(placementPosition.X - 3, placementPosition.Y), Searches.Chain(new Searches.Down(400), new GenCondition[] + { + new Conditions.IsSolid().AreaAnd(6, 1) + }), out Point ground)) + { + return false; + } + + ground.Y += (int)(TrunkHeight * 0.645f); + + // Get all tiles in a specific area. + Dictionary tileCounts = new Dictionary(); + WorldUtils.Gen(new Point(ground.X - TrunkHeight / 2, ground.Y - TrunkHeight / 2), new Shapes.Rectangle(TrunkHeight, TrunkHeight), new Actions.TileScanner(new ushort[] + { + TileID.Dirt, + TileID.Stone, + TileID.Mud, + TileID.JungleGrass, + TileID.SnowBlock, + TileID.Sand, + }).Output(tileCounts)); + + int overworldTileCount = tileCounts[TileID.Dirt] + tileCounts[TileID.Stone]; + int jungleTileCount = tileCounts[TileID.Mud] + tileCounts[TileID.JungleGrass]; + + // Avoid jungles, deserts, and snow biomes. + if (tileCounts[TileID.SnowBlock] > jungleTileCount || jungleTileCount > overworldTileCount || overworldTileCount < 50 || tileCounts[TileID.Sand] >= 50) + return false; + + float trunkRotation = WorldGen.genRand.NextFloatDirection() * 0.116f; + for (int i = 0; i < TrunkHeight; i += 2) + { + Point currentPoint = (ground.ToVector2() - Vector2.UnitY.RotatedBy(trunkRotation) * i).ToPoint(); + + // Create the trunk. + WorldUtils.Gen(currentPoint, new Shapes.Rectangle(TrunkWidth, TrunkWidth), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceWall(WallID.LivingWood, true), + new Actions.PlaceTile(TileID.LivingMahogany) + })); + } + + // Generate roots. + for (int i = 0; i < RootCount; i++) + { + int rootLength = (int)(TrunkHeight * WorldGen.genRand.NextFloat(0.425f, 0.7f)); + float rootAngle = MathHelper.Lerp(-0.89f, 0.89f, i / (float)(RootCount - 1f)) + WorldGen.genRand.NextFloatDirection() * 0.074f + trunkRotation + MathHelper.PiOver2; + WorldUtils.Gen(ground, new ShapeRoot(rootAngle, rootLength, TrunkWidth - 1), Actions.Chain(new GenAction[] + { + new Actions.SetTile(TileID.LivingMahogany), + })); + } + + List branchEnds = new(); + Point topOfTrunk = (ground.ToVector2() - Vector2.UnitY.RotatedBy(trunkRotation) * (TrunkHeight - 4f)).ToPoint(); + + // Create side branches. + for (int i = 0; i < RootCount - 1; i++) + { + int branchLength = WorldGen.genRand.Next(26, 49); + float branchDirectionX = -WorldGen.genRand.NextFloat(1.25f, 4.5f) * WorldGen.genRand.NextBool().ToDirectionInt(); + float branchDirectionY = -2f; + Vector2 branchDirection = new Vector2(branchDirectionX, branchDirectionY).SafeNormalize(Vector2.UnitX); + Point branchStart = (ground.ToVector2() - Vector2.UnitY.RotatedBy(trunkRotation) * Main.rand.NextFloat(0.45f, 0.84f) * TrunkHeight).ToPoint(); + WorldUtils.Gen(branchStart, new ShapeBranch(branchDirection.ToRotation(), branchLength).OutputEndpoints(branchEnds), Actions.Chain(new GenAction[] + { + new Actions.SetTile(TileID.LivingMahogany), + })); + } + + // Create branch leaves. + using (List.Enumerator enumerator = branchEnds.GetEnumerator()) + { + while (enumerator.MoveNext()) + { + WorldUtils.Gen(enumerator.Current, new Shapes.Circle(4), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(4, 2, 0.3), + new Actions.SetTile(TileID.LivingMahoganyLeaves), + new Actions.SetFrames(true) + })); + } + } + + // Create leaves at the top of the trunk. + WorldUtils.Gen(topOfTrunk, new Shapes.Circle(TrunkWidth * 2), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(3, 2, 0.1), + new Actions.SetTile(TileID.LivingMahoganyLeaves), + new Actions.SetFrames(true) + })); + + // Generate a cave in the roots of the biome. + int width = (int)(WorldGen.genRand.Next(104, 120) * worldSize); + int height = (int)(WorldGen.genRand.Next(88, 110) * worldSize); + Vector2 cavePosition = ground.ToVector2() + Vector2.UnitY * height * 0.44f; + Rectangle caveArea = Utils.CenteredRectangle(cavePosition, new Vector2(width, height)); + FloralParadiseMinibiome.Place(caveArea); + + // Clear out the inner part of the tiles to create an open space in the tree. + for (int i = 0; i < TrunkHeight * 0.9f; i += 2) + { + Point currentPoint = (ground.ToVector2() - Vector2.UnitY.RotatedBy(trunkRotation) * i).ToPoint(); + Point center = (currentPoint.ToVector2() + Vector2.One * TrunkHollowSpace - Vector2.UnitX * 2f).ToPoint(); + WorldUtils.Gen(center, new Shapes.Rectangle(TrunkHollowSpace, TrunkHollowSpace), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(true), + new Actions.PlaceWall(WallID.LivingWood, true) + })); + } + + return true; + } + } +} diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index f020932486..361adf0026 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -211,9 +211,10 @@ namespace CalamityMod.World public static void SulphurSeaGenerationAfterAbyss() { - CreateBeachNearSea(); + CreateBeach(); ClearOutStrayTiles(); ClearAloneTiles(); + //PlaceSulphurReef(); var scrapPilePositions = PlaceScrapPiles(); GenerateColumnsInCaverns(); GenerateHardenedSandstone(); @@ -670,7 +671,149 @@ namespace CalamityMod.World } } - public static void CreateBeachNearSea() + /* + public static void PlaceSulphurReef() + { + int beachWidth = WorldGen.genRand.Next(150, 190 + 1); + int x = GetActualX(BiomeWidth - 10); + float xRatio = Utils.GetLerpValue(BiomeWidth - 10, BiomeWidth + beachWidth, x, true); + int depth = (int)(Math.Sin((1f - xRatio) * MathHelper.PiOver2) * BeachMaxDepth + 1f); + + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); + + Point origin = new Point(x + (x < Main.maxTilesX / 2 ? -35 : 35), YStart + depth + 80); + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); + + float angle = MathHelper.Pi * 0.15f; + float otherAngle = MathHelper.PiOver2 - angle; + + int size = 80 + (Main.maxTilesX / 180); + float actualSize = size * 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; + + //first, place a basalt barrier around where the biome will be + for (int X = origin.X - size - 3; X <= origin.X + size + 3; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckReefsCircle(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist)) + { + float percent = dist / constant; + float blurPercent = 0.98f; + + if (percent > blurPercent) + { + + } + else + { + //clear absolutely everything before generating the caverns + Main.tile[X, Y].ClearEverything(); + + //generate perlin noise caves + float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 20f, Y / 20f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 350f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 350f, 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 + { + WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + } + + Main.tile[X, Y].WallType = (ushort)ModContent.WallType(); + WorldGen.PlaceWall(X, Y, ModContent.WallType()); + + Main.tile[X, Y].Get().LiquidType = LiquidID.Water; + Main.tile[X, Y].LiquidAmount = byte.MaxValue; + } + } + } + } + + //place sand + for (int X = origin.X - size - 3; X <= origin.X + size + 3; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckReefsCircle(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist)) + { + 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) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + SunkenSea.PlaceSand(X, Y, 3, ModContent.TileType()); + } + } + } + } + + //cleanup + for (int X = origin.X - size - 3; X <= origin.X + size + 3; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckReefsCircle(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist)) + { + //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); + } + + Tile.SmoothSlope(X, Y); + } + } + } + } + + public static bool CheckReefsCircle(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance) + { + Vector2 point = tile.ToWorldCoordinates(); + + float distY = center.Y - point.Y; + point.Y -= distY * 3f; + + float distance1 = Vector2.Distance(point, focus1); + float distance2 = Vector2.Distance(point, focus2); + distance = distance1 + distance2; + + return distance <= distanceConstant; + } + */ + + public static void CreateBeach() { int beachWidth = WorldGen.genRand.Next(150, 190 + 1); var searchCondition = Searches.Chain(new Searches.Down(3000), new Conditions.IsSolid()); diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 20e6d1b40c..9459d720a1 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Tiles.SunkenSea.Ambient; using CalamityMod.Walls; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -13,825 +15,1322 @@ namespace CalamityMod.World { public class SunkenSea { - private struct Hub + /* + Dylandoe checklist: + + -Make ambient tiles naturally grow on sunken sea tiles/sands (only eutrophic sand is done) + -Add basalt slab block + -Add navystone brick wall + -Add the wall corals properly + -Make sunken sea walls produce water + */ + + public static void PlaceTimelessShores(int startPosX, int startPosY) { - public Vector2 Position; + int biomeSize = 250 + (Main.maxTilesX / 180); - public Hub(Vector2 position) + //place a box of circles to serve as the main "area" for the biome + for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X += 25) { - Position = position; - } - - public Hub(float x, float y) - { - Position = new Vector2(x, y); - } - } - - private class Cluster : List - { - } - - private class ClusterGroup : List - { - public int Width; - - public int Height; - - private void SearchForCluster(bool[,] hubMap, List pointCluster, int x, int y, int level = 2) - { - pointCluster.Add(new Point(x, y)); - hubMap[x, y] = false; - level--; - if (level == -1) + for (int Y = startPosY - 50; Y <= startPosY + 50; Y += 20) { - return; - } - if (x > 0 && hubMap[x - 1, y]) - { - SearchForCluster(hubMap, pointCluster, x - 1, y, level); - } - if (x < hubMap.GetLength(0) - 1 && hubMap[x + 1, y]) - { - SearchForCluster(hubMap, pointCluster, x + 1, y, level); - } - if (y > 0 && hubMap[x, y - 1]) - { - SearchForCluster(hubMap, pointCluster, x, y - 1, level); - } - if (y < hubMap.GetLength(1) - 1 && hubMap[x, y + 1]) - { - SearchForCluster(hubMap, pointCluster, x, y + 1, level); + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(25), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); } } - private void AttemptClaim(int x, int y, int[,] clusterIndexMap, List> pointClusters, int index) //Attempts to create a cluster + //clear a smaller square out of the center where the biomes stuff will be + for (int X = startPosX - biomeSize + 35; X <= startPosX + biomeSize - 35; X++) { - int clusterPos = clusterIndexMap[x, y]; - if (clusterPos != -1 && clusterPos != index) + for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) { - int clusterHeight = (WorldGen.genRand.NextBool(2)) ? -1 : index; - foreach (Point current in pointClusters[clusterPos]) + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(2, 5)), Actions.Chain(new GenAction[] { - clusterIndexMap[current.X, current.Y] = clusterHeight; - } + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear() + })); } } - public void Generate(int width, int height) //Creates clusters for cluster group + //place little islands + for (int MoundX = startPosX - biomeSize + 35; MoundX <= startPosX + biomeSize - 35; MoundX += WorldGen.genRand.Next(60, 120)) { - Width = width; - Height = height; - Clear(); - bool[,] array = new bool[width, height]; - int clusterPos = (width >> 1) - 1; - int clusterHeight = (height >> 1) - 1; - int clusterSize = (clusterPos + 1) * (clusterPos + 1); - Point point = new Point(clusterPos, clusterHeight); - for (int i = point.Y - clusterHeight; i <= point.Y + clusterHeight; i++) + int MoundY = startPosY + 60; + + ShapeData mound = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(MoundX, MoundY), new Shapes.Mound(30, 45), Actions.Chain(new GenAction[] + { + blotchMod.Output(mound) + })); + WorldUtils.Gen(new Point(MoundX, MoundY), new ModShapes.All(mound), Actions.Chain(new GenAction[] + { + new Actions.Clear(), new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + + //place a wall pillar above an island + PlaceShoresWallPillar(startPosY, MoundX); + } + + //clear the tops off of the mounds so they have flat surfaces the player can walk on + for (int MoundClearX = startPosX - biomeSize + 37; MoundClearX <= startPosX + biomeSize - 37; MoundClearX++) + { + for (int MoundClearY = startPosY - 35; MoundClearY <= startPosY + 35; MoundClearY++) { - float num4 = (float)clusterPos / (float)clusterHeight * (float)(i - point.Y); - int num5 = Math.Min(clusterPos, (int)Math.Sqrt((float)clusterSize - num4 * num4)); - for (int j = point.X - num5; j <= point.X + num5; j++) - { - array[j, i] = WorldGen.genRand.NextBool(2); - } + WorldGen.KillTile(MoundClearX, MoundClearY); } - List> list = new List>(); - for (int k = 0; k < array.GetLength(0); k++) + } + + //place water below the clear barrier for the islands so that theres water inbetween them + for (int WaterX = startPosX - biomeSize + 35; WaterX <= startPosX + biomeSize - 35; WaterX++) + { + for (int WaterY = startPosY + 37; WaterY <= startPosY + 50; WaterY++) { - for (int l = 0; l < array.GetLength(1); l++) - { - if (array[k, l] && WorldGen.genRand.NextBool(2)) - { - List list2 = new List(); - SearchForCluster(array, list2, k, l, 2); - if (list2.Count > 2) - { - list.Add(list2); - } - } - } + Main.tile[WaterX, WaterY].Get().LiquidType = LiquidID.Water; + Main.tile[WaterX, WaterY].LiquidAmount = byte.MaxValue; } - int[,] array2 = new int[array.GetLength(0), array.GetLength(1)]; - for (int m = 0; m < array2.GetLength(0); m++) + } + + //slope tiles + for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X++) + { + for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) { - for (int n = 0; n < array2.GetLength(1); n++) - { - array2[m, n] = -1; - } + Tile.SmoothSlope(X, Y); } - for (int num6 = 0; num6 < list.Count; num6++) + } + + //place layer of sand on valid runestone blocks + for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X++) + { + for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) { - foreach (Point current in list[num6]) + bool canPlaceSand = false; + + 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 && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) { - array2[current.X, current.Y] = num6; + canPlaceSand = true; } - } - for (int num7 = 0; num7 < list.Count; num7++) - { - foreach (Point point2 in list[num7]) + + if (canPlaceSand) { - int x = point2.X; - int y = point2.Y; - if (array2[x, y] == -1) - { - break; - } - int index = array2[x, y]; - if (x > 0) - { - AttemptClaim(x - 1, y, array2, list, index); - } - if (x < array2.GetLength(0) - 1) - { - AttemptClaim(x + 1, y, array2, list, index); - } - if (y > 0) - { - AttemptClaim(x, y - 1, array2, list, index); - } - if (y < array2.GetLength(1) - 1) - { - AttemptClaim(x, y + 1, array2, list, index); - } - } - } - using (List>.Enumerator enumerator2 = list.GetEnumerator()) - { - while (enumerator2.MoveNext()) - { - enumerator2.Current.Clear(); - } - } - for (int num8 = 0; num8 < array2.GetLength(0); num8++) - { - for (int num9 = 0; num9 < array2.GetLength(1); num9++) - { - if (array2[num8, num9] != -1) - { - list[array2[num8, num9]].Add(new Point(num8, num9)); - } - } - } - foreach (List current2 in list) - { - if (current2.Count < 4) - { - current2.Clear(); - } - } - foreach (List current3 in list) - { - Cluster cluster = new Cluster(); - if (current3.Count > 0) - { - foreach (Point current4 in current3) - { - cluster.Add(new Hub((float)current4.X + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f, (float)current4.Y + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f)); - } - Add(cluster); + PlaceSand(X, Y, 5, ModContent.TileType()); } } } } - // Generates clumps / clusters / chunks of general tiles in the Sunken Sea area - private static void PlaceClusters(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector) + //places a pillar of walls along the height of the timeless shores biome + public static void PlaceShoresWallPillar(int startPosY, int XPosition) { - int totalWidth = (int)(terrainApplicationScaleVector.X * clusters.Width); - int totalHeight = (int)(terrainApplicationScaleVector.Y * clusters.Height); - Vector2 totalScale = new Vector2(totalWidth, totalHeight); - Vector2 individualScale = new Vector2(clusters.Width, clusters.Height); - - //I was a bit worried about editing anything in this loop too drastically, so i just changed all instances of placing navystone to eutrophic sand - for (int i = -20; i < totalWidth + 20; i++) + for (int Y = startPosY - 55; Y <= startPosY + 50; Y++) { - for (int j = -20; j < totalHeight + 20; j++) + int RandomX = + WorldGen.genRand.Next(-8, 8); + + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(XPosition + RandomX, Y), new Shapes.Circle(WorldGen.genRand.Next(3, 7)), Actions.Chain(new GenAction[] { - float num3 = 0f; - int clusterAmt = -1; - float num5 = 0f; - int num6 = i + start.X; - int num7 = j + start.Y; - Vector2 vector = new Vector2((float)i, (float)j) / totalScale * individualScale; - float num8 = (new Vector2((float)i, (float)j) / totalScale * 2f - Vector2.One).Length(); - for (int k = 0; k < clusters.Count; k++) + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(XPosition + RandomX, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.PlaceWall((ushort)ModContent.WallType()) + })); + } + } + + //sides of the sunken sea (radiant reefs) + //LeftSideBarrier is used to make the barrier of basalt either on the left or right, since the sunken sea is meant to have barriers on both sides and the reefs is generated twice + public static void PlaceRadiantReefs(int startPosX, int startPosY, bool LeftSideBarrier) + { + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); + + Point origin = new Point(startPosX, startPosY); + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); + + float angle = MathHelper.Pi * 0.15f; + float otherAngle = MathHelper.PiOver2 - angle; + + int biomeSize = 180 + (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; + + //first, place a basalt barrier on the left and right of the biome + 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, Y < origin.Y)) { - Cluster cluster = clusters[k]; - if (Math.Abs(cluster[0].Position.X - vector.X) <= 10f && Math.Abs(cluster[0].Position.Y - vector.Y) <= 10f) + float percent = dist / constant; + float blurPercent = 0.99f; + + if (percent > blurPercent) { - float num9 = 0f; - foreach (Hub current in cluster) + if (Y > origin.Y - 60) { - num9 += 1f / Vector2.DistanceSquared(current.Position, vector); - } - if (num9 > num3) - { - if (num3 > num5) + if (LeftSideBarrier) { - num5 = num3; + if (X <= origin.X && Main.tile[X - 40, Y].TileType != ModContent.TileType()) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X - 40, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X - 40, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } + } + else + { + if (X >= origin.X && Main.tile[X + 40, Y].TileType != ModContent.TileType()) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X + 40, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X + 40, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } } - num3 = num9; - clusterAmt = k; - } - else if (num9 > num5) - { - num5 = num9; } } } - float num10 = num3 + num5; - Tile tile = Main.tile[num6, num7]; - bool flag = num8 >= 0.8f; - if (num10 > 4.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent + } + } + + //generate the actual 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, Y < origin.Y)) { - tile.ClearEverything(); - tile.LiquidAmount = 192; - if (clusterAmt % 5 == 2) + float percent = dist / constant; + float blurPercent = 0.99f; + + if (percent > blurPercent) { - tile.ResetToType((ushort)ModContent.TileType()); - tile.Get().HasTile = true; - tile.LiquidAmount = 0; + //place smaller shellstone 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); } - Tile.SmoothSlope(num6, num7, true); - } - else if (num10 > 1.8f) - { - tile.WallType = (ushort)ModContent.WallType(); - tile.LiquidAmount = 192; - if (!flag || tile.HasTile) + else { - tile.ResetToType((ushort)ModContent.TileType()); - tile.Get().HasTile = true; - Tile.SmoothSlope(num6, num7, true); - tile.LiquidAmount = 0; - } - } - else if (num10 > 0.7f || !flag) - { - tile.LiquidAmount = 192; - if (!flag || tile.HasTile) - { - tile.ResetToType((ushort)ModContent.TileType()); - tile.Get().HasTile = true; - Tile.SmoothSlope(num6, num7, true); - tile.LiquidAmount = 0; - } - tile.WallType = (ushort)ModContent.WallType(); - } - else if (num10 > 0.25f) - { - float num11 = (num10 - 0.25f) / 0.45f; - if (WorldGen.genRand.NextFloat() < num11) - { - if (tile.HasTile) + //clear absolutely everything before generating the caverns + Main.tile[X, Y].ClearEverything(); + + //generate perlin noise caves + float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; + float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; + float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.280f; + + //kill or place tiles depending on the noise map + if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) { - tile.ResetToType((ushort)ModContent.TileType()); - tile.Get().HasTile = true; - Tile.SmoothSlope(num6, num7, true); - tile.WallType = (ushort)ModContent.WallType(); - tile.LiquidAmount = 0; + WorldGen.KillTile(X, Y); } else { - tile.WallType = (ushort)ModContent.WallType(); - tile.LiquidAmount = 192; + WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); } + + //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 / 80f, Y / 80f, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; + float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.280f; + + if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) + { + WorldGen.PlaceWall(X, Y, ModContent.WallType()); + } + + Main.tile[X, Y].Get().LiquidType = LiquidID.Water; + Main.tile[X, Y].LiquidAmount = byte.MaxValue; } } } } - //final cleanup loop - for (int i = -20; i < totalWidth + 20; i++) + //cleanup + for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { - for (int j = -20; j < totalHeight + 20; j++) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - int x = i + start.X; - int y = j + start.Y; - - Tile tile = Main.tile[x, y]; - Tile tileUp = Main.tile[x, y - 1]; - Tile tileDown = Main.tile[x, y + 1]; - Tile tileDown2 = Main.tile[x, y + 2]; - Tile tileLeft = Main.tile[x - 1, y]; - Tile tileRight = Main.tile[x + 1, y]; - - //lava BEGONE - if (tile.WallType == ModContent.WallType() || tile.WallType == ModContent.WallType()) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) + //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) { - tile.LiquidType = LiquidID.Water; - tile.LiquidAmount = 255; + WorldGen.KillTile(X, Y); } - //also get rid of any annoying leftover obsidian - if (tile.TileType == TileID.Obsidian) + //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); + WorldGen.KillTile(X, Y); } } + } + } - //place extra caves throughout the biome for variance - if (WorldGen.genRand.NextBool(1000)&& tile != null && tile.HasTile && - (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType())) + //place layer of sand blocks on valid surfaces + 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, Y < origin.Y)) { - TileRunner runner = new TileRunner(new Vector2(x, y), new Vector2(0, 5), new Point16(-35, 35), - new Point16(-35, 35), 15f, WorldGen.genRand.Next(25, 50), 0, false, true); - runner.Start(); - } + bool canPlaceSand = false; - //kill any random floating tiles - if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) - { - //kill any individual floating tiles - if (!tileUp.HasTile && !tileDown.HasTile && !tileLeft.HasTile && !tileRight.HasTile) + //place sand clumps on top of exposed shellstone + 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 && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) { - WorldGen.KillTile(x, y); + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 5, ModContent.TileType()); } } + } + } - //kill any random clumps of navystone without eutrophic sand around them - if (tile.TileType == ModContent.TileType() && tileUp.TileType != ModContent.TileType() && - tileDown.TileType != ModContent.TileType() && tileLeft.TileType != ModContent.TileType() && - tileRight.TileType != ModContent.TileType()) + //cleanup again + 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, Y < origin.Y)) { - WorldGen.KillTile(x, y); + //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); + } + + //if any sand is floating, put tiles below it + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + } + + Tile.SmoothSlope(X, Y); } } } } - // Adds tile variation to generated tile clusters and generates open areas with sea prism ore called "Tits" - // Generates sea prism crystals on prism ore and occasionally on navystone - private static void AddGeodes(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector, float overallBiomeScale) + //middle of the sunken sea (polyp forest) + public static void PlacePolypForest(int startPosX, int startPosY) { - int totalClusterZoneWidth = (int)(terrainApplicationScaleVector.X * clusters.Width); - int totalClusterZoneHeight = (int)(terrainApplicationScaleVector.Y * clusters.Height); - bool genCentalHole = true; - Rectangle rectangle = default; + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); - // Radius of the generated hole - int radius = (int)(WorldGen.genRand.Next(24, 28) * overallBiomeScale); - int diameter = radius * 2; + Point origin = new Point(startPosX, startPosY); + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - // Where to place the giant hole? "Center of the Sunken Sea", defined as follows: - // Dead center horizontally, and 1/3 of the way down the area - Point point = new Point(start.X + totalClusterZoneWidth / 2, start.Y + (int)(totalClusterZoneHeight * 0.33f)); + float angle = MathHelper.Pi * 0.15f; + float otherAngle = MathHelper.PiOver2 - angle; - ShapeData holeShape = new ShapeData(); - float outerRadiusPercentage = WorldGen.genRand.Next(40, 56) * 0.01f; //Small radius for ore patch to fit inside holes + int biomeSize = 120 + (Main.maxTilesX / 180); + float actualSize = biomeSize * 16f; + float constant = actualSize * 2f / (float)Math.Sin(angle); - // Y coordinate of the "bottom" of the Sunken Sea, 70% of the way down. - int sunkenSeaBottom = start.Y + (int)(totalClusterZoneHeight * 0.7f); - int smallHoles = 0; + float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); + int verticalRadius = (int)(constant / 16f); - // Scale amount of holes with world size - // 4 on Small, 6 on Normal (rounds down), 8 on Large - int totalHoleCount = (int)(4f * overallBiomeScale); + Vector2 fociOffset = Vector2.UnitY * fociSpacing; + Vector2 topFoci = center - fociOffset; + Vector2 bottomFoci = center + fociOffset; - for (int i = -20; i < totalClusterZoneWidth + 20; i++) + //place the polyp forest caverns + for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { - for (int j = -20; j < totalClusterZoneHeight + 20; j++) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - if (genCentalHole) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - // Set the rectangle for the central hole - genCentalHole = false; - rectangle = new Rectangle(start.X + totalClusterZoneWidth / 2 - radius, start.Y + (int)(totalClusterZoneHeight * 0.33f) - radius, diameter, diameter); + float percent = dist / constant; + float blurPercent = 0.98f; - WorldUtils.Gen(point, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + //biome "blending" on the edges (disabled for now) + if (percent > blurPercent) { - new Modifiers.Blotches(2, 0.6).Output(holeShape), //Adds uneven shape to the outer tiles - new Actions.ClearTile(true), //Clear all tiles - new Actions.SetLiquid(0, 192) //Leave some air pockets - })); + if (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.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth the outer parts + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } + } + else { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(4)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); + //clear absolutely everything before generating the caverns + Main.tile[X, Y].ClearEverything(); - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 6 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.SetTile((ushort)ModContent.TileType(), true) //Place outer shell - })); + //generate perlin noise caves + float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; + float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; + float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(3)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); + //kill or place tiles depending on the noise map + if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) + { + WorldGen.KillTile(X, Y); + } + else + { + WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + } - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 4 - { - new Modifiers.Blotches(2, 0.3), - new Actions.SetTile((ushort)ModContent.TileType(), true) //Place prism - })); + //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 / 80f, Y / 80f, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; + float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.235f; - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 2 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.ClearTile(true), //Clear all tiles - new Actions.SetLiquid(0, 255) - })); + if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) + { + //temporarily use navystone + WorldGen.PlaceWall(X, Y, ModContent.WallType()); + } - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(2)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); + Main.tile[X, Y].Get().LiquidType = LiquidID.Water; + Main.tile[X, Y].LiquidAmount = byte.MaxValue; + } } + } + } - // Set the point for non-central holes - int smallHoleX = WorldGen.genRand.Next(start.X + 30, start.X + totalClusterZoneWidth - 30); - int smallHoleY = WorldGen.genRand.Next(start.Y + 20, sunkenSeaBottom); - point = new Point(smallHoleX, smallHoleY); - - if (smallHoles < totalHoleCount && WorldGen.genRand.NextBool(3)&& !rectangle.Contains(point)) + //cleanup + 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, Y < origin.Y)) { - smallHoles++; - int radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * overallBiomeScale); - WorldUtils.Gen(point, new Shapes.Circle(radiusSmall), Actions.Chain(new GenAction[] - { - new Modifiers.Blotches(2, 0.45).Output(holeShape), - new Actions.ClearTile(true), - new Actions.SetLiquid(0, 192) - })); + //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; - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) { - new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(3)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); + WorldGen.KillTile(X, Y); + } - outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(65, 81) * 0.01); - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 4 + //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) { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.SetTile((ushort)ModContent.TileType(), true) //Place outer shell - })); - - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell - { - new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(3)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 2 - { - new Modifiers.Blotches(2, 0.3), - new Actions.SetTile((ushort)ModContent.TileType(), true) //Place prism - })); - - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.ClearTile(true), //Clear center - new Actions.SetLiquid(0, 255) - })); - - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(2)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); + WorldGen.KillTile(X, Y); + } } + } + } - int num3 = i + start.X; - int num4 = j + start.Y; - Tile tile = Main.tile[num3, num4]; - Tile testTile = Main.tile[num3, num4 + 1]; - Tile testTile2 = Main.tile[num3, num4 + 2]; - if (tile.TileType == ModContent.TileType() && (!WorldGen.SolidTile(testTile) || !WorldGen.SolidTile(testTile2))) //Tile variation + //place extra tiles + 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, Y < origin.Y)) { - tile.TileType = (ushort)ModContent.TileType(); + bool canPlaceSand = false; + + //place sand clumps on top of exposed limestone + 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 && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 5, ModContent.TileType()); + } + } + } + } + + //cleanup again + 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, Y < origin.Y)) + { + //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); + } + + //if any sand is floating, put tiles below it + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + } + + Tile.SmoothSlope(X, Y); } } } } - private static void AddTileVariance(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector, float overallBiomeScale) + //bottom of the biome (gleaming burrows) + public static void PlaceGleamingBurrows(int startPosX, int startPosY) { - int totalClusterZoneWidth = (int)(terrainApplicationScaleVector.X * clusters.Width); - int totalClusterZoneHeight = (int)(terrainApplicationScaleVector.Y * clusters.Height); - for (int k = -20; k < totalClusterZoneWidth + 20; k++) + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); + + Point origin = new Point(startPosX, startPosY); + 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; + + //place another barrier so the gleaming burrows doesnt just burst into the gully + for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X += 10) { - for (int l = -20; l < totalClusterZoneHeight + 20; l++) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y += 2) { - int num5 = k + start.X; - int num6 = l + start.Y; - Tile tile = Main.tile[num5, num6]; - if (tile.HasTile && (tile.TileType == ModContent.TileType() || - tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType())) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) { - bool flag = true; - for (int m = -1; m >= -3; m--) + float percent = dist / constant; + float blurPercent = 0.98f; + + if (percent > blurPercent) { - if (Main.tile[num5, num6 + m].HasTile) + if (Y > origin.Y + 20) { - flag = false; - break; - } - } - bool flag2 = true; - for (int n = 1; n <= 3; n++) - { - if (Main.tile[num5, num6 + n].HasTile) - { - flag2 = false; - break; - } - } - bool flag3 = true; - for (int o = -1; o >= -3; o--) - { - if (Main.tile[num5 + o, num6].HasTile) - { - flag3 = false; - break; - } - } - bool flag4 = true; - for (int p = 1; p <= 3; p++) - { - if (Main.tile[num5 + p, num6].HasTile) - { - flag4 = false; - break; - } - } - if (tile.TileType == ModContent.TileType() || ((tile.TileType == ModContent.TileType() || - tile.TileType == ModContent.TileType()) && WorldGen.genRand.NextBool(8))) - { - if (flag3 ^ flag4) - { - if (tile.Slope == 0 && !tile.IsHalfBlock) + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X, Y + 10), new Shapes.Circle(20), Actions.Chain(new GenAction[] { - Tile tile3 = Main.tile[num5 + (flag3 ? -1 : 1), num6]; - tile3.TileType = (ushort)ModContent.TileType(); - if (Main.tile[num5 - 1, num6].TileType == ModContent.TileType()) - { - Main.tile[num5 - 1, num6].TileFrameY = (short)(2 * 18); - } - else if (Main.tile[num5 + 1, num6].TileType == ModContent.TileType()) - { - Main.tile[num5 + 1, num6].TileFrameY = (short)(3 * 18); - } - tile3.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); - tile3.Get().HasTile = true; - } - } - if (flag ^ flag2) - { - if (tile.Slope == 0 && !tile.IsHalfBlock) + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X, Y + 10), new ModShapes.All(circle), Actions.Chain(new GenAction[] { - Tile tile3 = Main.tile[num5, num6 + (flag ? -1 : 1)]; - tile3.TileType = (ushort)ModContent.TileType(); - if (Main.tile[num5, num6 - 1].TileType == ModContent.TileType()) - { - Main.tile[num5, num6 - 1].TileFrameY = (short)(0 * 18); - } - else if (Main.tile[num5, num6 + 1].TileType == ModContent.TileType()) - { - Main.tile[num5, num6 + 1].TileFrameY = (short)(1 * 18); - } - tile3.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); - tile3.Get().HasTile = true; - } + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); } } } - if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + } + } + + //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)) { + float percent = dist / constant; + float blurPercent = 0.99f; + + if (percent > blurPercent) + { + if (Y > origin.Y - 50) + { + //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.Circle(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 + { + WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + } + + //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) + { + WorldGen.PlaceWall(X, Y, ModContent.WallType()); + } + + Main.tile[X, Y].Get().LiquidType = LiquidID.Water; + Main.tile[X, Y].LiquidAmount = byte.MaxValue; + } + } + } + } + + //cleanup the perlin caves + 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)) + { + //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++) + { + 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++) + { + 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)) + { + //place geodes + if (WorldGen.genRand.NextBool(800) && Main.tile[X, Y].TileType == ModContent.TileType()) + { + PlaceGeode(X, Y, WorldGen.genRand.Next(10, 17)); + } + + //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); + } + + //if any sand is floating, put tiles below it + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + } + + Tile.SmoothSlope(X, Y); + } + } + } + } + + //basalt biome underneath the sunken sea + public static void PlaceBasaltGully(int startPosX, int startPosY) + { + int biomeSize = 230 + (Main.maxTilesX / 180); + + int XLeft = GenVars.UndergroundDesertLocation.Left; + int XRight = GenVars.UndergroundDesertLocation.Right; + + //place circles of basalt along the 2 edges of the area + for (int Y = startPosY - 30; Y <= Main.maxTilesY - 260; Y += 20) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + int radius = WorldGen.genRand.Next(30, 45); + int RandomX = Main.rand.Next(-25, 25); + + WorldUtils.Gen(new Point(XLeft, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(XLeft, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall(WallID.LavaUnsafe1) + })); + + WorldUtils.Gen(new Point(XRight, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(XRight, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall(WallID.LavaUnsafe1) + })); + } + + //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance + for (int X = startPosX - biomeSize - 25; X <= startPosX + biomeSize + 25; X++) + { + for (int Y = startPosY - 30; Y <= Main.maxTilesY - 250; Y++) + { + Main.tile[X, Y].ClearEverything(); + WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + WorldGen.PlaceWall(X, Y, WallID.LavaUnsafe1); + } + } + + //place another wall of circles along the bottom of the biome so it doesnt just end unnaturally + for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X += 20) + { + int Y = Main.maxTilesY - 250; + + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(25), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall(WallID.LavaUnsafe1) + })); + } + + //place caverns and lava + for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) + { + for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) + { + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + //place caves + if (WorldGen.genRand.NextBool(350)) + { + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches( + WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), new Actions.ClearTile())); + } + + //place lava + if (WorldGen.genRand.NextBool(2000)) + { + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches( + WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), new Actions.SetLiquid(LiquidID.Lava, 255))); + } + } + } + } + + //place sand blocks + for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) + { + for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) + { + bool canPlaceSand = false; + + //place sand clumps on top of exposed basalt + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 3, ModContent.TileType()); + } + } + } + + //cleanup + for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) + { + for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) + { + //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); + } + + //if any sand is floating, put tiles below it + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + } + } + } + } + + //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) + { + 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++) + { + if (Main.tile[X, Y].WallType == WallID.LavaUnsafe1) + { + //get rid of water + if (Main.tile[X, Y].LiquidType == LiquidID.Water) + { + Main.tile[X, Y].Get().LiquidType = LiquidID.Lava; + } + + //get rid of obsidian blocks + if (Main.tile[X, Y].TileType == TileID.Obsidian) + { + WorldGen.KillTile(X, Y); + } + } + } + } + } + + //place all the ambient tiles in the sunken sea + public static void PlaceSunkenSeaAmbience() + { + //first clean up unnecessary chunks of tiles + CleanOutSmallClumps(); + + //just loop through the whole world and check for the specific tiles in the sunken sea because im lazy + for (int X = 20; X <= Main.maxTilesX - 20; X++) + { + for (int Y = 20; Y <= Main.maxTilesY - 20; Y++) + { + //place coral blobs in the radiant reefs + if (WorldGen.genRand.NextBool(100) && ((Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) || + (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile))) + { + ushort[] Corals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(2, 4)), 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(WorldGen.genRand.Next(Corals)) + })); + } + + //gleaming burrows ambient tiles + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + //brain coral if (WorldGen.genRand.NextBool(10)) { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); } - if (WorldGen.genRand.NextBool(20)) + //small brain coral + if (WorldGen.genRand.NextBool(5)) { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); } + + //tube coral + if (WorldGen.genRand.NextBool(12)) + { + WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); + } + //small tube coral if (WorldGen.genRand.NextBool(8)) { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.NextBool(20)) - { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); } - //colorful corals - if (WorldGen.genRand.NextBool(20)) + //anemonies + if (WorldGen.genRand.NextBool(10)) { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.NextBool(20)) - { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); } - if (WorldGen.genRand.NextBool(20)) + //giant navystone piles + if (WorldGen.genRand.NextBool(10)) { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + ushort[] GiantPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(GiantPiles)); } - if (WorldGen.genRand.NextBool(20)) + //small navystone piles + if (WorldGen.genRand.NextBool(5)) { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); - } + ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { //stalactites - if (WorldGen.genRand.NextBool(15)) + if (WorldGen.genRand.NextBool(10)) { ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(num5, num6 + 2, WorldGen.genRand.Next(Stalactites)); + WorldGen.PlaceObject(X, Y + 2, WorldGen.genRand.Next(Stalactites)); } - if (WorldGen.genRand.NextBool(15)) + //small stalactites + if (WorldGen.genRand.NextBool(8)) { - WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType(), true, false, -1, 0); + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType(), true, false, -1, 0); } //stalagmites - if (WorldGen.genRand.NextBool(10)) + if (WorldGen.genRand.NextBool(12)) { ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(num5, num6 - 2, WorldGen.genRand.Next(Stalagmites)); + WorldGen.PlaceObject(X, Y - 2, WorldGen.genRand.Next(Stalagmites)); } + //small stalagmites if (WorldGen.genRand.NextBool(10)) { - WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + WorldGen.PlaceTile(X, Y - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + //giant navystone piles + if (WorldGen.genRand.NextBool()) + { + ushort[] GiantPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(GiantPiles)); + } + + //small navystone piles + if (WorldGen.genRand.NextBool()) + { + ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); } } - if (!tile.HasTile) + + //radiant reefs ambient tiles + if (Main.tile[X, Y].TileType == ModContent.TileType()) { - if (tile.TileType == ModContent.TileType() || tile.WallType == ModContent.WallType()) + //multi-colored corals + if (WorldGen.genRand.NextBool(3)) { - if (WorldGen.genRand.NextBool(10)) + ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(ColoredCorals)); + } + + //blue coral trees + if (WorldGen.genRand.NextBool(4)) + { + ushort[] BlueCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BlueCorals)); + } + + //brown coral trees + if (WorldGen.genRand.NextBool(4)) + { + ushort[] BrownCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BrownCorals)); + } + + //fan coral + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); + } + + //misc corals + if (WorldGen.genRand.NextBool()) + { + ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(MiscCorals)); + } + } + + //grow depth vines on navystone + if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) + { + if (WorldGen.genRand.NextBool(7)) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + } + + //wall corals + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + if (WorldGen.genRand.NextBool(5) && !Main.tile[X + 1, Y].HasTile) + { + ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceTile(X + 2, Y, WorldGen.genRand.Next(WallCorals), true, false, -1, 0); + } + + if (WorldGen.genRand.NextBool(5) && !Main.tile[X - 1, Y].HasTile) + { + ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceTile(X - 2, Y, WorldGen.genRand.Next(WallCorals), true, false, -1, 0); + } + } + } + } + } + + //check if theres enough tiles to place sand below + public static bool PlaceSand(int X, int Y, int height, int tileType) + { + for (int j = Y; j <= Y + height; j++) + { + if (Main.tile[X, j].HasTile && Main.tile[X, j + 1].HasTile && Main.tile[X, j + 2].HasTile && Main.tile[X, j + 3].HasTile && + Main.tile[X - 1, j + 3].HasTile && Main.tile[X + 1, j + 3].HasTile) + { + Main.tile[X, j].TileType = (ushort)tileType; + } + else + { + return false; + } + } + + return true; + } + + //placing sea prism geodes + public static bool PlaceGeode(int X, int Y, int radius) + { + int crystalNearby = 0; + + //check a 20 by 20 square for other geodes before placing + for (int i = X - 20; i < X + 20; i++) + { + for (int j = Y - 20; j < Y + 20; j++) + { + //dont allow geodes to place if another one is too close + if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == ModContent.TileType()) + { + crystalNearby++; + if (crystalNearby > 0) + { + return false; + } + } + } + } + + ShapeData circle1 = new ShapeData(); + ShapeData circle2 = new ShapeData(); + ShapeData circle3 = new ShapeData(); + + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + //first circle of navystone + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle1) + })); + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle1), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + + //second circle of prisms + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle2) + })); + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle2), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + + //clear out the middle of the circle + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 9), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle3) + })); + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle3), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.SetLiquid(), + new Actions.PlaceWall((ushort)ModContent.WallType()) + })); + + return true; + } + + //method to clean up small clumps of tiles (taken from the sulphur sea generation) + public static void CleanOutSmallClumps() + { + 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(), + }; + + void getAttachedPoints(int x, int y, List points) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); + Point p = new(x, y); + + if (!blockTileTypes.Contains(t.TileType) || !t.HasTile || points.Count > 75 || points.Contains(p)) + { + return; + } + + points.Add(p); + + getAttachedPoints(x + 1, y, points); + getAttachedPoints(x - 1, y, points); + getAttachedPoints(x, y + 1, points); + getAttachedPoints(x, y - 1, points); + } + + for (int x = 20; x < Main.maxTilesX - 20; x++) + { + for (int y = 20; y < Main.maxTilesY - 20; y++) + { + List chunkPoints = new(); + getAttachedPoints(x, y, chunkPoints); + + int cutoffLimit = 75; + if (chunkPoints.Count >= 1 && chunkPoints.Count < cutoffLimit) + { + foreach (Point p in chunkPoints) + { + WorldUtils.Gen(p, new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] { - WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType(), true, false, -1, 0); - } + new Actions.ClearTile(true), + new Actions.SetLiquid() + })); } } } } } - //added this to 100% make sure the sunken sea places where it is supposed to be - static bool foundValidPosition = false; - - public static bool Place(Point origin) + //method to make sure things only generate in each biome circle + public static bool CheckInBiomeArea(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false) { - for (int y = origin.Y; y >= (int)Main.worldSurface; y--) + Vector2 point = tile.ToWorldCoordinates(); + + if (collapse) { - //check for the desert biomes walls - if (Main.tile[origin.X, y].WallType == WallID.Sandstone || Main.tile[origin.X, y].WallType == WallID.HardenedSand) - { - origin.Y = y + 50; //offset so it doesnt generate weird - foundValidPosition = true; - break; - } + float distY = center.Y - point.Y; + point.Y -= distY * 4f; } - while (foundValidPosition) - { - // 1 on Small, 1.52 on Medium, 2 on Large - float scale = Main.maxTilesX / 4200f; - // Clamp scale to prevent problems on extra large worlds - scale = MathHelper.Clamp(scale, 1f, 2f); + float distance1 = Vector2.Distance(point, focus1); + float distance2 = Vector2.Distance(point, focus2); + distance = distance1 + distance2; - // 80 on Small, 121.6 on Medium, 160 on Large - int sunkenSeaAreaX = (int)(80f * scale); - // 84-102 on Small, 127.68-155.04 on Medium, 168-204 on Large - float baseVerticalSize = 60f * scale; - float verticalScaleFactor = 1.4f + WorldGen.genRand.NextFloat(0.3f); - int sunkenSeaAreaY = (int)(verticalScaleFactor * baseVerticalSize); - - // What the fuck is this and why is it used everywhere - // As far as I can tell, this just scales up the entire Sunken Sea to be 4x wider and 2x taller than what is listed above - Vector2 arbitrary42GodVector = new Vector2(4f, 2f); - - // Place the majority of the terrain as clusters - ClusterGroup clusterGroup = new ClusterGroup(); - clusterGroup.Generate(sunkenSeaAreaX, sunkenSeaAreaY); - PlaceClusters(clusterGroup, origin, arbitrary42GodVector); - - // Place Geodes - AddGeodes(clusterGroup, origin, arbitrary42GodVector, scale); - - // Re-frame everything in some arbitrary radius - int totalWidth = (int)(arbitrary42GodVector.X * clusterGroup.Width); - int totalHeight = (int)(arbitrary42GodVector.Y * clusterGroup.Height); - int frameExcessRadius = 40; - for (int i = -frameExcessRadius; i < totalWidth + frameExcessRadius; i++) - { - for (int j = -frameExcessRadius; j < totalHeight + frameExcessRadius; j++) - { - if (i + origin.X > 0 && i + origin.X < Main.maxTilesX - 1 && j + origin.Y > 0 && j + origin.Y < Main.maxTilesY - 1) - { - WorldGen.SquareWallFrame(i + origin.X, j + origin.Y, true); - WorldUtils.TileFrame(i + origin.X, j + origin.Y, true); - Tile.SmoothSlope(i + origin.X, j + origin.Y, true); - } - } - } - - // Add Tile Variance (sand, crystals, etc.) - AddTileVariance(clusterGroup, origin, arbitrary42GodVector, scale); - - return true; - } - - return false; + return distance <= distanceConstant; } - - /* - public static void PlaceTit(int x, int y, ushort type = 165) - { - if (WorldGen.SolidTile(x, y - 1) && !Main.tile[x, y].HasTile && !Main.tile[x, y + 1].HasTile) - { - if (Main.tile[x, y - 1].TileType == (ushort)ModContent.TileType()) - { - if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y + 2].HasTile) - { - int num2 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].TileType = type; - Main.tile[x, y].Get().HasTile = true; - Main.tile[x, y].TileFrameX = (short)num2; - Main.tile[x, y].TileFrameY = 72; - } - else - { - int num3 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].TileType = type; - Main.tile[x, y].Get().HasTile = true; - Main.tile[x, y].TileFrameX = (short)num3; - Main.tile[x, y].TileFrameY = 0; - Main.tile[x, y + 1].TileType = type; - Main.tile[x, y + 1].Get().HasTile = true; - Main.tile[x, y + 1].TileFrameX = (short)num3; - Main.tile[x, y + 1].TileFrameY = 18; - } - } - } - else - { - if (WorldGen.SolidTile(x, y + 1) && !Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile) - { - if (Main.tile[x, y + 1].TileType == (ushort)ModContent.TileType()) - { - if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y - 2].HasTile) - { - int num13 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].TileType = type; - Main.tile[x, y].Get().HasTile = true; - Main.tile[x, y].TileFrameX = (short)num13; - Main.tile[x, y].TileFrameY = 90; - } - else - { - int num14 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y - 1].TileType = type; - Main.tile[x, y - 1].Get().HasTile = true; - Main.tile[x, y - 1].TileFrameX = (short)num14; - Main.tile[x, y - 1].TileFrameY = 36; - Main.tile[x, y].TileType = type; - Main.tile[x, y].Get().HasTile = true; - Main.tile[x, y].TileFrameX = (short)num14; - Main.tile[x, y].TileFrameY = 54; - } - } - } - } - } - */ } } diff --git a/build.txt b/build.txt index b80ad208f0..cf9028fcf7 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 2.0.4.002 +version = 2.0.4.003 displayName = Calamity Mod modReferences = CalamityModMusic homepage = https://discord.gg/calamity